Added capital works blank section. Synced calling screen.
[capital-apms-progress.git] / process / report / month-end-og-accrual.p
blob8580ebdc9790156a3a3052411ddaebde27256ee3
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 ------------------------------------------------------------------------*/
7 DEF INPUT PARAMETER report-options AS CHAR NO-UNDO.
9 DEF VAR preview AS LOGI NO-UNDO INIT No.
10 DEF VAR one-property AS LOGI NO-UNDO INIT No.
11 DEF VAR property-code AS INT NO-UNDO INIT ?.
12 DEF VAR generate-transactions AS LOGI NO-UNDO INIT No.
13 DEF VAR exporting AS LOGI NO-UNDO INITIAL No.
14 DEF VAR month-ending AS INT NO-UNDO INITIAL ?.
15 DEF VAR year-end AS LOGI NO-UNDO INITIAL No.
16 DEF VAR summary AS LOGI NO-UNDO INITIAL No.
17 RUN parse-parameters.
19 DEF BUFFER ToMonth FOR Month.
20 FIND ToMonth WHERE ToMonth.MonthCode = month-ending NO-LOCK.
21 DEF BUFFER FromMonth FOR Month.
23 DEF VAR period-text AS CHAR NO-UNDO INITIAL "Month".
24 IF year-end THEN period-text = "Year".
26 DEF VAR batch-no AS INT NO-UNDO INITIAL ?.
27 DEF VAR document-no AS INT NO-UNDO.
28 DEF VAR transaction-no AS INT NO-UNDO.
29 DEF VAR need-property-header AS LOGI NO-UNDO.
30 DEF VAR need-account-header AS LOGI NO-UNDO.
31 DEF VAR reconcile-from AS DATE NO-UNDO.
32 DEF VAR property-months AS INT NO-UNDO.
33 DEF VAR property-total AS DEC NO-UNDO.
34 DEF VAR last-property AS INT NO-UNDO INITIAL ?.
36 DEF VAR user-name AS CHAR NO-UNDO.
37 {inc/username.i "user-name"}
38 DEF VAR timeStamp AS CHAR FORMAT "X(44)" NO-UNDO.
39 timeStamp = STRING( ToMonth.EndDate, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
41 DEF VAR line AS CHAR NO-UNDO.
43 DEF VAR time-font AS CHAR NO-UNDO INITIAL "helvetica,proportional,point,6,normal".
44 DEF VAR fixed-font AS CHAR NO-UNDO INITIAL "courier,fixed,cpi,16,lpi,9,normal".
45 DEF VAR header-font AS CHAR NO-UNDO INITIAL "Times,Point,11,lpi,6,Proportional,Normal".
47 DEF TEMP-TABLE TOG NO-UNDO
48 FIELD PropertyCode AS INT
49 FIELD TenantCode AS INT
50 FIELD AccountCode AS DEC
51 FIELD AccountName AS CHAR
52 FIELD Percent AS DEC
53 FIELD Fixed AS DEC
54 FIELD Budget AS DEC
55 FIELD Actual AS DEC
56 FIELD Recovered AS DEC
57 INDEX XPKTOG IS UNIQUE PRIMARY PropertyCode TenantCode AccountCode
58 INDEX XAK1TOG PropertyCode AccountCode .
61 {inc/ofc-this.i}
62 {inc/ofc-acct.i "OG-ACCRUAL" "outgoings-account"}
63 {inc/ofc-set.i "Reconciliation-Date" "reconciliation-date-text"}
64 IF NOT AVAILABLE(OfficeSetting) THEN reconciliation-date-text = "".
66 /* _UIB-CODE-BLOCK-END */
67 &ANALYZE-RESUME
70 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
72 /* ******************** Preprocessor Definitions ******************** */
74 &Scoped-define PROCEDURE-TYPE Procedure
75 &Scoped-define DB-AWARE no
79 /* _UIB-PREPROCESSOR-BLOCK-END */
80 &ANALYZE-RESUME
83 /* ************************ Function Prototypes ********************** */
85 &IF DEFINED(EXCLUDE-each-o-account) = 0 &THEN
87 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD each-o-account Procedure
88 FUNCTION each-o-account RETURNS DECIMAL
89 ( INPUT total-blnc AS DEC ) FORWARD.
91 /* _UIB-CODE-BLOCK-END */
92 &ANALYZE-RESUME
94 &ENDIF
96 &IF DEFINED(EXCLUDE-each-p-account) = 0 &THEN
98 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD each-p-account Procedure
99 FUNCTION each-p-account RETURNS DECIMAL
100 ( INPUT total-blnc AS DEC ) FORWARD.
102 /* _UIB-CODE-BLOCK-END */
103 &ANALYZE-RESUME
105 &ENDIF
107 &IF DEFINED(EXCLUDE-each-property) = 0 &THEN
109 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD each-property Procedure
110 FUNCTION each-property RETURNS DECIMAL
111 ( /* parameter-definitions */ ) FORWARD.
113 /* _UIB-CODE-BLOCK-END */
114 &ANALYZE-RESUME
116 &ENDIF
118 &IF DEFINED(EXCLUDE-get-balance) = 0 &THEN
120 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-balance Procedure
121 FUNCTION get-balance RETURNS DECIMAL
122 ( INPUT et AS CHAR, INPUT ec AS INT, INPUT ac AS DEC ) FORWARD.
124 /* _UIB-CODE-BLOCK-END */
125 &ANALYZE-RESUME
127 &ENDIF
129 &IF DEFINED(EXCLUDE-lease-line) = 0 &THEN
131 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD lease-line Procedure
132 FUNCTION lease-line RETURNS CHARACTER
133 ( INPUT pro-rata-pc AS DEC, INPUT recovery AS DEC, INPUT trailing AS CHAR, INPUT account-balance AS DEC) FORWARD.
135 /* _UIB-CODE-BLOCK-END */
136 &ANALYZE-RESUME
138 &ENDIF
140 &IF DEFINED(EXCLUDE-make-transaction) = 0 &THEN
142 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD make-transaction Procedure
143 FUNCTION make-transaction RETURNS LOGICAL
144 ( INPUT et AS CHAR, INPUT ec AS INT, INPUT ac AS DEC, INPUT txt AS CHAR, INPUT amnt AS DEC ) FORWARD.
146 /* _UIB-CODE-BLOCK-END */
147 &ANALYZE-RESUME
149 &ENDIF
152 /* *********************** Procedure Settings ************************ */
154 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
155 /* Settings for THIS-PROCEDURE
156 Type: Procedure
157 Allow:
158 Frames: 0
159 Add Fields to: Neither
160 Other Settings: CODE-ONLY COMPILE
162 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
164 /* ************************* Create Window ************************** */
166 &ANALYZE-SUSPEND _CREATE-WINDOW
167 /* DESIGN Window definition (used by the UIB)
168 CREATE WINDOW Procedure ASSIGN
169 HEIGHT = .35
170 WIDTH = 51.14.
171 /* END WINDOW DEFINITION */
173 &ANALYZE-RESUME
175 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
176 /* ************************* Included-Libraries *********************** */
178 {inc/method/m-txtrep.i}
179 {inc/date.i}
180 {inc/null.i}
181 {inc/convert.i}
183 /* _UIB-CODE-BLOCK-END */
184 &ANALYZE-RESUME
190 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
193 /* *************************** Main Block *************************** */
195 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES PAGE-SIZE 0.
197 RUN pclrep-start( preview, "reset,portrait,tm,2,a4,lm,6,courier,cpi,16,lpi,9").
199 RUN month-end-og-accrual.
201 OUTPUT CLOSE.
203 RUN pclrep-finish.
205 /* _UIB-CODE-BLOCK-END */
206 &ANALYZE-RESUME
209 /* ********************** Internal Procedures *********************** */
211 &IF DEFINED(EXCLUDE-inst-page-footer) = 0 &THEN
213 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-footer Procedure
214 PROCEDURE inst-page-footer :
215 /*------------------------------------------------------------------------------
216 Purpose: Print any page footer
217 ------------------------------------------------------------------------------*/
219 END PROCEDURE.
221 /* _UIB-CODE-BLOCK-END */
222 &ANALYZE-RESUME
224 &ENDIF
226 &IF DEFINED(EXCLUDE-inst-page-header) = 0 &THEN
228 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-header Procedure
229 PROCEDURE inst-page-header :
230 /*------------------------------------------------------------------------------
231 Purpose:
232 ------------------------------------------------------------------------------*/
234 line = timeStamp.
235 IF NOT exporting THEN DO:
236 line = line + CHR(13) + SPC(275) + "Page: " + STRING( pclrep-page-number ).
237 END.
238 RUN pclrep-line( time-font, line).
240 RUN pclrep-down-by(2).
241 RUN pclrep-line( header-font, SPC(35) + "Month End Outgoings Report as at " + STRING( ToMonth.EndDate, "99/99/9999")).
242 RUN pclrep-down-by(1).
245 RUN pclrep-line( fixed-font, "A/C Code Account Name Actual Recovered Net").
246 RUN pclrep-down-by(1).
248 END PROCEDURE.
250 /* _UIB-CODE-BLOCK-END */
251 &ANALYZE-RESUME
253 &ENDIF
255 &IF DEFINED(EXCLUDE-make-accruals) = 0 &THEN
257 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE make-accruals Procedure
258 PROCEDURE make-accruals :
259 /*------------------------------------------------------------------------------
260 Purpose:
261 ------------------------------------------------------------------------------*/
262 DEF INPUT PARAMETER amount AS DEC NO-UNDO.
264 IF amount = 0 THEN RETURN.
266 IF batch-no = ? THEN DO:
267 CREATE NewBatch.
268 NewBatch.BatchType = "AUTO".
269 NewBatch.Description = period-text + " end Outgoings Accrual".
270 batch-no = NewBatch.BatchCode.
271 document-no = 0.
272 END.
274 IF Property.PropertyCode <> last-property THEN document-no = document-no + 1.
276 make-transaction( "P", Property.PropertyCode, ChartOfAccount.AccountCode + 0.1,
277 period-text + "-end Outgoings Journal", - amount ).
278 make-transaction( "P", Property.PropertyCode, outgoings-account,
279 period-text + "-end Outgoings Journal", amount ).
281 last-property = Property.PropertyCode .
283 END PROCEDURE.
285 /* _UIB-CODE-BLOCK-END */
286 &ANALYZE-RESUME
288 &ENDIF
290 &IF DEFINED(EXCLUDE-make-ye-accruals) = 0 &THEN
292 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE make-ye-accruals Procedure
293 PROCEDURE make-ye-accruals :
294 /*------------------------------------------------------------------------------
295 Purpose:
296 ------------------------------------------------------------------------------*/
297 DEF INPUT PARAMETER amount AS DEC NO-UNDO.
298 DEF INPUT PARAMETER balance AS DEC NO-UNDO.
300 IF amount = 0 THEN RETURN.
302 IF batch-no = ? THEN DO:
303 CREATE NewBatch.
304 NewBatch.BatchType = "AUTO".
305 NewBatch.Description = period-text + " end Outgoings Accrual".
306 batch-no = NewBatch.BatchCode.
307 document-no = 0.
308 END.
310 IF Property.PropertyCode <> last-property THEN document-no = document-no + 1.
312 make-transaction( "P", Property.PropertyCode, ChartOfAccount.AccountCode + 0.1,
313 period-text + "-end Outgoings Journal", amount ).
314 make-transaction( "P", Property.PropertyCode, outgoings-account,
315 period-text + "-end Outgoings Journal", - amount ).
317 make-transaction( "P", Property.PropertyCode, ChartOfAccount.AccountCode,
318 period-text + "-end Outgoings Journal", balance ).
319 make-transaction( "P", Property.PropertyCode, ChartOfAccount.AccountCode + 0.3,
320 period-text + "-end Outgoings Journal", - balance ).
322 last-property = Property.PropertyCode .
324 END PROCEDURE.
326 /* _UIB-CODE-BLOCK-END */
327 &ANALYZE-RESUME
329 &ENDIF
331 &IF DEFINED(EXCLUDE-month-end-og-accrual) = 0 &THEN
333 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE month-end-og-accrual Procedure
334 PROCEDURE month-end-og-accrual :
335 /*------------------------------------------------------------------------------
336 Purpose:
337 ------------------------------------------------------------------------------*/
338 DEF VAR g-total AS DEC NO-UNDO INITIAL 0.0 .
340 IF one-property THEN DO:
341 FIND Property WHERE Property.PropertyCode = property-code NO-LOCK.
342 each-property().
343 END.
344 ELSE DO:
345 FOR EACH Property WHERE Property.Active AND NOT Property.ExternallyManaged NO-LOCK:
346 g-total = g-total + each-property().
347 END.
349 IF g-total <> 0 THEN DO:
350 RUN pclrep-down-by(1).
351 line = FILL( " ", 91) + FILL( '=', 12 ).
352 RUN pclrep-line( fixed-font, line ).
354 RUN pclrep-line( header-font, STRING( "Grand Total Recoveries", "X(91)" )
355 + STRING( g-total, ">,>>>,>>9.99CR") ).
356 END.
357 END.
359 END PROCEDURE.
361 /* _UIB-CODE-BLOCK-END */
362 &ANALYZE-RESUME
364 &ENDIF
366 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
368 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
369 PROCEDURE parse-parameters :
370 /*------------------------------------------------------------------------------
371 Purpose:
372 ------------------------------------------------------------------------------*/
374 DEF VAR token AS CHAR NO-UNDO.
375 DEF VAR i AS INT NO-UNDO.
377 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
378 token = ENTRY( i, report-options, "~n" ).
380 CASE ENTRY( 1, token ):
381 WHEN "Preview" THEN preview = Yes.
382 WHEN "Property" THEN property-code = INT( ENTRY(2,token ) ).
383 WHEN "OneProperty" THEN one-property = Yes.
384 WHEN "MakeTransactions" THEN generate-transactions = Yes.
385 WHEN "MonthEnding" THEN month-ending = INT( ENTRY(2,token) ).
386 WHEN "YearEnd" THEN year-end = Yes.
387 WHEN "Summary" THEN summary = Yes.
388 END CASE.
390 END.
392 END PROCEDURE.
394 /* _UIB-CODE-BLOCK-END */
395 &ANALYZE-RESUME
397 &ENDIF
399 /* ************************ Function Implementations ***************** */
401 &IF DEFINED(EXCLUDE-each-o-account) = 0 &THEN
403 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION each-o-account Procedure
404 FUNCTION each-o-account RETURNS DECIMAL
405 ( INPUT total-blnc AS DEC ) :
406 /*------------------------------------------------------------------------------
407 Purpose:
408 Notes:
409 ------------------------------------------------------------------------------*/
410 DEF VAR total-fixed AS DEC NO-UNDO INITIAL 0.
411 DEF VAR fixed AS DEC NO-UNDO.
412 DEF VAR pro-rata AS DEC NO-UNDO.
413 DEF BUFFER LeaseMonth FOR Month .
415 need-account-header = Yes.
416 FOR EACH TenancyLease OF Property WHERE TenancyLease.LeaseStatus <> "PAST"
417 AND TenancyLease.RecoveryType = "B" NO-LOCK:
418 FIND TenancyOutgoing OF TenancyLease WHERE TenancyOutgoing.AccountCode = ChartOfAccount.AccountCode NO-LOCK NO-ERROR.
419 fixed = IF AVAILABLE(TenancyOutgoing) THEN TenancyOutgoing.FixedAmount ELSE 0.
420 IF fixed = 0 THEN NEXT.
422 IF TenancyLease.FirstLeaseStart > reconcile-from THEN DO:
423 FIND FIRST LeaseMonth WHERE LeaseMonth.StartDate >= TenancyLease.FirstLeaseStart NO-LOCK.
424 pro-rata = diff-months( LeaseMonth.StartDate, ToMonth.EndDate + 1) / 12 .
425 END.
426 ELSE
427 pro-rata = property-months / 12.
429 IF NOT summary AND fixed <> 0 THEN DO:
430 line = lease-line( pro-rata, fixed, " ", total-blnc ).
431 RUN pclrep-line( fixed-font, line ).
432 END.
433 total-fixed = total-fixed + (pro-rata * fixed).
434 END.
436 IF NOT summary AND total-fixed <> 0 THEN DO:
437 line = FILL( " ", 76) + FILL( '-', 12) + " " + FILL( '-', 12 ).
438 RUN pclrep-line( fixed-font, line ).
440 line = FILL( " ", 91)
441 /* + STRING( total-fixed, ">,>>>,>>9.99CR") + " " */
442 + STRING( total-fixed, ">,>>>,>>9.99CR").
443 RUN pclrep-line( fixed-font, line ).
444 RUN pclrep-down-by(0.8).
445 END.
447 total-fixed = ROUND( total-fixed, 2).
448 IF generate-transactions AND year-end THEN RUN make-ye-accruals( total-fixed, total-blnc ).
449 ELSE IF generate-transactions THEN RUN make-accruals( total-fixed ).
451 RETURN total-fixed.
453 END FUNCTION.
455 /* _UIB-CODE-BLOCK-END */
456 &ANALYZE-RESUME
458 &ENDIF
460 &IF DEFINED(EXCLUDE-each-p-account) = 0 &THEN
462 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION each-p-account Procedure
463 FUNCTION each-p-account RETURNS DECIMAL
464 ( INPUT total-blnc AS DEC ) :
465 /*------------------------------------------------------------------------------
466 Purpose:
467 Notes:
468 ------------------------------------------------------------------------------*/
469 DEF VAR total-pcnt AS DEC NO-UNDO.
470 DEF VAR pcnt AS DEC NO-UNDO.
471 DEF VAR pro-rata AS DEC NO-UNDO.
472 DEF BUFFER LeaseMonth FOR Month .
474 IF total-blnc = 0 THEN RETURN 0.0 .
476 need-account-header = Yes.
477 FOR EACH TenancyLease OF Property WHERE TenancyLease.LeaseStatus <> "PAST"
478 AND TenancyLease.RecoveryType = "B" NO-LOCK:
479 FIND TenancyOutgoing OF TenancyLease WHERE TenancyOutgoing.AccountCode = ChartOfAccount.AccountCode NO-LOCK NO-ERROR.
480 pcnt = IF AVAILABLE(TenancyOutgoing) THEN TenancyOutgoing.Percent ELSE TenancyLease.OutgoingsRate.
481 IF pcnt = 0 THEN NEXT.
483 IF TenancyLease.FirstLeaseStart > reconcile-from THEN DO:
484 FIND FIRST LeaseMonth WHERE LeaseMonth.StartDate >= TenancyLease.FirstLeaseStart NO-LOCK.
485 pro-rata = diff-months( LeaseMonth.StartDate, ToMonth.EndDate + 1) / property-months .
486 END.
487 ELSE
488 pro-rata = 1.
490 IF NOT summary THEN DO:
491 line = lease-line( pro-rata, pcnt, "%", total-blnc ).
492 RUN pclrep-line( fixed-font, line ).
493 END.
494 total-pcnt = total-pcnt + (pro-rata * pcnt).
495 END.
497 IF NOT summary THEN DO:
498 line = FILL( " ", 76) + FILL( '-', 12) + " " + FILL( '-', 12 ).
499 RUN pclrep-line( fixed-font, line ).
501 line = FILL( " ", 76)
502 + STRING( total-pcnt, "->>>>,>>9.99") + "% "
503 + STRING( total-blnc * (total-pcnt / 100), ">,>>>,>>9.99CR").
504 RUN pclrep-line( fixed-font, line ).
505 RUN pclrep-down-by(0.8).
506 END.
508 total-pcnt = ROUND( total-blnc * (total-pcnt / 100), 2).
510 IF generate-transactions AND year-end THEN RUN make-ye-accruals( total-pcnt, total-blnc ).
511 ELSE IF generate-transactions THEN RUN make-accruals( total-pcnt ).
512 RETURN total-pcnt.
514 END FUNCTION.
516 /* _UIB-CODE-BLOCK-END */
517 &ANALYZE-RESUME
519 &ENDIF
521 &IF DEFINED(EXCLUDE-each-property) = 0 &THEN
523 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION each-property Procedure
524 FUNCTION each-property RETURNS DECIMAL
525 ( /* parameter-definitions */ ) :
526 /*------------------------------------------------------------------------------
527 Purpose:
528 Notes:
529 ------------------------------------------------------------------------------*/
530 DEF VAR rec-total AS DEC NO-UNDO INITIAL 0.0 .
531 DEF VAR p-amount AS DEC NO-UNDO INITIAL 0.0 .
532 DEF VAR p-total AS DEC NO-UNDO INITIAL 0.0 .
534 FIND FIRST TenancyLease OF Property WHERE TenancyLease.LeaseStatus <> "PAST"
535 AND TenancyLease.RecoveryType = "A"
536 NO-LOCK NO-ERROR.
537 IF AVAILABLE(TenancyLease) THEN RETURN 0.0.
539 need-property-header = Yes.
540 reconcile-from = Property.ReconciliationDue + 1.
541 IF reconciliation-date-text <> "Done" THEN
542 reconcile-from = add-months( reconcile-from, -12).
544 FIND LAST FromMonth WHERE FromMonth.StartDate <= reconcile-from NO-LOCK.
545 property-months = diff-months( FromMonth.StartDate, ToMonth.EndDate + 1).
547 FOR EACH ChartOfAccount WHERE ChartOfAccount.ExpenseRecoveryType = "P" NO-LOCK:
548 p-amount = get-balance( "P", Property.PropertyCode, ChartOfAccount.AccountCode ).
549 p-total = p-total + p-amount.
550 rec-total = rec-total + each-p-account( p-amount ).
551 END.
553 FOR EACH ChartOfAccount WHERE ChartOfAccount.ExpenseRecoveryType = "O" NO-LOCK:
554 p-amount = get-balance( "P", Property.PropertyCode, ChartOfAccount.AccountCode ).
555 p-total = p-total + p-amount.
556 rec-total = rec-total + each-o-account( p-amount ).
557 END.
559 IF rec-total <> 0 THEN DO:
560 IF property-months > 14 THEN DO:
561 MESSAGE "P" + STRING(Property.PropertyCode, "99999") + " months =" property-months "months from" Property.ReconciliationDue "to" STRING(ToMonth.EndDate + 1, "99/99/9999").
562 END.
563 ELSE DO:
564 IF property-months < 1 THEN
565 MESSAGE "P" + STRING(Property.PropertyCode, "99999") + " zero months from" Property.ReconciliationDue "to" STRING(ToMonth.EndDate + 1, "99/99/9999") "- ignored".
566 END.
568 IF summary THEN DO:
569 RUN pclrep-line( fixed-font, "P" + STRING(Property.PropertyCode, "99999")
570 + " - " + STRING( null-str(Property.Name,"?"), "X(60)" )
571 + " from " + STRING( reconcile-from, "99/99/9999")
572 + " "
573 + STRING( rec-total, ">,>>>,>>9.99CR") ).
574 END.
575 ELSE DO:
576 line = FILL( " ", 39) + FILL( '-', 12) + FILL( " ", 40) + FILL( '-', 12 ).
577 RUN pclrep-line( fixed-font, line ).
579 line = FILL( " ", 39)
580 + STRING( p-total, ">,>>>,>>9.99CR")
581 + FILL( " ", 38)
582 + STRING( rec-total, ">,>>>,>>9.99CR").
583 RUN pclrep-line( fixed-font, line ).
584 RUN pclrep-down-by(1.3).
585 END.
586 END.
588 RETURN rec-total.
590 END FUNCTION.
592 /* _UIB-CODE-BLOCK-END */
593 &ANALYZE-RESUME
595 &ENDIF
597 &IF DEFINED(EXCLUDE-get-balance) = 0 &THEN
599 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-balance Procedure
600 FUNCTION get-balance RETURNS DECIMAL
601 ( INPUT et AS CHAR, INPUT ec AS INT, INPUT ac AS DEC ) :
602 /*------------------------------------------------------------------------------
603 Purpose:
604 Notes:
605 ------------------------------------------------------------------------------*/
606 DEF VAR balance AS DEC NO-UNDO INITIAL 0.0 .
608 FOR EACH AccountBalance WHERE AccountBalance.EntityType = et
609 AND AccountBalance.EntityCode = ec
610 AND AccountBalance.AccountCode = ac
611 AND AccountBalance.MonthCode <= month-ending
612 AND AccountBalance.Balance <> 0.0 NO-LOCK:
613 balance = balance + AccountBalance.Balance.
614 END.
615 RETURN balance.
617 END FUNCTION.
619 /* _UIB-CODE-BLOCK-END */
620 &ANALYZE-RESUME
622 &ENDIF
624 &IF DEFINED(EXCLUDE-lease-line) = 0 &THEN
626 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION lease-line Procedure
627 FUNCTION lease-line RETURNS CHARACTER
628 ( INPUT pro-rata-pc AS DEC, INPUT recovery AS DEC, INPUT trailing AS CHAR, INPUT account-balance AS DEC) :
629 /*------------------------------------------------------------------------------
630 Purpose:
631 Notes:
632 ------------------------------------------------------------------------------*/
633 DEF VAR s1 AS CHAR NO-UNDO.
635 IF need-property-header THEN DO:
636 RUN pclrep-down-by(0.4).
637 RUN pclrep-line( header-font, "P" + STRING(Property.PropertyCode, "99999")
638 + " - " + Property.Name
639 + " from " + STRING( reconcile-from, "99/99/9999") ).
640 RUN pclrep-down-by(0.3).
641 need-property-header = No.
642 END.
644 IF need-account-header THEN DO:
645 s1 = STRING( ChartOfAccount.AccountCode, "9999.99") + " "
646 + STRING( ChartOfAccount.Name, "X(30)") + " "
647 + STRING( account-balance, ">,>>>,>>9.99CR") + " ".
648 need-account-header = No.
649 END.
650 ELSE DO:
651 s1 = FILL( " ", 54).
652 END.
654 s1 = s1 + "T" + STRING( TenancyLease.TenantCode, "99999") + " ".
655 IF trailing = "%" THEN
656 s1 = s1 + STRING( recovery, "->>>>,>>9.99") + trailing + " "
657 + STRING( recovery * pro-rata-pc, "->>>>,>>9.99") + trailing + " ".
658 ELSE
659 s1 = s1 + STRING( recovery, ">,>>>,>>9.99CR") + " "
660 + STRING( recovery * pro-rata-pc, ">,>>>,>>9.99CR") + " ".
662 IF TenancyLease.FirstLeaseStart > reconcile-from THEN
663 s1 = s1 + STRING( TenancyLease.FirstLeaseStart, "99/99/9999") + " ".
664 ELSE
665 s1 = s1 + FILL(" ",11).
667 RETURN s1.
669 END FUNCTION.
671 /* _UIB-CODE-BLOCK-END */
672 &ANALYZE-RESUME
674 &ENDIF
676 &IF DEFINED(EXCLUDE-make-transaction) = 0 &THEN
678 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION make-transaction Procedure
679 FUNCTION make-transaction RETURNS LOGICAL
680 ( INPUT et AS CHAR, INPUT ec AS INT, INPUT ac AS DEC, INPUT txt AS CHAR, INPUT amnt AS DEC ) :
681 /*------------------------------------------------------------------------------
682 Purpose:
683 Notes:
684 ------------------------------------------------------------------------------*/
686 IF amnt = 0 THEN RETURN No.
688 FIND NewDocument WHERE NewDocument.BatchCode = batch-no
689 AND NewDocument.DocumentCode = document-no NO-LOCK NO-ERROR.
690 IF NOT AVAILABLE(NewDocument) THEN DO:
691 CREATE NewDocument.
692 NewDocument.BatchCode = batch-no.
693 NewDocument.DocumentCode = document-no.
694 NewDocument.DocumentType = "OGAC".
695 NewDocument.Reference = STRING(batch-no) + "/" + STRING(document-no).
696 NewDocument.Description = txt.
697 transaction-no = 0.
698 END.
700 transaction-no = transaction-no + 1.
702 CREATE NewAcctTrans.
703 NewAcctTrans.BatchCode = batch-no.
704 NewAcctTrans.DocumentCode = document-no.
705 NewAcctTrans.EntityType = et.
706 NewAcctTrans.EntityCode = ec.
707 NewAcctTrans.AccountCode = ac.
708 NewAcctTrans.Amount = amnt.
709 NewAcctTrans.Date = (ToMonth.EndDate + (IF year-end THEN 1 ELSE 0)).
710 NewAcctTrans.Description = txt.
711 NewAcctTrans.Reference = STRING(batch-no) + "/" + STRING(document-no) + "/" + STRING(transaction-no).
713 RETURN Yes.
715 END FUNCTION.
717 /* _UIB-CODE-BLOCK-END */
718 &ANALYZE-RESUME
720 &ENDIF