Changes for Catalyst APMS. Added PDF checkboxes to screens the generate remittance...
[capital-apms-progress.git] / vwr / mnt / v-tr-j.w
blob5a4ac4765b4672f5d153ba227e533b9394b3389c
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 DEF VAR user-name AS CHAR INITIAL "Andrew" NO-UNDO.
17 /* _UIB-CODE-BLOCK-END */
18 &ANALYZE-RESUME
21 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
23 /* ******************** Preprocessor Definitions ******************** */
25 &Scoped-define PROCEDURE-TYPE SmartViewer
27 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
29 /* Name of first Frame and/or Browse and/or first Query */
30 &Scoped-define FRAME-NAME F-Main
32 /* External Tables */
33 &Scoped-define EXTERNAL-TABLES RP
34 &Scoped-define FIRST-EXTERNAL-TABLE RP
37 /* Need to scope the external tables to this procedure */
38 DEFINE QUERY external_tables FOR RP.
39 /* Standard List Definitions */
40 &Scoped-Define ENABLED-FIELDS RP.Char1 RP.Int1 RP.Int2 RP.Char4 RP.Dec1 ~
41 RP.Dec2 RP.Log9 RP.Char3 RP.Log5 RP.Char2 RP.Log2
42 &Scoped-define FIELD-PAIRS~
43 ~{&FP1}Int1 ~{&FP2}Int1 ~{&FP3}~
44 ~{&FP1}Int2 ~{&FP2}Int2 ~{&FP3}~
45 ~{&FP1}Dec1 ~{&FP2}Dec1 ~{&FP3}~
46 ~{&FP1}Dec2 ~{&FP2}Dec2 ~{&FP3}~
47 ~{&FP1}Char2 ~{&FP2}Char2 ~{&FP3}
48 &Scoped-define ENABLED-TABLES RP
49 &Scoped-define FIRST-ENABLED-TABLE RP
50 &Scoped-Define ENABLED-OBJECTS RECT-1 RECT-5 RECT-4 RECT-6 cb-month1 ~
51 cb-month2 btn_Browse Btn_OK
52 &Scoped-Define DISPLAYED-FIELDS RP.Char1 RP.Int1 RP.Int2 RP.Char4 RP.Dec1 ~
53 RP.Dec2 RP.Log9 RP.Char3 RP.Log5 RP.Char2 RP.Log2
54 &Scoped-Define DISPLAYED-OBJECTS fil_proj1 fil_proj2 fil_account1 ~
55 fil_account2 cb-month1 cb-month2
57 /* Custom List Definitions */
58 /* ADM-CREATE-FIELDS,ADM-ASSIGN-FIELDS,List-3,List-4,List-5,List-6 */
60 /* _UIB-PREPROCESSOR-BLOCK-END */
61 &ANALYZE-RESUME
65 /* *********************** Control Definitions ********************** */
68 /* Definitions of the field level widgets */
69 DEFINE BUTTON btn_Browse
70 LABEL "Browse"
71 SIZE 6.29 BY 1.05
72 FONT 10.
74 DEFINE BUTTON Btn_OK AUTO-GO DEFAULT
75 LABEL "&OK"
76 SIZE 12 BY 1.2
77 BGCOLOR 8 .
79 DEFINE VARIABLE cb-month1 AS CHARACTER FORMAT "X(256)":U
80 LABEL "Period"
81 VIEW-AS COMBO-BOX INNER-LINES 15
82 LIST-ITEMS "10/07/1886"
83 SIZE 17.14 BY 1 NO-UNDO.
85 DEFINE VARIABLE cb-month2 AS CHARACTER FORMAT "X(256)":U
86 LABEL "To"
87 VIEW-AS COMBO-BOX INNER-LINES 15
88 LIST-ITEMS "Item 1"
89 SIZE 17.14 BY 1 NO-UNDO.
91 DEFINE VARIABLE fil_account1 AS CHARACTER FORMAT "X(256)":U
92 VIEW-AS FILL-IN
93 SIZE 51.29 BY 1
94 BGCOLOR 16 NO-UNDO.
96 DEFINE VARIABLE fil_account2 AS CHARACTER FORMAT "X(256)":U
97 VIEW-AS FILL-IN
98 SIZE 51.29 BY 1
99 BGCOLOR 16 NO-UNDO.
101 DEFINE VARIABLE fil_proj1 AS CHARACTER FORMAT "X(256)":U
102 VIEW-AS FILL-IN
103 SIZE 51.29 BY 1
104 BGCOLOR 16 NO-UNDO.
106 DEFINE VARIABLE fil_proj2 AS CHARACTER FORMAT "X(256)":U
107 VIEW-AS FILL-IN
108 SIZE 51.29 BY 1
109 BGCOLOR 16 NO-UNDO.
111 DEFINE RECTANGLE RECT-1
112 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
113 SIZE 74.86 BY 15.6.
115 DEFINE RECTANGLE RECT-4
116 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
117 SIZE 73.72 BY 3.45.
119 DEFINE RECTANGLE RECT-5
120 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
121 SIZE 73.72 BY 3.55.
123 DEFINE RECTANGLE RECT-6
124 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
125 SIZE 73.72 BY 1.6.
128 /* ************************ Frame Definitions *********************** */
130 DEFINE FRAME F-Main
131 RP.Char1 AT ROW 1.45 COL 2.14 NO-LABEL
132 VIEW-AS RADIO-SET HORIZONTAL EXPAND
133 RADIO-BUTTONS
134 "Single project", "1":U,
135 "Project range", "R":U,
136 "Project hierarchy", "H":U
137 SIZE 48 BY 1
138 FONT 10
139 RP.Int1 AT ROW 2.55 COL 9.29 COLON-ALIGNED
140 LABEL "Project" FORMAT "99999"
141 VIEW-AS FILL-IN
142 SIZE 6.29 BY 1
143 fil_proj1 AT ROW 2.55 COL 21.43 COLON-ALIGNED NO-LABEL
144 RP.Int2 AT ROW 3.55 COL 9.29 COLON-ALIGNED
145 LABEL "To" FORMAT "99999"
146 VIEW-AS FILL-IN
147 SIZE 6.29 BY 1
148 fil_proj2 AT ROW 3.55 COL 21.43 COLON-ALIGNED NO-LABEL
149 RP.Char4 AT ROW 5.45 COL 2.14 HELP
150 "" NO-LABEL
151 VIEW-AS RADIO-SET HORIZONTAL EXPAND
152 RADIO-BUTTONS
153 "All accounts", "*":U,
154 "Single account", "1":U,
155 "Account range", "R":U
156 SIZE 48 BY 1
157 FONT 10
158 RP.Dec1 AT ROW 6.55 COL 9.29 COLON-ALIGNED HELP
160 LABEL "Account" FORMAT "9999.99"
161 VIEW-AS FILL-IN
162 SIZE 8 BY 1
163 fil_account1 AT ROW 6.55 COL 21.43 COLON-ALIGNED NO-LABEL
164 RP.Dec2 AT ROW 7.55 COL 9.29 COLON-ALIGNED HELP
166 LABEL "to" FORMAT "9999.99"
167 VIEW-AS FILL-IN
168 SIZE 8 BY 1
169 fil_account2 AT ROW 7.55 COL 21.43 COLON-ALIGNED NO-LABEL
170 cb-month1 AT ROW 9.35 COL 9.29 COLON-ALIGNED
171 cb-month2 AT ROW 9.35 COL 36.14 COLON-ALIGNED
172 RP.Log9 AT ROW 11 COL 11.29 HELP
174 LABEL "Hide related records"
175 VIEW-AS TOGGLE-BOX
176 SIZE 17.14 BY .8
177 RP.Char3 AT ROW 12.2 COL 11.29 HELP
178 "" NO-LABEL
179 VIEW-AS RADIO-SET VERTICAL
180 RADIO-BUTTONS
181 "by Project then by Account", "J":U,
182 "by Account then by Project", "A":U
183 SIZE 21.72 BY 1.6
184 FONT 10
185 RP.Log5 AT ROW 13.95 COL 11.29
186 LABEL "Export to"
187 VIEW-AS TOGGLE-BOX
188 SIZE 9.14 BY 1
189 FONT 10
190 RP.Char2 AT ROW 13.95 COL 18.43 COLON-ALIGNED NO-LABEL FORMAT "X(120)"
191 VIEW-AS FILL-IN
192 SIZE 48.57 BY 1
193 FONT 10
194 btn_Browse AT ROW 13.95 COL 69
195 RP.Log2 AT ROW 15.2 COL 11.29 HELP
197 LABEL "Preview"
198 VIEW-AS TOGGLE-BOX
199 SIZE 11.72 BY .8
200 FONT 10
201 Btn_OK AT ROW 15.2 COL 63.29
202 RECT-1 AT ROW 1 COL 1
203 RECT-5 AT ROW 1.2 COL 1.57
204 RECT-4 AT ROW 5.2 COL 1.57
205 RECT-6 AT ROW 9 COL 1.57
206 "Sequence" VIEW-AS TEXT
207 SIZE 7.43 BY .8 AT ROW 12.2 COL 3.29
208 FONT 10
209 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
210 SIDE-LABELS NO-UNDERLINE THREE-D
211 AT COL 1 ROW 1 SCROLLABLE
212 FONT 10
213 DEFAULT-BUTTON Btn_OK.
216 /* *********************** Procedure Settings ************************ */
218 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
219 /* Settings for THIS-PROCEDURE
220 Type: SmartViewer
221 External Tables: ttpl.RP
222 Allow: Basic,DB-Fields
223 Frames: 1
224 Add Fields to: EXTERNAL-TABLES
225 Other Settings: PERSISTENT-ONLY COMPILE
228 /* This procedure should always be RUN PERSISTENT. Report the error, */
229 /* then cleanup and return. */
230 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
231 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
232 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
233 RETURN.
234 END.
236 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
238 /* ************************* Create Window ************************** */
240 &ANALYZE-SUSPEND _CREATE-WINDOW
241 /* DESIGN Window definition (used by the UIB)
242 CREATE WINDOW V-table-Win ASSIGN
243 HEIGHT = 17.45
244 WIDTH = 78.72.
245 /* END WINDOW DEFINITION */
247 &ANALYZE-RESUME
250 /* *************** Runtime Attributes and UIB Settings ************** */
252 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
253 /* SETTINGS FOR WINDOW V-table-Win
254 VISIBLE,,RUN-PERSISTENT */
255 /* SETTINGS FOR FRAME F-Main
256 NOT-VISIBLE Size-to-Fit */
257 ASSIGN
258 FRAME F-Main:SCROLLABLE = FALSE
259 FRAME F-Main:HIDDEN = TRUE.
261 /* SETTINGS FOR FILL-IN RP.Char2 IN FRAME F-Main
262 EXP-LABEL EXP-FORMAT */
263 /* SETTINGS FOR RADIO-SET RP.Char3 IN FRAME F-Main
264 EXP-HELP */
265 /* SETTINGS FOR RADIO-SET RP.Char4 IN FRAME F-Main
266 EXP-HELP */
267 /* SETTINGS FOR FILL-IN RP.Dec1 IN FRAME F-Main
268 EXP-LABEL EXP-FORMAT EXP-HELP */
269 /* SETTINGS FOR FILL-IN RP.Dec2 IN FRAME F-Main
270 EXP-LABEL EXP-FORMAT EXP-HELP */
271 /* SETTINGS FOR FILL-IN fil_account1 IN FRAME F-Main
272 NO-ENABLE */
273 /* SETTINGS FOR FILL-IN fil_account2 IN FRAME F-Main
274 NO-ENABLE */
275 /* SETTINGS FOR FILL-IN fil_proj1 IN FRAME F-Main
276 NO-ENABLE */
277 /* SETTINGS FOR FILL-IN fil_proj2 IN FRAME F-Main
278 NO-ENABLE */
279 /* SETTINGS FOR FILL-IN RP.Int1 IN FRAME F-Main
280 EXP-LABEL EXP-FORMAT */
281 /* SETTINGS FOR FILL-IN RP.Int2 IN FRAME F-Main
282 EXP-LABEL EXP-FORMAT */
283 /* SETTINGS FOR TOGGLE-BOX RP.Log2 IN FRAME F-Main
284 EXP-LABEL EXP-HELP */
285 /* SETTINGS FOR TOGGLE-BOX RP.Log5 IN FRAME F-Main
286 EXP-LABEL */
287 /* SETTINGS FOR TOGGLE-BOX RP.Log9 IN FRAME F-Main
288 EXP-LABEL EXP-HELP */
289 /* _RUN-TIME-ATTRIBUTES-END */
290 &ANALYZE-RESUME
293 /* Setting information for Queries and Browse Widgets fields */
295 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
296 /* Query rebuild information for FRAME F-Main
297 _Options = "NO-LOCK"
298 _Query is NOT OPENED
299 */ /* FRAME F-Main */
300 &ANALYZE-RESUME
305 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
306 /* ************************* Included-Libraries *********************** */
308 {src/adm/method/viewer.i}
309 {inc/method/m-mntvwr.i}
311 /* _UIB-CODE-BLOCK-END */
312 &ANALYZE-RESUME
317 /* ************************ Control Triggers ************************ */
319 &Scoped-define SELF-NAME btn_Browse
320 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_Browse V-table-Win
321 ON CHOOSE OF btn_Browse IN FRAME F-Main /* Browse */
323 RUN select-file-dialog .
324 END.
326 /* _UIB-CODE-BLOCK-END */
327 &ANALYZE-RESUME
330 &Scoped-define SELF-NAME Btn_OK
331 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_OK V-table-Win
332 ON CHOOSE OF Btn_OK IN FRAME F-Main /* OK */
334 DISABLE {&SELF-NAME} WITH FRAME {&FRAME-NAME}.
335 RUN run-report.
336 ENABLE {&SELF-NAME} WITH FRAME {&FRAME-NAME}.
337 END.
339 /* _UIB-CODE-BLOCK-END */
340 &ANALYZE-RESUME
343 &Scoped-define SELF-NAME RP.Char1
344 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char1 V-table-Win
345 ON VALUE-CHANGED OF RP.Char1 IN FRAME F-Main /* Char1 */
347 RUN enable-appropriate-fields.
348 END.
350 /* _UIB-CODE-BLOCK-END */
351 &ANALYZE-RESUME
354 &Scoped-define SELF-NAME RP.Char3
355 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char3 V-table-Win
356 ON VALUE-CHANGED OF RP.Char3 IN FRAME F-Main /* Char3 */
358 RUN enable-appropriate-fields.
359 END.
361 /* _UIB-CODE-BLOCK-END */
362 &ANALYZE-RESUME
365 &Scoped-define SELF-NAME RP.Char4
366 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char4 V-table-Win
367 ON VALUE-CHANGED OF RP.Char4 IN FRAME F-Main /* Char4 */
369 RUN enable-appropriate-fields.
370 END.
372 /* _UIB-CODE-BLOCK-END */
373 &ANALYZE-RESUME
376 &Scoped-define SELF-NAME RP.Dec1
377 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Dec1 V-table-Win
378 ON LEAVE OF RP.Dec1 IN FRAME F-Main /* Account */
380 DO WITH FRAME {&FRAME-NAME}:
381 FIND ProjectBudget WHERE ProjectBudget.ProjectCode = INPUT RP.Int1
382 AND ProjectBudget.AccountCode = INPUT RP.Dec1
383 NO-LOCK NO-ERROR.
384 IF AVAILABLE(ProjectBudget) THEN
385 fil_account1:SCREEN-VALUE = ProjectBudget.Description.
386 END.
387 END.
389 /* _UIB-CODE-BLOCK-END */
390 &ANALYZE-RESUME
393 &Scoped-define SELF-NAME RP.Dec2
394 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Dec2 V-table-Win
395 ON LEAVE OF RP.Dec2 IN FRAME F-Main /* to */
397 DO WITH FRAME {&FRAME-NAME}:
398 FIND ProjectBudget WHERE ProjectBudget.ProjectCode = INPUT RP.Int1
399 AND ProjectBudget.AccountCode = INPUT RP.Dec2
400 NO-LOCK NO-ERROR.
401 IF AVAILABLE(ProjectBudget) THEN
402 fil_account2:SCREEN-VALUE = ProjectBudget.Description.
403 END.
404 END.
406 /* _UIB-CODE-BLOCK-END */
407 &ANALYZE-RESUME
410 &Scoped-define SELF-NAME fil_proj1
411 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_proj1 V-table-Win
412 ON U1 OF fil_proj1 IN FRAME F-Main
414 {inc/selfil/sfprj1.i "RP" "Int1"}
415 END.
417 /* _UIB-CODE-BLOCK-END */
418 &ANALYZE-RESUME
421 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_proj1 V-table-Win
422 ON U2 OF fil_proj1 IN FRAME F-Main
424 {inc/selfil/sfprj2.i "RP" "Int1"}
425 END.
427 /* _UIB-CODE-BLOCK-END */
428 &ANALYZE-RESUME
431 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_proj1 V-table-Win
432 ON U3 OF fil_proj1 IN FRAME F-Main
434 {inc/selfil/sfprj3.i "RP" "Int1"}
435 END.
437 /* _UIB-CODE-BLOCK-END */
438 &ANALYZE-RESUME
441 &Scoped-define SELF-NAME fil_proj2
442 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_proj2 V-table-Win
443 ON U1 OF fil_proj2 IN FRAME F-Main
445 {inc/selfil/sfprj1.i "RP" "Int2"}
446 END.
448 /* _UIB-CODE-BLOCK-END */
449 &ANALYZE-RESUME
452 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_proj2 V-table-Win
453 ON U2 OF fil_proj2 IN FRAME F-Main
455 {inc/selfil/sfprj2.i "RP" "Int2"}
456 END.
458 /* _UIB-CODE-BLOCK-END */
459 &ANALYZE-RESUME
462 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_proj2 V-table-Win
463 ON U3 OF fil_proj2 IN FRAME F-Main
465 {inc/selfil/sfprj3.i "RP" "Int2"}
466 END.
468 /* _UIB-CODE-BLOCK-END */
469 &ANALYZE-RESUME
472 &Scoped-define SELF-NAME RP.Int1
473 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int1 V-table-Win
474 ON LEAVE OF RP.Int1 IN FRAME F-Main /* Project */
476 {inc/selcde/cdprj.i "fil_proj1"}
477 END.
479 /* _UIB-CODE-BLOCK-END */
480 &ANALYZE-RESUME
483 &Scoped-define SELF-NAME RP.Int2
484 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int2 V-table-Win
485 ON LEAVE OF RP.Int2 IN FRAME F-Main /* To */
487 {inc/selcde/cdprj.i "fil_proj2"}
488 END.
490 /* _UIB-CODE-BLOCK-END */
491 &ANALYZE-RESUME
494 &Scoped-define SELF-NAME RP.Log5
495 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log5 V-table-Win
496 ON VALUE-CHANGED OF RP.Log5 IN FRAME F-Main /* Export to */
498 RUN enable-appropriate-fields.
499 END.
501 /* _UIB-CODE-BLOCK-END */
502 &ANALYZE-RESUME
505 &UNDEFINE SELF-NAME
507 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
510 /* *************************** Main Block *************************** */
512 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
513 RUN dispatch IN THIS-PROCEDURE ('initialize':U).
514 &ENDIF
516 /************************ INTERNAL PROCEDURES ********************/
518 /* _UIB-CODE-BLOCK-END */
519 &ANALYZE-RESUME
522 /* ********************** Internal Procedures *********************** */
524 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
525 PROCEDURE adm-row-available :
526 /*------------------------------------------------------------------------------
527 Purpose: Dispatched to this procedure when the Record-
528 Source has a new row available. This procedure
529 tries to get the new row (or foriegn keys) from
530 the Record-Source and process it.
531 Parameters: <none>
532 ------------------------------------------------------------------------------*/
534 /* Define variables needed by this internal procedure. */
535 {src/adm/template/row-head.i}
537 /* Create a list of all the tables that we need to get. */
538 {src/adm/template/row-list.i "RP"}
540 /* Get the record ROWID's from the RECORD-SOURCE. */
541 {src/adm/template/row-get.i}
543 /* FIND each record specified by the RECORD-SOURCE. */
544 {src/adm/template/row-find.i "RP"}
546 /* Process the newly available records (i.e. display fields,
547 open queries, and/or pass records on to any RECORD-TARGETS). */
548 {src/adm/template/row-end.i}
550 END PROCEDURE.
552 /* _UIB-CODE-BLOCK-END */
553 &ANALYZE-RESUME
556 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
557 PROCEDURE disable_UI :
558 /*------------------------------------------------------------------------------
559 Purpose: DISABLE the User Interface
560 Parameters: <none>
561 Notes: Here we clean-up the user-interface by deleting
562 dynamic widgets we have created and/or hide
563 frames. This procedure is usually called when
564 we are ready to "clean-up" after running.
565 ------------------------------------------------------------------------------*/
566 /* Hide all frames. */
567 HIDE FRAME F-Main.
568 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
569 END PROCEDURE.
571 /* _UIB-CODE-BLOCK-END */
572 &ANALYZE-RESUME
575 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-appropriate-fields V-table-Win
576 PROCEDURE enable-appropriate-fields :
577 /*------------------------------------------------------------------------------
578 Purpose: As its name!
579 ------------------------------------------------------------------------------*/
581 DO WITH FRAME {&FRAME-NAME}:
582 CASE INPUT RP.Char1: /* Project: single, hierarchy or range */
583 WHEN "1" THEN DO:
584 RUN set-link-attributes IN sys-mgr ( THIS-PROCEDURE, STRING(fil_proj2:HANDLE), 'hidden = yes' ).
585 HIDE RP.Int2 fil_proj2 .
586 END.
587 WHEN "H" THEN DO:
588 RUN set-link-attributes IN sys-mgr ( THIS-PROCEDURE, STRING(fil_proj2:HANDLE), 'hidden = yes' ).
589 HIDE RP.Int2 fil_proj2 .
590 END.
591 WHEN "R" THEN DO:
592 RUN set-link-attributes IN sys-mgr ( THIS-PROCEDURE, STRING(fil_proj2:HANDLE), 'hidden = no' ).
593 VIEW RP.Int2 fil_proj2 .
594 END.
595 END CASE.
597 CASE INPUT RP.Char4: /* Account: All, Single, range*/
598 WHEN "*" THEN DO:
599 RUN set-link-attributes IN sys-mgr ( THIS-PROCEDURE, STRING( fil_account1:HANDLE), 'hidden = yes' ).
600 RUN set-link-attributes IN sys-mgr ( THIS-PROCEDURE, STRING( fil_account2:HANDLE), 'hidden = yes' ).
601 HIDE RP.Dec1 fil_account1 RP.Dec2 fil_account2 .
602 END.
603 WHEN "1" THEN DO:
604 RUN set-link-attributes IN sys-mgr ( THIS-PROCEDURE, STRING( fil_account1:HANDLE), 'hidden = no' ).
605 RUN set-link-attributes IN sys-mgr ( THIS-PROCEDURE, STRING( fil_account2:HANDLE), 'hidden = yes' ).
606 VIEW RP.Dec1 fil_account1 .
607 HIDE RP.Dec2 fil_account2 .
608 END.
609 WHEN "R" THEN DO:
610 RUN set-link-attributes IN sys-mgr ( THIS-PROCEDURE, STRING( fil_account1:HANDLE), 'hidden = no' ).
611 RUN set-link-attributes IN sys-mgr ( THIS-PROCEDURE, STRING( fil_account2:HANDLE), 'hidden = no' ).
612 VIEW RP.Dec1 fil_account1 RP.Dec2 fil_account2 .
613 END.
614 END CASE.
616 /* Export to... */
617 IF INPUT RP.Log5 THEN
618 VIEW RP.Char2 btn_Browse .
619 ELSE
620 HIDE RP.Char2 btn_Browse .
622 END.
624 END PROCEDURE.
626 /* _UIB-CODE-BLOCK-END */
627 &ANALYZE-RESUME
630 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
631 PROCEDURE inst-initialize :
632 /*------------------------------------------------------------------------------
633 Purpose: Initialise the necessary bits and pieces
634 ------------------------------------------------------------------------------*/
635 DEF VAR month1-list AS CHAR INITIAL "" NO-UNDO.
636 DEF VAR month2-list AS CHAR INITIAL "" NO-UNDO.
637 DEF VAR delim AS CHAR INITIAL "|" NO-UNDO.
639 RUN get-username IN sec-mgr ( OUTPUT user-name ).
640 FIND RP WHERE RP.ReportID = "tr-j"
641 AND RP.UserName = user-name
642 NO-ERROR.
644 IF NOT AVAILABLE( RP ) THEN DO:
645 CREATE RP.
646 ASSIGN
647 RP.ReportID = "tr-j"
648 RP.UserName = user-name
650 END.
652 /* Initialise the month list for the combos */
653 FOR EACH Month NO-LOCK:
654 month1-list = month1-list + delim + STRING( Month.StartDate, "99/99/9999" ).
655 month2-list = month2-list + delim + STRING( Month.EndDate, "99/99/9999" ).
656 END.
657 month1-list = SUBSTRING( month1-list, 2). /* trim initial delimiter */
658 month2-list = SUBSTRING( month2-list, 2). /* trim initial delimiter */
659 DO WITH FRAME {&FRAME-NAME}:
660 ASSIGN
661 cb-month1:DELIMITER = delim
662 cb-month2:DELIMITER = delim
663 cb-month1:LIST-ITEMS = month1-list
664 cb-month2:LIST-ITEMS = month2-list
666 END.
668 /* Set to initially saved values */
669 FIND Month WHERE Month.MonthCode = RP.Int3 NO-LOCK NO-ERROR.
670 IF AVAILABLE(Month) THEN cb-month1 = STRING( Month.StartDate, "99/99/9999" ).
671 FIND Month WHERE Month.MonthCode = RP.Int4 NO-LOCK NO-ERROR.
672 IF AVAILABLE(Month) THEN cb-month2 = STRING( Month.EndDate, "99/99/9999" ).
674 DO WITH FRAME {&FRAME-NAME}:
675 FIND ProjectBudget WHERE ProjectBudget.ProjectCode = INPUT RP.Int1
676 AND ProjectBudget.AccountCode = INPUT RP.Dec1 NO-LOCK NO-ERROR.
677 IF AVAILABLE(ProjectBudget) THEN fil_account1 = ProjectBudget.Description.
678 FIND ProjectBudget WHERE ProjectBudget.ProjectCode = INPUT RP.Int1
679 AND ProjectBudget.AccountCode = INPUT RP.Dec2 NO-LOCK NO-ERROR.
680 IF AVAILABLE(ProjectBudget) THEN fil_account2 = ProjectBudget.Description.
681 END.
683 DISPLAY cb-month1 cb-month2 fil_account1 fil_account2 WITH FRAME {&FRAME-NAME} IN WINDOW {&WINDOW-NAME}.
685 RUN dispatch ( 'display-fields':U ).
686 RUN dispatch ( 'enable-fields':U ).
687 RUN enable-appropriate-fields.
689 END PROCEDURE.
691 /* _UIB-CODE-BLOCK-END */
692 &ANALYZE-RESUME
695 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
696 PROCEDURE pre-destroy :
697 /*------------------------------------------------------------------------------
698 Purpose:
699 ------------------------------------------------------------------------------*/
700 RUN check-modified( 'clear':U ).
701 END PROCEDURE.
703 /* _UIB-CODE-BLOCK-END */
704 &ANALYZE-RESUME
707 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE run-report V-table-Win
708 PROCEDURE run-report :
709 /*------------------------------------------------------------------------------
710 Purpose: Actually run the report program.
711 ------------------------------------------------------------------------------*/
713 DO TRANSACTION:
714 RUN dispatch IN THIS-PROCEDURE ('update-record':U).
716 FIND CURRENT RP EXCLUSIVE-LOCK.
717 FIND Month WHERE Month.StartDate = DATE( cb-month1:SCREEN-VALUE IN FRAME {&FRAME-NAME}) NO-LOCK NO-ERROR.
718 IF AVAILABLE(Month) THEN RP.Int3 = Month.MonthCode.
720 FIND Month WHERE Month.EndDate = DATE( cb-month2:SCREEN-VALUE IN FRAME {&FRAME-NAME}) NO-LOCK NO-ERROR.
721 IF AVAILABLE(Month) THEN RP.Int4 = Month.MonthCode.
722 FIND CURRENT RP NO-LOCK.
723 END.
725 DEF VAR report-options AS CHAR NO-UNDO.
726 DEF VAR e1 AS INTEGER NO-UNDO.
727 DEF VAR e2 AS INTEGER NO-UNDO.
728 DEF VAR show-all AS LOGICAL NO-UNDO.
729 DEF VAR a1 AS DECIMAL NO-UNDO.
730 DEF VAR a2 AS DECIMAL NO-UNDO.
731 DEF VAR export-fname AS CHAR INITIAL ? NO-UNDO.
734 ASSIGN
735 e1 = RP.Int1 e2 = (IF RP.Char1 = "1" OR RP.Char1 = "H" THEN RP.Int1 ELSE RP.Int2 )
736 a1 = RP.Dec1 a2 = (IF RP.Char4 = "1" THEN RP.Dec1 ELSE RP.Dec2 )
737 export-fname = (IF RP.Log5 THEN RP.Char2 ELSE "" )
739 IF RP.Char4 = "*" THEN ASSIGN a1 = 0 a2 = 9999.99 .
741 report-options = RP.Char1 + "," + RP.Char4 + "," + RP.Char3 + ","
742 + STRING( e1 ) + "," + STRING( e2 ) + ","
743 + STRING( RP.Int3 ) + "," + STRING( RP.Int4 ) + ","
744 + STRING( a1 ) + "," + STRING( a2 ) + ","
745 + STRING( RP.Log2, "Yes/No" ) + ","
746 + export-fname
747 + (IF RP.Log9 THEN "~nNoRelations" ELSE "").
749 RUN notify( 'set-busy, container-source':U ).
750 RUN process/report/tr-j.p( report-options ).
751 RUN notify( 'set-idle, container-source':U ).
753 END PROCEDURE.
755 /* _UIB-CODE-BLOCK-END */
756 &ANALYZE-RESUME
759 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE select-file-dialog V-table-Win
760 PROCEDURE select-file-dialog :
761 /*------------------------------------------------------------------------------
762 Purpose:
763 ------------------------------------------------------------------------------*/
764 DEF VAR select-ok AS LOGICAL INITIAL Yes NO-UNDO.
765 DEF VAR file-name AS CHAR NO-UNDO.
766 DEF VAR start-dir AS CHAR NO-UNDO.
768 file-name = INPUT FRAME {&FRAME-NAME} RP.Char2 .
769 start-dir = SUBSTRING( file-name, 1, R-INDEX(file-name, "\" ) ).
771 SYSTEM-DIALOG GET-FILE file-name FILTERS "Comma-separated values" "*.CSV"
772 SAVE-AS ASK-OVERWRITE CREATE-TEST-FILE DEFAULT-EXTENSION ".CSV"
773 INITIAL-DIR start-dir RETURN-TO-START-DIR
774 TITLE "" USE-FILENAME UPDATE select-ok.
776 IF select-ok THEN DO:
777 IF SUBSTRING( file-name, R-INDEX( file-name, ".") ) <> ".CSV" THEN DO:
778 IF (LENGTH( file-name ) - R-INDEX( file-name, "." )) < 4 THEN
779 file-name = SUBSTRING( file-name, 1, R-INDEX( file-name, ".")) + "CSV" .
780 END.
781 RP.Char2:SCREEN-VALUE IN FRAME {&FRAME-NAME} = file-name.
782 END.
784 END PROCEDURE.
786 /* _UIB-CODE-BLOCK-END */
787 &ANALYZE-RESUME
790 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
791 PROCEDURE send-records :
792 /*------------------------------------------------------------------------------
793 Purpose: Send record ROWID's for all tables used by
794 this file.
795 Parameters: see template/snd-head.i
796 ------------------------------------------------------------------------------*/
798 /* Define variables needed by this internal procedure. */
799 {src/adm/template/snd-head.i}
801 /* For each requested table, put it's ROWID in the output list. */
802 {src/adm/template/snd-list.i "RP"}
804 /* Deal with any unexpected table requests before closing. */
805 {src/adm/template/snd-end.i}
807 END PROCEDURE.
809 /* _UIB-CODE-BLOCK-END */
810 &ANALYZE-RESUME
813 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
814 PROCEDURE state-changed :
815 /* -----------------------------------------------------------
816 Purpose:
817 Parameters: <none>
818 Notes:
819 -------------------------------------------------------------*/
820 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
821 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
823 CASE p-state:
824 /* Object instance CASEs can go here to replace standard behavior
825 or add new cases. */
826 {src/adm/template/vstates.i}
827 END CASE.
828 END PROCEDURE.
830 /* _UIB-CODE-BLOCK-END */
831 &ANALYZE-RESUME