1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
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.
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.
31 IF payment-style
<> "CHEQ" THEN DO:
32 RUN process
/report
/remittance.p
( report-options
).
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
).
44 {inc
/ofc-set-l.i
"Cheque-Usage-Summaries" "do-usage-summary"}
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
*/
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
*/
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
*/
112 /* *********************** Procedure Settings
************************ */
114 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
115 /* Settings for
THIS-PROCEDURE
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
131 /* END WINDOW DEFINITION
*/
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
}
142 /* _UIB-CODE-BLOCK-END
*/
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.
162 RUN view-output-file
( preview
).
164 /* _UIB-CODE-BLOCK-END
*/
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 /*------------------------------------------------------------------------------
178 ------------------------------------------------------------------------------*/
184 /* _UIB-CODE-BLOCK-END
*/
189 &IF DEFINED(EXCLUDE-cheque-details) = 0 &THEN
191 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE cheque-details Procedure
192 PROCEDURE cheque-details
:
193 /*------------------------------------------------------------------------------
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" ).
224 /* _UIB-CODE-BLOCK-END
*/
229 &IF DEFINED(EXCLUDE-each-cheque) = 0 &THEN
231 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-cheque Procedure
232 PROCEDURE each-cheque
:
233 /*------------------------------------------------------------------------------
237 ------------------------------------------------------------------------------*/
240 switch-bin
( INTEGER(cheque-tray
) ).
242 RUN get-creditor-address.
243 RUN get-voucher-details.
246 RUN print-advice
( 15, 10, "" ).
247 RUN remittance-header.
248 RUN print-advice
( 56, 10, msg-text
).
253 IF n-vouchers
> {&max-vouchers} THEN RUN print-secondary-advice.
257 /* _UIB-CODE-BLOCK-END
*/
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 /*------------------------------------------------------------------------------
270 ------------------------------------------------------------------------------*/
272 FIND FIRST BankAccount
WHERE BankAccount.BankAccountCode
= bank-account
274 IF NOT AVAILABLE BankAccount
THEN RETURN "FAIL".
278 /* _UIB-CODE-BLOCK-END
*/
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
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
).
307 /* _UIB-CODE-BLOCK-END
*/
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 /*------------------------------------------------------------------------------
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
332 FIND FIRST Creditor
OF Voucher
NO-LOCK.
333 RUN process
/getaddr.p
( "C", Creditor.CreditorCode
, "PYMT,POST,MAIN",
334 OUTPUT creditor-address
).
338 /* _UIB-CODE-BLOCK-END
*/
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 /*------------------------------------------------------------------------------
351 ------------------------------------------------------------------------------*/
353 voucher-details
= "".
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" ).
370 n-vouchers
= NUM-ENTRIES( voucher-details
, "~n" ).
374 /* _UIB-CODE-BLOCK-END
*/
379 &IF DEFINED(EXCLUDE-page-feed) = 0 &THEN
381 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
382 PROCEDURE page-feed
:
383 /*------------------------------------------------------------------------------
387 ------------------------------------------------------------------------------*/
390 page-no
= page-no
+ 1.
394 /* _UIB-CODE-BLOCK-END
*/
399 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
401 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
402 PROCEDURE parse-parameters
:
403 /*------------------------------------------------------------------------------
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
).
428 /* _UIB-CODE-BLOCK-END
*/
433 &IF DEFINED(EXCLUDE-payment-header) = 0 &THEN
435 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE payment-header Procedure
436 PROCEDURE payment-header
:
437 /*------------------------------------------------------------------------------
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" ).
451 /* _UIB-CODE-BLOCK-END
*/
456 &IF DEFINED(EXCLUDE-print-advice) = 0 &THEN
458 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-advice Procedure
459 PROCEDURE print-advice
:
460 /*------------------------------------------------------------------------------
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" ).
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.
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" ).
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
, "|" ).
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" ).
521 /* _UIB-CODE-BLOCK-END
*/
526 &IF DEFINED(EXCLUDE-print-cheques) = 0 &THEN
528 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-cheques Procedure
529 PROCEDURE print-cheques
:
530 /*------------------------------------------------------------------------------
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
550 IF do-usage-summary
<> No
THEN RUN print-usage-summary.
554 /* _UIB-CODE-BLOCK-END
*/
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 /*------------------------------------------------------------------------------
567 ------------------------------------------------------------------------------*/
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
, "|" ).
590 IF a-ln
>= {&PAGE-LINES} THEN
595 RUN secondary-advice-header
( a-pn
).
602 SPACE( 50 ) " " FILL( "-", 13 ) SKIP
603 SPACE( 50 ) "Total " STRING( Cheque.Amount
, ">>,>>>,>>9.99" ) SKIP
604 SPACE( 50 ) " " FILL( "=", 13 ) SKIP.
610 /* _UIB-CODE-BLOCK-END
*/
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 /*------------------------------------------------------------------------------
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:
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" ).
645 summary-total
= summary-total
+ Cheque.Amount.
648 IF s-ln
>= page-lines
THEN
653 RUN usage-summary-header
( s-pn
, OUTPUT page-lines
).
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
*/
665 switch-bin
( INTEGER(plain-tray
) ).
670 /* _UIB-CODE-BLOCK-END
*/
675 &IF DEFINED(EXCLUDE-remittance-header) = 0 &THEN
677 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE remittance-header Procedure
678 PROCEDURE remittance-header
:
679 /*------------------------------------------------------------------------------
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" ).
692 /* _UIB-CODE-BLOCK-END
*/
697 &IF DEFINED(EXCLUDE-reset-page) = 0 &THEN
699 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
700 PROCEDURE reset-page
:
701 /*------------------------------------------------------------------------------
705 ------------------------------------------------------------------------------*/
707 PUT CONTROL reset-page.
712 /* _UIB-CODE-BLOCK-END
*/
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 /*------------------------------------------------------------------------------
725 ------------------------------------------------------------------------------*/
727 DEF INPUT PARAMETER page-no
AS INT NO-UNDO.
729 DEF VAR head-font
AS CHAR NO-UNDO.
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.
739 PUT CONTROL head-font.
740 PUT UNFORMATTED SPACE(30) "Remittance Advice".
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)
750 "Amount".
RUN skip-line
(2).
754 /* _UIB-CODE-BLOCK-END
*/
759 &IF DEFINED(EXCLUDE-skip-line) = 0 &THEN
761 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
762 PROCEDURE skip-line
:
763 /*------------------------------------------------------------------------------
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.
789 /* _UIB-CODE-BLOCK-END
*/
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 /*------------------------------------------------------------------------------
802 ------------------------------------------------------------------------------*/
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}.
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.
828 PUT UNFORMATTED SPACE( 180 ) "Page " + STRING(page-no
).
831 PUT CONTROL head-font.
832 PUT UNFORMATTED SPACE(26) "Cheque Usage Summary".
835 IF AVAILABLE BankAccount
THEN
837 PUT CONTROL bank-font.
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.
847 page-lines
= page-lines
- 3.
859 /* _UIB-CODE-BLOCK-END
*/
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 /*------------------------------------------------------------------------------
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.
*/
888 /* _UIB-CODE-BLOCK-END
*/