Add blank column, rename column.
[capital-apms-progress.git] / process / report / rntladvc.p
blob1dd74e143bfffafdcbcfea7c994d87f06f90ae5e
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
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.
14 {inc/ofc-this.i}
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"}
23 RUN parse-parameters.
25 &SCOPED-DEFINE trn-per-page 52
27 /* Report counters */
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 */
85 &ANALYZE-RESUME
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 */
98 &ANALYZE-RESUME
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 */
110 &ANALYZE-RESUME
112 &ENDIF
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 */
121 &ANALYZE-RESUME
123 &ENDIF
126 /* *********************** Procedure Settings ************************ */
128 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
129 /* Settings for THIS-PROCEDURE
130 Type: Procedure
131 Allow:
132 Frames: 0
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
143 HEIGHT = 25
144 WIDTH = 40.
145 /* END WINDOW DEFINITION */
147 &ANALYZE-RESUME
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}
154 {inc/entity.i}
155 {inc/convert.i}
156 {inc/rentchrg.i}
158 /* _UIB-CODE-BLOCK-END */
159 &ANALYZE-RESUME
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" ) +
171 " for " + user-name.
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.
179 RUN rental-advice.
181 OUTPUT CLOSE.
182 RUN view-output-file ( No ).
184 /* _UIB-CODE-BLOCK-END */
185 &ANALYZE-RESUME
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 /*------------------------------------------------------------------------------
195 Purpose:
196 Parameters: <none>
197 Notes:
198 ------------------------------------------------------------------------------*/
200 PUT CONTROL CHR(13).
202 END PROCEDURE.
204 /* _UIB-CODE-BLOCK-END */
205 &ANALYZE-RESUME
207 &ENDIF
209 &IF DEFINED(EXCLUDE-detail-lines) = 0 &THEN
211 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE detail-lines Procedure
212 PROCEDURE detail-lines :
213 /*------------------------------------------------------------------------------
214 Purpose:
215 ------------------------------------------------------------------------------*/
216 DEF VAR charged-rental AS DEC NO-UNDO.
218 tax-applicable = No.
220 PUT CONTROL body-font.
221 total-rental = 0.
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 ).
227 END.
228 END.
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.
235 RUN skip-line(2).
237 total-rental = 0.
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 ).
247 RUN skip-line(1.5).
248 total-rental = total-rental + charged-rental.
249 END.
251 PUT CONTROL body-font.
252 RUN skip-line(1).
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 ).
259 RUN skip-line(2).
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.
272 RUN separator-line.
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).
278 RUN separator-line.
280 IF gst <> 0 THEN
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).
293 RUN separator-line.
295 END.
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).
302 RUN separator-line.
304 END PROCEDURE.
306 /* _UIB-CODE-BLOCK-END */
307 &ANALYZE-RESUME
309 &ENDIF
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 /*------------------------------------------------------------------------------
316 Purpose:
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:".
326 RUN carriage-return.
327 PUT CONTROL num-font.
328 RUN pcl-move-relative( 0, 53 ).
329 PUT UNFORMATTED " Annual per Month".
330 PUT CONTROL body-font.
331 RUN skip-line(2).
333 total-rental = 0.
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.
341 RUN carriage-return.
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 ).
346 RUN skip-line(1.5).
347 tenant-rent-total = tenant-rent-total + ChargeDetail.ChargeAmount.
348 tenant-tax-total = tenant-tax-total + ROUND( ChargeDetail.TaxableAmount * (Office.GST / 100), 2).
349 END.
351 IF tenant-tax-total <> 0 THEN DO:
352 RUN separator-line.
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".
361 RUN carriage-return.
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.
366 END.
368 RUN separator-line.
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).
374 RUN separator-line.
376 END PROCEDURE.
378 /* _UIB-CODE-BLOCK-END */
379 &ANALYZE-RESUME
381 &ENDIF
383 &IF DEFINED(EXCLUDE-each-tenant) = 0 &THEN
385 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-tenant Procedure
386 PROCEDURE each-tenant :
387 /*------------------------------------------------------------------------------
388 Purpose:
389 Parameters: <none>
390 Notes:
391 ------------------------------------------------------------------------------*/
393 total-rental = 0.
394 total-outgoings = 0.
395 page-no = 1.
396 RUN get-tenant-details.
397 RUN page-header.
399 IF use-rent-charges AND NOT use-rental-spaces THEN
400 RUN detail-rent-charges.
401 ELSE
402 RUN detail-lines.
404 RUN page-footer.
405 RUN page-feed.
407 END PROCEDURE.
409 /* _UIB-CODE-BLOCK-END */
410 &ANALYZE-RESUME
412 &ENDIF
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
420 Parameters: <none>
421 Notes:
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 ).
457 END PROCEDURE.
459 /* _UIB-CODE-BLOCK-END */
460 &ANALYZE-RESUME
462 &ENDIF
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 ------------------------------------------------------------------------------*/
471 {inc/ofc-this.i}
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".
481 END.
482 tax-invoice-no = INTEGER( OfficeSettings.SetValue ).
483 OfficeSettings.SetValue = STRING( tax-invoice-no + 1 ).
484 FIND CURRENT OfficeSettings NO-LOCK.
486 END PROCEDURE.
488 /* _UIB-CODE-BLOCK-END */
489 &ANALYZE-RESUME
491 &ENDIF
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 /*------------------------------------------------------------------------------
498 Purpose:
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.
505 regarding = "".
506 IF Tenant.EntityType = 'P' THEN DO:
507 FIND FIRST Property WHERE Property.PropertyCode = Tenant.EntityCode
508 NO-LOCK NO-ERROR.
509 IF AVAILABLE Property THEN regarding = Property.Name.
510 END.
511 ELSE IF Tenant.EntityType = 'L' THEN DO:
512 FIND FIRST Company WHERE Company.CompanyCode = Tenant.EntityCode
513 NO-LOCK NO-ERROR.
514 IF AVAILABLE Company THEN regarding = Company.LegalName.
515 END.
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.
526 ELSE
527 gst-number = Company.TaxNo.
528 END.
529 END.
531 FIND FIRST PostalDetail WHERE
532 PostalDetail.PersonCode = Tenant.BillingContact AND
533 PostalDetail.PostalType = 'BILL' NO-LOCK NO-ERROR.
535 DO i = 1 TO 6:
536 tenant-address[i] = "".
537 END.
539 tenant-address[1] = Tenant.Name.
540 IF NOT AVAILABLE PostalDetail THEN RETURN.
541 DO i = 2 TO 5:
542 ASSIGN tenant-address[i] = "".
543 ASSIGN
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.
547 END.
549 IF PostalDetail.City <> ? THEN DO:
550 i = last-line + 1.
551 tenant-address[i] = PostalDetail.City.
552 END.
554 END PROCEDURE.
556 /* _UIB-CODE-BLOCK-END */
557 &ANALYZE-RESUME
559 &ENDIF
561 &IF DEFINED(EXCLUDE-next-line) = 0 &THEN
563 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE next-line Procedure
564 PROCEDURE next-line :
565 /*------------------------------------------------------------------------------
566 Purpose:
567 Parameters: <none>
568 Notes:
569 ------------------------------------------------------------------------------*/
571 trn-no = trn-no + 1.
573 IF trn-no >= {&trn-per-page} THEN
575 RUN page-footer.
576 RUN page-feed.
577 RUN page-header.
578 END.
580 END PROCEDURE.
582 /* _UIB-CODE-BLOCK-END */
583 &ANALYZE-RESUME
585 &ENDIF
587 &IF DEFINED(EXCLUDE-page-feed) = 0 &THEN
589 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
590 PROCEDURE page-feed :
591 /*------------------------------------------------------------------------------
592 Purpose:
593 Parameters: <none>
594 Notes:
595 ------------------------------------------------------------------------------*/
597 PUT CONTROL CHR(12).
598 page-no = page-no + 1.
600 END PROCEDURE.
602 /* _UIB-CODE-BLOCK-END */
603 &ANALYZE-RESUME
605 &ENDIF
607 &IF DEFINED(EXCLUDE-page-footer) = 0 &THEN
609 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-footer Procedure
610 PROCEDURE page-footer :
611 /*------------------------------------------------------------------------------
612 Purpose:
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.
624 PUT UNFORMATTED
625 "Please arrange for the attached automatic payment authority to be " +
626 "completed and forwarded to" SKIP(1).
627 PUT UNFORMATTED
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).
640 DO i = 1 TO n:
641 PUT UNFORMATTED ENTRY(i,letters-from) SKIP(1).
642 END.
643 END.
645 PUT CONTROL line-printer.
646 RUN pcl-moveto( 110, 11 ). RUN carriage-return.
648 PUT CONTROL footer-font-1.
649 PUT UNFORMATTED
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.
655 RUN skip-line(2).
656 PUT CONTROL footer-font-2.
657 PUT UNFORMATTED
658 CAPS( "This is a tax invoice which is applicable to all payments made under the above payment" ).
659 RUN skip-line(1.5).
660 PUT UNFORMATTED
661 CAPS( "authority during the term of the applicable property lease or until otherwise varied" ).
662 RUN skip-line(1).
664 END PROCEDURE.
666 /* _UIB-CODE-BLOCK-END */
667 &ANALYZE-RESUME
669 &ENDIF
671 &IF DEFINED(EXCLUDE-page-header) = 0 &THEN
673 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-header Procedure
674 PROCEDURE page-header :
675 /*------------------------------------------------------------------------------
676 Purpose:
677 ------------------------------------------------------------------------------*/
679 RUN reset-page.
681 RUN print-title.
682 RUN print-address.
683 RUN print-header.
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.
689 ELSE
690 client-name = Client.Name.
691 END.
693 PUT CONTROL re-font.
694 IF gst-multi-company THEN DO:
695 PUT UNFORMATTED "SUPPLIER:".
696 RUN carriage-return.
697 PUT CONTROL line-printer.
698 PUT UNFORMATTED SPACE(14).
699 PUT CONTROL re-font.
700 PUT UNFORMATTED STRING( client-name, "X(80)" ).
701 RUN carriage-return.
702 RUN skip-line(2).
703 PUT UNFORMATTED "ABN:".
704 RUN carriage-return.
705 PUT UNFORMATTED SPACE(17).
706 PUT UNFORMATTED STRING( gst-number, "X(80)" ).
707 RUN carriage-return.
708 RUN skip-line(2).
709 PUT UNFORMATTED "RE:".
710 RUN carriage-return.
711 PUT UNFORMATTED SPACE(17).
712 PUT UNFORMATTED STRING( regarding, "X(80)" ).
713 END.
714 ELSE DO:
715 PUT UNFORMATTED "RE:".
716 RUN carriage-return.
717 PUT CONTROL line-printer.
718 PUT UNFORMATTED SPACE(11).
719 PUT CONTROL re-font.
720 PUT UNFORMATTED STRING( regarding, "X(80)" ).
721 END.
723 RUN skip-line(3).
725 PUT CONTROL body-font.
726 PUT UNFORMATTED
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).
729 PUT UNFORMATTED
730 "out on the automatic payment authority attached.".
731 RUN skip-line(3).
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.
736 RUN skip-line(3).
738 END PROCEDURE.
740 /* _UIB-CODE-BLOCK-END */
741 &ANALYZE-RESUME
743 &ENDIF
745 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
747 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
748 PROCEDURE parse-parameters :
749 /*------------------------------------------------------------------------------
750 Purpose:
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)).
768 END CASE.
769 END.
771 END PROCEDURE.
773 /* _UIB-CODE-BLOCK-END */
774 &ANALYZE-RESUME
776 &ENDIF
778 &IF DEFINED(EXCLUDE-print-address) = 0 &THEN
780 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-address Procedure
781 PROCEDURE print-address :
782 /*------------------------------------------------------------------------------
783 Purpose:
784 Parameters: <none>
785 Notes:
786 ------------------------------------------------------------------------------*/
788 DEF VAR i AS INT NO-UNDO.
790 RUN skip-line(2).
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.
799 END.
800 RUN skip-line(2).
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.
805 RUN carriage-return.
806 PUT CONTROL num-font.
807 IF gst-applies THEN
808 PUT UNFORMATTED SPACE( 83 - LENGTH(gst-number)) gst-number.
809 PUT CONTROL tenant-address-font.
810 END.
811 RUN skip-line(2).
813 PUT UNFORMATTED STRING( tenant-address[3], "X(50)" ).
814 RUN skip-line(2).
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.
819 RUN skip-line(2).
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").
823 RUN skip-line(1).
825 IF tenant-address[6] <> "" THEN DO:
826 PUT UNFORMATTED STRING( tenant-address[6], "X(50)" ).
827 RUN skip-line(1).
828 END.
830 END PROCEDURE.
832 /* _UIB-CODE-BLOCK-END */
833 &ANALYZE-RESUME
835 &ENDIF
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 /*------------------------------------------------------------------------------
842 Purpose:
843 Parameters: <none>
844 Notes:
845 ------------------------------------------------------------------------------*/
847 DEF VAR copy-codes AS CHAR NO-UNDO.
849 RUN hpgl-initialize.
850 RUN hpgl-copywatermark.
851 RUN hpgl-get-codes( yes, yes, OUTPUT copy-codes ).
852 PUT CONTROL copy-codes.
854 END PROCEDURE.
856 /* _UIB-CODE-BLOCK-END */
857 &ANALYZE-RESUME
859 &ENDIF
861 &IF DEFINED(EXCLUDE-print-header) = 0 &THEN
863 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-header Procedure
864 PROCEDURE print-header :
865 /*------------------------------------------------------------------------------
866 Purpose:
867 Parameters: <none>
868 Notes:
869 ------------------------------------------------------------------------------*/
871 RUN pcl-move-relative( 0, 50 ).
872 PUT CONTROL title-font.
873 PUT UNFORMATTED "RENTAL ADVICE".
874 PUT CONTROL line-printer.
875 RUN skip-line(1.5).
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.
880 RUN skip-line(2).
882 PUT CONTROL tenant-address-font.
883 PUT UNFORMATTED SPACE(138) STRING( "Page " + STRING( page-no ) ).
884 PUT CONTROL line-printer.
885 RUN skip-line(5).
887 END PROCEDURE.
889 /* _UIB-CODE-BLOCK-END */
890 &ANALYZE-RESUME
892 &ENDIF
894 &IF DEFINED(EXCLUDE-print-title) = 0 &THEN
896 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-title Procedure
897 PROCEDURE print-title :
898 /*------------------------------------------------------------------------------
899 Purpose:
900 Parameters: <none>
901 Notes:
902 ------------------------------------------------------------------------------*/
904 PUT CONTROL line-printer.
905 RUN skip-line(2).
907 RUN hpgl-initialize.
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.
915 RUN skip-line(2).
917 END PROCEDURE.
919 /* _UIB-CODE-BLOCK-END */
920 &ANALYZE-RESUME
922 &ENDIF
924 &IF DEFINED(EXCLUDE-rental-advice) = 0 &THEN
926 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rental-advice Procedure
927 PROCEDURE rental-advice :
928 /*------------------------------------------------------------------------------
929 Purpose:
930 Parameters: <none>
931 Notes:
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.
943 END PROCEDURE.
945 /* _UIB-CODE-BLOCK-END */
946 &ANALYZE-RESUME
948 &ENDIF
950 &IF DEFINED(EXCLUDE-reset-page) = 0 &THEN
952 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
953 PROCEDURE reset-page :
954 /*------------------------------------------------------------------------------
955 Purpose:
956 Parameters: <none>
957 Notes:
958 ------------------------------------------------------------------------------*/
960 PUT CONTROL reset-page.
961 trn-no = 0.
962 ln = 0.
964 END PROCEDURE.
966 /* _UIB-CODE-BLOCK-END */
967 &ANALYZE-RESUME
969 &ENDIF
971 &IF DEFINED(EXCLUDE-separator-line) = 0 &THEN
973 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE separator-line Procedure
974 PROCEDURE separator-line :
975 /*------------------------------------------------------------------------------
976 Purpose:
977 Parameters: <none>
978 Notes:
979 ------------------------------------------------------------------------------*/
981 PUT CONTROL num-font.
982 PUT UNFORMATTED SPACE(69) FILL( "-", 14 ).
983 RUN skip-line(1).
985 END PROCEDURE.
987 /* _UIB-CODE-BLOCK-END */
988 &ANALYZE-RESUME
990 &ENDIF
992 &IF DEFINED(EXCLUDE-skip-line) = 0 &THEN
994 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
995 PROCEDURE skip-line :
996 /*------------------------------------------------------------------------------
997 Purpose:
998 Parameters: <none>
999 Notes:
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.
1016 ln = ln + n.
1018 RUN carriage-return.
1020 END PROCEDURE.
1022 /* _UIB-CODE-BLOCK-END */
1023 &ANALYZE-RESUME
1025 &ENDIF
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 /*------------------------------------------------------------------------------
1032 Purpose:
1033 Parameters: <none>
1034 Notes:
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.
1050 ln = line-no.
1052 RUN carriage-return.
1054 END PROCEDURE.
1056 /* _UIB-CODE-BLOCK-END */
1057 &ANALYZE-RESUME
1059 &ENDIF
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 /*------------------------------------------------------------------------------
1069 Purpose:
1070 ------------------------------------------------------------------------------*/
1071 IF use-rent-charges <> Yes THEN DO:
1072 RETURN (IF space-charged <> ? THEN space-charged ELSE 0).
1073 END.
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 .
1080 END.
1081 IF total-contract = 0.0 THEN DO:
1082 RETURN 0.0 .
1083 END.
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 .
1090 END.
1092 RETURN (space-contract / total-contract) * total-charge .
1094 END FUNCTION.
1096 /* _UIB-CODE-BLOCK-END */
1097 &ANALYZE-RESUME
1099 &ENDIF
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 /*------------------------------------------------------------------------------
1107 Purpose:
1108 Notes: Dummy function.
1109 ------------------------------------------------------------------------------*/
1111 RETURN Yes. /* Function return value. */
1113 END FUNCTION.
1115 /* _UIB-CODE-BLOCK-END */
1116 &ANALYZE-RESUME
1118 &ENDIF