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 /*------------------------------------------------------------------------
9 File
: vwr
/mnt
/v-prjord.w
10 Author
: Andrew McMillan
11 Date
: 10 December
1997
12 ------------------------------------------------------------------------*/
16 /* *************************** Definitions
************************** */
18 &SCOPED-DEFINE REPORT-ID "PRJORDER - Project Orders"
20 /* _UIB-CODE-BLOCK-END
*/
24 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
26 /* ******************** Preprocessor Definitions
******************** */
28 &Scoped-define PROCEDURE-TYPE SmartViewer
30 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
32 /* Name of first Frame and
/or Browse and
/or first Query
*/
33 &Scoped-define FRAME-NAME F-Main
36 &Scoped-define EXTERNAL-TABLES RP
37 &Scoped-define FIRST-EXTERNAL-TABLE RP
40 /* Need to scope the external tables to this procedure
*/
41 DEFINE QUERY external_tables
FOR RP.
42 /* Standard List Definitions
*/
43 &Scoped-Define ENABLED-FIELDS RP.Int1 RP.Int2 RP.Log6 RP.Log5 RP.Log1 ~
45 &Scoped-define FIELD-PAIRS~
46 ~
{&FP1}Int1 ~{&FP2}Int1 ~{&FP3}~
47 ~
{&FP1}Int2 ~{&FP2}Int2 ~{&FP3}
48 &Scoped-define ENABLED-TABLES RP
49 &Scoped-define FIRST-ENABLED-TABLE RP
50 &Scoped-Define ENABLED-OBJECTS RECT-32 cmb_From cmb_UpTo btn_print
51 &Scoped-Define DISPLAYED-FIELDS RP.Int1 RP.Int2 RP.Log6 RP.Log5 RP.Log1 ~
53 &Scoped-Define DISPLAYED-OBJECTS fil_Project1 fil_Project2 cmb_From ~
56 /* Custom List Definitions
*/
57 /* ADM-CREATE-FIELDS
,ADM-ASSIGN-FIELDS
,List-3
,List-4
,List-5
,List-6
*/
59 /* _UIB-PREPROCESSOR-BLOCK-END
*/
64 /* *********************** Control Definitions
********************** */
67 /* Definitions of the field level widgets
*/
68 DEFINE BUTTON btn_print
DEFAULT
73 DEFINE VARIABLE cmb_From
AS CHARACTER FORMAT "X(256)":U
75 VIEW-AS COMBO-BOX INNER-LINES 24
77 SIZE 18.86 BY 1 NO-UNDO.
79 DEFINE VARIABLE cmb_UpTo
AS CHARACTER FORMAT "X(256)":U
81 VIEW-AS COMBO-BOX INNER-LINES 24
83 SIZE 18.86 BY 1 NO-UNDO.
85 DEFINE VARIABLE fil_Project1
AS CHARACTER FORMAT "X(256)":U
87 SIZE 50.86 BY 1 NO-UNDO.
89 DEFINE VARIABLE fil_Project2
AS CHARACTER FORMAT "X(256)":U
91 SIZE 50.86 BY 1.05 NO-UNDO.
93 DEFINE RECTANGLE RECT-32
94 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
98 /* ************************ Frame Definitions
*********************** */
101 RP.Int1
AT ROW 1.4 COL 5.86 COLON-ALIGNED
102 LABEL "Project" FORMAT "99999"
105 fil_Project1
AT ROW 1.4 COL 15.57 COLON-ALIGNED NO-LABEL
106 RP.Int2
AT ROW 2.6 COL 5.86 COLON-ALIGNED
107 LABEL "To" FORMAT "99999"
110 fil_Project2
AT ROW 2.6 COL 15.57 COLON-ALIGNED NO-LABEL
111 cmb_From
AT ROW 4 COL 21.29 COLON-ALIGNED
112 RP.Log6
AT ROW 4.05 COL 7.86 HELP
117 cmb_UpTo
AT ROW 5 COL 21.29 COLON-ALIGNED
118 RP.Log5
AT ROW 5.05 COL 7.86
122 RP.Log1
AT ROW 6.6 COL 7.86 HELP
124 LABEL "Summarise orders in sub-projects"
127 RP.Log2
AT ROW 7.6 COL 7.86 HELP
131 SIZE 9.14 BY .8 TOOLTIP "Output report to report viewer preview"
132 btn_print
AT ROW 7.6 COL 59.29
133 RECT-32
AT ROW 1 COL 1
134 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
135 SIDE-LABELS NO-UNDERLINE THREE-D
136 AT COL 1 ROW 1 SCROLLABLE
138 DEFAULT-BUTTON btn_print.
141 /* *********************** Procedure Settings
************************ */
143 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
144 /* Settings for
THIS-PROCEDURE
146 External Tables
: TTPL.RP
147 Allow
: Basic
,DB-Fields
149 Add Fields to
: EXTERNAL-TABLES
150 Other Settings
: PERSISTENT-ONLY
COMPILE
153 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
154 /* then cleanup and return.
*/
155 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
156 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
157 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
161 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
163 /* ************************* Create Window
************************** */
165 &ANALYZE-SUSPEND _CREATE-WINDOW
166 /* DESIGN Window definition
(used by the UIB
)
167 CREATE WINDOW V-table-Win
ASSIGN
170 /* END WINDOW DEFINITION
*/
175 /* *************** Runtime Attributes and UIB Settings
************** */
177 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
178 /* SETTINGS
FOR WINDOW V-table-Win
179 VISIBLE,,RUN-PERSISTENT
*/
180 /* SETTINGS
FOR FRAME F-Main
181 NOT-VISIBLE Size-to-Fit
*/
183 FRAME F-Main
:SCROLLABLE = FALSE
184 FRAME F-Main
:HIDDEN = TRUE.
186 /* SETTINGS
FOR FILL-IN fil_Project1
IN FRAME F-Main
188 /* SETTINGS
FOR FILL-IN fil_Project2
IN FRAME F-Main
190 /* SETTINGS
FOR FILL-IN RP.Int1
IN FRAME F-Main
191 EXP-LABEL EXP-FORMAT
*/
192 /* SETTINGS
FOR FILL-IN RP.Int2
IN FRAME F-Main
193 EXP-LABEL EXP-FORMAT
*/
194 /* SETTINGS
FOR TOGGLE-BOX RP.Log1
IN FRAME F-Main
195 EXP-LABEL EXP-HELP
*/
196 /* SETTINGS
FOR TOGGLE-BOX RP.Log2
IN FRAME F-Main
197 EXP-LABEL EXP-HELP
*/
198 /* SETTINGS
FOR TOGGLE-BOX RP.Log5
IN FRAME F-Main
200 /* SETTINGS
FOR TOGGLE-BOX RP.Log6
IN FRAME F-Main
201 EXP-LABEL EXP-HELP
*/
202 /* _RUN-TIME-ATTRIBUTES-END
*/
206 /* Setting information for Queries and Browse Widgets fields
*/
208 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
209 /* Query rebuild information for
FRAME F-Main
212 */ /* FRAME F-Main
*/
218 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
219 /* ************************* Included-Libraries
*********************** */
221 {src
/adm
/method
/viewer.i
}
222 {inc
/method
/m-mntvwr.i
}
224 /* _UIB-CODE-BLOCK-END
*/
230 /* ************************ Control Triggers
************************ */
232 &Scoped-define SELF-NAME btn_print
233 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_print V-table-Win
234 ON CHOOSE OF btn_print
IN FRAME F-Main
/* OK */
236 DISABLE {&SELF-NAME} WITH FRAME {&FRAME-NAME}.
238 ENABLE {&SELF-NAME} WITH FRAME {&FRAME-NAME}.
241 /* _UIB-CODE-BLOCK-END
*/
245 &Scoped-define SELF-NAME cmb_From
246 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_From V-table-Win
247 ON U1
OF cmb_From
IN FRAME F-Main
/* date .
*/
249 {inc
/selcmb
/scmths1.i
"RP" "Int6"}
252 /* _UIB-CODE-BLOCK-END
*/
256 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_From V-table-Win
257 ON U2
OF cmb_From
IN FRAME F-Main
/* date .
*/
259 {inc
/selcmb
/scmths2.i
"RP" "Int6"}
262 /* _UIB-CODE-BLOCK-END
*/
266 &Scoped-define SELF-NAME cmb_UpTo
267 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_UpTo V-table-Win
268 ON U1
OF cmb_UpTo
IN FRAME F-Main
/* date
*/
270 {inc
/selcmb
/scmthe1.i
"RP" "Int5"}
273 /* _UIB-CODE-BLOCK-END
*/
277 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_UpTo V-table-Win
278 ON U2
OF cmb_UpTo
IN FRAME F-Main
/* date
*/
280 {inc
/selcmb
/scmthe2.i
"RP" "Int5"}
283 /* _UIB-CODE-BLOCK-END
*/
287 &Scoped-define SELF-NAME fil_Project1
288 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Project1 V-table-Win
289 ON U1
OF fil_Project1
IN FRAME F-Main
291 {inc
/selfil
/sfprj1.i
"RP" "Int1"}
294 /* _UIB-CODE-BLOCK-END
*/
298 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Project1 V-table-Win
299 ON U2
OF fil_Project1
IN FRAME F-Main
301 {inc
/selfil
/sfprj2.i
"RP" "Int1"}
304 /* _UIB-CODE-BLOCK-END
*/
308 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Project1 V-table-Win
309 ON U3
OF fil_Project1
IN FRAME F-Main
311 {inc
/selfil
/sfprj3.i
"RP" "Int1"}
314 /* _UIB-CODE-BLOCK-END
*/
318 &Scoped-define SELF-NAME fil_Project2
319 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Project2 V-table-Win
320 ON U1
OF fil_Project2
IN FRAME F-Main
322 {inc
/selfil
/sfprj1.i
"RP" "Int2"}
325 /* _UIB-CODE-BLOCK-END
*/
329 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Project2 V-table-Win
330 ON U2
OF fil_Project2
IN FRAME F-Main
332 {inc
/selfil
/sfprj2.i
"RP" "Int2"}
335 /* _UIB-CODE-BLOCK-END
*/
339 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Project2 V-table-Win
340 ON U3
OF fil_Project2
IN FRAME F-Main
342 {inc
/selfil
/sfprj3.i
"RP" "Int2"}
345 /* _UIB-CODE-BLOCK-END
*/
349 &Scoped-define SELF-NAME RP.Int1
350 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int1 V-table-Win
351 ON LEAVE OF RP.Int1
IN FRAME F-Main
/* Project
*/
353 {inc
/selcde
/cdprj.i
"fil_Project1"}
356 /* _UIB-CODE-BLOCK-END
*/
360 &Scoped-define SELF-NAME RP.Int2
361 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int2 V-table-Win
362 ON LEAVE OF RP.Int2
IN FRAME F-Main
/* To
*/
364 {inc
/selcde
/cdprj.i
"fil_Project2"}
367 /* _UIB-CODE-BLOCK-END
*/
371 &Scoped-define SELF-NAME RP.Log5
372 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log5 V-table-Win
373 ON VALUE-CHANGED
OF RP.Log5
IN FRAME F-Main
/* Report up to
*/
375 RUN dispatch
( 'enable-fields'
:U
).
378 /* _UIB-CODE-BLOCK-END
*/
382 &Scoped-define SELF-NAME RP.Log6
383 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log6 V-table-Win
384 ON VALUE-CHANGED
OF RP.Log6
IN FRAME F-Main
/* Report from
*/
386 RUN dispatch
( 'enable-fields'
:U
).
389 /* _UIB-CODE-BLOCK-END
*/
395 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
398 /* *************************** Main Block
*************************** */
400 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
401 RUN dispatch
IN THIS-PROCEDURE ('initialize'
:U
).
404 /************************ INTERNAL PROCEDURES
********************/
406 /* _UIB-CODE-BLOCK-END
*/
410 /* ********************** Internal Procedures
*********************** */
412 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
413 PROCEDURE adm-row-available
:
414 /*------------------------------------------------------------------------------
415 Purpose
: Dispatched to this procedure when the Record-
416 Source has a new row available. This procedure
417 tries to get the new row
(or foriegn keys
) from
418 the Record-Source and process it.
420 ------------------------------------------------------------------------------*/
422 /* Define variables needed by this internal procedure.
*/
423 {src
/adm
/template
/row-head.i
}
425 /* Create a list of all the tables that we need to get.
*/
426 {src
/adm
/template
/row-list.i
"RP"}
428 /* Get the record
ROWID's from the RECORD-SOURCE.
*/
429 {src
/adm
/template
/row-get.i
}
431 /* FIND each record specified by the RECORD-SOURCE.
*/
432 {src
/adm
/template
/row-find.i
"RP"}
434 /* Process the newly available records
(i.e. display fields
,
435 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
436 {src
/adm
/template
/row-end.i
}
440 /* _UIB-CODE-BLOCK-END
*/
444 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
445 PROCEDURE disable_UI
:
446 /*------------------------------------------------------------------------------
447 Purpose
: DISABLE the User Interface
449 Notes
: Here we clean-up the user-interface by deleting
450 dynamic widgets we have created and
/or hide
451 frames. This procedure is usually called when
452 we are ready to
"clean-up" after running.
453 ------------------------------------------------------------------------------*/
454 /* Hide all frames.
*/
456 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
459 /* _UIB-CODE-BLOCK-END
*/
463 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
464 PROCEDURE inst-enable-fields
:
465 /*------------------------------------------------------------------------------
467 ------------------------------------------------------------------------------*/
468 DO WITH FRAME {&FRAME-NAME}:
470 IF INPUT RP.Log5
THEN VIEW cmb_UpTo.
ELSE HIDE cmb_UpTo.
471 IF INPUT RP.Log6
THEN VIEW cmb_From.
ELSE HIDE cmb_From.
477 /* _UIB-CODE-BLOCK-END
*/
481 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
482 PROCEDURE inst-initialize
:
483 /*------------------------------------------------------------------------------
487 ------------------------------------------------------------------------------*/
489 DEF VAR user-name
AS CHAR NO-UNDO.
491 RUN get-username
IN sys-mgr
( OUTPUT user-name
).
494 RP.UserName
= user-name
AND
495 RP.ReportID
= {&REPORT-ID} NO-ERROR.
497 IF NOT AVAILABLE RP
THEN
498 DO WITH FRAME {&FRAME-NAME}:
501 RP.ReportID
= {&REPORT-ID}
502 RP.UserName
= user-name.
505 RUN dispatch
( 'display-fields'
:U
).
506 RUN dispatch
( 'enable-fields'
:U
).
510 /* _UIB-CODE-BLOCK-END
*/
514 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
515 PROCEDURE pre-destroy
:
516 /*------------------------------------------------------------------------------
520 ------------------------------------------------------------------------------*/
522 RUN check-modified
( "CLEAR" ).
526 /* _UIB-CODE-BLOCK-END
*/
530 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE run-report V-table-Win
531 PROCEDURE run-report
:
532 /*------------------------------------------------------------------------------
534 ------------------------------------------------------------------------------*/
535 DEF VAR options
AS CHAR NO-UNDO.
537 DO WITH FRAME {&FRAME-NAME}:
540 IF RETURN-VALUE = "FAIL" THEN RETURN.
542 RUN dispatch
( 'update-record'
:U
).
544 options
= "Range," + STRING( RP.Int1
) + "," + STRING( RP.Int2
)
545 + (IF RP.Log2
THEN "~nPreview" ELSE "")
546 + (IF RP.Log1
THEN "~nSummarise" ELSE "")
547 + "~nVariation-Types," + (IF RP.Log3
THEN "VAR," ELSE "") + (IF RP.Log4
THEN "ADJ" ELSE "")
548 + (IF RP.Log5
THEN "~nUpTo," + STRING(RP.Int5
) ELSE "")
549 + (IF RP.Log6
THEN "~nFrom," + STRING(RP.Int6
) ELSE "")
552 RUN notify
( 'set-busy
, CONTAINER-SOURCE'
:u
).
553 RUN process
/report
/prjorder.p
( options
).
554 RUN notify
( 'set-idle
, CONTAINER-SOURCE'
:u
).
560 /* _UIB-CODE-BLOCK-END
*/
564 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
565 PROCEDURE send-records
:
566 /*------------------------------------------------------------------------------
567 Purpose
: Send record
ROWID's for all tables used by
569 Parameters
: see template
/snd-head.i
570 ------------------------------------------------------------------------------*/
572 /* Define variables needed by this internal procedure.
*/
573 {src
/adm
/template
/snd-head.i
}
575 /* For each requested table
, put it's
ROWID in the output list.
*/
576 {src
/adm
/template
/snd-list.i
"RP"}
578 /* Deal with any unexpected table requests before closing.
*/
579 {src
/adm
/template
/snd-end.i
}
583 /* _UIB-CODE-BLOCK-END
*/
587 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
588 PROCEDURE state-changed
:
589 /* -----------------------------------------------------------
593 -------------------------------------------------------------*/
594 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
595 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
598 /* Object instance CASEs can go here to replace standard behavior
600 {src
/adm
/template
/vstates.i
}
604 /* _UIB-CODE-BLOCK-END
*/
608 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-report V-table-Win
609 PROCEDURE verify-report
:
610 /*------------------------------------------------------------------------------
614 ------------------------------------------------------------------------------*/
616 DO WITH FRAME {&FRAME-NAME}:
618 IF NOT CAN-FIND( FIRST Project
WHERE
619 ROWID( Project
) = TO-ROWID( fil_Project1
:PRIVATE-DATA ) ) THEN
621 MESSAGE "You need to select a project!" VIEW-AS ALERT-BOX ERROR
622 TITLE "No project selected".
623 APPLY '
ENTRY'
:U
TO RP.Int1.
631 /* _UIB-CODE-BLOCK-END
*/