Add blank column, rename column.
[capital-apms-progress.git] / process / report / chqprt.p
blob46b2cc98b2de3f2e9d5bc21ebd719cf75c9060c0
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 Print cheques
6 NOTE: this is written for an actual HP5N or HP5M printer
7 ------------------------------------------------------------------------*/
9 &SCOPED-DEFINE max-vouchers 20 /* Max that will fit in the remittance */
10 &SCOPED-DEFINE address-line 4 /* Begin the address in the this line of the remittance window */
11 &SCOPED-DEFINE message-line 17 /* Begin the message line at this line */
13 DEF INPUT PARAMETER report-options AS CHAR NO-UNDO.
14 DEF VAR bank-account LIKE Cheque.BankAccountCode NO-UNDO.
15 DEF VAR cheque-from LIKE Cheque.ChequeNo NO-UNDO.
16 DEF VAR cheque-to LIKE Cheque.ChequeNo NO-UNDO.
17 DEF VAR msg-text AS CHAR NO-UNDO.
18 DEF VAR gst-applies AS LOGI NO-UNDO.
19 DEFINE VARIABLE payment-style AS CHARACTER INITIAL '' NO-UNDO.
20 DEFINE VARIABLE bankimport-directory AS CHARACTER INITIAL '' NO-UNDO.
22 RUN parse-parameters.
24 {inc/ofc-this.i}
25 {inc/ofc-set.i "BankFileDirectory" "bank-file-directory"}
27 IF LENGTH(bankimport-directory) = 0 AND LENGTH(bank-file-directory) > 0 THEN DO:
28 bankimport-directory = bank-file-directory.
29 END.
31 IF payment-style <> "CHEQ" THEN DO:
32 RUN process/report/remittance.p ( report-options ).
33 RETURN.
34 END.
36 gst-applies = Office.GST <> ?.
37 FIND OfficeSetting OF Office WHERE OfficeSetting.SetName = "Cheque-Program" NO-LOCK NO-ERROR.
38 IF AVAILABLE(OfficeSetting) THEN DO:
39 IF OfficeSetting.SetValue <> "Default" THEN DO:
40 RUN VALUE(OfficeSetting.SetValue) ( report-options ).
41 RETURN.
42 END.
43 END.
44 {inc/ofc-set-l.i "Cheque-Usage-Summaries" "do-usage-summary"}
46 /* Report counters */
47 DEF VAR ln AS DEC INIT 0.00 NO-UNDO.
49 /* Line definitions */
51 DEF VAR date-in-words AS CHAR NO-UNDO.
52 DEF VAR creditor-address AS CHAR NO-UNDO.
54 DEF VAR reset-page AS CHAR NO-UNDO.
55 DEF VAR half-line AS CHAR NO-UNDO. half-line = CHR(27) + "=".
56 DEF VAR cheque-font AS CHAR NO-UNDO.
57 DEF VAR overrun-font AS CHAR NO-UNDO.
58 DEF VAR line-printer AS CHAR NO-UNDO.
60 DEF VAR rows AS DEC NO-UNDO.
61 DEF VAR cols AS DEC NO-UNDO.
63 DEF VAR page-no AS INT NO-UNDO.
64 DEF VAR voucher-details AS CHAR NO-UNDO.
65 DEF VAR n-vouchers AS INT NO-UNDO.
67 /* HP Printer Bin Assignments */
69 &SCOPED-DEFINE PRIORITY 0 /* Prioirty - Manual Feed, Tray2, Tray3 */
70 &SCOPED-DEFINE TRAY_2 1 /* Tray 2 only */
71 &SCOPED-DEFINE MANUAL_FEED_A4 2 /* Manual Feed A$ Tray 1 */
72 &SCOPED-DEFINE MANUAL_FEED_ENV 3 /* Maunal Feed Envelope Tray 1 */
73 &SCOPED-DEFINE PRIORITY_2 4 /* Priority - Tray2, Tray3 */
74 &SCOPED-DEFINE TRAY_3 5 /* Tray 3 only */
76 {inc/ofc-set.i "TrayForCheques" "cheque-tray"}
77 IF NOT AVAILABLE(OfficeSetting) THEN cheque-tray = "{&MANUAL_FEED_A4}" .
78 {inc/ofc-set.i "TrayForPlain" "plain-tray"}
79 IF NOT AVAILABLE(OfficeSetting) THEN plain-tray = "{&TRAY_2}" .
81 /* _UIB-CODE-BLOCK-END */
82 &ANALYZE-RESUME
85 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
87 /* ******************** Preprocessor Definitions ******************** */
89 &Scoped-define PROCEDURE-TYPE Procedure
90 &Scoped-define DB-AWARE no
94 /* _UIB-PREPROCESSOR-BLOCK-END */
95 &ANALYZE-RESUME
98 /* ************************ Function Prototypes ********************** */
100 &IF DEFINED(EXCLUDE-switch-bin) = 0 &THEN
102 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD switch-bin Procedure
103 FUNCTION switch-bin RETURNS CHARACTER
104 ( INPUT bin-id AS INT ) FORWARD.
106 /* _UIB-CODE-BLOCK-END */
107 &ANALYZE-RESUME
109 &ENDIF
112 /* *********************** Procedure Settings ************************ */
114 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
115 /* Settings for THIS-PROCEDURE
116 Type: Procedure
117 Allow:
118 Frames: 0
119 Add Fields to: Neither
120 Other Settings: CODE-ONLY COMPILE
122 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
124 /* ************************* Create Window ************************** */
126 &ANALYZE-SUSPEND _CREATE-WINDOW
127 /* DESIGN Window definition (used by the UIB)
128 CREATE WINDOW Procedure ASSIGN
129 HEIGHT = .1
130 WIDTH = 39.57.
131 /* END WINDOW DEFINITION */
133 &ANALYZE-RESUME
135 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
136 /* ************************* Included-Libraries *********************** */
138 {inc/method/m-sysmgr.i}
139 {inc/method/m-txtrep.i}
140 {inc/convert.i}
142 /* _UIB-CODE-BLOCK-END */
143 &ANALYZE-RESUME
149 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
152 /* *************************** Main Block *************************** */
154 DEF VAR preview AS LOGI INIT No NO-UNDO.
156 RUN get-control-strings.
157 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES PAGE-SIZE 0.
159 RUN print-cheques.
161 OUTPUT CLOSE.
162 RUN view-output-file ( preview ).
164 /* _UIB-CODE-BLOCK-END */
165 &ANALYZE-RESUME
168 /* ********************** Internal Procedures *********************** */
170 &IF DEFINED(EXCLUDE-carriage-return) = 0 &THEN
172 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE carriage-return Procedure
173 PROCEDURE carriage-return :
174 /*------------------------------------------------------------------------------
175 Purpose:
176 Parameters: <none>
177 Notes:
178 ------------------------------------------------------------------------------*/
180 PUT CONTROL CHR(13).
182 END PROCEDURE.
184 /* _UIB-CODE-BLOCK-END */
185 &ANALYZE-RESUME
187 &ENDIF
189 &IF DEFINED(EXCLUDE-cheque-details) = 0 &THEN
191 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE cheque-details Procedure
192 PROCEDURE cheque-details :
193 /*------------------------------------------------------------------------------
194 Purpose:
195 Parameters: <none>
196 Notes:
197 ------------------------------------------------------------------------------*/
199 DEF VAR date-in-words AS CHAR NO-UNDO.
200 DEF VAR sum-in-words AS CHAR NO-UNDO.
201 DEF VAR i AS INT NO-UNDO.
203 RUN date-to-word( Cheque.Date, OUTPUT date-in-words ).
204 RUN amount-to-word( Cheque.Amount, OUTPUT sum-in-words ).
205 RUN word-wrap( sum-in-words, 60, OUTPUT sum-in-words ).
206 SUBSTR( sum-in-words, 1, 1 ) = CAPS( SUBSTR( sum-in-words, 1, 1 ) ).
208 PUT CONTROL line-printer. RUN pcl-moveto( 95.5, 5 ). PUT CONTROL cheque-font.
209 PUT UNFORMATTED Cheque.PayeeName.
211 PUT CONTROL line-printer. RUN pcl-moveto( 96.5, 101 ). PUT CONTROL cheque-font.
212 PUT UNFORMATTED date-in-words.
214 PUT CONTROL line-printer. RUN pcl-moveto( 100,107 ). PUT CONTROL cheque-font.
215 PUT UNFORMATTED STRING( Cheque.Amount, "$>>,>>>,>>9.99" ).
217 DO i = 1 TO NUM-ENTRIES( sum-in-words, "~n" ):
218 PUT CONTROL line-printer. RUN pcl-moveto( 100 + ( i - 1 ) * 1.5, 5 ). PUT CONTROL cheque-font.
219 PUT UNFORMATTED ENTRY( i, sum-in-words, "~n" ).
220 END.
222 END PROCEDURE.
224 /* _UIB-CODE-BLOCK-END */
225 &ANALYZE-RESUME
227 &ENDIF
229 &IF DEFINED(EXCLUDE-each-cheque) = 0 &THEN
231 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-cheque Procedure
232 PROCEDURE each-cheque :
233 /*------------------------------------------------------------------------------
234 Purpose:
235 Parameters: <none>
236 Notes:
237 ------------------------------------------------------------------------------*/
239 RUN reset-page.
240 switch-bin( INTEGER(cheque-tray) ).
242 RUN get-creditor-address.
243 RUN get-voucher-details.
245 RUN payment-header.
246 RUN print-advice( 15, 10, "" ).
247 RUN remittance-header.
248 RUN print-advice( 56, 10, msg-text ).
250 RUN cheque-details.
251 RUN page-feed.
253 IF n-vouchers > {&max-vouchers} THEN RUN print-secondary-advice.
255 END PROCEDURE.
257 /* _UIB-CODE-BLOCK-END */
258 &ANALYZE-RESUME
260 &ENDIF
262 &IF DEFINED(EXCLUDE-get-bank-account) = 0 &THEN
264 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-bank-account Procedure
265 PROCEDURE get-bank-account :
266 /*------------------------------------------------------------------------------
267 Purpose:
268 Parameters: <none>
269 Notes:
270 ------------------------------------------------------------------------------*/
272 FIND FIRST BankAccount WHERE BankAccount.BankAccountCode = bank-account
273 NO-LOCK NO-ERROR.
274 IF NOT AVAILABLE BankAccount THEN RETURN "FAIL".
276 END PROCEDURE.
278 /* _UIB-CODE-BLOCK-END */
279 &ANALYZE-RESUME
281 &ENDIF
283 &IF DEFINED(EXCLUDE-get-control-strings) = 0 &THEN
285 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-control-strings Procedure
286 PROCEDURE get-control-strings :
287 /*------------------------------------------------------------------------------
288 Purpose: Get all control strings for this report
289 Parameters: <none>
290 Notes:
291 ------------------------------------------------------------------------------*/
293 RUN make-control-string( "PCL", "reset,simplex,portrait,a4,tm,0,lm,6",
294 OUTPUT reset-page, OUTPUT rows, OUTPUT cols ).
296 RUN make-control-string( "PCL", "LinePrinter,lpi,9.54",
297 OUTPUT line-printer, OUTPUT rows, OUTPUT cols ).
299 RUN make-control-string( "PCL", "Courier,cpi,12",
300 OUTPUT cheque-font, OUTPUT rows, OUTPUT cols ).
302 RUN make-control-string( "PCL", "Proportional,times,bold,point,18",
303 OUTPUT overrun-font, OUTPUT rows, OUTPUT cols ).
305 END PROCEDURE.
307 /* _UIB-CODE-BLOCK-END */
308 &ANALYZE-RESUME
310 &ENDIF
312 &IF DEFINED(EXCLUDE-get-creditor-address) = 0 &THEN
314 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-creditor-address Procedure
315 PROCEDURE get-creditor-address :
316 /*------------------------------------------------------------------------------
317 Purpose:
318 Parameters: <none>
319 Notes:
320 ------------------------------------------------------------------------------*/
322 DEF VAR i AS INT NO-UNDO.
323 DEF VAR addr_string AS CHAR NO-UNDO.
325 creditor-address = "".
327 FIND FIRST Voucher WHERE
328 Voucher.BankAccountCode = Cheque.BankAccountCode AND
329 Voucher.ChequeNo = Cheque.ChequeNo
330 NO-LOCK.
332 FIND FIRST Creditor OF Voucher NO-LOCK.
333 RUN process/getaddr.p( "C", Creditor.CreditorCode, "PYMT,POST,MAIN",
334 OUTPUT creditor-address ).
336 END PROCEDURE.
338 /* _UIB-CODE-BLOCK-END */
339 &ANALYZE-RESUME
341 &ENDIF
343 &IF DEFINED(EXCLUDE-get-voucher-details) = 0 &THEN
345 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-voucher-details Procedure
346 PROCEDURE get-voucher-details :
347 /*------------------------------------------------------------------------------
348 Purpose:
349 Parameters: <none>
350 Notes:
351 ------------------------------------------------------------------------------*/
353 voucher-details = "".
354 n-vouchers = 0.
356 FOR EACH Voucher NO-LOCK WHERE
357 Voucher.BankAccountCode = Cheque.BankAccountCode AND
358 Voucher.ChequeNo = Cheque.ChequeNo BREAK BY Voucher.VoucherSeq:
360 voucher-details = voucher-details + IF voucher-details = "" THEN "" ELSE "~n".
362 voucher-details = voucher-details +
363 STRING( Voucher.Date, "99/99/99" ) + "|" +
364 STRING( Voucher.VoucherSeq, ">>99999" ) + "|" +
365 STRING( Voucher.InvoiceReference, "X(15)" ) + "|" +
366 STRING( Voucher.GoodsValue + Voucher.TaxValue, ">>,>>>,>>9.99CR" ).
368 END.
370 n-vouchers = NUM-ENTRIES( voucher-details, "~n" ).
372 END PROCEDURE.
374 /* _UIB-CODE-BLOCK-END */
375 &ANALYZE-RESUME
377 &ENDIF
379 &IF DEFINED(EXCLUDE-page-feed) = 0 &THEN
381 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
382 PROCEDURE page-feed :
383 /*------------------------------------------------------------------------------
384 Purpose:
385 Parameters: <none>
386 Notes:
387 ------------------------------------------------------------------------------*/
389 PUT CONTROL CHR(12).
390 page-no = page-no + 1.
392 END PROCEDURE.
394 /* _UIB-CODE-BLOCK-END */
395 &ANALYZE-RESUME
397 &ENDIF
399 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
401 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
402 PROCEDURE parse-parameters :
403 /*------------------------------------------------------------------------------
404 Purpose:
405 Parameters: <none>
406 Notes:
407 ------------------------------------------------------------------------------*/
408 DEF VAR i AS INT NO-UNDO.
409 DEF VAR token AS CHAR NO-UNDO.
411 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
412 token = ENTRY( i, report-options, "~n" ).
413 CASE( ENTRY( 1, token ) ):
414 WHEN "BankAccount" THEN bank-account = TRIM(ENTRY(2,token)).
415 WHEN "Message" THEN msg-text = REPLACE( SUBSTRING(token,9), CHR(7), "~n").
417 WHEN "ChequeRange" THEN ASSIGN
418 cheque-from = INT(ENTRY(2,token))
419 cheque-to = INT(ENTRY(3,token)).
421 WHEN "PaymentStyle" THEN payment-style = ENTRY(2,token).
423 END CASE.
424 END.
426 END PROCEDURE.
428 /* _UIB-CODE-BLOCK-END */
429 &ANALYZE-RESUME
431 &ENDIF
433 &IF DEFINED(EXCLUDE-payment-header) = 0 &THEN
435 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE payment-header Procedure
436 PROCEDURE payment-header :
437 /*------------------------------------------------------------------------------
438 Purpose:
439 Parameters: <none>
440 Notes:
441 ------------------------------------------------------------------------------*/
443 PUT CONTROL line-printer.
444 RUN pcl-moveto( 5, 113 ).
445 PUT UNFORMATTED STRING( Cheque.ChequeNo, "999999" ).
446 RUN pcl-moveto( 7, 109 ).
447 PUT UNFORMATTED STRING( Cheque.Date, "99/99/9999" ).
449 END PROCEDURE.
451 /* _UIB-CODE-BLOCK-END */
452 &ANALYZE-RESUME
454 &ENDIF
456 &IF DEFINED(EXCLUDE-print-advice) = 0 &THEN
458 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-advice Procedure
459 PROCEDURE print-advice :
460 /*------------------------------------------------------------------------------
461 Purpose:
462 ------------------------------------------------------------------------------*/
463 DEF INPUT PARAMETER base-row AS DEC NO-UNDO.
464 DEF INPUT PARAMETER base-col AS DEC NO-UNDO.
465 DEF INPUT PARAMETER msg-text AS CHAR NO-UNDO.
467 DEF VAR i AS INT NO-UNDO.
468 DEF VAR voucher-line AS CHAR NO-UNDO.
469 DEF VAR voucher-base AS DEC NO-UNDO.
471 /* Print the address */
473 DO i = 1 TO NUM-ENTRIES( creditor-address, "~n" ):
474 RUN pcl-moveto( base-row + i - 1 + {&address-line}, base-col ).
475 PUT UNFORMATTED ENTRY( i, creditor-address, "~n" ).
476 END.
478 /* Print the details */
480 IF n-vouchers > {&max-vouchers} THEN
482 RUN pcl-moveto( base-row + 3, base-col + 60 ).
483 PUT CONTROL overrun-font.
484 PUT UNFORMATTED "SEE ATTACHED SHEET".
485 PUT CONTROL line-printer.
486 END.
487 ELSE
490 /* Print the vouchers */
492 voucher-base = base-col + 55.
494 DO i = 1 TO NUM-ENTRIES( voucher-details, "~n" ):
495 RUN pcl-moveto( base-row + i - 1, voucher-base ).
496 voucher-line = ENTRY( i, voucher-details, "~n" ).
497 PUT UNFORMATTED
498 ENTRY( 1, voucher-line, "|" ) SPACE(7)
499 ENTRY( 2, voucher-line, "|" ) SPACE(10)
500 ENTRY( 3, voucher-line, "|" ) SPACE(2)
501 ENTRY( 4, voucher-line, "|" ).
502 END.
504 END.
506 /* Print the total */
507 PUT CONTROL line-printer.
508 RUN pcl-moveto( base-row + 21, base-col + 103 ).
509 PUT UNFORMATTED STRING( Cheque.Amount, ">>,>>>,>>9.99CR" ).
511 /* Print the message */
513 IF msg-text <> "" THEN
514 DO i = 1 TO NUM-ENTRIES( msg-text, "~n" ):
515 RUN pcl-moveto( base-row + {&message-line} + i - 1, base-col ).
516 PUT UNFORMATTED ENTRY( i, msg-text, "~n" ).
517 END.
519 END PROCEDURE.
521 /* _UIB-CODE-BLOCK-END */
522 &ANALYZE-RESUME
524 &ENDIF
526 &IF DEFINED(EXCLUDE-print-cheques) = 0 &THEN
528 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-cheques Procedure
529 PROCEDURE print-cheques :
530 /*------------------------------------------------------------------------------
531 Purpose:
532 ------------------------------------------------------------------------------*/
534 RUN get-bank-account.
535 IF RETURN-VALUE = 'FAIL' THEN RETURN.
537 FOR EACH Cheque NO-LOCK WHERE
538 Cheque.BankAccountCode = BankAccount.BankAccountCode AND
539 Cheque.ChequeNo >= cheque-from AND
540 Cheque.ChequeNo <= cheque-to AND NOT Cheque.Cancelled:
542 FIND FIRST Voucher WHERE Voucher.BankAccountCode = Cheque.BankAccountCode
543 AND Voucher.ChequeNo = Cheque.ChequeNo NO-LOCK NO-ERROR.
545 IF Voucher.PaymentStyle = payment-style THEN
546 RUN each-cheque.
548 END.
550 IF do-usage-summary <> No THEN RUN print-usage-summary.
552 END PROCEDURE.
554 /* _UIB-CODE-BLOCK-END */
555 &ANALYZE-RESUME
557 &ENDIF
559 &IF DEFINED(EXCLUDE-print-secondary-advice) = 0 &THEN
561 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-secondary-advice Procedure
562 PROCEDURE print-secondary-advice :
563 /*------------------------------------------------------------------------------
564 Purpose:
565 Parameters: <none>
566 Notes:
567 ------------------------------------------------------------------------------*/
569 &SCOP PAGE-LINES 90
571 DEF VAR a-pn AS INT NO-UNDO INIT 1.
572 DEF VAR a-ln AS INT NO-UNDO.
573 DEF VAR i AS INT NO-UNDO.
574 DEF VAR voucher-line AS CHAR NO-UNDO.
576 RUN secondary-advice-header( a-pn ).
578 DO i = 1 TO NUM-ENTRIES( voucher-details, "~n" ):
580 voucher-line = ENTRY( i, voucher-details, "~n" ).
581 PUT UNFORMATTED SPACE(10)
582 ENTRY( 1, voucher-line, "|" ) SPACE(9)
583 ENTRY( 2, voucher-line, "|" ) SPACE(7)
584 ENTRY( 3, voucher-line, "|" ) SPACE(4)
585 ENTRY( 4, voucher-line, "|" ).
586 RUN skip-line(1).
588 a-ln = a-ln + 1.
590 IF a-ln >= {&PAGE-LINES} THEN
592 a-pn = a-pn + 1.
593 a-ln = 0.
594 RUN page-feed.
595 RUN secondary-advice-header( a-pn ).
596 END.
598 END.
600 PUT SKIP.
601 PUT UNFORMATTED
602 SPACE( 50 ) " " FILL( "-", 13 ) SKIP
603 SPACE( 50 ) "Total " STRING( Cheque.Amount, ">>,>>>,>>9.99" ) SKIP
604 SPACE( 50 ) " " FILL( "=", 13 ) SKIP.
606 RUN page-feed.
608 END PROCEDURE.
610 /* _UIB-CODE-BLOCK-END */
611 &ANALYZE-RESUME
613 &ENDIF
615 &IF DEFINED(EXCLUDE-print-usage-summary) = 0 &THEN
617 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-usage-summary Procedure
618 PROCEDURE print-usage-summary :
619 /*------------------------------------------------------------------------------
620 Purpose:
621 Parameters: <none>
622 Notes:
623 ------------------------------------------------------------------------------*/
625 DEF VAR s-ln AS INT NO-UNDO.
626 DEF VAR s-pn AS INT INIT 1 NO-UNDO.
627 DEF VAR summary-total AS DEC NO-UNDO.
628 DEF VAR page-lines AS INT NO-UNDO.
630 RUN usage-summary-header( s-pn, OUTPUT page-lines ).
632 FOR EACH Cheque NO-LOCK WHERE
633 Cheque.BankAccountCode = bank-account AND
634 Cheque.ChequeNo >= cheque-from AND
635 Cheque.ChequeNo <= cheque-to,
636 FIRST Creditor OF Cheque NO-LOCK:
638 PUT UNFORMATTED
639 STRING( Cheque.ChequeNo, "999999" ) SPACE(5)
640 STRING( Cheque.CreditorCode, ">>>>>9" ) SPACE(3)
641 STRING( Creditor.Name, "X(50)" ) SPACE(9)
642 STRING( Cheque.Amount, ">,>>>,>>>,>>9.99" ).
643 RUN skip-line(1).
645 summary-total = summary-total + Cheque.Amount.
647 s-ln = s-ln + 1.
648 IF s-ln >= page-lines THEN
650 s-pn = s-pn + 1.
651 s-ln = 0.
652 RUN page-feed.
653 RUN usage-summary-header( s-pn, OUTPUT page-lines ).
654 END.
656 END.
658 PUT UNFORMATTED
659 SPACE(80) "---------------" SKIP
660 SPACE(79) STRING( summary-total, ">,>>>,>>>,>>9.99" ) SKIP
661 SPACE(80) "===============".
663 /* eject page and decisively set back to internal bin */
664 RUN reset-page.
665 switch-bin( INTEGER(plain-tray) ).
668 END PROCEDURE.
670 /* _UIB-CODE-BLOCK-END */
671 &ANALYZE-RESUME
673 &ENDIF
675 &IF DEFINED(EXCLUDE-remittance-header) = 0 &THEN
677 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE remittance-header Procedure
678 PROCEDURE remittance-header :
679 /*------------------------------------------------------------------------------
680 Purpose:
681 Parameters: <none>
682 Notes:
683 ------------------------------------------------------------------------------*/
685 RUN pcl-moveto( 46, 109 ).
686 PUT UNFORMATTED STRING( Cheque.Date, "99/99/9999" ).
687 RUN pcl-moveto( 47.5, 113 ).
688 PUT UNFORMATTED STRING( Cheque.ChequeNo, "999999" ).
690 END PROCEDURE.
692 /* _UIB-CODE-BLOCK-END */
693 &ANALYZE-RESUME
695 &ENDIF
697 &IF DEFINED(EXCLUDE-reset-page) = 0 &THEN
699 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
700 PROCEDURE reset-page :
701 /*------------------------------------------------------------------------------
702 Purpose:
703 Parameters: <none>
704 Notes:
705 ------------------------------------------------------------------------------*/
707 PUT CONTROL reset-page.
708 ln = 0.
710 END PROCEDURE.
712 /* _UIB-CODE-BLOCK-END */
713 &ANALYZE-RESUME
715 &ENDIF
717 &IF DEFINED(EXCLUDE-secondary-advice-header) = 0 &THEN
719 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE secondary-advice-header Procedure
720 PROCEDURE secondary-advice-header :
721 /*------------------------------------------------------------------------------
722 Purpose:
723 Parameters: <none>
724 Notes:
725 ------------------------------------------------------------------------------*/
727 DEF INPUT PARAMETER page-no AS INT NO-UNDO.
729 DEF VAR head-font AS CHAR NO-UNDO.
731 RUN reset-page.
732 switch-bin( INTEGER(plain-tray) ).
734 RUN make-control-string( "PCL", "Proportional,Times,Bold,Point,18", OUTPUT head-font, OUTPUT rows, OUTPUT cols ).
736 PUT CONTROL line-printer.
737 RUN skip-line(4).
739 PUT CONTROL head-font.
740 PUT UNFORMATTED SPACE(30) "Remittance Advice".
741 RUN skip-line(2).
743 PUT CONTROL line-printer.
744 PUT UNFORMATTED SPACE(8) "Cheque No: " + STRING( Cheque.ChequeNo, ">>>>999999" ). RUN skip-line(1).
745 PUT UNFORMATTED SPACE(8) "Payment Date: " + STRING( Cheque.Date, "99/99/9999" ). RUN skip-line(1).
746 PUT UNFORMATTED SPACE(8) "Page: " + STRING( page-no, ">>>>>>>>>9" ). RUN skip-line(2).
747 PUT UNFORMATTED SPACE(12) "Date" SPACE(8)
748 "Reference" SPACE(6)
749 "Inv.Ref" SPACE(19)
750 "Amount". RUN skip-line(2).
752 END PROCEDURE.
754 /* _UIB-CODE-BLOCK-END */
755 &ANALYZE-RESUME
757 &ENDIF
759 &IF DEFINED(EXCLUDE-skip-line) = 0 &THEN
761 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
762 PROCEDURE skip-line :
763 /*------------------------------------------------------------------------------
764 Purpose:
765 Parameters: <none>
766 Notes:
767 ------------------------------------------------------------------------------*/
769 DEF INPUT PARAMETER n AS DEC NO-UNDO.
771 DEF VAR int-part AS INT NO-UNDO.
772 DEF VAR dec-part AS DEC NO-UNDO.
774 int-part = TRUNCATE( n, 0 ).
775 IF int-part < 0 THEN RETURN.
776 dec-part = n - int-part.
777 IF int-part = 0 AND dec-part = 0 THEN RETURN.
779 /* Need to have this like the following - do not touch */
780 IF int-part <> 0 THEN PUT CONTROL FILL( CHR(10), int-part ).
781 IF dec-part <> 0 THEN PUT CONTROL half-line.
783 ln = ln + n.
785 RUN carriage-return.
787 END PROCEDURE.
789 /* _UIB-CODE-BLOCK-END */
790 &ANALYZE-RESUME
792 &ENDIF
794 &IF DEFINED(EXCLUDE-usage-summary-header) = 0 &THEN
796 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE usage-summary-header Procedure
797 PROCEDURE usage-summary-header :
798 /*------------------------------------------------------------------------------
799 Purpose:
800 Parameters: <none>
801 Notes:
802 ------------------------------------------------------------------------------*/
804 &SCOP PAGE-LINES 90
806 DEF INPUT PARAMETER page-no AS INT NO-UNDO.
807 DEF OUTPUT PARAMETER page-lines AS INT NO-UNDO.
809 DEF VAR user-name AS CHAR NO-UNDO.
810 DEF VAR date-font AS CHAR NO-UNDO.
811 DEF VAR head-font AS CHAR NO-UNDO.
812 DEF VAR bank-font AS CHAR NO-UNDO.
814 page-lines = {&PAGE-LINES}.
815 RUN reset-page.
816 switch-bin( INTEGER(plain-tray) ).
818 RUN make-control-string( "PCL", "Proportional,Times,Bold,Point,8", OUTPUT date-font, OUTPUT rows, OUTPUT cols ).
819 RUN make-control-string( "PCL", "Proportional,Times,Bold,Point,18", OUTPUT head-font, OUTPUT rows, OUTPUT cols ).
820 RUN make-control-string( "PCL", "Proportional,Times,Bold,Point,8", OUTPUT bank-font, OUTPUT rows, OUTPUT cols ).
821 RUN get-username IN sys-mgr( OUTPUT user-name ).
823 PUT CONTROL line-printer. RUN skip-line(4).
824 PUT CONTROL date-font.
826 PUT UNFORMATTED "Printed at " + STRING( TIME, "HH:MM:SS" ) + ", " + STRING( TODAY, "99/99/9999" ) + " for " + user-name.
827 RUN carriage-return.
828 PUT UNFORMATTED SPACE( 180 ) "Page " + STRING(page-no).
829 RUN skip-line(4).
831 PUT CONTROL head-font.
832 PUT UNFORMATTED SPACE(26) "Cheque Usage Summary".
833 RUN skip-line(4).
835 IF AVAILABLE BankAccount THEN
837 PUT CONTROL bank-font.
838 PUT UNFORMATTED
839 "(L" + STRING( BankAccount.CompanyCode, "9999" ) + " - " +
840 STRING( BankAccount.AccountCode, "9999.99" ) + ") " +
841 BankAccount.BankName + ", " +
842 BankAccount.BankBranchName + ", " +
843 BankAccount.AccountName + " " +
844 "(" + STRING( BankAccount.BankAccount ) + ")".
845 PUT CONTROL line-printer.
846 RUN skip-line(3).
847 page-lines = page-lines - 3.
848 END.
850 PUT UNFORMATTED
851 "Cheque #" SPACE(2)
852 "Creditor" SPACE(2)
853 "Name" SPACE(65)
854 "Amount".
855 RUN skip-line(3).
857 END PROCEDURE.
859 /* _UIB-CODE-BLOCK-END */
860 &ANALYZE-RESUME
862 &ENDIF
864 /* ************************ Function Implementations ***************** */
866 &IF DEFINED(EXCLUDE-switch-bin) = 0 &THEN
868 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION switch-bin Procedure
869 FUNCTION switch-bin RETURNS CHARACTER
870 ( INPUT bin-id AS INT ) :
871 /*------------------------------------------------------------------------------
872 Purpose:
873 Notes:
874 ------------------------------------------------------------------------------*/
876 DEF VAR bin-ctrl AS CHAR NO-UNDO.
877 DEF VAR rows AS DEC NO-UNDO.
878 DEF VAR cols AS DEC NO-UNDO.
880 RUN make-control-string( "PCL", "bin," + STRING( bin-id ), OUTPUT bin-ctrl,
881 OUTPUT rows, OUTPUT cols ).
882 PUT CONTROL bin-ctrl.
884 RETURN "". /* Function return value. */
886 END FUNCTION.
888 /* _UIB-CODE-BLOCK-END */
889 &ANALYZE-RESUME
891 &ENDIF