Really, this should be it, for the passing income.
[capital-apms-progress.git] / vwr / mnt / v-month-end-og-accrual.w
blob1511f1eb6ef482323cc2943289e9745c745bf058
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 File:
10 Description:
11 ------------------------------------------------------------------------*/
12 CREATE WIDGET-POOL.
13 /* *************************** Definitions ************************** */
15 &SCOPED-DEFINE REPORT-ID "Month End OG Accrual"
17 {inc/ofc-this.i}
19 /* _UIB-CODE-BLOCK-END */
20 &ANALYZE-RESUME
23 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
25 /* ******************** Preprocessor Definitions ******************** */
27 &Scoped-define PROCEDURE-TYPE SmartViewer
29 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
31 /* Name of first Frame and/or Browse and/or first Query */
32 &Scoped-define FRAME-NAME F-Main
34 /* External Tables */
35 &Scoped-define EXTERNAL-TABLES RP
36 &Scoped-define FIRST-EXTERNAL-TABLE RP
39 /* Need to scope the external tables to this procedure */
40 DEFINE QUERY external_tables FOR RP.
41 /* Standard List Definitions */
42 &Scoped-Define ENABLED-FIELDS RP.Char1 RP.Int1 RP.Log2 RP.Log3 RP.Log4 ~
43 RP.Log1
44 &Scoped-define FIELD-PAIRS~
45 ~{&FP1}Int1 ~{&FP2}Int1 ~{&FP3}
46 &Scoped-define ENABLED-TABLES RP
47 &Scoped-define FIRST-ENABLED-TABLE RP
48 &Scoped-Define ENABLED-OBJECTS RECT-23 cmb_MonthEnding btn_print
49 &Scoped-Define DISPLAYED-FIELDS RP.Char1 RP.Int1 RP.Log2 RP.Log3 RP.Log4 ~
50 RP.Log1
51 &Scoped-Define DISPLAYED-OBJECTS fil_Property cmb_MonthEnding
53 /* Custom List Definitions */
54 /* ADM-CREATE-FIELDS,ADM-ASSIGN-FIELDS,List-3,List-4,List-5,List-6 */
56 /* _UIB-PREPROCESSOR-BLOCK-END */
57 &ANALYZE-RESUME
61 /* *********************** Control Definitions ********************** */
64 /* Definitions of the field level widgets */
65 DEFINE BUTTON btn_print
66 LABEL "&OK"
67 SIZE 10.29 BY 1
68 FONT 9.
70 DEFINE VARIABLE cmb_MonthEnding AS CHARACTER FORMAT "X(256)":U
71 LABEL "Month ending"
72 VIEW-AS COMBO-BOX INNER-LINES 24
73 LIST-ITEMS "Item 1"
74 SIZE 16 BY 1 NO-UNDO.
76 DEFINE VARIABLE fil_Property AS CHARACTER FORMAT "X(256)":U
77 VIEW-AS FILL-IN
78 SIZE 42.86 BY 1
79 FONT 10 NO-UNDO.
81 DEFINE RECTANGLE RECT-23
82 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
83 SIZE 68 BY 9.2.
86 /* ************************ Frame Definitions *********************** */
88 DEFINE FRAME F-Main
89 RP.Char1 AT ROW 1.2 COL 2 NO-LABEL
90 VIEW-AS RADIO-SET VERTICAL
91 RADIO-BUTTONS
92 "All properties", "All":U,
93 "Single Property", "OneProperty":U
94 SIZE 13.86 BY 1.6
95 FONT 10
96 RP.Int1 AT ROW 2 COL 13.86 COLON-ALIGNED NO-LABEL FORMAT "99999"
97 VIEW-AS FILL-IN
98 SIZE 6.57 BY 1
99 FONT 10
100 fil_Property AT ROW 2 COL 23.57 COLON-ALIGNED NO-LABEL
101 cmb_MonthEnding AT ROW 3.8 COL 13.86 COLON-ALIGNED
102 RP.Log2 AT ROW 6 COL 6.14
103 LABEL "Summary"
104 VIEW-AS TOGGLE-BOX
105 SIZE 9.14 BY .8
106 RP.Log3 AT ROW 6.8 COL 6.14 HELP
108 LABEL "Generate accrual journal"
109 VIEW-AS TOGGLE-BOX
110 SIZE 20 BY .8
111 RP.Log4 AT ROW 7.6 COL 6.14
112 LABEL "Year end"
113 VIEW-AS TOGGLE-BOX
114 SIZE 9.14 BY .8
115 RP.Log1 AT ROW 9 COL 6.14
116 LABEL "Preview"
117 VIEW-AS TOGGLE-BOX
118 SIZE 14.29 BY .8
119 FONT 10
120 btn_print AT ROW 9 COL 58.14
121 RECT-23 AT ROW 1 COL 1
122 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
123 SIDE-LABELS NO-UNDERLINE THREE-D
124 AT COL 1 ROW 1 SCROLLABLE
125 FONT 10
126 DEFAULT-BUTTON btn_print.
129 /* *********************** Procedure Settings ************************ */
131 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
132 /* Settings for THIS-PROCEDURE
133 Type: SmartViewer
134 External Tables: ttpl.RP
135 Allow: Basic,DB-Fields
136 Frames: 1
137 Add Fields to: EXTERNAL-TABLES
138 Other Settings: PERSISTENT-ONLY COMPILE
141 /* This procedure should always be RUN PERSISTENT. Report the error, */
142 /* then cleanup and return. */
143 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
144 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
145 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
146 RETURN.
147 END.
149 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
151 /* ************************* Create Window ************************** */
153 &ANALYZE-SUSPEND _CREATE-WINDOW
154 /* DESIGN Window definition (used by the UIB)
155 CREATE WINDOW V-table-Win ASSIGN
156 HEIGHT = 10.75
157 WIDTH = 74.86.
158 /* END WINDOW DEFINITION */
160 &ANALYZE-RESUME
163 /* *************** Runtime Attributes and UIB Settings ************** */
165 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
166 /* SETTINGS FOR WINDOW V-table-Win
167 VISIBLE,,RUN-PERSISTENT */
168 /* SETTINGS FOR FRAME F-Main
169 NOT-VISIBLE Size-to-Fit */
170 ASSIGN
171 FRAME F-Main:SCROLLABLE = FALSE
172 FRAME F-Main:HIDDEN = TRUE.
174 /* SETTINGS FOR FILL-IN fil_Property IN FRAME F-Main
175 NO-ENABLE */
176 /* SETTINGS FOR FILL-IN RP.Int1 IN FRAME F-Main
177 EXP-LABEL EXP-FORMAT */
178 /* SETTINGS FOR TOGGLE-BOX RP.Log1 IN FRAME F-Main
179 EXP-LABEL */
180 /* SETTINGS FOR TOGGLE-BOX RP.Log2 IN FRAME F-Main
181 EXP-LABEL */
182 /* SETTINGS FOR TOGGLE-BOX RP.Log3 IN FRAME F-Main
183 EXP-LABEL EXP-HELP */
184 /* SETTINGS FOR TOGGLE-BOX RP.Log4 IN FRAME F-Main
185 EXP-LABEL */
186 /* _RUN-TIME-ATTRIBUTES-END */
187 &ANALYZE-RESUME
190 /* Setting information for Queries and Browse Widgets fields */
192 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
193 /* Query rebuild information for FRAME F-Main
194 _Options = "NO-LOCK"
195 _Query is NOT OPENED
196 */ /* FRAME F-Main */
197 &ANALYZE-RESUME
202 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
203 /* ************************* Included-Libraries *********************** */
205 {src/adm/method/viewer.i}
206 {inc/method/m-mntvwr.i}
208 /* _UIB-CODE-BLOCK-END */
209 &ANALYZE-RESUME
214 /* ************************ Control Triggers ************************ */
216 &Scoped-define SELF-NAME btn_print
217 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_print V-table-Win
218 ON CHOOSE OF btn_print IN FRAME F-Main /* OK */
220 SELF:SENSITIVE = No.
221 RUN run-report.
222 SELF:SENSITIVE = Yes.
223 END.
225 /* _UIB-CODE-BLOCK-END */
226 &ANALYZE-RESUME
229 &Scoped-define SELF-NAME RP.Char1
230 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char1 V-table-Win
231 ON VALUE-CHANGED OF RP.Char1 IN FRAME F-Main /* Char1 */
233 RUN tenant-options-changed.
234 END.
236 /* _UIB-CODE-BLOCK-END */
237 &ANALYZE-RESUME
240 &Scoped-define SELF-NAME cmb_MonthEnding
241 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthEnding V-table-Win
242 ON U1 OF cmb_MonthEnding IN FRAME F-Main /* Month ending */
244 {inc/selcmb/scmthe1.i "RP" "Int3"}
245 END.
247 /* _UIB-CODE-BLOCK-END */
248 &ANALYZE-RESUME
251 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthEnding V-table-Win
252 ON U2 OF cmb_MonthEnding IN FRAME F-Main /* Month ending */
254 {inc/selcmb/scmthe2.i "RP" "Int3"}
255 END.
257 /* _UIB-CODE-BLOCK-END */
258 &ANALYZE-RESUME
261 &Scoped-define SELF-NAME fil_Property
262 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
263 ON U1 OF fil_Property IN FRAME F-Main
265 {inc/selfil/sfpro1.i "RP" "Int1"}
266 END.
268 /* _UIB-CODE-BLOCK-END */
269 &ANALYZE-RESUME
272 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
273 ON U2 OF fil_Property IN FRAME F-Main
275 {inc/selfil/sfpro2.i "RP" "Int1"}
276 END.
278 /* _UIB-CODE-BLOCK-END */
279 &ANALYZE-RESUME
282 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
283 ON U3 OF fil_Property IN FRAME F-Main
285 {inc/selfil/sfpro3.i "RP" "Int1"}
286 END.
288 /* _UIB-CODE-BLOCK-END */
289 &ANALYZE-RESUME
292 &Scoped-define SELF-NAME RP.Int1
293 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int1 V-table-Win
294 ON LEAVE OF RP.Int1 IN FRAME F-Main /* Int1 */
296 {inc/selcde/cdpro.i "fil_Property"}
297 END.
299 /* _UIB-CODE-BLOCK-END */
300 &ANALYZE-RESUME
303 &Scoped-define SELF-NAME RP.Log2
304 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log2 V-table-Win
305 ON VALUE-CHANGED OF RP.Log2 IN FRAME F-Main /* Summary */
307 RUN enable-appropriate-fields.
308 END.
310 /* _UIB-CODE-BLOCK-END */
311 &ANALYZE-RESUME
314 &Scoped-define SELF-NAME RP.Log3
315 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log3 V-table-Win
316 ON VALUE-CHANGED OF RP.Log3 IN FRAME F-Main /* Generate accrual journal */
318 RUN enable-appropriate-fields.
319 END.
321 /* _UIB-CODE-BLOCK-END */
322 &ANALYZE-RESUME
325 &UNDEFINE SELF-NAME
327 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
330 /* *************************** Main Block *************************** */
332 /* _UIB-CODE-BLOCK-END */
333 &ANALYZE-RESUME
336 /* ********************** Internal Procedures *********************** */
338 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win
339 PROCEDURE adm-row-available :
340 /*------------------------------------------------------------------------------
341 Purpose: Override (thoroughly!) the Progress adm-row-available
342 ------------------------------------------------------------------------------*/
344 /* Define variables needed by this internal procedure. */
345 {src/adm/template/row-head.i}
347 /* Create a list of all the tables that we need to get. */
348 {src/adm/template/row-list.i "Creditor"}
350 /* Get the record ROWID's from the RECORD-SOURCE. */
351 {src/adm/template/row-get.i}
353 /* FIND each record specified by the RECORD-SOURCE. */
354 {src/adm/template/row-find.i "Creditor"}
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 disable_UI V-table-Win _DEFAULT-DISABLE
367 PROCEDURE disable_UI :
368 /*------------------------------------------------------------------------------
369 Purpose: DISABLE the User Interface
370 Parameters: <none>
371 Notes: Here we clean-up the user-interface by deleting
372 dynamic widgets we have created and/or hide
373 frames. This procedure is usually called when
374 we are ready to "clean-up" after running.
375 ------------------------------------------------------------------------------*/
376 /* Hide all frames. */
377 HIDE FRAME F-Main.
378 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
379 END PROCEDURE.
381 /* _UIB-CODE-BLOCK-END */
382 &ANALYZE-RESUME
385 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-appropriate-fields V-table-Win
386 PROCEDURE enable-appropriate-fields :
387 /*------------------------------------------------------------------------------
388 Purpose:
389 ------------------------------------------------------------------------------*/
390 DO WITH FRAME {&FRAME-NAME}:
392 IF INPUT RP.Log2 THEN DISABLE RP.Log3 RP.Log4. ELSE ENABLE RP.Log3 RP.Log4.
393 IF NOT INPUT RP.Log2 AND INPUT RP.Log3 THEN ENABLE RP.Log4. ELSE DISABLE RP.Log4.
395 RUN tenant-options-changed.
396 END.
397 END PROCEDURE.
399 /* _UIB-CODE-BLOCK-END */
400 &ANALYZE-RESUME
403 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
404 PROCEDURE inst-enable-fields :
405 /*------------------------------------------------------------------------------
406 Purpose:
407 ------------------------------------------------------------------------------*/
409 RUN enable-appropriate-fields.
411 END PROCEDURE.
413 /* _UIB-CODE-BLOCK-END */
414 &ANALYZE-RESUME
417 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
418 PROCEDURE inst-initialize :
419 /*------------------------------------------------------------------------------
420 Purpose:
421 ------------------------------------------------------------------------------*/
422 DEF VAR user-name AS CHAR NO-UNDO.
424 RUN get-username IN sys-mgr( OUTPUT user-name ).
426 FIND RP WHERE RP.UserName = user-name AND RP.ReportID = {&REPORT-ID} NO-ERROR.
428 IF NOT AVAILABLE RP THEN DO WITH FRAME {&FRAME-NAME}:
429 CREATE RP.
430 ASSIGN RP.ReportID = {&REPORT-ID}
431 RP.UserName = user-name
432 RP.Char1 = "OneProperty"
433 RP.Log1 = Yes
434 RP.Log2 = No.
435 END.
437 RUN dispatch( 'display-fields':U ).
438 RUN dispatch( 'enable-fields':U ).
440 END PROCEDURE.
442 /* _UIB-CODE-BLOCK-END */
443 &ANALYZE-RESUME
446 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
447 PROCEDURE pre-destroy :
448 /*------------------------------------------------------------------------------
449 Purpose:
450 Parameters: <none>
451 Notes:
452 ------------------------------------------------------------------------------*/
454 RUN check-modified( "CLEAR" ).
456 END PROCEDURE.
458 /* _UIB-CODE-BLOCK-END */
459 &ANALYZE-RESUME
462 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE run-report V-table-Win
463 PROCEDURE run-report :
464 /*------------------------------------------------------------------------------
465 Purpose: Actually run the report through RB engine.
466 ------------------------------------------------------------------------------*/
467 DEF VAR report-options AS CHAR NO-UNDO.
468 DEF VAR open-only AS LOGI NO-UNDO INITIAL No.
470 RUN verify-report.
471 IF RETURN-VALUE = "FAIL" THEN RETURN.
473 RUN dispatch( 'update-record':U ).
475 open-only = RP.Log1.
476 IF RP.Log3 THEN open-only = Yes.
478 report-options = RP.Char1
479 + (IF RP.Char1 = "OneProperty" THEN "~nProperty," + STRING( RP.Int1 ) ELSE "")
480 + (IF RP.Log1 THEN "~nPreview" ELSE "")
481 + (IF RP.Log2 THEN "~nSummary" ELSE "")
482 + (IF NOT RP.Log2 AND RP.Log3 THEN "~nMakeTransactions" ELSE "")
483 + (IF NOT RP.Log2 AND RP.Log3 AND RP.Log4 THEN "~nYearEnd" ELSE "")
484 + "~nMonthEnding," + STRING( RP.Int3 )
487 IF RP.Log1 THEN DO:
488 RUN notify( 'set-busy, CONTAINER-SOURCE':U ).
489 RUN process/report/month-end-og-accrual.p ( report-options ).
490 RUN notify( 'set-idle, CONTAINER-SOURCE':U ).
491 END.
492 ELSE DO:
493 RUN make-bq-entry IN sys-mgr( "process/report/month-end-og-accrual.p", report-options, ?, ?).
494 END.
496 END PROCEDURE.
498 /* _UIB-CODE-BLOCK-END */
499 &ANALYZE-RESUME
502 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win
503 PROCEDURE send-records :
504 /*------------------------------------------------------------------------------
505 Purpose:
506 ------------------------------------------------------------------------------*/
508 /* Define variables needed by this internal procedure. */
509 {src/adm/template/snd-head.i}
511 /* For each requested table, put it's ROWID in the output list. */
512 {src/adm/template/snd-list.i "Creditor"}
514 /* Deal with any unexpected table requests before closing. */
515 {src/adm/template/snd-end.i}
517 END PROCEDURE.
519 /* _UIB-CODE-BLOCK-END */
520 &ANALYZE-RESUME
523 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
524 PROCEDURE state-changed :
525 /* -----------------------------------------------------------
526 Purpose:
527 Parameters: <none>
528 Notes:
529 -------------------------------------------------------------*/
530 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
531 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
533 CASE p-state:
534 /* Object instance CASEs can go here to replace standard behavior
535 or add new cases. */
536 {src/adm/template/vstates.i}
537 END CASE.
538 END PROCEDURE.
540 /* _UIB-CODE-BLOCK-END */
541 &ANALYZE-RESUME
544 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE tenant-options-changed V-table-Win
545 PROCEDURE tenant-options-changed :
546 /*------------------------------------------------------------------------------
547 Purpose:
548 ------------------------------------------------------------------------------*/
549 DEF VAR options AS CHAR NO-UNDO.
551 options = INPUT FRAME {&FRAME-NAME} RP.Char1.
553 CASE options:
554 WHEN "All" THEN
555 DO WITH FRAME {&FRAME-NAME}:
556 HIDE RP.Int1 fil_Property.
557 RUN set-link-attributes IN sys-mgr( THIS-PROCEDURE, STRING( fil_Property:HANDLE ), "HIDDEN = Yes":U ).
558 END.
560 WHEN "OneProperty" THEN
561 DO WITH FRAME {&FRAME-NAME}:
562 VIEW RP.Int1 fil_Property.
563 RUN set-link-attributes IN sys-mgr( THIS-PROCEDURE, STRING( fil_Property:HANDLE ), "HIDDEN = No":U ).
564 END.
566 END.
568 END PROCEDURE.
570 /* _UIB-CODE-BLOCK-END */
571 &ANALYZE-RESUME
574 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-report V-table-Win
575 PROCEDURE verify-report :
576 /*------------------------------------------------------------------------------
577 Purpose:
578 ------------------------------------------------------------------------------*/
580 CASE INPUT FRAME {&FRAME-NAME} RP.Char1:
582 WHEN 'OneProperty' THEN
583 IF NOT CAN-FIND( FIRST Property WHERE Property.PropertyCode =
584 INPUT FRAME {&FRAME-NAME} RP.Int1 ) THEN
586 MESSAGE "You must select a property" VIEW-AS ALERT-BOX ERROR.
587 APPLY 'ENTRY':U TO RP.Int1 IN FRAME {&FRAME-NAME}.
588 RETURN "FAIL".
589 END.
590 END.
592 END PROCEDURE.
594 /* _UIB-CODE-BLOCK-END */
595 &ANALYZE-RESUME