Add blank column, rename column.
[capital-apms-progress.git] / process / report / apform.p
blob6a899647d70bf39e375e46a19cbc0e42f6a56a53
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 ------------------------------------------------------------------------*/
16 DEF INPUT PARAMETER report-options AS CHAR NO-UNDO.
18 DEF VAR tenant-code LIKE Tenant.TenantCode NO-UNDO.
19 DEF VAR bank-account LIKE BankAccount.BankAccountCode NO-UNDO.
20 DEF VAR commence-date AS DATE NO-UNDO.
21 DEF VAR use-rental-spaces AS LOGI NO-UNDO INITIAL No.
23 {inc/ofc-this.i}
24 {inc/ofc-set-l.i "Use-Rent-Charges" "use-rent-charges"}
25 {inc/ofc-set.i "Advice-Letters-From" "letters-from"}
26 IF NOT AVAILABLE(OfficeSetting) THEN letters-from = "".
27 {inc/ofc-set.i "RentCharge-Outgoings" "og-rentcharge-type"}
28 IF NOT AVAILABLE(OfficeSetting) THEN og-rentcharge-type = "".
31 RUN parse-parameters.
33 DEF VAR fixed-codes AS CHAR NO-UNDO.
34 DEF VAR section-codes AS CHAR EXTENT 4 NO-UNDO.
36 DEF VAR variable-codes AS CHAR NO-UNDO.
37 DEF VAR prt-ctrl AS CHAR NO-UNDO.
38 DEF VAR rows AS INT NO-UNDO.
39 DEF VAR cols AS INT NO-UNDO.
41 DEF VAR payee-particulars AS CHAR NO-UNDO.
42 DEF VAR gst-applies AS LOGI NO-UNDO.
43 DEF VAR tax-applicable AS LOGI NO-UNDO.
45 DEF VAR user-name AS CHAR NO-UNDO.
46 DEF VAR print-id AS CHAR NO-UNDO.
47 DEF VAR total-per-month AS DEC NO-UNDO.
50 FIND Month WHERE Month.StartDate <= commence-date AND Month.EndDate >= commence-date NO-LOCK.
51 DEF VAR commence-month-start AS DATE NO-UNDO.
52 DEF VAR commence-month-end AS DATE NO-UNDO.
53 commence-month-start = Month.StartDate.
54 commence-month-end = Month.EndDate.
56 /* _UIB-CODE-BLOCK-END */
57 &ANALYZE-RESUME
60 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
62 /* ******************** Preprocessor Definitions ******************** */
64 &Scoped-define PROCEDURE-TYPE Procedure
65 &Scoped-define DB-AWARE no
69 /* _UIB-PREPROCESSOR-BLOCK-END */
70 &ANALYZE-RESUME
73 /* ************************ Function Prototypes ********************** */
75 &IF DEFINED(EXCLUDE-get-charged-rental) = 0 &THEN
77 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-charged-rental Procedure
78 FUNCTION get-charged-rental RETURNS DECIMAL
79 ( INPUT space-charged AS DEC, INPUT space-contract AS DEC, INPUT area-type AS CHAR, INPUT lease-code AS INT ) FORWARD.
81 /* _UIB-CODE-BLOCK-END */
82 &ANALYZE-RESUME
84 &ENDIF
86 &IF DEFINED(EXCLUDE-get-expected-dc) = 0 &THEN
88 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-expected-dc Procedure
89 FUNCTION get-expected-dc RETURNS DECIMAL
90 ( /* parameter-definitions */ ) FORWARD.
92 /* _UIB-CODE-BLOCK-END */
93 &ANALYZE-RESUME
95 &ENDIF
97 &IF DEFINED(EXCLUDE-get-expected-dc-rentalspace) = 0 &THEN
99 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-expected-dc-rentalspace Procedure
100 FUNCTION get-expected-dc-rentalspace RETURNS DECIMAL
101 ( /* parameter-definitions */ ) FORWARD.
103 /* _UIB-CODE-BLOCK-END */
104 &ANALYZE-RESUME
106 &ENDIF
108 &IF DEFINED(EXCLUDE-include-lease) = 0 &THEN
110 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD include-lease Procedure
111 FUNCTION include-lease RETURNS LOGICAL
112 ( INPUT lease-code AS INT ) FORWARD.
114 /* _UIB-CODE-BLOCK-END */
115 &ANALYZE-RESUME
117 &ENDIF
120 /* *********************** Procedure Settings ************************ */
122 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
123 /* Settings for THIS-PROCEDURE
124 Type: Procedure
125 Allow:
126 Frames: 0
127 Add Fields to: Neither
128 Other Settings: CODE-ONLY COMPILE
130 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
132 /* ************************* Create Window ************************** */
134 &ANALYZE-SUSPEND _CREATE-WINDOW
135 /* DESIGN Window definition (used by the UIB)
136 CREATE WINDOW Procedure ASSIGN
137 HEIGHT = 15.25
138 WIDTH = 42.
139 /* END WINDOW DEFINITION */
141 &ANALYZE-RESUME
143 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
144 /* ************************* Included-Libraries *********************** */
146 {inc/method/m-txtrep.i}
147 {inc/method/m-hpgl.i}
148 {inc/convert.i}
149 {inc/rentchrg.i}
151 /* _UIB-CODE-BLOCK-END */
152 &ANALYZE-RESUME
158 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
161 /* *************************** Main Block *************************** */
162 {inc/username.i "user-name"}
163 print-id = STRING( TODAY, "99/99/9999" ) + " " + STRING( TIME, "HH:MM" ) + " " +
164 user-name.
166 gst-applies = Office.GST <> ?.
168 RUN make-control-string ( "PCL", "reset,portrait,tm,0,a4,lm,0,courier,cpi,18,lpi,9",
169 OUTPUT prt-ctrl, OUTPUT rows, OUTPUT cols ).
170 RUN output-control-file ( prt-ctrl ).
171 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES PAGE-SIZE 0.
173 RUN ap-form.
175 OUTPUT CLOSE.
176 RUN view-output-file ( No ).
178 /* _UIB-CODE-BLOCK-END */
179 &ANALYZE-RESUME
182 /* ********************** Internal Procedures *********************** */
184 &IF DEFINED(EXCLUDE-ap-form) = 0 &THEN
186 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE ap-form Procedure
187 PROCEDURE ap-form :
188 /*------------------------------------------------------------------------------
189 Purpose:
190 ------------------------------------------------------------------------------*/
192 RUN get-fixed-codes.
193 DEF VAR i AS INT NO-UNDO.
194 DO i = 1 TO 4:
195 PUT CONTROL section-codes[i].
196 END.
198 RUN get-variables.
199 RUN variable-replacements.
200 PUT CONTROL variable-codes.
202 RUN make-control-string( "PCL", "eject", OUTPUT prt-ctrl, OUTPUT rows, OUTPUT cols ).
203 PUT CONTROL prt-ctrl.
205 END PROCEDURE.
207 /* _UIB-CODE-BLOCK-END */
208 &ANALYZE-RESUME
210 &ENDIF
212 &IF DEFINED(EXCLUDE-edit-box) = 0 &THEN
214 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE edit-box Procedure
215 PROCEDURE edit-box :
216 /*------------------------------------------------------------------------------
217 Purpose:
218 Parameters: <none>
219 Notes:
220 ------------------------------------------------------------------------------*/
222 &SCOP box-w 4
223 &SCOP box-h 6.5
225 DEF INPUT PARAMETER sequence-string AS CHAR NO-UNDO.
227 DEF VAR n AS INT NO-UNDO.
228 DEF VAR i AS INT NO-UNDO.
229 DEF VAR j AS INT NO-UNDO.
230 DEF VAR k AS INT NO-UNDO.
232 RUN hpgl-set-line-width( 0.25 ).
234 DO i = 1 TO NUM-ENTRIES( sequence-string ):
236 ASSIGN n = INT( ENTRY( i, sequence-string ) ) NO-ERROR.
238 IF ERROR-STATUS:ERROR OR n = 0 THEN
240 RUN hpgl-move-relative( {&box-w}, 0 ).
241 k = k + 1.
242 END.
243 ELSE
244 DO j = 1 TO n:
245 RUN hpgl-box-relative( {&box-w}, {&box-h} ).
246 RUN hpgl-move-relative( {&box-w}, 0 ).
247 k = k + 1.
248 END.
250 END.
252 RUN hpgl-move-relative( {&box-w} * k * -1, 0 ).
254 END PROCEDURE.
256 /* _UIB-CODE-BLOCK-END */
257 &ANALYZE-RESUME
259 &ENDIF
261 &IF DEFINED(EXCLUDE-get-fixed-codes) = 0 &THEN
263 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-fixed-codes Procedure
264 PROCEDURE get-fixed-codes :
265 /*------------------------------------------------------------------------------
266 Purpose:
267 Parameters: <none>
268 Notes:
269 ------------------------------------------------------------------------------*/
271 RUN hpgl-initialize.
273 /* The constant parts of the page */
274 RUN section-1.
275 RUN section-2.
276 RUN section-3.
277 RUN section-4.
279 END PROCEDURE.
281 /* _UIB-CODE-BLOCK-END */
282 &ANALYZE-RESUME
284 &ENDIF
286 &IF DEFINED(EXCLUDE-get-frequency-desc) = 0 &THEN
288 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-frequency-desc Procedure
289 PROCEDURE get-frequency-desc :
290 /*------------------------------------------------------------------------------
291 Purpose: Get the lease payment frequency description
292 Parameters: <none>
293 Notes:
294 ------------------------------------------------------------------------------*/
295 DEF INPUT PARAM v-tenantcode LIKE TenancyLease.TenantCode NO-UNDO.
296 DEF OUTPUT PARAM freq-desc AS CHAR INITIAL '' NO-UNDO.
298 FOR EACH TenancyLease WHERE TenancyLease.TenantCode = Tenant.TenantCode
299 AND TenancyLease.LeaseStatus <> "PAST" NO-LOCK:
301 /* If there are different frequencies for the various leases then default to Monthly */
302 IF freq-desc = '' THEN freq-desc = TenancyLease.PaymentFrequency.
303 ELSE IF freq-desc <> TenancyLease.PaymentFrequency THEN freq-desc = "MNTH".
305 END.
307 FIND FIRST FrequencyType WHERE FrequencyType.FrequencyCode = freq-desc NO-LOCK NO-ERROR.
308 IF AVAILABLE FrequencyType
309 THEN DO:
310 freq-desc = FrequencyType.DESCRIPTION.
311 END.
312 ELSE freq-desc = "Monthly".
314 END PROCEDURE.
316 /* _UIB-CODE-BLOCK-END */
317 &ANALYZE-RESUME
319 &ENDIF
321 &IF DEFINED(EXCLUDE-get-tenant-details) = 0 &THEN
323 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-tenant-details Procedure
324 PROCEDURE get-tenant-details :
325 /*------------------------------------------------------------------------------
326 Purpose:
327 Parameters: <none>
328 Notes:
329 ------------------------------------------------------------------------------*/
331 DEF VAR entity-name AS CHAR NO-UNDO.
333 FIND Tenant WHERE Tenant.TenantCode = tenant-code NO-LOCK.
334 entity-name = Tenant.Name.
336 IF Tenant.EntityType = "P" THEN DO:
337 FIND Property WHERE Property.PropertyCode = Tenant.EntityCode NO-LOCK NO-ERROR.
338 IF AVAILABLE Property THEN entity-name = Property.Name.
339 END.
340 ELSE IF Tenant.EntityType = "L" THEN DO:
341 FIND Company WHERE Company.CompanyCode = Tenant.EntityCode NO-LOCK NO-ERROR.
342 IF AVAILABLE Company THEN entity-name = Company.LegalName.
343 END.
345 total-per-month = get-expected-dc().
347 payee-particulars =
348 "RENTAL, " + STRING( SUBSTR ( entity-name, 1, 21 ), "X(21)" ) +
349 " T" + STRING( Tenant.TenantCode, "99999" ).
350 payee-particulars = CAPS( payee-particulars ).
352 END PROCEDURE.
354 /* _UIB-CODE-BLOCK-END */
355 &ANALYZE-RESUME
357 &ENDIF
359 &IF DEFINED(EXCLUDE-get-variables) = 0 &THEN
361 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-variables Procedure
362 PROCEDURE get-variables :
363 /*------------------------------------------------------------------------------
364 Purpose:
365 Parameters: <none>
366 Notes:
367 ------------------------------------------------------------------------------*/
369 RUN hpgl-moveto( 160, 228 ).
370 RUN hpgl-text( "Times,Proportional,Point,12,Bold", "@TodaysDate@" ).
372 RUN hpgl-moveto( 59, 201.5 ).
373 RUN hpgl-text( hpgl-last-font, "@CommenceDate@" ).
374 RUN hpgl-move-relative( 81, 0 ).
375 RUN hpgl-text( hpgl-last-font, "@Frequency@" ).
376 RUN hpgl-move-relative( -88, -16.5 ).
377 RUN hpgl-text( "Times,Proportional,Point,10,Bold", "@DollarAmount@" ).
378 RUN hpgl-move-relative( 40, 0 ).
379 RUN hpgl-text( "Times,Proportional,Point,7,Bold", "@AmountInWords@" ).
381 RUN hpgl-moveto( 109, 173 ).
382 RUN hpgl-text( "Courier,Fixed,cpi,8,Bold", "@PayeeName@" ).
383 RUN hpgl-moveto( 20, 87 ).
384 RUN hpgl-text( "Times,Proportional,Point,10,Normal",
385 "Information to appear in @PayeeName2@'s bank statement:" ).
387 RUN hpgl-moveto( 109, 160 ).
388 RUN hpgl-text( "Courier,Fixed,cpi,8,Bold", "@PayeeAccount@" ).
390 RUN hpgl-moveto( 93, 153 ).
391 RUN hpgl-text( "Times,Proportional,Point,10,Bold", "@BankName@ @BranchName@ " ).
393 /******************
394 RUN hpgl-moveto( 148, 153 ).
395 RUN hpgl-text( "Times,Proportional,Point,10,Bold", "@BranchName@" ).
396 ******************/
398 RUN hpgl-moveto( 28.5, 78 ).
399 RUN hpgl-text( "Courier,Fixed,cpi,8,Bold", "@PayeeParticulars@" ).
401 RUN hpgl-get-codes( no, yes, OUTPUT variable-codes ).
404 END PROCEDURE.
406 /* _UIB-CODE-BLOCK-END */
407 &ANALYZE-RESUME
409 &ENDIF
411 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
413 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
414 PROCEDURE parse-parameters :
415 /*------------------------------------------------------------------------------
416 Purpose:
417 ------------------------------------------------------------------------------*/
418 DEF VAR token AS CHAR NO-UNDO.
419 DEF VAR i AS INT NO-UNDO.
421 {inc/showopts.i "report-options"}
423 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
424 token = ENTRY( i, report-options, "~n" ).
426 CASE ENTRY( 1, token ):
427 WHEN "TenantCode" THEN tenant-code = INT( ENTRY(2,token) ).
428 WHEN "BankAccount" THEN bank-account = ENTRY(2,token).
429 WHEN "UseRentalSpaces" THEN use-rental-spaces = Yes.
430 WHEN "Commencing" THEN commence-date = DATE( ENTRY(2,token)).
431 END CASE.
432 END.
434 END PROCEDURE.
436 /* _UIB-CODE-BLOCK-END */
437 &ANALYZE-RESUME
439 &ENDIF
441 &IF DEFINED(EXCLUDE-replace-payee-details) = 0 &THEN
443 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE replace-payee-details Procedure
444 PROCEDURE replace-payee-details :
445 /*------------------------------------------------------------------------------
446 Purpose:
447 Parameters: <none>
448 Notes:
449 ------------------------------------------------------------------------------*/
451 DEF VAR name-codes AS CHAR NO-UNDO.
452 DEF VAR account-codes AS CHAR NO-UNDO.
453 DEF VAR particular-codes AS CHAR NO-UNDO.
454 DEF VAR move-relative AS CHAR NO-UNDO.
455 DEF VAR payee-name AS CHAR NO-UNDO.
456 DEF VAR payee-account AS CHAR NO-UNDO.
458 DEF VAR i AS INT NO-UNDO.
459 DEF VAR j AS INT NO-UNDO.
461 RUN hpgl-move-relative( 4, 0).
462 RUN hpgl-get-codes( no, yes, OUTPUT move-relative ).
464 /* Payee Name */
466 FIND FIRST BankAccount WHERE BankAccount.BankAccountCode = bank-account
467 NO-LOCK NO-ERROR.
468 IF NOT AVAILABLE BankAccount THEN RETURN.
470 payee-name = CAPS( SUBSTR( BankAccount.AccountName, 1, 20 ) ).
471 DO i = 1 TO LENGTH( payee-name ):
472 name-codes = name-codes + SUBSTRING( payee-name, i, 1) + move-relative .
473 END.
475 /* Account Code */
477 payee-account = STRING( BankAccount.BankAccount, "99-9999-9999999-999" ).
478 DO i = 1 TO NUM-ENTRIES( payee-account, "-" ):
479 DO j = 1 TO LENGTH( ENTRY( i, payee-account, "-") ):
480 account-codes = account-codes + SUBSTR( ENTRY( i, payee-account, "-" ), j, 1 ) + move-relative.
481 END.
482 account-codes = account-codes + move-relative.
483 END.
485 /* Payee Particulars */
487 DO i = 1 TO LENGTH( payee-particulars ):
488 particular-codes = particular-codes + SUBSTR( payee-particulars, i, 1 ) + move-relative.
489 IF i MODULO 12 = 0 THEN
490 particular-codes = particular-codes + move-relative + move-relative.
491 END.
493 hpgl-codes = variable-codes.
494 RUN hpgl-replace( "@PayeeName@", name-codes ).
495 RUN hpgl-replace( "@PayeeName2@", BankAccount.AccountName ).
496 RUN hpgl-replace( "@PayeeAccount@", account-codes ).
497 RUN hpgl-replace( "@PayeeParticulars@", particular-codes ).
498 RUN hpgl-replace( "@BankName@", BankAccount.BankName ).
499 RUN hpgl-replace( "@BranchName@", BankAccount.BankBranchName ).
500 RUN hpgl-get-codes( no, yes, OUTPUT variable-codes ).
502 END PROCEDURE.
504 /* _UIB-CODE-BLOCK-END */
505 &ANALYZE-RESUME
507 &ENDIF
509 &IF DEFINED(EXCLUDE-section-1) = 0 &THEN
511 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE section-1 Procedure
512 PROCEDURE section-1 :
513 /*------------------------------------------------------------------------------
514 Purpose: Print the voucher approval boxes.
515 ------------------------------------------------------------------------------*/
517 RUN hpgl-moveto( 20, 268).
518 RUN hpgl-set-line-width( 1 ).
519 RUN hpgl-box-relative( 126, 15 ).
521 RUN hpgl-move-relative( 1, 11 ).
522 RUN hpgl-text( "Times,Proportional,Point,8,Normal", "TO: The Manager," ).
523 RUN hpgl-move-relative( 0, -7 ).
524 RUN hpgl-set-line-width( 0.1 ).
525 RUN hpgl-line-relative( 124, 0 ).
526 RUN hpgl-move-relative( -124 + 42, -3 ).
527 RUN hpgl-text( hpgl-last-font, "(Insert Name of Bank and Branch)" ).
528 RUN hpgl-move-relative( -43, -1 ).
530 RUN hpgl-set-line-width( 1 ).
531 RUN hpgl-move-relative( 0, -13.5 ).
532 RUN hpgl-box-relative( 126, 10 ).
533 RUN hpgl-move-relative( 1, 6 ).
534 RUN hpgl-text( "Times,Proportional,Point,6,Normal", "07" ).
535 RUN hpgl-move-relative( 3, 0 ).
536 RUN hpgl-text( "Times,Proportional,Point,8,Normal", "NAME OF ACCOUNT:" ).
537 RUN hpgl-move-relative( -4, -6 ).
539 RUN hpgl-move-relative( 0, -30.5 ).
540 RUN hpgl-box-relative( 68, 27 ).
542 RUN hpgl-set-line-width( 0.5 ).
543 RUN hpgl-box-relative( 73, 27 ).
544 RUN hpgl-box-relative( 126, 27 ).
546 /* Account Number Edit Boxes */
548 RUN hpgl-move-relative( 3, 12 ).
549 RUN edit-box( "2" ).
550 RUN hpgl-move-relative( 0.5, 1.5 ).
551 RUN hpgl-text( "Times,Proportional,Point,12,Bold", "A" ).
552 RUN hpgl-move-relative( -0.5, -5 ).
553 RUN hpgl-text( "Times,Proportional,Point,6,Normal", "N - New" ).
554 RUN hpgl-move-relative( 0, -2 ).
555 RUN hpgl-text( hpgl-last-font, "C - Change" ).
556 RUN hpgl-move-relative( 0, 5.5 ).
558 RUN hpgl-move-relative( 29, 3.25 ).
559 RUN edit-box( "2, ,4" ).
560 RUN hpgl-move-relative( -8, 4 ).
561 RUN hpgl-text( hpgl-last-font, "Payer's" ).
562 RUN hpgl-move-relative( 0, -2 ).
563 RUN hpgl-text( hpgl-last-font, "Account" ).
564 RUN hpgl-move-relative( 0, -2 ).
565 RUN hpgl-text( hpgl-last-font, "Number" ).
566 RUN hpgl-move-relative( 8, 7.3 ).
567 RUN hpgl-text( hpgl-last-font, "Bank" ).
568 RUN hpgl-move-relative( 12, 0 ).
569 RUN hpgl-text( hpgl-last-font, "Branch" ).
570 RUN hpgl-move-relative( -12, -7.3 ).
572 RUN hpgl-move-relative( -12, -13 ).
573 RUN edit-box( "7" ).
574 RUN hpgl-move-relative( 1, 1.5 ).
575 RUN hpgl-text( "Times,Proportional,Point,12,Bold", "0" ).
576 RUN hpgl-move-relative( -1, -1.5 + 7.3 ).
577 RUN hpgl-text( "Times,Proportional,Point,6,Normal", "Account Number" ).
578 RUN hpgl-move-relative( 0, -7.3 ).
580 RUN hpgl-move-relative( 28, 3.25 ).
581 RUN hpgl-line-relative( 4, 0 ).
583 RUN hpgl-move-relative( 0, -3.25 ).
584 RUN edit-box( "3" ).
585 RUN hpgl-move-relative( 0, 7.3 ).
586 RUN hpgl-text( hpgl-last-font, "Suffix" ).
587 RUN hpgl-move-relative( 0, -7.3 ).
589 /* Other Edit Boxes */
591 RUN hpgl-move-relative( 26, 13 ).
592 RUN edit-box( "3, ,2, ,1, ,1" ).
593 RUN hpgl-move-relative( -2.5, 4 ).
594 RUN hpgl-text( hpgl-last-font, "01" ).
595 RUN hpgl-move-relative( 16, 0 ).
596 RUN hpgl-text( hpgl-last-font, "02" ).
597 RUN hpgl-move-relative( 12, 0 ).
598 RUN hpgl-text( hpgl-last-font, "06" ).
599 RUN hpgl-move-relative( 8, 0 ).
600 RUN hpgl-text( hpgl-last-font, "28" ).
601 RUN hpgl-move-relative( -36 + 2.5, 3.3 ).
602 RUN hpgl-text( hpgl-last-font, "A/P No." ).
603 RUN hpgl-move-relative( 16, 0 ).
604 RUN hpgl-text( hpgl-last-font, "Type" ).
605 RUN hpgl-move-relative( 12, 0 ).
606 RUN hpgl-text( hpgl-last-font, "Charge" ).
607 RUN hpgl-move-relative( 8, 2 ).
608 RUN hpgl-text( hpgl-last-font, "Bank" ).
609 RUN hpgl-move-relative( 0, -2 ).
610 RUN hpgl-text( hpgl-last-font, "Interest" ).
611 RUN hpgl-move-relative( -36, -7.3 ).
613 RUN hpgl-move-relative( 0, -13 ).
614 RUN edit-box( "4, ,3, ,1" ).
615 RUN hpgl-move-relative( -2.5, 4 ).
616 RUN hpgl-text( hpgl-last-font, "11" ).
617 RUN hpgl-move-relative( 20, 0 ).
618 RUN hpgl-text( hpgl-last-font, "12" ).
619 RUN hpgl-move-relative( 16, 0 ).
620 RUN hpgl-text( hpgl-last-font, "13" ).
621 RUN hpgl-move-relative( -36 + 2.5, 3.3 ).
622 RUN hpgl-text( hpgl-last-font, "Non Std Com." ).
623 RUN hpgl-move-relative( 20, 2 ).
624 RUN hpgl-text( hpgl-last-font, "Bulk/G.A" ).
625 RUN hpgl-move-relative( 0, -2 ).
626 RUN hpgl-text( hpgl-last-font, "Code" ).
627 RUN hpgl-move-relative( 16, 2 ).
628 RUN hpgl-text( hpgl-last-font, "Freq." ).
629 RUN hpgl-move-relative( 0, -2 ).
630 RUN hpgl-text( hpgl-last-font, "O'ride" ).
631 RUN hpgl-move-relative( -36 - 78, -7.3 - 2 ).
633 /* Office use only stuff */
635 RUN hpgl-move-relative( 129, 59 - 26 ).
636 RUN hpgl-set-line-width( 0.5 ).
637 RUN hpgl-box-relative( 55, 26 ).
639 RUN hpgl-move-relative( 9, 21 ).
640 RUN hpgl-text( "Times,Proportional,Point,12,Bold", "AUTHORITY FOR" ).
641 RUN hpgl-move-relative( -7, -4 ).
642 RUN hpgl-text( hpgl-last-font, "AUTOMATIC PAYMENTS" ).
643 RUN hpgl-move-relative( 9, -11 ).
644 RUN hpgl-text( "Times,Proportional,Point,10,Normal", "(Not to operate as an" ).
645 RUN hpgl-move-relative( -3, -3 ).
646 RUN hpgl-text( hpgl-last-font, "assignment or agreement)" ).
647 RUN hpgl-move-relative( -8, -3 ).
649 RUN hpgl-move-relative( 0, -13 ).
650 RUN hpgl-box-relative( 55, 11 ).
651 RUN hpgl-box-relative( 40, 11 ).
652 RUN hpgl-box-relative( 21, 11 ).
654 RUN hpgl-move-relative( 1, 8 ).
655 RUN hpgl-text( "Times,Proportional,Point,7,Normal", "Date Received:" ).
656 RUN hpgl-move-relative( 21, 0 ).
657 RUN hpgl-text( hpgl-last-font, "Recorded By:" ).
658 RUN hpgl-move-relative( 19, 0 ).
659 RUN hpgl-text( hpgl-last-font, "Checked By:" ).
660 RUN hpgl-move-relative( -41, -8 ).
662 RUN hpgl-move-relative( 0, -20 ).
663 RUN hpgl-box-relative( 55, 18 ).
664 RUN hpgl-move-relative( 1, 15 ).
665 RUN hpgl-text( "Times,Proportional,Point,7,Normal", "Date:" ).
667 RUN hpgl-get-codes( no, yes, OUTPUT section-codes[1] ).
669 END PROCEDURE.
671 /* _UIB-CODE-BLOCK-END */
672 &ANALYZE-RESUME
674 &ENDIF
676 &IF DEFINED(EXCLUDE-section-2) = 0 &THEN
678 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE section-2 Procedure
679 PROCEDURE section-2 :
680 /*------------------------------------------------------------------------------
681 Purpose:
682 Parameters: <none>
683 Notes:
684 ------------------------------------------------------------------------------*/
686 RUN hpgl-moveto( 20, 209).
687 RUN hpgl-text( "Time,Proportional,Point,8,Normal",
688 "Please effect this Automatic Payment by debiting my/our account. Details are:-" ).
690 RUN hpgl-move-relative( 0, -8 ).
691 RUN hpgl-text( hpgl-last-font, "COMMENCING DATE:" ).
692 RUN hpgl-move-relative( 90, 0 ).
693 RUN hpgl-text( hpgl-last-font, "FREQUENCY:" ).
694 RUN hpgl-move-relative( -52, -1 ).
695 RUN hpgl-set-line-width( 0.5 ).
696 RUN hpgl-box-relative( 43, 5.5 ).
698 RUN hpgl-move-relative( -2.5, 3.25 ).
699 RUN hpgl-text( "Time,Proportional,Point,6,Normal", "04" ).
700 RUN hpgl-move-relative( 2.5 + 81, -3.25 ).
701 RUN hpgl-box-relative( 65, 5.5 ).
702 RUN hpgl-move-relative( -2.5, 3.25 ).
703 RUN hpgl-text( hpgl-last-font, "05" ).
704 RUN hpgl-move-relative( 2.5 - 119, -3.25 + 1 ).
706 RUN hpgl-move-relative( 0, -10 ).
707 RUN hpgl-text( "Time,Proportional,Point,8,Normal", "AMOUNT:" ).
708 RUN hpgl-move-relative( 30, 0 ).
709 RUN hpgl-text( hpgl-last-font, "Amount" ).
710 RUN hpgl-move-relative( 40, 0 ).
711 RUN hpgl-text( hpgl-last-font, "Amount in Words" ).
712 RUN hpgl-move-relative( -70, 0 - 7.5 ).
714 RUN hpgl-box-relative( 184, 5.5 ).
715 RUN hpgl-box-relative( 70, 5.5 ).
716 RUN hpgl-box-relative( 30, 5.5 ).
718 RUN hpgl-move-relative( 1, 3.5 ).
719 RUN hpgl-text( "Times,Proportional,Point,6,Normal", "(i)" ).
720 RUN hpgl-move-relative( 3, 0 ).
721 RUN hpgl-text( hpgl-last-font, "When Amount" ).
722 RUN hpgl-move-relative( 0, -2 ).
723 RUN hpgl-text( hpgl-last-font, "is constant" ).
724 RUN hpgl-move-relative( 23.5, 1.5 ).
725 RUN hpgl-text( hpgl-last-font, "03" ).
726 RUN hpgl-move-relative( -27.5, -3 ).
728 RUN hpgl-move-relative( 0, -6 ).
729 RUN hpgl-text( "Times,Proportional,Point,10,Normal", "UNTIL" ).
730 RUN hpgl-move-relative( 14, 0 ).
731 RUN hpgl-text( "Times,Proportional,Point,12,Bold", "Further Notice" ).
732 RUN hpgl-move-relative( 30, 0 ).
733 RUN hpgl-text( "Times,Proportional,Point,10,Normal", "PAY TO:" ).
734 RUN hpgl-move-relative( -44 + 70, -27 ).
736 RUN hpgl-box-relative( 114, 30 ).
737 RUN hpgl-move-relative( 3, 25 ).
738 RUN hpgl-text( "Times,Proportional,Point,6,Normal", "Payee's" ).
739 RUN hpgl-move-relative( 0, -2 ).
740 RUN hpgl-text( hpgl-last-font, "Name" ).
742 RUN hpgl-move-relative( 13, 2 ).
743 RUN hpgl-text( hpgl-last-font, "19" ).
744 RUN hpgl-move-relative( 2.5, -4 ).
745 RUN edit-box( "20" ).
746 RUN hpgl-move-relative( 0, -13 ).
747 RUN edit-box( "2, ,4, ,7, ,3" ).
748 RUN hpgl-move-relative( -15.5, 4 ).
749 RUN hpgl-text( hpgl-last-font, "Payee's" ).
750 RUN hpgl-move-relative( 0, -2 ).
751 RUN hpgl-text( hpgl-last-font, "Account" ).
752 RUN hpgl-move-relative( 0, -2 ).
753 RUN hpgl-text( hpgl-last-font, "Number" ).
755 RUN hpgl-move-relative( 13, 4 ).
756 RUN hpgl-text( hpgl-last-font, "18" ).
757 RUN hpgl-move-relative( 2.5, 3.3 ).
758 RUN hpgl-text( hpgl-last-font, "Bank" ).
759 RUN hpgl-move-relative( 12, 0 ).
760 RUN hpgl-text( hpgl-last-font, "Branch" ).
761 RUN hpgl-move-relative( 20, 0 ).
762 RUN hpgl-text( hpgl-last-font, "Payee's Account Number" ).
763 RUN hpgl-move-relative( 32, 0 ).
764 RUN hpgl-text( hpgl-last-font, "Suffix" ).
766 RUN hpgl-get-codes( no, yes, OUTPUT section-codes[2] ).
768 END PROCEDURE.
770 /* _UIB-CODE-BLOCK-END */
771 &ANALYZE-RESUME
773 &ENDIF
775 &IF DEFINED(EXCLUDE-section-3) = 0 &THEN
777 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE section-3 Procedure
778 PROCEDURE section-3 :
779 /*------------------------------------------------------------------------------
780 Purpose:
781 Parameters: <none>
782 Notes:
783 ------------------------------------------------------------------------------*/
785 RUN hpgl-moveto( 20, 138).
786 RUN hpgl-text( "Time,Proportional,Point,10,Bold", "CONDITIONS:" ).
787 RUN hpgl-move-relative( 28, 0 ).
788 RUN hpgl-text( "Time,Proportional,Point,8,Normal",
789 "I/we understand and accept that the bank accepts this authority only upon the following conditions, namely:-" ).
791 RUN hpgl-move-relative( -28, -5 ).
792 RUN hpgl-text( "Time,Proportional,Point,7,Normal", "1." ).
793 RUN text-lines(
794 "The bank will endeavour to effect such automatic payments without any responsibility or liability for any refusal or omission to make all or any of the payments, or for late" + CHR(10) +
795 "payment, or for any omission to follow any such instructions. Further the bank accepts no responsibility or liability for the accuracy of the information contained in the" + CHR(10) +
796 "payment information fields on this authority, or for failure to transmit such information in the manner requested. In any event this authority is subject to any arrangement" + CHR(10) +
797 "nor or hereafter subsisting between myself/ourselves and the bank in relation to my/our account." ).
799 RUN hpgl-move-relative( -3, -2.2 ).
800 RUN hpgl-text( hpgl-last-font, "2." ).
801 RUN text-lines(
802 "The bank may, in its absolute discretion, conclusively determine the order of priority of payment by it of any moneys pursuant to this or any other authority or cheque which" + CHR(10) +
803 "I/we may now or hereafter give to the bank or draw on my/our account." ).
805 RUN hpgl-move-relative( -3, -2.2 ).
806 RUN hpgl-text( hpgl-last-font, "3." ).
807 RUN text-lines(
808 "The bank may at any time terminate this order as to future payments by notice in writing to me/us - or without any notice at any time after being advised in writing by the" + CHR(10) +
809 "abovenamed payee that no further payment is required." ).
811 RUN hpgl-move-relative( -3, -2.2 ).
812 RUN hpgl-text( hpgl-last-font, "4." ).
813 RUN text-lines(
814 "This order will remain in full force and effect in respect of all payments made in good faith notwithstanding my/our death or bankruptcy or any other revocation of this order" + CHR(10) +
815 "until notice of my/our death, bankruptcy or such revocation is received by the bank." ).
817 RUN hpgl-move-relative( -3, -2.2 ).
818 RUN hpgl-text( hpgl-last-font, "5." ).
819 RUN text-lines(
820 "All current bank charges for this service in force from time to time are to be added to the payment and debited to my/our account." ).
822 RUN hpgl-get-codes( no, yes, OUTPUT section-codes[3] ).
824 END PROCEDURE.
826 /* _UIB-CODE-BLOCK-END */
827 &ANALYZE-RESUME
829 &ENDIF
831 &IF DEFINED(EXCLUDE-section-4) = 0 &THEN
833 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE section-4 Procedure
834 PROCEDURE section-4 :
835 /*------------------------------------------------------------------------------
836 Purpose:
837 Parameters: <none>
838 Notes:
839 ------------------------------------------------------------------------------*/
841 RUN hpgl-moveto( 28, 76 ).
842 RUN edit-box( "12, , ,12, , ,12" ).
844 RUN hpgl-move-relative( 0, 7.3 ).
845 RUN hpgl-text( "Times,Proportional,Point,6,Normal", "15 Payee Particulars" ).
846 RUN hpgl-move-relative( 56, 0 ).
847 RUN hpgl-text( hpgl-last-font, "16 Payee Code" ).
848 RUN hpgl-move-relative( 56, 0 ).
849 RUN hpgl-text( hpgl-last-font, "17 Payee Reference" ).
850 RUN hpgl-move-relative( 0, -9 ).
851 RUN hpgl-text( "Times,Proportional,Point,6,Bold", "Please end with our code for automatic processing" ).
852 RUN hpgl-move-relative( -120, -9.3 ).
854 RUN hpgl-text( "Times,Proportional,Point,10,Normal",
855 "Information to appear in my/our bank statement:" ).
856 RUN hpgl-move-relative( 8, -11 ).
857 RUN edit-box( "12, , ,12, , ,12" ).
859 RUN hpgl-move-relative( 0, 7.8 ).
860 RUN hpgl-text( "Times,Proportional,Point,6,Normal", "25 Payer Particulars" ).
861 RUN hpgl-move-relative( 56, 0 ).
862 RUN hpgl-text( hpgl-last-font, "26 Payer Code" ).
863 RUN hpgl-move-relative( 56, 0 ).
864 RUN hpgl-text( hpgl-last-font, "27 Payer Reference" ).
865 RUN hpgl-move-relative( -112, -7.8 ).
867 RUN hpgl-set-line-width( 1 ).
868 RUN hpgl-box-relative( 48, 6.5 ).
869 RUN hpgl-move-relative( 56, 0 ).
870 RUN hpgl-box-relative( 48, 6.5 ).
871 RUN hpgl-move-relative( 56, 0 ).
872 RUN hpgl-box-relative( 48, 6.5 ).
873 RUN hpgl-move-relative( -112 - 8, 0 ).
875 RUN hpgl-move-relative( 0, -33 ).
876 RUN hpgl-box-relative( 184, 21 ).
877 RUN hpgl-box-relative( 85, 21 ).
879 RUN hpgl-move-relative( 2, 17 ).
880 RUN hpgl-text( "Times,Proportional,Point,10,Bold", "IMPORTANT - PLEASE INDICATE" ).
881 RUN hpgl-move-relative( 0, -12 ).
882 RUN edit-box( "1" ).
883 RUN hpgl-move-relative( 8, 3.5 ).
884 RUN hpgl-text( "Times,Proportional,Point,6,Normal", "This is a new" ).
885 RUN hpgl-move-relative( 0, -2 ).
886 RUN hpgl-text( hpgl-last-font, "Authority" ).
887 RUN hpgl-move-relative( 17, -1.5 ).
889 RUN edit-box( "1" ).
890 RUN hpgl-move-relative( 8, 7 ).
891 RUN hpgl-text( hpgl-last-font, "As from above commencing date, this" ).
892 RUN hpgl-move-relative( 0, -2 ).
893 RUN hpgl-text( hpgl-last-font, "authority replaces existing authorities for" ).
894 RUN hpgl-move-relative( 0, -5 ).
895 RUN hpgl-text( hpgl-last-font, "$" ).
896 RUN hpgl-move-relative( 2, 0 ).
897 RUN hpgl-set-line-width( 0.1 ).
898 RUN hpgl-line-relative( 34, 0 ).
899 RUN hpgl-move-relative( 1, 0 ).
900 RUN hpgl-text( hpgl-last-font, "in favour of" ).
901 RUN hpgl-move-relative( -37, -2 ).
902 RUN hpgl-text( hpgl-last-font, "the same payee." ).
903 RUN hpgl-move-relative( -36, -3 ).
905 RUN hpgl-move-relative( 88, 17.5 ).
906 RUN hpgl-text( hpgl-last-font, "Name of Account (Customer to complete):" ).
907 RUN hpgl-move-relative( 0, -7 ).
908 RUN hpgl-line-relative( 95, 0 ).
909 RUN hpgl-move-relative( -95, -7 ).
910 RUN hpgl-line-relative( 95, 0 ).
911 RUN hpgl-move-relative( -60, -2 ).
912 RUN hpgl-text( hpgl-last-font, "Customer's Signature" ).
913 RUN hpgl-move-relative( 42, -0.6 ).
914 RUN hpgl-text( 'Courier,Point,4,Proportional,Normal', print-id ).
916 RUN hpgl-get-codes( no, yes, OUTPUT section-codes[4] ).
918 END PROCEDURE.
920 /* _UIB-CODE-BLOCK-END */
921 &ANALYZE-RESUME
923 &ENDIF
925 &IF DEFINED(EXCLUDE-text-lines) = 0 &THEN
927 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE text-lines Procedure
928 PROCEDURE text-lines :
929 /*------------------------------------------------------------------------------
930 Purpose:
931 Parameters: <none>
932 Notes:
933 ------------------------------------------------------------------------------*/
935 DEF INPUT PARAMETER lines AS CHAR NO-UNDO.
937 DEF VAR i AS INT NO-UNDO.
939 RUN hpgl-move-relative( 3, 0 ).
941 DO i = 1 TO NUM-ENTRIES( lines, CHR(10) ):
942 RUN hpgl-text( hpgl-last-font, ENTRY( i, lines, CHR(10) ) ).
943 RUN hpgl-move-relative( 0, -2.2 ).
944 END.
946 END PROCEDURE.
948 /* _UIB-CODE-BLOCK-END */
949 &ANALYZE-RESUME
951 &ENDIF
953 &IF DEFINED(EXCLUDE-variable-replacements) = 0 &THEN
955 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE variable-replacements Procedure
956 PROCEDURE variable-replacements :
957 /*------------------------------------------------------------------------------
958 Purpose:
959 Parameters: <none>
960 Notes:
961 ------------------------------------------------------------------------------*/
963 RUN get-tenant-details.
964 RUN replace-payee-details.
966 DEF VAR date-in-words AS CHAR NO-UNDO.
967 DEF VAR amount-in-words AS CHAR NO-UNDO.
968 DEF VAR freq-desc AS CHAR NO-UNDO INITIAL "Monthly".
970 hpgl-codes = variable-codes.
972 RUN date-to-word( TODAY, OUTPUT date-in-words ).
973 RUN hpgl-replace( "@TodaysDate@", date-in-words ).
974 RUN date-to-word( commence-date, OUTPUT date-in-words ).
975 RUN hpgl-replace( "@CommenceDate@", date-in-words ).
976 RUN get-frequency-desc(Tenant.TenantCode, OUTPUT freq-desc).
977 RUN hpgl-replace( "@Frequency@", freq-desc ).
978 RUN amount-to-word( total-per-month, OUTPUT amount-in-words ).
979 SUBSTR( amount-in-words, 1, 1 ) = CAPS( SUBSTR( amount-in-words, 1, 1 ) ).
980 RUN hpgl-replace( "@DollarAmount@", STRING( total-per-month, "$ZZZ,ZZ9.99" ) ).
981 RUN hpgl-replace( "@AmountInWords@", amount-in-words ).
983 RUN hpgl-get-codes( no, yes, OUTPUT variable-codes ).
985 END PROCEDURE.
987 /* _UIB-CODE-BLOCK-END */
988 &ANALYZE-RESUME
990 &ENDIF
992 /* ************************ Function Implementations ***************** */
994 &IF DEFINED(EXCLUDE-get-charged-rental) = 0 &THEN
996 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-charged-rental Procedure
997 FUNCTION get-charged-rental RETURNS DECIMAL
998 ( INPUT space-charged AS DEC, INPUT space-contract AS DEC, INPUT area-type AS CHAR, INPUT lease-code AS INT ) :
999 /*------------------------------------------------------------------------------
1000 Purpose:
1001 ------------------------------------------------------------------------------*/
1002 IF use-rent-charges <> Yes THEN DO:
1003 RETURN (IF space-charged <> ? THEN space-charged ELSE 0).
1004 END.
1006 DEF BUFFER TestSpace FOR RentalSpace.
1007 DEF VAR total-contract AS DEC NO-UNDO INITIAL 0.0.
1008 FOR EACH TestSpace WHERE TestSpace.TenancyLeaseCode = lease-code
1009 AND TestSpace.AreaStatus = "L" NO-LOCK:
1010 total-contract = total-contract + TestSpace.ContractedRental .
1011 END.
1012 IF total-contract = 0.0 THEN DO:
1013 RETURN 0.0 .
1014 END.
1016 DEF BUFFER TestCharge FOR RentCharge.
1017 DEF VAR total-charge AS DEC NO-UNDO INITIAL 0.0.
1018 FOR EACH TestCharge WHERE TestCharge.TenancyLeaseCode = lease-code
1019 AND TestCharge.RentChargeType <> og-rentcharge-type NO-LOCK:
1020 total-charge = total-charge + TestCharge.CurrentAnnualRental .
1021 END.
1023 RETURN (space-contract / total-contract) * total-charge .
1025 END FUNCTION.
1027 /* _UIB-CODE-BLOCK-END */
1028 &ANALYZE-RESUME
1030 &ENDIF
1032 &IF DEFINED(EXCLUDE-get-expected-dc) = 0 &THEN
1034 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-expected-dc Procedure
1035 FUNCTION get-expected-dc RETURNS DECIMAL
1036 ( /* parameter-definitions */ ) :
1037 /*------------------------------------------------------------------------------
1038 Purpose: Get the expected DC due
1039 Notes:
1040 ------------------------------------------------------------------------------*/
1041 IF use-rental-spaces = Yes THEN RETURN get-expected-dc-rentalspace().
1043 rent-charge-one-period = Yes.
1044 RUN build-tenant-charges( Tenant.TenantCode, commence-month-start, commence-month-end ).
1045 FIND FIRST ChargeDetail NO-ERROR.
1046 IF NOT AVAILABLE(ChargeDetail) THEN RETURN 0.0 .
1048 DEF VAR to-be-charged AS DEC NO-UNDO INITIAL 0.0 .
1049 DEF VAR this-charge AS DEC NO-UNDO INITIAL 0.0 .
1050 DEF VAR taxable-total AS DEC NO-UNDO.
1052 FOR EACH ChargeDetail WHERE ChargeDetail.TenantCode = Tenant.TenantCode
1053 AND ChargeDetail.ChargeStart <= commence-date
1054 AND ChargeDetail.ChargedFrom >= commence-date
1055 AND ChargeDetail.ChargedUpTo >= commence-date
1056 AND (ChargeDetail.ChargeEnd > commence-date OR ChargeDetail.ChargeEnd = ?)
1057 BREAK BY ChargeDetail.AccountCode:
1058 this-charge = this-charge + ChargeDetail.ChargeAmount.
1059 taxable-total = taxable-total + ChargeDetail.TaxableAmount.
1060 IF LAST-OF( ChargeDetail.AccountCode ) OR ChargeDetail.ChargeType = "S" THEN DO:
1061 to-be-charged = to-be-charged + ROUND( this-charge, 2)
1062 + ROUND( taxable-total * (Office.GST / 100), 2).
1063 this-charge = 0.
1064 taxable-total = 0.
1065 END.
1066 END.
1068 RETURN to-be-charged.
1070 END FUNCTION.
1072 /* _UIB-CODE-BLOCK-END */
1073 &ANALYZE-RESUME
1075 &ENDIF
1077 &IF DEFINED(EXCLUDE-get-expected-dc-rentalspace) = 0 &THEN
1079 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-expected-dc-rentalspace Procedure
1080 FUNCTION get-expected-dc-rentalspace RETURNS DECIMAL
1081 ( /* parameter-definitions */ ) :
1082 /*------------------------------------------------------------------------------
1083 Purpose:
1084 Notes:
1085 ------------------------------------------------------------------------------*/
1086 DEF VAR total-outgoings AS DEC NO-UNDO.
1087 DEF VAR total-rental AS DEC NO-UNDO INITIAL 0.0 .
1088 DEF VAR total-per-annum AS DEC NO-UNDO.
1089 DEF VAR per-month AS DEC NO-UNDO.
1090 DEF VAR gst AS DEC NO-UNDO.
1091 DEF VAR total-per-month AS DEC NO-UNDO.
1092 DEF VAR tax-aplicable AS LOGI INITIAL No NO-UNDO.
1093 DEF VAR freq-code AS CHAR INITIAL '' NO-UNDO.
1094 DEF VAR freq-unit AS INT INITIAL 0 NO-UNDO.
1096 RUN process/calcoutg.p( Tenant.TenantCode, OUTPUT total-outgoings ).
1098 FOR EACH TenancyLease WHERE TenancyLease.TenantCode = Tenant.TenantCode
1099 AND TenancyLease.LeaseStatus <> "PAST" NO-LOCK:
1100 tax-applicable = tax-applicable OR TenancyLease.TaxApplies.
1102 /* Store frequency code - If there are different frequencies for the various leases then default to Monthly */
1103 IF freq-code = '' THEN freq-code = TenancyLease.PaymentFrequency.
1104 ELSE IF freq-code <> TenancyLease.PaymentFrequency THEN freq-code = "MNTH".
1106 /* Calculate Total rent */
1107 FOR EACH RentalSpace OF TenancyLease WHERE RentalSpace.AreaStatus <> "V" NO-LOCK:
1108 total-rental = total-rental + get-charged-rental( RentalSpace.ChargedRental, RentalSpace.ContractedRental, RentalSpace.AreaType, RentalSpace.TenancyLeaseCode ).
1109 END.
1110 END.
1113 /* Find the frequency type record for unit to calculate period rent amount */
1114 FIND FIRST FrequencyType WHERE FrequencyType.FrequencyCode = freq-code NO-LOCK NO-ERROR.
1115 IF AVAILABLE FrequencyType
1116 THEN DO:
1117 CASE FrequencyType.RepeatUnits:
1118 WHEN "MONT" THEN freq-unit = ROUND(12 / FrequencyType.UnitCount, 0).
1119 WHEN "DAYS" THEN freq-unit = ROUND(365 / FrequencyType.UnitCount, 0).
1120 OTHERWISE freq-unit = 12.
1121 END CASE.
1122 END.
1123 ELSE freq-unit = 12.
1126 total-per-annum = total-rental + total-outgoings.
1127 per-month = ROUND( total-per-annum / freq-unit, 2).
1128 gst = IF tax-applicable AND gst-applies THEN
1129 ROUND( per-month * ( Office.GST / 100 ), 2)
1130 ELSE 0.
1131 total-per-month = per-month + ROUND( gst, 2).
1133 RETURN total-per-month.
1135 END FUNCTION.
1137 /* _UIB-CODE-BLOCK-END */
1138 &ANALYZE-RESUME
1140 &ENDIF
1142 &IF DEFINED(EXCLUDE-include-lease) = 0 &THEN
1144 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION include-lease Procedure
1145 FUNCTION include-lease RETURNS LOGICAL
1146 ( INPUT lease-code AS INT ) :
1147 /*------------------------------------------------------------------------------
1148 Purpose:
1149 Notes: Dummy function.
1150 ------------------------------------------------------------------------------*/
1152 RETURN Yes. /* Function return value. */
1154 END FUNCTION.
1156 /* _UIB-CODE-BLOCK-END */
1157 &ANALYZE-RESUME
1159 &ENDIF