Added capital works blank section. Synced calling screen.
[capital-apms-progress.git] / vwr / sel / b-selnbc.w
blob707f31d9038a6515a17c7f5f280462e80913824b
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 B-table-Win
8 /*------------------------------------------------------------------------
10 File:
12 Description: from BROWSER.W - Basic SmartBrowser Object Template
14 Input Parameters:
15 <none>
17 Output Parameters:
18 <none>
20 ------------------------------------------------------------------------*/
21 /* This .W file was created with the Progress UIB. */
22 /*----------------------------------------------------------------------*/
24 /* Create an unnamed pool to store all the widgets created
25 by this procedure. This is a good default which assures
26 that this procedure's triggers and internal procedures
27 will execute in this procedure's storage, and that proper
28 cleanup will occur on deletion of the procedure. */
30 CREATE WIDGET-POOL.
32 /* *************************** Definitions ************************** */
34 /* Parameters Definitions --- */
36 /* Local Variable Definitions --- */
38 {inc/topic/tpnewbch.i}
40 DEF VAR PersonName AS CHAR FORMAT "X(20)" LABEL "Operator" NO-UNDO.
41 DEF VAR gap-1 AS CHAR NO-UNDO FORMAT "X" LABEL "".
42 DEF VAR gap-2 AS CHAR NO-UNDO FORMAT "X" LABEL "".
44 /* _UIB-CODE-BLOCK-END */
45 &ANALYZE-RESUME
48 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
50 /* ******************** Preprocessor Definitions ******************** */
52 &Scoped-define PROCEDURE-TYPE SmartBrowser
54 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
56 /* Name of first Frame and/or Browse and/or first Query */
57 &Scoped-define FRAME-NAME F-Main
58 &Scoped-define BROWSE-NAME br_table
60 /* Internal Tables (found by Frame, Query & Browse Queries) */
61 &Scoped-define INTERNAL-TABLES NewBatch Person
63 /* Define KEY-PHRASE in case it is used by any query. */
64 &Scoped-define KEY-PHRASE TRUE
66 /* Definitions for BROWSE br_table */
67 &Scoped-define FIELDS-IN-QUERY-br_table NewBatch.BatchCode gap-1 @ gap-1 ~
68 NewBatch.Description NewBatch.DocumentCount NewBatch.Total gap-2 @ gap-2 ~
69 Person.FirstName + ' ' + Person.LastName @ PersonName
70 &Scoped-define ENABLED-FIELDS-IN-QUERY-br_table
71 &Scoped-define FIELD-PAIRS-IN-QUERY-br_table
72 &Scoped-define OPEN-QUERY-br_table OPEN QUERY br_table FOR EACH NewBatch WHERE ~{&KEY-PHRASE} NO-LOCK, ~
73 EACH Person OF NewBatch OUTER-JOIN NO-LOCK ~
74 BY NewBatch.BatchCode DESCENDING.
75 &Scoped-define TABLES-IN-QUERY-br_table NewBatch Person
76 &Scoped-define FIRST-TABLE-IN-QUERY-br_table NewBatch
79 /* Definitions for FRAME F-Main */
81 /* Standard List Definitions */
82 &Scoped-Define ENABLED-OBJECTS br_table
84 /* Custom List Definitions */
85 /* List-1,List-2,List-3,List-4,List-5,List-6 */
87 /* _UIB-PREPROCESSOR-BLOCK-END */
88 &ANALYZE-RESUME
91 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" B-table-Win _INLINE
92 /* Actions: ? adm/support/keyedit.w ? ? ? */
93 /* STRUCTURED-DATA
94 <KEY-OBJECT>
95 &BROWSE-NAME
96 </KEY-OBJECT>
97 <FOREIGN-KEYS>
98 BatchType|y|y|TTPL.NewBatch.BatchType
99 BatchCode||y|TTPL.NewBatch.BatchCode
100 PersonCode||y|TTPL.NewBatch.PersonCode
101 </FOREIGN-KEYS>
102 <EXECUTING-CODE>
103 **************************
104 * Set attributes related to FOREIGN KEYS
106 RUN set-attribute-list (
107 'Keys-Accepted = "BatchType",
108 Keys-Supplied = "BatchType,BatchCode,PersonCode"':U).
110 /* Tell the ADM to use the OPEN-QUERY-CASES. */
111 &Scoped-define OPEN-QUERY-CASES RUN dispatch ('open-query-cases':U).
112 /**************************
113 </EXECUTING-CODE> */
114 /* _UIB-CODE-BLOCK-END */
115 &ANALYZE-RESUME
117 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Advanced Query Options" B-table-Win _INLINE
118 /* Actions: ? adm/support/advqedit.w ? ? ? */
119 /* STRUCTURED-DATA
120 <KEY-OBJECT>
121 &BROWSE-NAME
122 </KEY-OBJECT>
123 <SORTBY-OPTIONS>
124 </SORTBY-OPTIONS>
125 <SORTBY-RUN-CODE>
126 ************************
127 * Set attributes related to SORTBY-OPTIONS */
128 RUN set-attribute-list (
129 'SortBy-Options = ""':U).
130 /************************
131 </SORTBY-RUN-CODE>
132 <FILTER-ATTRIBUTES>
133 </FILTER-ATTRIBUTES> */
135 /* _UIB-CODE-BLOCK-END */
136 &ANALYZE-RESUME
139 /* *********************** Control Definitions ********************** */
142 /* Definitions of the field level widgets */
143 /* Query definitions */
144 &ANALYZE-SUSPEND
145 DEFINE QUERY br_table FOR
146 NewBatch,
147 Person SCROLLING.
148 &ANALYZE-RESUME
150 /* Browse definitions */
151 DEFINE BROWSE br_table
152 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS br_table B-table-Win _STRUCTURED
153 QUERY br_table NO-LOCK DISPLAY
154 NewBatch.BatchCode
155 gap-1 @ gap-1
156 NewBatch.Description
157 NewBatch.DocumentCount
158 NewBatch.Total
159 gap-2 @ gap-2
160 Person.FirstName + ' ' + Person.LastName @ PersonName
161 /* _UIB-CODE-BLOCK-END */
162 &ANALYZE-RESUME
163 WITH NO-ASSIGN NO-ROW-MARKERS SEPARATORS SIZE 82.29 BY 14
164 BGCOLOR 15 .
167 /* ************************ Frame Definitions *********************** */
169 DEFINE FRAME F-Main
170 br_table AT ROW 1 COL 1
171 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
172 SIDE-LABELS NO-UNDERLINE THREE-D
173 AT COL 1 ROW 1 SCROLLABLE
174 FGCOLOR 0 .
177 /* *********************** Procedure Settings ************************ */
179 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
180 /* Settings for THIS-PROCEDURE
181 Type: SmartBrowser
182 Allow: Basic,Browse
183 Frames: 1
184 Add Fields to: EXTERNAL-TABLES
185 Other Settings: PERSISTENT-ONLY COMPILE
188 /* This procedure should always be RUN PERSISTENT. Report the error, */
189 /* then cleanup and return. */
190 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
191 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
192 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
193 RETURN.
194 END.
196 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
198 /* ************************* Create Window ************************** */
200 &ANALYZE-SUSPEND _CREATE-WINDOW
201 /* DESIGN Window definition (used by the UIB)
202 CREATE WINDOW B-table-Win ASSIGN
203 HEIGHT = 14.8
204 WIDTH = 90.72.
205 /* END WINDOW DEFINITION */
207 &ANALYZE-RESUME
210 /* *************** Runtime Attributes and UIB Settings ************** */
212 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
213 /* SETTINGS FOR WINDOW B-table-Win
214 NOT-VISIBLE,,RUN-PERSISTENT */
215 /* SETTINGS FOR FRAME F-Main
216 NOT-VISIBLE Size-to-Fit */
217 /* BROWSE-TAB br_table 1 F-Main */
218 ASSIGN
219 FRAME F-Main:SCROLLABLE = FALSE
220 FRAME F-Main:HIDDEN = TRUE.
222 /* _RUN-TIME-ATTRIBUTES-END */
223 &ANALYZE-RESUME
226 /* Setting information for Queries and Browse Widgets fields */
228 &ANALYZE-SUSPEND _QUERY-BLOCK BROWSE br_table
229 /* Query rebuild information for BROWSE br_table
230 _TblList = "TTPL.NewBatch,TTPL.Person OF TTPL.NewBatch"
231 _Options = "NO-LOCK KEY-PHRASE"
232 _TblOptList = ", OUTER"
233 _OrdList = "TTPL.NewBatch.BatchCode|no"
234 _FldNameList[1] = TTPL.NewBatch.BatchCode
235 _FldNameList[2] > "_<CALC>"
236 "gap-1 @ gap-1" ? ? ? ? ? ? ? ? ? no ?
237 _FldNameList[3] = TTPL.NewBatch.Description
238 _FldNameList[4] = TTPL.NewBatch.DocumentCount
239 _FldNameList[5] = TTPL.NewBatch.Total
240 _FldNameList[6] > "_<CALC>"
241 "gap-2 @ gap-2" ? ? ? ? ? ? ? ? ? no ?
242 _FldNameList[7] > "_<CALC>"
243 "Person.FirstName + ' ' + Person.LastName @ PersonName" ? ? ? ? ? ? ? ? ? no ?
244 _Query is NOT OPENED
245 */ /* BROWSE br_table */
246 &ANALYZE-RESUME
248 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
249 /* Query rebuild information for FRAME F-Main
250 _Options = "NO-LOCK"
251 _Query is NOT OPENED
252 */ /* FRAME F-Main */
253 &ANALYZE-RESUME
257 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "SmartBrowserWizard" B-table-Win _INLINE
258 /* Actions: adm/support/_wizard.w ? ? ? adm/support/_wizdel.p */
259 /* SmartBrowser Wizard
260 Destroy on next read */
261 /* _UIB-CODE-BLOCK-END */
262 &ANALYZE-RESUME
265 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB B-table-Win
266 /* ************************* Included-Libraries *********************** */
268 {src/adm/method/browser.i}
269 {inc/method/m-selvwr.i}
271 /* _UIB-CODE-BLOCK-END */
272 &ANALYZE-RESUME
277 /* ************************ Control Triggers ************************ */
279 &Scoped-define BROWSE-NAME br_table
280 &Scoped-define SELF-NAME br_table
281 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
282 ON ROW-ENTRY OF br_table IN FRAME F-Main
284 /* This code displays initial values for newly added or copied rows. */
285 {src/adm/template/brsentry.i}
286 END.
288 /* _UIB-CODE-BLOCK-END */
289 &ANALYZE-RESUME
292 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
293 ON ROW-LEAVE OF br_table IN FRAME F-Main
295 /* Do not disable this code or no updates will take place except
296 by pressing the Save button on an Update SmartPanel. */
297 {src/adm/template/brsleave.i}
298 END.
300 /* _UIB-CODE-BLOCK-END */
301 &ANALYZE-RESUME
304 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
305 ON VALUE-CHANGED OF br_table IN FRAME F-Main
307 /* This ADM trigger code must be preserved in order to notify other
308 objects when the browser's current row changes. */
309 {src/adm/template/brschnge.i}
311 END.
313 /* _UIB-CODE-BLOCK-END */
314 &ANALYZE-RESUME
317 &UNDEFINE SELF-NAME
319 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK B-table-Win
322 /* *************************** Main Block *************************** */
324 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
325 RUN dispatch IN THIS-PROCEDURE ('initialize':U).
326 &ENDIF
328 /* _UIB-CODE-BLOCK-END */
329 &ANALYZE-RESUME
332 /* ********************** Internal Procedures *********************** */
334 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-open-query-cases B-table-Win adm/support/_adm-opn.p
335 PROCEDURE adm-open-query-cases :
336 /*------------------------------------------------------------------------------
337 Purpose: Opens different cases of the query based on attributes
338 such as the 'Key-Name', or 'SortBy-Case'
339 Parameters: <none>
340 ------------------------------------------------------------------------------*/
341 DEF VAR key-value AS CHAR NO-UNDO.
343 /* Look up the current key-value. */
344 RUN get-attribute ('Key-Value':U).
345 key-value = RETURN-VALUE.
347 /* Find the current record using the current Key-Name. */
348 RUN get-attribute ('Key-Name':U).
349 CASE RETURN-VALUE:
350 WHEN 'BatchType':U THEN DO:
351 &Scope KEY-PHRASE NewBatch.BatchType eq key-value
352 {&OPEN-QUERY-{&BROWSE-NAME}}
353 END. /* BatchType */
354 OTHERWISE DO:
355 &Scope KEY-PHRASE TRUE
356 {&OPEN-QUERY-{&BROWSE-NAME}}
357 END. /* OTHERWISE...*/
358 END CASE.
360 END PROCEDURE.
362 /* _UIB-CODE-BLOCK-END */
363 &ANALYZE-RESUME
366 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available B-table-Win _ADM-ROW-AVAILABLE
367 PROCEDURE adm-row-available :
368 /*------------------------------------------------------------------------------
369 Purpose: Dispatched to this procedure when the Record-
370 Source has a new row available. This procedure
371 tries to get the new row (or foriegn keys) from
372 the Record-Source and process it.
373 Parameters: <none>
374 ------------------------------------------------------------------------------*/
376 /* Define variables needed by this internal procedure. */
377 {src/adm/template/row-head.i}
379 /* Process the newly available records (i.e. display fields,
380 open queries, and/or pass records on to any RECORD-TARGETS). */
381 {src/adm/template/row-end.i}
383 END PROCEDURE.
385 /* _UIB-CODE-BLOCK-END */
386 &ANALYZE-RESUME
389 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI B-table-Win _DEFAULT-DISABLE
390 PROCEDURE disable_UI :
391 /*------------------------------------------------------------------------------
392 Purpose: DISABLE the User Interface
393 Parameters: <none>
394 Notes: Here we clean-up the user-interface by deleting
395 dynamic widgets we have created and/or hide
396 frames. This procedure is usually called when
397 we are ready to "clean-up" after running.
398 ------------------------------------------------------------------------------*/
399 /* Hide all frames. */
400 HIDE FRAME F-Main.
401 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
402 END PROCEDURE.
404 /* _UIB-CODE-BLOCK-END */
405 &ANALYZE-RESUME
408 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-key B-table-Win adm/support/_key-snd.p
409 PROCEDURE send-key :
410 /*------------------------------------------------------------------------------
411 Purpose: Sends a requested KEY value back to the calling
412 SmartObject.
413 Parameters: <see adm/template/sndkytop.i>
414 ------------------------------------------------------------------------------*/
416 /* Define variables needed by this internal procedure. */
417 {src/adm/template/sndkytop.i}
419 /* Return the key value associated with each key case. */
420 {src/adm/template/sndkycas.i "BatchType" "NewBatch" "BatchType"}
421 {src/adm/template/sndkycas.i "BatchCode" "NewBatch" "BatchCode"}
422 {src/adm/template/sndkycas.i "PersonCode" "NewBatch" "PersonCode"}
424 /* Close the CASE statement and end the procedure. */
425 {src/adm/template/sndkyend.i}
427 END PROCEDURE.
429 /* _UIB-CODE-BLOCK-END */
430 &ANALYZE-RESUME
433 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records B-table-Win _ADM-SEND-RECORDS
434 PROCEDURE send-records :
435 /*------------------------------------------------------------------------------
436 Purpose: Send record ROWID's for all tables used by
437 this file.
438 Parameters: see template/snd-head.i
439 ------------------------------------------------------------------------------*/
441 /* Define variables needed by this internal procedure. */
442 {src/adm/template/snd-head.i}
444 /* For each requested table, put it's ROWID in the output list. */
445 {src/adm/template/snd-list.i "NewBatch"}
446 {src/adm/template/snd-list.i "Person"}
448 /* Deal with any unexpected table requests before closing. */
449 {src/adm/template/snd-end.i}
451 END PROCEDURE.
453 /* _UIB-CODE-BLOCK-END */
454 &ANALYZE-RESUME
457 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed B-table-Win
458 PROCEDURE state-changed :
459 /* -----------------------------------------------------------
460 Purpose:
461 Parameters: <none>
462 Notes:
463 -------------------------------------------------------------*/
464 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
465 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
467 CASE p-state:
468 /* Object instance CASEs can go here to replace standard behavior
469 or add new cases. */
470 {src/adm/template/bstates.i}
471 END CASE.
472 END PROCEDURE.
474 /* _UIB-CODE-BLOCK-END */
475 &ANALYZE-RESUME