Changes for Catalyst APMS. Added PDF checkboxes to screens the generate remittance...
[capital-apms-progress.git] / vwr / mnt / d-alternate.w
blobd8e3cf467d33bd8998330c0ba6abd1bfb05938f9
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 &Scoped-define FRAME-NAME D-Dialog
8 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS D-Dialog
9 /*------------------------------------------------------------------------
11 File:
13 Description: Edit alternate company names
15 Input Parameters:
16 Person Code and Main Company
18 Output Parameters:
19 <none>
21 Author:
23 Created:
24 ------------------------------------------------------------------------*/
26 CREATE WIDGET-POOL.
28 /* *************************** Definitions ************************** */
30 /* Parameters Definitions --- */
31 DEF INPUT PARAMETER person-code AS INT NO-UNDO.
32 DEF INPUT PARAMETER person-default AS CHAR NO-UNDO.
33 DEF INPUT PARAMETER alternate-type AS CHAR NO-UNDO.
35 /* Local Variable Definitions --- */
37 FIND Person WHERE Person.PersonCode = person-code
38 NO-LOCK NO-ERROR.
39 IF NOT AVAILABLE(Person) THEN DO:
40 MESSAGE "No person record available for" person-code
41 VIEW-AS ALERT-BOX ERROR.
42 END.
44 /* _UIB-CODE-BLOCK-END */
45 &ANALYZE-RESUME
48 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
50 /* ******************** Preprocessor Definitions ******************** */
52 &Scoped-define PROCEDURE-TYPE SmartDialog
54 &Scoped-define ADM-CONTAINER DIALOG-BOX
56 /* Name of first Frame and/or Browse and/or first Query */
57 &Scoped-define FRAME-NAME D-Dialog
58 &Scoped-define BROWSE-NAME br_Details
60 /* External Tables */
61 &Scoped-define EXTERNAL-TABLES Person
62 &Scoped-define FIRST-EXTERNAL-TABLE Person
65 /* Need to scope the external tables to this procedure */
66 DEFINE QUERY external_tables FOR Person.
67 /* Internal Tables (found by Frame, Query & Browse Queries) */
68 &Scoped-define INTERNAL-TABLES PersonDetail
70 /* Definitions for BROWSE br_Details */
71 &Scoped-define FIELDS-IN-QUERY-br_Details PersonDetail.ContactType PersonDetail.DataValue
72 &Scoped-define ENABLED-FIELDS-IN-QUERY-br_Details PersonDetail.ContactType ~
73 PersonDetail.DataValue
74 &Scoped-define FIELD-PAIRS-IN-QUERY-br_Details~
75 ~{&FP1}ContactType ~{&FP2}ContactType ~{&FP3}~
76 ~{&FP1}DataValue ~{&FP2}DataValue ~{&FP3}
77 &Scoped-define ENABLED-TABLES-IN-QUERY-br_Details PersonDetail
78 &Scoped-define FIRST-ENABLED-TABLE-IN-QUERY-br_Details PersonDetail
79 &Scoped-define SELF-NAME br_Details
80 &Scoped-define OPEN-QUERY-br_Details OPEN QUERY {&SELF-NAME} FOR EACH PersonDetail OF Person WHERE PersonDetail.PersonDetailType = "ALT" AND PersonDetail.SupplementaryType = alternate-type NO-LOCK.
81 &Scoped-define TABLES-IN-QUERY-br_Details PersonDetail
82 &Scoped-define FIRST-TABLE-IN-QUERY-br_Details PersonDetail
85 /* Definitions for DIALOG-BOX D-Dialog */
86 &Scoped-define OPEN-BROWSERS-IN-QUERY-D-Dialog ~
87 ~{&OPEN-QUERY-br_Details}
89 /* Standard List Definitions */
90 &Scoped-Define ENABLED-OBJECTS RECT-2 br_Details btn_add btn_remove Btn_OK ~
91 Btn_Cancel
92 &Scoped-Define DISPLAYED-OBJECTS default-value
94 /* Custom List Definitions */
95 /* List-1,List-2,List-3,List-4,List-5,List-6 */
97 /* _UIB-PREPROCESSOR-BLOCK-END */
98 &ANALYZE-RESUME
102 /* *********************** Control Definitions ********************** */
104 /* Define a dialog box */
106 /* Definitions of the field level widgets */
107 DEFINE BUTTON btn_add
108 LABEL "&Add"
109 SIZE 10 BY 1.
111 DEFINE BUTTON Btn_Cancel AUTO-END-KEY
112 LABEL "Cancel"
113 SIZE 9.14 BY 1.15
114 BGCOLOR 8 .
116 DEFINE BUTTON Btn_OK AUTO-GO DEFAULT
117 LABEL "OK"
118 SIZE 7.43 BY 1.15
119 BGCOLOR 8 .
121 DEFINE BUTTON btn_remove
122 LABEL "&Remove"
123 SIZE 10 BY 1.
125 DEFINE VARIABLE default-value AS CHARACTER FORMAT "X(80)"
126 LABEL "Default"
127 VIEW-AS FILL-IN
128 SIZE 44 BY 1.
130 DEFINE RECTANGLE RECT-2
131 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
132 SIZE 52 BY 11.4.
134 /* Query definitions */
135 &ANALYZE-SUSPEND
136 DEFINE QUERY br_Details FOR
137 PersonDetail SCROLLING.
138 &ANALYZE-RESUME
140 /* Browse definitions */
141 DEFINE BROWSE br_Details
142 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS br_Details D-Dialog _FREEFORM
143 QUERY br_Details DISPLAY
144 PersonDetail.ContactType FORMAT "X(6)" WIDTH 6
145 PersonDetail.DataValue COLUMN-LABEL "Company" FORMAT "X(50)" WIDTH 41
146 ENABLE
147 PersonDetail.ContactType
148 PersonDetail.DataValue
149 /* _UIB-CODE-BLOCK-END */
150 &ANALYZE-RESUME
151 WITH NO-ROW-MARKERS SIZE 50.86 BY 7.5
152 FONT 10.
155 /* ************************ Frame Definitions *********************** */
157 DEFINE FRAME D-Dialog
158 default-value AT ROW 1.3 COL 6.43 COLON-ALIGNED
159 br_Details AT ROW 3.6 COL 1.57
160 btn_add AT ROW 11.2 COL 31.57
161 btn_remove AT ROW 11.2 COL 42.14
162 Btn_OK AT ROW 12.5 COL 1
163 Btn_Cancel AT ROW 12.5 COL 10.14
164 "Enter the contact types and the overrides which apply." VIEW-AS TEXT
165 SIZE 49.43 BY .8 AT ROW 2.6 COL 2.14
166 RECT-2 AT ROW 1 COL 1
167 SPACE(0.13) SKIP(1.59)
168 WITH VIEW-AS DIALOG-BOX KEEP-TAB-ORDER
169 SIDE-LABELS NO-UNDERLINE THREE-D SCROLLABLE
170 FONT 10
171 TITLE "Address Details"
172 DEFAULT-BUTTON Btn_OK CANCEL-BUTTON Btn_Cancel.
175 /* *********************** Procedure Settings ************************ */
177 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
178 /* Settings for THIS-PROCEDURE
179 Type: SmartDialog
180 External Tables: TTPL.Person
181 Allow: Basic,Browse,DB-Fields,Query,Smart
182 Other Settings: COMPILE
184 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
187 /* *************** Runtime Attributes and UIB Settings ************** */
189 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
190 /* SETTINGS FOR DIALOG-BOX D-Dialog
192 /* BROWSE-TAB br_Details default-value D-Dialog */
193 ASSIGN
194 FRAME D-Dialog:SCROLLABLE = FALSE
195 FRAME D-Dialog:HIDDEN = TRUE.
197 /* SETTINGS FOR FILL-IN default-value IN FRAME D-Dialog
198 NO-ENABLE */
199 /* _RUN-TIME-ATTRIBUTES-END */
200 &ANALYZE-RESUME
203 /* Setting information for Queries and Browse Widgets fields */
205 &ANALYZE-SUSPEND _QUERY-BLOCK BROWSE br_Details
206 /* Query rebuild information for BROWSE br_Details
207 _START_FREEFORM
208 OPEN QUERY {&SELF-NAME} FOR EACH PersonDetail OF Person
209 WHERE PersonDetail.PersonDetailType = "ALT"
210 AND PersonDetail.SupplementaryType = alternate-type NO-LOCK.
211 _END_FREEFORM
212 _Where[1] = "PersonDetail.PersonDetailType = ""ALT""
213 AND PersonDetail.SupplementaryType = alternate-type"
214 _Query is OPENED
215 */ /* BROWSE br_Details */
216 &ANALYZE-RESUME
218 &ANALYZE-SUSPEND _QUERY-BLOCK DIALOG-BOX D-Dialog
219 /* Query rebuild information for DIALOG-BOX D-Dialog
220 _Options = "SHARE-LOCK"
221 _Query is NOT OPENED
222 */ /* DIALOG-BOX D-Dialog */
223 &ANALYZE-RESUME
228 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB D-Dialog
229 /* ************************* Included-Libraries *********************** */
231 {src/adm/method/containr.i}
233 /* _UIB-CODE-BLOCK-END */
234 &ANALYZE-RESUME
239 /* ************************ Control Triggers ************************ */
241 &Scoped-define SELF-NAME D-Dialog
242 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL D-Dialog D-Dialog
243 ON WINDOW-CLOSE OF FRAME D-Dialog /* Address Details */
244 DO:
245 /* Add Trigger to equate WINDOW-CLOSE to END-ERROR. */
246 APPLY "END-ERROR":U TO SELF.
247 END.
249 /* _UIB-CODE-BLOCK-END */
250 &ANALYZE-RESUME
253 &Scoped-define BROWSE-NAME br_Details
254 &Scoped-define SELF-NAME br_Details
255 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_Details D-Dialog
256 ON VALUE-CHANGED OF br_Details IN FRAME D-Dialog /* Browse 1 */
258 RUN display-alternate.
259 END.
261 /* _UIB-CODE-BLOCK-END */
262 &ANALYZE-RESUME
265 &Scoped-define SELF-NAME btn_add
266 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_add D-Dialog
267 ON CHOOSE OF btn_add IN FRAME D-Dialog /* Add */
269 RUN add-alternate.
270 END.
272 /* _UIB-CODE-BLOCK-END */
273 &ANALYZE-RESUME
276 &Scoped-define SELF-NAME btn_remove
277 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_remove D-Dialog
278 ON CHOOSE OF btn_remove IN FRAME D-Dialog /* Remove */
280 RUN remove-alternate.
281 END.
283 /* _UIB-CODE-BLOCK-END */
284 &ANALYZE-RESUME
287 &UNDEFINE SELF-NAME
289 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK D-Dialog
292 /* *************************** Main Block *************************** */
293 default-value = person-default.
294 DataValue:LABEL IN BROWSE {&BROWSE-NAME} = alternate-type.
296 ON LEAVE OF PersonDetail.ContactType IN BROWSE {&BROWSE-NAME} DO:
297 RUN assign-alternate.
298 END.
300 ON LEAVE OF PersonDetail.DataValue IN BROWSE {&BROWSE-NAME} DO:
301 RUN assign-alternate.
302 END.
304 RUN open-alt-query.
305 RUN display-alternate.
307 {src/adm/template/dialogmn.i}
309 /* _UIB-CODE-BLOCK-END */
310 &ANALYZE-RESUME
313 /* ********************** Internal Procedures *********************** */
315 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE add-alternate D-Dialog
316 PROCEDURE add-alternate :
317 /*------------------------------------------------------------------------------
318 Purpose:
319 ------------------------------------------------------------------------------*/
321 DO WITH FRAME {&FRAME-NAME}:
323 DEF VAR reposition-row AS INT NO-UNDO.
324 DEF VAR reposition-rowid AS ROWID NO-UNDO.
326 IF NUM-RESULTS( "{&BROWSE-NAME}" ) = 0 OR NUM-RESULTS( "{&BROWSE-NAME}" ) = ? THEN DO:
327 RUN open-alt-query.
328 END.
330 IF AVAILABLE PersonDetail THEN RUN assign-alternate.
332 CREATE PersonDetail.
333 PersonDetail.PersonCode = person-code.
334 PersonDetail.PersonDetailType = "ALT".
335 PersonDetail.SupplementaryType = alternate-type.
337 reposition-rowid = ROWID( PersonDetail ).
339 reposition-row = {&BROWSE-NAME}:GET-REPOSITIONED-ROW().
340 reposition-row = INT( {&BROWSE-NAME}:HEIGHT-CHARS ) - 1.
341 OPEN QUERY {&BROWSE-NAME} FOR EACH PersonDetail.
342 IF {&BROWSE-NAME}:SET-REPOSITIONED-ROW( reposition-row, "CONDITIONAL" ) THEN.
343 REPOSITION {&BROWSE-NAME} TO ROWID reposition-rowid.
345 RUN display-alternate.
346 RUN assign-alternate.
347 APPLY 'ENTRY':U TO PersonDetail.ContactType IN BROWSE {&BROWSE-NAME}.
349 END.
351 END PROCEDURE.
353 /* _UIB-CODE-BLOCK-END */
354 &ANALYZE-RESUME
357 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-create-objects D-Dialog _ADM-CREATE-OBJECTS
358 PROCEDURE adm-create-objects :
359 /*------------------------------------------------------------------------------
360 Purpose: Create handles for all SmartObjects used in this procedure.
361 After SmartObjects are initialized, then SmartLinks are added.
362 Parameters: <none>
363 ------------------------------------------------------------------------------*/
365 END PROCEDURE.
367 /* _UIB-CODE-BLOCK-END */
368 &ANALYZE-RESUME
371 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available D-Dialog _ADM-ROW-AVAILABLE
372 PROCEDURE adm-row-available :
373 /*------------------------------------------------------------------------------
374 Purpose: Dispatched to this procedure when the Record-
375 Source has a new row available. This procedure
376 tries to get the new row (or foriegn keys) from
377 the Record-Source and process it.
378 Parameters: <none>
379 ------------------------------------------------------------------------------*/
381 /* Define variables needed by this internal procedure. */
382 {src/adm/template/row-head.i}
384 /* Create a list of all the tables that we need to get. */
385 {src/adm/template/row-list.i "Person"}
387 /* Get the record ROWID's from the RECORD-SOURCE. */
388 {src/adm/template/row-get.i}
390 /* FIND each record specified by the RECORD-SOURCE. */
391 {src/adm/template/row-find.i "Person"}
393 /* Process the newly available records (i.e. display fields,
394 open queries, and/or pass records on to any RECORD-TARGETS). */
395 {src/adm/template/row-end.i}
397 END PROCEDURE.
399 /* _UIB-CODE-BLOCK-END */
400 &ANALYZE-RESUME
403 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE assign-alternate D-Dialog
404 PROCEDURE assign-alternate :
405 /*------------------------------------------------------------------------------
406 Purpose:
407 ------------------------------------------------------------------------------*/
409 IF AVAILABLE PersonDetail THEN DO:
410 FIND CURRENT PersonDetail EXCLUSIVE-LOCK.
411 ASSIGN BROWSE {&BROWSE-NAME}
412 PersonDetail.DataValue
413 PersonDetail.ContactType .
415 PersonDetail.PersonCode = person-code.
416 PersonDetail.PersonDetailType = "ALT".
417 PersonDetail.SupplementaryType = alternate-type.
418 FIND CURRENT PersonDetail NO-LOCK.
419 END.
420 END PROCEDURE.
422 /* _UIB-CODE-BLOCK-END */
423 &ANALYZE-RESUME
426 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE close-alt-query D-Dialog
427 PROCEDURE close-alt-query :
428 /*------------------------------------------------------------------------------
429 Purpose:
430 Parameters: <none>
431 Notes:
432 ------------------------------------------------------------------------------*/
434 CLOSE QUERY {&BROWSE-NAME}.
436 END PROCEDURE.
438 /* _UIB-CODE-BLOCK-END */
439 &ANALYZE-RESUME
442 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI D-Dialog _DEFAULT-DISABLE
443 PROCEDURE disable_UI :
444 /*------------------------------------------------------------------------------
445 Purpose: DISABLE the User Interface
446 Parameters: <none>
447 Notes: Here we clean-up the user-interface by deleting
448 dynamic widgets we have created and/or hide
449 frames. This procedure is usually called when
450 we are ready to "clean-up" after running.
451 ------------------------------------------------------------------------------*/
452 /* Hide all frames. */
453 HIDE FRAME D-Dialog.
454 END PROCEDURE.
456 /* _UIB-CODE-BLOCK-END */
457 &ANALYZE-RESUME
460 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE display-alternate D-Dialog
461 PROCEDURE display-alternate :
462 /*------------------------------------------------------------------------------
463 Purpose:
464 ------------------------------------------------------------------------------*/
466 IF AVAILABLE PersonDetail THEN DO:
467 DISPLAY {&FIELDS-IN-QUERY-{&BROWSE-NAME}} WITH BROWSE {&BROWSE-NAME}.
468 END.
469 RUN sensitise-buttons.
471 END PROCEDURE.
473 /* _UIB-CODE-BLOCK-END */
474 &ANALYZE-RESUME
477 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI D-Dialog _DEFAULT-ENABLE
478 PROCEDURE enable_UI :
479 /*------------------------------------------------------------------------------
480 Purpose: ENABLE the User Interface
481 Parameters: <none>
482 Notes: Here we display/view/enable the widgets in the
483 user-interface. In addition, OPEN all queries
484 associated with each FRAME and BROWSE.
485 These statements here are based on the "Other
486 Settings" section of the widget Property Sheets.
487 ------------------------------------------------------------------------------*/
488 DISPLAY default-value
489 WITH FRAME D-Dialog.
490 ENABLE RECT-2 br_Details btn_add btn_remove Btn_OK Btn_Cancel
491 WITH FRAME D-Dialog.
492 VIEW FRAME D-Dialog.
493 {&OPEN-BROWSERS-IN-QUERY-D-Dialog}
494 END PROCEDURE.
496 /* _UIB-CODE-BLOCK-END */
497 &ANALYZE-RESUME
500 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE open-alt-query D-Dialog
501 PROCEDURE open-alt-query :
502 /*------------------------------------------------------------------------------
503 Purpose:
504 ------------------------------------------------------------------------------*/
506 DO WITH FRAME {&FRAME-NAME}:
507 {&OPEN-QUERY-{&BROWSE-NAME}}
508 RUN display-alternate.
509 END.
511 END PROCEDURE.
513 /* _UIB-CODE-BLOCK-END */
514 &ANALYZE-RESUME
517 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE remove-alternate D-Dialog
518 PROCEDURE remove-alternate :
519 /*------------------------------------------------------------------------------
520 Purpose:
521 Parameters: <none>
522 Notes:
523 ------------------------------------------------------------------------------*/
525 DO WITH FRAME {&FRAME-NAME}:
527 IF NUM-RESULTS( "{&BROWSE-NAME}" ) = 0 OR NUM-RESULTS( "{&BROWSE-NAME}" ) = ? THEN RETURN.
529 IF {&BROWSE-NAME}:SELECT-FOCUSED-ROW() AND
530 {&BROWSE-NAME}:FETCH-SELECTED-ROW(1) THEN
532 GET CURRENT {&BROWSE-NAME}.
533 DELETE PersonDetail.
534 IF {&BROWSE-NAME}:DELETE-CURRENT-ROW() THEN.
535 END.
537 IF NUM-RESULTS( "{&BROWSE-NAME}" ) = ? OR
538 NUM-RESULTS( "{&BROWSE-NAME}" ) = 0 THEN
540 RUN close-alt-query.
541 RUN sensitise-buttons.
542 RETURN.
543 END.
545 IF {&BROWSE-NAME}:FETCH-SELECTED-ROW(1) THEN RUN display-alternate.
547 END.
549 END PROCEDURE.
551 /* _UIB-CODE-BLOCK-END */
552 &ANALYZE-RESUME
555 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records D-Dialog _ADM-SEND-RECORDS
556 PROCEDURE send-records :
557 /*------------------------------------------------------------------------------
558 Purpose: Send record ROWID's for all tables used by
559 this file.
560 Parameters: see template/snd-head.i
561 ------------------------------------------------------------------------------*/
563 /* Define variables needed by this internal procedure. */
564 {src/adm/template/snd-head.i}
566 /* For each requested table, put it's ROWID in the output list. */
567 {src/adm/template/snd-list.i "Person"}
568 {src/adm/template/snd-list.i "PersonDetail"}
570 /* Deal with any unexpected table requests before closing. */
571 {src/adm/template/snd-end.i}
573 END PROCEDURE.
575 /* _UIB-CODE-BLOCK-END */
576 &ANALYZE-RESUME
579 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE sensitise-buttons D-Dialog
580 PROCEDURE sensitise-buttons :
581 /*------------------------------------------------------------------------------
582 Purpose:
583 ------------------------------------------------------------------------------*/
585 DO WITH FRAME {&FRAME-NAME}:
586 btn_remove:SENSITIVE = AVAILABLE PersonDetail.
587 END.
589 END PROCEDURE.
591 /* _UIB-CODE-BLOCK-END */
592 &ANALYZE-RESUME
595 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed D-Dialog
596 PROCEDURE state-changed :
597 /* -----------------------------------------------------------
598 Purpose:
599 Parameters: <none>
600 Notes:
601 -------------------------------------------------------------*/
602 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
603 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
604 END PROCEDURE.
606 /* _UIB-CODE-BLOCK-END */
607 &ANALYZE-RESUME