Add blank column, rename column.
[capital-apms-progress.git] / process / report / statemnt.p
blob2004646050dd4fcfa5f1c1e3b2360d1d31666e1f
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 File :
6 Purpose :
8 Syntax :
10 Description :
12 Author(s) :
13 Created :
14 Notes :
15 ------------------------------------------------------------------------*/
17 &SCOPED-DEFINE trn-per-page 43
19 DEF INPUT PARAMETER report-options AS CHAR NO-UNDO.
21 DEF VAR from-tenant LIKE Tenant.TenantCode NO-UNDO.
22 DEF VAR to-tenant LIKE Tenant.TenantCode NO-UNDO.
23 DEF VAR open-only AS LOGI NO-UNDO.
24 DEF VAR active-only AS LOGI NO-UNDO.
25 DEF VAR prop-code LIKE Property.PropertyCode NO-UNDO.
26 DEF VAR from-month LIKE Month.MonthCode NO-UNDO.
27 DEF VAR to-month LIKE Month.MonthCode NO-UNDO.
28 DEF VAR summarise-part AS LOGI NO-UNDO.
29 DEF VAR show-zeroes AS LOGI NO-UNDO.
30 RUN parse-parameters.
32 DEF VAR logo-codes AS CHAR NO-UNDO.
34 /* Report counters */
35 DEF VAR ln AS DEC INIT 0.00 NO-UNDO.
37 /* Line definitions */
39 DEF VAR statement-total AS DEC NO-UNDO.
41 DEF VAR title-line AS CHAR EXTENT 4 NO-UNDO.
42 DEF VAR title-address AS CHAR EXTENT 4 NO-UNDO.
43 DEF VAR date-in-words AS CHAR NO-UNDO.
45 DEF VAR client-code AS CHAR NO-UNDO.
46 DEF VAR entity-type AS CHAR NO-UNDO.
47 DEF VAR entity-code AS INT NO-UNDO.
48 DEF VAR tenant-address AS CHAR EXTENT 7 NO-UNDO.
49 DEF VAR office-address AS CHAR EXTENT 5 NO-UNDO.
50 DEF VAR trn-line AS CHAR NO-UNDO.
51 DEF VAR trn-no AS INT NO-UNDO.
52 DEF VAR regarding 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 line-printer AS CHAR NO-UNDO.
57 DEF VAR tenant-address-font AS CHAR NO-UNDO.
58 DEF VAR header-font AS CHAR NO-UNDO.
59 DEF VAR re-font AS CHAR NO-UNDO.
60 DEF VAR trn-font AS CHAR NO-UNDO.
61 DEF VAR remittance-title-font AS CHAR NO-UNDO.
62 DEF VAR remittance-font AS CHAR NO-UNDO.
63 DEF VAR remittance-prompt AS CHAR NO-UNDO.
64 DEF VAR remittance-font-bold AS CHAR NO-UNDO.
65 DEF VAR id-font AS CHAR NO-UNDO.
67 DEF VAR total-line-printed AS LOGI NO-UNDO.
69 {inc/ofc-this.i}
70 {inc/ofc-acct.i "DEBTORS" "sundry-debtors"}
72 {inc/ofc-set-l.i "Statement-IsTaxInvoice" "is-tax-invoice"}
74 DEF VAR gst-applies AS LOGI NO-UNDO.
75 gst-applies = Office.GST <> ?.
77 {inc/ofc-set.i "GST-Number" "gst-number"}
78 IF NOT AVAILABLE(OfficeSetting) THEN
79 gst-number = REPLACE( STRING( Office.GSTNo, ">99,999,999"),",","-") .
80 {inc/ofc-set.i "GST-Number-Name" "gst-number-name"}
81 IF NOT AVAILABLE(OfficeSetting) THEN
82 gst-number-name = "GST NO.".
84 DEF VAR user-name AS CHAR NO-UNDO.
85 DEF VAR print-id AS CHAR NO-UNDO.
86 {inc/username.i "user-name"}
87 print-id = STRING( TODAY, "99/99/9999" ) + " " + STRING( TIME, "HH:MM" ) + " " +
88 user-name.
90 /* _UIB-CODE-BLOCK-END */
91 &ANALYZE-RESUME
94 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
96 /* ******************** Preprocessor Definitions ******************** */
98 &Scoped-define PROCEDURE-TYPE Procedure
99 &Scoped-define DB-AWARE no
103 /* _UIB-PREPROCESSOR-BLOCK-END */
104 &ANALYZE-RESUME
108 /* *********************** Procedure Settings ************************ */
110 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
111 /* Settings for THIS-PROCEDURE
112 Type: Procedure
113 Allow:
114 Frames: 0
115 Add Fields to: Neither
116 Other Settings: CODE-ONLY COMPILE
118 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
120 /* ************************* Create Window ************************** */
122 &ANALYZE-SUSPEND _CREATE-WINDOW
123 /* DESIGN Window definition (used by the UIB)
124 CREATE WINDOW Procedure ASSIGN
125 HEIGHT = 21.9
126 WIDTH = 40.
127 /* END WINDOW DEFINITION */
129 &ANALYZE-RESUME
131 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
132 /* ************************* Included-Libraries *********************** */
134 {inc/method/m-txtrep.i}
135 {inc/method/m-hpgl.i}
136 {inc/entity.i}
137 {inc/convert.i}
139 /* _UIB-CODE-BLOCK-END */
140 &ANALYZE-RESUME
146 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
149 /* *************************** Main Block *************************** */
151 RUN get-control-strings.
152 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES PAGE-SIZE 0.
154 RUN statement-of-account.
156 OUTPUT CLOSE.
157 RUN view-output-file ( no ).
159 /* _UIB-CODE-BLOCK-END */
160 &ANALYZE-RESUME
163 /* ********************** Internal Procedures *********************** */
165 &IF DEFINED(EXCLUDE-carriage-return) = 0 &THEN
167 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE carriage-return Procedure
168 PROCEDURE carriage-return :
169 /*------------------------------------------------------------------------------
170 Purpose:
171 Parameters: <none>
172 Notes:
173 ------------------------------------------------------------------------------*/
175 PUT CONTROL CHR(13).
177 END PROCEDURE.
179 /* _UIB-CODE-BLOCK-END */
180 &ANALYZE-RESUME
182 &ENDIF
184 &IF DEFINED(EXCLUDE-each-closing-group) = 0 &THEN
186 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-closing-group Procedure
187 PROCEDURE each-closing-group :
188 /*------------------------------------------------------------------------------
189 Purpose:
190 ------------------------------------------------------------------------------*/
191 DEF VAR grp-amount AS DEC NO-UNDO INITIAL 0.
192 DEF VAR dispDate AS CHAR NO-UNDO.
193 DEF VAR dispReference AS CHAR NO-UNDO.
194 DEF VAR dispDescription AS CHAR NO-UNDO.
196 FIND LAST AcctTran NO-LOCK OF ClosingGroup NO-ERROR.
197 IF NOT AVAILABLE(AcctTran) THEN RETURN.
199 ASSIGN dispDate = STRING( ClosingGroup.Date, "99/99/9999" )
200 dispReference = "CG " + STRING( ClosingGroup.ClosingGroup)
201 dispDescription = (IF ClosingGroup.Description <> ""
202 THEN ClosingGroup.Description
203 ELSE AcctTran.Description ) .
205 IF dispDescription = "" THEN DO:
206 FIND Document NO-LOCK OF AcctTran.
207 IF dispDescription = "" THEN dispDescription = Document.Description.
208 END.
210 DEF BUFFER AltTran FOR AcctTran.
211 FOR EACH AltTran NO-LOCK OF ClosingGroup:
212 grp-amount = grp-amount + AltTran.Amount.
213 END.
215 RUN next-transaction.
217 PUT UNFORMATTED dispDate SPACE(3)
218 STRING( dispReference, "X(12)" ) SPACE(3)
219 STRING( dispDescription, "X(50)" ) SPACE(4)
220 STRING( grp-amount, ">,>>>,>>>,>>9.99CR" ).
221 RUN skip-line(1).
223 statement-total = statement-total + grp-amount.
226 END PROCEDURE.
228 /* _UIB-CODE-BLOCK-END */
229 &ANALYZE-RESUME
231 &ENDIF
233 &IF DEFINED(EXCLUDE-each-tenant) = 0 &THEN
235 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-tenant Procedure
236 PROCEDURE each-tenant :
237 /*------------------------------------------------------------------------------
238 Purpose:
239 Parameters: <none>
240 Notes:
241 ------------------------------------------------------------------------------*/
243 &SCOPED-DEFINE tran-clause AcctTran.EntityType = 'T' AND ~
244 AcctTran.EntityCode = Tenant.TenantCode AND ~
245 AcctTran.AccountCode = sundry-debtors
247 &SCOPED-DEFINE by-clause BY AcctTran.EntityType ~
248 BY AcctTran.EntityCode ~
249 BY AcctTran.AccountCode~
250 BY AcctTran.Date ~
251 BY AcctTran.BatchCode ~
252 BY AcctTran.DocumentCode ~
253 BY AcctTran.TransactionCode
255 FIND AccountSummary WHERE AccountSummary.EntityType = "T"
256 AND AccountSummary.EntityCode = Tenant.TenantCode
257 AND AccountSummary.AccountCode = sundry-debtors
258 AND AccountSummary.Balance <> 0
259 NO-LOCK NO-ERROR.
260 IF (prop-code <> ? OR from-tenant <> to-tenant)
261 AND NOT AVAILABLE(AccountSummary) THEN RETURN.
263 RUN get-tenant-details.
264 RUN page-header.
265 total-line-printed = No.
266 statement-total = 0.
268 IF from-month = ? OR to-month = ? OR summarise-part THEN DO:
269 FOR EACH AcctTran NO-LOCK WHERE {&tran-clause} AND
270 (AcctTran.ClosingGroup = ? OR
271 (IF summarise-part THEN No ELSE ((AcctTran.ClosedState = "P") OR NOT open-only) ))
272 {&by-clause}:
273 RUN each-transaction.
274 END.
275 IF summarise-part THEN DO:
276 FOR EACH ClosingGroup NO-LOCK
277 WHERE ClosingGroup.EntityType = "T"
278 AND ClosingGroup.EntityCode = Tenant.TenantCode
279 AND ClosingGroup.AccountCode = sundry-debtors
280 AND ClosingGroup.ClosedStatus = "P"
281 BY ClosingGroup.EntityType BY ClosingGroup.EntityCode
282 BY ClosingGroup.AccountCode BY ClosingGroup.Date:
283 RUN each-closing-group.
284 END.
285 END.
286 END.
287 ELSE
288 FOR EACH AcctTran NO-LOCK WHERE {&tran-clause} AND
289 AcctTran.MonthCode >= from-month AND
290 AcctTran.monthCode <= to-month AND
291 (AcctTran.ClosingGroup = ? OR AcctTran.ClosedState = "P" OR NOT open-only )
292 {&by-clause}:
293 RUN each-transaction.
294 END.
296 RUN total-line.
297 RUN print-remittance.
298 RUN page-feed.
300 END PROCEDURE.
302 /* _UIB-CODE-BLOCK-END */
303 &ANALYZE-RESUME
305 &ENDIF
307 &IF DEFINED(EXCLUDE-each-transaction) = 0 &THEN
309 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-transaction Procedure
310 PROCEDURE each-transaction :
311 /*------------------------------------------------------------------------------
312 Purpose:
313 Parameters: <none>
314 Notes:
315 ------------------------------------------------------------------------------*/
317 DEF VAR trn-ref AS CHAR NO-UNDO.
318 DEF VAR trn-desc AS CHAR NO-UNDO.
319 RUN next-transaction.
321 IF AcctTran.Reference = "" OR AcctTran.Description = "" THEN DO:
322 FIND FIRST Document OF AcctTran NO-LOCK.
323 trn-ref = IF AcctTran.Reference <> "" THEN AcctTran.Reference
324 ELSE Document.Reference.
325 trn-desc = IF AcctTran.Description <> "" THEN AcctTran.Description
326 ELSE Document.Description.
327 END.
328 ELSE ASSIGN
329 trn-ref = AcctTran.Reference
330 trn-desc = AcctTran.Description .
332 PUT UNFORMATTED
333 STRING( AcctTran.Date, "99/99/9999" ) SPACE(3)
334 STRING( trn-ref, "X(12)" ) SPACE(3)
335 STRING( trn-desc, "X(50)" ) SPACE(4)
336 STRING( AcctTran.Amount, ">,>>>,>>>,>>9.99CR" ).
337 RUN skip-line(1).
339 statement-total = statement-total + AcctTran.Amount.
341 END PROCEDURE.
343 /* _UIB-CODE-BLOCK-END */
344 &ANALYZE-RESUME
346 &ENDIF
348 &IF DEFINED(EXCLUDE-get-client-address) = 0 &THEN
350 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-client-address Procedure
351 PROCEDURE get-client-address :
352 /*------------------------------------------------------------------------------
353 Purpose:
354 ------------------------------------------------------------------------------*/
355 DEF INPUT PARAMETER client-code AS CHAR NO-UNDO.
357 DEF VAR i AS INT NO-UNDO.
358 DEF VAR client-address AS CHAR NO-UNDO INITIAL "".
360 FIND Client WHERE Client.ClientCode = client-code NO-LOCK NO-ERROR.
361 IF NOT AVAILABLE(Client) THEN RETURN.
363 client-address = TRIM( REPLACE(Client.RemittanceAddress, CHR(13), "") ).
364 IF client-address = ? OR client-address = "" THEN RETURN.
366 DO i = 1 TO 5:
367 IF i <= NUM-ENTRIES( client-address, "~n" ) THEN
368 ASSIGN office-address[i] = ENTRY( i, client-address, "~n" ) NO-ERROR.
369 ELSE
370 office-address[i] = "".
372 IF office-address[i] = ? THEN office-address[i] = "".
373 END.
375 END PROCEDURE.
377 /* _UIB-CODE-BLOCK-END */
378 &ANALYZE-RESUME
380 &ENDIF
382 &IF DEFINED(EXCLUDE-get-control-strings) = 0 &THEN
384 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-control-strings Procedure
385 PROCEDURE get-control-strings :
386 /*------------------------------------------------------------------------------
387 Purpose: Get all control strings for this report
388 ------------------------------------------------------------------------------*/
390 DEF VAR rows AS DEC NO-UNDO.
391 DEF VAR cols AS DEC NO-UNDO.
393 RUN make-control-string ( "PCL", "reset,portrait,a4,tm,0,lm,6",
394 OUTPUT reset-page, OUTPUT rows, OUTPUT cols ).
396 RUN make-control-string ( "PCL", "LinePrinter,lpi,9.54",
397 OUTPUT trn-font, OUTPUT rows, OUTPUT cols ).
399 RUN make-control-string ( "PCL", "Proportional,Times,Bold,Point,10",
400 OUTPUT tenant-address-font, OUTPUT rows, OUTPUT cols ).
402 RUN make-control-string ( "PCL", "Proportional,Times,Bold,Point,16",
403 OUTPUT header-font, OUTPUT rows, OUTPUT cols ).
405 RUN make-control-string ( "PCL", "Proportional,Times,Bold,Point,11",
406 OUTPUT re-font, OUTPUT rows, OUTPUT cols ).
408 RUN make-control-string ( "PCL", "Proportional,Times,Bold,Point,16",
409 OUTPUT remittance-title-font, OUTPUT rows, OUTPUT cols ).
411 RUN make-control-string ( "PCL", "Times,Proportional,point,9,normal,lpi,7",
412 OUTPUT remittance-font, OUTPUT rows, OUTPUT cols ).
414 RUN make-control-string ( "PCL", "Times,Proportional,point,8,normal,lpi,7",
415 OUTPUT remittance-prompt, OUTPUT rows, OUTPUT cols ).
417 RUN make-control-string ( "PCL", "Times,Proportional,point,10,bold",
418 OUTPUT remittance-font-bold, OUTPUT rows, OUTPUT cols ).
420 RUN make-control-string ( "PCL", "Times,Proportional,Point,4,Normal",
421 OUTPUT id-font, OUTPUT rows, OUTPUT cols ).
423 END PROCEDURE.
425 /* _UIB-CODE-BLOCK-END */
426 &ANALYZE-RESUME
428 &ENDIF
430 &IF DEFINED(EXCLUDE-get-office-address) = 0 &THEN
432 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-office-address Procedure
433 PROCEDURE get-office-address :
434 /*------------------------------------------------------------------------------
435 Purpose:
436 ------------------------------------------------------------------------------*/
437 DEF VAR i AS INT NO-UNDO.
439 FIND FIRST Office WHERE Office.ThisOffice NO-LOCK.
441 DO i = 1 TO 5:
442 ASSIGN
443 office-address[i] = ENTRY( i, Office.StreetAddress, CHR(10) )
444 office-address[i] = REPLACE( office-address[i], CHR(13), "" )
445 NO-ERROR.
446 IF office-address[i] = ? THEN office-address[i] = "".
447 END.
449 END PROCEDURE.
451 /* _UIB-CODE-BLOCK-END */
452 &ANALYZE-RESUME
454 &ENDIF
456 &IF DEFINED(EXCLUDE-get-tenant-details) = 0 &THEN
458 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-tenant-details Procedure
459 PROCEDURE get-tenant-details :
460 /*------------------------------------------------------------------------------
461 Purpose:
462 ------------------------------------------------------------------------------*/
464 regarding = "".
465 IF Tenant.EntityType = 'P' THEN
467 /* Note: find fails if lease is not unique - this is deliberate! */
468 FIND TenancyLease WHERE TenancyLease.TenantCode = Tenant.TenantCode NO-LOCK NO-ERROR.
469 IF AVAILABLE(TenancyLease) THEN DO:
470 regarding = TenancyLease.AreaDescription.
471 IF regarding = ? THEN regarding = "".
472 END.
474 FIND FIRST Property WHERE Property.PropertyCode = Tenant.EntityCode
475 NO-LOCK NO-ERROR.
476 IF AVAILABLE Property THEN
477 regarding = (IF regarding <> "" THEN TRIM(regarding) + ", " ELSE "")
478 + Property.Name
479 + (IF Property.Name <> Property.StreetAddress THEN ", " + Property.StreetAddress ELSE "" ) .
481 END.
482 ELSE IF Tenant.EntityType = 'L' THEN
484 FIND FIRST Company WHERE Company.CompanyCode = Tenant.EntityCode
485 NO-LOCK NO-ERROR.
486 IF AVAILABLE Company THEN regarding = Company.LegalName.
487 END.
489 entity-type = Tenant.EntityType.
490 entity-code = Tenant.EntityCode.
491 client-code = get-entity-client( Tenant.EntityType, Tenant.EntityCode ).
492 RUN get-client-address( client-code ).
494 DEF VAR addr AS CHAR NO-UNDO.
495 DEF VAR i AS INT NO-UNDO.
497 RUN process/getaddr.p( "T", Tenant.TenantCode, "BILL", OUTPUT addr ).
498 DO i = 1 TO 7: tenant-address[i] = "". END.
499 DO i = 1 TO NUM-ENTRIES( addr, CHR(10) ):
500 tenant-address[i] = ENTRY( i, addr, CHR(10) ).
501 END.
503 END PROCEDURE.
505 /* _UIB-CODE-BLOCK-END */
506 &ANALYZE-RESUME
508 &ENDIF
510 &IF DEFINED(EXCLUDE-next-transaction) = 0 &THEN
512 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE next-transaction Procedure
513 PROCEDURE next-transaction :
514 /*------------------------------------------------------------------------------
515 Purpose:
516 Parameters: <none>
517 Notes:
518 ------------------------------------------------------------------------------*/
520 trn-no = trn-no + 1.
522 IF trn-no >= {&trn-per-page} THEN
524 RUN print-remittance.
525 RUN page-feed.
526 RUN page-header.
527 END.
529 END PROCEDURE.
531 /* _UIB-CODE-BLOCK-END */
532 &ANALYZE-RESUME
534 &ENDIF
536 &IF DEFINED(EXCLUDE-page-feed) = 0 &THEN
538 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
539 PROCEDURE page-feed :
540 /*------------------------------------------------------------------------------
541 Purpose:
542 Parameters: <none>
543 Notes:
544 ------------------------------------------------------------------------------*/
546 PUT CONTROL CHR(12).
548 END PROCEDURE.
550 /* _UIB-CODE-BLOCK-END */
551 &ANALYZE-RESUME
553 &ENDIF
555 &IF DEFINED(EXCLUDE-page-header) = 0 &THEN
557 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-header Procedure
558 PROCEDURE page-header :
559 /*------------------------------------------------------------------------------
560 Purpose:
561 Parameters: <none>
562 Notes:
563 ------------------------------------------------------------------------------*/
565 RUN reset-page.
566 RUN print-title.
567 RUN print-address.
569 RUN skip-line(2).
570 PUT CONTROL header-font.
571 IF ( is-tax-invoice ) THEN DO:
572 PUT UNFORMATTED SPACE(26) "INVOICE / STATEMENT".
573 RUN skip-line(1.5).
574 PUT UNFORMATTED SPACE(36) "Tax Invoice".
575 END.
576 ELSE
577 PUT UNFORMATTED SPACE(26) "STATEMENT OF ACCOUNT".
578 RUN carriage-return.
579 PUT UNFORMATTED FILL( '_', 64).
580 RUN skip-line(2).
582 PUT CONTROL re-font.
583 PUT UNFORMATTED "RE: ".
584 PUT CONTROL STRING( regarding, "X(100)" ).
585 RUN skip-line(1.5).
586 PUT CONTROL trn-font.
588 END PROCEDURE.
590 /* _UIB-CODE-BLOCK-END */
591 &ANALYZE-RESUME
593 &ENDIF
595 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
597 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
598 PROCEDURE parse-parameters :
599 /*------------------------------------------------------------------------------
600 Purpose:
601 ------------------------------------------------------------------------------*/
602 DEF VAR n-tenant AS INT NO-UNDO.
603 DEF VAR n-property AS INT NO-UNDO.
604 DEF VAR type-of AS CHAR NO-UNDO.
605 DEF VAR range-of AS CHAR NO-UNDO.
608 type-of = ENTRY( 1, report-options).
609 n-property = INT( ENTRY( 2, report-options)).
610 n-tenant = INT( ENTRY( 3, report-options)).
612 IF type-of = "All" THEN
613 ASSIGN from-tenant = 0 to-tenant = 99999 prop-code = ?.
614 ELSE IF type-of = "Tenant" THEN
615 ASSIGN from-tenant = n-tenant to-tenant = n-tenant prop-code = ?.
616 ELSE IF type-of = "Range" THEN
617 ASSIGN from-tenant = n-property to-tenant = n-tenant prop-code = ?.
618 ELSE IF type-of = "Property" THEN
619 ASSIGN from-tenant = ? to-tenant = ? prop-code = n-property.
621 range-of = ENTRY( 4, report-options).
622 open-only = (ENTRY( 5, report-options) = "Yes").
623 active-only = (ENTRY( 6, report-options) = "Yes").
624 from-month = INT( ENTRY( 7, report-options)).
625 to-month = INT( ENTRY( 8, report-options)).
626 summarise-part = (ENTRY( 9, report-options) = "Yes").
627 show-zeroes = (ENTRY( 10, report-options) = "Yes").
629 IF summarise-part THEN open-only = Yes.
630 IF open-only OR range-of <> "Range" THEN ASSIGN from-month = ? to-month = ?.
632 END PROCEDURE.
634 /* _UIB-CODE-BLOCK-END */
635 &ANALYZE-RESUME
637 &ENDIF
639 &IF DEFINED(EXCLUDE-print-address) = 0 &THEN
641 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-address Procedure
642 PROCEDURE print-address :
643 /*------------------------------------------------------------------------------
644 Purpose:
645 Parameters: <none>
646 Notes:
647 ------------------------------------------------------------------------------*/
649 DEF VAR i AS INT NO-UNDO.
651 RUN skip-line(6).
652 PUT CONTROL tenant-address-font.
654 DO i = 1 TO 7:
655 PUT UNFORMATTED tenant-address[i].
656 IF i = 2 AND gst-applies AND is-tax-invoice THEN DO:
657 PUT UNFORMATTED CHR(13) SPACE( 124 ) gst-number-name
658 CHR(13) SPACE( 140 ) gst-number.
659 END.
660 ELSE IF i = 4 THEN PUT UNFORMATTED CHR(13) SPACE(140) STRING( date-in-words, "X(20)" ).
661 RUN skip-line(1).
662 END.
664 END PROCEDURE.
666 /* _UIB-CODE-BLOCK-END */
667 &ANALYZE-RESUME
669 &ENDIF
671 &IF DEFINED(EXCLUDE-print-remittance) = 0 &THEN
673 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-remittance Procedure
674 PROCEDURE print-remittance :
675 /*------------------------------------------------------------------------------
676 Purpose:
677 ------------------------------------------------------------------------------*/
678 DEF VAR amount-due AS CHAR NO-UNDO.
680 PUT CONTROL trn-font.
681 RUN pcl-moveto( 92, 11 ). RUN carriage-return.
683 PUT CONTROL id-font.
684 PUT UNFORMATTED print-id.
685 RUN carriage-return.
686 PUT CONTROL remittance-font.
687 PUT UNFORMATTED FILL(' ',20) + "Activity occurring after " + date-in-words + " will appear on your next statement." .
688 RUN skip-line(0.5).
689 PUT CONTROL remittance-title-font.
690 PUT UNFORMATTED FILL( '_ ', 48 ). RUN skip-line(2).
691 PUT UNFORMATTED "Remittance Advice".
692 RUN skip-line(2).
693 PUT CONTROL remittance-font.
695 PUT UNFORMATTED "Please return this portion with your cheque, payable to:".
696 RUN skip-line(1.5).
698 FIND Client WHERE Client.ClientCode = client-code NO-LOCK NO-ERROR.
699 IF AVAILABLE(Client) AND Client.Name <> Client.LegalName AND Client.LegalName <> ? AND Client.LegalName <> "" THEN
700 PUT CONTROL remittance-font-bold Client.LegalName remittance-font.
701 ELSE IF AVAILABLE(Client) THEN
702 PUT CONTROL remittance-font-bold Client.Name remittance-font.
703 RUN skip-line(1).
705 DEF VAR i AS INT NO-UNDO.
706 DO i = 1 TO 5:
707 PUT UNFORMATTED office-address[i]. RUN skip-line(1).
708 END.
710 DEF VAR remittance-codes AS CHAR NO-UNDO.
711 amount-due = IF total-line-printed THEN TRIM( STRING( statement-total, ">,>>>,>>>,>>9.99CR" ) ) ELSE "".
713 RUN hpgl-initialize.
714 RUN hpgl-moveto( 110, 50 ).
715 RUN hpgl-text( remittance-prompt, "Our Ref:" ).
716 RUN hpgl-move-relative( 20, 0 ).
717 RUN hpgl-text( remittance-font, "T" + STRING( Tenant.TenantCode, "99999" ) ).
718 RUN hpgl-move-relative( 25, 0 ).
719 RUN hpgl-text( remittance-prompt, "Date:" ).
720 RUN hpgl-move-relative( 10, 0 ).
721 RUN hpgl-text( remittance-font, STRING( TODAY, "99/99/9999" ) ).
722 RUN hpgl-move-relative( -55, -18 ).
723 RUN hpgl-text( remittance-prompt, "From:" ).
724 RUN hpgl-move-relative( 20, 0 ).
725 RUN hpgl-text( remittance-font, Tenant.Name ).
726 RUN hpgl-move-relative( -20, -4 ).
727 RUN hpgl-text( remittance-prompt, "Re:" ).
728 RUN hpgl-move-relative( 20, 0 ).
729 RUN hpgl-text( remittance-font, regarding ).
730 RUN hpgl-move-relative( -20, -4 ).
731 RUN hpgl-text( remittance-prompt, "Amount Due:" ).
732 RUN hpgl-move-relative( 20, 0 ).
733 RUN hpgl-text( remittance-font, amount-due ).
734 RUN hpgl-move-relative( -20, -6 ).
735 RUN hpgl-text( remittance-prompt, "Amount Paid:" ).
737 RUN hpgl-get-codes( yes, no, OUTPUT remittance-codes ).
738 PUT CONTROL remittance-codes.
740 END PROCEDURE.
742 /* _UIB-CODE-BLOCK-END */
743 &ANALYZE-RESUME
745 &ENDIF
747 &IF DEFINED(EXCLUDE-print-title) = 0 &THEN
749 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-title Procedure
750 PROCEDURE print-title :
751 /*------------------------------------------------------------------------------
752 Purpose:
753 ------------------------------------------------------------------------------*/
755 RUN hpgl-initialize.
756 RUN client-logo( entity-type, entity-code, client-code ).
757 RUN client-address( entity-type, entity-code, client-code ).
758 RUN hpgl-get-codes( yes, yes, OUTPUT logo-codes ).
759 PUT CONTROL logo-codes.
761 END PROCEDURE.
763 /* _UIB-CODE-BLOCK-END */
764 &ANALYZE-RESUME
766 &ENDIF
768 &IF DEFINED(EXCLUDE-reset-page) = 0 &THEN
770 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
771 PROCEDURE reset-page :
772 /*------------------------------------------------------------------------------
773 Purpose:
774 Parameters: <none>
775 Notes:
776 ------------------------------------------------------------------------------*/
778 PUT CONTROL reset-page.
779 trn-no = 0.
780 ln = 0.
782 END PROCEDURE.
784 /* _UIB-CODE-BLOCK-END */
785 &ANALYZE-RESUME
787 &ENDIF
789 &IF DEFINED(EXCLUDE-skip-line) = 0 &THEN
791 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
792 PROCEDURE skip-line :
793 /*------------------------------------------------------------------------------
794 Purpose:
795 Parameters: <none>
796 Notes:
797 ------------------------------------------------------------------------------*/
799 DEF INPUT PARAMETER n AS DEC NO-UNDO.
801 DEF VAR int-part AS INT NO-UNDO.
802 DEF VAR dec-part AS DEC NO-UNDO.
804 int-part = TRUNCATE( n, 0 ).
805 IF int-part < 0 THEN RETURN.
806 dec-part = n - int-part.
807 IF int-part = 0 AND dec-part = 0 THEN RETURN.
809 /* Need to have this like the following - do not touch */
810 IF int-part <> 0 THEN PUT CONTROL FILL( CHR(10), int-part ).
811 IF dec-part <> 0 THEN PUT CONTROL half-line.
813 ln = ln + n.
815 RUN carriage-return.
817 END PROCEDURE.
819 /* _UIB-CODE-BLOCK-END */
820 &ANALYZE-RESUME
822 &ENDIF
824 &IF DEFINED(EXCLUDE-skip-to-line) = 0 &THEN
826 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-to-line Procedure
827 PROCEDURE skip-to-line :
828 /*------------------------------------------------------------------------------
829 Purpose:
830 Parameters: <none>
831 Notes:
832 ------------------------------------------------------------------------------*/
834 DEF INPUT PARAMETER line-no AS DEC NO-UNDO.
836 DEF VAR int-part AS INT NO-UNDO.
837 DEF VAR dec-part AS DEC NO-UNDO.
839 int-part = TRUNCATE( line-no - ln, 0 ).
840 IF int-part < 0 THEN RETURN.
841 dec-part = ( line-no - ln ) - int-part.
842 IF int-part = 0 AND dec-part = 0 THEN RETURN.
844 IF int-part <> 0 THEN PUT CONTROL FILL( CHR(10), int-part ).
845 IF dec-part <> 0 THEN PUT CONTROL half-line.
847 ln = line-no.
849 RUN carriage-return.
851 END PROCEDURE.
853 /* _UIB-CODE-BLOCK-END */
854 &ANALYZE-RESUME
856 &ENDIF
858 &IF DEFINED(EXCLUDE-statement-of-account) = 0 &THEN
860 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE statement-of-account Procedure
861 PROCEDURE statement-of-account :
862 /*------------------------------------------------------------------------------
863 Purpose:
864 Parameters: <none>
865 Notes:
866 ------------------------------------------------------------------------------*/
868 RUN get-control-strings.
869 RUN get-office-address.
870 RUN date-to-word( TODAY, OUTPUT date-in-words ).
872 IF prop-code <> ? THEN DO:
873 FOR EACH Tenant NO-LOCK WHERE (NOT(active-only) OR Tenant.Active)
874 AND Tenant.EntityType = 'P' AND Tenant.EntityCode = prop-code
875 BY Tenant.TenantCode:
876 RUN each-tenant.
877 END.
878 END.
879 ELSE DO:
880 FOR EACH Tenant NO-LOCK WHERE (NOT(active-only) OR Tenant.Active)
881 AND Tenant.TenantCode >= from-tenant AND Tenant.TenantCode <= to-tenant
882 BY Tenant.TenantCode:
883 RUN each-tenant.
884 END.
885 END.
888 END PROCEDURE.
890 /* _UIB-CODE-BLOCK-END */
891 &ANALYZE-RESUME
893 &ENDIF
895 &IF DEFINED(EXCLUDE-total-line) = 0 &THEN
897 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE total-line Procedure
898 PROCEDURE total-line :
899 /*------------------------------------------------------------------------------
900 Purpose:
901 Parameters: <none>
902 Notes:
903 ------------------------------------------------------------------------------*/
905 trn-no = trn-no + 3.
906 RUN next-transaction.
908 PUT UNFORMATTED SPACE(86) "------------". RUN skip-line(1).
909 PUT UNFORMATTED
910 SPACE(82)
911 STRING( statement-total, ">,>>>,>>>,>>9.99CR" ). RUN skip-line(1).
912 PUT UNFORMATTED SPACE(86) "============". RUN skip-line(1).
914 total-line-printed = Yes.
916 END PROCEDURE.
918 /* _UIB-CODE-BLOCK-END */
919 &ANALYZE-RESUME
921 &ENDIF