Really, this should be it, for the passing income.
[capital-apms-progress.git] / vwr / mnt / v-budget.w
blobd96dd3e334c35b6ac09860558b9e4af4c3f70800
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI ADM1
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 /*------------------------------------------------------------------------
10 File:
12 Description: from VIEWER.W - Template for SmartViewer Objects
14 Input Parameters:
15 <none>
17 Output Parameters:
18 <none>
20 ------------------------------------------------------------------------*/
22 CREATE WIDGET-POOL.
24 /* *************************** Definitions ************************** */
26 /* Local Variable Definitions --- */
28 DEF VAR user-name AS CHAR NO-UNDO.
29 DEF VAR no-months AS INT NO-UNDO.
31 DEF VAR key-name AS CHAR NO-UNDO.
32 DEF VAR key-value AS CHAR NO-UNDO.
33 DEF VAR ext-et AS CHAR NO-UNDO.
34 DEF VAR ext-ec AS INT NO-UNDO.
35 DEF VAR ext-ac AS DEC NO-UNDO.
37 DEF VAR source-link-name AS CHAR NO-UNDO.
38 DEF VAR source-table AS CHAR NO-UNDO.
40 {inc/ofc-this.i}
41 {inc/ofc-set.i "Budget-Closed-To" "budget-closed-to" "ERROR"}
42 DEF VAR budget-closed-date AS DATE NO-UNDO.
43 budget-closed-date = DATE(budget-closed-to).
45 /* _UIB-CODE-BLOCK-END */
46 &ANALYZE-RESUME
49 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
51 /* ******************** Preprocessor Definitions ******************** */
53 &Scoped-define PROCEDURE-TYPE SmartViewer
54 &Scoped-define DB-AWARE no
56 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
58 /* Name of first Frame and/or Browse and/or first Query */
59 &Scoped-define FRAME-NAME F-Main
61 /* External Tables */
62 &Scoped-define EXTERNAL-TABLES RP
63 &Scoped-define FIRST-EXTERNAL-TABLE RP
66 /* Need to scope the external tables to this procedure */
67 DEFINE QUERY external_tables FOR RP.
68 /* Define KEY-PHRASE in case it is used by any query. */
69 &Scoped-define KEY-PHRASE TRUE
71 /* Standard List Definitions */
72 &Scoped-Define ENABLED-FIELDS RP.Int2 RP.Char2 RP.Int1 RP.Dec1 RP.Char3
73 &Scoped-define ENABLED-TABLES RP
74 &Scoped-define FIRST-ENABLED-TABLE RP
75 &Scoped-Define ENABLED-OBJECTS fil_Month-1 fil_Month-2 fil_Month-3 ~
76 fil_Month-4 fil_AnnualBudget fil_Month-5 fil_Month-6 fil_Month-7 ~
77 fil_Month-8 fil_Month-9 fil_Month-10 fil_Month-11 fil_Month-12 Btn_OK ~
78 Btn_Cancel Btn_Apply RECT-1
79 &Scoped-Define DISPLAYED-FIELDS RP.Int2 RP.Char2 RP.Int1 RP.Dec1 RP.Char3
80 &Scoped-define DISPLAYED-TABLES RP
81 &Scoped-define FIRST-DISPLAYED-TABLE RP
82 &Scoped-Define DISPLAYED-OBJECTS fil_YearDescription fil_EntityName ~
83 fil_AccountName fil_Month-1 fil_Month-2 fil_Month-3 fil_Month-4 ~
84 fil_AnnualBudget fil_Month-5 fil_Month-6 fil_Month-7 fil_Month-8 ~
85 fil_Month-9 fil_Month-10 fil_Month-11 fil_Month-12 fil_Budgetclosed
87 /* Custom List Definitions */
88 /* ADM-CREATE-FIELDS,ADM-ASSIGN-FIELDS,List-3,List-4,List-5,List-6 */
90 /* _UIB-PREPROCESSOR-BLOCK-END */
91 &ANALYZE-RESUME
94 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" V-table-Win _INLINE
95 /* Actions: ? adm/support/keyedit.w ? ? ? */
96 /* STRUCTURED-DATA
97 <KEY-OBJECT>
98 THIS-PROCEDURE
99 </KEY-OBJECT>
100 <FOREIGN-KEYS>
101 EntityType||y|AccountSummary.EntityType
102 EntityCode||y|AccountSummary.EntityCode
103 AccountCode||y|AccountSummary.AccountCode
104 </FOREIGN-KEYS>
105 <EXECUTING-CODE>
106 **************************
107 * Set attributes related to FOREIGN KEYS
109 RUN set-attribute-list (
110 'Keys-Accepted = ,
111 Keys-Supplied = "EntityType,EntityCode,AccountCode"':U).
112 /**************************
113 </EXECUTING-CODE> */
114 /* _UIB-CODE-BLOCK-END */
115 &ANALYZE-RESUME
118 /* *********************** Control Definitions ********************** */
121 /* Definitions of the field level widgets */
122 DEFINE BUTTON Btn_Apply DEFAULT
123 LABEL "&Apply"
124 SIZE 12 BY 1
125 BGCOLOR 8 .
127 DEFINE BUTTON Btn_Cancel AUTO-END-KEY DEFAULT
128 LABEL "&Cancel"
129 SIZE 12 BY 1
130 BGCOLOR 8 .
132 DEFINE BUTTON Btn_OK AUTO-GO
133 LABEL "&OK"
134 SIZE 12 BY 1
135 BGCOLOR 8 .
137 DEFINE VARIABLE fil_AccountName AS CHARACTER FORMAT "X(256)":U
138 VIEW-AS FILL-IN
139 SIZE 45.14 BY 1
140 BGCOLOR 16 NO-UNDO.
142 DEFINE VARIABLE fil_AnnualBudget AS DECIMAL FORMAT "-ZZ,ZZZ,ZZ9.99":U INITIAL 0
143 LABEL "Full year"
144 VIEW-AS FILL-IN
145 SIZE 16 BY 1
146 BGCOLOR 16 NO-UNDO.
148 DEFINE VARIABLE fil_Budgetclosed AS DATE FORMAT "99/99/9999":U
149 LABEL "Budgets are closed up to"
150 VIEW-AS TEXT
151 SIZE 16 BY .7 NO-UNDO.
153 DEFINE VARIABLE fil_EntityName AS CHARACTER FORMAT "X(256)":U
154 VIEW-AS FILL-IN
155 SIZE 45.14 BY 1
156 BGCOLOR 16 NO-UNDO.
158 DEFINE VARIABLE fil_Month-1 AS DECIMAL FORMAT "-ZZ,ZZZ,ZZ9.99":U INITIAL 0
159 LABEL "January"
160 VIEW-AS FILL-IN
161 SIZE 12 BY 1
162 BGCOLOR 16 NO-UNDO.
164 DEFINE VARIABLE fil_Month-10 AS DECIMAL FORMAT "-ZZ,ZZZ,ZZ9.99":U INITIAL 0
165 LABEL "October"
166 VIEW-AS FILL-IN
167 SIZE 12 BY 1
168 BGCOLOR 16 NO-UNDO.
170 DEFINE VARIABLE fil_Month-11 AS DECIMAL FORMAT "-ZZ,ZZZ,ZZ9.99":U INITIAL 0
171 LABEL "November"
172 VIEW-AS FILL-IN
173 SIZE 12 BY 1
174 BGCOLOR 16 NO-UNDO.
176 DEFINE VARIABLE fil_Month-12 AS DECIMAL FORMAT "-ZZ,ZZZ,ZZ9.99":U INITIAL 0
177 LABEL "December"
178 VIEW-AS FILL-IN
179 SIZE 12 BY 1
180 BGCOLOR 16 NO-UNDO.
182 DEFINE VARIABLE fil_Month-2 AS DECIMAL FORMAT "-ZZ,ZZZ,ZZ9.99":U INITIAL 0
183 LABEL "February"
184 VIEW-AS FILL-IN
185 SIZE 12 BY 1
186 BGCOLOR 16 NO-UNDO.
188 DEFINE VARIABLE fil_Month-3 AS DECIMAL FORMAT "-ZZ,ZZZ,ZZ9.99":U INITIAL 0
189 LABEL "March"
190 VIEW-AS FILL-IN
191 SIZE 12 BY 1
192 BGCOLOR 16 NO-UNDO.
194 DEFINE VARIABLE fil_Month-4 AS DECIMAL FORMAT "-ZZ,ZZZ,ZZ9.99":U INITIAL 0
195 LABEL "April"
196 VIEW-AS FILL-IN
197 SIZE 12 BY 1
198 BGCOLOR 16 NO-UNDO.
200 DEFINE VARIABLE fil_Month-5 AS DECIMAL FORMAT "-ZZ,ZZZ,ZZ9.99":U INITIAL 0
201 LABEL "May"
202 VIEW-AS FILL-IN
203 SIZE 12 BY 1
204 BGCOLOR 16 NO-UNDO.
206 DEFINE VARIABLE fil_Month-6 AS DECIMAL FORMAT "-ZZ,ZZZ,ZZ9.99":U INITIAL 0
207 LABEL "June"
208 VIEW-AS FILL-IN
209 SIZE 12 BY 1
210 BGCOLOR 16 NO-UNDO.
212 DEFINE VARIABLE fil_Month-7 AS DECIMAL FORMAT "-ZZ,ZZZ,ZZ9.99":U INITIAL 0
213 LABEL "July"
214 VIEW-AS FILL-IN
215 SIZE 12 BY 1
216 BGCOLOR 16 NO-UNDO.
218 DEFINE VARIABLE fil_Month-8 AS DECIMAL FORMAT "-ZZ,ZZZ,ZZ9.99":U INITIAL 0
219 LABEL "August"
220 VIEW-AS FILL-IN
221 SIZE 12 BY 1
222 BGCOLOR 16 NO-UNDO.
224 DEFINE VARIABLE fil_Month-9 AS DECIMAL FORMAT "-ZZ,ZZZ,ZZ9.99":U INITIAL 0
225 LABEL "September"
226 VIEW-AS FILL-IN
227 SIZE 12 BY 1
228 BGCOLOR 16 NO-UNDO.
230 DEFINE VARIABLE fil_YearDescription AS CHARACTER FORMAT "X(256)":U
231 VIEW-AS FILL-IN
232 SIZE 45.14 BY 1
233 BGCOLOR 16 NO-UNDO.
235 DEFINE RECTANGLE RECT-1
236 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
237 SIZE 65.14 BY 17.
240 /* ************************ Frame Definitions *********************** */
242 DEFINE FRAME F-Main
243 RP.Int2 AT ROW 1.2 COL 9.29 COLON-ALIGNED HELP
245 LABEL "Year" FORMAT "9999"
246 VIEW-AS FILL-IN
247 SIZE 6 BY 1
248 fil_YearDescription AT ROW 1.2 COL 18.43 COLON-ALIGNED NO-LABEL
249 RP.Char2 AT ROW 2.2 COL 9.29 COLON-ALIGNED HELP
251 LABEL "Entity" FORMAT "X"
252 VIEW-AS FILL-IN
253 SIZE 2.86 BY 1
254 RP.Int1 AT ROW 2.2 COL 12.14 COLON-ALIGNED HELP
255 "" NO-LABEL FORMAT "99999"
256 VIEW-AS FILL-IN
257 SIZE 6 BY 1
258 fil_EntityName AT ROW 2.2 COL 18.43 COLON-ALIGNED NO-LABEL
259 RP.Dec1 AT ROW 3.2 COL 9.29 COLON-ALIGNED HELP
261 LABEL "Account" FORMAT "9999.99"
262 VIEW-AS FILL-IN
263 SIZE 8.86 BY 1
264 fil_AccountName AT ROW 3.2 COL 18.43 COLON-ALIGNED NO-LABEL
265 RP.Char3 AT ROW 4.2 COL 11.29 HELP
266 "" NO-LABEL
267 VIEW-AS RADIO-SET VERTICAL
268 RADIO-BUTTONS
269 "Annual", "A":U,
270 "Monthly", "M":U
271 SIZE 11.43 BY 2.4
272 FONT 10
273 fil_Month-1 AT ROW 4.4 COL 51.29 COLON-ALIGNED
274 fil_Month-2 AT ROW 5.4 COL 51.29 COLON-ALIGNED
275 fil_Month-3 AT ROW 6.4 COL 51.29 COLON-ALIGNED
276 fil_Month-4 AT ROW 7.4 COL 51.29 COLON-ALIGNED
277 fil_AnnualBudget AT ROW 8.2 COL 9.29 COLON-ALIGNED
278 fil_Month-5 AT ROW 8.4 COL 51.29 COLON-ALIGNED
279 fil_Month-6 AT ROW 9.4 COL 51.29 COLON-ALIGNED
280 fil_Month-7 AT ROW 10.4 COL 51.29 COLON-ALIGNED
281 fil_Month-8 AT ROW 11.4 COL 51.29 COLON-ALIGNED
282 fil_Month-9 AT ROW 12.4 COL 51.29 COLON-ALIGNED
283 fil_Month-10 AT ROW 13.4 COL 51.29 COLON-ALIGNED
284 fil_Month-11 AT ROW 14.4 COL 51.29 COLON-ALIGNED
285 fil_Month-12 AT ROW 15.4 COL 51.29 COLON-ALIGNED
286 Btn_OK AT ROW 16.8 COL 28.43
287 Btn_Cancel AT ROW 16.8 COL 41
288 Btn_Apply AT ROW 16.8 COL 53.57
289 fil_Budgetclosed AT ROW 10.9 COL 21 COLON-ALIGNED
290 RECT-1 AT ROW 1 COL 1
291 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
292 SIDE-LABELS NO-UNDERLINE THREE-D
293 AT COL 1 ROW 1 SCROLLABLE
294 FONT 9
295 DEFAULT-BUTTON Btn_Apply CANCEL-BUTTON Btn_Cancel.
298 /* *********************** Procedure Settings ************************ */
300 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
301 /* Settings for THIS-PROCEDURE
302 Type: SmartViewer
303 External Tables: TTPL.RP
304 Allow: Basic,DB-Fields
305 Frames: 1
306 Add Fields to: EXTERNAL-TABLES
307 Other Settings: PERSISTENT-ONLY COMPILE
310 /* This procedure should always be RUN PERSISTENT. Report the error, */
311 /* then cleanup and return. */
312 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
313 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT.":U
314 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
315 RETURN.
316 END.
318 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
320 /* ************************* Create Window ************************** */
322 &ANALYZE-SUSPEND _CREATE-WINDOW
323 /* DESIGN Window definition (used by the UIB)
324 CREATE WINDOW V-table-Win ASSIGN
325 HEIGHT = 18.6
326 WIDTH = 76.
327 /* END WINDOW DEFINITION */
329 &ANALYZE-RESUME
331 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
332 /* ************************* Included-Libraries *********************** */
334 {src/adm/method/viewer.i}
335 {inc/method/m-mntvwr.i}
337 /* _UIB-CODE-BLOCK-END */
338 &ANALYZE-RESUME
343 /* *********** Runtime Attributes and AppBuilder Settings *********** */
345 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
346 /* SETTINGS FOR WINDOW V-table-Win
347 VISIBLE,,RUN-PERSISTENT */
348 /* SETTINGS FOR FRAME F-Main
349 NOT-VISIBLE Size-to-Fit */
350 ASSIGN
351 FRAME F-Main:SCROLLABLE = FALSE
352 FRAME F-Main:HIDDEN = TRUE.
354 /* SETTINGS FOR FILL-IN RP.Char2 IN FRAME F-Main
355 EXP-LABEL EXP-FORMAT EXP-HELP */
356 /* SETTINGS FOR RADIO-SET RP.Char3 IN FRAME F-Main
357 EXP-HELP */
358 /* SETTINGS FOR FILL-IN RP.Dec1 IN FRAME F-Main
359 EXP-LABEL EXP-FORMAT EXP-HELP */
360 /* SETTINGS FOR FILL-IN fil_AccountName IN FRAME F-Main
361 NO-ENABLE */
362 /* SETTINGS FOR FILL-IN fil_Budgetclosed IN FRAME F-Main
363 NO-ENABLE */
364 /* SETTINGS FOR FILL-IN fil_EntityName IN FRAME F-Main
365 NO-ENABLE */
366 /* SETTINGS FOR FILL-IN fil_YearDescription IN FRAME F-Main
367 NO-ENABLE */
368 /* SETTINGS FOR FILL-IN RP.Int1 IN FRAME F-Main
369 EXP-LABEL EXP-FORMAT EXP-HELP */
370 /* SETTINGS FOR FILL-IN RP.Int2 IN FRAME F-Main
371 EXP-LABEL EXP-FORMAT EXP-HELP */
372 /* _RUN-TIME-ATTRIBUTES-END */
373 &ANALYZE-RESUME
376 /* Setting information for Queries and Browse Widgets fields */
378 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
379 /* Query rebuild information for FRAME F-Main
380 _Options = "NO-LOCK KEY-PHRASE SORTBY-PHRASE KEEP-EMPTY"
381 _Query is NOT OPENED
382 */ /* FRAME F-Main */
383 &ANALYZE-RESUME
389 /* ************************ Control Triggers ************************ */
391 &Scoped-define SELF-NAME Btn_Apply
392 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_Apply V-table-Win
393 ON CHOOSE OF Btn_Apply IN FRAME F-Main /* Apply */
395 RUN assign-budgets.
396 APPLY 'ENTRY':U TO RP.Dec1 .
397 END.
399 /* _UIB-CODE-BLOCK-END */
400 &ANALYZE-RESUME
403 &Scoped-define SELF-NAME Btn_Cancel
404 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_Cancel V-table-Win
405 ON CHOOSE OF Btn_Cancel IN FRAME F-Main /* Cancel */
407 RUN dispatch( 'exit':U ).
408 END.
410 /* _UIB-CODE-BLOCK-END */
411 &ANALYZE-RESUME
414 &Scoped-define SELF-NAME Btn_OK
415 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_OK V-table-Win
416 ON CHOOSE OF Btn_OK IN FRAME F-Main /* OK */
418 RUN assign-budgets.
419 RUN dispatch( 'exit':U ).
420 END.
422 /* _UIB-CODE-BLOCK-END */
423 &ANALYZE-RESUME
426 &Scoped-define SELF-NAME RP.Char2
427 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char2 V-table-Win
428 ON LEAVE OF RP.Char2 IN FRAME F-Main /* Entity */
430 DO WITH FRAME {&FRAME-NAME}:
431 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
432 ASSIGN {&SELF-NAME}.
433 RUN dispatch( 'enable-fields':U ).
434 END.
435 END.
436 END.
438 /* _UIB-CODE-BLOCK-END */
439 &ANALYZE-RESUME
442 &Scoped-define SELF-NAME RP.Char3
443 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char3 V-table-Win
444 ON VALUE-CHANGED OF RP.Char3 IN FRAME F-Main /* Char3 */
446 DO WITH FRAME {&FRAME-NAME}:
447 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
448 ASSIGN {&SELF-NAME}.
449 RUN dispatch( 'enable-fields':U ).
450 IF INPUT {&SELF-NAME} = "A" THEN
451 APPLY "ENTRY":U TO fil_AnnualBudget.
452 ELSE
453 APPLY "ENTRY":U TO fil_Month-1.
454 END.
455 END.
456 END.
458 /* _UIB-CODE-BLOCK-END */
459 &ANALYZE-RESUME
462 &Scoped-define SELF-NAME RP.Dec1
463 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Dec1 V-table-Win
464 ON LEAVE OF RP.Dec1 IN FRAME F-Main /* Account */
466 DO WITH FRAME {&FRAME-NAME}:
467 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
468 ASSIGN {&SELF-NAME}.
469 RUN dispatch( 'enable-fields':U ).
470 END.
471 END.
472 END.
474 /* _UIB-CODE-BLOCK-END */
475 &ANALYZE-RESUME
478 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Dec1 V-table-Win
479 ON RETURN OF RP.Dec1 IN FRAME F-Main /* Account */
481 DO WITH FRAME {&FRAME-NAME}:
482 APPLY 'TAB' TO SELF.
483 APPLY 'TAB' TO RP.Char3.
484 RETURN NO-APPLY.
485 END.
486 END.
488 /* _UIB-CODE-BLOCK-END */
489 &ANALYZE-RESUME
492 &Scoped-define SELF-NAME fil_AnnualBudget
493 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_AnnualBudget V-table-Win
494 ON LEAVE OF fil_AnnualBudget IN FRAME F-Main /* Full year */
496 DO WITH FRAME {&FRAME-NAME}:
497 IF INPUT fil_AnnualBudget <> fil_AnnualBudget THEN DO:
498 ASSIGN fil_AnnualBudget.
499 RUN set-monthly-amounts.
500 END.
501 END.
502 END.
504 /* _UIB-CODE-BLOCK-END */
505 &ANALYZE-RESUME
508 &Scoped-define SELF-NAME fil_Month-1
509 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Month-1 V-table-Win
510 ON LEAVE OF fil_Month-1 IN FRAME F-Main /* January */
512 DO WITH FRAME {&FRAME-NAME}:
513 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
514 ASSIGN {&SELF-NAME}.
515 RUN set-annual-amount.
516 END.
517 END.
518 END.
520 /* _UIB-CODE-BLOCK-END */
521 &ANALYZE-RESUME
524 &Scoped-define SELF-NAME fil_Month-10
525 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Month-10 V-table-Win
526 ON LEAVE OF fil_Month-10 IN FRAME F-Main /* October */
528 DO WITH FRAME {&FRAME-NAME}:
529 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
530 ASSIGN {&SELF-NAME}.
531 RUN set-annual-amount.
532 END.
533 END.
534 END.
536 /* _UIB-CODE-BLOCK-END */
537 &ANALYZE-RESUME
540 &Scoped-define SELF-NAME fil_Month-11
541 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Month-11 V-table-Win
542 ON LEAVE OF fil_Month-11 IN FRAME F-Main /* November */
544 DO WITH FRAME {&FRAME-NAME}:
545 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
546 ASSIGN {&SELF-NAME}.
547 RUN set-annual-amount.
548 END.
549 END.
550 END.
552 /* _UIB-CODE-BLOCK-END */
553 &ANALYZE-RESUME
556 &Scoped-define SELF-NAME fil_Month-12
557 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Month-12 V-table-Win
558 ON LEAVE OF fil_Month-12 IN FRAME F-Main /* December */
560 DO WITH FRAME {&FRAME-NAME}:
561 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
562 ASSIGN {&SELF-NAME}.
563 RUN set-annual-amount.
564 END.
565 END.
566 END.
568 /* _UIB-CODE-BLOCK-END */
569 &ANALYZE-RESUME
572 &Scoped-define SELF-NAME fil_Month-2
573 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Month-2 V-table-Win
574 ON LEAVE OF fil_Month-2 IN FRAME F-Main /* February */
576 DO WITH FRAME {&FRAME-NAME}:
577 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
578 ASSIGN {&SELF-NAME}.
579 RUN set-annual-amount.
580 END.
581 END.
582 END.
584 /* _UIB-CODE-BLOCK-END */
585 &ANALYZE-RESUME
588 &Scoped-define SELF-NAME fil_Month-3
589 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Month-3 V-table-Win
590 ON LEAVE OF fil_Month-3 IN FRAME F-Main /* March */
592 DO WITH FRAME {&FRAME-NAME}:
593 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
594 ASSIGN {&SELF-NAME}.
595 RUN set-annual-amount.
596 END.
597 END.
598 END.
600 /* _UIB-CODE-BLOCK-END */
601 &ANALYZE-RESUME
604 &Scoped-define SELF-NAME fil_Month-4
605 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Month-4 V-table-Win
606 ON LEAVE OF fil_Month-4 IN FRAME F-Main /* April */
608 DO WITH FRAME {&FRAME-NAME}:
609 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
610 ASSIGN {&SELF-NAME}.
611 RUN set-annual-amount.
612 END.
613 END.
614 END.
616 /* _UIB-CODE-BLOCK-END */
617 &ANALYZE-RESUME
620 &Scoped-define SELF-NAME fil_Month-5
621 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Month-5 V-table-Win
622 ON LEAVE OF fil_Month-5 IN FRAME F-Main /* May */
624 DO WITH FRAME {&FRAME-NAME}:
625 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
626 ASSIGN {&SELF-NAME}.
627 RUN set-annual-amount.
628 END.
629 END.
630 END.
632 /* _UIB-CODE-BLOCK-END */
633 &ANALYZE-RESUME
636 &Scoped-define SELF-NAME fil_Month-6
637 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Month-6 V-table-Win
638 ON LEAVE OF fil_Month-6 IN FRAME F-Main /* June */
640 DO WITH FRAME {&FRAME-NAME}:
641 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
642 ASSIGN {&SELF-NAME}.
643 RUN set-annual-amount.
644 END.
645 END.
646 END.
648 /* _UIB-CODE-BLOCK-END */
649 &ANALYZE-RESUME
652 &Scoped-define SELF-NAME fil_Month-7
653 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Month-7 V-table-Win
654 ON LEAVE OF fil_Month-7 IN FRAME F-Main /* July */
656 DO WITH FRAME {&FRAME-NAME}:
657 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
658 ASSIGN {&SELF-NAME}.
659 RUN set-annual-amount.
660 END.
661 END.
662 END.
664 /* _UIB-CODE-BLOCK-END */
665 &ANALYZE-RESUME
668 &Scoped-define SELF-NAME fil_Month-8
669 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Month-8 V-table-Win
670 ON LEAVE OF fil_Month-8 IN FRAME F-Main /* August */
672 DO WITH FRAME {&FRAME-NAME}:
673 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
674 ASSIGN {&SELF-NAME}.
675 RUN set-annual-amount.
676 END.
677 END.
678 END.
680 /* _UIB-CODE-BLOCK-END */
681 &ANALYZE-RESUME
684 &Scoped-define SELF-NAME fil_Month-9
685 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Month-9 V-table-Win
686 ON LEAVE OF fil_Month-9 IN FRAME F-Main /* September */
688 DO WITH FRAME {&FRAME-NAME}:
689 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
690 ASSIGN {&SELF-NAME}.
691 RUN set-annual-amount.
692 END.
693 END.
694 END.
696 /* _UIB-CODE-BLOCK-END */
697 &ANALYZE-RESUME
700 &Scoped-define SELF-NAME RP.Int1
701 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int1 V-table-Win
702 ON LEAVE OF RP.Int1 IN FRAME F-Main /* Int1 */
704 DO WITH FRAME {&FRAME-NAME}:
705 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
706 ASSIGN {&SELF-NAME}.
707 RUN dispatch( 'enable-fields':U ).
708 END.
709 END.
710 END.
712 /* _UIB-CODE-BLOCK-END */
713 &ANALYZE-RESUME
716 &Scoped-define SELF-NAME RP.Int2
717 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int2 V-table-Win
718 ON LEAVE OF RP.Int2 IN FRAME F-Main /* Year */
720 DO WITH FRAME {&FRAME-NAME}:
721 IF INPUT {&SELF-NAME} <> {&SELF-NAME} THEN DO:
722 ASSIGN {&SELF-NAME}.
723 RUN assign-month-labels.
724 RUN dispatch( 'enable-fields':U ).
725 END.
726 END.
727 END.
729 /* _UIB-CODE-BLOCK-END */
730 &ANALYZE-RESUME
733 &UNDEFINE SELF-NAME
735 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
738 /* *************************** Main Block *************************** */
740 fil_BudgetClosed = budget-closed-date .
742 /* _UIB-CODE-BLOCK-END */
743 &ANALYZE-RESUME
746 /* ********************** Internal Procedures *********************** */
748 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-find-using-key V-table-Win adm/support/_key-fnd.p
749 PROCEDURE adm-find-using-key :
750 /*------------------------------------------------------------------------------
751 Purpose: Finds the current record using the contents of
752 the 'Key-Name' and 'Key-Value' attributes.
753 Parameters: <none>
754 ------------------------------------------------------------------------------*/
756 /* No Foreign keys are accepted by this SmartObject. */
758 END PROCEDURE.
760 /* _UIB-CODE-BLOCK-END */
761 &ANALYZE-RESUME
763 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
764 PROCEDURE adm-row-available :
765 /*------------------------------------------------------------------------------
766 Purpose: Dispatched to this procedure when the Record-
767 Source has a new row available. This procedure
768 tries to get the new row (or foriegn keys) from
769 the Record-Source and process it.
770 Parameters: <none>
771 ------------------------------------------------------------------------------*/
773 /* Define variables needed by this internal procedure. */
774 {src/adm/template/row-head.i}
776 /* Create a list of all the tables that we need to get. */
777 {src/adm/template/row-list.i "RP"}
779 /* Get the record ROWID's from the RECORD-SOURCE. */
780 {src/adm/template/row-get.i}
782 /* FIND each record specified by the RECORD-SOURCE. */
783 {src/adm/template/row-find.i "RP"}
785 /* Process the newly available records (i.e. display fields,
786 open queries, and/or pass records on to any RECORD-TARGETS). */
787 {src/adm/template/row-end.i}
789 END PROCEDURE.
791 /* _UIB-CODE-BLOCK-END */
792 &ANALYZE-RESUME
794 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE assign-budgets V-table-Win
795 PROCEDURE assign-budgets :
796 /*------------------------------------------------------------------------------
797 Purpose: Assign the budget figures to the AccountBalance
798 ------------------------------------------------------------------------------*/
799 DEF VAR et AS CHAR NO-UNDO.
800 DEF VAR ec AS INT NO-UNDO.
801 DEF VAR ac AS DEC NO-UNDO.
802 DEF VAR bals AS DEC EXTENT 12 NO-UNDO.
803 DEF VAR i AS INT NO-UNDO.
805 DO WITH FRAME {&FRAME-NAME}:
806 bals[1] = INPUT fil_Month-1.
807 bals[2] = INPUT fil_Month-2.
808 bals[3] = INPUT fil_Month-3.
809 bals[4] = INPUT fil_Month-4.
810 bals[5] = INPUT fil_Month-5.
811 bals[6] = INPUT fil_Month-6.
812 bals[7] = INPUT fil_Month-7.
813 bals[8] = INPUT fil_Month-8.
814 bals[9] = INPUT fil_Month-9.
815 bals[10] = INPUT fil_Month-10.
816 bals[11] = INPUT fil_Month-11.
817 bals[12] = INPUT fil_Month-12.
818 et = INPUT RP.Char2.
819 ec = INPUT RP.Int1.
820 ac = INPUT RP.Dec1.
821 END.
823 DO TRANSACTION WITH FRAME {&FRAME-NAME}:
824 i = 1.
825 FOR EACH Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK:
826 IF i > 12 THEN LEAVE.
827 FIND AccountBalance WHERE AccountBalance.EntityType = et
828 AND AccountBalance.EntityCode = ec
829 AND AccountBalance.AccountCode = ac
830 AND AccountBalance.MonthCode = Month.MonthCode EXCLUSIVE-LOCK NO-ERROR.
831 IF NOT AVAILABLE(AccountBalance) THEN DO:
832 CREATE AccountBalance.
833 ASSIGN AccountBalance.EntityType = et
834 AccountBalance.EntityCode = ec
835 AccountBalance.AccountCode = ac
836 AccountBalance.MonthCode = Month.MonthCode.
837 END.
838 AccountBalance.RevisedBudget = bals[i] .
839 IF Month.StartDate > budget-closed-date THEN
840 AccountBalance.Budget = bals[i] .
841 i = i + 1.
842 END.
843 END.
845 END PROCEDURE.
847 /* _UIB-CODE-BLOCK-END */
848 &ANALYZE-RESUME
850 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE assign-month-labels V-table-Win
851 PROCEDURE assign-month-labels :
852 /*------------------------------------------------------------------------------
853 Purpose: Assign the names of the months
854 ------------------------------------------------------------------------------*/
855 DO WITH FRAME {&FRAME-NAME}:
856 FIND FIRST Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
857 IF AVAILABLE(Month) THEN DO:
858 fil_Month-1:LABEL = Month.MonthName.
859 no-months = 1.
860 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
861 END. ELSE HIDE fil_Month-1.
862 IF AVAILABLE(Month) THEN DO:
863 fil_Month-2:LABEL = Month.MonthName.
864 no-months = 2.
865 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
866 END. ELSE HIDE fil_Month-2.
867 IF AVAILABLE(Month) THEN DO:
868 fil_Month-3:LABEL = Month.MonthName.
869 no-months = 3.
870 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
871 END. ELSE HIDE fil_Month-3.
872 IF AVAILABLE(Month) THEN DO:
873 fil_Month-4:LABEL = Month.MonthName.
874 no-months = 4.
875 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
876 END. ELSE HIDE fil_Month-4.
877 IF AVAILABLE(Month) THEN DO:
878 fil_Month-5:LABEL = Month.MonthName.
879 no-months = 5.
880 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
881 END. ELSE HIDE fil_Month-5.
882 IF AVAILABLE(Month) THEN DO:
883 fil_Month-6:LABEL = Month.MonthName.
884 no-months = 6.
885 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
886 END. ELSE HIDE fil_Month-6.
887 IF AVAILABLE(Month) THEN DO:
888 fil_Month-7:LABEL = Month.MonthName.
889 no-months = 7.
890 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
891 END. ELSE HIDE fil_Month-7.
892 IF AVAILABLE(Month) THEN DO:
893 fil_Month-8:LABEL = Month.MonthName.
894 no-months = 8.
895 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
896 END. ELSE HIDE fil_Month-8.
897 IF AVAILABLE(Month) THEN DO:
898 fil_Month-9:LABEL = Month.MonthName.
899 no-months = 9.
900 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
901 END. ELSE HIDE fil_Month-9.
902 IF AVAILABLE(Month) THEN DO:
903 fil_Month-10:LABEL = Month.MonthName.
904 no-months = 10.
905 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
906 END. ELSE HIDE fil_Month-10.
907 IF AVAILABLE(Month) THEN DO:
908 fil_Month-11:LABEL = Month.MonthName.
909 no-months = 11.
910 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
911 END. ELSE HIDE fil_Month-11.
912 IF AVAILABLE(Month) THEN DO:
913 fil_Month-12:LABEL = Month.MonthName.
914 no-months = 12.
915 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
916 END. ELSE HIDE fil_Month-12.
917 END.
919 END PROCEDURE.
921 /* _UIB-CODE-BLOCK-END */
922 &ANALYZE-RESUME
924 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
925 PROCEDURE disable_UI :
926 /*------------------------------------------------------------------------------
927 Purpose: DISABLE the User Interface
928 Parameters: <none>
929 Notes: Here we clean-up the user-interface by deleting
930 dynamic widgets we have created and/or hide
931 frames. This procedure is usually called when
932 we are ready to "clean-up" after running.
933 ------------------------------------------------------------------------------*/
934 /* Hide all frames. */
935 HIDE FRAME F-Main.
936 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
937 END PROCEDURE.
939 /* _UIB-CODE-BLOCK-END */
940 &ANALYZE-RESUME
942 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-account-summary V-table-Win
943 PROCEDURE get-account-summary :
944 /*------------------------------------------------------------------------------
945 Purpose:
946 ------------------------------------------------------------------------------*/
947 DEF OUTPUT PARAMETER et AS CHAR NO-UNDO.
948 DEF OUTPUT PARAMETER ec AS INT NO-UNDO.
949 DEF OUTPUT PARAMETER ac AS DEC NO-UNDO.
951 DEF VAR key-value AS CHAR NO-UNDO.
952 DEF VAR wh AS WIDGET-HANDLE NO-UNDO.
954 RUN get-link-handle IN adm-broker-hdl ( INPUT THIS-PROCEDURE, 'record-source':U,
955 OUTPUT source-link-name ).
956 wh = WIDGET-HANDLE(source-link-name).
957 IF VALID-HANDLE(wh) THEN DO:
958 RUN send-key IN WIDGET-HANDLE(source-link-name) ( source-table, OUTPUT key-value ).
959 IF source-table = "AccountSummary" AND NUM-ENTRIES(key-value, "/") > 2 THEN DO:
960 et = ENTRY( 1, key-value, "/").
961 ec = INT( ENTRY( 2, key-value, "/")).
962 ac = DEC( ENTRY( 3, key-value, "/")).
963 END.
964 END.
966 END PROCEDURE.
968 /* _UIB-CODE-BLOCK-END */
969 &ANALYZE-RESUME
971 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-current-budgets V-table-Win
972 PROCEDURE get-current-budgets :
973 /*------------------------------------------------------------------------------
974 Purpose: Get the current budget figures
975 ------------------------------------------------------------------------------*/
976 DEF VAR et AS CHAR NO-UNDO.
977 DEF VAR ec AS INT NO-UNDO.
978 DEF VAR ac AS DEC NO-UNDO.
980 DO WITH FRAME {&FRAME-NAME}:
981 et = INPUT RP.Char2.
982 ec = INPUT RP.Int1.
983 ac = INPUT RP.Dec1.
984 FIND FIRST Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
985 IF AVAILABLE(Month) THEN DO:
986 FIND AccountBalance WHERE AccountBalance.EntityType = et
987 AND AccountBalance.EntityCode = ec
988 AND AccountBalance.AccountCode = ac
989 AND AccountBalance.MonthCode = Month.MonthCode NO-LOCK NO-ERROR.
990 fil_Month-1 = (IF AVAILABLE(AccountBalance) THEN AccountBalance.Budget ELSE 0 ).
991 DISPLAY fil_Month-1.
992 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
993 IF INPUT RP.Char3 = "A" THEN DISABLE fil_Month-1. ELSE ENABLE fil_Month-1.
994 END.
995 ELSE HIDE fil_Month-1.
996 IF AVAILABLE(Month) THEN DO:
997 FIND AccountBalance WHERE AccountBalance.EntityType = et
998 AND AccountBalance.EntityCode = ec
999 AND AccountBalance.AccountCode = ac
1000 AND AccountBalance.MonthCode = Month.MonthCode NO-LOCK NO-ERROR.
1001 fil_Month-2 = (IF AVAILABLE(AccountBalance) THEN AccountBalance.Budget ELSE 0 ).
1002 DISPLAY fil_Month-2.
1003 IF INPUT RP.Char3 = "A" THEN DISABLE fil_Month-2. ELSE ENABLE fil_Month-2.
1004 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1005 END.
1006 ELSE HIDE fil_Month-2.
1007 IF AVAILABLE(Month) THEN DO:
1008 FIND AccountBalance WHERE AccountBalance.EntityType = et
1009 AND AccountBalance.EntityCode = ec
1010 AND AccountBalance.AccountCode = ac
1011 AND AccountBalance.MonthCode = Month.MonthCode NO-LOCK NO-ERROR.
1012 fil_Month-3 = (IF AVAILABLE(AccountBalance) THEN AccountBalance.Budget ELSE 0 ).
1013 DISPLAY fil_Month-3.
1014 IF INPUT RP.Char3 = "A" THEN DISABLE fil_Month-3. ELSE ENABLE fil_Month-3.
1015 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1016 END.
1017 ELSE HIDE fil_Month-3.
1018 IF AVAILABLE(Month) THEN DO:
1019 FIND AccountBalance WHERE AccountBalance.EntityType = et
1020 AND AccountBalance.EntityCode = ec
1021 AND AccountBalance.AccountCode = ac
1022 AND AccountBalance.MonthCode = Month.MonthCode NO-LOCK NO-ERROR.
1023 fil_Month-4 = (IF AVAILABLE(AccountBalance) THEN AccountBalance.Budget ELSE 0 ).
1024 DISPLAY fil_Month-4.
1025 IF INPUT RP.Char3 = "A" THEN DISABLE fil_Month-4. ELSE ENABLE fil_Month-4.
1026 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1027 END.
1028 ELSE HIDE fil_Month-4.
1029 IF AVAILABLE(Month) THEN DO:
1030 FIND AccountBalance WHERE AccountBalance.EntityType = et
1031 AND AccountBalance.EntityCode = ec
1032 AND AccountBalance.AccountCode = ac
1033 AND AccountBalance.MonthCode = Month.MonthCode NO-LOCK NO-ERROR.
1034 fil_Month-5 = (IF AVAILABLE(AccountBalance) THEN AccountBalance.Budget ELSE 0 ).
1035 DISPLAY fil_Month-5.
1036 IF INPUT RP.Char3 = "A" THEN DISABLE fil_Month-5. ELSE ENABLE fil_Month-5.
1037 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1038 END.
1039 ELSE HIDE fil_Month-5.
1040 IF AVAILABLE(Month) THEN DO:
1041 FIND AccountBalance WHERE AccountBalance.EntityType = et
1042 AND AccountBalance.EntityCode = ec
1043 AND AccountBalance.AccountCode = ac
1044 AND AccountBalance.MonthCode = Month.MonthCode NO-LOCK NO-ERROR.
1045 fil_Month-6 = (IF AVAILABLE(AccountBalance) THEN AccountBalance.Budget ELSE 0 ).
1046 DISPLAY fil_Month-6.
1047 IF INPUT RP.Char3 = "A" THEN DISABLE fil_Month-6. ELSE ENABLE fil_Month-6.
1048 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1049 END.
1050 ELSE HIDE fil_Month-6.
1051 IF AVAILABLE(Month) THEN DO:
1052 FIND AccountBalance WHERE AccountBalance.EntityType = et
1053 AND AccountBalance.EntityCode = ec
1054 AND AccountBalance.AccountCode = ac
1055 AND AccountBalance.MonthCode = Month.MonthCode NO-LOCK NO-ERROR.
1056 fil_Month-7 = (IF AVAILABLE(AccountBalance) THEN AccountBalance.Budget ELSE 0 ).
1057 DISPLAY fil_Month-7.
1058 IF INPUT RP.Char3 = "A" THEN DISABLE fil_Month-7. ELSE ENABLE fil_Month-7.
1059 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1060 END.
1061 ELSE HIDE fil_Month-7.
1062 IF AVAILABLE(Month) THEN DO:
1063 FIND AccountBalance WHERE AccountBalance.EntityType = et
1064 AND AccountBalance.EntityCode = ec
1065 AND AccountBalance.AccountCode = ac
1066 AND AccountBalance.MonthCode = Month.MonthCode NO-LOCK NO-ERROR.
1067 fil_Month-8 = (IF AVAILABLE(AccountBalance) THEN AccountBalance.Budget ELSE 0 ).
1068 DISPLAY fil_Month-8.
1069 IF INPUT RP.Char3 = "A" THEN DISABLE fil_Month-8. ELSE ENABLE fil_Month-8.
1070 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1071 END.
1072 ELSE HIDE fil_Month-8.
1073 IF AVAILABLE(Month) THEN DO:
1074 FIND AccountBalance WHERE AccountBalance.EntityType = et
1075 AND AccountBalance.EntityCode = ec
1076 AND AccountBalance.AccountCode = ac
1077 AND AccountBalance.MonthCode = Month.MonthCode NO-LOCK NO-ERROR.
1078 fil_Month-9 = (IF AVAILABLE(AccountBalance) THEN AccountBalance.Budget ELSE 0 ).
1079 DISPLAY fil_Month-9.
1080 IF INPUT RP.Char3 = "A" THEN DISABLE fil_Month-9. ELSE ENABLE fil_Month-9.
1081 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1082 END.
1083 ELSE HIDE fil_Month-9.
1084 IF AVAILABLE(Month) THEN DO:
1085 FIND AccountBalance WHERE AccountBalance.EntityType = et
1086 AND AccountBalance.EntityCode = ec
1087 AND AccountBalance.AccountCode = ac
1088 AND AccountBalance.MonthCode = Month.MonthCode NO-LOCK NO-ERROR.
1089 fil_Month-10 = (IF AVAILABLE(AccountBalance) THEN AccountBalance.Budget ELSE 0 ).
1090 DISPLAY fil_Month-10.
1091 IF INPUT RP.Char3 = "A" THEN DISABLE fil_Month-10. ELSE ENABLE fil_Month-10.
1092 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1093 END.
1094 ELSE HIDE fil_Month-10.
1095 IF AVAILABLE(Month) THEN DO:
1096 FIND AccountBalance WHERE AccountBalance.EntityType = et
1097 AND AccountBalance.EntityCode = ec
1098 AND AccountBalance.AccountCode = ac
1099 AND AccountBalance.MonthCode = Month.MonthCode NO-LOCK NO-ERROR.
1100 fil_Month-11 = (IF AVAILABLE(AccountBalance) THEN AccountBalance.Budget ELSE 0 ).
1101 DISPLAY fil_Month-11.
1102 IF INPUT RP.Char3 = "A" THEN DISABLE fil_Month-11. ELSE ENABLE fil_Month-11.
1103 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1104 END.
1105 ELSE HIDE fil_Month-11.
1106 IF AVAILABLE(Month) THEN DO:
1107 FIND AccountBalance WHERE AccountBalance.EntityType = et
1108 AND AccountBalance.EntityCode = ec
1109 AND AccountBalance.AccountCode = ac
1110 AND AccountBalance.MonthCode = Month.MonthCode NO-LOCK NO-ERROR.
1111 fil_Month-12 = (IF AVAILABLE(AccountBalance) THEN AccountBalance.Budget ELSE 0 ).
1112 DISPLAY fil_Month-12.
1113 IF INPUT RP.Char3 = "A" THEN DISABLE fil_Month-12. ELSE ENABLE fil_Month-12.
1114 END.
1115 ELSE HIDE fil_Month-12.
1116 END.
1117 RUN set-annual-amount.
1119 END PROCEDURE.
1121 /* _UIB-CODE-BLOCK-END */
1122 &ANALYZE-RESUME
1124 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
1125 PROCEDURE inst-enable-fields :
1126 /*------------------------------------------------------------------------------
1127 Purpose: Enable/disable fields appropriately
1128 ------------------------------------------------------------------------------*/
1129 DEF VAR ok-enabled AS LOGICAL INITIAL yes NO-UNDO.
1131 DO WITH FRAME {&FRAME-NAME}:
1132 FIND FinancialYear WHERE FinancialYear.FinancialYearCode = INPUT RP.Int2 NO-LOCK NO-ERROR.
1133 IF AVAILABLE( FinancialYear ) THEN DO:
1134 fil_YearDescription = FinancialYear.Description .
1135 DISPLAY fil_YearDescription .
1136 END.
1137 ELSE
1138 ok-enabled = no.
1140 fil_EntityName = "" .
1141 CASE INPUT RP.Char2:
1142 WHEN "P" THEN DO:
1143 FIND Property WHERE Property.PropertyCode = INPUT RP.Int1 NO-LOCK NO-ERROR.
1144 IF AVAILABLE( Property ) THEN
1145 fil_EntityName = Property.Name.
1146 ELSE
1147 ok-enabled = no.
1148 END.
1149 WHEN "J" THEN DO:
1150 FIND Project WHERE Project.ProjectCode = INPUT RP.Int1 NO-LOCK NO-ERROR.
1151 IF AVAILABLE( Project ) THEN
1152 fil_EntityName = Project.Name.
1153 ELSE
1154 ok-enabled = no.
1155 END.
1156 WHEN "L" THEN DO:
1157 FIND Company WHERE Company.CompanyCode = INPUT RP.Int1 NO-LOCK NO-ERROR.
1158 IF AVAILABLE( Company ) THEN
1159 fil_EntityName = Company.LegalName.
1160 ELSE
1161 ok-enabled = no.
1162 END.
1163 END CASE.
1164 DISPLAY fil_EntityName.
1166 FIND ChartOfAccount WHERE ChartOfAccount.AccountCode = INPUT RP.Dec1 NO-LOCK NO-ERROR.
1167 IF AVAILABLE(ChartOfAccount) THEN DO:
1168 fil_AccountName = ChartOfAccount.Name .
1169 DISPLAY fil_AccountName .
1170 END.
1171 ELSE
1172 ok-enabled = no.
1174 IF ok-enabled THEN
1175 ENABLE Btn_OK Btn_Apply.
1176 ELSE
1177 DISABLE Btn_OK Btn_Apply.
1179 IF ok-enabled THEN RUN get-current-budgets.
1181 IF INPUT RP.Char3 = "A" THEN
1182 ENABLE fil_AnnualBudget.
1183 ELSE
1184 DISABLE fil_AnnualBudget.
1187 END.
1189 END PROCEDURE.
1191 /* _UIB-CODE-BLOCK-END */
1192 &ANALYZE-RESUME
1194 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
1195 PROCEDURE inst-initialize :
1196 /*------------------------------------------------------------------------------
1197 Purpose: Initialise the necessary bits and pieces
1198 ------------------------------------------------------------------------------*/
1200 &SCOP RPT-NAME "BudgetMaintenance"
1201 RUN get-username IN sec-mgr ( OUTPUT user-name ).
1202 DO TRANSACTION:
1203 FIND RP WHERE RP.ReportID = {&RPT-NAME}
1204 AND RP.UserName = user-name
1205 EXCLUSIVE-LOCK NO-ERROR.
1207 IF NOT AVAILABLE( RP ) THEN DO:
1208 /* Find the current Financial Year */
1209 FIND LAST Month WHERE Month.StartDate <= TODAY NO-LOCK NO-ERROR.
1210 CREATE RP.
1211 ASSIGN
1212 RP.ReportID = {&RPT-NAME}
1213 RP.UserName = user-name
1214 RP.Int2 = (IF AVAILABLE(Month) THEN Month.FinancialYearCode ELSE 0)
1216 END.
1217 IF key-name = "AccountSummary" THEN DO:
1218 RP.Char2 = ext-et.
1219 RP.Int1 = ext-ec.
1220 RP.Dec1 = ext-ac.
1221 END.
1222 FIND CURRENT RP SHARE-LOCK.
1223 END.
1225 RUN assign-month-labels.
1226 RUN dispatch ( 'display-fields':U ).
1227 RUN dispatch ( 'enable-fields':U ).
1229 END PROCEDURE.
1231 /* _UIB-CODE-BLOCK-END */
1232 &ANALYZE-RESUME
1234 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-row-available V-table-Win
1235 PROCEDURE inst-row-available :
1236 /*------------------------------------------------------------------------------
1237 Purpose:
1238 ------------------------------------------------------------------------------*/
1239 IF key-name = "AccountSummary" THEN DO WITH FRAME {&FRAME-NAME}:
1240 RUN get-account-summary( OUTPUT ext-et, OUTPUT ext-ec, OUTPUT ext-ac ).
1241 END.
1242 END PROCEDURE.
1244 /* _UIB-CODE-BLOCK-END */
1245 &ANALYZE-RESUME
1247 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
1248 PROCEDURE pre-destroy :
1249 /*------------------------------------------------------------------------------
1250 Purpose:
1251 ------------------------------------------------------------------------------*/
1252 RUN check-modified( 'clear':U ).
1253 END PROCEDURE.
1255 /* _UIB-CODE-BLOCK-END */
1256 &ANALYZE-RESUME
1258 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-row-available V-table-Win
1259 PROCEDURE pre-row-available :
1260 /*------------------------------------------------------------------------------
1261 Purpose: Figure out which table we're using a row-available from
1262 ------------------------------------------------------------------------------*/
1263 IF have-records THEN RETURN.
1265 RUN get-link-handle IN adm-broker-hdl ( INPUT THIS-PROCEDURE, 'record-source':U,
1266 OUTPUT source-link-name ).
1267 IF NOT VALID-HANDLE(WIDGET-HANDLE(source-link-name)) THEN RETURN.
1269 RUN get-attribute IN WIDGET-HANDLE(source-link-name) ('internal-tables':U ).
1270 source-table = RETURN-VALUE.
1272 IF INDEX( source-table, "AccountSummary" ) > 0 THEN source-table = "AccountSummary".
1273 ELSE IF INDEX( source-table, "AccountBalance" ) > 0 THEN source-table = "AccountBalance".
1275 END PROCEDURE.
1277 /* _UIB-CODE-BLOCK-END */
1278 &ANALYZE-RESUME
1280 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-key V-table-Win adm/support/_key-snd.p
1281 PROCEDURE send-key :
1282 /*------------------------------------------------------------------------------
1283 Purpose: Sends a requested KEY value back to the calling
1284 SmartObject.
1285 Parameters: <see adm/template/sndkytop.i>
1286 ------------------------------------------------------------------------------*/
1288 /* Define variables needed by this internal procedure. */
1289 {src/adm/template/sndkytop.i}
1291 /* Return the key value associated with each key case. */
1292 {src/adm/template/sndkycas.i "EntityType" "AccountSummary" "EntityType"}
1293 {src/adm/template/sndkycas.i "EntityCode" "AccountSummary" "EntityCode"}
1294 {src/adm/template/sndkycas.i "AccountCode" "AccountSummary" "AccountCode"}
1296 /* Close the CASE statement and end the procedure. */
1297 {src/adm/template/sndkyend.i}
1299 END PROCEDURE.
1301 /* _UIB-CODE-BLOCK-END */
1302 &ANALYZE-RESUME
1304 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
1305 PROCEDURE send-records :
1306 /*------------------------------------------------------------------------------
1307 Purpose: Send record ROWID's for all tables used by
1308 this file.
1309 Parameters: see template/snd-head.i
1310 ------------------------------------------------------------------------------*/
1312 /* Define variables needed by this internal procedure. */
1313 {src/adm/template/snd-head.i}
1315 /* For each requested table, put it's ROWID in the output list. */
1316 {src/adm/template/snd-list.i "RP"}
1318 /* Deal with any unexpected table requests before closing. */
1319 {src/adm/template/snd-end.i}
1321 END PROCEDURE.
1323 /* _UIB-CODE-BLOCK-END */
1324 &ANALYZE-RESUME
1326 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-annual-amount V-table-Win
1327 PROCEDURE set-annual-amount :
1328 /*------------------------------------------------------------------------------
1329 Purpose: Total the monthly fields to come up with an annual figure
1330 ------------------------------------------------------------------------------*/
1331 DEF VAR annual-total AS DECIMAL INITIAL 0 NO-UNDO.
1333 DO WITH FRAME {&FRAME-NAME}:
1334 FIND FIRST Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1335 IF AVAILABLE(Month) THEN DO:
1336 annual-total = annual-total + INPUT fil_Month-1.
1337 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1338 END.
1339 IF AVAILABLE(Month) THEN DO:
1340 annual-total = annual-total + INPUT fil_Month-2.
1341 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1342 END.
1343 IF AVAILABLE(Month) THEN DO:
1344 annual-total = annual-total + INPUT fil_Month-3.
1345 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1346 END.
1347 IF AVAILABLE(Month) THEN DO:
1348 annual-total = annual-total + INPUT fil_Month-4.
1349 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1350 END.
1351 IF AVAILABLE(Month) THEN DO:
1352 annual-total = annual-total + INPUT fil_Month-5.
1353 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1354 END.
1355 IF AVAILABLE(Month) THEN DO:
1356 annual-total = annual-total + INPUT fil_Month-6.
1357 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1358 END.
1359 IF AVAILABLE(Month) THEN DO:
1360 annual-total = annual-total + INPUT fil_Month-7.
1361 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1362 END.
1363 IF AVAILABLE(Month) THEN DO:
1364 annual-total = annual-total + INPUT fil_Month-8.
1365 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1366 END.
1367 IF AVAILABLE(Month) THEN DO:
1368 annual-total = annual-total + INPUT fil_Month-9.
1369 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1370 END.
1371 IF AVAILABLE(Month) THEN DO:
1372 annual-total = annual-total + INPUT fil_Month-10.
1373 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1374 END.
1375 IF AVAILABLE(Month) THEN DO:
1376 annual-total = annual-total + INPUT fil_Month-11.
1377 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1378 END.
1379 IF AVAILABLE(Month) THEN DO:
1380 annual-total = annual-total + INPUT fil_Month-12.
1381 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK NO-ERROR.
1382 END.
1383 fil_AnnualBudget = annual-total.
1384 DISPLAY fil_AnnualBudget.
1385 END.
1387 END PROCEDURE.
1389 /* _UIB-CODE-BLOCK-END */
1390 &ANALYZE-RESUME
1392 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-monthly-amounts V-table-Win
1393 PROCEDURE set-monthly-amounts :
1394 /*------------------------------------------------------------------------------
1395 Purpose: Set each month to 1/2th of the annual figure
1396 ------------------------------------------------------------------------------*/
1397 DEF VAR one-month AS DECIMAL NO-UNDO.
1399 DO WITH FRAME {&FRAME-NAME}:
1400 one-month = ROUND( (INPUT fil_AnnualBudget ) / no-months, 2).
1402 FIND FIRST Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK.
1403 IF AVAILABLE(Month) THEN DO:
1404 fil_Month-1 = one-month.
1405 DISPLAY fil_Month-1.
1406 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK.
1407 END.
1408 IF AVAILABLE(Month) THEN DO:
1409 fil_Month-2 = one-month.
1410 DISPLAY fil_Month-2.
1411 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK.
1412 END.
1413 IF AVAILABLE(Month) THEN DO:
1414 fil_Month-3 = one-month.
1415 DISPLAY fil_Month-3.
1416 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK.
1417 END.
1418 IF AVAILABLE(Month) THEN DO:
1419 fil_Month-4 = one-month.
1420 DISPLAY fil_Month-4.
1421 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK.
1422 END.
1423 IF AVAILABLE(Month) THEN DO:
1424 fil_Month-5 = one-month.
1425 DISPLAY fil_Month-5.
1426 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK.
1427 END.
1428 IF AVAILABLE(Month) THEN DO:
1429 fil_Month-6 = one-month.
1430 DISPLAY fil_Month-6.
1431 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK.
1432 END.
1433 IF AVAILABLE(Month) THEN DO:
1434 fil_Month-7 = one-month.
1435 DISPLAY fil_Month-7.
1436 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK.
1437 END.
1438 IF AVAILABLE(Month) THEN DO:
1439 fil_Month-8 = one-month.
1440 DISPLAY fil_Month-8.
1441 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK.
1442 END.
1443 IF AVAILABLE(Month) THEN DO:
1444 fil_Month-9 = one-month.
1445 DISPLAY fil_Month-9.
1446 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK.
1447 END.
1448 IF AVAILABLE(Month) THEN DO:
1449 fil_Month-10 = one-month.
1450 DISPLAY fil_Month-10.
1451 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK.
1452 END.
1453 IF AVAILABLE(Month) THEN DO:
1454 fil_Month-11 = one-month.
1455 DISPLAY fil_Month-11.
1456 FIND NEXT Month WHERE Month.FinancialYearCode = RP.Int2 NO-LOCK.
1457 END.
1458 IF AVAILABLE(Month) THEN DO:
1459 fil_Month-12 = (INPUT fil_AnnualBudget ) - (one-month * 11).
1460 DISPLAY fil_Month-12.
1461 END.
1462 END.
1463 END PROCEDURE.
1465 /* _UIB-CODE-BLOCK-END */
1466 &ANALYZE-RESUME
1468 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
1469 PROCEDURE state-changed :
1470 /* -----------------------------------------------------------
1471 Purpose:
1472 Parameters: <none>
1473 Notes:
1474 -------------------------------------------------------------*/
1475 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
1476 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
1478 CASE p-state:
1479 /* Object instance CASEs can go here to replace standard behavior
1480 or add new cases. */
1481 {src/adm/template/vstates.i}
1482 END CASE.
1483 END PROCEDURE.
1485 /* _UIB-CODE-BLOCK-END */
1486 &ANALYZE-RESUME
1488 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-Key-Name V-table-Win
1489 PROCEDURE use-Key-Name :
1490 /*------------------------------------------------------------------------------
1491 Purpose:
1492 ------------------------------------------------------------------------------*/
1493 DEF INPUT PARAMETER new-name AS CHAR NO-UNDO.
1494 key-name = new-name.
1496 END PROCEDURE.
1498 /* _UIB-CODE-BLOCK-END */
1499 &ANALYZE-RESUME
1501 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-Key-Value V-table-Win
1502 PROCEDURE use-Key-Value :
1503 /*------------------------------------------------------------------------------
1504 Purpose:
1505 ------------------------------------------------------------------------------*/
1506 DEF INPUT PARAMETER new-value AS CHAR NO-UNDO.
1507 key-value = new-value.
1508 IF key-name = "EntityType" THEN DO:
1509 END.
1510 ELSE IF key-name = "EntityCode" THEN DO:
1511 END.
1512 ELSE IF key-name = "AccountCode" THEN DO:
1513 END.
1514 END PROCEDURE.
1516 /* _UIB-CODE-BLOCK-END */
1517 &ANALYZE-RESUME