Add blank column, rename column.
[capital-apms-progress.git] / process / report / cheque-ppg.p
blob465cf8f83f04159ae1f8461eea4547f8d023900f
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 a PCL5 compatible 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 IF LENGTH(bankimport-directory) > 0 THEN DO:
25 RUN process/report/remittance.p ( report-options ).
26 RETURN.
27 END.
29 {inc/ofc-this.i}
30 gst-applies = Office.GST <> ?.
31 {inc/ofc-set-l.i "Cheque-Usage-Summaries" "do-usage-summary"}
33 /* Report counters */
34 DEF VAR ln AS DEC INIT 0.00 NO-UNDO.
36 /* Line definitions */
38 DEF VAR date-in-words AS CHAR NO-UNDO.
39 DEF VAR creditor-address AS CHAR NO-UNDO.
41 DEF VAR reset-page AS CHAR NO-UNDO.
42 DEF VAR half-line AS CHAR NO-UNDO. half-line = CHR(27) + "=".
43 DEF VAR cheque-font AS CHAR NO-UNDO.
44 DEF VAR overrun-font AS CHAR NO-UNDO.
45 DEF VAR line-printer AS CHAR NO-UNDO.
47 DEF VAR rows AS DEC NO-UNDO.
48 DEF VAR cols AS DEC NO-UNDO.
50 DEF VAR page-no AS INT NO-UNDO.
51 DEF VAR voucher-details AS CHAR NO-UNDO.
52 DEF VAR n-vouchers AS INT NO-UNDO.
54 /* HP Printer Bin Assignments */
56 &SCOPED-DEFINE PRIORITY 0 /* Prioirty - Manual Feed, Tray2, Tray3 */
57 &SCOPED-DEFINE TRAY_2 1 /* Tray 2 only */
58 &SCOPED-DEFINE MANUAL_FEED_A4 2 /* Manual Feed A$ Tray 1 */
59 &SCOPED-DEFINE MANUAL_FEED_ENV 3 /* Maunal Feed Envelope Tray 1 */
60 &SCOPED-DEFINE PRIORITY_2 4 /* Priority - Tray2, Tray3 */
61 &SCOPED-DEFINE TRAY_3 5 /* Tray 3 only */
63 {inc/ofc-set.i "TrayForCheques" "cheque-tray"}
64 IF NOT AVAILABLE(OfficeSetting) THEN cheque-tray = "{&MANUAL_FEED_A4}" .
65 {inc/ofc-set.i "TrayForPlain" "plain-tray"}
66 IF NOT AVAILABLE(OfficeSetting) THEN plain-tray = "{&TRAY_2}" .
68 /* _UIB-CODE-BLOCK-END */
69 &ANALYZE-RESUME
72 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
74 /* ******************** Preprocessor Definitions ******************** */
76 &Scoped-define PROCEDURE-TYPE Procedure
77 &Scoped-define DB-AWARE no
81 /* _UIB-PREPROCESSOR-BLOCK-END */
82 &ANALYZE-RESUME
85 /* ************************ Function Prototypes ********************** */
87 &IF DEFINED(EXCLUDE-switch-bin) = 0 &THEN
89 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD switch-bin Procedure
90 FUNCTION switch-bin RETURNS CHARACTER
91 ( INPUT bin-id AS INT ) FORWARD.
93 /* _UIB-CODE-BLOCK-END */
94 &ANALYZE-RESUME
96 &ENDIF
99 /* *********************** Procedure Settings ************************ */
101 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
102 /* Settings for THIS-PROCEDURE
103 Type: Procedure
104 Allow:
105 Frames: 0
106 Add Fields to: Neither
107 Other Settings: CODE-ONLY COMPILE
109 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
111 /* ************************* Create Window ************************** */
113 &ANALYZE-SUSPEND _CREATE-WINDOW
114 /* DESIGN Window definition (used by the UIB)
115 CREATE WINDOW Procedure ASSIGN
116 HEIGHT = 20.85
117 WIDTH = 39.57.
118 /* END WINDOW DEFINITION */
120 &ANALYZE-RESUME
122 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
123 /* ************************* Included-Libraries *********************** */
125 {inc/method/m-sysmgr.i}
126 {inc/method/m-txtrep.i}
127 {inc/convert.i}
129 /* _UIB-CODE-BLOCK-END */
130 &ANALYZE-RESUME
136 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
139 /* *************************** Main Block *************************** */
141 DEF VAR preview AS LOGI INIT No NO-UNDO.
143 RUN get-control-strings.
144 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES PAGE-SIZE 0.
146 RUN print-cheques.
148 OUTPUT CLOSE.
149 RUN view-output-file ( preview ).
151 /* _UIB-CODE-BLOCK-END */
152 &ANALYZE-RESUME
155 /* ********************** Internal Procedures *********************** */
157 &IF DEFINED(EXCLUDE-carriage-return) = 0 &THEN
159 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE carriage-return Procedure
160 PROCEDURE carriage-return :
161 /*------------------------------------------------------------------------------
162 Purpose:
163 Parameters: <none>
164 Notes:
165 ------------------------------------------------------------------------------*/
167 PUT CONTROL CHR(13).
169 END PROCEDURE.
171 /* _UIB-CODE-BLOCK-END */
172 &ANALYZE-RESUME
174 &ENDIF
176 &IF DEFINED(EXCLUDE-cheque-details) = 0 &THEN
178 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE cheque-details Procedure
179 PROCEDURE cheque-details :
180 /*------------------------------------------------------------------------------
181 Purpose:
182 Parameters: <none>
183 Notes:
184 ------------------------------------------------------------------------------*/
186 DEF VAR date-in-words AS CHAR NO-UNDO.
187 DEF VAR sum-in-words AS CHAR NO-UNDO.
188 DEF VAR i AS INT NO-UNDO.
190 RUN date-to-word( Cheque.Date, OUTPUT date-in-words ).
191 RUN amount-to-word( Cheque.Amount, OUTPUT sum-in-words ).
192 RUN word-wrap( sum-in-words, 60, OUTPUT sum-in-words ).
193 SUBSTR( sum-in-words, 1, 1 ) = CAPS( SUBSTR( sum-in-words, 1, 1 ) ).
195 PUT CONTROL line-printer. RUN pcl-moveto( 96, 8 ). PUT CONTROL cheque-font.
196 PUT UNFORMATTED Cheque.PayeeName.
198 PUT CONTROL line-printer. RUN pcl-moveto( 91, 101 ). PUT CONTROL cheque-font.
199 PUT UNFORMATTED date-in-words.
201 PUT CONTROL line-printer. RUN pcl-moveto( 100,105 ). PUT CONTROL cheque-font.
202 PUT UNFORMATTED STRING( Cheque.Amount, "$>>,>>>,>>9.99" ).
204 DO i = 1 TO NUM-ENTRIES( sum-in-words, "~n" ):
205 PUT CONTROL line-printer. RUN pcl-moveto( 102 + ( i - 1 ) * 1.5, 5 ). PUT CONTROL cheque-font.
206 PUT UNFORMATTED ENTRY( i, sum-in-words, "~n" ).
207 END.
209 END PROCEDURE.
211 /* _UIB-CODE-BLOCK-END */
212 &ANALYZE-RESUME
214 &ENDIF
216 &IF DEFINED(EXCLUDE-each-cheque) = 0 &THEN
218 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-cheque Procedure
219 PROCEDURE each-cheque :
220 /*------------------------------------------------------------------------------
221 Purpose:
222 Parameters: <none>
223 Notes:
224 ------------------------------------------------------------------------------*/
226 RUN reset-page.
227 switch-bin( INTEGER(cheque-tray) ).
229 RUN get-creditor-address.
230 RUN get-voucher-details.
232 RUN payment-header.
233 RUN print-advice( 15, 10, "" ).
234 RUN remittance-header.
235 RUN print-advice( 56, 10, msg-text ).
237 RUN cheque-details.
238 RUN page-feed.
240 IF n-vouchers > {&max-vouchers} THEN RUN print-secondary-advice.
242 END PROCEDURE.
244 /* _UIB-CODE-BLOCK-END */
245 &ANALYZE-RESUME
247 &ENDIF
249 &IF DEFINED(EXCLUDE-get-bank-account) = 0 &THEN
251 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-bank-account Procedure
252 PROCEDURE get-bank-account :
253 /*------------------------------------------------------------------------------
254 Purpose:
255 Parameters: <none>
256 Notes:
257 ------------------------------------------------------------------------------*/
259 FIND FIRST BankAccount WHERE BankAccount.BankAccountCode = bank-account
260 NO-LOCK NO-ERROR.
261 IF NOT AVAILABLE BankAccount THEN RETURN "FAIL".
263 END PROCEDURE.
265 /* _UIB-CODE-BLOCK-END */
266 &ANALYZE-RESUME
268 &ENDIF
270 &IF DEFINED(EXCLUDE-get-control-strings) = 0 &THEN
272 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-control-strings Procedure
273 PROCEDURE get-control-strings :
274 /*------------------------------------------------------------------------------
275 Purpose: Get all control strings for this report
276 Parameters: <none>
277 Notes:
278 ------------------------------------------------------------------------------*/
280 RUN make-control-string( "PCL", "reset,portrait,a4,tm,0,lm,6",
281 OUTPUT reset-page, OUTPUT rows, OUTPUT cols ).
283 RUN make-control-string( "PCL", "LinePrinter,lpi,9.54",
284 OUTPUT line-printer, OUTPUT rows, OUTPUT cols ).
286 RUN make-control-string( "PCL", "Courier,cpi,12",
287 OUTPUT cheque-font, OUTPUT rows, OUTPUT cols ).
289 RUN make-control-string( "PCL", "Proportional,times,bold,point,18",
290 OUTPUT overrun-font, OUTPUT rows, OUTPUT cols ).
292 END PROCEDURE.
294 /* _UIB-CODE-BLOCK-END */
295 &ANALYZE-RESUME
297 &ENDIF
299 &IF DEFINED(EXCLUDE-get-creditor-address) = 0 &THEN
301 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-creditor-address Procedure
302 PROCEDURE get-creditor-address :
303 /*------------------------------------------------------------------------------
304 Purpose:
305 Parameters: <none>
306 Notes:
307 ------------------------------------------------------------------------------*/
309 DEF VAR i AS INT NO-UNDO.
310 DEF VAR addr_string AS CHAR NO-UNDO.
312 creditor-address = "".
314 FIND FIRST Voucher WHERE
315 Voucher.BankAccountCode = Cheque.BankAccountCode AND
316 Voucher.ChequeNo = Cheque.ChequeNo
317 NO-LOCK.
319 FIND FIRST Creditor OF Voucher NO-LOCK.
320 RUN process/getaddr.p( "C", Creditor.CreditorCode, "PYMT,POST,MAIN",
321 OUTPUT creditor-address ).
323 END PROCEDURE.
325 /* _UIB-CODE-BLOCK-END */
326 &ANALYZE-RESUME
328 &ENDIF
330 &IF DEFINED(EXCLUDE-get-voucher-details) = 0 &THEN
332 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-voucher-details Procedure
333 PROCEDURE get-voucher-details :
334 /*------------------------------------------------------------------------------
335 Purpose:
336 Parameters: <none>
337 Notes:
338 ------------------------------------------------------------------------------*/
340 voucher-details = "".
341 n-vouchers = 0.
343 FOR EACH Voucher NO-LOCK WHERE
344 Voucher.BankAccountCode = Cheque.BankAccountCode AND
345 Voucher.ChequeNo = Cheque.ChequeNo BREAK BY Voucher.VoucherSeq:
347 voucher-details = voucher-details + IF voucher-details = "" THEN "" ELSE "~n".
349 voucher-details = voucher-details +
350 STRING( Voucher.Date, "99/99/99" ) + "|" +
351 STRING( Voucher.VoucherSeq, ">>99999" ) + "|" +
352 STRING( Voucher.InvoiceReference, "X(15)" ) + "|" +
353 STRING( Voucher.GoodsValue + Voucher.TaxValue, ">>,>>>,>>9.99CR" ).
355 END.
357 n-vouchers = NUM-ENTRIES( voucher-details, "~n" ).
359 END PROCEDURE.
361 /* _UIB-CODE-BLOCK-END */
362 &ANALYZE-RESUME
364 &ENDIF
366 &IF DEFINED(EXCLUDE-page-feed) = 0 &THEN
368 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
369 PROCEDURE page-feed :
370 /*------------------------------------------------------------------------------
371 Purpose:
372 Parameters: <none>
373 Notes:
374 ------------------------------------------------------------------------------*/
376 PUT CONTROL CHR(12).
377 page-no = page-no + 1.
379 END PROCEDURE.
381 /* _UIB-CODE-BLOCK-END */
382 &ANALYZE-RESUME
384 &ENDIF
386 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
388 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
389 PROCEDURE parse-parameters :
390 /*------------------------------------------------------------------------------
391 Purpose:
392 Parameters: <none>
393 Notes:
394 ------------------------------------------------------------------------------*/
395 DEF VAR i AS INT NO-UNDO.
396 DEF VAR token AS CHAR NO-UNDO.
398 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
399 token = ENTRY( i, report-options, "~n" ).
400 CASE( ENTRY( 1, token ) ):
401 WHEN "BankAccount" THEN bank-account = TRIM(ENTRY(2,token)).
402 WHEN "Message" THEN msg-text = REPLACE( SUBSTRING(token,9), CHR(7), "~n").
404 WHEN "ChequeRange" THEN ASSIGN
405 cheque-from = INT(ENTRY(2,token))
406 cheque-to = INT(ENTRY(3,token)).
408 WHEN "PaymentStyle" THEN payment-style = ENTRY(2,token).
410 WHEN "WriteBankImportFileTo" THEN bankimport-directory = ENTRY(2,token).
412 END CASE.
413 END.
415 END PROCEDURE.
417 /* _UIB-CODE-BLOCK-END */
418 &ANALYZE-RESUME
420 &ENDIF
422 &IF DEFINED(EXCLUDE-payment-header) = 0 &THEN
424 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE payment-header Procedure
425 PROCEDURE payment-header :
426 /*------------------------------------------------------------------------------
427 Purpose:
428 Parameters: <none>
429 Notes:
430 ------------------------------------------------------------------------------*/
432 PUT CONTROL line-printer.
433 RUN pcl-moveto( 5, 113 ).
434 PUT UNFORMATTED STRING( Cheque.ChequeNo, "999999" ).
435 RUN pcl-moveto( 7, 109 ).
436 PUT UNFORMATTED STRING( Cheque.Date, "99/99/9999" ).
438 END PROCEDURE.
440 /* _UIB-CODE-BLOCK-END */
441 &ANALYZE-RESUME
443 &ENDIF
445 &IF DEFINED(EXCLUDE-print-advice) = 0 &THEN
447 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-advice Procedure
448 PROCEDURE print-advice :
449 /*------------------------------------------------------------------------------
450 Purpose:
451 ------------------------------------------------------------------------------*/
452 DEF INPUT PARAMETER base-row AS DEC NO-UNDO.
453 DEF INPUT PARAMETER base-col AS DEC NO-UNDO.
454 DEF INPUT PARAMETER msg-text AS CHAR NO-UNDO.
456 DEF VAR i AS INT NO-UNDO.
457 DEF VAR voucher-line AS CHAR NO-UNDO.
458 DEF VAR voucher-base AS DEC NO-UNDO.
460 /* Print the address */
462 DO i = 1 TO NUM-ENTRIES( creditor-address, "~n" ):
463 RUN pcl-moveto( base-row + i - 1 + {&address-line}, base-col ).
464 PUT UNFORMATTED ENTRY( i, creditor-address, "~n" ).
465 END.
467 /* Print the details */
469 IF n-vouchers > {&max-vouchers} THEN
471 RUN pcl-moveto( base-row + 3, base-col + 60 ).
472 PUT CONTROL overrun-font.
473 PUT UNFORMATTED "SEE ATTACHED SHEET".
474 PUT CONTROL line-printer.
475 END.
476 ELSE
479 /* Print the vouchers */
481 voucher-base = base-col + 55.
483 DO i = 1 TO NUM-ENTRIES( voucher-details, "~n" ):
484 RUN pcl-moveto( base-row + i - 1, voucher-base ).
485 voucher-line = ENTRY( i, voucher-details, "~n" ).
486 PUT UNFORMATTED
487 ENTRY( 1, voucher-line, "|" ) SPACE(7)
488 ENTRY( 2, voucher-line, "|" ) SPACE(10)
489 ENTRY( 3, voucher-line, "|" ) SPACE(2)
490 ENTRY( 4, voucher-line, "|" ).
491 END.
493 END.
495 /* Print the total */
496 PUT CONTROL line-printer.
497 RUN pcl-moveto( base-row + 21, base-col + 103 ).
498 PUT UNFORMATTED STRING( Cheque.Amount, ">>,>>>,>>9.99CR" ).
500 /* Print the message */
502 IF msg-text <> "" THEN
503 DO i = 1 TO NUM-ENTRIES( msg-text, "~n" ):
504 RUN pcl-moveto( base-row + {&message-line} + i - 1, base-col ).
505 PUT UNFORMATTED ENTRY( i, msg-text, "~n" ).
506 END.
508 END PROCEDURE.
510 /* _UIB-CODE-BLOCK-END */
511 &ANALYZE-RESUME
513 &ENDIF
515 &IF DEFINED(EXCLUDE-print-cheques) = 0 &THEN
517 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-cheques Procedure
518 PROCEDURE print-cheques :
519 /*------------------------------------------------------------------------------
520 Purpose:
521 ------------------------------------------------------------------------------*/
523 RUN get-bank-account.
524 IF RETURN-VALUE = 'FAIL' THEN RETURN.
526 FOR EACH Cheque NO-LOCK WHERE
527 Cheque.BankAccountCode = BankAccount.BankAccountCode AND
528 Cheque.ChequeNo >= cheque-from AND
529 Cheque.ChequeNo <= cheque-to AND NOT Cheque.Cancelled:
531 FIND FIRST Voucher WHERE Voucher.BankAccountCode = Cheque.BankAccountCode
532 AND Voucher.ChequeNo = Cheque.ChequeNo NO-LOCK NO-ERROR.
534 IF Voucher.PaymentStyle = payment-style THEN
535 RUN each-cheque.
537 END.
539 IF do-usage-summary <> No THEN RUN print-usage-summary.
541 END PROCEDURE.
543 /* _UIB-CODE-BLOCK-END */
544 &ANALYZE-RESUME
546 &ENDIF
548 &IF DEFINED(EXCLUDE-print-secondary-advice) = 0 &THEN
550 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-secondary-advice Procedure
551 PROCEDURE print-secondary-advice :
552 /*------------------------------------------------------------------------------
553 Purpose:
554 Parameters: <none>
555 Notes:
556 ------------------------------------------------------------------------------*/
558 &SCOP PAGE-LINES 90
560 DEF VAR a-pn AS INT NO-UNDO INIT 1.
561 DEF VAR a-ln AS INT NO-UNDO.
562 DEF VAR i AS INT NO-UNDO.
563 DEF VAR voucher-line AS CHAR NO-UNDO.
565 RUN secondary-advice-header( a-pn ).
567 DO i = 1 TO NUM-ENTRIES( voucher-details, "~n" ):
569 voucher-line = ENTRY( i, voucher-details, "~n" ).
570 PUT UNFORMATTED SPACE(10)
571 ENTRY( 1, voucher-line, "|" ) SPACE(9)
572 ENTRY( 2, voucher-line, "|" ) SPACE(7)
573 ENTRY( 3, voucher-line, "|" ) SPACE(4)
574 ENTRY( 4, voucher-line, "|" ).
575 RUN skip-line(1).
577 a-ln = a-ln + 1.
579 IF a-ln >= {&PAGE-LINES} THEN
581 a-pn = a-pn + 1.
582 a-ln = 0.
583 RUN page-feed.
584 RUN secondary-advice-header( a-pn ).
585 END.
587 END.
589 PUT SKIP.
590 PUT UNFORMATTED
591 SPACE( 50 ) " " FILL( "-", 13 ) SKIP
592 SPACE( 50 ) "Total " STRING( Cheque.Amount, ">>,>>>,>>9.99" ) SKIP
593 SPACE( 50 ) " " FILL( "=", 13 ) SKIP.
595 RUN page-feed.
597 END PROCEDURE.
599 /* _UIB-CODE-BLOCK-END */
600 &ANALYZE-RESUME
602 &ENDIF
604 &IF DEFINED(EXCLUDE-print-usage-summary) = 0 &THEN
606 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-usage-summary Procedure
607 PROCEDURE print-usage-summary :
608 /*------------------------------------------------------------------------------
609 Purpose:
610 Parameters: <none>
611 Notes:
612 ------------------------------------------------------------------------------*/
614 DEF VAR s-ln AS INT NO-UNDO.
615 DEF VAR s-pn AS INT INIT 1 NO-UNDO.
616 DEF VAR summary-total AS DEC NO-UNDO.
617 DEF VAR page-lines AS INT NO-UNDO.
619 RUN usage-summary-header( s-pn, OUTPUT page-lines ).
621 FOR EACH Cheque NO-LOCK WHERE
622 Cheque.BankAccountCode = bank-account AND
623 Cheque.ChequeNo >= cheque-from AND
624 Cheque.ChequeNo <= cheque-to,
625 FIRST Creditor OF Cheque NO-LOCK:
627 PUT UNFORMATTED
628 STRING( Cheque.ChequeNo, "999999" ) SPACE(5)
629 STRING( Cheque.CreditorCode, ">>>>>9" ) SPACE(3)
630 STRING( Creditor.Name, "X(50)" ) SPACE(9)
631 STRING( Cheque.Amount, ">,>>>,>>>,>>9.99" ).
632 RUN skip-line(1).
634 summary-total = summary-total + Cheque.Amount.
636 s-ln = s-ln + 1.
637 IF s-ln >= page-lines THEN
639 s-pn = s-pn + 1.
640 s-ln = 0.
641 RUN page-feed.
642 RUN usage-summary-header( s-pn, OUTPUT page-lines ).
643 END.
645 END.
647 PUT UNFORMATTED
648 SPACE(80) "---------------" SKIP
649 SPACE(79) STRING( summary-total, ">,>>>,>>>,>>9.99" ) SKIP
650 SPACE(80) "===============".
652 /* eject page and decisively set back to internal bin */
653 RUN reset-page.
654 switch-bin( INTEGER(plain-tray) ).
657 END PROCEDURE.
659 /* _UIB-CODE-BLOCK-END */
660 &ANALYZE-RESUME
662 &ENDIF
664 &IF DEFINED(EXCLUDE-remittance-header) = 0 &THEN
666 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE remittance-header Procedure
667 PROCEDURE remittance-header :
668 /*------------------------------------------------------------------------------
669 Purpose:
670 Parameters: <none>
671 Notes:
672 ------------------------------------------------------------------------------*/
674 RUN pcl-moveto( 46, 109 ).
675 PUT UNFORMATTED STRING( Cheque.Date, "99/99/9999" ).
676 RUN pcl-moveto( 47.5, 113 ).
677 PUT UNFORMATTED STRING( Cheque.ChequeNo, "999999" ).
679 END PROCEDURE.
681 /* _UIB-CODE-BLOCK-END */
682 &ANALYZE-RESUME
684 &ENDIF
686 &IF DEFINED(EXCLUDE-reset-page) = 0 &THEN
688 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
689 PROCEDURE reset-page :
690 /*------------------------------------------------------------------------------
691 Purpose:
692 Parameters: <none>
693 Notes:
694 ------------------------------------------------------------------------------*/
696 PUT CONTROL reset-page.
697 ln = 0.
699 END PROCEDURE.
701 /* _UIB-CODE-BLOCK-END */
702 &ANALYZE-RESUME
704 &ENDIF
706 &IF DEFINED(EXCLUDE-secondary-advice-header) = 0 &THEN
708 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE secondary-advice-header Procedure
709 PROCEDURE secondary-advice-header :
710 /*------------------------------------------------------------------------------
711 Purpose:
712 Parameters: <none>
713 Notes:
714 ------------------------------------------------------------------------------*/
716 DEF INPUT PARAMETER page-no AS INT NO-UNDO.
718 DEF VAR head-font AS CHAR NO-UNDO.
720 RUN reset-page.
721 switch-bin( INTEGER(plain-tray) ).
723 RUN make-control-string( "PCL", "Proportional,Times,Bold,Point,18", OUTPUT head-font, OUTPUT rows, OUTPUT cols ).
725 PUT CONTROL line-printer.
726 RUN skip-line(4).
728 PUT CONTROL head-font.
729 PUT UNFORMATTED SPACE(30) "Remittance Advice".
730 RUN skip-line(2).
732 PUT CONTROL line-printer.
733 PUT UNFORMATTED SPACE(8) "Cheque No: " + STRING( Cheque.ChequeNo, ">>>>999999" ). RUN skip-line(1).
734 PUT UNFORMATTED SPACE(8) "Payment Date: " + STRING( Cheque.Date, "99/99/9999" ). RUN skip-line(1).
735 PUT UNFORMATTED SPACE(8) "Page: " + STRING( page-no, ">>>>>>>>>9" ). RUN skip-line(2).
736 PUT UNFORMATTED SPACE(12) "Date" SPACE(8)
737 "Reference" SPACE(6)
738 "Inv.Ref" SPACE(19)
739 "Amount". RUN skip-line(2).
741 END PROCEDURE.
743 /* _UIB-CODE-BLOCK-END */
744 &ANALYZE-RESUME
746 &ENDIF
748 &IF DEFINED(EXCLUDE-skip-line) = 0 &THEN
750 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
751 PROCEDURE skip-line :
752 /*------------------------------------------------------------------------------
753 Purpose:
754 Parameters: <none>
755 Notes:
756 ------------------------------------------------------------------------------*/
758 DEF INPUT PARAMETER n AS DEC NO-UNDO.
760 DEF VAR int-part AS INT NO-UNDO.
761 DEF VAR dec-part AS DEC NO-UNDO.
763 int-part = TRUNCATE( n, 0 ).
764 IF int-part < 0 THEN RETURN.
765 dec-part = n - int-part.
766 IF int-part = 0 AND dec-part = 0 THEN RETURN.
768 /* Need to have this like the following - do not touch */
769 IF int-part <> 0 THEN PUT CONTROL FILL( CHR(10), int-part ).
770 IF dec-part <> 0 THEN PUT CONTROL half-line.
772 ln = ln + n.
774 RUN carriage-return.
776 END PROCEDURE.
778 /* _UIB-CODE-BLOCK-END */
779 &ANALYZE-RESUME
781 &ENDIF
783 &IF DEFINED(EXCLUDE-usage-summary-header) = 0 &THEN
785 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE usage-summary-header Procedure
786 PROCEDURE usage-summary-header :
787 /*------------------------------------------------------------------------------
788 Purpose:
789 Parameters: <none>
790 Notes:
791 ------------------------------------------------------------------------------*/
793 &SCOP PAGE-LINES 90
795 DEF INPUT PARAMETER page-no AS INT NO-UNDO.
796 DEF OUTPUT PARAMETER page-lines AS INT NO-UNDO.
798 DEF VAR user-name AS CHAR NO-UNDO.
799 DEF VAR date-font AS CHAR NO-UNDO.
800 DEF VAR head-font AS CHAR NO-UNDO.
801 DEF VAR bank-font AS CHAR NO-UNDO.
803 page-lines = {&PAGE-LINES}.
804 RUN reset-page.
805 switch-bin( INTEGER(plain-tray) ).
807 RUN make-control-string( "PCL", "Proportional,Times,Bold,Point,8", OUTPUT date-font, OUTPUT rows, OUTPUT cols ).
808 RUN make-control-string( "PCL", "Proportional,Times,Bold,Point,18", OUTPUT head-font, OUTPUT rows, OUTPUT cols ).
809 RUN make-control-string( "PCL", "Proportional,Times,Bold,Point,8", OUTPUT bank-font, OUTPUT rows, OUTPUT cols ).
810 RUN get-username IN sys-mgr( OUTPUT user-name ).
812 PUT CONTROL line-printer. RUN skip-line(4).
813 PUT CONTROL date-font.
815 PUT UNFORMATTED "Printed at " + STRING( TIME, "HH:MM:SS" ) + ", " + STRING( TODAY, "99/99/9999" ) + " for " + user-name.
816 RUN carriage-return.
817 PUT UNFORMATTED SPACE( 180 ) "Page " + STRING(page-no).
818 RUN skip-line(4).
820 PUT CONTROL head-font.
821 PUT UNFORMATTED SPACE(26) "Cheque Usage Summary".
822 RUN skip-line(4).
824 IF AVAILABLE BankAccount THEN
826 PUT CONTROL bank-font.
827 PUT UNFORMATTED
828 "(L" + STRING( BankAccount.CompanyCode, "9999" ) + " - " +
829 STRING( BankAccount.AccountCode, "9999.99" ) + ") " +
830 BankAccount.BankName + ", " +
831 BankAccount.BankBranchName + ", " +
832 BankAccount.AccountName + " " +
833 "(" + STRING( BankAccount.BankAccount ) + ")".
834 PUT CONTROL line-printer.
835 RUN skip-line(3).
836 page-lines = page-lines - 3.
837 END.
839 PUT UNFORMATTED
840 "Cheque #" SPACE(2)
841 "Creditor" SPACE(2)
842 "Name" SPACE(65)
843 "Amount".
844 RUN skip-line(3).
846 END PROCEDURE.
848 /* _UIB-CODE-BLOCK-END */
849 &ANALYZE-RESUME
851 &ENDIF
853 /* ************************ Function Implementations ***************** */
855 &IF DEFINED(EXCLUDE-switch-bin) = 0 &THEN
857 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION switch-bin Procedure
858 FUNCTION switch-bin RETURNS CHARACTER
859 ( INPUT bin-id AS INT ) :
860 /*------------------------------------------------------------------------------
861 Purpose:
862 Notes:
863 ------------------------------------------------------------------------------*/
865 DEF VAR bin-ctrl AS CHAR NO-UNDO.
866 DEF VAR rows AS DEC NO-UNDO.
867 DEF VAR cols AS DEC NO-UNDO.
869 RUN make-control-string( "PCL", "bin," + STRING( bin-id ), OUTPUT bin-ctrl,
870 OUTPUT rows, OUTPUT cols ).
871 PUT CONTROL bin-ctrl.
873 RETURN "". /* Function return value. */
875 END FUNCTION.
877 /* _UIB-CODE-BLOCK-END */
878 &ANALYZE-RESUME
880 &ENDIF