1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
6 &Scoped-define WINDOW-NAME CURRENT-WINDOW
7 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS V-table-Win
8 /*------------------------------------------------------------------------
11 ------------------------------------------------------------------------*/
13 /* *************************** Definitions
************************** */
15 DEF VAR user-name
AS CHAR INITIAL "Andrew" NO-UNDO.
17 /* _UIB-CODE-BLOCK-END
*/
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
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
*/
65 /* *********************** Control Definitions
********************** */
68 /* Definitions of the field level widgets
*/
69 DEFINE BUTTON btn_Browse
74 DEFINE BUTTON Btn_OK
AUTO-GO DEFAULT
79 DEFINE VARIABLE cb-month1
AS CHARACTER FORMAT "X(256)":U
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
87 VIEW-AS COMBO-BOX INNER-LINES 15
89 SIZE 17.14 BY 1 NO-UNDO.
91 DEFINE VARIABLE fil_account1
AS CHARACTER FORMAT "X(256)":U
96 DEFINE VARIABLE fil_account2
AS CHARACTER FORMAT "X(256)":U
101 DEFINE VARIABLE fil_proj1
AS CHARACTER FORMAT "X(256)":U
106 DEFINE VARIABLE fil_proj2
AS CHARACTER FORMAT "X(256)":U
111 DEFINE RECTANGLE RECT-1
112 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
115 DEFINE RECTANGLE RECT-4
116 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
119 DEFINE RECTANGLE RECT-5
120 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
123 DEFINE RECTANGLE RECT-6
124 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
128 /* ************************ Frame Definitions
*********************** */
131 RP.Char1
AT ROW 1.45 COL 2.14 NO-LABEL
132 VIEW-AS RADIO-SET HORIZONTAL EXPAND
134 "Single project", "1":U
,
135 "Project range", "R":U
,
136 "Project hierarchy", "H":U
139 RP.Int1
AT ROW 2.55 COL 9.29 COLON-ALIGNED
140 LABEL "Project" FORMAT "99999"
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"
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
151 VIEW-AS RADIO-SET HORIZONTAL EXPAND
153 "All accounts", "*":U
,
154 "Single account", "1":U
,
155 "Account range", "R":U
158 RP.Dec1
AT ROW 6.55 COL 9.29 COLON-ALIGNED HELP
160 LABEL "Account" FORMAT "9999.99"
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"
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"
177 RP.Char3
AT ROW 12.2 COL 11.29 HELP
179 VIEW-AS RADIO-SET VERTICAL
181 "by Project then by Account", "J":U
,
182 "by Account then by Project", "A":U
185 RP.Log5
AT ROW 13.95 COL 11.29
190 RP.Char2
AT ROW 13.95 COL 18.43 COLON-ALIGNED NO-LABEL FORMAT "X(120)"
194 btn_Browse
AT ROW 13.95 COL 69
195 RP.Log2
AT ROW 15.2 COL 11.29 HELP
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
209 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
210 SIDE-LABELS NO-UNDERLINE THREE-D
211 AT COL 1 ROW 1 SCROLLABLE
213 DEFAULT-BUTTON Btn_OK.
216 /* *********************** Procedure Settings
************************ */
218 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
219 /* Settings for
THIS-PROCEDURE
221 External Tables
: ttpl.RP
222 Allow
: Basic
,DB-Fields
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.
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
245 /* END WINDOW DEFINITION
*/
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
*/
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
265 /* SETTINGS
FOR RADIO-SET RP.Char4
IN FRAME F-Main
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
273 /* SETTINGS
FOR FILL-IN fil_account2
IN FRAME F-Main
275 /* SETTINGS
FOR FILL-IN fil_proj1
IN FRAME F-Main
277 /* SETTINGS
FOR FILL-IN fil_proj2
IN FRAME F-Main
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
287 /* SETTINGS
FOR TOGGLE-BOX RP.Log9
IN FRAME F-Main
288 EXP-LABEL EXP-HELP
*/
289 /* _RUN-TIME-ATTRIBUTES-END
*/
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
299 */ /* FRAME F-Main
*/
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
*/
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 .
326 /* _UIB-CODE-BLOCK-END
*/
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}.
336 ENABLE {&SELF-NAME} WITH FRAME {&FRAME-NAME}.
339 /* _UIB-CODE-BLOCK-END
*/
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.
350 /* _UIB-CODE-BLOCK-END
*/
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.
361 /* _UIB-CODE-BLOCK-END
*/
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.
372 /* _UIB-CODE-BLOCK-END
*/
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
384 IF AVAILABLE(ProjectBudget
) THEN
385 fil_account1
:SCREEN-VALUE = ProjectBudget.Description.
389 /* _UIB-CODE-BLOCK-END
*/
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
401 IF AVAILABLE(ProjectBudget
) THEN
402 fil_account2
:SCREEN-VALUE = ProjectBudget.Description.
406 /* _UIB-CODE-BLOCK-END
*/
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"}
417 /* _UIB-CODE-BLOCK-END
*/
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"}
427 /* _UIB-CODE-BLOCK-END
*/
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"}
437 /* _UIB-CODE-BLOCK-END
*/
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"}
448 /* _UIB-CODE-BLOCK-END
*/
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"}
458 /* _UIB-CODE-BLOCK-END
*/
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"}
468 /* _UIB-CODE-BLOCK-END
*/
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"}
479 /* _UIB-CODE-BLOCK-END
*/
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"}
490 /* _UIB-CODE-BLOCK-END
*/
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.
501 /* _UIB-CODE-BLOCK-END
*/
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
).
516 /************************ INTERNAL PROCEDURES
********************/
518 /* _UIB-CODE-BLOCK-END
*/
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.
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
}
552 /* _UIB-CODE-BLOCK-END
*/
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
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.
*/
568 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
571 /* _UIB-CODE-BLOCK-END
*/
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
*/
584 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING(fil_proj2
:HANDLE), 'hidden
= yes'
).
585 HIDE RP.Int2 fil_proj2 .
588 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING(fil_proj2
:HANDLE), 'hidden
= yes'
).
589 HIDE RP.Int2 fil_proj2 .
592 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING(fil_proj2
:HANDLE), 'hidden
= no'
).
593 VIEW RP.Int2 fil_proj2 .
597 CASE INPUT RP.Char4
: /* Account
: All
, Single
, range
*/
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 .
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 .
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 .
617 IF INPUT RP.Log5
THEN
618 VIEW RP.Char2 btn_Browse .
620 HIDE RP.Char2 btn_Browse .
626 /* _UIB-CODE-BLOCK-END
*/
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
644 IF NOT AVAILABLE( RP
) THEN DO:
648 RP.UserName
= user-name
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" ).
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}:
661 cb-month1
:DELIMITER = delim
662 cb-month2
:DELIMITER = delim
663 cb-month1
:LIST-ITEMS = month1-list
664 cb-month2
:LIST-ITEMS = month2-list
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.
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.
691 /* _UIB-CODE-BLOCK-END
*/
695 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
696 PROCEDURE pre-destroy
:
697 /*------------------------------------------------------------------------------
699 ------------------------------------------------------------------------------*/
700 RUN check-modified
( 'clear'
:U
).
703 /* _UIB-CODE-BLOCK-END
*/
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 ------------------------------------------------------------------------------*/
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.
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.
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" ) + ","
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
).
755 /* _UIB-CODE-BLOCK-END
*/
759 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE select-file-dialog V-table-Win
760 PROCEDURE select-file-dialog
:
761 /*------------------------------------------------------------------------------
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" .
781 RP.Char2
:SCREEN-VALUE IN FRAME {&FRAME-NAME} = file-name.
786 /* _UIB-CODE-BLOCK-END
*/
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
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
}
809 /* _UIB-CODE-BLOCK-END
*/
813 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
814 PROCEDURE state-changed
:
815 /* -----------------------------------------------------------
819 -------------------------------------------------------------*/
820 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
821 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
824 /* Object instance CASEs can go here to replace standard behavior
826 {src
/adm
/template
/vstates.i
}
830 /* _UIB-CODE-BLOCK-END
*/