When processing by company, list in creditor/voucher sequence.
[capital-apms-progress.git] / workflow / b-flow-step-type.w
blob0ef944df5be03712242704c6341c79838264d5ba
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 ------------------------------------------------------------------------*/
22 CREATE WIDGET-POOL.
24 /* *************************** Definitions ************************** */
26 DEF VAR key-name AS CHAR NO-UNDO.
27 DEF VAR key-value AS CHAR NO-UNDO.
29 /* _UIB-CODE-BLOCK-END */
30 &ANALYZE-RESUME
33 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
35 /* ******************** Preprocessor Definitions ******************** */
37 &Scoped-define PROCEDURE-TYPE SmartBrowser
39 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
41 /* Name of first Frame and/or Browse and/or first Query */
42 &Scoped-define FRAME-NAME F-Main
43 &Scoped-define BROWSE-NAME br_table
45 /* Internal Tables (found by Frame, Query & Browse Queries) */
46 &Scoped-define INTERNAL-TABLES FlowStepType
48 /* Define KEY-PHRASE in case it is used by any query. */
49 &Scoped-define KEY-PHRASE TRUE
51 /* Definitions for BROWSE br_table */
52 &Scoped-define FIELDS-IN-QUERY-br_table FlowStepType.FlowTaskType ~
53 FlowStepType.FlowStepType FlowStepType.Description ~
54 FlowStepType.InitialStatus FlowStepType.InitialPriority ~
55 FlowStepType.WarnPeriod FlowStepType.WarnUnits
56 &Scoped-define ENABLED-FIELDS-IN-QUERY-br_table
57 &Scoped-define FIELD-PAIRS-IN-QUERY-br_table
58 &Scoped-define OPEN-QUERY-br_table OPEN QUERY br_table FOR EACH FlowStepType WHERE ~{&KEY-PHRASE} NO-LOCK ~
59 ~{&SORTBY-PHRASE}.
60 &Scoped-define TABLES-IN-QUERY-br_table FlowStepType
61 &Scoped-define FIRST-TABLE-IN-QUERY-br_table FlowStepType
64 /* Definitions for FRAME F-Main */
66 /* Standard List Definitions */
67 &Scoped-Define ENABLED-OBJECTS br_table
69 /* Custom List Definitions */
70 /* List-1,List-2,List-3,List-4,List-5,List-6 */
72 /* _UIB-PREPROCESSOR-BLOCK-END */
73 &ANALYZE-RESUME
76 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" B-table-Win _INLINE
77 /* Actions: ? adm/support/keyedit.w ? ? ? */
78 /* STRUCTURED-DATA
79 <KEY-OBJECT>
80 &BROWSE-NAME
81 </KEY-OBJECT>
82 <FOREIGN-KEYS>
83 FlowTaskType|y|y|TTPL.FlowStepType.FlowTaskType
84 NextTaskType||y|TTPL.FlowStepType.FlowTaskType
85 FlowStepType||y|TTPL.FlowStepType.FlowStepType
86 NextStepType||y|TTPL.FlowStepType.FlowStepType
87 </FOREIGN-KEYS>
88 <EXECUTING-CODE>
89 **************************
90 * Set attributes related to FOREIGN KEYS
92 RUN set-attribute-list (
93 'Keys-Accepted = "FlowTaskType",
94 Keys-Supplied = "FlowTaskType,NextTaskType,FlowStepType,NextStepType"':U).
96 /* Tell the ADM to use the OPEN-QUERY-CASES. */
97 &Scoped-define OPEN-QUERY-CASES RUN dispatch ('open-query-cases':U).
98 /**************************
99 </EXECUTING-CODE> */
100 /* _UIB-CODE-BLOCK-END */
101 &ANALYZE-RESUME
103 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Advanced Query Options" B-table-Win _INLINE
104 /* Actions: ? adm/support/advqedit.w ? ? ? */
105 /* STRUCTURED-DATA
106 <KEY-OBJECT>
107 &BROWSE-NAME
108 </KEY-OBJECT>
109 <SORTBY-OPTIONS>
110 </SORTBY-OPTIONS>
111 <SORTBY-RUN-CODE>
112 ************************
113 * Set attributes related to SORTBY-OPTIONS */
114 RUN set-attribute-list (
115 'SortBy-Options = ""':U).
116 /************************
117 </SORTBY-RUN-CODE>
118 <FILTER-ATTRIBUTES>
119 </FILTER-ATTRIBUTES> */
121 /* _UIB-CODE-BLOCK-END */
122 &ANALYZE-RESUME
125 /* *********************** Control Definitions ********************** */
128 /* Definitions of the field level widgets */
129 /* Query definitions */
130 &ANALYZE-SUSPEND
131 DEFINE QUERY br_table FOR
132 FlowStepType SCROLLING.
133 &ANALYZE-RESUME
135 /* Browse definitions */
136 DEFINE BROWSE br_table
137 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS br_table B-table-Win _STRUCTURED
138 QUERY br_table NO-LOCK DISPLAY
139 FlowStepType.FlowTaskType COLUMN-LABEL "Task Type"
140 FlowStepType.FlowStepType COLUMN-LABEL "Step Type Code"
141 FlowStepType.Description
142 FlowStepType.InitialStatus COLUMN-LABEL "Init. Status"
143 FlowStepType.InitialPriority COLUMN-LABEL "Init. Priority"
144 FlowStepType.WarnPeriod
145 FlowStepType.WarnUnits
146 /* _UIB-CODE-BLOCK-END */
147 &ANALYZE-RESUME
148 WITH NO-ASSIGN SEPARATORS SIZE 84.57 BY 12.8
149 BGCOLOR 16 .
152 /* ************************ Frame Definitions *********************** */
154 DEFINE FRAME F-Main
155 br_table AT ROW 1 COL 1
156 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
157 SIDE-LABELS NO-UNDERLINE THREE-D
158 AT COL 1 ROW 1 SCROLLABLE
159 BGCOLOR 8 FGCOLOR 0 .
162 /* *********************** Procedure Settings ************************ */
164 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
165 /* Settings for THIS-PROCEDURE
166 Type: SmartBrowser
167 Allow: Basic,Browse
168 Frames: 1
169 Add Fields to: EXTERNAL-TABLES
170 Other Settings: PERSISTENT-ONLY COMPILE
173 /* This procedure should always be RUN PERSISTENT. Report the error, */
174 /* then cleanup and return. */
175 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
176 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
177 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
178 RETURN.
179 END.
181 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
183 /* ************************* Create Window ************************** */
185 &ANALYZE-SUSPEND _CREATE-WINDOW
186 /* DESIGN Window definition (used by the UIB)
187 CREATE WINDOW B-table-Win ASSIGN
188 HEIGHT = 14.35
189 WIDTH = 84.86.
190 /* END WINDOW DEFINITION */
192 &ANALYZE-RESUME
195 /* *************** Runtime Attributes and UIB Settings ************** */
197 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
198 /* SETTINGS FOR WINDOW B-table-Win
199 NOT-VISIBLE,,RUN-PERSISTENT */
200 /* SETTINGS FOR FRAME F-Main
201 NOT-VISIBLE Size-to-Fit */
202 /* BROWSE-TAB br_table 1 F-Main */
203 ASSIGN
204 FRAME F-Main:SCROLLABLE = FALSE
205 FRAME F-Main:HIDDEN = TRUE.
207 /* _RUN-TIME-ATTRIBUTES-END */
208 &ANALYZE-RESUME
211 /* Setting information for Queries and Browse Widgets fields */
213 &ANALYZE-SUSPEND _QUERY-BLOCK BROWSE br_table
214 /* Query rebuild information for BROWSE br_table
215 _TblList = "TTPL.FlowStepType"
216 _Options = "NO-LOCK KEY-PHRASE SORTBY-PHRASE"
217 _FldNameList[1] > TTPL.FlowStepType.FlowTaskType
218 "FlowTaskType" "Task Type" ? "character" ? ? ? ? ? ? no ?
219 _FldNameList[2] > TTPL.FlowStepType.FlowStepType
220 "FlowStepType" "Step Type Code" ? "character" ? ? ? ? ? ? no ?
221 _FldNameList[3] = TTPL.FlowStepType.Description
222 _FldNameList[4] > TTPL.FlowStepType.InitialStatus
223 "InitialStatus" "Init. Status" ? "character" ? ? ? ? ? ? no ?
224 _FldNameList[5] > TTPL.FlowStepType.InitialPriority
225 "InitialPriority" "Init. Priority" ? "integer" ? ? ? ? ? ? no ?
226 _FldNameList[6] = TTPL.FlowStepType.WarnPeriod
227 _FldNameList[7] = TTPL.FlowStepType.WarnUnits
228 _Query is NOT OPENED
229 */ /* BROWSE br_table */
230 &ANALYZE-RESUME
232 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
233 /* Query rebuild information for FRAME F-Main
234 _Options = "NO-LOCK"
235 _Query is NOT OPENED
236 */ /* FRAME F-Main */
237 &ANALYZE-RESUME
242 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB B-table-Win
243 /* ************************* Included-Libraries *********************** */
245 {src/adm/method/browser.i}
246 {inc/method/m-drlvwr.i}
248 /* _UIB-CODE-BLOCK-END */
249 &ANALYZE-RESUME
254 /* ************************ Control Triggers ************************ */
256 &Scoped-define BROWSE-NAME br_table
257 &Scoped-define SELF-NAME br_table
258 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
259 ON ROW-ENTRY OF br_table IN FRAME F-Main
261 /* This code displays initial values for newly added or copied rows. */
262 {src/adm/template/brsentry.i}
263 END.
265 /* _UIB-CODE-BLOCK-END */
266 &ANALYZE-RESUME
269 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
270 ON ROW-LEAVE OF br_table IN FRAME F-Main
272 /* Do not disable this code or no updates will take place except
273 by pressing the Save button on an Update SmartPanel. */
274 {src/adm/template/brsleave.i}
275 END.
277 /* _UIB-CODE-BLOCK-END */
278 &ANALYZE-RESUME
281 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
282 ON VALUE-CHANGED OF br_table IN FRAME F-Main
284 /* This ADM trigger code must be preserved in order to notify other
285 objects when the browser's current row changes. */
286 {src/adm/template/brschnge.i}
287 END.
289 /* _UIB-CODE-BLOCK-END */
290 &ANALYZE-RESUME
293 &UNDEFINE SELF-NAME
295 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK B-table-Win
298 /* *************************** Main Block *************************** */
300 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
301 RUN dispatch IN THIS-PROCEDURE ('initialize':U).
302 &ENDIF
304 /* _UIB-CODE-BLOCK-END */
305 &ANALYZE-RESUME
308 /* ********************** Internal Procedures *********************** */
310 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-open-query-cases B-table-Win adm/support/_adm-opn.p
311 PROCEDURE adm-open-query-cases :
312 /*------------------------------------------------------------------------------
313 Purpose: Opens different cases of the query based on attributes
314 such as the 'Key-Name', or 'SortBy-Case'
315 Parameters: <none>
316 ------------------------------------------------------------------------------*/
317 DEF VAR key-value AS CHAR NO-UNDO.
319 /* Look up the current key-value. */
320 RUN get-attribute ('Key-Value':U).
321 key-value = RETURN-VALUE.
323 /* Find the current record using the current Key-Name. */
324 RUN get-attribute ('Key-Name':U).
325 CASE RETURN-VALUE:
326 WHEN 'FlowTaskType':U THEN DO:
327 &Scope KEY-PHRASE FlowStepType.FlowTaskType eq key-value
328 {&OPEN-QUERY-{&BROWSE-NAME}}
329 END. /* FlowTaskType */
330 OTHERWISE DO:
331 &Scope KEY-PHRASE TRUE
332 {&OPEN-QUERY-{&BROWSE-NAME}}
333 END. /* OTHERWISE...*/
334 END CASE.
336 END PROCEDURE.
338 /* _UIB-CODE-BLOCK-END */
339 &ANALYZE-RESUME
342 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available B-table-Win _ADM-ROW-AVAILABLE
343 PROCEDURE adm-row-available :
344 /*------------------------------------------------------------------------------
345 Purpose: Dispatched to this procedure when the Record-
346 Source has a new row available. This procedure
347 tries to get the new row (or foriegn keys) from
348 the Record-Source and process it.
349 Parameters: <none>
350 ------------------------------------------------------------------------------*/
352 /* Define variables needed by this internal procedure. */
353 {src/adm/template/row-head.i}
355 /* Process the newly available records (i.e. display fields,
356 open queries, and/or pass records on to any RECORD-TARGETS). */
357 {src/adm/template/row-end.i}
359 END PROCEDURE.
361 /* _UIB-CODE-BLOCK-END */
362 &ANALYZE-RESUME
365 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI B-table-Win _DEFAULT-DISABLE
366 PROCEDURE disable_UI :
367 /*------------------------------------------------------------------------------
368 Purpose: DISABLE the User Interface
369 Parameters: <none>
370 Notes: Here we clean-up the user-interface by deleting
371 dynamic widgets we have created and/or hide
372 frames. This procedure is usually called when
373 we are ready to "clean-up" after running.
374 ------------------------------------------------------------------------------*/
375 /* Hide all frames. */
376 HIDE FRAME F-Main.
377 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
378 END PROCEDURE.
380 /* _UIB-CODE-BLOCK-END */
381 &ANALYZE-RESUME
384 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE internal-send-key B-table-Win adm/support/_key-snd.p
385 PROCEDURE internal-send-key :
386 /*------------------------------------------------------------------------------
387 Purpose: Sends a requested KEY value back to the calling
388 SmartObject.
389 Parameters: <see adm/template/sndkytop.i>
390 ------------------------------------------------------------------------------*/
392 /* Define variables needed by this internal procedure. */
393 {src/adm/template/sndkytop.i}
395 /* Return the key value associated with each key case. */
396 {src/adm/template/sndkycas.i "FlowTaskType" "FlowStepType" "FlowTaskType"}
397 {src/adm/template/sndkycas.i "NextTaskType" "FlowStepType" "FlowTaskType"}
398 {src/adm/template/sndkycas.i "FlowStepType" "FlowStepType" "FlowStepType"}
399 {src/adm/template/sndkycas.i "NextStepType" "FlowStepType" "FlowStepType"}
401 /* Close the CASE statement and end the procedure. */
402 {src/adm/template/sndkyend.i}
404 END PROCEDURE.
406 /* _UIB-CODE-BLOCK-END */
407 &ANALYZE-RESUME
410 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-delete-record B-table-Win
411 PROCEDURE local-delete-record :
412 /*------------------------------------------------------------------------------
413 Purpose: Override standard ADM method
414 Notes:
415 ------------------------------------------------------------------------------*/
416 DEF VAR yes-do-it AS LOGI NO-UNDO INITIAL Yes.
418 IF NOT AVAILABLE(FlowStepType) THEN RETURN.
420 MESSAGE "Are you sure you want to delete" SKIP
421 "the current Workflow Step record?"
422 VIEW-AS ALERT-BOX QUESTION BUTTONS OK-CANCEL
423 TITLE "Are you sure?" UPDATE yes-do-it .
425 IF yes-do-it THEN DO TRANSACTION:
426 FIND CURRENT FlowStepType EXCLUSIVE-LOCK.
427 DELETE FlowStepType.
428 RUN dispatch ( 'open-query':U ).
429 END.
430 END PROCEDURE.
432 /* _UIB-CODE-BLOCK-END */
433 &ANALYZE-RESUME
436 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-key B-table-Win
437 PROCEDURE send-key :
438 /*------------------------------------------------------------------------------
439 Purpose: Override the standard send-key routine.
440 ------------------------------------------------------------------------------*/
441 /* definition from src/adm/template/sndkytop.i */
442 DEFINE INPUT PARAMETER pc_key-name AS CHARACTER NO-UNDO.
443 DEFINE OUTPUT PARAMETER pc_key-value AS CHARACTER NO-UNDO INITIAL ?.
445 MESSAGE "Sending key" pc_key-name SKIP
446 "could send" key-name "which is" key-value SKIP
447 "record is" (IF AVAILABLE(FlowStepType) THEN "" ELSE "not ") + "available".
449 IF NOT AVAILABLE(FlowStepType) THEN DO:
450 IF (pc_key-name = "FlowTaskType" OR pc_key-name = "NextTaskType")
451 AND key-name = "FlowTaskType" THEN DO:
452 pc_key-value = key-value.
453 RETURN.
454 END.
455 END.
457 RUN internal-send-key( pc_key-name, OUTPUT pc_key-value ).
459 END PROCEDURE.
461 /* _UIB-CODE-BLOCK-END */
462 &ANALYZE-RESUME
465 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records B-table-Win _ADM-SEND-RECORDS
466 PROCEDURE send-records :
467 /*------------------------------------------------------------------------------
468 Purpose: Send record ROWID's for all tables used by
469 this file.
470 Parameters: see template/snd-head.i
471 ------------------------------------------------------------------------------*/
473 /* Define variables needed by this internal procedure. */
474 {src/adm/template/snd-head.i}
476 /* For each requested table, put it's ROWID in the output list. */
477 {src/adm/template/snd-list.i "FlowStepType"}
479 /* Deal with any unexpected table requests before closing. */
480 {src/adm/template/snd-end.i}
482 END PROCEDURE.
484 /* _UIB-CODE-BLOCK-END */
485 &ANALYZE-RESUME
488 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed B-table-Win
489 PROCEDURE state-changed :
490 /* -----------------------------------------------------------
491 Purpose:
492 Parameters: <none>
493 Notes:
494 -------------------------------------------------------------*/
495 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
496 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
498 CASE p-state:
499 /* Object instance CASEs can go here to replace standard behavior
500 or add new cases. */
501 {src/adm/template/bstates.i}
502 END CASE.
503 END PROCEDURE.
505 /* _UIB-CODE-BLOCK-END */
506 &ANALYZE-RESUME
509 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-Key-Name B-table-Win
510 PROCEDURE use-Key-Name :
511 /*------------------------------------------------------------------------------
512 Purpose:
513 ------------------------------------------------------------------------------*/
514 DEF INPUT PARAMETER new-key-name AS CHAR NO-UNDO.
515 key-name = new-key-name.
516 END PROCEDURE.
518 /* _UIB-CODE-BLOCK-END */
519 &ANALYZE-RESUME
522 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-key-value B-table-Win
523 PROCEDURE use-key-value :
524 /*------------------------------------------------------------------------------
525 Purpose:
526 ------------------------------------------------------------------------------*/
527 DEF INPUT PARAMETER new-key-value AS CHAR NO-UNDO.
528 key-value = new-key-value.
529 END PROCEDURE.
531 /* _UIB-CODE-BLOCK-END */
532 &ANALYZE-RESUME