Really, this should be it, for the passing income.
[capital-apms-progress.git] / vwr / mnt / v-valuation.w
blobe42581eeba0f6ab6cb93ea9575debbd150b53cbc
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
2 &ANALYZE-RESUME
3 /* Connected Databases
4 ttpl PROGRESS
5 */
6 &Scoped-define WINDOW-NAME CURRENT-WINDOW
7 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS V-table-Win
8 /*------------------------------------------------------------------------
9 ------------------------------------------------------------------------*/
11 CREATE WIDGET-POOL.
13 /* *************************** Definitions ************************** */
15 DEF VAR debug-mode AS LOGI NO-UNDO INITIAL No.
16 DEF VAR mode AS CHAR NO-UNDO.
17 DEF VAR committing-charge AS LOGI NO-UNDO.
19 DEF VAR maintain-enabled AS LOGI INITIAL No NO-UNDO.
21 /* _UIB-CODE-BLOCK-END */
22 &ANALYZE-RESUME
25 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
27 /* ******************** Preprocessor Definitions ******************** */
29 &Scoped-define PROCEDURE-TYPE SmartViewer
31 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
33 /* Name of first Frame and/or Browse and/or first Query */
34 &Scoped-define FRAME-NAME F-Main
36 /* External Tables */
37 &Scoped-define EXTERNAL-TABLES Valuation
38 &Scoped-define FIRST-EXTERNAL-TABLE Valuation
41 /* Need to scope the external tables to this procedure */
42 DEFINE QUERY external_tables FOR Valuation.
43 /* Standard List Definitions */
44 &Scoped-Define ENABLED-FIELDS Valuation.Amount Valuation.DateDone ~
45 Valuation.Valuer
46 &Scoped-define FIELD-PAIRS~
47 ~{&FP1}Amount ~{&FP2}Amount ~{&FP3}~
48 ~{&FP1}DateDone ~{&FP2}DateDone ~{&FP3}~
49 ~{&FP1}Valuer ~{&FP2}Valuer ~{&FP3}
50 &Scoped-define ENABLED-TABLES Valuation
51 &Scoped-define FIRST-ENABLED-TABLE Valuation
52 &Scoped-Define ENABLED-OBJECTS RECT-34 cmb_ValuationType
53 &Scoped-Define DISPLAYED-FIELDS Valuation.PropertyCode ~
54 Valuation.ValuationCode Valuation.Amount Valuation.DateDone ~
55 Valuation.Valuer
56 &Scoped-Define DISPLAYED-OBJECTS fil_Property cmb_ValuationType
58 /* Custom List Definitions */
59 /* ADM-CREATE-FIELDS,ADM-ASSIGN-FIELDS,List-3,List-4,List-5,List-6 */
61 /* _UIB-PREPROCESSOR-BLOCK-END */
62 &ANALYZE-RESUME
65 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" V-table-Win _INLINE
66 /* Actions: ? adm/support/keyedit.w ? ? ? */
67 /* STRUCTURED-DATA
68 <KEY-OBJECT>
69 THIS-PROCEDURE
70 </KEY-OBJECT>
71 <FOREIGN-KEYS>
72 </FOREIGN-KEYS>
73 <EXECUTING-CODE>
74 **************************
75 * Set attributes related to FOREIGN KEYS
77 RUN set-attribute-list (
78 'Keys-Accepted = "",
79 Keys-Supplied = ""':U).
80 /**************************
81 </EXECUTING-CODE> */
83 /* _UIB-CODE-BLOCK-END */
84 &ANALYZE-RESUME
87 /* *********************** Control Definitions ********************** */
90 /* Definitions of the field level widgets */
91 DEFINE VARIABLE cmb_ValuationType AS CHARACTER FORMAT "X(256)":U
92 LABEL "Type"
93 VIEW-AS COMBO-BOX INNER-LINES 15
94 LIST-ITEMS "Item 1"
95 SIZE 37.72 BY 1 NO-UNDO.
97 DEFINE VARIABLE fil_Property AS CHARACTER FORMAT "X(256)":U
98 VIEW-AS FILL-IN
99 SIZE 32 BY 1 NO-UNDO.
101 DEFINE RECTANGLE RECT-34
102 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
103 SIZE 46.86 BY 8.4.
106 /* ************************ Frame Definitions *********************** */
108 DEFINE FRAME F-Main
109 Valuation.PropertyCode AT ROW 1.2 COL 7.57 COLON-ALIGNED
110 LABEL "Property"
111 VIEW-AS FILL-IN
112 SIZE 5.72 BY 1
113 fil_Property AT ROW 1.2 COL 13.29 COLON-ALIGNED NO-LABEL
114 Valuation.ValuationCode AT ROW 2.2 COL 7.57 COLON-ALIGNED
115 LABEL "Valn. Code"
116 VIEW-AS FILL-IN
117 SIZE 5.72 BY 1
118 cmb_ValuationType AT ROW 4.4 COL 7.57 COLON-ALIGNED
119 Valuation.Amount AT ROW 5.6 COL 7.57 COLON-ALIGNED
120 LABEL "Valuation" FORMAT "->>>,>>>,>>9.99"
121 VIEW-AS FILL-IN
122 SIZE 11 BY 1
123 Valuation.DateDone AT ROW 6.8 COL 7.57 COLON-ALIGNED
124 LABEL "Date"
125 VIEW-AS FILL-IN
126 SIZE 11 BY 1
127 Valuation.Valuer AT ROW 8 COL 7.57 COLON-ALIGNED
128 VIEW-AS FILL-IN
129 SIZE 37.72 BY 1.05
130 RECT-34 AT ROW 1 COL 1
131 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
132 SIDE-LABELS NO-UNDERLINE THREE-D
133 AT COL 1 ROW 1 SCROLLABLE
134 FONT 10.
137 /* *********************** Procedure Settings ************************ */
139 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
140 /* Settings for THIS-PROCEDURE
141 Type: SmartViewer
142 External Tables: TTPL.Valuation
143 Allow: Basic,DB-Fields
144 Frames: 1
145 Add Fields to: EXTERNAL-TABLES
146 Other Settings: PERSISTENT-ONLY COMPILE
149 /* This procedure should always be RUN PERSISTENT. Report the error, */
150 /* then cleanup and return. */
151 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
152 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
153 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
154 RETURN.
155 END.
157 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
159 /* ************************* Create Window ************************** */
161 &ANALYZE-SUSPEND _CREATE-WINDOW
162 /* DESIGN Window definition (used by the UIB)
163 CREATE WINDOW V-table-Win ASSIGN
164 HEIGHT = 12.7
165 WIDTH = 61.14.
166 /* END WINDOW DEFINITION */
168 &ANALYZE-RESUME
171 /* *************** Runtime Attributes and UIB Settings ************** */
173 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
174 /* SETTINGS FOR WINDOW V-table-Win
175 VISIBLE,,RUN-PERSISTENT */
176 /* SETTINGS FOR FRAME F-Main
177 NOT-VISIBLE Size-to-Fit */
178 ASSIGN
179 FRAME F-Main:SCROLLABLE = FALSE
180 FRAME F-Main:HIDDEN = TRUE.
182 /* SETTINGS FOR FILL-IN Valuation.Amount IN FRAME F-Main
183 EXP-LABEL EXP-FORMAT */
184 /* SETTINGS FOR FILL-IN Valuation.DateDone IN FRAME F-Main
185 EXP-LABEL */
186 /* SETTINGS FOR FILL-IN fil_Property IN FRAME F-Main
187 NO-ENABLE */
188 /* SETTINGS FOR FILL-IN Valuation.PropertyCode IN FRAME F-Main
189 NO-ENABLE EXP-LABEL */
190 /* SETTINGS FOR FILL-IN Valuation.ValuationCode IN FRAME F-Main
191 NO-ENABLE EXP-LABEL */
192 /* _RUN-TIME-ATTRIBUTES-END */
193 &ANALYZE-RESUME
196 /* Setting information for Queries and Browse Widgets fields */
198 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
199 /* Query rebuild information for FRAME F-Main
200 _Options = "NO-LOCK"
201 _Query is NOT OPENED
202 */ /* FRAME F-Main */
203 &ANALYZE-RESUME
208 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
209 /* ************************* Included-Libraries *********************** */
211 {src/adm/method/viewer.i}
212 {inc/method/m-mntvwr.i}
214 /* _UIB-CODE-BLOCK-END */
215 &ANALYZE-RESUME
220 /* ************************ Control Triggers ************************ */
222 &Scoped-define SELF-NAME cmb_ValuationType
223 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_ValuationType V-table-Win
224 ON U1 OF cmb_ValuationType IN FRAME F-Main /* Type */
226 {inc/selcmb/scvaltyp1.i "Valuation" "ValuationType"}
227 END.
229 /* _UIB-CODE-BLOCK-END */
230 &ANALYZE-RESUME
233 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_ValuationType V-table-Win
234 ON U2 OF cmb_ValuationType IN FRAME F-Main /* Type */
236 {inc/selcmb/scvaltyp2.i "Valuation" "ValuationType"}
237 END.
239 /* _UIB-CODE-BLOCK-END */
240 &ANALYZE-RESUME
243 &UNDEFINE SELF-NAME
245 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
248 /* *************************** Main Block *************************** */
250 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
251 RUN dispatch IN THIS-PROCEDURE ('initialize':U).
252 &ENDIF
254 /************************ INTERNAL PROCEDURES ********************/
256 /* _UIB-CODE-BLOCK-END */
257 &ANALYZE-RESUME
260 /* ********************** Internal Procedures *********************** */
262 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
263 PROCEDURE adm-row-available :
264 /*------------------------------------------------------------------------------
265 Purpose: Dispatched to this procedure when the Record-
266 Source has a new row available. This procedure
267 tries to get the new row (or foriegn keys) from
268 the Record-Source and process it.
269 Parameters: <none>
270 ------------------------------------------------------------------------------*/
272 /* Define variables needed by this internal procedure. */
273 {src/adm/template/row-head.i}
275 /* Create a list of all the tables that we need to get. */
276 {src/adm/template/row-list.i "Valuation"}
278 /* Get the record ROWID's from the RECORD-SOURCE. */
279 {src/adm/template/row-get.i}
281 /* FIND each record specified by the RECORD-SOURCE. */
282 {src/adm/template/row-find.i "Valuation"}
284 /* Process the newly available records (i.e. display fields,
285 open queries, and/or pass records on to any RECORD-TARGETS). */
286 {src/adm/template/row-end.i}
288 END PROCEDURE.
290 /* _UIB-CODE-BLOCK-END */
291 &ANALYZE-RESUME
294 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE cancel-changes V-table-Win
295 PROCEDURE cancel-changes :
296 /*------------------------------------------------------------------------------
297 Purpose:
298 ------------------------------------------------------------------------------*/
300 IF mode = "Add" THEN RUN delete-valuation.
301 RUN check-modified( "CLEAR" ).
302 RUN dispatch( 'exit':U ).
304 END PROCEDURE.
306 /* _UIB-CODE-BLOCK-END */
307 &ANALYZE-RESUME
310 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE confirm-changes V-table-Win
311 PROCEDURE confirm-changes :
312 /*------------------------------------------------------------------------------
313 Purpose:
314 ------------------------------------------------------------------------------*/
316 RUN verify-valuation.
317 IF RETURN-VALUE = "FAIL" THEN RETURN.
319 RUN dispatch( 'update-record':U ).
321 IF mode = "Add" THEN RUN notify( 'open-query, RECORD-SOURCE':U ).
322 RUN dispatch( 'exit':U ).
324 END PROCEDURE.
326 /* _UIB-CODE-BLOCK-END */
327 &ANALYZE-RESUME
330 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE delete-valuation V-table-Win
331 PROCEDURE delete-valuation :
332 /*------------------------------------------------------------------------------
333 Purpose:
334 Parameters: <none>
335 Notes:
336 ------------------------------------------------------------------------------*/
338 FIND CURRENT Valuation EXCLUSIVE-LOCK NO-ERROR.
339 IF AVAILABLE Valuation THEN DELETE Valuation NO-ERROR.
341 END PROCEDURE.
343 /* _UIB-CODE-BLOCK-END */
344 &ANALYZE-RESUME
347 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
348 PROCEDURE disable_UI :
349 /*------------------------------------------------------------------------------
350 Purpose: DISABLE the User Interface
351 Parameters: <none>
352 Notes: Here we clean-up the user-interface by deleting
353 dynamic widgets we have created and/or hide
354 frames. This procedure is usually called when
355 we are ready to "clean-up" after running.
356 ------------------------------------------------------------------------------*/
357 /* Hide all frames. */
358 HIDE FRAME F-Main.
359 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
360 END PROCEDURE.
362 /* _UIB-CODE-BLOCK-END */
363 &ANALYZE-RESUME
366 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
367 PROCEDURE inst-initialize :
368 /*------------------------------------------------------------------------------
369 Purpose:
370 Parameters: <none>
371 Notes:
372 ------------------------------------------------------------------------------*/
374 IF mode = "Add" THEN DO:
375 have-records = Yes.
376 RUN dispatch( 'add-record' ).
377 END.
378 ELSE DO:
379 RUN dispatch( 'enable-fields':U ).
380 END.
382 END PROCEDURE.
384 /* _UIB-CODE-BLOCK-END */
385 &ANALYZE-RESUME
388 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-row-available V-table-Win
389 PROCEDURE inst-row-available :
390 /*------------------------------------------------------------------------------
391 Purpose:
392 ------------------------------------------------------------------------------*/
393 DO WITH FRAME {&FRAME-NAME}:
394 FIND Property WHERE Property.PropertyCode = Valuation.PropertyCode NO-LOCK NO-ERROR.
395 fil_Property = (IF AVAILABLE(Property) THEN Property.Name ELSE "").
396 DISPLAY fil_Property WITH FRAME {&FRAME-NAME} .
397 /* fil_Property:SCREEN-VALUE = (IF AVAILABLE(Property) THEN Property.Name ELSE ""). */
398 END.
399 END PROCEDURE.
401 /* _UIB-CODE-BLOCK-END */
402 &ANALYZE-RESUME
405 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE override-add-record V-table-Win
406 PROCEDURE override-add-record :
407 /*------------------------------------------------------------------------------
408 Purpose:
409 Parameters: <none>
410 Notes:
411 ------------------------------------------------------------------------------*/
412 DEF VAR property-code AS INT NO-UNDO.
413 DEF VAR valuation-code LIKE Valuation.ValuationCode NO-UNDO.
415 DO WITH FRAME {&FRAME-NAME}:
417 CURRENT-WINDOW:TITLE = "Adding a Valuation".
418 property-code = INT( find-parent-key( 'PropertyCode' ) ).
419 FIND LAST Valuation WHERE Valuation.PropertyCode = property-code NO-LOCK NO-ERROR.
420 valuation-code = (IF AVAILABLE(Valuation) THEN Valuation.ValuationCode ELSE 0) + 1.
421 DO TRANSACTION:
422 CREATE Valuation.
423 Valuation.PropertyCode = property-code.
424 Valuation.ValuationCode = valuation-code.
425 END.
427 RUN dispatch( 'display-fields':U ).
428 RUN dispatch( 'enable-fields':U ).
430 Valuation.DateDone:SCREEN-VALUE = STRING( TODAY ).
432 END.
434 END PROCEDURE.
436 /* _UIB-CODE-BLOCK-END */
437 &ANALYZE-RESUME
440 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
441 PROCEDURE pre-destroy :
442 /*------------------------------------------------------------------------------
443 Purpose:
444 Parameters: <none>
445 Notes:
446 ------------------------------------------------------------------------------*/
448 IF LAST-EVENT:FUNCTION = "WINDOW-CLOSE" THEN RUN cancel-changes.
450 END PROCEDURE.
452 /* _UIB-CODE-BLOCK-END */
453 &ANALYZE-RESUME
456 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
457 PROCEDURE send-records :
458 /*------------------------------------------------------------------------------
459 Purpose: Send record ROWID's for all tables used by
460 this file.
461 Parameters: see template/snd-head.i
462 ------------------------------------------------------------------------------*/
464 /* Define variables needed by this internal procedure. */
465 {src/adm/template/snd-head.i}
467 /* For each requested table, put it's ROWID in the output list. */
468 {src/adm/template/snd-list.i "Valuation"}
470 /* Deal with any unexpected table requests before closing. */
471 {src/adm/template/snd-end.i}
473 END PROCEDURE.
475 /* _UIB-CODE-BLOCK-END */
476 &ANALYZE-RESUME
479 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
480 PROCEDURE state-changed :
481 /* -----------------------------------------------------------
482 Purpose:
483 Parameters: <none>
484 Notes:
485 -------------------------------------------------------------*/
486 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
487 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
489 CASE p-state:
490 /* Object instance CASEs can go here to replace standard behavior
491 or add new cases. */
492 {src/adm/template/vstates.i}
493 END CASE.
494 END PROCEDURE.
496 /* _UIB-CODE-BLOCK-END */
497 &ANALYZE-RESUME
500 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-mode V-table-Win
501 PROCEDURE use-mode :
502 /*------------------------------------------------------------------------------
503 Purpose:
504 Parameters: <none>
505 Notes:
506 ------------------------------------------------------------------------------*/
508 DEF INPUT PARAMETER new-mode AS CHAR NO-UNDO.
509 mode = new-mode.
511 END PROCEDURE.
513 /* _UIB-CODE-BLOCK-END */
514 &ANALYZE-RESUME
517 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-valuation V-table-Win
518 PROCEDURE verify-valuation :
519 /*------------------------------------------------------------------------------
520 Purpose:
521 Parameters: <none>
522 Notes:
523 ------------------------------------------------------------------------------*/
525 DO WITH FRAME {&FRAME-NAME}:
526 /* no valuation yet */
527 END.
529 END PROCEDURE.
531 /* _UIB-CODE-BLOCK-END */
532 &ANALYZE-RESUME