1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI ADM1
6 &Scoped-define WINDOW-NAME CURRENT-WINDOW
7 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS V-table-Win
8 /*------------------------------------------------------------------------
14 ------------------------------------------------------------------------*/
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.
28 {inc
/method
/m-bankimportfile-gen.i
}
30 {inc
/ofc-set.i
"PDF-Output-Directory" "pdf-output-directory"}
31 IF NOT AVAILABLE(OfficeSetting
) THEN
34 /* _UIB-CODE-BLOCK-END
*/
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
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 ~
71 /* Custom List Definitions
*/
72 /* ADM-CREATE-FIELDS
,ADM-ASSIGN-FIELDS
,List-3
,List-4
,List-5
,List-6
*/
74 /* _UIB-PREPROCESSOR-BLOCK-END
*/
79 /* *********************** Control Definitions
********************** */
82 /* Definitions of the field level widgets
*/
83 DEFINE BUTTON btn-select-file
88 DEFINE BUTTON btn_print
DEFAULT
93 DEFINE VARIABLE cbx_pdfoutput
AS LOGICAL INITIAL no
94 LABEL "PDF remittance"
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
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
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
111 SIZE 44.57 BY 1 NO-UNDO.
113 DEFINE RECTANGLE RECT-27
114 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
118 /* ************************ Frame Definitions
*********************** */
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"
125 RP.Int2
AT ROW 2.4 COL 22.72 COLON-ALIGNED NO-LABEL FORMAT "999999"
128 RP.Log4
AT ROW 3.7 COL 4.29 HELP
130 VIEW-AS RADIO-SET VERTICAL
132 "One Payment Style", no
,
133 "Force Payment by", yes
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"
142 RP.Int3
AT ROW 5.55 COL 33.86 COLON-ALIGNED HELP
143 "" NO-LABEL FORMAT "999999"
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"
153 RP.Date1
AT ROW 8.75 COL 20.72 COLON-ALIGNED HELP
154 "" NO-LABEL FORMAT "99/99/9999"
157 RP.Char1
AT ROW 10.15 COL 15 NO-LABEL
158 VIEW-AS EDITOR NO-WORD-WRAP SCROLLBAR-VERTICAL
160 RP.Log3
AT ROW 14.25 COL 2.43 HELP
162 LABEL "Re-print the cheques while renumbering them"
165 RP.Log7
AT ROW 15.5 COL 4.57 HELP
167 LABEL "Generate Bank Import File"
170 RP.Char3
AT ROW 16.4 COL 10 COLON-ALIGNED HELP
172 LABEL "Directory" FORMAT "X(120)"
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
183 SIZE 1.72 BY 1 AT ROW 2.4 COL 22.43
185 "Message Text:" VIEW-AS TEXT
186 SIZE 10.57 BY 1 AT ROW 10 COL 4.14
188 "From Bank A/C:" VIEW-AS TEXT
189 SIZE 11.57 BY .9 AT ROW 1.2 COL 3.29
191 "Reprint Cheques" VIEW-AS TEXT
192 SIZE 12 BY 1 AT ROW 2.5 COL 2.57
194 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
195 SIDE-LABELS NO-UNDERLINE THREE-D
196 AT COL 1 ROW 1 SCROLLABLE
198 DEFAULT-BUTTON btn_print.
201 /* *********************** Procedure Settings
************************ */
203 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
204 /* Settings for
THIS-PROCEDURE
206 External Tables
: TTPL.RP
207 Allow
: Basic
,DB-Fields
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.
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
230 /* END WINDOW DEFINITION
*/
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
*/
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
*/
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
261 /* SETTINGS
FOR COMBO-BOX cmb_bnkact-2
IN FRAME F-Main
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
279 /* SETTINGS
FOR TOGGLE-BOX RP.Log7
IN FRAME F-Main
280 EXP-LABEL EXP-HELP
*/
281 /* _RUN-TIME-ATTRIBUTES-END
*/
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
291 */ /* FRAME F-Main
*/
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.
307 /* _UIB-CODE-BLOCK-END
*/
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
).
320 /* _UIB-CODE-BLOCK-END
*/
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}.
333 /* _UIB-CODE-BLOCK-END
*/
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
, "\" ) ).
346 /* _UIB-CODE-BLOCK-END
*/
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"}
357 /* _UIB-CODE-BLOCK-END
*/
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"}
367 /* _UIB-CODE-BLOCK-END
*/
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.
378 /* _UIB-CODE-BLOCK-END
*/
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"}
389 /* _UIB-CODE-BLOCK-END
*/
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"}
399 /* _UIB-CODE-BLOCK-END
*/
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.
410 /* _UIB-CODE-BLOCK-END
*/
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.
424 /* _UIB-CODE-BLOCK-END
*/
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"}
434 /* _UIB-CODE-BLOCK-END
*/
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.
445 /* _UIB-CODE-BLOCK-END
*/
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").
460 /* _UIB-CODE-BLOCK-END
*/
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.
474 /* _UIB-CODE-BLOCK-END
*/
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
*/
485 /* _UIB-CODE-BLOCK-END
*/
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.
497 /* _UIB-CODE-BLOCK-END
*/
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.
508 /* _UIB-CODE-BLOCK-END
*/
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.
520 /* _UIB-CODE-BLOCK-END
*/
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.
535 /* _UIB-CODE-BLOCK-END
*/
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.
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
}
569 /* _UIB-CODE-BLOCK-END
*/
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
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.
*/
584 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
587 /* _UIB-CODE-BLOCK-END
*/
590 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-import-file-gen V-table-Win
591 PROCEDURE enable-import-file-gen
:
592 /*------------------------------------------------------------------------------
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.
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
).
617 FIND BankAccount
WHERE ROWID( BankAccount
) =
618 TO-ROWID( ENTRY( item-idx
, cmb_bnkact-2
:PRIVATE-DATA ) ) NO-LOCK NO-ERROR.
620 IF NOT INPUT RP.Log1
THEN DO:
621 item-idx
= cmb_bnkact
:LOOKUP( INPUT cmb_bnkact
).
623 FIND BankAccount
WHERE ROWID( BankAccount
) =
624 TO-ROWID( ENTRY( item-idx
, cmb_bnkact
:PRIVATE-DATA ) ) NO-LOCK NO-ERROR.
627 IF AVAILABLE BankAccount
THEN DO:
628 RUN get-bankbranchaccountsuffix
(
629 BankAccount.BankAccount
,
635 /* IF RETURN-VALUE = "FAIL" THEN RETURN "FAIL".
*/
638 IF v-bank
= 3 THEN DO:
639 item-idx
= cmb_PaymentStyle
:LOOKUP( INPUT cmb_PaymentStyle
).
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.
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.
653 ELSE HIDE RP.Char3 btn-select-file.
657 RP.Log7
= NO.
DISPLAY RP.Log7.
658 HIDE RP.Log7 RP.Char3 btn-select-file.
662 RP.Log7
= NO.
DISPLAY RP.Log7.
663 HIDE RP.Log7 RP.Char3 btn-select-file.
670 /* _UIB-CODE-BLOCK-END
*/
673 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-from-bank-account V-table-Win
674 PROCEDURE get-from-bank-account
:
675 /*------------------------------------------------------------------------------
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.
693 /* _UIB-CODE-BLOCK-END
*/
696 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-to-bank-account V-table-Win
697 PROCEDURE get-to-bank-account
:
698 /*------------------------------------------------------------------------------
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.
716 /* _UIB-CODE-BLOCK-END
*/
719 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
720 PROCEDURE inst-enable-fields
:
721 /*------------------------------------------------------------------------------
725 ------------------------------------------------------------------------------*/
727 RUN renumber-changed.
732 /* _UIB-CODE-BLOCK-END
*/
735 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
736 PROCEDURE inst-initialize
:
737 /*------------------------------------------------------------------------------
741 ------------------------------------------------------------------------------*/
743 DEF VAR user-name
AS CHAR NO-UNDO.
745 RUN get-username
IN sys-mgr
( OUTPUT user-name
).
748 RP.UserName
= user-name
AND
749 RP.ReportID
= {&REPORT-ID} NO-ERROR.
751 IF NOT AVAILABLE RP
THEN DO:
755 RP.ReportID
= {&REPORT-ID}
756 RP.UserName
= user-name
760 RP.Char1
= "Please forward all invoices to:~n" + Office.StreetAddress .
764 /* RUN update-bank-accounts.
*/
765 RUN dispatch
( 'display-fields'
:U
).
766 RUN dispatch
( 'enable-fields'
:U
).
767 RUN enable-import-file-gen.
771 /* _UIB-CODE-BLOCK-END
*/
774 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
775 PROCEDURE pre-destroy
:
776 /*------------------------------------------------------------------------------
780 ------------------------------------------------------------------------------*/
782 RUN check-modified
( "CLEAR" ).
786 /* _UIB-CODE-BLOCK-END
*/
789 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE redate-changed V-table-Win
790 PROCEDURE redate-changed
:
791 /*------------------------------------------------------------------------------
795 ------------------------------------------------------------------------------*/
797 RP.Date1
:SENSITIVE IN FRAME {&FRAME-NAME} =
798 INPUT FRAME {&FRAME-NAME} RP.Log2 = "Yes".
802 /* _UIB-CODE-BLOCK-END
*/
805 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE renumber-changed V-table-Win
806 PROCEDURE renumber-changed
:
807 /*------------------------------------------------------------------------------
809 ------------------------------------------------------------------------------*/
810 DO WITH FRAME {&FRAME-NAME} :
811 RP.Int3
:SENSITIVE = INPUT RP.Log1
= "Yes".
813 IF INPUT RP.Log1
THEN
820 /* _UIB-CODE-BLOCK-END
*/
823 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE renumber-cheque-range V-table-Win
824 PROCEDURE renumber-cheque-range
:
825 /*------------------------------------------------------------------------------
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
).
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.
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.
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
).
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.
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.
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.
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.".
914 IF change-no
OR change-acct
OR RP.Log2
OR RP.Log4
THEN
916 DO /*TRANSACTION */ ON ERROR UNDO modify-cheques
, RETURN "FAIL":
918 DEF VAR cheque-no
AS INT NO-UNDO.
921 FIND FIRST Cheque
EXCLUSIVE-LOCK WHERE Cheque.BankAccountCode
= BankAccount.BankAccountCode
922 AND Cheque.ChequeNo
>= f1
AND Cheque.ChequeNo
<= f2
NO-ERROR.
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
):
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.
935 IF change-no
THEN Cheque.ChequeNo
= cheque-no.
936 IF change-acct
THEN Cheque.BankAccountCode
= ToBank.BankAccountCode.
938 IF RP.Log2
THEN Cheque.Date
= RP.Date1.
940 FIND NEXT Cheque
EXCLUSIVE-LOCK WHERE Cheque.BankAccountCode
= BankAccount.BankAccountCode
941 AND Cheque.ChequeNo
>= f1
AND Cheque.ChequeNo
<= f2
NO-ERROR.
943 FIND PREV Cheque
EXCLUSIVE-LOCK WHERE Cheque.BankAccountCode
= BankAccount.BankAccountCode
944 AND Cheque.ChequeNo
>= f1
AND Cheque.ChequeNo
<= f2
NO-ERROR.
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
*/
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.
969 FOR EACH Voucher
WHERE Voucher.BankAccountCode
= Cheque.BankAccountCode
970 AND Voucher.ChequeNo
= Cheque.ChequeNo
EXCLUSIVE-LOCK:
971 Voucher.PaymentStyle
= RP.Char6.
975 FIND NEXT Cheque
EXCLUSIVE-LOCK WHERE Cheque.BankAccountCode
= BankAccount.BankAccountCode
976 AND Cheque.ChequeNo
>= f1
AND Cheque.ChequeNo
<= f2
NO-ERROR.
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".
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.
994 IF (change-acct
OR change-no
OR RP.Log2
) AND NOT RP.Log3
THEN DO:
997 msg
= "moved from Bank '" + BankAccount.BankAccountCode
+ "' to '" + ToBank.BankAccountCode
+ "'".
999 msg
= msg
+ (IF msg
<> "" THEN ",~n" ELSE "") + "renumbered by " + STRING(offset
) + " (" + STRING(f1
) + " becomes " + STRING(t1
) + " and so on)".
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".
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.
1020 report-options
= report-options
+ "~nOutputPDF".
1022 RUN process
/report
/chqprt.p
( report-options
).
1028 /* _UIB-CODE-BLOCK-END
*/
1031 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE select-file-dialog V-table-Win
1032 PROCEDURE select-file-dialog
:
1033 /*------------------------------------------------------------------------------
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.
1059 /* _UIB-CODE-BLOCK-END
*/
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
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
}
1081 /* _UIB-CODE-BLOCK-END
*/
1084 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
1085 PROCEDURE state-changed
:
1086 /* -----------------------------------------------------------
1090 -------------------------------------------------------------*/
1091 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
1092 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
1095 /* Object instance CASEs can go here to replace standard behavior
1096 or add new cases.
*/
1097 {src
/adm
/template
/vstates.i
}
1101 /* _UIB-CODE-BLOCK-END
*/
1104 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-bank-accounts V-table-Win
1105 PROCEDURE update-bank-accounts
:
1106 /*------------------------------------------------------------------------------
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.
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.
1143 /* _UIB-CODE-BLOCK-END
*/
1146 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-run V-table-Win
1147 PROCEDURE verify-run
:
1148 /*------------------------------------------------------------------------------
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.
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.
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.
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.
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.
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
))
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.
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.
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.
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.
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.
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.
1269 IF n-cheques
= 0 THEN
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.
1282 /* _UIB-CODE-BLOCK-END
*/