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 /*------------------------------------------------------------------------
9 File
: vwr\mnt\v-chqrun.w
10 ------------------------------------------------------------------------*/
12 /* *************************** Definitions
************************** */
14 &SCOP REPORT-ID "Cheque Run"
17 {inc
/ofc-acct.i
"CREDITORS" "sundry-creditors"}
19 DEF VAR creditor-list
AS CHAR NO-UNDO.
20 DEF VAR pdf-support
AS LOGICAL INIT YES NO-UNDO.
21 DEF VAR pdf-output
AS LOGICAL INIT NO NO-UNDO.
23 /* ensure bank account is scoped to entire program
*/
24 FIND FIRST BankAccount
NO-LOCK NO-ERROR.
26 {inc
/method
/m-bankimportfile-gen.i
}
28 {inc
/ofc-set.i
"PDF-Output-Directory" "pdf-output-directory"}
29 IF NOT AVAILABLE(OfficeSetting
) THEN
32 /* _UIB-CODE-BLOCK-END
*/
36 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
38 /* ******************** Preprocessor Definitions
******************** */
40 &Scoped-define PROCEDURE-TYPE SmartViewer
41 &Scoped-define DB-AWARE no
43 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
45 /* Name of first Frame and
/or Browse and
/or first Query
*/
46 &Scoped-define FRAME-NAME F-Main
49 &Scoped-define EXTERNAL-TABLES RP
50 &Scoped-define FIRST-EXTERNAL-TABLE RP
53 /* Need to scope the external tables to this procedure
*/
54 DEFINE QUERY external_tables
FOR RP.
55 /* Standard List Definitions
*/
56 &Scoped-Define ENABLED-FIELDS RP.Log5 RP.Int1 RP.Char4 RP.Log2 RP.Log6 ~
58 &Scoped-define ENABLED-TABLES RP
59 &Scoped-define FIRST-ENABLED-TABLE RP
60 &Scoped-Define ENABLED-OBJECTS cmb_Client cmb_bnkact fil_from fil_to ~
61 fil_acct-from fil_acct-to fil_due cmb_PaymentStyle fil_startchq fil_Date ~
62 btn_print cbx_pdfoutput RECT-22
63 &Scoped-Define DISPLAYED-FIELDS RP.Log5 RP.Int1 RP.Char4 RP.Log2 RP.Log6 ~
65 &Scoped-define DISPLAYED-TABLES RP
66 &Scoped-define FIRST-DISPLAYED-TABLE RP
67 &Scoped-Define DISPLAYED-OBJECTS cmb_Client cmb_bnkact fil_from fil_to ~
68 fil_acct-from fil_acct-to fil_due cmb_PaymentStyle fil_startchq ~
69 fil_LastCheque fil_Date 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
*/
79 /* *********************** Control Definitions
********************** */
82 /* Definitions of the field level widgets
*/
83 DEFINE BUTTON btn_print
DEFAULT
88 DEFINE VARIABLE cbx_pdfoutput
AS LOGICAL INITIAL no
89 LABEL "PDF remittance"
91 SIZE 14 BY .8 TOOLTIP "Generate the remittance advice from this cheque run a batch of PDF files" NO-UNDO.
93 DEFINE VARIABLE cmb_bnkact
AS CHARACTER FORMAT "X(256)":U
95 VIEW-AS COMBO-BOX INNER-LINES 15
97 SIZE 52.57 BY 1 NO-UNDO.
99 DEFINE VARIABLE cmb_Client
AS CHARACTER FORMAT "X(256)"
100 VIEW-AS COMBO-BOX INNER-LINES 15
103 SIZE 45.14 BY 1 NO-UNDO.
105 DEFINE VARIABLE cmb_PaymentStyle
AS CHARACTER FORMAT "X(256)":U
106 VIEW-AS COMBO-BOX INNER-LINES 15
108 SIZE 44.57 BY 1 NO-UNDO.
110 DEFINE VARIABLE fil_acct-from
AS DECIMAL FORMAT "9999.99":U
INITIAL 0
113 SIZE 6.86 BY 1.05 NO-UNDO.
115 DEFINE VARIABLE fil_acct-to
AS DECIMAL FORMAT "9999.99":U
INITIAL 0
118 SIZE 6.86 BY 1.05 NO-UNDO.
120 DEFINE VARIABLE fil_Date
AS DATE FORMAT "99/99/9999":U
123 SIZE 11.29 BY 1 NO-UNDO.
125 DEFINE VARIABLE fil_due
AS INTEGER FORMAT ">>9":U
INITIAL 10
126 LABEL "Cheques due in"
130 DEFINE VARIABLE fil_from
AS INTEGER FORMAT "99999":U
INITIAL 0
131 LABEL "Creditor from"
133 SIZE 5.72 BY 1 NO-UNDO.
135 DEFINE VARIABLE fil_LastCheque
AS CHARACTER FORMAT "X(256)":U
137 SIZE 21.14 BY 1.05 NO-UNDO.
139 DEFINE VARIABLE fil_startchq
AS INTEGER FORMAT "999999":U
INITIAL 0
140 LABEL "Next Cheque No"
142 SIZE 7.57 BY 1 NO-UNDO.
144 DEFINE VARIABLE fil_to
AS INTEGER FORMAT "99999":U
INITIAL 0
147 SIZE 5.72 BY 1 NO-UNDO.
149 DEFINE RECTANGLE RECT-22
150 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
154 /* ************************ Frame Definitions
*********************** */
157 RP.Log5
AT ROW 1.4 COL 4.43 HELP
159 VIEW-AS RADIO-SET VERTICAL
161 "All Clients/Owners", no
,
162 "One Client/Owner", yes
164 cmb_Client
AT ROW 2 COL 19 COLON-ALIGNED NO-LABEL
165 cmb_bnkact
AT ROW 3.4 COL 11.57 COLON-ALIGNED
166 RP.Int1
AT ROW 5.4 COL 4.43 HELP
168 VIEW-AS RADIO-SET VERTICAL
170 "A range of creditor codes", 1,
171 "Vouchers charged to a range of projects", 2,
172 "Vouchers charged to a range of accounts", 3,
173 "A list of creditor codes", 4
175 fil_from
AT ROW 5.6 COL 49.86 COLON-ALIGNED
176 fil_to
AT ROW 5.6 COL 58.43 COLON-ALIGNED
177 fil_acct-from
AT ROW 6.8 COL 47.57 COLON-ALIGNED
178 fil_acct-to
AT ROW 6.8 COL 57.29 COLON-ALIGNED
179 RP.Char4
AT ROW 7.8 COL 20.72 COLON-ALIGNED HELP
180 "" NO-LABEL FORMAT "X(256)"
182 SIZE 43.43 BY 1.05 TOOLTIP "Enter creditor codes separated by commas"
183 fil_due
AT ROW 9.2 COL 11.57 COLON-ALIGNED
184 RP.Log2
AT ROW 9.25 COL 43
185 LABEL "Enforce creditor cheque limits"
188 RP.Log6
AT ROW 10.25 COL 43 HELP
190 LABEL "Select my vouchers only"
192 SIZE 21 BY .8 TOOLTIP "Only select Approved vouchers last modified by current user."
193 RP.Log4
AT ROW 11 COL 4.43 HELP
195 VIEW-AS RADIO-SET VERTICAL
197 "One Payment Style", no
,
198 "Force Payment by", yes
200 cmb_PaymentStyle
AT ROW 11.4 COL 19.57 COLON-ALIGNED NO-LABEL
201 fil_startchq
AT ROW 13.05 COL 11.57 COLON-ALIGNED
202 fil_LastCheque
AT ROW 13.05 COL 19 COLON-ALIGNED NO-LABEL
203 fil_Date
AT ROW 13.05 COL 52.72 COLON-ALIGNED
204 RP.Char1
AT ROW 14.25 COL 13.57 NO-LABEL
205 VIEW-AS EDITOR NO-WORD-WRAP SCROLLBAR-VERTICAL
208 btn_print
AT ROW 19.25 COL 57
209 cbx_pdfoutput
AT ROW 19.45 COL 43
210 RECT-22
AT ROW 1 COL 1
211 "Select creditors by:" VIEW-AS TEXT
212 SIZE 13.14 BY .8 AT ROW 4.6 COL 2.72
213 "Message Text:" VIEW-AS TEXT
214 SIZE 10.29 BY 1 AT ROW 14.25 COL 3.29
216 "days or less" VIEW-AS TEXT
217 SIZE 8 BY 1 AT ROW 9.2 COL 18.14
219 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
220 SIDE-LABELS NO-UNDERLINE THREE-D
221 AT COL 1 ROW 1 SCROLLABLE
223 DEFAULT-BUTTON btn_print.
226 /* *********************** Procedure Settings
************************ */
228 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
229 /* Settings for
THIS-PROCEDURE
231 External Tables
: TTPL.RP
232 Allow
: Basic
,DB-Fields
234 Add Fields to
: EXTERNAL-TABLES
235 Other Settings
: PERSISTENT-ONLY
COMPILE
238 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
239 /* then cleanup and return.
*/
240 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
241 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT.":U
242 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
246 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
248 /* ************************* Create Window
************************** */
250 &ANALYZE-SUSPEND _CREATE-WINDOW
251 /* DESIGN Window definition
(used by the UIB
)
252 CREATE WINDOW V-table-Win
ASSIGN
255 /* END WINDOW DEFINITION
*/
259 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
260 /* ************************* Included-Libraries
*********************** */
262 {src
/adm
/method
/viewer.i
}
263 {inc
/method
/m-mntvwr.i
}
265 /* _UIB-CODE-BLOCK-END
*/
271 /* *********** Runtime Attributes and AppBuilder Settings
*********** */
273 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
274 /* SETTINGS
FOR WINDOW V-table-Win
275 VISIBLE,,RUN-PERSISTENT
*/
276 /* SETTINGS
FOR FRAME F-Main
277 NOT-VISIBLE Size-to-Fit
*/
279 FRAME F-Main
:SCROLLABLE = FALSE
280 FRAME F-Main
:HIDDEN = TRUE.
282 /* SETTINGS
FOR FILL-IN RP.Char4
IN FRAME F-Main
283 EXP-LABEL EXP-FORMAT EXP-HELP
*/
284 /* SETTINGS
FOR FILL-IN fil_LastCheque
IN FRAME F-Main
286 /* SETTINGS
FOR RADIO-SET RP.Int1
IN FRAME F-Main
288 /* SETTINGS
FOR TOGGLE-BOX RP.Log2
IN FRAME F-Main
290 /* SETTINGS
FOR RADIO-SET RP.Log4
IN FRAME F-Main
292 /* SETTINGS
FOR RADIO-SET RP.Log5
IN FRAME F-Main
294 /* SETTINGS
FOR TOGGLE-BOX RP.Log6
IN FRAME F-Main
295 EXP-LABEL EXP-HELP
*/
296 /* _RUN-TIME-ATTRIBUTES-END
*/
300 /* Setting information for Queries and Browse Widgets fields
*/
302 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
303 /* Query rebuild information for
FRAME F-Main
306 */ /* FRAME F-Main
*/
313 /* ************************ Control Triggers
************************ */
315 &Scoped-define SELF-NAME btn_print
316 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_print V-table-Win
317 ON CHOOSE OF btn_print
IN FRAME F-Main
/* OK */
319 DO WITH FRAME {&FRAME-NAME}:
320 RUN notify
( 'set-busy
, CONTAINER-SOURCE'
:U
).
324 IF RETURN-VALUE = "FAIL" THEN
325 RUN notify
( 'set-idle
, CONTAINER-SOURCE'
:U
).
327 RUN dispatch
( 'exit'
:U
).
331 /* _UIB-CODE-BLOCK-END
*/
335 &Scoped-define SELF-NAME cbx_pdfoutput
336 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cbx_pdfoutput V-table-Win
337 ON VALUE-CHANGED
OF cbx_pdfoutput
IN FRAME F-Main
/* OK */
339 DO WITH FRAME {&FRAME-NAME}:
340 pdf-output
= cbx_pdfoutput
:CHECKED IN FRAME {&FRAME-NAME}.
344 /* _UIB-CODE-BLOCK-END
*/
348 &Scoped-define SELF-NAME cmb_bnkact
349 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_bnkact V-table-Win
350 ON U1
OF cmb_bnkact
IN FRAME F-Main
/* Bank Account
*/
352 {inc
/selcmb
/scchq1.i
"RP" "Char5"}
355 /* _UIB-CODE-BLOCK-END
*/
359 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_bnkact V-table-Win
360 ON U2
OF cmb_bnkact
IN FRAME F-Main
/* Bank Account
*/
362 {inc
/selcmb
/scchq2.i
"RP" "Char5"}
365 /* _UIB-CODE-BLOCK-END
*/
369 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_bnkact V-table-Win
370 ON VALUE-CHANGED
OF cmb_bnkact
IN FRAME F-Main
/* Bank Account
*/
372 RUN display-last-cheque-no.
374 /* Display Import File Generation option?
*/
375 RUN enable-import-file-gen.
378 /* _UIB-CODE-BLOCK-END
*/
382 &Scoped-define SELF-NAME cmb_Client
383 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_Client V-table-Win
384 ON U1
OF cmb_Client
IN FRAME F-Main
386 {inc
/selcmb
/scclient1.i
"RP" "Char2"}
387 RUN display-last-cheque-no.
390 /* _UIB-CODE-BLOCK-END
*/
394 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_Client V-table-Win
395 ON U2
OF cmb_Client
IN FRAME F-Main
397 {inc
/selcmb
/scclient2.i
"RP" "Char2"}
400 /* _UIB-CODE-BLOCK-END
*/
404 &Scoped-define SELF-NAME cmb_PaymentStyle
405 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_PaymentStyle V-table-Win
406 ON U1
OF cmb_PaymentStyle
IN FRAME F-Main
408 {inc
/selcmb
/scpsty1.i
"RP" "Char6"}
410 /* Display Import File Generation option?
*/
411 RUN enable-import-file-gen.
414 /* _UIB-CODE-BLOCK-END
*/
418 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_PaymentStyle V-table-Win
419 ON U2
OF cmb_PaymentStyle
IN FRAME F-Main
421 {inc
/selcmb
/scpsty2.i
"RP" "Char6"}
424 /* _UIB-CODE-BLOCK-END
*/
428 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_PaymentStyle V-table-Win
429 ON VALUE-CHANGED
OF cmb_PaymentStyle
IN FRAME F-Main
431 RUN enable-appropriate-fields.
433 /* Display Import File Generation option?
*/
434 RUN enable-import-file-gen.
437 /* _UIB-CODE-BLOCK-END
*/
441 &Scoped-define SELF-NAME fil_Date
442 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Date V-table-Win
443 ON LEAVE OF fil_Date
IN FRAME F-Main
/* Cheque Date
*/
445 IF INPUT {&SELF-NAME} < TODAY THEN
447 MESSAGE "The cheque should only be dated in the past" SKIP
448 "if you are creating a record of manually produced cheques."
449 VIEW-AS ALERT-BOX WARNING TITLE "Cheque date in the past".
450 /* DISPLAY {&SELF-NAME} WITH FRAME {&FRAME-NAME}. */
457 /* _UIB-CODE-BLOCK-END
*/
461 &Scoped-define SELF-NAME fil_from
462 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_from V-table-Win
463 ON LEAVE OF fil_from
IN FRAME F-Main
/* Creditor from
*/
465 IF SELF:MODIFIED THEN
470 fil_to
= {&SELF-NAME}.
472 DISPLAY fil_to
WITH FRAME {&FRAME-NAME}.
480 /* _UIB-CODE-BLOCK-END
*/
484 &Scoped-define SELF-NAME RP.Int1
485 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int1 V-table-Win
486 ON VALUE-CHANGED
OF RP.Int1
IN FRAME F-Main
/* Int1
*/
488 RUN enable-appropriate-fields.
490 /* Display Import File Generation option?
*/
491 RUN enable-import-file-gen.
494 /* _UIB-CODE-BLOCK-END
*/
498 &Scoped-define SELF-NAME RP.Log4
499 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log4 V-table-Win
500 ON VALUE-CHANGED
OF RP.Log4
IN FRAME F-Main
/* Log4
*/
502 RUN enable-appropriate-fields.
505 /* _UIB-CODE-BLOCK-END
*/
509 &Scoped-define SELF-NAME RP.Log5
510 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log5 V-table-Win
511 ON VALUE-CHANGED
OF RP.Log5
IN FRAME F-Main
/* Log5
*/
513 RUN enable-appropriate-fields.
516 /* _UIB-CODE-BLOCK-END
*/
522 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
525 /* *************************** Main Block
*************************** */
527 IF NOT pdf-support
THEN DO:
528 cbx_pdfoutput
:VISIBLE IN FRAME {&FRAME-NAME} = NO.
531 /* _UIB-CODE-BLOCK-END
*/
535 /* ********************** Internal Procedures
*********************** */
537 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
538 PROCEDURE adm-row-available
:
539 /*------------------------------------------------------------------------------
540 Purpose
: Dispatched to this procedure when the Record-
541 Source has a new row available. This procedure
542 tries to get the new row
(or foriegn keys
) from
543 the Record-Source and process it.
545 ------------------------------------------------------------------------------*/
547 /* Define variables needed by this internal procedure.
*/
548 {src
/adm
/template
/row-head.i
}
550 /* Create a list of all the tables that we need to get.
*/
551 {src
/adm
/template
/row-list.i
"RP"}
553 /* Get the record
ROWID's from the RECORD-SOURCE.
*/
554 {src
/adm
/template
/row-get.i
}
556 /* FIND each record specified by the RECORD-SOURCE.
*/
557 {src
/adm
/template
/row-find.i
"RP"}
559 /* Process the newly available records
(i.e. display fields
,
560 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
561 {src
/adm
/template
/row-end.i
}
565 /* _UIB-CODE-BLOCK-END
*/
568 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE build-account-range V-table-Win
569 PROCEDURE build-account-range
:
570 /*------------------------------------------------------------------------------
571 Purpose
: Build a list of creditors based on vouchers which have been updated
572 against a particular range of projects.
573 ------------------------------------------------------------------------------*/
574 DEF INPUT PARAMETER print-date
AS DATE NO-UNDO.
575 DEF OUTPUT PARAMETER creditor-list
AS CHAR NO-UNDO.
577 DEF VAR start-account
AS DEC NO-UNDO.
578 DEF VAR end-account
AS DEC NO-UNDO.
579 DEF VAR cheque-total
AS DEC INIT 0.00 NO-UNDO.
580 DEF VAR c-creditor
AS CHAR NO-UNDO.
581 DEF BUFFER CrdVoucher
FOR Voucher.
583 DO WITH FRAME {&FRAME-NAME}:
584 start-account
= INPUT fil_acct-from.
585 end-account
= INPUT fil_acct-to.
588 /* Search by voucher rather than creditor for efficiency
*/
590 FOR EACH Voucher
WHERE Voucher.VoucherStatus
= "A"
591 AND (Voucher.DateDue
<= print-date
OR Voucher.DateDue
= ?
) NO-LOCK:
593 c-creditor
= STRING( Voucher.CreditorCode
).
595 IF LOOKUP( c-creditor
, creditor-list
) = 0 THEN DO:
598 FOR EACH CrdVoucher
WHERE CrdVoucher.CreditorCode
= Voucher.CreditorCode
599 AND CrdVoucher.VoucherStatus
= "A"
600 AND CrdVoucher.AccountCode
>= start-account
601 AND CrdVoucher.AccountCode
<= end-account
602 AND (CrdVoucher.DateDue
<= print-date
603 OR CrdVoucher.DateDue
= ?
) NO-LOCK:
605 cheque-total
= cheque-total
+ CrdVoucher.GoodsValue
+ CrdVoucher.TaxValue.
608 IF cheque-total
> 0 THEN DO:
609 creditor-list
= creditor-list
+ IF creditor-list
= "" THEN "" ELSE ",".
610 creditor-list
= creditor-list
+ c-creditor.
617 /* _UIB-CODE-BLOCK-END
*/
620 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE build-creditor-list V-table-Win
621 PROCEDURE build-creditor-list
:
622 /*------------------------------------------------------------------------------
623 Purpose
: Build a list of creditors based on an entered list.
624 ------------------------------------------------------------------------------*/
625 DEF INPUT PARAMETER print-date
AS DATE NO-UNDO.
626 DEF OUTPUT PARAMETER creditor-list
AS CHAR NO-UNDO.
628 DEF VAR in-creditor-list
AS CHAR NO-UNDO.
629 DEF VAR cheque-total
AS DEC INIT 0.00 NO-UNDO.
630 DEF VAR i
AS INT NO-UNDO.
631 DEF VAR creditor-code
AS INT NO-UNDO.
633 DO WITH FRAME {&FRAME-NAME}:
634 in-creditor-list
= INPUT RP.Char4.
638 DO i
= 1 TO NUM-ENTRIES(in-creditor-list
):
639 creditor-code
= INT( TRIM( ENTRY( i
, in-creditor-list
) ) ).
641 FOR EACH Voucher
WHERE Voucher.CreditorCode
= creditor-code
642 AND Voucher.VoucherStatus
= "A"
643 AND (Voucher.DateDue
<= print-date
644 OR Voucher.DateDue
= ?
) NO-LOCK:
645 cheque-total
= cheque-total
+ Voucher.GoodsValue
+ Voucher.TaxValue.
647 IF cheque-total
> 0 THEN DO:
648 creditor-list
= creditor-list
+ IF creditor-list
= "" THEN "" ELSE ",".
649 creditor-list
= creditor-list
+ STRING(creditor-code
).
652 MESSAGE "Creditor " + STRING(creditor-code
) ":" SKIP(1)
653 "No cheque will be produced as the total would be " + STRING(cheque-total
)
654 VIEW-AS ALERT-BOX INFORMATION
655 TITLE "Cheque Not Required".
661 /* _UIB-CODE-BLOCK-END
*/
664 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE build-creditor-range V-table-Win
665 PROCEDURE build-creditor-range
:
666 /*------------------------------------------------------------------------------
667 Purpose
: Find the creditors with cheques due in a simple range of creditors
668 ------------------------------------------------------------------------------*/
669 DEF INPUT PARAMETER print-date
AS DATE NO-UNDO.
670 DEF OUTPUT PARAMETER creditor-list
AS CHAR NO-UNDO.
672 DEF VAR start-crdtor
AS INT NO-UNDO.
673 DEF VAR end-crdtor
AS INT NO-UNDO.
674 DEF VAR c-creditor
AS CHAR NO-UNDO.
675 DEF VAR cheque-total
AS DEC INIT 0.00 NO-UNDO.
676 DEF BUFFER CrdVoucher
FOR Voucher.
678 start-crdtor
= INPUT FRAME {&FRAME-NAME} fil_from.
679 end-crdtor
= INPUT FRAME {&FRAME-NAME} fil_to.
680 IF end-crdtor
< start-crdtor
THEN end-crdtor
= start-crdtor.
682 /* Search by voucher rather than creditor for efficiency
*/
684 FOR EACH Voucher
WHERE
685 Voucher.VoucherStatus
= "A" AND
686 ( Voucher.DateDue
<= print-date
OR Voucher.DateDue
= ?
) NO-LOCK:
688 c-creditor
= STRING( Voucher.CreditorCode
).
690 IF Voucher.CreditorCode
>= start-crdtor
AND
691 Voucher.CreditorCode
<= end-crdtor
AND
692 LOOKUP( c-creditor
, creditor-list
) = 0 THEN
696 FOR EACH CrdVoucher
WHERE
697 CrdVoucher.CreditorCode
= Voucher.CreditorCode
AND
698 CrdVoucher.VoucherStatus
= "A" AND
699 ( CrdVoucher.DateDue
<= print-date
OR CrdVoucher.DateDue
= ?
) NO-LOCK:
700 cheque-total
= cheque-total
+ CrdVoucher.GoodsValue
+ CrdVoucher.TaxValue.
703 IF cheque-total
> 0 THEN
705 creditor-list
= creditor-list
+ IF creditor-list
= "" THEN "" ELSE ",".
706 creditor-list
= creditor-list
+ c-creditor.
713 /* _UIB-CODE-BLOCK-END
*/
716 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE build-project-range V-table-Win
717 PROCEDURE build-project-range
:
718 /*------------------------------------------------------------------------------
719 Purpose
: Build a list of creditors based on vouchers which have been updated
720 against a particular range of projects.
721 ------------------------------------------------------------------------------*/
722 DEF INPUT PARAMETER print-date
AS DATE NO-UNDO.
723 DEF OUTPUT PARAMETER creditor-list
AS CHAR NO-UNDO.
725 DEF VAR start-project
AS INT NO-UNDO.
726 DEF VAR end-project
AS INT NO-UNDO.
727 DEF VAR cheque-total
AS DEC INIT 0.00 NO-UNDO.
728 DEF VAR c-creditor
AS CHAR NO-UNDO.
729 DEF BUFFER CrdVoucher
FOR Voucher.
731 DO WITH FRAME {&FRAME-NAME}:
732 start-project
= INPUT fil_from.
733 end-project
= INPUT fil_to.
736 /* Search by voucher rather than creditor for efficiency
*/
738 FOR EACH Voucher
WHERE Voucher.VoucherStatus
= "A"
739 AND (Voucher.DateDue
<= print-date
OR Voucher.DateDue
= ?
) NO-LOCK:
741 c-creditor
= STRING( Voucher.CreditorCode
).
743 IF LOOKUP( c-creditor
, creditor-list
) = 0 THEN DO:
746 FOR EACH CrdVoucher
WHERE CrdVoucher.CreditorCode
= Voucher.CreditorCode
747 AND CrdVoucher.VoucherStatus
= "A"
748 AND CrdVoucher.EntityType
= "J"
749 AND CrdVoucher.EntityCode
>= start-project
750 AND CrdVoucher.EntityCode
<= end-project
751 AND (CrdVoucher.DateDue
<= print-date
752 OR CrdVoucher.DateDue
= ?
) NO-LOCK:
754 cheque-total
= cheque-total
+ CrdVoucher.GoodsValue
+ CrdVoucher.TaxValue.
757 IF cheque-total
> 0 THEN DO:
758 creditor-list
= creditor-list
+ IF creditor-list
= "" THEN "" ELSE ",".
759 creditor-list
= creditor-list
+ c-creditor.
766 /* _UIB-CODE-BLOCK-END
*/
769 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE cheque-run V-table-Win
770 PROCEDURE cheque-run
:
771 /*------------------------------------------------------------------------------
773 ------------------------------------------------------------------------------*/
774 DEF VAR report-options
AS CHAR NO-UNDO.
775 DEFINE VARIABLE item-idx
AS INTEGER INITIAL 0 NO-UNDO.
777 DO WITH FRAME {&FRAME-NAME}:
778 item-idx
= cmb_PaymentStyle
:LOOKUP( INPUT cmb_PaymentStyle
).
780 FIND PaymentStyle
WHERE ROWID( PaymentStyle
) =
781 TO-ROWID( ENTRY( item-idx
, cmb_PaymentStyle
:PRIVATE-DATA ) ) NO-LOCK NO-ERROR.
783 IF AVAILABLE PaymentStyle
THEN DO:
784 FIND CURRENT RP
SHARE-LOCK.
785 RP.Char6
= PaymentStyle.PaymentStyle.
790 IF RETURN-VALUE = "FAIL" THEN RETURN "FAIL".
792 RUN dispatch
( 'update-record'
:U
).
794 DO WITH FRAME {&FRAME-NAME}:
795 report-options
= "ChequeDate," + STRING( INPUT fil_Date
, "99/99/9999" )
796 + "~nFirstCheque," + STRING( INPUT fil_StartChq
)
797 + "~nDueBefore," + STRING( TODAY + INPUT fil_due
, "99/99/9999" )
798 + (IF RP.Log2
THEN "~nEnforceLimit" ELSE "")
799 + (IF RP.Log5
THEN "~nOneClient," + RP.Char2
ELSE "")
800 + (IF RP.Log6
THEN "~nMyVouchers," ELSE "")
801 + "~nBankAccount," + RP.Char5
802 + "~nMessage," + REPLACE( RP.Char1
, "~n", CHR(7) ) .
804 report-options
= report-options
805 + (IF RP.Log4
= No
THEN "~nPaymentStyle," ELSE "~nForcePaymentBy,")
809 WHEN 1 THEN /* "CreditorRange":U
*/
810 report-options
= report-options
+ "~nCreditorRange," + STRING( INPUT fil_from
) + "," + STRING( INPUT fil_to
).
811 WHEN 2 THEN /* "ProjectRange":U
*/
812 report-options
= report-options
+ "~nProjectRange," + STRING( INPUT fil_from
) + "," + STRING( INPUT fil_to
).
813 WHEN 3 THEN /* "AccountRange":U
*/
814 report-options
= report-options
+ "~nAccountRange," + STRING( INPUT fil_acct-from
) + "," + STRING( INPUT fil_acct-to
).
815 WHEN 4 THEN /* "CreditorList":U
*/
816 report-options
= report-options
+ "~nCreditorList," + INPUT RP.Char4 .
822 report-options
= report-options
+ "~nOutputPDF".
824 RUN process
/cheq-run.p
( report-options
).
828 /* _UIB-CODE-BLOCK-END
*/
831 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
832 PROCEDURE disable_UI
:
833 /*------------------------------------------------------------------------------
834 Purpose
: DISABLE the User Interface
836 Notes
: Here we clean-up the user-interface by deleting
837 dynamic widgets we have created and
/or hide
838 frames. This procedure is usually called when
839 we are ready to
"clean-up" after running.
840 ------------------------------------------------------------------------------*/
841 /* Hide all frames.
*/
843 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
846 /* _UIB-CODE-BLOCK-END
*/
849 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE display-last-cheque-no V-table-Win
850 PROCEDURE display-last-cheque-no
:
851 /*------------------------------------------------------------------------------
853 ------------------------------------------------------------------------------*/
854 DEF VAR i
AS INT NO-UNDO.
855 DEF VAR bank-id
AS CHAR NO-UNDO.
857 DO WITH FRAME {&FRAME-NAME}:
860 i
= cmb_bnkact
:LOOKUP( cmb_bnkact
:SCREEN-VALUE ).
861 bank-id
= ENTRY( i
, cmb_bnkact
:PRIVATE-DATA ).
862 FIND BankAccount
WHERE ROWID(BankAccount
) = TO-ROWID(bank-id
) NO-LOCK NO-ERROR.
864 IF AVAILABLE(BankAccount
) THEN DO:
865 /* the Cheque.Date clause encourages Progress to choose a good index
*/
866 FIND FIRST Cheque
WHERE Cheque.BankAccountCode
= BankAccount.BankAccountCode
867 AND Cheque.Date
<= TODAY + 999 NO-LOCK NO-ERROR.
868 IF AVAILABLE(Cheque
) THEN
869 fil_LastCheque
= "(last: " + STRING(Cheque.ChequeNo
) + " " + STRING(Cheque.Date
, "99/99/9999") + ")".
872 DISPLAY fil_LastCheque.
876 /* _UIB-CODE-BLOCK-END
*/
879 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-appropriate-fields V-table-Win
880 PROCEDURE enable-appropriate-fields
:
881 /*------------------------------------------------------------------------------
882 Purpose
: Enable the apprpriate fields based on the chosen SelectionType
883 ------------------------------------------------------------------------------*/
884 DEFINE VARIABLE payment-styles
AS LOGICAL NO-UNDO INITIAL No.
886 FIND FIRST PaymentStyle
NO-LOCK NO-ERROR.
887 IF AVAILABLE(PaymentStyle
) THEN DO:
888 FIND NEXT PaymentStyle
NO-LOCK NO-ERROR.
889 payment-styles
= AVAILABLE(PaymentStyle
).
892 DO WITH FRAME {&FRAME-NAME}:
894 WHEN 1 THEN DO: /* "CreditorRange" */
895 HIDE RP.Char4 fil_acct-from fil_acct-to.
896 fil_from
:LABEL = "Creditor from".
897 VIEW fil_from fil_to.
899 WHEN 2 THEN DO: /* "ProjectRange" */
900 HIDE RP.Char4 fil_acct-from fil_acct-to.
901 fil_from
:LABEL = "Project from".
902 VIEW fil_from fil_to.
904 WHEN 3 THEN DO: /* "AccountRange" */
905 HIDE RP.Char4 fil_from fil_to.
906 VIEW fil_acct-from fil_acct-to.
908 WHEN 4 THEN DO: /* "CreditorList" */
909 HIDE fil_from fil_to fil_acct-from fil_acct-to.
914 VIEW RP.Log5 RP.Log2.
916 IF payment-styles
THEN
917 VIEW RP.Log4 cmb_PaymentStyle.
919 HIDE RP.Log4 cmb_PaymentStyle .
921 IF INPUT RP.Log5
THEN
929 /* _UIB-CODE-BLOCK-END
*/
932 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-import-file-gen V-table-Win
933 PROCEDURE enable-import-file-gen
:
934 /*------------------------------------------------------------------------------
938 ------------------------------------------------------------------------------*/
939 /* Display Import File Generation option?
*/
940 /* Payer Bank Account
*/
941 DEFINE VARIABLE item-idx
AS INTEGER NO-UNDO.
942 DEFINE VARIABLE v-bankaccount
LIKE BankAccount.BankAccount
INITIAL 0 NO-UNDO.
943 DEFINE VARIABLE v-bank
AS INTEGER INITIAL 0 NO-UNDO.
944 DEFINE VARIABLE v-branch
AS INTEGER INITIAL 0 NO-UNDO.
945 DEFINE VARIABLE v-account
AS INTEGER INITIAL 0 NO-UNDO.
946 DEFINE VARIABLE v-suffix
AS INTEGER INITIAL 0 NO-UNDO.
948 DEFINE VARIABLE v-allorone-payment-style
AS CHARACTER INITIAL ''
NO-UNDO.
949 DEFINE VARIABLE v-payment-style
AS CHARACTER INITIAL ''
NO-UNDO.
951 DO WITH FRAME {&FRAME-NAME}:
952 FIND CURRENT RP
SHARE-LOCK NO-ERROR.
954 /* Check Payer Bank Account
*/
955 item-idx
= cmb_bnkact
:LOOKUP( INPUT cmb_bnkact
).
956 IF item-idx
> 0 THEN DO:
957 FIND BankAccount
WHERE ROWID( BankAccount
) =
958 TO-ROWID( ENTRY( item-idx
, cmb_bnkact
:PRIVATE-DATA ) ) NO-LOCK NO-ERROR.
960 IF AVAILABLE BankAccount
THEN DO:
961 RUN get-bankbranchaccountsuffix
(
962 BankAccount.BankAccount
,
968 /* IF RETURN-VALUE = "FAIL" THEN RETURN "FAIL".
*/
977 /* _UIB-CODE-BLOCK-END
*/
980 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-bank-account V-table-Win
981 PROCEDURE get-bank-account
:
982 /*------------------------------------------------------------------------------
986 ------------------------------------------------------------------------------*/
988 DO WITH FRAME {&FRAME-NAME}:
990 DEF VAR item-idx
AS INT NO-UNDO.
992 item-idx
= cmb_bnkact
:LOOKUP( INPUT cmb_bnkact
).
993 IF item-idx
= 0 THEN RETURN.
995 FIND BankAccount
WHERE ROWID( BankAccount
) =
996 TO-ROWID( ENTRY( item-idx
, cmb_bnkact
:PRIVATE-DATA ) ) NO-LOCK.
1002 /* _UIB-CODE-BLOCK-END
*/
1005 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
1006 PROCEDURE inst-initialize
:
1007 /*------------------------------------------------------------------------------
1009 ------------------------------------------------------------------------------*/
1011 DEF VAR user-name
AS CHAR NO-UNDO.
1012 RUN get-username
IN sys-mgr
( OUTPUT user-name
).
1015 RP.ReportID
= {&REPORT-ID} AND
1016 RP.UserName
= user-name
1020 IF NOT AVAILABLE RP
THEN DO:
1022 ASSIGN RP.ReportID
= {&REPORT-ID}
1023 RP.UserName
= user-name .
1025 RP.Char1
= "Please forward all invoices to:~n" + Office.StreetAddress .
1040 WITH FRAME {&FRAME-NAME}.
1042 fil_from
:MODIFIED IN FRAME {&FRAME-NAME} = No.
1043 RUN dispatch
( 'display-fields'
:U
).
1044 RUN dispatch
( 'enable-fields'
:U
).
1045 RUN enable-appropriate-fields.
1046 RUN enable-import-file-gen.
1047 RUN display-last-cheque-no.
1051 /* _UIB-CODE-BLOCK-END
*/
1054 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE old-cheque-run V-table-Win
1055 PROCEDURE old-cheque-run
:
1056 /*------------------------------------------------------------------------------
1060 ------------------------------------------------------------------------------*/
1061 DEF VAR report-options
AS CHAR NO-UNDO.
1062 DEF VAR batch-no
AS INT NO-UNDO.
1063 DEF VAR start-printing
AS LOGICAL NO-UNDO INITIAL Yes.
1065 RUN get-bank-account.
1067 IF RETURN-VALUE = "FAIL" THEN RETURN RETURN-VALUE.
1069 RUN dispatch
( 'update-record'
:U
).
1071 DEF VAR print-date
AS DATE NO-UNDO.
1072 DEF VAR tran-date
AS DATE NO-UNDO.
1073 DEF VAR cheque-no
AS INT NO-UNDO.
1074 DEF VAR start-no
AS INT NO-UNDO.
1075 DEF VAR end-no
AS INT NO-UNDO.
1076 DEF VAR n-days
AS INT NO-UNDO.
1077 DEF VAR n-cheques
AS INT INIT 0 NO-UNDO.
1078 DEF VAR printed-ok
AS LOGI
NO-UNDO.
1079 DEF VAR cheque-total
AS DEC NO-UNDO.
1080 DEF VAR i
AS INT NO-UNDO.
1082 n-days
= INPUT FRAME {&FRAME-NAME} fil_due.
1083 start-no
= INPUT FRAME {&FRAME-NAME} fil_startchq.
1084 print-date
= TODAY + n-days.
1085 tran-date
= INPUT FRAME {&FRAME-NAME} fil_Date .
1087 cheque-no
= start-no.
1090 DO TRANSACTION ON ERROR UNDO cheque-run
, RETURN:
1092 /* Create the batch
*/
1095 NewBatch.BatchType
= 'NORM'
1096 NewBatch.Description
= "Cheque Batch - " + STRING( TODAY, "99/99/9999" ).
1098 batch-no
= NewBatch.BatchCode .
1099 n-cheques
= NUM-ENTRIES( creditor-list
).
1101 DO i
= 1 TO n-cheques
:
1103 FIND FIRST Creditor
WHERE Creditor.CreditorCode
= INT( ENTRY( i
, creditor-list
) )
1108 NewDocument.BatchCode
= batch-no
1109 NewDocument.DocumentType
= "CHEQ"
1110 NewDocument.Description
= Creditor.PayeeName
1111 NewDocument.Reference
= STRING( cheque-no
).
1115 Cheque.BatchCode
= batch-no
1116 Cheque.DocumentCode
= NewDocument.DocumentCode
1117 Cheque.BankAccountCode
= BankAccount.BankAccountCode
1118 Cheque.ChequeNo
= cheque-no
1119 Cheque.CreditorCode
= Creditor.CreditorCode
1120 Cheque.Date
= INPUT FRAME {&FRAME-NAME} fil_Date
1121 Cheque.PayeeName
= Creditor.PayeeName.
1124 FOR EACH Voucher
OF Creditor
WHERE
1125 Voucher.VoucherStatus
= "A" AND
1126 ( Voucher.DateDue
<= print-date
OR Voucher.DateDue
= ?
) EXCLUSIVE-LOCK:
1129 Voucher.VoucherStatus
= "P"
1130 Voucher.BankAccountCode
= Cheque.BankAccountCode
1131 Voucher.ChequeNo
= Cheque.ChequeNo
1133 cheque-total
= cheque-total
+ Voucher.GoodsValue
+ Voucher.TaxValue.
1136 /* Debit the creditor
*/
1137 CREATE NewAcctTrans.
1139 NewAcctTrans.BatchCode
= batch-no
1140 NewAcctTrans.DocumentCode
= NewDocument.DocumentCode
1141 NewAcctTrans.EntityType
= "C"
1142 NewAcctTrans.EntityCode
= Creditor.CreditorCode
1143 NewAcctTrans.AccountCode
= sundry-creditors
1144 NewAcctTrans.Amount
= cheque-total
1145 NewAcctTrans.Date
= tran-date
1146 NewAcctTrans.Description
= ""
1147 NewAcctTrans.Reference
= "".
1150 Cheque.Amount
= cheque-total.
1153 cheque-no
= cheque-no
+ 1.
1155 /* Credit the bank account
*/
1156 CREATE NewAcctTrans.
1158 NewAcctTrans.BatchCode
= batch-no
1159 NewAcctTrans.DocumentCode
= NewDocument.DocumentCode
1160 NewAcctTrans.EntityType
= "L"
1161 NewAcctTrans.EntityCode
= BankAccount.CompanyCode
1162 NewAcctTrans.AccountCode
= BankAccount.AccountCode
1163 NewAcctTrans.Amount
= cheque-total
* -1
1164 NewAcctTrans.Date
= tran-date
1165 NewAcctTrans.Description
= ""
1166 NewAcctTrans.Reference
= "".
1170 MESSAGE "There are" n-cheques
"cheques to printed." SKIP
1171 "Start printing Now ?" SKIP(2)
1172 "The printer will wait for you to insert cheque paper."
1173 VIEW-AS ALERT-BOX QUESTION BUTTONS YES-NO
1174 TITLE "Start Printing ?" UPDATE start-printing.
1176 IF NOT start-printing
THEN UNDO cheque-run
, RETURN.
1179 report-options
= "BankAccount," + BankAccount.BankAccountCode
1180 + "~nChequeRange," + STRING(start-no
) + "," + STRING(end-no
)
1181 + "~nMessage," + REPLACE( RP.Char1
, "~n", CHR(7)).
1183 report-options
= report-options
+ "~nOutputPDF".
1185 RUN process
/report
/chqprt.p
( report-options
).
1189 /* _UIB-CODE-BLOCK-END
*/
1192 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
1193 PROCEDURE pre-destroy
:
1194 /*------------------------------------------------------------------------------
1198 ------------------------------------------------------------------------------*/
1200 RUN check-modified
( "CLEAR" ).
1204 /* _UIB-CODE-BLOCK-END
*/
1207 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
1208 PROCEDURE send-records
:
1209 /*------------------------------------------------------------------------------
1210 Purpose
: Send record
ROWID's for all tables used by
1212 Parameters
: see template
/snd-head.i
1213 ------------------------------------------------------------------------------*/
1215 /* Define variables needed by this internal procedure.
*/
1216 {src
/adm
/template
/snd-head.i
}
1218 /* For each requested table
, put it's
ROWID in the output list.
*/
1219 {src
/adm
/template
/snd-list.i
"RP"}
1221 /* Deal with any unexpected table requests before closing.
*/
1222 {src
/adm
/template
/snd-end.i
}
1226 /* _UIB-CODE-BLOCK-END
*/
1229 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE sort-by-creditor-name V-table-Win
1230 PROCEDURE sort-by-creditor-name
:
1231 /*------------------------------------------------------------------------------
1235 ------------------------------------------------------------------------------*/
1237 DEF INPUT PARAMETER in-list
AS CHAR NO-UNDO.
1238 DEF OUTPUT PARAMETER out-list
AS CHAR NO-UNDO.
1240 DEF VAR sel_sort
AS HANDLE NO-UNDO.
1241 DEF VAR i
AS INT NO-UNDO.
1242 DEF VAR delim
AS CHAR NO-UNDO INIT "~~".
1243 /* HACK
- Create a selection list to do the sorting
*/
1245 CREATE SELECTION-LIST sel_sort
1247 FRAME = FRAME {&FRAME-NAME}:HANDLE
1252 sel_sort
:LIST-ITEMS = "".
1254 DO i
= 1 TO NUM-ENTRIES( in-list
):
1255 FIND Creditor
WHERE Creditor.CreditorCode
= INT( ENTRY( i
, in-list
) )
1257 IF AVAILABLE Creditor
THEN
1258 IF sel_sort
:ADD-LAST( Creditor.Name
+ "|" + ENTRY( i
, in-list
) ) THEN.
1261 DO i
= 1 TO NUM-ENTRIES( sel_sort
:LIST-ITEMS, delim
):
1262 out-list
= TRIM( out-list
+ "," + ENTRY( 2, sel_sort
:ENTRY( i
), "|" ), "," ).
1267 /* _UIB-CODE-BLOCK-END
*/
1270 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
1271 PROCEDURE state-changed
:
1272 /* -----------------------------------------------------------
1276 -------------------------------------------------------------*/
1277 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
1278 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
1281 /* Object instance CASEs can go here to replace standard behavior
1282 or add new cases.
*/
1283 {src
/adm
/template
/vstates.i
}
1287 /* _UIB-CODE-BLOCK-END
*/
1290 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-bank-accounts V-table-Win
1291 PROCEDURE update-bank-accounts
:
1292 /*------------------------------------------------------------------------------
1296 ------------------------------------------------------------------------------*/
1298 DEF VAR item
AS CHAR NO-UNDO.
1299 DEF VAR id-list
AS CHAR NO-UNDO.
1300 DEF VAR default-account
AS CHAR NO-UNDO.
1301 cmb_bnkact
:LIST-ITEMS IN FRAME {&FRAME-NAME} = "".
1303 FIND Office
WHERE Office.ThisOffice
NO-LOCK.
1304 FIND OfficeControlAccount
OF Office
WHERE OfficeControlAccount.Name
= "PYMTBANK" NO-LOCK NO-ERROR.
1306 FOR EACH BankAccount
NO-LOCK:
1307 item
= STRING( BankAccount.CompanyCode
, ">>>>9" ) + ' '
+
1308 STRING( BankAccount.AccountCode
, "9999.99" ) + ' '
+
1309 BankAccount.AccountName.
1310 IF cmb_bnkact
:ADD-LAST( item
) THEN.
1311 id-list
= id-list
+ IF id-list
= "" THEN "" ELSE ",".
1312 id-list
= id-list
+ STRING( ROWID( BankAccount
) ).
1313 IF AVAILABLE(OfficeControlAccount
) AND BankAccount.BankAccountCode
= OfficeControlAccount.Description
THEN default-account
= item.
1316 cmb_bnkact
:PRIVATE-DATA = id-list.
1317 cmb_bnkact
:SCREEN-VALUE = IF default-account
<> "" THEN default-account
ELSE
1318 ENTRY( 1, cmb_bnkact
:LIST-ITEMS ).
1319 RUN get-bank-account.
1323 /* _UIB-CODE-BLOCK-END
*/
1326 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-run V-table-Win
1327 PROCEDURE verify-run
:
1328 /*------------------------------------------------------------------------------
1330 ------------------------------------------------------------------------------*/
1331 DEF VAR print-date
AS DATE NO-UNDO.
1332 DEF VAR n-days
AS INT NO-UNDO.
1333 DEF VAR i
AS INT NO-UNDO.
1334 DEF VAR start-cheque
AS INT NO-UNDO.
1335 DEF VAR end-cheque
AS INT NO-UNDO.
1337 DO WITH FRAME {&FRAME-NAME}:
1338 start-cheque
= INPUT fil_startchq.
1339 n-days
= INPUT fil_due.
1341 print-date
= TODAY + n-days.
1343 IF start-cheque
= 0 THEN DO:
1344 MESSAGE "You must enter a starting cheque number."
1345 VIEW-AS ALERT-BOX ERROR TITLE "No starting cheque entered".
1346 APPLY '
ENTRY'
:U
TO fil_startchq.
1351 WHEN 1 THEN RUN build-creditor-range
( print-date
, OUTPUT creditor-list
).
/* "CreditorRange" */
1352 WHEN 2 THEN RUN build-project-range
( print-date
, OUTPUT creditor-list
).
/* "ProjectRange" */
1353 WHEN 3 THEN RUN build-account-range
( print-date
, OUTPUT creditor-list
).
/* "AccountRange" */
1354 WHEN 4 THEN RUN build-creditor-list
( print-date
, OUTPUT creditor-list
).
/* "CreditorList" */
1356 MESSAGE "Some form of selection must be chosen!"
1357 VIEW-AS ALERT-BOX ERROR TITLE "Select Range Type".
1358 /*APPLY '
ENTRY'
:U
TO RP.Char3.
*/
1363 RUN sort-by-creditor-name
( INPUT creditor-list
, OUTPUT creditor-list
).
1365 end-cheque
= start-cheque
+ NUM-ENTRIES( creditor-list
) - 1.
1366 IF CAN-FIND( FIRST Cheque
WHERE
1367 Cheque.BankAccountCode
= BankAccount.BankAccountCode
AND
1368 Cheque.ChequeNo
>= start-cheque
AND Cheque.ChequeNo
<= end-cheque
) THEN
1371 "Cheque numbers could not be assigned because" SKIP
1372 "one or more of the required numbers has already" SKIP
1373 "been used." SKIP(2)
1374 "You need to change the starting cheque number."
1375 VIEW-AS ALERT-BOX ERROR TITLE "Cheque numbers already allocated".
1376 APPLY '
ENTRY'
:U
TO fil_startchq
IN FRAME {&FRAME-NAME}.
1381 IF NUM-ENTRIES( creditor-list
) = 0 THEN DO:
1382 MESSAGE "There are no cheques to be printed !" VIEW-AS ALERT-BOX INFORMATION.
1388 /* _UIB-CODE-BLOCK-END
*/