1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 ------------------------------------------------------------------------*/
6 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
7 DEF VAR tenant-code
LIKE Tenant.TenantCode
NO-UNDO.
8 DEF VAR commence-date
AS DATE NO-UNDO.
9 DEF VAR advice-date
AS DATE NO-UNDO.
10 DEF VAR tax-invoice
AS LOGI
NO-UNDO INITIAL Yes.
11 DEF VAR closing-para
AS LOGI
NO-UNDO INITIAL No.
12 DEF VAR use-rental-spaces
AS LOGI
NO-UNDO INITIAL No.
15 {inc
/ofc-set-l.i
"Use-Rent-Charges" "use-rent-charges"}
16 {inc
/ofc-set.i
"Advice-Letters-From" "letters-from"}
17 IF NOT AVAILABLE(OfficeSetting
) THEN letters-from
= "".
18 {inc
/ofc-set.i
"RentCharge-Outgoings" "og-rentcharge-type"}
19 IF NOT AVAILABLE(OfficeSetting
) THEN og-rentcharge-type
= "".
21 {inc
/ofc-set-l.i
"GST-Multi-Company" "gst-multi-company"}
25 &SCOPED-DEFINE trn-per-page 52
28 DEF VAR ln
AS DEC INIT 0.00 NO-UNDO.
30 /* Line definitions
*/
32 DEF VAR date-in-words
AS CHAR NO-UNDO.
33 DEF VAR tenant-address
AS CHAR NO-UNDO EXTENT 6.
34 DEF VAR office-address
AS CHAR NO-UNDO EXTENT 6.
35 DEF VAR client-code
AS CHAR NO-UNDO.
36 DEF VAR client-name
AS CHAR NO-UNDO.
37 DEF VAR entity-type
AS CHAR NO-UNDO.
38 DEF VAR entity-code
AS INT NO-UNDO.
39 DEF VAR trn-line
AS CHAR NO-UNDO.
40 DEF VAR trn-no
AS INT NO-UNDO.
41 DEF VAR regarding
AS CHAR NO-UNDO.
43 DEF VAR reset-page
AS CHAR NO-UNDO.
44 DEF VAR half-line
AS CHAR NO-UNDO. half-line
= CHR(27) + "=".
45 DEF VAR title-font
AS CHAR NO-UNDO.
46 DEF VAR tenant-address-font
AS CHAR NO-UNDO.
47 DEF VAR re-font
AS CHAR NO-UNDO.
48 DEF VAR line-printer
AS CHAR NO-UNDO.
49 DEF VAR body-font
AS CHAR NO-UNDO.
50 DEF VAR body-bold
AS CHAR NO-UNDO.
51 DEF VAR num-font
AS CHAR NO-UNDO.
52 DEF VAR footer-font-1
AS CHAR NO-UNDO.
53 DEF VAR footer-font-2
AS CHAR NO-UNDO.
55 DEF VAR page-no
AS INT NO-UNDO.
56 DEF VAR logo-codes
AS CHAR NO-UNDO.
57 DEF VAR gst-applies
AS LOGI
NO-UNDO.
58 DEF VAR tax-applicable
AS LOGI
NO-UNDO.
60 DEF VAR num-fmt
AS CHAR INIT "->>,>>>,>>9.99" NO-UNDO.
61 DEF VAR total-rental
AS DEC NO-UNDO.
62 DEF VAR total-outgoings
AS DEC NO-UNDO.
63 DEF VAR tax-invoice-no
AS INT NO-UNDO.
65 DEF VAR now
AS CHAR NO-UNDO.
66 DEF VAR user-name
AS CHAR NO-UNDO.
69 gst-applies
= Office.GST
<> ?.
70 IF NOT(gst-applies
) THEN tax-invoice
= No.
72 {inc
/ofc-set.i
"GST-Number" "gst-number"}
73 IF NOT AVAILABLE(OfficeSetting
) THEN
74 gst-number
= REPLACE( STRING( Office.GSTNo
, ">99,999,999"),",","-") .
76 {inc
/ofc-set.i
"GST-Number-Name" "gst-number-name"}
77 IF NOT AVAILABLE(OfficeSetting
) THEN
78 gst-number-name
= "GST NO.".
80 DEF BUFFER AdviceMonth
FOR Month.
81 FIND AdviceMonth
WHERE AdviceMonth.StartDate
<= commence-date
AND AdviceMonth.EndDate
>= commence-date
NO-LOCK.
82 IF commence-date
> AdviceMonth.StartDate
THEN FIND NEXT AdviceMonth
NO-LOCK.
84 /* _UIB-CODE-BLOCK-END
*/
88 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
90 /* ******************** Preprocessor Definitions
******************** */
92 &Scoped-define PROCEDURE-TYPE Procedure
93 &Scoped-define DB-AWARE no
97 /* _UIB-PREPROCESSOR-BLOCK-END
*/
101 /* ************************ Function Prototypes
********************** */
103 &IF DEFINED(EXCLUDE-get-charged-rental) = 0 &THEN
105 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-charged-rental Procedure
106 FUNCTION get-charged-rental
RETURNS DECIMAL
107 ( INPUT space-charged
AS DEC, INPUT space-contract
AS DEC, INPUT area-type
AS CHAR, INPUT lease-code
AS INT ) FORWARD.
109 /* _UIB-CODE-BLOCK-END
*/
114 &IF DEFINED(EXCLUDE-include-lease) = 0 &THEN
116 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD include-lease Procedure
117 FUNCTION include-lease
RETURNS LOGICAL
118 ( INPUT lease-code
AS INT ) FORWARD.
120 /* _UIB-CODE-BLOCK-END
*/
126 /* *********************** Procedure Settings
************************ */
128 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
129 /* Settings for
THIS-PROCEDURE
133 Add Fields to
: Neither
134 Other Settings
: CODE-ONLY
136 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
138 /* ************************* Create Window
************************** */
140 &ANALYZE-SUSPEND _CREATE-WINDOW
141 /* DESIGN Window definition
(used by the UIB
)
142 CREATE WINDOW Procedure
ASSIGN
145 /* END WINDOW DEFINITION
*/
149 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
150 /* ************************* Included-Libraries
*********************** */
152 {inc
/method
/m-txtrep.i
}
153 {inc
/method
/m-hpgl.i
}
158 /* _UIB-CODE-BLOCK-END
*/
165 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
168 /* *************************** Main Block
*************************** */
169 {inc
/username.i
"user-name"}
170 now
= STRING( TODAY, "99/99/9999" ) + " " + STRING( TIME, "HH:MM:SS" ) +
173 RUN get-control-strings.
174 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
176 /* Tell inc
/rentchrg.i to show override descriptions
*/
177 show-override-descriptions
= Yes.
182 RUN view-output-file
( No
).
184 /* _UIB-CODE-BLOCK-END
*/
188 /* ********************** Internal Procedures
*********************** */
190 &IF DEFINED(EXCLUDE-carriage-return) = 0 &THEN
192 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE carriage-return Procedure
193 PROCEDURE carriage-return
:
194 /*------------------------------------------------------------------------------
198 ------------------------------------------------------------------------------*/
204 /* _UIB-CODE-BLOCK-END
*/
209 &IF DEFINED(EXCLUDE-detail-lines) = 0 &THEN
211 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE detail-lines Procedure
212 PROCEDURE detail-lines
:
213 /*------------------------------------------------------------------------------
215 ------------------------------------------------------------------------------*/
216 DEF VAR charged-rental
AS DEC NO-UNDO.
220 PUT CONTROL body-font.
222 FOR EACH TenancyLease
WHERE TenancyLease.TenantCode
= Tenant.TenantCode
223 AND TenancyLease.LeaseStatus
<> "PAST" NO-LOCK:
224 tax-applicable
= tax-applicable
OR TenancyLease.TaxApplies.
225 FOR EACH RentalSpace
OF TenancyLease
WHERE RentalSpace.AreaStatus
<> "V" NO-LOCK:
226 total-rental
= total-rental
+ get-charged-rental
( RentalSpace.ChargedRental
, RentalSpace.ContractedRental
, RentalSpace.AreaType
, RentalSpace.TenancyLeaseCode
).
230 PUT UNFORMATTED "(i) Rental( as below )".
RUN carriage-return.
231 PUT CONTROL num-font.
232 RUN pcl-move-relative
( 0, 69 ).
233 PUT UNFORMATTED STRING( total-rental
, num-fmt
).
234 PUT CONTROL body-font.
238 FOR EACH TenancyLease
WHERE TenancyLease.TenantCode
= Tenant.TenantCode
239 AND TenancyLease.LeaseStatus
<> "PAST",
240 EACH RentalSpace
OF TenancyLease
WHERE RentalSpace.AreaStatus
<> "V" NO-LOCK:
241 charged-rental
= get-charged-rental
( RentalSpace.ChargedRental
, RentalSpace.ContractedRental
, RentalSpace.AreaType
, RentalSpace.TenancyLeaseCode
).
242 PUT CONTROL body-font.
243 PUT UNFORMATTED SPACE(4) RentalSpace.Description.
RUN carriage-return.
244 PUT CONTROL num-font.
245 RUN pcl-move-relative
( 0, 53 ).
246 PUT UNFORMATTED STRING( charged-rental
, num-fmt
).
248 total-rental
= total-rental
+ charged-rental.
251 PUT CONTROL body-font.
253 RUN process
/calcoutg.p
( Tenant.TenantCode
, OUTPUT total-outgoings
).
255 PUT UNFORMATTED "(ii) Outgoings".
RUN carriage-return.
256 PUT CONTROL num-font.
257 RUN pcl-move-relative
( 0, 69 ).
258 PUT UNFORMATTED STRING( total-outgoings
, num-fmt
).
262 DEF VAR total-per-annum
AS DEC NO-UNDO.
263 DEF VAR per-month
AS DEC NO-UNDO.
264 DEF VAR gst
AS DEC NO-UNDO.
265 DEF VAR total-per-month
AS DEC NO-UNDO.
267 total-per-annum
= total-rental
+ total-outgoings.
268 per-month
= ROUND( total-per-annum
/ 12, 2).
269 gst
= IF tax-applicable
AND gst-applies
THEN ROUND( per-month
* ( Office.GST
/ 100 ), 2) ELSE 0.
270 total-per-month
= per-month
+ gst.
273 PUT CONTROL body-font.
274 PUT UNFORMATTED SPACE(60) "Total Per Annum".
RUN carriage-return.
275 PUT CONTROL num-font.
276 RUN pcl-move-relative
( 0, 69 ).
277 PUT UNFORMATTED STRING( total-per-annum
, num-fmt
).
RUN skip-line
(1).
282 PUT CONTROL body-font.
283 PUT UNFORMATTED SPACE(60) "Per Month".
RUN carriage-return.
284 PUT CONTROL num-font.
285 RUN pcl-move-relative
( 0, 69 ).
286 PUT UNFORMATTED STRING( per-month
, num-fmt
).
RUN skip-line
(1.5).
288 PUT CONTROL body-font.
289 PUT UNFORMATTED SPACE(60) "GST".
RUN carriage-return.
290 PUT CONTROL num-font.
291 RUN pcl-move-relative
( 0, 69 ).
292 PUT UNFORMATTED STRING( gst
, num-fmt
).
RUN skip-line
(1).
297 PUT CONTROL body-font.
298 PUT UNFORMATTED SPACE(60) "Total Per Month".
RUN carriage-return.
299 PUT CONTROL num-font.
300 RUN pcl-move-relative
( 0, 69 ).
301 PUT UNFORMATTED STRING( total-per-month
, num-fmt
).
RUN skip-line
(1).
306 /* _UIB-CODE-BLOCK-END
*/
311 &IF DEFINED(EXCLUDE-detail-rent-charges) = 0 &THEN
313 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE detail-rent-charges Procedure
314 PROCEDURE detail-rent-charges
:
315 /*------------------------------------------------------------------------------
317 ------------------------------------------------------------------------------*/
318 DEF VAR tenant-rent-total
AS DEC NO-UNDO INITIAL 0.0 .
319 DEF VAR tenant-tax-total
AS DEC NO-UNDO INITIAL 0.0 .
321 rent-charge-one-period
= Yes.
322 RUN build-tenant-charges
( Tenant.TenantCode
, AdviceMonth.StartDate
, AdviceMonth.EndDate
).
324 PUT CONTROL body-font.
325 PUT UNFORMATTED "Rental and Outgoings charges:".
327 PUT CONTROL num-font.
328 RUN pcl-move-relative
( 0, 53 ).
329 PUT UNFORMATTED " Annual per Month".
330 PUT CONTROL body-font.
334 FOR EACH ChargeDetail
WHERE ChargeDetail.TenantCode
= Tenant.TenantCode
335 AND ChargeDetail.ChargeStart
<= commence-date
336 AND ChargeDetail.ChargedFrom
>= commence-date
337 AND ChargeDetail.ChargedUpTo
>= commence-date
338 AND (ChargeDetail.ChargeEnd
> commence-date
OR ChargeDetail.ChargeEnd
= ?
):
339 PUT CONTROL body-font.
340 PUT UNFORMATTED SPACE(8) ChargeDetail.Description.
342 PUT CONTROL num-font.
343 RUN pcl-move-relative
( 0, 53 ).
344 PUT UNFORMATTED STRING( ChargeDetail.AnnualAmount
, num-fmt
) + " ".
345 PUT UNFORMATTED STRING( ChargeDetail.ChargeAmount
, num-fmt
).
347 tenant-rent-total
= tenant-rent-total
+ ChargeDetail.ChargeAmount.
348 tenant-tax-total
= tenant-tax-total
+ ROUND( ChargeDetail.TaxableAmount
* (Office.GST
/ 100), 2).
351 IF tenant-tax-total
<> 0 THEN DO:
353 PUT CONTROL body-font.
354 PUT UNFORMATTED SPACE(60) "Per Month".
RUN carriage-return.
355 PUT CONTROL num-font.
356 RUN pcl-move-relative
( 0, 69 ).
357 PUT UNFORMATTED STRING( tenant-rent-total
, num-fmt
).
RUN skip-line
(1.5).
359 PUT CONTROL body-font.
360 PUT UNFORMATTED SPACE(60) "GST".
362 PUT CONTROL num-font.
363 RUN pcl-move-relative
( 0, 69 ).
364 PUT UNFORMATTED STRING( tenant-tax-total
, num-fmt
).
RUN skip-line
(1).
365 tenant-rent-total
= tenant-rent-total
+ tenant-tax-total.
369 PUT CONTROL body-font.
370 PUT UNFORMATTED SPACE(60) "Total Per Month".
RUN carriage-return.
371 PUT CONTROL num-font.
372 RUN pcl-move-relative
( 0, 69 ).
373 PUT UNFORMATTED STRING( tenant-rent-total
, num-fmt
).
RUN skip-line
(1).
378 /* _UIB-CODE-BLOCK-END
*/
383 &IF DEFINED(EXCLUDE-each-tenant) = 0 &THEN
385 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-tenant Procedure
386 PROCEDURE each-tenant
:
387 /*------------------------------------------------------------------------------
391 ------------------------------------------------------------------------------*/
396 RUN get-tenant-details.
399 IF use-rent-charges
AND NOT use-rental-spaces
THEN
400 RUN detail-rent-charges.
409 /* _UIB-CODE-BLOCK-END
*/
414 &IF DEFINED(EXCLUDE-get-control-strings) = 0 &THEN
416 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-control-strings Procedure
417 PROCEDURE get-control-strings
:
418 /*------------------------------------------------------------------------------
419 Purpose
: Get all control strings for this report
422 ------------------------------------------------------------------------------*/
424 DEF VAR rows
AS DEC NO-UNDO.
425 DEF VAR cols
AS DEC NO-UNDO.
427 RUN make-control-string
( "PCL", "reset,portrait,a4,tm,0,lm,6",
428 OUTPUT reset-page
, OUTPUT rows
, OUTPUT cols
).
430 RUN make-control-string
( "PCL", "Helvetica,Point,20,Bold,Proportional",
431 OUTPUT title-font
, OUTPUT rows
, OUTPUT cols
).
433 RUN make-control-string
( "PCL", "Courier,Fixed,cpi,12,Bold",
434 OUTPUT num-font
, OUTPUT rows
, OUTPUT cols
).
436 RUN make-control-string
( "PCL", "Helvetica,Point,10,Proportional,Normal",
437 OUTPUT tenant-address-font
, OUTPUT rows
, OUTPUT cols
).
439 RUN make-control-string
( "PCL", "Helvetica,Point,11,Proportional,Bold",
440 OUTPUT re-font
, OUTPUT rows
, OUTPUT cols
).
442 RUN make-control-string
( "PCL", "LinePrinter,lpi,9.54",
443 OUTPUT line-printer
, OUTPUT rows
, OUTPUT cols
).
445 RUN make-control-string
( "PCL", "Times,Point,11,Proportional,Normal",
446 OUTPUT body-font
, OUTPUT rows
, OUTPUT cols
).
448 RUN make-control-string
( "PCL", "Times,Point,11,Proportional,Bold",
449 OUTPUT body-bold
, OUTPUT rows
, OUTPUT cols
).
451 RUN make-control-string
( "PCL", "Times,Point,10.5,Proportional,Normal",
452 OUTPUT footer-font-1
, OUTPUT rows
, OUTPUT cols
).
454 RUN make-control-string
( "PCL", "Helvetica,Point,10,Proportional,Bold",
455 OUTPUT footer-font-2
, OUTPUT rows
, OUTPUT cols
).
459 /* _UIB-CODE-BLOCK-END
*/
464 &IF DEFINED(EXCLUDE-get-tax-invoice-no) = 0 &THEN
466 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-tax-invoice-no Procedure
467 PROCEDURE get-tax-invoice-no
:
468 /*------------------------------------------------------------------------------
469 Purpose
: Find the next invoice number
470 ------------------------------------------------------------------------------*/
473 FIND OfficeSettings
OF Office
EXCLUSIVE-LOCK
474 WHERE OfficeSettings.SetName
= "Next-Rental-Advice-No" NO-ERROR.
476 IF NOT AVAILABLE(OfficeSettings
) THEN DO:
477 CREATE OfficeSettings.
478 ASSIGN OfficeSettings.OfficeCode
= Office.OfficeCode
479 OfficeSettings.SetName
= "Next-Rental-Advice-No"
480 OfficeSettings.SetValue
= "1".
482 tax-invoice-no
= INTEGER( OfficeSettings.SetValue
).
483 OfficeSettings.SetValue
= STRING( tax-invoice-no
+ 1 ).
484 FIND CURRENT OfficeSettings
NO-LOCK.
488 /* _UIB-CODE-BLOCK-END
*/
493 &IF DEFINED(EXCLUDE-get-tenant-details) = 0 &THEN
495 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-tenant-details Procedure
496 PROCEDURE get-tenant-details
:
497 /*------------------------------------------------------------------------------
499 ------------------------------------------------------------------------------*/
500 DEF VAR i
AS INT NO-UNDO.
501 DEF VAR last-line
AS INT NO-UNDO.
503 DEF VAR company-code
AS INT NO-UNDO.
506 IF Tenant.EntityType
= 'P'
THEN DO:
507 FIND FIRST Property
WHERE Property.PropertyCode
= Tenant.EntityCode
509 IF AVAILABLE Property
THEN regarding
= Property.Name.
511 ELSE IF Tenant.EntityType
= 'L'
THEN DO:
512 FIND FIRST Company
WHERE Company.CompanyCode
= Tenant.EntityCode
514 IF AVAILABLE Company
THEN regarding
= Company.LegalName.
517 entity-type
= Tenant.EntityType.
518 entity-code
= Tenant.EntityCode.
519 client-code
= get-entity-client
( entity-type
, entity-code
).
520 IF gst-multi-company
THEN DO:
521 company-code
= get-entity-ledger
( entity-type
, entity-code
).
522 FIND FIRST Company
WHERE Company.CompanyCode
= company-code
NO-LOCK NO-ERROR.
523 IF AVAILABLE(Company
) THEN DO:
524 IF Company.OperationalCountry
= 'AUS'
THEN
525 gst-number
= Company.BusinessNo.
527 gst-number
= Company.TaxNo.
531 FIND FIRST PostalDetail
WHERE
532 PostalDetail.PersonCode
= Tenant.BillingContact
AND
533 PostalDetail.PostalType
= 'BILL'
NO-LOCK NO-ERROR.
536 tenant-address
[i
] = "".
539 tenant-address
[1] = Tenant.Name.
540 IF NOT AVAILABLE PostalDetail
THEN RETURN.
542 ASSIGN tenant-address
[i
] = "".
544 tenant-address
[i
] = ENTRY( i
- 1, PostalDetail.Address
, CHR(10) ) NO-ERROR.
545 IF tenant-address
[i
] = ?
THEN tenant-address
[i
] = "".
546 IF tenant-address
[i
] <> "" THEN last-line
= i.
549 IF PostalDetail.City
<> ?
THEN DO:
551 tenant-address
[i
] = PostalDetail.City.
556 /* _UIB-CODE-BLOCK-END
*/
561 &IF DEFINED(EXCLUDE-next-line) = 0 &THEN
563 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE next-line Procedure
564 PROCEDURE next-line
:
565 /*------------------------------------------------------------------------------
569 ------------------------------------------------------------------------------*/
573 IF trn-no
>= {&trn-per-page} THEN
582 /* _UIB-CODE-BLOCK-END
*/
587 &IF DEFINED(EXCLUDE-page-feed) = 0 &THEN
589 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
590 PROCEDURE page-feed
:
591 /*------------------------------------------------------------------------------
595 ------------------------------------------------------------------------------*/
598 page-no
= page-no
+ 1.
602 /* _UIB-CODE-BLOCK-END
*/
607 &IF DEFINED(EXCLUDE-page-footer) = 0 &THEN
609 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-footer Procedure
610 PROCEDURE page-footer
:
611 /*------------------------------------------------------------------------------
613 ------------------------------------------------------------------------------*/
614 DEF VAR i
AS INT NO-UNDO.
615 DEF VAR n
AS INT NO-UNDO.
616 DEF VAR client-name
AS CHAR NO-UNDO.
618 IF closing-para
THEN DO:
619 PUT CONTROL body-font.
620 PUT UNFORMATTED SKIP(1)
621 "Rental that is due in respect of a partial months occupation will be " +
622 "included on your next tax invoice." SKIP(2).
623 PUT CONTROL body-bold.
625 "Please arrange for the attached automatic payment authority to be " +
626 "completed and forwarded to" SKIP(1).
628 "your bank." SKIP(2).
629 PUT CONTROL body-font.
630 PUT UNFORMATTED "Yours faithfully" SKIP(1).
632 entity-type
= Tenant.EntityType.
633 entity-code
= Tenant.EntityCode.
634 client-code
= get-entity-client
( entity-type
, entity-code
).
635 FIND Client
WHERE Client.ClientCode
= client-code
NO-LOCK NO-ERROR.
636 IF AVAILABLE(Client
) THEN client-name
= Client.LegalName.
ELSE client-name
= Office.Name .
637 PUT UNFORMATTED client-name
SKIP(8).
639 n
= NUM-ENTRIES(letters-from
).
641 PUT UNFORMATTED ENTRY(i
,letters-from
) SKIP(1).
645 PUT CONTROL line-printer.
646 RUN pcl-moveto
( 110, 11 ).
RUN carriage-return.
648 PUT CONTROL footer-font-1.
650 "In the event that the automatic payment authority is not in effect on the " +
651 "commencement date a cheque should be issued.".
653 IF NOT tax-invoice
THEN RETURN.
656 PUT CONTROL footer-font-2.
658 CAPS( "This is a tax invoice which is applicable to all payments made under the above payment" ).
661 CAPS( "authority during the term of the applicable property lease or until otherwise varied" ).
666 /* _UIB-CODE-BLOCK-END
*/
671 &IF DEFINED(EXCLUDE-page-header) = 0 &THEN
673 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-header Procedure
674 PROCEDURE page-header
:
675 /*------------------------------------------------------------------------------
677 ------------------------------------------------------------------------------*/
685 FIND FIRST Client
WHERE Client.ClientCode
= client-code
NO-ERROR.
686 IF AVAILABLE Client
THEN DO:
687 IF Client.Name
<> Client.LegalName
AND Client.LegalName
<> ?
AND Client.LegalName
<> "" THEN
688 client-name
= Client.LegalName.
690 client-name
= Client.Name.
694 IF gst-multi-company
THEN DO:
695 PUT UNFORMATTED "SUPPLIER:".
697 PUT CONTROL line-printer.
698 PUT UNFORMATTED SPACE(14).
700 PUT UNFORMATTED STRING( client-name
, "X(80)" ).
703 PUT UNFORMATTED "ABN:".
705 PUT UNFORMATTED SPACE(17).
706 PUT UNFORMATTED STRING( gst-number
, "X(80)" ).
709 PUT UNFORMATTED "RE:".
711 PUT UNFORMATTED SPACE(17).
712 PUT UNFORMATTED STRING( regarding
, "X(80)" ).
715 PUT UNFORMATTED "RE:".
717 PUT CONTROL line-printer.
718 PUT UNFORMATTED SPACE(11).
720 PUT UNFORMATTED STRING( regarding
, "X(80)" ).
725 PUT CONTROL body-font.
727 "The property rental shown below is payable by regular automatic transfer " +
728 "on the 1st day of each month as set".
RUN skip-line
(1.5).
730 "out on the automatic payment authority attached.".
733 DEF VAR commence-date-in-words
AS CHAR NO-UNDO.
734 RUN date-to-word
( commence-date
, OUTPUT commence-date-in-words
).
735 PUT UNFORMATTED "Commencement Date: " + commence-date-in-words.
740 /* _UIB-CODE-BLOCK-END
*/
745 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
747 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
748 PROCEDURE parse-parameters
:
749 /*------------------------------------------------------------------------------
751 ------------------------------------------------------------------------------*/
752 DEF VAR token
AS CHAR NO-UNDO.
753 DEF VAR i
AS INT NO-UNDO.
755 {inc
/showopts.i
"report-options"}
757 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
758 token
= ENTRY( i
, report-options
, "~n" ).
760 CASE ENTRY( 1, token
):
761 WHEN "TenantCode" THEN tenant-code
= INT( ENTRY(2,token
) ).
762 WHEN "UseRentalSpaces" THEN use-rental-spaces
= Yes.
763 WHEN "NotTaxInvoice" THEN tax-invoice
= No.
764 WHEN "ClosingParagraph" THEN closing-para
= Yes.
765 WHEN "UsePastCharges" THEN use-past-charges
= Yes.
766 WHEN "Commencing" THEN commence-date
= DATE( ENTRY(2,token
)).
767 WHEN "AdviceDate" THEN advice-date
= DATE( ENTRY(2,token
)).
773 /* _UIB-CODE-BLOCK-END
*/
778 &IF DEFINED(EXCLUDE-print-address) = 0 &THEN
780 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-address Procedure
781 PROCEDURE print-address
:
782 /*------------------------------------------------------------------------------
786 ------------------------------------------------------------------------------*/
788 DEF VAR i
AS INT NO-UNDO.
791 PUT CONTROL tenant-address-font.
793 PUT UNFORMATTED STRING( tenant-address
[1], "X(50)" ).
RUN carriage-return.
794 IF tax-invoice
THEN DO:
795 PUT UNFORMATTED SPACE( 100 ) "Tax Invoice No:".
RUN carriage-return.
796 PUT CONTROL num-font.
797 PUT UNFORMATTED SPACE( 78 ) STRING( tax-invoice-no
, ">>>>9" ).
798 PUT CONTROL tenant-address-font.
802 PUT UNFORMATTED STRING( tenant-address
[2], "X(50)" ).
RUN carriage-return.
803 IF tax-invoice
THEN DO:
804 PUT UNFORMATTED SPACE( 100 ) gst-number-name.
806 PUT CONTROL num-font.
808 PUT UNFORMATTED SPACE( 83 - LENGTH(gst-number
)) gst-number.
809 PUT CONTROL tenant-address-font.
813 PUT UNFORMATTED STRING( tenant-address
[3], "X(50)" ).
816 PUT UNFORMATTED STRING( tenant-address
[4], "X(50)" ).
RUN carriage-return.
817 PUT UNFORMATTED SPACE(110) STRING( date-in-words
, "X(20)" ).
RUN carriage-return.
821 PUT UNFORMATTED STRING( tenant-address
[5], "X(50)" ).
RUN carriage-return.
822 PUT UNFORMATTED SPACE(110) "Our ref: " + Tenant.EntityType
+ STRING( Tenant.EntityCode
, "99999") + "/" + "T" + STRING(Tenant.TenantCode
, "99999").
825 IF tenant-address
[6] <> "" THEN DO:
826 PUT UNFORMATTED STRING( tenant-address
[6], "X(50)" ).
832 /* _UIB-CODE-BLOCK-END
*/
837 &IF DEFINED(EXCLUDE-print-copy-sign) = 0 &THEN
839 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-copy-sign Procedure
840 PROCEDURE print-copy-sign
:
841 /*------------------------------------------------------------------------------
845 ------------------------------------------------------------------------------*/
847 DEF VAR copy-codes
AS CHAR NO-UNDO.
850 RUN hpgl-copywatermark.
851 RUN hpgl-get-codes
( yes
, yes
, OUTPUT copy-codes
).
852 PUT CONTROL copy-codes.
856 /* _UIB-CODE-BLOCK-END
*/
861 &IF DEFINED(EXCLUDE-print-header) = 0 &THEN
863 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-header Procedure
864 PROCEDURE print-header
:
865 /*------------------------------------------------------------------------------
869 ------------------------------------------------------------------------------*/
871 RUN pcl-move-relative
( 0, 50 ).
872 PUT CONTROL title-font.
873 PUT UNFORMATTED "RENTAL ADVICE".
874 PUT CONTROL line-printer.
876 RUN pcl-move-relative
( 0, 40 ).
877 PUT CONTROL footer-font-2.
878 PUT UNFORMATTED (IF tax-invoice
OR NOT(gst-applies
) THEN "" ELSE "(THIS IS NOT A TAX INVOICE)").
879 PUT CONTROL line-printer.
882 PUT CONTROL tenant-address-font.
883 PUT UNFORMATTED SPACE(138) STRING( "Page " + STRING( page-no
) ).
884 PUT CONTROL line-printer.
889 /* _UIB-CODE-BLOCK-END
*/
894 &IF DEFINED(EXCLUDE-print-title) = 0 &THEN
896 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-title Procedure
897 PROCEDURE print-title
:
898 /*------------------------------------------------------------------------------
902 ------------------------------------------------------------------------------*/
904 PUT CONTROL line-printer.
909 RUN client-logo
( entity-type
, entity-code
, client-code
).
910 RUN client-address
( entity-type
, entity-code
, client-code
).
911 RUN hpgl-get-codes
( yes
, yes
, OUTPUT logo-codes
).
912 PUT CONTROL logo-codes.
914 PUT CONTROL line-printer.
919 /* _UIB-CODE-BLOCK-END
*/
924 &IF DEFINED(EXCLUDE-rental-advice) = 0 &THEN
926 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rental-advice Procedure
927 PROCEDURE rental-advice
:
928 /*------------------------------------------------------------------------------
932 ------------------------------------------------------------------------------*/
934 DEF VAR i
AS INT NO-UNDO.
936 RUN get-control-strings.
937 RUN get-tax-invoice-no.
938 RUN date-to-word
( advice-date
, OUTPUT date-in-words
).
940 FIND Tenant
WHERE Tenant.TenantCode
= tenant-code
NO-LOCK NO-ERROR.
941 IF AVAILABLE Tenant
THEN RUN each-tenant.
945 /* _UIB-CODE-BLOCK-END
*/
950 &IF DEFINED(EXCLUDE-reset-page) = 0 &THEN
952 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
953 PROCEDURE reset-page
:
954 /*------------------------------------------------------------------------------
958 ------------------------------------------------------------------------------*/
960 PUT CONTROL reset-page.
966 /* _UIB-CODE-BLOCK-END
*/
971 &IF DEFINED(EXCLUDE-separator-line) = 0 &THEN
973 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE separator-line Procedure
974 PROCEDURE separator-line
:
975 /*------------------------------------------------------------------------------
979 ------------------------------------------------------------------------------*/
981 PUT CONTROL num-font.
982 PUT UNFORMATTED SPACE(69) FILL( "-", 14 ).
987 /* _UIB-CODE-BLOCK-END
*/
992 &IF DEFINED(EXCLUDE-skip-line) = 0 &THEN
994 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
995 PROCEDURE skip-line
:
996 /*------------------------------------------------------------------------------
1000 ------------------------------------------------------------------------------*/
1002 DEF INPUT PARAMETER n
AS DEC NO-UNDO.
1004 DEF VAR int-part
AS INT NO-UNDO.
1005 DEF VAR dec-part
AS DEC NO-UNDO.
1007 int-part
= TRUNCATE( n
, 0 ).
1008 IF int-part
< 0 THEN RETURN.
1009 dec-part
= n
- int-part.
1010 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
1012 /* Need to have this like the following
- do not touch
*/
1013 IF int-part
<> 0 THEN PUT CONTROL FILL( CHR(10), int-part
).
1014 IF dec-part
<> 0 THEN PUT CONTROL half-line.
1018 RUN carriage-return.
1022 /* _UIB-CODE-BLOCK-END
*/
1027 &IF DEFINED(EXCLUDE-skip-to-line) = 0 &THEN
1029 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-to-line Procedure
1030 PROCEDURE skip-to-line
:
1031 /*------------------------------------------------------------------------------
1035 ------------------------------------------------------------------------------*/
1037 DEF INPUT PARAMETER line-no
AS DEC NO-UNDO.
1039 DEF VAR int-part
AS INT NO-UNDO.
1040 DEF VAR dec-part
AS DEC NO-UNDO.
1042 int-part
= TRUNCATE( line-no
- ln
, 0 ).
1043 IF int-part
< 0 THEN RETURN.
1044 dec-part
= ( line-no
- ln
) - int-part.
1045 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
1047 IF int-part
<> 0 THEN PUT CONTROL FILL( CHR(10), int-part
).
1048 IF dec-part
<> 0 THEN PUT CONTROL half-line.
1052 RUN carriage-return.
1056 /* _UIB-CODE-BLOCK-END
*/
1061 /* ************************ Function Implementations
***************** */
1063 &IF DEFINED(EXCLUDE-get-charged-rental) = 0 &THEN
1065 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-charged-rental Procedure
1066 FUNCTION get-charged-rental
RETURNS DECIMAL
1067 ( INPUT space-charged
AS DEC, INPUT space-contract
AS DEC, INPUT area-type
AS CHAR, INPUT lease-code
AS INT ) :
1068 /*------------------------------------------------------------------------------
1070 ------------------------------------------------------------------------------*/
1071 IF use-rent-charges
<> Yes
THEN DO:
1072 RETURN (IF space-charged
<> ?
THEN space-charged
ELSE 0).
1075 DEF BUFFER TestSpace
FOR RentalSpace.
1076 DEF VAR total-contract
AS DEC NO-UNDO INITIAL 0.0.
1077 FOR EACH TestSpace
WHERE TestSpace.TenancyLeaseCode
= lease-code
1078 AND TestSpace.AreaStatus
= "L" NO-LOCK:
1079 total-contract
= total-contract
+ TestSpace.ContractedRental .
1081 IF total-contract
= 0.0 THEN DO:
1085 DEF BUFFER TestCharge
FOR RentCharge.
1086 DEF VAR total-charge
AS DEC NO-UNDO INITIAL 0.0.
1087 FOR EACH TestCharge
WHERE TestCharge.TenancyLeaseCode
= lease-code
1088 AND TestCharge.RentChargeType
<> og-rentcharge-type
NO-LOCK:
1089 total-charge
= total-charge
+ TestCharge.CurrentAnnualRental .
1092 RETURN (space-contract
/ total-contract
) * total-charge .
1096 /* _UIB-CODE-BLOCK-END
*/
1101 &IF DEFINED(EXCLUDE-include-lease) = 0 &THEN
1103 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION include-lease Procedure
1104 FUNCTION include-lease
RETURNS LOGICAL
1105 ( INPUT lease-code
AS INT ) :
1106 /*------------------------------------------------------------------------------
1108 Notes
: Dummy function.
1109 ------------------------------------------------------------------------------*/
1111 RETURN Yes.
/* Function return value.
*/
1115 /* _UIB-CODE-BLOCK-END
*/