Really, this should be it, for the passing income.
[capital-apms-progress.git] / vwr / mnt / v-chqrep.w
blob3d8dddfab8cbf534d4f7b11b7266283ca83f4634
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI ADM1
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 V-table-Win
8 /*------------------------------------------------------------------------
10 File:
12 Description:
14 ------------------------------------------------------------------------*/
16 CREATE WIDGET-POOL.
18 /* *************************** Definitions ************************** */
20 &SCOPED-DEFINE REPORT-ID "Cheque Reprint"
22 DEF BUFFER ToBank FOR BankAccount.
23 DEF VAR pdf-support AS LOGICAL INIT YES NO-UNDO.
24 DEF VAR pdf-output AS LOGICAL INIT NO NO-UNDO.
26 {inc/ofc-this.i}
28 {inc/method/m-bankimportfile-gen.i}
30 {inc/ofc-set.i "PDF-Output-Directory" "pdf-output-directory"}
31 IF NOT AVAILABLE(OfficeSetting) THEN
32 pdf-support = NO.
34 /* _UIB-CODE-BLOCK-END */
35 &ANALYZE-RESUME
38 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
40 /* ******************** Preprocessor Definitions ******************** */
42 &Scoped-define PROCEDURE-TYPE SmartViewer
43 &Scoped-define DB-AWARE no
45 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
47 /* Name of first Frame and/or Browse and/or first Query */
48 &Scoped-define FRAME-NAME F-Main
50 /* External Tables */
51 &Scoped-define EXTERNAL-TABLES RP
52 &Scoped-define FIRST-EXTERNAL-TABLE RP
55 /* Need to scope the external tables to this procedure */
56 DEFINE QUERY external_tables FOR RP.
57 /* Standard List Definitions */
58 &Scoped-Define ENABLED-FIELDS RP.Int1 RP.Int2 RP.Log4 RP.Log1 RP.Int3 ~
59 RP.Log2 RP.Date1 RP.Char1 RP.Log3 RP.Log7 RP.Char3
60 &Scoped-define ENABLED-TABLES RP
61 &Scoped-define FIRST-ENABLED-TABLE RP
62 &Scoped-Define ENABLED-OBJECTS cmb_bnkact cmb_PaymentStyle cmb_bnkact-2 ~
63 btn-select-file btn_print cbx_pdfoutput RECT-27
64 &Scoped-Define DISPLAYED-FIELDS RP.Int1 RP.Int2 RP.Log4 RP.Log1 RP.Int3 ~
65 RP.Log2 RP.Date1 RP.Char1 RP.Log3 RP.Log7 RP.Char3
66 &Scoped-define DISPLAYED-TABLES RP
67 &Scoped-define FIRST-DISPLAYED-TABLE RP
68 &Scoped-Define DISPLAYED-OBJECTS cmb_bnkact cmb_PaymentStyle cmb_bnkact-2 ~
69 cbx_pdfoutput
71 /* Custom List Definitions */
72 /* ADM-CREATE-FIELDS,ADM-ASSIGN-FIELDS,List-3,List-4,List-5,List-6 */
74 /* _UIB-PREPROCESSOR-BLOCK-END */
75 &ANALYZE-RESUME
79 /* *********************** Control Definitions ********************** */
82 /* Definitions of the field level widgets */
83 DEFINE BUTTON btn-select-file
84 LABEL "Browse"
85 SIZE 7.43 BY 1
86 FONT 9.
88 DEFINE BUTTON btn_print DEFAULT
89 LABEL "&OK"
90 SIZE 9.43 BY .9
91 FONT 9.
93 DEFINE VARIABLE cbx_pdfoutput AS LOGICAL INITIAL no
94 LABEL "PDF remittance"
95 VIEW-AS TOGGLE-BOX
96 SIZE 14 BY .8 TOOLTIP "Generate the remittance advice from this cheque batch in PDF format" NO-UNDO.
98 DEFINE VARIABLE cmb_bnkact AS CHARACTER FORMAT "X(256)":U
99 VIEW-AS COMBO-BOX INNER-LINES 5
100 DROP-DOWN-LIST
101 SIZE 51 BY 1 NO-UNDO.
103 DEFINE VARIABLE cmb_bnkact-2 AS CHARACTER FORMAT "X(256)":U
104 VIEW-AS COMBO-BOX INNER-LINES 5
105 DROP-DOWN-LIST
106 SIZE 51 BY 1 NO-UNDO.
108 DEFINE VARIABLE cmb_PaymentStyle AS CHARACTER FORMAT "X(256)":U
109 VIEW-AS COMBO-BOX INNER-LINES 15
110 DROP-DOWN-LIST
111 SIZE 44.57 BY 1 NO-UNDO.
113 DEFINE RECTANGLE RECT-27
114 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
115 SIZE 65.72 BY 18.
118 /* ************************ Frame Definitions *********************** */
120 DEFINE FRAME F-Main
121 cmb_bnkact AT ROW 1.1 COL 15 NO-LABEL
122 RP.Int1 AT ROW 2.4 COL 13.29 COLON-ALIGNED NO-LABEL FORMAT "999999"
123 VIEW-AS FILL-IN
124 SIZE 7 BY 1
125 RP.Int2 AT ROW 2.4 COL 22.72 COLON-ALIGNED NO-LABEL FORMAT "999999"
126 VIEW-AS FILL-IN
127 SIZE 7 BY 1
128 RP.Log4 AT ROW 3.7 COL 4.29 HELP
129 "" NO-LABEL
130 VIEW-AS RADIO-SET VERTICAL
131 RADIO-BUTTONS
132 "One Payment Style", no,
133 "Force Payment by", yes
134 SIZE 16.57 BY 1.6
135 cmb_PaymentStyle AT ROW 4.05 COL 19.43 COLON-ALIGNED NO-LABEL
136 RP.Log1 AT ROW 5.55 COL 2.14 HELP
138 LABEL "Renumber cheques into new range starting at"
139 VIEW-AS TOGGLE-BOX
140 SIZE 33.86 BY .8
141 FONT 10
142 RP.Int3 AT ROW 5.55 COL 33.86 COLON-ALIGNED HELP
143 "" NO-LABEL FORMAT "999999"
144 VIEW-AS FILL-IN
145 SIZE 7.57 BY 1
146 cmb_bnkact-2 AT ROW 6.65 COL 15 NO-LABEL
147 RP.Log2 AT ROW 8.75 COL 2.14 HELP
149 LABEL "Change cheque dates to"
150 VIEW-AS TOGGLE-BOX
151 SIZE 20 BY 1
152 FONT 10
153 RP.Date1 AT ROW 8.75 COL 20.72 COLON-ALIGNED HELP
154 "" NO-LABEL FORMAT "99/99/9999"
155 VIEW-AS FILL-IN
156 SIZE 11.57 BY 1
157 RP.Char1 AT ROW 10.15 COL 15 NO-LABEL
158 VIEW-AS EDITOR NO-WORD-WRAP SCROLLBAR-VERTICAL
159 SIZE 51.14 BY 4.05
160 RP.Log3 AT ROW 14.25 COL 2.43 HELP
162 LABEL "Re-print the cheques while renumbering them"
163 VIEW-AS TOGGLE-BOX
164 SIZE 38.29 BY .8
165 RP.Log7 AT ROW 15.5 COL 4.57 HELP
167 LABEL "Generate Bank Import File"
168 VIEW-AS TOGGLE-BOX
169 SIZE 21.43 BY .8
170 RP.Char3 AT ROW 16.4 COL 10 COLON-ALIGNED HELP
172 LABEL "Directory" FORMAT "X(120)"
173 VIEW-AS FILL-IN
174 SIZE 46.29 BY 1
175 btn-select-file AT ROW 16.4 COL 58.72
176 btn_print AT ROW 17.75 COL 56.86
177 cbx_pdfoutput AT ROW 17.95 COL 42.86
178 RECT-27 AT ROW 1 COL 1
179 "To Bank A/C:" VIEW-AS TEXT
180 SIZE 9.72 BY .8 AT ROW 6.75 COL 4.43
181 FONT 10
182 "to" VIEW-AS TEXT
183 SIZE 1.72 BY 1 AT ROW 2.4 COL 22.43
184 FONT 10
185 "Message Text:" VIEW-AS TEXT
186 SIZE 10.57 BY 1 AT ROW 10 COL 4.14
187 FONT 10
188 "From Bank A/C:" VIEW-AS TEXT
189 SIZE 11.57 BY .9 AT ROW 1.2 COL 3.29
190 FONT 10
191 "Reprint Cheques" VIEW-AS TEXT
192 SIZE 12 BY 1 AT ROW 2.5 COL 2.57
193 FONT 10
194 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
195 SIDE-LABELS NO-UNDERLINE THREE-D
196 AT COL 1 ROW 1 SCROLLABLE
197 FONT 10
198 DEFAULT-BUTTON btn_print.
201 /* *********************** Procedure Settings ************************ */
203 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
204 /* Settings for THIS-PROCEDURE
205 Type: SmartViewer
206 External Tables: TTPL.RP
207 Allow: Basic,DB-Fields
208 Frames: 1
209 Add Fields to: EXTERNAL-TABLES
210 Other Settings: PERSISTENT-ONLY COMPILE
213 /* This procedure should always be RUN PERSISTENT. Report the error, */
214 /* then cleanup and return. */
215 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
216 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT.":U
217 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
218 RETURN.
219 END.
221 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
223 /* ************************* Create Window ************************** */
225 &ANALYZE-SUSPEND _CREATE-WINDOW
226 /* DESIGN Window definition (used by the UIB)
227 CREATE WINDOW V-table-Win ASSIGN
228 HEIGHT = 23.75
229 WIDTH = 77.43.
230 /* END WINDOW DEFINITION */
232 &ANALYZE-RESUME
234 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
235 /* ************************* Included-Libraries *********************** */
237 {src/adm/method/viewer.i}
238 {inc/method/m-mntvwr.i}
240 /* _UIB-CODE-BLOCK-END */
241 &ANALYZE-RESUME
246 /* *********** Runtime Attributes and AppBuilder Settings *********** */
248 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
249 /* SETTINGS FOR WINDOW V-table-Win
250 VISIBLE,,RUN-PERSISTENT */
251 /* SETTINGS FOR FRAME F-Main
252 NOT-VISIBLE Size-to-Fit */
253 ASSIGN
254 FRAME F-Main:SCROLLABLE = FALSE
255 FRAME F-Main:HIDDEN = TRUE.
257 /* SETTINGS FOR FILL-IN RP.Char3 IN FRAME F-Main
258 EXP-LABEL EXP-FORMAT EXP-HELP */
259 /* SETTINGS FOR COMBO-BOX cmb_bnkact IN FRAME F-Main
260 ALIGN-L */
261 /* SETTINGS FOR COMBO-BOX cmb_bnkact-2 IN FRAME F-Main
262 ALIGN-L */
263 /* SETTINGS FOR FILL-IN RP.Date1 IN FRAME F-Main
264 EXP-LABEL EXP-FORMAT EXP-HELP */
265 /* SETTINGS FOR FILL-IN RP.Int1 IN FRAME F-Main
266 EXP-LABEL EXP-FORMAT */
267 /* SETTINGS FOR FILL-IN RP.Int2 IN FRAME F-Main
268 EXP-LABEL EXP-FORMAT */
269 /* SETTINGS FOR FILL-IN RP.Int3 IN FRAME F-Main
270 EXP-LABEL EXP-FORMAT EXP-HELP */
271 /* SETTINGS FOR TOGGLE-BOX RP.Log1 IN FRAME F-Main
272 EXP-LABEL EXP-HELP */
273 /* SETTINGS FOR TOGGLE-BOX RP.Log2 IN FRAME F-Main
274 EXP-LABEL EXP-HELP */
275 /* SETTINGS FOR TOGGLE-BOX RP.Log3 IN FRAME F-Main
276 EXP-LABEL EXP-HELP */
277 /* SETTINGS FOR RADIO-SET RP.Log4 IN FRAME F-Main
278 EXP-HELP */
279 /* SETTINGS FOR TOGGLE-BOX RP.Log7 IN FRAME F-Main
280 EXP-LABEL EXP-HELP */
281 /* _RUN-TIME-ATTRIBUTES-END */
282 &ANALYZE-RESUME
285 /* Setting information for Queries and Browse Widgets fields */
287 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
288 /* Query rebuild information for FRAME F-Main
289 _Options = "NO-LOCK"
290 _Query is NOT OPENED
291 */ /* FRAME F-Main */
292 &ANALYZE-RESUME
298 /* ************************ Control Triggers ************************ */
300 &Scoped-define SELF-NAME btn-select-file
301 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn-select-file V-table-Win
302 ON CHOOSE OF btn-select-file IN FRAME F-Main /* Browse */
304 RUN select-file-dialog.
305 END.
307 /* _UIB-CODE-BLOCK-END */
308 &ANALYZE-RESUME
311 &Scoped-define SELF-NAME btn_print
312 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_print V-table-Win
313 ON CHOOSE OF btn_print IN FRAME F-Main /* OK */
315 RUN notify( 'set-busy, CONTAINER-SOURCE':U ).
316 RUN renumber-cheque-range.
317 RUN notify( 'set-idle, CONTAINER-SOURCE':U ).
318 END.
320 /* _UIB-CODE-BLOCK-END */
321 &ANALYZE-RESUME
324 &Scoped-define SELF-NAME cbx_pdfoutput
325 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cbx_pdfoutput V-table-Win
326 ON VALUE-CHANGED OF cbx_pdfoutput IN FRAME F-Main /* OK */
328 DO WITH FRAME {&FRAME-NAME}:
329 pdf-output = cbx_pdfoutput:CHECKED IN FRAME {&FRAME-NAME}.
330 END.
331 END.
333 /* _UIB-CODE-BLOCK-END */
334 &ANALYZE-RESUME
337 &Scoped-define SELF-NAME RP.Char3
338 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char3 V-table-Win
339 ON LEAVE OF RP.Char3 IN FRAME F-Main /* Directory */
341 RP.Char3 = SUBSTRING( INPUT RP.Char3, 1, R-INDEX(INPUT RP.Char3, "\" ) ).
343 DISPLAY RP.Char3.
344 END.
346 /* _UIB-CODE-BLOCK-END */
347 &ANALYZE-RESUME
350 &Scoped-define SELF-NAME cmb_bnkact
351 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_bnkact V-table-Win
352 ON U1 OF cmb_bnkact IN FRAME F-Main
354 {inc/selcmb/scbnk1.i "RP" "Char2"}
355 END.
357 /* _UIB-CODE-BLOCK-END */
358 &ANALYZE-RESUME
361 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_bnkact V-table-Win
362 ON U2 OF cmb_bnkact IN FRAME F-Main
364 {inc/selcmb/scbnk2.i "RP" "Char2"}
365 END.
367 /* _UIB-CODE-BLOCK-END */
368 &ANALYZE-RESUME
371 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_bnkact V-table-Win
372 ON VALUE-CHANGED OF cmb_bnkact IN FRAME F-Main
374 /* Display Import File Generation option? */
375 RUN enable-import-file-gen.
376 END.
378 /* _UIB-CODE-BLOCK-END */
379 &ANALYZE-RESUME
382 &Scoped-define SELF-NAME cmb_bnkact-2
383 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_bnkact-2 V-table-Win
384 ON U1 OF cmb_bnkact-2 IN FRAME F-Main
386 {inc/selcmb/scchq1.i "RP" "Char3"}
387 END.
389 /* _UIB-CODE-BLOCK-END */
390 &ANALYZE-RESUME
393 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_bnkact-2 V-table-Win
394 ON U2 OF cmb_bnkact-2 IN FRAME F-Main
396 {inc/selcmb/scchq2.i "RP" "Char3"}
397 END.
399 /* _UIB-CODE-BLOCK-END */
400 &ANALYZE-RESUME
403 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_bnkact-2 V-table-Win
404 ON VALUE-CHANGED OF cmb_bnkact-2 IN FRAME F-Main
406 /* Display Import File Generation option? */
407 RUN enable-import-file-gen.
408 END.
410 /* _UIB-CODE-BLOCK-END */
411 &ANALYZE-RESUME
414 &Scoped-define SELF-NAME cmb_PaymentStyle
415 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_PaymentStyle V-table-Win
416 ON U1 OF cmb_PaymentStyle IN FRAME F-Main
418 {inc/selcmb/scpsty1.i "RP" "Char6"}
420 /* Display Import File Generation option? */
421 RUN enable-import-file-gen.
422 END.
424 /* _UIB-CODE-BLOCK-END */
425 &ANALYZE-RESUME
428 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_PaymentStyle V-table-Win
429 ON U2 OF cmb_PaymentStyle IN FRAME F-Main
431 {inc/selcmb/scpsty2.i "RP" "Char6"}
432 END.
434 /* _UIB-CODE-BLOCK-END */
435 &ANALYZE-RESUME
438 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_PaymentStyle V-table-Win
439 ON VALUE-CHANGED OF cmb_PaymentStyle IN FRAME F-Main
441 /* Display Import File Generation option? */
442 RUN enable-import-file-gen.
443 END.
445 /* _UIB-CODE-BLOCK-END */
446 &ANALYZE-RESUME
449 &Scoped-define SELF-NAME RP.Int1
450 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int1 V-table-Win
451 ON LEAVE OF RP.Int1 IN FRAME F-Main /* Int1 */
453 DO WITH FRAME {&FRAME-NAME}:
454 IF INPUT RP.Int2 < INPUT RP.Int1 AND INPUT RP.Int1 <> RP.Int1 THEN DO:
455 RP.Int2:SCREEN-VALUE = STRING( INPUT RP.Int1, "999999").
456 END.
457 END.
458 END.
460 /* _UIB-CODE-BLOCK-END */
461 &ANALYZE-RESUME
464 &Scoped-define SELF-NAME RP.Log1
465 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log1 V-table-Win
466 ON VALUE-CHANGED OF RP.Log1 IN FRAME F-Main /* Renumber cheques into new range starting at */
468 RUN renumber-changed.
470 /* Display Import File Generation option? */
471 RUN enable-import-file-gen.
472 END.
474 /* _UIB-CODE-BLOCK-END */
475 &ANALYZE-RESUME
478 &Scoped-define SELF-NAME RP.Log2
479 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log2 V-table-Win
480 ON VALUE-CHANGED OF RP.Log2 IN FRAME F-Main /* Change cheque dates to */
482 RUN redate-changed.
483 END.
485 /* _UIB-CODE-BLOCK-END */
486 &ANALYZE-RESUME
489 &Scoped-define SELF-NAME RP.Log3
490 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log3 V-table-Win
491 ON VALUE-CHANGED OF RP.Log3 IN FRAME F-Main /* Re-print the cheques while renumbering them */
493 /* Display Import File Generation option? */
494 RUN enable-import-file-gen.
495 END.
497 /* _UIB-CODE-BLOCK-END */
498 &ANALYZE-RESUME
501 &Scoped-define SELF-NAME RP.Log4
502 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log4 V-table-Win
503 ON VALUE-CHANGED OF RP.Log4 IN FRAME F-Main /* Log4 */
505 RUN enable-import-file-gen.
506 END.
508 /* _UIB-CODE-BLOCK-END */
509 &ANALYZE-RESUME
512 &Scoped-define SELF-NAME RP.Log7
513 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log7 V-table-Win
514 ON VALUE-CHANGED OF RP.Log7 IN FRAME F-Main /* Generate Bank Import File */
516 /* Display Import File Generation option? */
517 RUN enable-import-file-gen.
518 END.
520 /* _UIB-CODE-BLOCK-END */
521 &ANALYZE-RESUME
524 &UNDEFINE SELF-NAME
526 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
529 /* *************************** Main Block *************************** */
531 IF NOT pdf-support THEN DO:
532 cbx_pdfoutput:VISIBLE IN FRAME {&FRAME-NAME} = NO.
533 END.
535 /* _UIB-CODE-BLOCK-END */
536 &ANALYZE-RESUME
539 /* ********************** Internal Procedures *********************** */
541 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
542 PROCEDURE adm-row-available :
543 /*------------------------------------------------------------------------------
544 Purpose: Dispatched to this procedure when the Record-
545 Source has a new row available. This procedure
546 tries to get the new row (or foriegn keys) from
547 the Record-Source and process it.
548 Parameters: <none>
549 ------------------------------------------------------------------------------*/
551 /* Define variables needed by this internal procedure. */
552 {src/adm/template/row-head.i}
554 /* Create a list of all the tables that we need to get. */
555 {src/adm/template/row-list.i "RP"}
557 /* Get the record ROWID's from the RECORD-SOURCE. */
558 {src/adm/template/row-get.i}
560 /* FIND each record specified by the RECORD-SOURCE. */
561 {src/adm/template/row-find.i "RP"}
563 /* Process the newly available records (i.e. display fields,
564 open queries, and/or pass records on to any RECORD-TARGETS). */
565 {src/adm/template/row-end.i}
567 END PROCEDURE.
569 /* _UIB-CODE-BLOCK-END */
570 &ANALYZE-RESUME
572 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
573 PROCEDURE disable_UI :
574 /*------------------------------------------------------------------------------
575 Purpose: DISABLE the User Interface
576 Parameters: <none>
577 Notes: Here we clean-up the user-interface by deleting
578 dynamic widgets we have created and/or hide
579 frames. This procedure is usually called when
580 we are ready to "clean-up" after running.
581 ------------------------------------------------------------------------------*/
582 /* Hide all frames. */
583 HIDE FRAME F-Main.
584 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
585 END PROCEDURE.
587 /* _UIB-CODE-BLOCK-END */
588 &ANALYZE-RESUME
590 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-import-file-gen V-table-Win
591 PROCEDURE enable-import-file-gen :
592 /*------------------------------------------------------------------------------
593 Purpose:
594 Parameters: <none>
595 Notes:
596 ------------------------------------------------------------------------------*/
597 /* Display Import File Generation option? */
598 /* Payer Bank Account */
599 DEFINE VARIABLE item-idx AS INTEGER INITIAL 0 NO-UNDO.
600 DEFINE VARIABLE v-bankaccount LIKE BankAccount.BankAccount INITIAL 0 NO-UNDO.
601 DEFINE VARIABLE v-bank AS INTEGER INITIAL 0 NO-UNDO.
602 DEFINE VARIABLE v-branch AS INTEGER INITIAL 0 NO-UNDO.
603 DEFINE VARIABLE v-account AS INTEGER INITIAL 0 NO-UNDO.
604 DEFINE VARIABLE v-suffix AS INTEGER INITIAL 0 NO-UNDO.
605 /* Payment Style */
606 DEFINE VARIABLE v-allorone-payment-style AS CHARACTER INITIAL '' NO-UNDO.
607 DEFINE VARIABLE v-payment-style AS CHARACTER INITIAL '' NO-UNDO.
609 DO WITH FRAME {&FRAME-NAME}:
610 FIND CURRENT RP SHARE-LOCK NO-ERROR.
612 IF INPUT RP.Log3 THEN DO:
613 /* Check Payer Bank Account */
614 IF INPUT RP.Log1 THEN DO:
615 item-idx = cmb_bnkact-2:LOOKUP( INPUT cmb_bnkact-2 ).
616 IF item-idx > 0 THEN
617 FIND BankAccount WHERE ROWID( BankAccount ) =
618 TO-ROWID( ENTRY( item-idx, cmb_bnkact-2:PRIVATE-DATA ) ) NO-LOCK NO-ERROR.
619 END.
620 IF NOT INPUT RP.Log1 THEN DO:
621 item-idx = cmb_bnkact:LOOKUP( INPUT cmb_bnkact ).
622 IF item-idx > 0 THEN
623 FIND BankAccount WHERE ROWID( BankAccount ) =
624 TO-ROWID( ENTRY( item-idx, cmb_bnkact:PRIVATE-DATA ) ) NO-LOCK NO-ERROR.
625 END.
627 IF AVAILABLE BankAccount THEN DO:
628 RUN get-bankbranchaccountsuffix (
629 BankAccount.BankAccount,
630 OUTPUT v-bank,
631 OUTPUT v-branch,
632 OUTPUT v-account,
633 OUTPUT v-suffix
635 /* IF RETURN-VALUE = "FAIL" THEN RETURN "FAIL". */
636 END.
638 IF v-bank = 3 THEN DO:
639 item-idx = cmb_PaymentStyle:LOOKUP( INPUT cmb_PaymentStyle ).
640 IF item-idx > 0 THEN
641 FIND PaymentStyle WHERE ROWID( PaymentStyle ) =
642 TO-ROWID( ENTRY( item-idx, cmb_PaymentStyle:PRIVATE-DATA ) ) NO-LOCK NO-ERROR.
644 IF NOT AVAILABLE PaymentStyle OR PaymentStyle.PaymentStyle <> 'DD ' THEN DO:
645 RP.Log7 = No. DISPLAY RP.Log7.
646 HIDE RP.Log7 RP.Char3 btn-select-file.
647 END.
648 ELSE DO:
649 VIEW RP.Log7. ENABLE RP.LOG7.
650 IF INPUT RP.Log7 THEN DO:
651 VIEW RP.Char3 btn-select-file. ENABLE RP.Char3 btn-select-file.
652 END.
653 ELSE HIDE RP.Char3 btn-select-file.
654 END.
655 END.
656 ELSE DO:
657 RP.Log7 = NO. DISPLAY RP.Log7.
658 HIDE RP.Log7 RP.Char3 btn-select-file.
659 END.
660 END.
661 ELSE DO:
662 RP.Log7 = NO. DISPLAY RP.Log7.
663 HIDE RP.Log7 RP.Char3 btn-select-file.
664 END.
666 END.
668 END PROCEDURE.
670 /* _UIB-CODE-BLOCK-END */
671 &ANALYZE-RESUME
673 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-from-bank-account V-table-Win
674 PROCEDURE get-from-bank-account :
675 /*------------------------------------------------------------------------------
676 Purpose:
677 ------------------------------------------------------------------------------*/
679 DO WITH FRAME {&FRAME-NAME}:
681 DEF VAR item-idx AS INT NO-UNDO.
683 item-idx = cmb_bnkact:LOOKUP( INPUT cmb_bnkact ).
684 IF item-idx = 0 THEN RETURN.
686 FIND BankAccount WHERE ROWID( BankAccount ) =
687 TO-ROWID( ENTRY( item-idx, cmb_bnkact:PRIVATE-DATA ) ) NO-LOCK.
689 END.
691 END PROCEDURE.
693 /* _UIB-CODE-BLOCK-END */
694 &ANALYZE-RESUME
696 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-to-bank-account V-table-Win
697 PROCEDURE get-to-bank-account :
698 /*------------------------------------------------------------------------------
699 Purpose:
700 ------------------------------------------------------------------------------*/
702 DO WITH FRAME {&FRAME-NAME}:
704 DEF VAR item-idx AS INT NO-UNDO.
706 item-idx = cmb_bnkact-2:LOOKUP( INPUT cmb_bnkact-2 ).
707 IF item-idx = 0 THEN RETURN.
709 FIND ToBank WHERE ROWID( ToBank ) =
710 TO-ROWID( ENTRY( item-idx, cmb_bnkact-2:PRIVATE-DATA ) ) NO-LOCK.
712 END.
714 END PROCEDURE.
716 /* _UIB-CODE-BLOCK-END */
717 &ANALYZE-RESUME
719 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
720 PROCEDURE inst-enable-fields :
721 /*------------------------------------------------------------------------------
722 Purpose:
723 Parameters: <none>
724 Notes:
725 ------------------------------------------------------------------------------*/
727 RUN renumber-changed.
728 RUN redate-changed.
730 END PROCEDURE.
732 /* _UIB-CODE-BLOCK-END */
733 &ANALYZE-RESUME
735 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
736 PROCEDURE inst-initialize :
737 /*------------------------------------------------------------------------------
738 Purpose:
739 Parameters: <none>
740 Notes:
741 ------------------------------------------------------------------------------*/
743 DEF VAR user-name AS CHAR NO-UNDO.
745 RUN get-username IN sys-mgr( OUTPUT user-name ).
747 FIND RP WHERE
748 RP.UserName = user-name AND
749 RP.ReportID = {&REPORT-ID} NO-ERROR.
751 IF NOT AVAILABLE RP THEN DO:
753 CREATE RP.
754 ASSIGN
755 RP.ReportID = {&REPORT-ID}
756 RP.UserName = user-name
757 RP.Date1 = TODAY.
759 {inc/ofc-this.i}
760 RP.Char1 = "Please forward all invoices to:~n" + Office.StreetAddress .
762 END.
764 /* RUN update-bank-accounts. */
765 RUN dispatch( 'display-fields':U ).
766 RUN dispatch( 'enable-fields':U ).
767 RUN enable-import-file-gen.
769 END PROCEDURE.
771 /* _UIB-CODE-BLOCK-END */
772 &ANALYZE-RESUME
774 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
775 PROCEDURE pre-destroy :
776 /*------------------------------------------------------------------------------
777 Purpose:
778 Parameters: <none>
779 Notes:
780 ------------------------------------------------------------------------------*/
782 RUN check-modified( "CLEAR" ).
784 END PROCEDURE.
786 /* _UIB-CODE-BLOCK-END */
787 &ANALYZE-RESUME
789 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE redate-changed V-table-Win
790 PROCEDURE redate-changed :
791 /*------------------------------------------------------------------------------
792 Purpose:
793 Parameters: <none>
794 Notes:
795 ------------------------------------------------------------------------------*/
797 RP.Date1:SENSITIVE IN FRAME {&FRAME-NAME} =
798 INPUT FRAME {&FRAME-NAME} RP.Log2 = "Yes".
800 END PROCEDURE.
802 /* _UIB-CODE-BLOCK-END */
803 &ANALYZE-RESUME
805 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE renumber-changed V-table-Win
806 PROCEDURE renumber-changed :
807 /*------------------------------------------------------------------------------
808 Purpose:
809 ------------------------------------------------------------------------------*/
810 DO WITH FRAME {&FRAME-NAME} :
811 RP.Int3:SENSITIVE = INPUT RP.Log1 = "Yes".
813 IF INPUT RP.Log1 THEN
814 VIEW cmb_bnkact-2.
815 ELSE
816 HIDE cmb_bnkact-2.
817 END.
818 END PROCEDURE.
820 /* _UIB-CODE-BLOCK-END */
821 &ANALYZE-RESUME
823 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE renumber-cheque-range V-table-Win
824 PROCEDURE renumber-cheque-range :
825 /*------------------------------------------------------------------------------
826 Purpose:
827 ------------------------------------------------------------------------------*/
828 DEF VAR report-options AS CHAR NO-UNDO.
829 DEF VAR i AS INT NO-UNDO.
830 DEF VAR n-cheques AS INT NO-UNDO INITIAL 0.
831 DEF VAR change-no AS LOGI NO-UNDO.
832 DEF VAR change-acct AS LOGI NO-UNDO.
833 DEF VAR msg AS CHAR NO-UNDO.
834 DEF VAR start-printing AS LOGI NO-UNDO INIT No.
836 DEFINE VARIABLE item-idx AS INTEGER INITIAL 0 NO-UNDO.
838 DO WITH FRAME {&FRAME-NAME}:
839 item-idx = cmb_PaymentStyle:LOOKUP( INPUT cmb_PaymentStyle ).
840 IF item-idx > 0 THEN
841 FIND PaymentStyle WHERE ROWID( PaymentStyle ) =
842 TO-ROWID( ENTRY( item-idx, cmb_PaymentStyle:PRIVATE-DATA ) ) NO-LOCK NO-ERROR.
844 IF AVAILABLE PaymentStyle THEN DO:
845 FIND CURRENT RP SHARE-LOCK.
846 RP.Char6 = PaymentStyle.PaymentStyle.
847 END.
848 END.
850 RUN verify-run.
851 IF RETURN-VALUE = "FAIL" THEN RETURN.
852 RUN dispatch( 'update-record':U ).
854 DEF VAR f1 AS INT NO-UNDO.
855 DEF VAR f2 AS INT NO-UNDO.
856 DEF VAR t1 AS INT NO-UNDO.
857 DEF VAR t2 AS INT NO-UNDO.
858 DEF VAR upwards AS LOGI NO-UNDO INITIAL Yes.
859 DEF VAR offset AS INT INIT 0 NO-UNDO.
860 f1 = RP.Int1.
861 f2 = RP.Int2.
862 t1 = RP.Int3.
863 t2 = t1 + f2 - f1.
864 offset = t1 - f1.
866 IF t1 >= f1 AND t1 <= f2 THEN upwards = No.
868 change-no = RP.Log1 AND f1 <> t1.
869 change-acct = RP.Log1 AND (BankAccount.BankAccountCode <> ToBank.BankAccountCode).
870 IF RP.Log3 THEN DO:
871 /* Count the cheques */
872 /* Check Voucher.PaymentStyle of cheque against Forced Payment Style
873 IF Forced Payment Style = 'DD' AND Creditor.EnableDirectPayment
874 OR Voucher.PaymentStyle = PaymentStyle selected
875 then cheque will be printed */
876 IF INPUT RP.Log4 THEN DO: /* If Force PaymentStyle */
877 IF TRIM(RP.Char6) = 'DD' THEN DO:
878 FOR EACH Cheque WHERE Cheque.BankAccountCode = BankAccount.BankAccountCode
879 AND Cheque.ChequeNo >= f1 AND Cheque.ChequeNo <= f2
880 AND NOT Cheque.Cancelled NO-LOCK:
882 IF CAN-FIND(FIRST Creditor
883 WHERE Creditor.CreditorCode = Cheque.CreditorCode
884 AND Creditor.EnableDirectPayment) THEN n-cheques = n-cheques + 1.
885 END.
886 END.
887 ELSE DO:
888 FOR EACH Cheque WHERE Cheque.BankAccountCode = BankAccount.BankAccountCode
889 AND Cheque.ChequeNo >= f1 AND Cheque.ChequeNo <= f2
890 AND NOT Cheque.Cancelled NO-LOCK:
892 n-cheques = n-cheques + 1.
893 END.
894 END.
895 END.
896 ELSE DO: /* Else check Voucher.PaymentStyle and BankImport */
897 FOR EACH Cheque WHERE Cheque.BankAccountCode = BankAccount.BankAccountCode
898 AND Cheque.ChequeNo >= f1 AND Cheque.ChequeNo <= f2
899 AND NOT Cheque.Cancelled NO-LOCK:
901 FIND FIRST Voucher WHERE Voucher.BankAccountCode = Cheque.BankAccountCode
902 AND Voucher.ChequeNo = Cheque.ChequeNo NO-LOCK NO-ERROR.
904 IF AVAILABLE Voucher THEN DO:
905 IF Voucher.PaymentStyle = RP.Char6 THEN n-cheques = n-cheques + 1.
906 END.
907 END.
908 END.
909 msg = "There are " + STRING( n-cheques ) + " cheques to printed~n" +
910 "Start printing Now ?~n~n~n" +
911 "The printer will wait for you to insert cheque paper.".
912 END.
914 IF change-no OR change-acct OR RP.Log2 OR RP.Log4 THEN
915 modify-cheques:
916 DO /*TRANSACTION */ ON ERROR UNDO modify-cheques, RETURN "FAIL":
918 DEF VAR cheque-no AS INT NO-UNDO.
920 IF upwards THEN
921 FIND FIRST Cheque EXCLUSIVE-LOCK WHERE Cheque.BankAccountCode = BankAccount.BankAccountCode
922 AND Cheque.ChequeNo >= f1 AND Cheque.ChequeNo <= f2 NO-ERROR.
923 ELSE
924 FIND LAST Cheque EXCLUSIVE-LOCK WHERE Cheque.BankAccountCode = BankAccount.BankAccountCode
925 AND Cheque.ChequeNo >= f1 AND Cheque.ChequeNo <= f2 NO-ERROR.
927 DO WHILE AVAILABLE(Cheque):
928 IF RP.Log1 THEN DO:
929 cheque-no = Cheque.ChequeNo + offset.
930 FOR EACH Voucher WHERE Voucher.BankAccountCode = Cheque.BankAccountCode
931 AND Voucher.ChequeNo = Cheque.ChequeNo EXCLUSIVE-LOCK:
932 IF change-no THEN Voucher.ChequeNo = cheque-no.
933 IF change-acct THEN Voucher.BankAccountCode = ToBank.BankAccountCode.
934 END.
935 IF change-no THEN Cheque.ChequeNo = cheque-no.
936 IF change-acct THEN Cheque.BankAccountCode = ToBank.BankAccountCode.
937 END.
938 IF RP.Log2 THEN Cheque.Date = RP.Date1.
939 IF upwards THEN
940 FIND NEXT Cheque EXCLUSIVE-LOCK WHERE Cheque.BankAccountCode = BankAccount.BankAccountCode
941 AND Cheque.ChequeNo >= f1 AND Cheque.ChequeNo <= f2 NO-ERROR.
942 ELSE
943 FIND PREV Cheque EXCLUSIVE-LOCK WHERE Cheque.BankAccountCode = BankAccount.BankAccountCode
944 AND Cheque.ChequeNo >= f1 AND Cheque.ChequeNo <= f2 NO-ERROR.
945 END.
947 /* IF Forced Payment Style option set then go through vouchers for each cheque
948 in the range specified and update paymentstyle */
949 IF RP.Log4 AND LENGTH(RP.Char6) > 0 THEN DO:
950 FIND FIRST Cheque EXCLUSIVE-LOCK WHERE Cheque.BankAccountCode = BankAccount.BankAccountCode
951 AND Cheque.ChequeNo >= f1 AND Cheque.ChequeNo <= f2 NO-ERROR.
953 DO WHILE AVAILABLE(Cheque):
954 /* IF ForcedPaymentStyle */
955 IF RP.Log4 THEN DO:
956 /* IF forced-style 'DD'
957 THEN only alter Voucher.PaymentStyle if Creditor.EnableDirectPayment */
958 IF TRIM(RP.Char6) = 'DD' THEN DO:
959 IF CAN-FIND(FIRST Creditor
960 WHERE Creditor.CreditorCode = Cheque.CreditorCode
961 AND Creditor.EnableDirectPayment) THEN DO:
962 FOR EACH Voucher WHERE Voucher.BankAccountCode = Cheque.BankAccountCode
963 AND Voucher.ChequeNo = Cheque.ChequeNo EXCLUSIVE-LOCK:
964 Voucher.PaymentStyle = RP.Char6.
965 END.
966 END.
967 END.
968 ELSE DO:
969 FOR EACH Voucher WHERE Voucher.BankAccountCode = Cheque.BankAccountCode
970 AND Voucher.ChequeNo = Cheque.ChequeNo EXCLUSIVE-LOCK:
971 Voucher.PaymentStyle = RP.Char6.
972 END.
973 END.
974 END.
975 FIND NEXT Cheque EXCLUSIVE-LOCK WHERE Cheque.BankAccountCode = BankAccount.BankAccountCode
976 AND Cheque.ChequeNo >= f1 AND Cheque.ChequeNo <= f2 NO-ERROR.
977 END.
978 END.
980 IF RP.Log3 THEN DO:
981 MESSAGE msg VIEW-AS ALERT-BOX QUESTION BUTTONS YES-NO
982 TITLE "Start Printing ?" UPDATE start-printing.
984 IF NOT start-printing THEN UNDO modify-cheques, RETURN "FAIL".
985 END.
987 END.
988 ELSE IF RP.Log3 THEN DO:
989 MESSAGE msg VIEW-AS ALERT-BOX QUESTION BUTTONS YES-NO
990 TITLE "Start Printing ?" UPDATE start-printing.
991 IF NOT start-printing THEN RETURN.
992 END.
994 IF (change-acct OR change-no OR RP.Log2) AND NOT RP.Log3 THEN DO:
995 msg = "".
996 IF change-acct THEN
997 msg = "moved from Bank '" + BankAccount.BankAccountCode + "' to '" + ToBank.BankAccountCode + "'".
998 IF change-no THEN
999 msg = msg + (IF msg <> "" THEN ",~n" ELSE "") + "renumbered by " + STRING(offset) + " (" + STRING(f1) + " becomes " + STRING(t1) + " and so on)".
1000 IF RP.Log2 THEN
1001 msg = msg + (IF msg <> "" THEN "~nand " ELSE "") + "dated " + STRING(RP.Date1,"99/99/9999").
1002 MESSAGE "Cheques" msg VIEW-AS ALERT-BOX INFORMATION TITLE "Cheques Modified".
1003 END.
1004 ELSE DO:
1005 /* paymentstyle option -> both forced-paymentstyle and payment style should be reduced to
1006 PaymentStyle and passed to chqprt which should then honour payment style
1007 so cheques where voucher.paymentstyle = 'DD' won't get printed
1008 and if exporting BankImportFile
1009 cheques where voucher.paymentstyle <> 'DD' won't get printed */
1010 report-options = "BankAccount," + (IF AVAILABLE(ToBank) THEN ToBank.BankAccountCode ELSE BankAccount.BankAccountCode)
1011 + "~nChequeRange," + STRING(IF RP.Log1 THEN RP.Int3 ELSE RP.Int1)
1012 + "," + STRING(IF RP.Log1 THEN RP.Int3 + ( RP.Int2 - RP.Int1 ) ELSE RP.Int2)
1013 + "~nMessage," + REPLACE( RP.Char1, "~n", CHR(7))
1014 + "~nPaymentStyle," + RP.Char6.
1016 IF RP.Log7 AND LENGTH(RP.Char3) > 0 THEN
1017 report-options = report-options + "~nWriteBankImportFileTo," + RP.Char3.
1019 IF pdf-output THEN
1020 report-options = report-options + "~nOutputPDF".
1022 RUN process/report/chqprt.p( report-options ).
1024 END.
1026 END PROCEDURE.
1028 /* _UIB-CODE-BLOCK-END */
1029 &ANALYZE-RESUME
1031 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE select-file-dialog V-table-Win
1032 PROCEDURE select-file-dialog :
1033 /*------------------------------------------------------------------------------
1034 Purpose:
1035 Parameters: <none>
1036 Notes:
1037 ------------------------------------------------------------------------------*/
1038 DEF VAR select-ok AS LOGICAL INITIAL Yes NO-UNDO.
1039 DEF VAR v-directory AS CHAR NO-UNDO.
1040 DEF VAR v-start-dir AS CHAR NO-UNDO.
1042 v-directory = INPUT FRAME {&FRAME-NAME} RP.Char3 .
1043 v-start-dir = SUBSTRING( v-directory, 1, R-INDEX(v-directory, "\" ) ).
1045 SYSTEM-DIALOG GET-FILE v-directory FILTERS "Text" "*.txt"
1046 SAVE-AS CREATE-TEST-FILE DEFAULT-EXTENSION ".txt"
1047 INITIAL-DIR v-start-dir RETURN-TO-START-DIR
1048 TITLE "" UPDATE select-ok.
1050 IF select-ok THEN DO:
1051 /* Trim off filename to leave directory */
1052 v-directory = SUBSTRING( v-directory, 1, R-INDEX(v-directory, "\" ) ).
1054 RP.Char3:SCREEN-VALUE IN FRAME {&FRAME-NAME} = v-directory.
1055 END.
1057 END PROCEDURE.
1059 /* _UIB-CODE-BLOCK-END */
1060 &ANALYZE-RESUME
1062 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
1063 PROCEDURE send-records :
1064 /*------------------------------------------------------------------------------
1065 Purpose: Send record ROWID's for all tables used by
1066 this file.
1067 Parameters: see template/snd-head.i
1068 ------------------------------------------------------------------------------*/
1070 /* Define variables needed by this internal procedure. */
1071 {src/adm/template/snd-head.i}
1073 /* For each requested table, put it's ROWID in the output list. */
1074 {src/adm/template/snd-list.i "RP"}
1076 /* Deal with any unexpected table requests before closing. */
1077 {src/adm/template/snd-end.i}
1079 END PROCEDURE.
1081 /* _UIB-CODE-BLOCK-END */
1082 &ANALYZE-RESUME
1084 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
1085 PROCEDURE state-changed :
1086 /* -----------------------------------------------------------
1087 Purpose:
1088 Parameters: <none>
1089 Notes:
1090 -------------------------------------------------------------*/
1091 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
1092 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
1094 CASE p-state:
1095 /* Object instance CASEs can go here to replace standard behavior
1096 or add new cases. */
1097 {src/adm/template/vstates.i}
1098 END CASE.
1099 END PROCEDURE.
1101 /* _UIB-CODE-BLOCK-END */
1102 &ANALYZE-RESUME
1104 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-bank-accounts V-table-Win
1105 PROCEDURE update-bank-accounts :
1106 /*------------------------------------------------------------------------------
1107 Purpose:
1108 ------------------------------------------------------------------------------*/
1109 DEF VAR item AS CHAR NO-UNDO.
1110 DEF VAR id-list AS CHAR NO-UNDO.
1111 DEF VAR default-account AS CHAR NO-UNDO.
1113 DO WITH FRAME {&FRAME-NAME}:
1114 cmb_bnkact:LIST-ITEMS = "".
1116 FIND OfficeControlAccount OF Office WHERE OfficeControlAccount.Name = "PYMTBANK" NO-LOCK NO-ERROR.
1118 FOR EACH BankAccount NO-LOCK:
1119 item = STRING( BankAccount.CompanyCode, ">>>>9" ) + ' ' +
1120 STRING( BankAccount.AccountCode, "9999.99" ) + ' ' +
1121 BankAccount.AccountName.
1122 IF cmb_bnkact:ADD-LAST( item ) THEN.
1123 id-list = id-list + IF id-list = "" THEN "" ELSE ",".
1124 id-list = id-list + STRING( ROWID( BankAccount ) ).
1125 IF AVAILABLE(OfficeControlAccount) AND BankAccount.BankAccountCode = OfficeControlAccount.Description THEN default-account = item.
1126 END.
1128 cmb_bnkact:PRIVATE-DATA = id-list.
1129 cmb_bnkact:SCREEN-VALUE = IF default-account <> "" THEN default-account ELSE
1130 ENTRY( 1, cmb_bnkact:LIST-ITEMS ).
1132 cmb_bnkact-2:LIST-ITEMS = cmb_bnkact:LIST-ITEMS.
1133 cmb_bnkact-2:PRIVATE-DATA = id-list.
1134 cmb_bnkact-2:SCREEN-VALUE = IF default-account <> "" THEN default-account ELSE
1135 ENTRY( 1, cmb_bnkact-2:LIST-ITEMS ).
1137 RUN get-from-bank-account.
1138 RUN get-to-bank-account.
1139 END.
1141 END PROCEDURE.
1143 /* _UIB-CODE-BLOCK-END */
1144 &ANALYZE-RESUME
1146 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-run V-table-Win
1147 PROCEDURE verify-run :
1148 /*------------------------------------------------------------------------------
1149 Purpose:
1150 Notes: Verifying the cheque range has three stages:
1151 1 - From cheque number is greater than the to cheque number
1152 2 - If the existing cheque records are to be renumbered then verify that
1153 the target range is empty of existing cheques.
1154 ------------------------------------------------------------------------------*/
1155 DEF VAR range-ok AS LOGI INIT No NO-UNDO.
1156 DEF VAR batch-code LIKE NewBatch.BatchCode NO-UNDO.
1157 DEF VAR i AS INT NO-UNDO.
1158 DEF VAR n-cheques AS INT NO-UNDO INITIAL 0.
1160 DO WITH FRAME {&FRAME-NAME}:
1162 RUN get-from-bank-account.
1163 IF NOT AVAILABLE BankAccount THEN DO:
1164 MESSAGE "You must select a BankAccount." VIEW-AS ALERT-BOX ERROR
1165 TITLE "No bank Account selected".
1166 APPLY 'ENTRY':U TO cmb_bnkact.
1167 RETURN "FAIL".
1168 END.
1170 IF INPUT RP.Log1 THEN DO:
1171 IF INPUT RP.Int3 = 0 THEN DO:
1172 MESSAGE "You must enter a starting number to renumber" SKIP
1173 "cheques from" VIEW-AS ALERT-BOX ERROR
1174 TITLE "No starting number entered".
1175 APPLY 'ENTRY':U TO RP.Int3.
1176 RETURN "FAIL".
1177 END.
1179 RUN get-to-bank-account.
1180 IF NOT AVAILABLE ToBank THEN DO:
1181 MESSAGE "You must select a 'To' Bank." VIEW-AS ALERT-BOX ERROR
1182 TITLE "No 'To' bank Account selected".
1183 APPLY 'ENTRY':U TO cmb_bnkact-2.
1184 RETURN "FAIL".
1185 END.
1187 IF INPUT RP.Log7 AND LENGTH(RP.Char3) = 0 THEN DO:
1188 MESSAGE "You must select a Directory to output Bank Import File to."
1189 VIEW-AS ALERT-BOX ERROR TITLE "No Output Directory selected".
1190 APPLY 'ENTRY':U TO RP.Char3.
1191 RETURN "FAIL".
1192 END.
1194 DEF VAR f1 AS INT NO-UNDO.
1195 DEF VAR f2 AS INT NO-UNDO.
1196 DEF VAR t1 AS INT NO-UNDO.
1197 DEF VAR t2 AS INT NO-UNDO.
1198 f1 = INPUT RP.Int1.
1199 f2 = INPUT RP.Int2.
1200 t1 = INPUT RP.Int3.
1201 t2 = t1 + f2 - f1.
1202 IF CAN-FIND( FIRST Cheque WHERE Cheque.BankAccountCode = ToBank.BankAccountCode
1203 AND Cheque.ChequeNo >= t1 AND Cheque.ChequeNo <= t2
1204 AND NOT(Cheque.BankAccountCode = BankAccount.BankAccountCode
1205 AND Cheque.ChequeNo >= f1 AND Cheque.ChequeNo <= f2 ))
1206 THEN DO:
1207 MESSAGE "Cheques cannot be renumbered into the range starting" INPUT RP.Int3 SKIP
1208 "because one or more cheques within the target range" SKIP
1209 "already exist." VIEW-AS ALERT-BOX ERROR
1210 TITLE "Cheque Number Assignment Error".
1211 APPLY 'ENTRY':U TO RP.Date1.
1212 RETURN "FAIL".
1213 END.
1214 END.
1216 IF INPUT RP.Log2 = Yes AND INPUT RP.Date1 = ? THEN DO:
1217 MESSAGE "You must enter a cheque date to re-date cheques with." VIEW-AS ALERT-BOX ERROR
1218 TITLE "No cheque date entered.".
1219 APPLY 'ENTRY':U TO RP.Date1.
1220 RETURN "FAIL".
1221 END.
1223 IF INPUT RP.Int1 > INPUT RP.Int2 THEN DO:
1224 MESSAGE "The cheque range is invalid" VIEW-AS ALERT-BOX ERROR
1225 TITLE "Invalid Cheque Number range".
1226 APPLY 'ENTRY':U TO RP.Int1.
1227 RETURN "FAIL".
1228 END.
1230 /* Count the cheques */
1231 /* Check Voucher.PaymentStyle of cheque against Forced Payment Style
1232 IF Forced Payment Style = 'DD' AND Creditor.EnableDirectPayment
1233 OR Voucher.PaymentStyle = PaymentStyle selected
1234 THEN cheque will be printed */
1235 IF INPUT RP.Log4 THEN DO: /* IF Force PaymentStyle */
1236 IF TRIM(RP.Char6) = 'DD' THEN DO:
1237 FOR EACH Cheque WHERE Cheque.BankAccountCode = BankAccount.BankAccountCode
1238 AND Cheque.ChequeNo >= INPUT RP.Int1 AND Cheque.ChequeNo <= INPUT RP.Int2
1239 AND NOT Cheque.Cancelled NO-LOCK:
1241 IF CAN-FIND(FIRST Creditor
1242 WHERE Creditor.CreditorCode = Cheque.CreditorCode
1243 AND Creditor.EnableDirectPayment) THEN n-cheques = n-cheques + 1.
1244 END.
1245 END.
1246 ELSE DO:
1247 FOR EACH Cheque WHERE Cheque.BankAccountCode = BankAccount.BankAccountCode
1248 AND Cheque.ChequeNo >= INPUT RP.Int1 AND Cheque.ChequeNo <= INPUT RP.Int2
1249 AND NOT Cheque.Cancelled NO-LOCK:
1251 n-cheques = n-cheques + 1.
1252 END.
1253 END.
1254 END.
1255 ELSE DO: /* Else check Voucher.PaymentStyle */
1256 FOR EACH Cheque WHERE Cheque.BankAccountCode = BankAccount.BankAccountCode
1257 AND Cheque.ChequeNo >= INPUT RP.Int1 AND Cheque.ChequeNo <= INPUT RP.Int2
1258 AND NOT Cheque.Cancelled NO-LOCK:
1260 FIND FIRST Voucher WHERE Voucher.BankAccountCode = Cheque.BankAccountCode
1261 AND Voucher.ChequeNo = Cheque.ChequeNo NO-LOCK NO-ERROR.
1263 IF AVAILABLE Voucher THEN DO:
1264 IF TRIM(Voucher.PaymentStyle) = TRIM(RP.Char6) THEN n-cheques = n-cheques + 1.
1265 END.
1266 END.
1267 END.
1269 IF n-cheques = 0 THEN
1271 MESSAGE
1272 "There are no cheques available in the given range" SKIP
1273 "of PaymentStyle " + RP.Char6 + " for bank account:" SKIP(1)
1274 INPUT cmb_bnkact VIEW-AS ALERT-BOX ERROR TITLE "No cheques available".
1275 APPLY 'ENTRY':U TO cmb_bnkact.
1276 RETURN "FAIL".
1277 END.
1278 END.
1280 END PROCEDURE.
1282 /* _UIB-CODE-BLOCK-END */
1283 &ANALYZE-RESUME