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 NO-UNDO.
16 {inc
/username.i
"user-name"}
18 /* _UIB-CODE-BLOCK-END
*/
22 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
24 /* ******************** Preprocessor Definitions
******************** */
26 &Scoped-define PROCEDURE-TYPE SmartViewer
28 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
30 /* Name of first Frame and
/or Browse and
/or first Query
*/
31 &Scoped-define FRAME-NAME F-Main
34 &Scoped-define EXTERNAL-TABLES RP
35 &Scoped-define FIRST-EXTERNAL-TABLE RP
38 /* Need to scope the external tables to this procedure
*/
39 DEFINE QUERY external_tables
FOR RP.
40 /* Standard List Definitions
*/
41 &Scoped-Define ENABLED-FIELDS RP.Char1 RP.Int1 RP.Char2 RP.Log2 RP.Log1
42 &Scoped-define FIELD-PAIRS~
43 ~
{&FP1}Int1 ~{&FP2}Int1 ~{&FP3}
44 &Scoped-define ENABLED-TABLES RP
45 &Scoped-define FIRST-ENABLED-TABLE RP
46 &Scoped-Define ENABLED-OBJECTS RECT-27 cmb_Client btn_ok
47 &Scoped-Define DISPLAYED-FIELDS RP.Char1 RP.Int1 RP.Char2 RP.Log2 RP.Log1
48 &Scoped-Define DISPLAYED-OBJECTS fil_Company cmb_Client
50 /* Custom List Definitions
*/
51 /* ADM-CREATE-FIELDS
,ADM-ASSIGN-FIELDS
,List-3
,List-4
,List-5
,List-6
*/
53 /* _UIB-PREPROCESSOR-BLOCK-END
*/
58 /* *********************** Control Definitions
********************** */
61 /* Definitions of the field level widgets
*/
62 DEFINE BUTTON btn_ok
DEFAULT
66 DEFINE VARIABLE cmb_Client
AS CHARACTER FORMAT "X(256)"
67 VIEW-AS COMBO-BOX INNER-LINES 15
69 SIZE 41.14 BY 1 NO-UNDO.
71 DEFINE VARIABLE fil_Company
AS CHARACTER FORMAT "X(256)":U
73 SIZE 35.43 BY 1.05 NO-UNDO.
75 DEFINE RECTANGLE RECT-27
76 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
80 /* ************************ Frame Definitions
*********************** */
83 RP.Char1
AT ROW 2.4 COL 3.86 NO-LABEL
84 VIEW-AS RADIO-SET VERTICAL
86 "Company Name", "Name":U
,
87 "Company Code", "Code":U
,
88 "Hierarchy from", "Hierarchy":U
90 RP.Int1
AT ROW 3.8 COL 17.29 COLON-ALIGNED HELP
91 "" NO-LABEL FORMAT ">>999"
94 fil_Company
AT ROW 3.8 COL 23 COLON-ALIGNED NO-LABEL
95 RP.Char2
AT ROW 6.4 COL 3.86 HELP
97 VIEW-AS RADIO-SET VERTICAL
99 "All Clients/Owners", "All":U
,
100 "One Client/Owner", "OneClient":U
102 cmb_Client
AT ROW 7.2 COL 17.29 COLON-ALIGNED NO-LABEL
103 RP.Log2
AT ROW 9.2 COL 4.43
104 LABEL "Active companies only"
107 RP.Log1
AT ROW 10.8 COL 4.43
108 LABEL "Print Preview"
111 btn_ok
AT ROW 11 COL 50.72
112 RECT-27
AT ROW 1 COL 1
113 "Sort by:" VIEW-AS TEXT
114 SIZE 6.29 BY 1 AT ROW 1.4 COL 2.14
115 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
116 SIDE-LABELS NO-UNDERLINE THREE-D
117 AT COL 1 ROW 1 SCROLLABLE
119 DEFAULT-BUTTON btn_ok.
122 /* *********************** Procedure Settings
************************ */
124 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
125 /* Settings for
THIS-PROCEDURE
127 External Tables
: TTPL.RP
128 Allow
: Basic
,DB-Fields
130 Add Fields to
: EXTERNAL-TABLES
131 Other Settings
: PERSISTENT-ONLY
COMPILE
134 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
135 /* then cleanup and return.
*/
136 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
137 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
138 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
142 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
144 /* ************************* Create Window
************************** */
146 &ANALYZE-SUSPEND _CREATE-WINDOW
147 /* DESIGN Window definition
(used by the UIB
)
148 CREATE WINDOW V-table-Win
ASSIGN
151 /* END WINDOW DEFINITION
*/
156 /* *************** Runtime Attributes and UIB Settings
************** */
158 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
159 /* SETTINGS
FOR WINDOW V-table-Win
160 VISIBLE,,RUN-PERSISTENT
*/
161 /* SETTINGS
FOR FRAME F-Main
162 NOT-VISIBLE Size-to-Fit
*/
164 FRAME F-Main
:SCROLLABLE = FALSE
165 FRAME F-Main
:HIDDEN = TRUE.
167 /* SETTINGS
FOR RADIO-SET RP.Char2
IN FRAME F-Main
169 /* SETTINGS
FOR FILL-IN fil_Company
IN FRAME F-Main
171 /* SETTINGS
FOR FILL-IN RP.Int1
IN FRAME F-Main
172 EXP-LABEL EXP-FORMAT EXP-HELP
*/
173 /* SETTINGS
FOR TOGGLE-BOX RP.Log1
IN FRAME F-Main
175 /* SETTINGS
FOR TOGGLE-BOX RP.Log2
IN FRAME F-Main
177 /* _RUN-TIME-ATTRIBUTES-END
*/
181 /* Setting information for Queries and Browse Widgets fields
*/
183 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
184 /* Query rebuild information for
FRAME F-Main
187 */ /* FRAME F-Main
*/
193 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
194 /* ************************* Included-Libraries
*********************** */
196 {src
/adm
/method
/viewer.i
}
197 {inc
/method
/m-mntvwr.i
}
199 /* _UIB-CODE-BLOCK-END
*/
205 /* ************************ Control Triggers
************************ */
207 &Scoped-define SELF-NAME btn_ok
208 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_ok V-table-Win
209 ON CHOOSE OF btn_ok
IN FRAME F-Main
/* OK */
211 DISABLE {&SELF-NAME}.
216 /* _UIB-CODE-BLOCK-END
*/
220 &Scoped-define SELF-NAME RP.Char1
221 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char1 V-table-Win
222 ON VALUE-CHANGED
OF RP.Char1
IN FRAME F-Main
/* Char1
*/
224 RUN enable-appropriate-fields.
227 /* _UIB-CODE-BLOCK-END
*/
231 &Scoped-define SELF-NAME RP.Char2
232 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char2 V-table-Win
233 ON VALUE-CHANGED
OF RP.Char2
IN FRAME F-Main
/* Char2
*/
235 RUN enable-appropriate-fields.
238 /* _UIB-CODE-BLOCK-END
*/
242 &Scoped-define SELF-NAME cmb_Client
243 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_Client V-table-Win
244 ON U1
OF cmb_Client
IN FRAME F-Main
246 {inc
/selcmb
/scclient1.i
"RP" "Char3"}
249 /* _UIB-CODE-BLOCK-END
*/
253 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_Client V-table-Win
254 ON U2
OF cmb_Client
IN FRAME F-Main
256 {inc
/selcmb
/scclient2.i
"RP" "Char3"}
259 /* _UIB-CODE-BLOCK-END
*/
263 &Scoped-define SELF-NAME RP.Int1
264 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int1 V-table-Win
265 ON LEAVE OF RP.Int1
IN FRAME F-Main
/* Int1
*/
267 DO WITH FRAME {&FRAME-NAME}:
268 FIND Company
WHERE Company.CompanyCode
= INT(SELF:SCREEN-VALUE) NO-LOCK NO-ERROR.
269 IF AVAILABLE(Company
) THEN DO:
270 fil_Company
= Company.LegalName.
276 /* _UIB-CODE-BLOCK-END
*/
282 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
285 /* *************************** Main Block
*************************** */
287 /* _UIB-CODE-BLOCK-END
*/
291 /* ********************** Internal Procedures
*********************** */
293 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
294 PROCEDURE adm-row-available
:
295 /*------------------------------------------------------------------------------
296 Purpose
: Dispatched to this procedure when the Record-
297 Source has a new row available. This procedure
298 tries to get the new row
(or foriegn keys
) from
299 the Record-Source and process it.
301 ------------------------------------------------------------------------------*/
303 /* Define variables needed by this internal procedure.
*/
304 {src
/adm
/template
/row-head.i
}
306 /* Create a list of all the tables that we need to get.
*/
307 {src
/adm
/template
/row-list.i
"RP"}
309 /* Get the record
ROWID's from the RECORD-SOURCE.
*/
310 {src
/adm
/template
/row-get.i
}
312 /* FIND each record specified by the RECORD-SOURCE.
*/
313 {src
/adm
/template
/row-find.i
"RP"}
315 /* Process the newly available records
(i.e. display fields
,
316 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
317 {src
/adm
/template
/row-end.i
}
321 /* _UIB-CODE-BLOCK-END
*/
325 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
326 PROCEDURE disable_UI
:
327 /*------------------------------------------------------------------------------
328 Purpose
: DISABLE the User Interface
330 Notes
: Here we clean-up the user-interface by deleting
331 dynamic widgets we have created and
/or hide
332 frames. This procedure is usually called when
333 we are ready to
"clean-up" after running.
334 ------------------------------------------------------------------------------*/
335 /* Hide all frames.
*/
337 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
340 /* _UIB-CODE-BLOCK-END
*/
344 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-appropriate-fields V-table-Win
345 PROCEDURE enable-appropriate-fields
:
346 /*------------------------------------------------------------------------------
348 ------------------------------------------------------------------------------*/
349 DO WITH FRAME {&FRAME-NAME}:
350 IF INPUT RP.Char1
= "Hierarchy" THEN
351 VIEW RP.Int1 fil_Company.
353 HIDE RP.Int1 fil_Company.
355 IF INPUT RP.Char2
= "OneClient" THEN
362 /* _UIB-CODE-BLOCK-END
*/
366 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
367 PROCEDURE inst-initialize
:
368 /*------------------------------------------------------------------------------
372 ------------------------------------------------------------------------------*/
374 &SCOP REPORT-ID "Company Listing"
377 RP.UserName
= user-name
AND
378 RP.ReportID
= {&REPORT-ID} NO-ERROR.
380 IF NOT AVAILABLE RP
THEN
381 DO WITH FRAME {&FRAME-NAME}:
385 RP.ReportID
= {&REPORT-ID}
386 RP.UserName
= user-name
390 RUN dispatch
( 'enable-fields'
:U
).
391 RUN dispatch
( 'display-fields'
:U
).
392 APPLY '
LEAVE'
:U
TO RP.Int1.
393 RUN enable-appropriate-fields.
397 /* _UIB-CODE-BLOCK-END
*/
401 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
402 PROCEDURE pre-destroy
:
403 /*------------------------------------------------------------------------------
407 ------------------------------------------------------------------------------*/
409 RUN check-modified
( "CLEAR" ).
413 /* _UIB-CODE-BLOCK-END
*/
417 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE run-report V-table-Win
418 PROCEDURE run-report
:
419 /*------------------------------------------------------------------------------
421 ------------------------------------------------------------------------------*/
423 DEF VAR report-options
AS CHAR NO-UNDO.
426 IF RETURN-VALUE = "FAIL" THEN RETURN.
428 RUN dispatch
( 'update-record'
:U
).
430 report-options
= "Sort," + RP.Char1
+ "," + STRING(RP.Int1
)
431 + (IF RP.Log1
THEN "~nPreview,Yes" ELSE "")
432 + (IF RP.Log2
THEN "~nActiveOnly,Yes" ELSE "")
433 + (IF RP.Char2
= "OneClient" THEN "~n" + RP.Char2
+ "," + RP.Char3
ELSE "") .
436 RUN notify
( 'set-busy
, CONTAINER-SOURCE'
:U
).
437 RUN process
/report
/cmplistg.p
( report-options
).
438 RUN notify
( 'set-idle
, CONTAINER-SOURCE'
:U
).
441 RUN make-bq-entry
IN sys-mgr
( "process/report/cmplistg.p", report-options
, ?
, ?
).
446 /* _UIB-CODE-BLOCK-END
*/
450 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
451 PROCEDURE send-records
:
452 /*------------------------------------------------------------------------------
453 Purpose
: Send record
ROWID's for all tables used by
455 Parameters
: see template
/snd-head.i
456 ------------------------------------------------------------------------------*/
458 /* Define variables needed by this internal procedure.
*/
459 {src
/adm
/template
/snd-head.i
}
461 /* For each requested table
, put it's
ROWID in the output list.
*/
462 {src
/adm
/template
/snd-list.i
"RP"}
464 /* Deal with any unexpected table requests before closing.
*/
465 {src
/adm
/template
/snd-end.i
}
469 /* _UIB-CODE-BLOCK-END
*/
473 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
474 PROCEDURE state-changed
:
475 /* -----------------------------------------------------------
479 -------------------------------------------------------------*/
480 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
481 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
484 /* Object instance CASEs can go here to replace standard behavior
486 {src
/adm
/template
/vstates.i
}
490 /* _UIB-CODE-BLOCK-END
*/
494 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-report V-table-Win
495 PROCEDURE verify-report
:
496 /*------------------------------------------------------------------------------
500 ------------------------------------------------------------------------------*/
504 /* _UIB-CODE-BLOCK-END
*/