Really, this should be it, for the passing income.
[capital-apms-progress.git] / vwr / mnt / v-varflw.w
blob5840807ac865ac9a93bc6194452d6a22ac995f88
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 mode AS CHAR NO-UNDO.
16 DEF VAR key-name AS CHAR NO-UNDO.
17 DEF VAR key-value AS CHAR NO-UNDO.
19 DEF VAR project-code AS INT NO-UNDO.
20 DEF VAR variation-code AS INT NO-UNDO.
21 DEF VAR account-code AS DEC NO-UNDO.
22 DEF VAR month-code AS INT NO-UNDO.
24 /* record scoping */
25 FIND FIRST VariationFlow NO-LOCK NO-ERROR.
27 /* _UIB-CODE-BLOCK-END */
28 &ANALYZE-RESUME
31 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
33 /* ******************** Preprocessor Definitions ******************** */
35 &Scoped-define PROCEDURE-TYPE SmartViewer
37 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
39 /* Name of first Frame and/or Browse and/or first Query */
40 &Scoped-define FRAME-NAME F-Main
42 /* External Tables */
43 &Scoped-define EXTERNAL-TABLES Variation Project VariationFlow
44 &Scoped-define FIRST-EXTERNAL-TABLE Variation
47 /* Need to scope the external tables to this procedure */
48 DEFINE QUERY external_tables FOR Variation, Project, VariationFlow.
49 /* Standard List Definitions */
50 &Scoped-Define ENABLED-FIELDS VariationFlow.Amount
51 &Scoped-define FIELD-PAIRS~
52 ~{&FP1}Amount ~{&FP2}Amount ~{&FP3}
53 &Scoped-define ENABLED-TABLES VariationFlow
54 &Scoped-define FIRST-ENABLED-TABLE VariationFlow
55 &Scoped-Define ENABLED-OBJECTS RECT-1 cmb_Account cmb_Month
56 &Scoped-Define DISPLAYED-FIELDS VariationFlow.ProjectCode Project.Name ~
57 VariationFlow.VariationCode Variation.Reason VariationFlow.Amount
58 &Scoped-Define DISPLAYED-OBJECTS cmb_Account cmb_Month
60 /* Custom List Definitions */
61 /* ADM-CREATE-FIELDS,ADM-ASSIGN-FIELDS,List-3,List-4,List-5,List-6 */
63 /* _UIB-PREPROCESSOR-BLOCK-END */
64 &ANALYZE-RESUME
67 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" V-table-Win _INLINE
68 /* Actions: ? adm/support/keyedit.w ? ? ? */
69 /* STRUCTURED-DATA
70 <KEY-OBJECT>
71 THIS-PROCEDURE
72 </KEY-OBJECT>
73 <FOREIGN-KEYS>
74 ProjectCode|y|y|ttpl.VariationFlow.ProjectCode
75 VariationCode|y|y|ttpl.VariationFlow.VariationCode
76 MonthCode||y|ttpl.VariationFlow.MonthCode
77 </FOREIGN-KEYS>
78 <EXECUTING-CODE>
79 **************************
80 * Set attributes related to FOREIGN KEYS
82 RUN set-attribute-list (
83 'Keys-Accepted = "ProjectCode,VariationCode",
84 Keys-Supplied = "ProjectCode,VariationCode,MonthCode"':U).
85 /**************************
86 </EXECUTING-CODE> */
87 /* _UIB-CODE-BLOCK-END */
88 &ANALYZE-RESUME
91 /* *********************** Control Definitions ********************** */
94 /* Definitions of the field level widgets */
95 DEFINE VARIABLE cmb_Account AS CHARACTER FORMAT "X(256)":U
96 LABEL "Account"
97 VIEW-AS COMBO-BOX INNER-LINES 15
98 LIST-ITEMS "Item 1"
99 SIZE 56 BY 1 NO-UNDO.
101 DEFINE VARIABLE cmb_Month AS CHARACTER FORMAT "X(256)":U
102 LABEL "Month"
103 VIEW-AS COMBO-BOX INNER-LINES 20
104 LIST-ITEMS "Item 1"
105 SIZE 26.86 BY 1 NO-UNDO.
107 DEFINE RECTANGLE RECT-1
108 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
109 SIZE 64.57 BY 5.6.
112 /* ************************ Frame Definitions *********************** */
114 DEFINE FRAME F-Main
115 VariationFlow.ProjectCode AT ROW 1.2 COL 7 COLON-ALIGNED
116 LABEL "Project"
117 VIEW-AS FILL-IN
118 SIZE 6.43 BY 1
119 Project.Name AT ROW 1.2 COL 17.29 COLON-ALIGNED NO-LABEL
120 VIEW-AS FILL-IN
121 SIZE 45.72 BY 1.05
122 VariationFlow.VariationCode AT ROW 2.2 COL 7 COLON-ALIGNED
123 LABEL "Variation"
124 VIEW-AS FILL-IN
125 SIZE 6.43 BY 1
126 Variation.Reason AT ROW 2.2 COL 17.29 COLON-ALIGNED NO-LABEL
127 VIEW-AS FILL-IN
128 SIZE 45.72 BY 1.05
129 cmb_Account AT ROW 4.2 COL 7 COLON-ALIGNED
130 cmb_Month AT ROW 5.4 COL 7 COLON-ALIGNED
131 VariationFlow.Amount AT ROW 5.4 COL 51 COLON-ALIGNED
132 VIEW-AS FILL-IN
133 SIZE 12 BY 1.05
134 RECT-1 AT ROW 1 COL 1
135 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
136 SIDE-LABELS NO-UNDERLINE THREE-D
137 AT COL 1 ROW 1 SCROLLABLE
138 FONT 10.
141 /* *********************** Procedure Settings ************************ */
143 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
144 /* Settings for THIS-PROCEDURE
145 Type: SmartViewer
146 External Tables: ttpl.Variation,ttpl.Project,ttpl.VariationFlow
147 Allow: Basic,DB-Fields
148 Frames: 1
149 Add Fields to: EXTERNAL-TABLES
150 Other Settings: PERSISTENT-ONLY COMPILE
153 /* This procedure should always be RUN PERSISTENT. Report the error, */
154 /* then cleanup and return. */
155 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
156 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
157 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
158 RETURN.
159 END.
161 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
163 /* ************************* Create Window ************************** */
165 &ANALYZE-SUSPEND _CREATE-WINDOW
166 /* DESIGN Window definition (used by the UIB)
167 CREATE WINDOW V-table-Win ASSIGN
168 HEIGHT = 14.95
169 WIDTH = 68.29.
170 /* END WINDOW DEFINITION */
172 &ANALYZE-RESUME
175 /* *************** Runtime Attributes and UIB Settings ************** */
177 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
178 /* SETTINGS FOR WINDOW V-table-Win
179 VISIBLE,,RUN-PERSISTENT */
180 /* SETTINGS FOR FRAME F-Main
181 NOT-VISIBLE Size-to-Fit */
182 ASSIGN
183 FRAME F-Main:SCROLLABLE = FALSE
184 FRAME F-Main:HIDDEN = TRUE.
186 /* SETTINGS FOR FILL-IN Project.Name IN FRAME F-Main
187 NO-ENABLE EXP-LABEL */
188 /* SETTINGS FOR FILL-IN VariationFlow.ProjectCode IN FRAME F-Main
189 NO-ENABLE EXP-LABEL */
190 /* SETTINGS FOR FILL-IN Variation.Reason IN FRAME F-Main
191 NO-ENABLE EXP-LABEL */
192 /* SETTINGS FOR FILL-IN VariationFlow.VariationCode IN FRAME F-Main
193 NO-ENABLE EXP-LABEL */
194 /* _RUN-TIME-ATTRIBUTES-END */
195 &ANALYZE-RESUME
198 /* Setting information for Queries and Browse Widgets fields */
200 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
201 /* Query rebuild information for FRAME F-Main
202 _Options = "NO-LOCK"
203 _Query is NOT OPENED
204 */ /* FRAME F-Main */
205 &ANALYZE-RESUME
210 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
211 /* ************************* Included-Libraries *********************** */
213 {src/adm/method/viewer.i}
214 {inc/method/m-mntvwr.i}
216 /* _UIB-CODE-BLOCK-END */
217 &ANALYZE-RESUME
222 /* ************************ Control Triggers ************************ */
224 &Scoped-define SELF-NAME cmb_Account
225 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_Account V-table-Win
226 ON U1 OF cmb_Account IN FRAME F-Main /* Account */
228 {inc/selcmb/scpbdg1.i "VariationFlow" "AccountCode" "INPUT VariationFlow.ProjectCode"}
229 END.
231 /* _UIB-CODE-BLOCK-END */
232 &ANALYZE-RESUME
235 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_Account V-table-Win
236 ON U2 OF cmb_Account IN FRAME F-Main /* Account */
238 {inc/selcmb/scpbdg2.i "VariationFlow" "AccountCode" "INPUT VariationFlow.ProjectCode"}
239 END.
241 /* _UIB-CODE-BLOCK-END */
242 &ANALYZE-RESUME
245 &Scoped-define SELF-NAME cmb_Month
246 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_Month V-table-Win
247 ON U1 OF cmb_Month IN FRAME F-Main /* Month */
249 {inc/selcmb/scmths1.i "VariationFlow" "MonthCode"}
251 /* plus we try and find a near-current month when adding */
252 IF mode = "Add" AND month-code <> 0 THEN DO WITH FRAME {&FRAME-NAME}:
253 FIND Month WHERE Month.MonthCode = month-code NO-LOCK NO-ERROR.
254 IF AVAILABLE(Month) THEN
255 {&SELF-NAME}:SCREEN-VALUE = STRING( Month.StartDate, "99/99/9999").
256 END.
257 END.
259 /* _UIB-CODE-BLOCK-END */
260 &ANALYZE-RESUME
263 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_Month V-table-Win
264 ON U2 OF cmb_Month IN FRAME F-Main /* Month */
266 {inc/selcmb/scmths2.i "VariationFlow" "MonthCode"}
267 END.
269 /* _UIB-CODE-BLOCK-END */
270 &ANALYZE-RESUME
273 &UNDEFINE SELF-NAME
275 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
278 /* *************************** Main Block *************************** */
280 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
281 RUN dispatch IN THIS-PROCEDURE ('initialize':U).
282 &ENDIF
284 /************************ INTERNAL PROCEDURES ********************/
286 /* _UIB-CODE-BLOCK-END */
287 &ANALYZE-RESUME
290 /* ********************** Internal Procedures *********************** */
292 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-find-using-key V-table-Win adm/support/_key-fnd.p
293 PROCEDURE adm-find-using-key :
294 /*------------------------------------------------------------------------------
295 Purpose: Finds the current record using the contents of
296 the 'Key-Name' and 'Key-Value' attributes.
297 Parameters: <none>
298 ------------------------------------------------------------------------------*/
299 DEF VAR key-value AS CHAR NO-UNDO.
300 DEF VAR row-avail-enabled AS LOGICAL NO-UNDO.
302 /* LOCK status on the find depends on FIELDS-ENABLED. */
303 RUN get-attribute ('FIELDS-ENABLED':U).
304 row-avail-enabled = (RETURN-VALUE eq 'yes':U).
305 /* Look up the current key-value. */
306 RUN get-attribute ('Key-Value':U).
307 key-value = RETURN-VALUE.
309 /* Find the current record using the current Key-Name. */
310 RUN get-attribute ('Key-Name':U).
311 CASE RETURN-VALUE:
312 WHEN 'ProjectCode':U THEN
313 {src/adm/template/find-tbl.i
314 &TABLE = VariationFlow
315 &WHERE = "WHERE VariationFlow.ProjectCode eq INTEGER(key-value)"
317 WHEN 'VariationCode':U THEN
318 {src/adm/template/find-tbl.i
319 &TABLE = VariationFlow
320 &WHERE = "WHERE VariationFlow.VariationCode eq INTEGER(key-value)"
322 END CASE.
324 END PROCEDURE.
326 /* _UIB-CODE-BLOCK-END */
327 &ANALYZE-RESUME
330 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
331 PROCEDURE adm-row-available :
332 /*------------------------------------------------------------------------------
333 Purpose: Dispatched to this procedure when the Record-
334 Source has a new row available. This procedure
335 tries to get the new row (or foriegn keys) from
336 the Record-Source and process it.
337 Parameters: <none>
338 ------------------------------------------------------------------------------*/
340 /* Define variables needed by this internal procedure. */
341 {src/adm/template/row-head.i}
343 /* Create a list of all the tables that we need to get. */
344 {src/adm/template/row-list.i "Variation"}
345 {src/adm/template/row-list.i "Project"}
346 {src/adm/template/row-list.i "VariationFlow"}
348 /* Get the record ROWID's from the RECORD-SOURCE. */
349 {src/adm/template/row-get.i}
351 /* FIND each record specified by the RECORD-SOURCE. */
352 {src/adm/template/row-find.i "Variation"}
353 {src/adm/template/row-find.i "Project"}
354 {src/adm/template/row-find.i "VariationFlow"}
356 /* Process the newly available records (i.e. display fields,
357 open queries, and/or pass records on to any RECORD-TARGETS). */
358 {src/adm/template/row-end.i}
360 END PROCEDURE.
362 /* _UIB-CODE-BLOCK-END */
363 &ANALYZE-RESUME
366 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE cancel-changes V-table-Win
367 PROCEDURE cancel-changes :
368 /*------------------------------------------------------------------------------
369 Purpose:
370 ------------------------------------------------------------------------------*/
371 IF mode = "Add" THEN RUN delete-flow.
372 RUN dispatch( 'exit':U ).
373 END PROCEDURE.
375 /* _UIB-CODE-BLOCK-END */
376 &ANALYZE-RESUME
379 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE confirm-changes V-table-Win
380 PROCEDURE confirm-changes :
381 /*------------------------------------------------------------------------------
382 Purpose:
383 ------------------------------------------------------------------------------*/
384 RUN verify-flow.
385 IF RETURN-VALUE = "FAIL" THEN RETURN.
387 RUN dispatch( 'update-record':U ).
388 IF mode = "Add" THEN RUN notify( 'open-query,record-source':U ).
389 RUN dispatch( 'exit':U ).
391 END PROCEDURE.
393 /* _UIB-CODE-BLOCK-END */
394 &ANALYZE-RESUME
397 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE delete-flow V-table-Win
398 PROCEDURE delete-flow :
399 /*------------------------------------------------------------------------------
400 Purpose:
401 ------------------------------------------------------------------------------*/
402 IF NOT AVAILABLE(VariationFlow) THEN RETURN.
403 FIND CURRENT VariationFlow EXCLUSIVE-LOCK NO-ERROR.
404 IF NOT AVAILABLE(VariationFlow) THEN RETURN.
405 DELETE VariationFlow NO-ERROR.
406 END PROCEDURE.
408 /* _UIB-CODE-BLOCK-END */
409 &ANALYZE-RESUME
412 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
413 PROCEDURE disable_UI :
414 /*------------------------------------------------------------------------------
415 Purpose: DISABLE the User Interface
416 Parameters: <none>
417 Notes: Here we clean-up the user-interface by deleting
418 dynamic widgets we have created and/or hide
419 frames. This procedure is usually called when
420 we are ready to "clean-up" after running.
421 ------------------------------------------------------------------------------*/
422 /* Hide all frames. */
423 HIDE FRAME F-Main.
424 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
425 END PROCEDURE.
427 /* _UIB-CODE-BLOCK-END */
428 &ANALYZE-RESUME
431 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
432 PROCEDURE inst-enable-fields :
433 /*------------------------------------------------------------------------------
434 Purpose:
435 ------------------------------------------------------------------------------*/
436 DO WITH FRAME {&FRAME-NAME}:
437 IF mode = "Add" THEN DO:
438 ENABLE cmb_Account cmb_Month.
439 END.
440 ELSE DO:
441 DISABLE cmb_Account cmb_Month.
442 END.
443 END.
444 END PROCEDURE.
446 /* _UIB-CODE-BLOCK-END */
447 &ANALYZE-RESUME
450 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
451 PROCEDURE inst-initialize :
452 /*------------------------------------------------------------------------------
453 Purpose:
454 ------------------------------------------------------------------------------*/
455 IF mode = "Add" THEN RUN dispatch( 'add-record':U ).
457 RUN dispatch( 'enable-fields':U ).
459 END PROCEDURE.
461 /* _UIB-CODE-BLOCK-END */
462 &ANALYZE-RESUME
465 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE normal-send-key V-table-Win adm/support/_key-snd.p
466 PROCEDURE normal-send-key :
467 /*------------------------------------------------------------------------------
468 Purpose: Sends a requested KEY value back to the calling
469 SmartObject.
470 Parameters: <see adm/template/sndkytop.i>
471 ------------------------------------------------------------------------------*/
473 /* Define variables needed by this internal procedure. */
474 {src/adm/template/sndkytop.i}
476 /* Return the key value associated with each key case. */
477 {src/adm/template/sndkycas.i "ProjectCode" "VariationFlow" "ProjectCode"}
478 {src/adm/template/sndkycas.i "VariationCode" "VariationFlow" "VariationCode"}
479 {src/adm/template/sndkycas.i "MonthCode" "VariationFlow" "MonthCode"}
481 /* Close the CASE statement and end the procedure. */
482 {src/adm/template/sndkyend.i}
484 END PROCEDURE.
486 /* _UIB-CODE-BLOCK-END */
487 &ANALYZE-RESUME
490 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE override-add-record V-table-Win
491 PROCEDURE override-add-record :
492 /*------------------------------------------------------------------------------
493 Purpose:
494 ------------------------------------------------------------------------------*/
495 DEF VAR rs-hdl AS HANDLE NO-UNDO.
496 DEF VAR new-key AS CHAR NO-UNDO.
498 RUN get-link-handle IN adm-broker-hdl( THIS-PROCEDURE, 'RECORD-SOURCE':U, OUTPUT new-key ).
499 rs-hdl = WIDGET-HANDLE(new-key).
500 IF VALID-HANDLE( rs-hdl ) THEN DO:
501 RUN send-key IN rs-hdl( "VariationFlow", OUTPUT new-key ).
502 IF new-key <> ? AND TRIM(new-key) <> "" THEN DO:
503 RUN set-attribute-list( 'Key-Name = VariationFlow, Key-Value = ':U + new-key).
504 END.
505 IF project-code = 0 OR variation-code = 0 THEN DO:
506 RUN send-key IN rs-hdl( "ProjectCode", OUTPUT new-key ).
507 project-code = INT(new-key).
508 FIND Project WHERE Project.ProjectCode = project-code NO-LOCK NO-ERROR.
509 RUN send-key IN rs-hdl( "VariationCode", OUTPUT new-key ).
510 variation-code = INT(new-key).
511 END.
512 END.
514 have-records = Yes.
516 FIND FIRST VariationFlow EXCLUSIVE-LOCK WHERE VariationFlow.ProjectCode = project-code
517 AND VariationFlow.VariationCode = variation-code
518 AND VariationFlow.AccountCode = 0
519 AND VariationFlow.MonthCode = 0 NO-ERROR.
520 IF NOT AVAILABLE(VariationFlow) THEN CREATE VariationFlow.
522 ASSIGN VariationFlow.ProjectCode = project-code
523 VariationFlow.VariationCode = variation-code
524 VariationFlow.AccountCode = account-code
525 VariationFlow.MonthCode = 0
526 VariationFlow.Amount = 0.
528 FIND CURRENT VariationFlow NO-LOCK.
530 FIND Variation OF VariationFlow NO-LOCK.
531 DEF BUFFER VFL FOR VariationFlow.
532 FOR EACH VFL OF Variation WHERE RECID(VFL) <> RECID(VariationFlow) EXCLUSIVE-LOCK:
533 IF VFL.MonthCode = 0 OR VFL.AccountCode = 0 THEN DELETE VFL.
534 END.
535 RUN dispatch IN THIS-PROCEDURE ('display-fields':U).
538 END PROCEDURE.
540 /* _UIB-CODE-BLOCK-END */
541 &ANALYZE-RESUME
544 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
545 PROCEDURE pre-destroy :
546 /*------------------------------------------------------------------------------
547 Purpose:
548 ------------------------------------------------------------------------------*/
549 RUN check-modified( 'clear':U ).
550 END PROCEDURE.
552 /* _UIB-CODE-BLOCK-END */
553 &ANALYZE-RESUME
556 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-key V-table-Win
557 PROCEDURE send-key :
558 /*------------------------------------------------------------------------------
559 Purpose:
560 Parameters: <none>
561 Notes:
562 ------------------------------------------------------------------------------*/
563 {inc/sendkey.i}
564 END PROCEDURE.
566 /* _UIB-CODE-BLOCK-END */
567 &ANALYZE-RESUME
570 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
571 PROCEDURE send-records :
572 /*------------------------------------------------------------------------------
573 Purpose: Send record ROWID's for all tables used by
574 this file.
575 Parameters: see template/snd-head.i
576 ------------------------------------------------------------------------------*/
578 /* Define variables needed by this internal procedure. */
579 {src/adm/template/snd-head.i}
581 /* For each requested table, put it's ROWID in the output list. */
582 {src/adm/template/snd-list.i "Variation"}
583 {src/adm/template/snd-list.i "Project"}
584 {src/adm/template/snd-list.i "VariationFlow"}
586 /* Deal with any unexpected table requests before closing. */
587 {src/adm/template/snd-end.i}
589 END PROCEDURE.
591 /* _UIB-CODE-BLOCK-END */
592 &ANALYZE-RESUME
595 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
596 PROCEDURE state-changed :
597 /* -----------------------------------------------------------
598 Purpose:
599 Parameters: <none>
600 Notes:
601 -------------------------------------------------------------*/
602 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
603 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
605 CASE p-state:
606 /* Object instance CASEs can go here to replace standard behavior
607 or add new cases. */
608 {src/adm/template/vstates.i}
609 END CASE.
610 END PROCEDURE.
612 /* _UIB-CODE-BLOCK-END */
613 &ANALYZE-RESUME
616 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-Key-Name V-table-Win
617 PROCEDURE use-Key-Name :
618 /*------------------------------------------------------------------------------
619 Purpose:
620 ------------------------------------------------------------------------------*/
621 DEF INPUT PARAMETER new-name AS CHAR NO-UNDO.
622 key-name = new-name.
623 END PROCEDURE.
625 /* _UIB-CODE-BLOCK-END */
626 &ANALYZE-RESUME
629 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-Key-Value V-table-Win
630 PROCEDURE use-Key-Value :
631 /*------------------------------------------------------------------------------
632 Purpose:
633 ------------------------------------------------------------------------------*/
634 DEF INPUT PARAMETER new-key AS CHAR NO-UNDO.
636 IF key-name = "VariationFlow" AND TRIM(new-key) <> "" THEN DO:
637 project-code = INT( ENTRY( 1, new-key, "/" ) ).
638 variation-code = INT( ENTRY( 2, new-key, "/" ) ).
639 account-code = DEC( ENTRY( 3, new-key, "/" ) ).
640 month-code = INT( ENTRY( 4, new-key, "/" ) ).
641 FIND VariationFlow NO-LOCK WHERE VariationFlow.ProjectCode = project-code
642 AND VariationFlow.VariationCode = variation-code
643 AND VariationFlow.AccountCode = account-code
644 AND VariationFlow.MonthCode = month-code NO-ERROR.
645 END.
646 ELSE IF key-name = "Variation" AND TRIM(new-key) <> "" THEN DO:
647 project-code = INT( ENTRY( 1, new-key ) ).
648 variation-code = INT( ENTRY( 2, new-key ) ).
649 END.
650 FIND Variation NO-LOCK WHERE Variation.ProjectCode = project-code
651 AND Variation.VariationCode = variation-code NO-ERROR.
652 IF AVAILABLE(Variation) THEN
653 FIND Project OF Variation NO-LOCK NO-ERROR.
655 END PROCEDURE.
657 /* _UIB-CODE-BLOCK-END */
658 &ANALYZE-RESUME
661 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-Mode V-table-Win
662 PROCEDURE use-Mode :
663 /*------------------------------------------------------------------------------
664 Purpose:
665 ------------------------------------------------------------------------------*/
666 DEF INPUT PARAMETER new-mode AS CHAR NO-UNDO.
667 mode = new-mode.
668 END PROCEDURE.
670 /* _UIB-CODE-BLOCK-END */
671 &ANALYZE-RESUME
674 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-flow V-table-Win
675 PROCEDURE verify-flow :
676 /*------------------------------------------------------------------------------
677 Purpose:
678 ------------------------------------------------------------------------------*/
679 DEF BUFFER VFL FOR VariationFlow.
681 DEF VAR in-month AS INT NO-UNDO.
682 DEF VAR in-account AS DEC NO-UNDO.
684 DO WITH FRAME {&FRAME-NAME}:
685 FIND Month WHERE Month.StartDate = DATE( cmb_Month:SCREEN-VALUE ) NO-LOCK NO-ERROR.
686 IF NOT AVAILABLE(Month) THEN RETURN "FAIL".
687 in-month = Month.MonthCode.
689 in-account = DEC( ENTRY( 1, cmb_Account:SCREEN-VALUE, " ") ).
690 FIND VFL NO-LOCK WHERE VFL.ProjectCode = VariationFlow.ProjectCode
691 AND VFL.VariationCode = VariationFlow.VariationCode
692 AND VFL.AccountCode = in-account
693 AND VFL.MonthCode = in-month
694 NO-ERROR.
695 IF mode = "Add" AND AVAILABLE(VFL) THEN DO:
696 MESSAGE "Flow already exists for account " + STRING( in-account, "9999.99") "for that month."
697 VIEW-AS ALERT-BOX ERROR TITLE "Flow already exists - use Maintain".
698 RETURN "FAIL".
699 END.
700 END.
702 END PROCEDURE.
704 /* _UIB-CODE-BLOCK-END */
705 &ANALYZE-RESUME