1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 Tenant Aged Balances Report
(or Export
)
6 ------------------------------------------------------------------------*/
7 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
9 DEF VAR current-month
LIKE Month.MonthCode
NO-UNDO.
10 DEF VAR today-name
AS CHAR NO-UNDO INITIAL "Today".
11 DEF VAR entity-type
AS CHAR NO-UNDO INITIAL "".
12 DEF VAR entity-1
AS INT NO-UNDO.
13 DEF VAR entity-n
AS INT NO-UNDO.
14 DEF VAR non-property
AS LOGICAL NO-UNDO INITIAL No.
15 DEF VAR by-debt-class
AS LOGI
NO-UNDO INITIAL No.
16 DEF VAR by-manager
AS LOGI
NO-UNDO INITIAL No.
17 DEF VAR by-company
AS LOGI
NO-UNDO INITIAL No.
18 DEF VAR summary
AS LOGI
NO-UNDO.
19 DEF VAR preview
AS LOGI
NO-UNDO.
20 DEF VAR exclude-rent
AS LOGI
NO-UNDO.
21 DEF VAR hide-ignored
AS LOGI
NO-UNDO INITIAL NO.
22 DEF VAR tenant-order
AS CHAR NO-UNDO INITIAL "A".
23 DEF VAR exporting
AS LOGI
NO-UNDO.
24 DEF VAR check-entity-range
AS LOGI
NO-UNDO INITIAL No.
25 DEF VAR file-name
AS CHAR NO-UNDO.
26 DEF VAR list-name
AS CHAR NO-UNDO.
27 DEF VAR use-closed-flags
AS LOGI
NO-UNDO INITIAL Yes.
28 DEF VAR min-abs-balance
LIKE AccountSummary.Balance
NO-UNDO INITIAL ?.
29 DEF VAR min-debit-balance
LIKE AccountSummary.Balance
NO-UNDO INITIAL ?.
30 DEF VAR overdue-balance
LIKE AccountSummary.Balance
NO-UNDO INITIAL ?.
31 DEF VAR overdue-periods
AS INT NO-UNDO INITIAL ?.
32 DEF VAR option-description
AS CHAR NO-UNDO INITIAL "".
36 &SCOPED-DEFINE lines-per-page 85
37 DEF VAR ln
AS DEC INIT 0.00 NO-UNDO.
39 DEF VAR need-property-header
AS LOGI
INITIAL Yes
NO-UNDO.
40 DEF VAR this-break-value
AS INT NO-UNDO.
41 DEF VAR this-break-name
AS CHAR NO-UNDO.
43 /* Line definitions
*/
44 DEF VAR trn-line
AS CHAR NO-UNDO.
45 DEF VAR trn-no
AS INT NO-UNDO.
47 DEF VAR reset-page
AS CHAR NO-UNDO.
48 DEF VAR half-line
AS CHAR NO-UNDO. half-line
= CHR(27) + "=".
49 DEF VAR title-font
AS CHAR NO-UNDO.
50 DEF VAR time-font
AS CHAR NO-UNDO.
51 DEF VAR property-font
AS CHAR NO-UNDO.
52 DEF VAR break-font
AS CHAR NO-UNDO.
53 DEF VAR line-printer
AS CHAR NO-UNDO.
54 DEF VAR amt-fmt
AS CHAR INIT "(>>,>>>,>>9.99)" NO-UNDO.
55 DEF VAR i
AS INT NO-UNDO.
57 DEF VAR last-break-value
LIKE Property.Manager
NO-UNDO INITIAL ?.
58 DEF VAR tnt-tot
AS DEC EXTENT 5 NO-UNDO.
59 DEF VAR prp-tot
AS DEC EXTENT 7 NO-UNDO.
60 DEF VAR brk-tot
AS DEC EXTENT 7 NO-UNDO.
61 DEF VAR gnd-tot
AS DEC EXTENT 7 INITIAL 0 NO-UNDO.
63 DEF BUFFER Month0
FOR Month.
64 DEF BUFFER Month1
FOR Month.
65 DEF BUFFER Month2
FOR Month.
67 DEF VAR now
AS CHAR NO-UNDO.
68 DEF VAR page-no
AS INT NO-UNDO INIT 1.
70 DEF VAR user-name
AS CHAR NO-UNDO.
72 {inc
/ofc-acct.i
"DEBTORS" "sundry-debtors"}
74 /* _UIB-CODE-BLOCK-END
*/
78 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
80 /* ******************** Preprocessor Definitions
******************** */
82 &Scoped-define PROCEDURE-TYPE Procedure
83 &Scoped-define DB-AWARE no
87 /* _UIB-PREPROCESSOR-BLOCK-END
*/
91 /* ************************ Function Prototypes
********************** */
93 &IF DEFINED(EXCLUDE-include-tenant) = 0 &THEN
95 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD include-tenant Procedure
96 FUNCTION include-tenant
RETURNS LOGICAL
97 ( INPUT tenant-code
AS INT, INPUT bal-0
AS DEC, INPUT bal-1
AS DEC, INPUT bal-2
AS DEC, INPUT bal-3
AS DEC ) FORWARD.
99 /* _UIB-CODE-BLOCK-END
*/
104 &IF DEFINED(EXCLUDE-include-tenant-entity) = 0 &THEN
106 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD include-tenant-entity Procedure
107 FUNCTION include-tenant-entity
RETURNS LOGICAL
108 ( /* parameter-definitions
*/ ) FORWARD.
110 /* _UIB-CODE-BLOCK-END
*/
115 &IF DEFINED(EXCLUDE-non-zero-property) = 0 &THEN
117 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD non-zero-property Procedure
118 FUNCTION non-zero-property
RETURNS LOGICAL
119 ( /* parameter-definitions
*/ ) FORWARD.
121 /* _UIB-CODE-BLOCK-END
*/
126 &IF DEFINED(EXCLUDE-non-zero-tenant) = 0 &THEN
128 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD non-zero-tenant Procedure
129 FUNCTION non-zero-tenant
RETURNS LOGICAL
130 ( /* parameter-definitions
*/ ) FORWARD.
132 /* _UIB-CODE-BLOCK-END
*/
138 /* *********************** Procedure Settings
************************ */
140 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
141 /* Settings for
THIS-PROCEDURE
145 Add Fields to
: Neither
146 Other Settings
: CODE-ONLY
COMPILE
148 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
150 /* ************************* Create Window
************************** */
152 &ANALYZE-SUSPEND _CREATE-WINDOW
153 /* DESIGN Window definition
(used by the UIB
)
154 CREATE WINDOW Procedure
ASSIGN
157 /* END WINDOW DEFINITION
*/
161 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
162 /* ************************* Included-Libraries
*********************** */
164 {inc
/method
/m-txtrep.i
}
167 /* _UIB-CODE-BLOCK-END
*/
174 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
177 /* *************************** Main Block
*************************** */
178 {inc
/username.i
"user-name"}
180 OUTPUT TO VALUE( IF exporting
THEN file-name
ELSE txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
182 RUN tenant-aged-balance.
187 MESSAGE "Export Complete" VIEW-AS ALERT-BOX INFORMATION TITLE "Finished".
189 RUN view-output-file
( preview
).
191 /* _UIB-CODE-BLOCK-END
*/
195 /* ********************** Internal Procedures
*********************** */
197 &IF DEFINED(EXCLUDE-allocate-to-totals) = 0 &THEN
199 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE allocate-to-totals Procedure
200 PROCEDURE allocate-to-totals
:
201 /*------------------------------------------------------------------------------
203 ------------------------------------------------------------------------------*/
205 IF AcctTran.MonthCode
< Month2.MonthCode
THEN
206 tnt-tot
[1] = tnt-tot
[1] + AcctTran.Amount.
207 ELSE IF AcctTran.MonthCode
= Month2.MonthCode
THEN
208 tnt-tot
[2] = tnt-tot
[2] + AcctTran.Amount.
209 ELSE IF AcctTran.MonthCode
= Month1.MonthCode
THEN
210 tnt-tot
[3] = tnt-tot
[3] + AcctTran.Amount.
212 tnt-tot
[4] = tnt-tot
[4] + AcctTran.Amount.
214 tnt-tot
[5] = tnt-tot
[5] + AcctTran.Amount.
218 /* _UIB-CODE-BLOCK-END
*/
223 &IF DEFINED(EXCLUDE-check-line) = 0 &THEN
225 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE check-line Procedure
226 PROCEDURE check-line
:
227 /*------------------------------------------------------------------------------
231 ------------------------------------------------------------------------------*/
233 IF exporting
THEN RETURN.
235 IF ln
>= {&lines-per-page} THEN DO:
242 /* _UIB-CODE-BLOCK-END
*/
247 &IF DEFINED(EXCLUDE-column-header) = 0 &THEN
249 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE column-header Procedure
250 PROCEDURE column-header
:
251 /*------------------------------------------------------------------------------
255 ------------------------------------------------------------------------------*/
257 IF exporting
THEN DO:
258 PUT UNFORMATTED (IF summary
THEN '
"Property"'
ELSE '
"Tenant"'
)
260 + STRING( Month2.StartDate
, "99/99/9999" ) + '
,'
261 + STRING( Month1.StartDate
, "99/99/9999" ) + '
,'
262 + STRING( Month0.StartDate
, "99/99/9999" ) + '
,'
267 + STRING( Month2.StartDate
- 1, "99/99/9999" ) + '
,'
268 + STRING( Month2.EndDate
, "99/99/9999" ) + '
,'
269 + STRING( Month1.EndDate
, "99/99/9999" ) + '
,'
270 + STRING( today-name
, "X(15)" ).
276 STRING( IF summary
THEN "Property" ELSE "Tenant", "X(54)" )
277 STRING( "Prior to", "X(15)" )
278 STRING( STRING( Month2.StartDate
, "99/99/9999" ) + " to", "X(15)" )
279 STRING( STRING( Month1.StartDate
, "99/99/9999" ) + " to", "X(15)" )
280 STRING( STRING( Month0.StartDate
, "99/99/9999" ) + " to", "X(15)" )
281 STRING( " Total", "X(15)" ).
285 STRING( "", "X(54)" )
286 STRING( STRING( Month2.StartDate
, "99/99/9999" ), "X(15)" )
287 STRING( STRING( Month2.EndDate
, "99/99/9999" ), "X(15)" )
288 STRING( STRING( Month1.EndDate
, "99/99/9999" ), "X(15)" )
289 STRING( today-name
, "X(15)" ).
295 /* _UIB-CODE-BLOCK-END
*/
300 &IF DEFINED(EXCLUDE-company-header) = 0 &THEN
302 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE company-header Procedure
303 PROCEDURE company-header
:
304 /*------------------------------------------------------------------------------
306 ------------------------------------------------------------------------------*/
309 RUN reset-brk-totals.
311 PUT CONTROL break-font.
312 PUT UNFORMATTED (IF AVAILABLE Company
THEN Company.LegalName
ELSE "Unknown Company" ).
313 PUT CONTROL line-printer.
314 RUN skip-line
( IF exporting
THEN 1 ELSE 2 ).
318 /* _UIB-CODE-BLOCK-END
*/
323 &IF DEFINED(EXCLUDE-each-company) = 0 &THEN
325 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-company Procedure
326 PROCEDURE each-company
:
327 /*------------------------------------------------------------------------------
329 ------------------------------------------------------------------------------*/
330 /* if the user selected non-property only then we don't want to
331 do this bit since it will pick up tenants with entitytype
= "P" */
332 IF non-property
= FALSE THEN DO:
333 FOR EACH Property
OF Company
NO-LOCK BY Property.PropertyCode
:
340 need-property-header
= Yes.
341 RUN reset-prp-totals.
342 IF tenant-order
= "A" THEN DO:
343 FOR EACH Tenant
WHERE Tenant.EntityType
= 'L'
344 AND Tenant.EntityCode
= Company.CompanyCode
NO-LOCK
345 BY Tenant.EntityType
BY Tenant.EntityCode
BY Tenant.Name
:
350 FOR EACH Tenant
WHERE Tenant.EntityType
= 'L'
351 AND Tenant.EntityCode
= Company.CompanyCode
NO-LOCK
352 BY Tenant.EntityType
BY Tenant.EntityCode
BY Tenant.TenantCode
:
357 IF NOT( need-property-header
) OR non-zero-property
() THEN
358 RUN total-line
( "Non-Property" ).
360 RUN update-brk-totals.
364 /* _UIB-CODE-BLOCK-END
*/
369 &IF DEFINED(EXCLUDE-each-debt-class) = 0 &THEN
371 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-debt-class Procedure
372 PROCEDURE each-debt-class
:
373 /*------------------------------------------------------------------------------
375 ------------------------------------------------------------------------------*/
377 need-property-header
= Yes.
378 RUN reset-prp-totals.
380 IF tenant-order
= "A" THEN DO:
381 FOR EACH Tenant
WHERE Tenant.DebtClassification
= DebtClassification.DebtClassification
NO-LOCK
382 BY Tenant.DebtClassification
BY Tenant.Name
:
387 FOR EACH Tenant
WHERE Tenant.DebtClassification
= DebtClassification.DebtClassification
NO-LOCK
388 BY Tenant.DebtClassification
BY Tenant.TenantCode
:
393 IF NOT( need-property-header
) OR non-zero-property
() THEN
394 RUN total-line
( DebtClassification.DebtClassification
+ " - " + DebtClassification.Description
).
396 RUN update-brk-totals.
400 /* _UIB-CODE-BLOCK-END
*/
405 &IF DEFINED(EXCLUDE-each-property) = 0 &THEN
407 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-property Procedure
408 PROCEDURE each-property
:
409 /*------------------------------------------------------------------------------
411 ------------------------------------------------------------------------------*/
413 need-property-header
= Yes.
414 RUN reset-prp-totals.
416 IF tenant-order
= "A" THEN DO:
417 FOR EACH Tenant
WHERE Tenant.EntityType
= 'P'
418 AND Tenant.EntityCode
= Property.PropertyCode
NO-LOCK
419 BY Tenant.EntityType
BY Tenant.EntityCode
BY Tenant.Name
:
424 FOR EACH Tenant
WHERE Tenant.EntityType
= 'P'
425 AND Tenant.EntityCode
= Property.PropertyCode
NO-LOCK
426 BY Tenant.EntityType
BY Tenant.EntityCode
BY Tenant.TenantCode
:
431 IF need-property-header
AND NOT( summary
) AND ( prp-tot
[6] <> 0 OR prp-tot
[7] <> 0 ) THEN
434 IF NOT( need-property-header
) OR non-zero-property
() THEN
435 RUN total-line
( "Property" ).
437 RUN update-brk-totals.
441 /* _UIB-CODE-BLOCK-END
*/
446 &IF DEFINED(EXCLUDE-each-tenant) = 0 &THEN
448 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-tenant Procedure
449 PROCEDURE each-tenant
:
450 /*------------------------------------------------------------------------------
452 ------------------------------------------------------------------------------*/
453 DEF VAR tnnt-total
AS DEC NO-UNDO.
454 DEF VAR extra
AS CHAR NO-UNDO INITIAL "".
456 IF NOT include-tenant-entity
() THEN RETURN.
457 IF NOT use-closed-flags
OR today-name
<> "Today" THEN DO:
458 RUN each-tenant-no-flags.
461 IF use-closed-flags
THEN DO:
462 IF today-name
<> "Today" THEN tnnt-total
= tnt-tot
[5].
463 RUN each-tenant-use-flags.
464 IF today-name
<> "Today" AND tnnt-total
<> tnt-tot
[5] THEN DO:
465 extra
= STRING( tnnt-total
, amt-fmt
).
466 IF exporting
THEN TRIM(extra
).
470 IF NOT( include-tenant
( Tenant.TenantCode
, tnt-tot
[4], tnt-tot
[3], tnt-tot
[2], tnt-tot
[1] )) THEN RETURN.
472 IF non-zero-tenant
() AND NOT summary
THEN DO:
473 IF need-property-header
THEN RUN property-header.
475 IF exporting
THEN DO:
476 PUT UNFORMATTED STRING( Tenant.TenantCode
) + '
,"' + Tenant.Name + '"'.
479 PUT UNFORMATTED '
,'
+ STRING( tnt-tot
[i
] ).
481 IF extra
<> "" THEN PUT UNFORMATTED "," + extra.
484 PUT UNFORMATTED STRING( Tenant.TenantCode
, "99999" ) SPACE(2)
485 STRING( Tenant.Name
, "X(45)" ) SPACE(2).
488 PUT UNFORMATTED STRING( tnt-tot
[i
], amt-fmt
).
490 IF extra
<> "" THEN PUT UNFORMATTED extra.
498 /* _UIB-CODE-BLOCK-END
*/
503 &IF DEFINED(EXCLUDE-each-tenant-no-flags) = 0 &THEN
505 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-tenant-no-flags Procedure
506 PROCEDURE each-tenant-no-flags
:
507 /*------------------------------------------------------------------------------
508 Purpose
: Without using 'closed' flags
509 ------------------------------------------------------------------------------*/
511 DEF VAR i
AS INT NO-UNDO.
513 RUN reset-tnt-totals.
515 FOR EACH AcctTran
NO-LOCK WHERE AcctTran.EntityType
= 'T'
516 AND AcctTran.EntityCode
= Tenant.TenantCode
517 AND AcctTran.AccountCode
= sundry-debtors
518 AND AcctTran.MonthCode
<= current-month
:
519 /* MESSAGE STRING(AcctTran.Reference
,"X(12)") STRING(AcctTran.Description
,"X(50)") STRING(AcctTran.Amount
,">>,>>>,>>9.99CR")
520 STRING(AcctTran.ClosingGroup
,">>>,>>9") AcctTran.ClosedState.
*/
521 RUN allocate-to-totals.
526 /* _UIB-CODE-BLOCK-END
*/
531 &IF DEFINED(EXCLUDE-each-tenant-use-flags) = 0 &THEN
533 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-tenant-use-flags Procedure
534 PROCEDURE each-tenant-use-flags
:
535 /*------------------------------------------------------------------------------
536 Purpose
: Using 'closed' flags
537 ------------------------------------------------------------------------------*/
538 DEF VAR i
AS INT NO-UNDO.
539 DEF VAR d-min
AS INT NO-UNDO.
540 DEF VAR d-max
AS INT NO-UNDO.
541 DEF VAR group-total
AS DEC NO-UNDO.
543 RUN reset-tnt-totals.
545 IF today-name
= "Today" THEN DO:
546 /* short-circuit things if we can
*/
547 FIND AccountSummary
WHERE AccountSummary.EntityType
= 'T'
548 AND AccountSummary.EntityCode
= Tenant.TenantCode
549 AND AccountSummary.AccountCode
= sundry-debtors
NO-LOCK NO-ERROR.
550 IF NOT AVAILABLE(AccountSummary
) OR AccountSummary.Balance
= 0 THEN RETURN .
553 FOR EACH AcctTran
NO-LOCK WHERE AcctTran.EntityType
= 'T'
554 AND AcctTran.EntityCode
= Tenant.TenantCode
555 AND AcctTran.AccountCode
= sundry-debtors
556 AND AcctTran.MonthCode
<= current-month
557 AND (AcctTran.ClosingGroup
= 0 OR AcctTran.ClosingGroup
= ?
),
558 FIRST Document
OF AcctTran
NO-LOCK:
559 IF exclude-rent
AND Document.DocumentType
= 'RENT'
THEN NEXT.
560 RUN allocate-to-totals.
563 DEF VAR groups-done
AS CHAR NO-UNDO INITIAL "".
564 DEF VAR this-group
AS CHAR NO-UNDO.
565 DEF BUFFER ClosedTran
FOR AcctTran.
567 FOR EACH ClosedTran
NO-LOCK WHERE ClosedTran.EntityType
= 'T'
568 AND ClosedTran.EntityCode
= Tenant.TenantCode
569 AND ClosedTran.AccountCode
= sundry-debtors
570 AND ClosedTran.MonthCode
<= current-month
571 AND ClosedTran.ClosingGroup
> 0
572 AND ClosedTran.ClosedState
= "P":
573 this-group
= STRING(ClosedTran.ClosingGroup
).
574 IF LOOKUP( this-group
, groups-done
) > 0 THEN NEXT part-closed-loop.
575 groups-done
= groups-done
+ this-group
+ ",".
576 d-min
= ClosedTran.MonthCode.
577 d-max
= ClosedTran.MonthCode.
579 FOR EACH AcctTran
WHERE AcctTran.EntityType
= 'T'
580 AND AcctTran.EntityCode
= Tenant.TenantCode
581 AND AcctTran.AccountCode
= sundry-debtors
582 AND AcctTran.MonthCode
<= current-month
583 AND AcctTran.ClosingGroup
= ClosedTran.ClosingGroup
NO-LOCK,
584 FIRST Document
OF AcctTran
NO-LOCK:
585 d-min
= MIN(d-min
, AcctTran.MonthCode
).
586 d-max
= MAX(d-max
, AcctTran.MonthCode
).
587 IF exclude-rent
AND Document.DocumentType
= 'RENT'
THEN NEXT.
588 group-total
= group-total
+ AcctTran.Amount.
590 IF group-total
> 0 THEN d-min
= d-max.
591 IF d-min
< Month2.MonthCode
THEN tnt-tot
[1] = tnt-tot
[1] + group-total.
592 ELSE IF d-min
= Month2.MonthCode
THEN tnt-tot
[2] = tnt-tot
[2] + group-total.
593 ELSE IF d-min
= Month1.MonthCode
THEN tnt-tot
[3] = tnt-tot
[3] + group-total.
595 tnt-tot
[4] = tnt-tot
[4] + group-total.
597 tnt-tot
[5] = tnt-tot
[5] + group-total.
602 FOR EACH ClosedTran
NO-LOCK WHERE ClosedTran.EntityType
= 'T'
603 AND ClosedTran.EntityCode
= Tenant.TenantCode
604 AND ClosedTran.AccountCode
= sundry-debtors
605 AND ClosedTran.MonthCode
> current-month
606 AND ClosedTran.ClosingGroup
> 0
607 AND ClosedTran.ClosedState
<> "P":
608 this-group
= STRING(ClosedTran.ClosingGroup
).
609 IF LOOKUP( this-group
, groups-done
) > 0 THEN NEXT closed-tran-loop.
610 /* MESSAGE STRING(ClosedTran.Reference
,"X(12)") STRING(ClosedTran.Description
,"X(50)") STRING(ClosedTran.Amount
,">>,>>>,>>9.99CR")
611 STRING(ClosedTran.ClosingGroup
,">>>,>>9") ClosedTran.ClosedState
" past end of period".
*/
612 groups-done
= groups-done
+ this-group
+ ",".
613 d-min
= ClosedTran.MonthCode.
614 d-max
= ClosedTran.MonthCode.
615 FOR EACH AcctTran
WHERE AcctTran.EntityType
= 'T'
616 AND AcctTran.EntityCode
= Tenant.TenantCode
617 AND AcctTran.AccountCode
= sundry-debtors
618 AND AcctTran.MonthCode
<= current-month
619 AND AcctTran.ClosingGroup
= ClosedTran.ClosingGroup
NO-LOCK,
620 FIRST Document
OF AcctTran
NO-LOCK:
621 IF exclude-rent
AND Document.DocumentType
= 'RENT'
THEN NEXT.
622 /* MESSAGE STRING(AcctTran.Reference
,"X(12)") STRING(AcctTran.Description
,"X(50)") STRING(AcctTran.Amount
,">>,>>>,>>9.99CR")
623 d-min
= MIN(d-min
, AcctTran.MonthCode
).
624 d-max
= MAX(d-max
, AcctTran.MonthCode
).
625 STRING(AcctTran.ClosingGroup
,">>>,>>9") AcctTran.ClosedState
" ***".
*/
626 RUN allocate-to-totals.
632 /* _UIB-CODE-BLOCK-END
*/
637 &IF DEFINED(EXCLUDE-get-control-strings) = 0 &THEN
639 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-control-strings Procedure
640 PROCEDURE get-control-strings
:
641 /*------------------------------------------------------------------------------
642 Purpose
: Get all control strings for this report
645 ------------------------------------------------------------------------------*/
646 DEF VAR rows
AS DEC NO-UNDO.
647 DEF VAR cols
AS DEC NO-UNDO.
649 RUN make-control-string
( "PCL", "reset,portrait,a4,tm,0,lm,1,LinePrinter,lpi,9.54",
650 OUTPUT reset-page
, OUTPUT rows
, OUTPUT cols
).
652 IF exporting
OR preview
THEN DO:
654 IF exporting
THEN reset-page
= "".
658 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,12",
659 OUTPUT title-font
, OUTPUT rows
, OUTPUT cols
).
661 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,6",
662 OUTPUT time-font
, OUTPUT rows
, OUTPUT cols
).
664 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,12",
665 OUTPUT break-font
, OUTPUT rows
, OUTPUT cols
).
667 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,8",
668 OUTPUT property-font
, OUTPUT rows
, OUTPUT cols
).
670 RUN make-control-string
( "PCL", "LinePrinter,lpi,9.54",
671 OUTPUT line-printer
, OUTPUT rows
, OUTPUT cols
).
675 /* _UIB-CODE-BLOCK-END
*/
680 &IF DEFINED(EXCLUDE-get-months) = 0 &THEN
682 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-months Procedure
683 PROCEDURE get-months
:
684 /*------------------------------------------------------------------------------
688 ------------------------------------------------------------------------------*/
690 IF NOT (current-month
> 0) THEN DO:
691 FIND FIRST Month
WHERE Month.StartDate
<= TODAY
692 AND Month.EndDate
>= TODAY NO-LOCK NO-ERROR.
693 IF NOT AVAILABLE month
THEN RETURN "FAIL".
694 current-month
= Month.MonthCode.
697 FIND FIRST Month0
WHERE Month0.MonthCode
= current-month
NO-LOCK NO-ERROR.
698 IF NOT AVAILABLE Month0
THEN RETURN "FAIL".
699 IF today-name
= "" THEN today-name
= STRING( Month0.EndDate
, "99/99/9999").
701 FIND LAST Month1
WHERE Month1.MonthCode
< Month0.MonthCode
NO-LOCK NO-ERROR.
702 IF NOT AVAILABLE Month1
THEN RETURN "FAIL".
704 FIND LAST Month2
WHERE Month2.MonthCode
< Month1.MonthCode
NO-LOCK NO-ERROR.
705 IF NOT AVAILABLE Month2
THEN RETURN "FAIL".
709 /* _UIB-CODE-BLOCK-END
*/
714 &IF DEFINED(EXCLUDE-page-feed) = 0 &THEN
716 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
717 PROCEDURE page-feed
:
718 /*------------------------------------------------------------------------------
722 ------------------------------------------------------------------------------*/
723 IF exporting
THEN RETURN.
726 page-no
= page-no
+ 1.
730 /* _UIB-CODE-BLOCK-END
*/
735 &IF DEFINED(EXCLUDE-page-header) = 0 &THEN
737 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-header Procedure
738 PROCEDURE page-header
:
739 /*------------------------------------------------------------------------------
743 ------------------------------------------------------------------------------*/
751 /* _UIB-CODE-BLOCK-END
*/
756 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
758 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
759 PROCEDURE parse-parameters
:
760 /*------------------------------------------------------------------------------
762 ------------------------------------------------------------------------------*/
763 DEF VAR i
AS INT NO-UNDO.
764 DEF VAR token
AS CHAR NO-UNDO.
766 {inc
/showopts.i
"report-options"}
768 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
769 token
= ENTRY( i
, report-options
, "~n" ).
770 CASE( ENTRY( 1, token
) ):
771 WHEN "AtMonthEnd" THEN ASSIGN
772 current-month
= INT( ENTRY(2,token
) )
774 WHEN "Summary" THEN summary
= Yes.
775 WHEN "NoOpenItems" THEN use-closed-flags
= No.
776 WHEN "Preview" THEN preview
= Yes.
777 WHEN "NonProperty" THEN non-property
= Yes.
778 WHEN "ExcludeRent" THEN exclude-rent
= Yes.
779 WHEN "HideIgnored" THEN hide-ignored
= Yes.
781 by-debt-class
= ENTRY(2,token
) = "ByDebtClass".
782 by-manager
= ENTRY(2,token
) = "ByManager".
783 by-company
= ENTRY(2,token
) = "ByCompany".
785 WHEN "TenantOrder" THEN tenant-order
= ENTRY(2, token
).
786 WHEN "MinAbsBalance" THEN min-abs-balance
= DEC( ENTRY(2, token
) ).
787 WHEN "MinDebitBalance" THEN min-debit-balance
= DEC( ENTRY(2, token
) ).
788 WHEN "OverdueBalance" THEN overdue-balance
= DEC( ENTRY(2, token
) ).
789 WHEN "OverduePeriods" THEN overdue-periods
= INT( ENTRY(2, token
) ).
791 WHEN "CompanyList" THEN ASSIGN
793 list-name
= SUBSTRING( token
, INDEX( token
, ",") + 1 ).
795 WHEN "EntityRange" THEN
797 entity-type
= ENTRY(2,token
)
798 entity-1
= INT( ENTRY(3, token
) )
799 entity-n
= INT( ENTRY(4, token
) )
800 check-entity-range
= Yes.
802 WHEN "Export" THEN ASSIGN
804 file-name
= SUBSTRING( token
, INDEX( token
, ",") + 1 ).
809 option-description
= "".
810 IF min-debit-balance
> 0 THEN
811 option-description
= ", Debits only, Minimum current: " + TRIM( STRING( min-debit-balance
, "->>,>>>,>>9.99")).
812 ELSE IF min-abs-balance
> 0 THEN
813 option-description
= ", Minimum current: " + TRIM( STRING( min-abs-balance
, "->>,>>>,>>9.99")) .
815 IF overdue-balance
> 0 THEN
816 option-description
= option-description
817 + ", Minimum " + TRIM( STRING( overdue-balance
, "->>,>>>,>>9.99"))
818 + " overdue for more than " + TRIM( STRING( overdue-periods
, "->9")) + " months".
820 option-description
= substring
( option-description
, 3).
823 /* _UIB-CODE-BLOCK-END
*/
828 &IF DEFINED(EXCLUDE-portfolio-header) = 0 &THEN
830 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE portfolio-header Procedure
831 PROCEDURE portfolio-header
:
832 /*------------------------------------------------------------------------------
836 ------------------------------------------------------------------------------*/
839 RUN reset-brk-totals.
841 FIND Person
WHERE Person.PersonCode
= Property.Manager
NO-LOCK NO-ERROR.
843 PUT CONTROL break-font.
844 PUT UNFORMATTED (IF AVAILABLE Person
THEN CAPS( Person.FirstName
+ " " + Person.LastName
) ELSE "Other" ).
845 PUT CONTROL line-printer.
846 RUN skip-line
( IF exporting
THEN 1 ELSE 2 ).
850 /* _UIB-CODE-BLOCK-END
*/
855 &IF DEFINED(EXCLUDE-print-title) = 0 &THEN
857 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-title Procedure
858 PROCEDURE print-title
:
859 /*------------------------------------------------------------------------------
861 ------------------------------------------------------------------------------*/
863 PUT CONTROL line-printer.
865 PUT CONTROL time-font.
866 PUT UNFORMATTED "Printed: " + now
+ " for " + user-name.
867 IF NOT exporting
THEN DO:
868 PUT UNFORMATTED CHR(13) SPACE( 275 ) "Page: " + STRING( page-no
).
870 IF option-description
<> "" THEN DO:
872 PUT UNFORMATTED "Options: " + option-description.
876 PUT CONTROL title-font.
877 PUT UNFORMATTED SPACE(45) "Tenant Aged Balances Report" (IF exclude-rent
THEN "Excluding Rent Charges" ELSE "").
879 PUT CONTROL line-printer.
883 /* _UIB-CODE-BLOCK-END
*/
888 &IF DEFINED(EXCLUDE-property-header) = 0 &THEN
890 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE property-header Procedure
891 PROCEDURE property-header
:
892 /*------------------------------------------------------------------------------
894 ------------------------------------------------------------------------------*/
895 DEF VAR break-entity-name
AS CHAR NO-UNDO.
897 need-property-header
= No.
899 IF by-debt-class
THEN RETURN.
902 IF entity-type
= "L" OR (by-company
AND AVAILABLE(Company
) ) THEN DO:
903 this-break-value
= Company.CompanyCode.
904 this-break-name
= "Company".
907 this-break-value
= Property.Manager.
908 this-break-name
= "Portfolio".
911 IF last-break-value
<> this-break-value
THEN DO:
912 IF last-break-value
<> ?
THEN RUN total-line
( this-break-name
).
913 RUN VALUE( this-break-name
+ "-header").
914 last-break-value
= this-break-value.
915 RUN reset-brk-totals.
920 IF AVAILABLE(Property
) THEN
921 break-entity-name
= STRING( Property.PropertyCode
, ">9999" ) + '
- '
+ Property.Name.
922 ELSE IF AVAILABLE(Company
) THEN
923 break-entity-name
= STRING( Company.CompanyCode
, ">>999" ) + '
- '
+ Company.LegalName.
925 break-entity-name
= "Unknown".
928 PUT CONTROL line-printer.
929 PUT UNFORMATTED STRING( break-entity-name
, "X(52)" ) SPACE(2).
932 PUT CONTROL property-font.
933 PUT UNFORMATTED break-entity-name.
934 PUT CONTROL line-printer.
935 RUN skip-line
( IF exporting
THEN 1 ELSE 1.5 ).
940 /* _UIB-CODE-BLOCK-END
*/
945 &IF DEFINED(EXCLUDE-reset-brk-totals) = 0 &THEN
947 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-brk-totals Procedure
948 PROCEDURE reset-brk-totals
:
949 /*------------------------------------------------------------------------------
953 ------------------------------------------------------------------------------*/
955 DEF VAR i
AS INT NO-UNDO.
956 DO i
= 1 TO 7: brk-tot
[i
] = 0.00.
END.
960 /* _UIB-CODE-BLOCK-END
*/
965 &IF DEFINED(EXCLUDE-reset-page) = 0 &THEN
967 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
968 PROCEDURE reset-page
:
969 /*------------------------------------------------------------------------------
973 ------------------------------------------------------------------------------*/
975 PUT CONTROL reset-page.
981 /* _UIB-CODE-BLOCK-END
*/
986 &IF DEFINED(EXCLUDE-reset-prp-totals) = 0 &THEN
988 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-prp-totals Procedure
989 PROCEDURE reset-prp-totals
:
990 /*------------------------------------------------------------------------------
994 ------------------------------------------------------------------------------*/
996 DEF VAR i
AS INT NO-UNDO.
997 DO i
= 1 TO 7: prp-tot
[i
] = 0.00.
END.
1001 /* _UIB-CODE-BLOCK-END
*/
1006 &IF DEFINED(EXCLUDE-reset-tnt-totals) = 0 &THEN
1008 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-tnt-totals Procedure
1009 PROCEDURE reset-tnt-totals
:
1010 /*------------------------------------------------------------------------------
1014 ------------------------------------------------------------------------------*/
1016 DEF VAR i
AS INT NO-UNDO.
1017 DO i
= 1 TO 5: tnt-tot
[i
] = 0.00.
END.
1021 /* _UIB-CODE-BLOCK-END
*/
1026 &IF DEFINED(EXCLUDE-skip-line) = 0 &THEN
1028 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
1029 PROCEDURE skip-line
:
1030 /*------------------------------------------------------------------------------
1034 ------------------------------------------------------------------------------*/
1036 DEF INPUT PARAMETER n
AS DEC NO-UNDO.
1038 IF ln
+ n
>= {&lines-per-page} THEN DO:
1043 DEF VAR int-part
AS INT NO-UNDO.
1044 DEF VAR dec-part
AS DEC NO-UNDO.
1046 int-part
= TRUNCATE( n
, 0 ).
1047 IF int-part
< 0 THEN RETURN.
1048 dec-part
= n
- int-part.
1049 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
1051 IF dec-part
<> 0 THEN PUT CONTROL half-line.
1053 IF int-part
> 1 THEN PUT SKIP( int-part
).
1054 ELSE IF int-part
> 0 THEN PUT SKIP.
1056 IF NOT exporting
THEN ln
= ln
+ n.
1060 /* _UIB-CODE-BLOCK-END
*/
1065 &IF DEFINED(EXCLUDE-tenant-aged-balance) = 0 &THEN
1067 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE tenant-aged-balance Procedure
1068 PROCEDURE tenant-aged-balance
:
1069 /*------------------------------------------------------------------------------
1071 ------------------------------------------------------------------------------*/
1072 DEF VAR i
AS INT NO-UNDO.
1075 IF RETURN-VALUE = "FAIL" THEN DO:
1076 MESSAGE "Report not available for that period".
1079 now
= STRING( TODAY, "99/99/9999" ) + " " + STRING( TIME, "HH:MM:SS" ).
1080 RUN get-control-strings.
1083 last-break-value
= ? .
1085 IF by-debt-class
THEN DO:
1086 FOR EACH DebtClassification
:
1087 RUN each-debt-class.
1089 need-property-header
= Yes.
1090 RUN reset-prp-totals.
1092 IF tenant-order
= "A" THEN DO:
1093 FOR EACH Tenant
WHERE NOT CAN-FIND( DebtClassification
WHERE Tenant.DebtClassification
= DebtClassification.DebtClassification
) NO-LOCK
1099 FOR EACH Tenant
WHERE NOT CAN-FIND( DebtClassification
WHERE Tenant.DebtClassification
= DebtClassification.DebtClassification
) NO-LOCK
1100 BY Tenant.TenantCode
:
1105 IF NOT( need-property-header
) OR non-zero-property
() THEN
1106 RUN total-line
( "Unclassified debtors" ).
1108 RUN update-brk-totals.
1113 WHEN "List" THEN DO:
1114 FIND ConsolidationList
WHERE ConsolidationList.Name
= list-name
NO-LOCK.
1115 IF by-manager
THEN DO:
1117 FOR EACH Property
WHERE CAN-DO( ConsolidationList.CompanyList
, STRING(Property.CompanyCode
)) NO-LOCK
1118 BY Property.Manager
BY Property.PropertyCode
:
1124 FIND ConsolidationList
WHERE ConsolidationList.Name
= list-name
NO-LOCK.
1125 DO i
= 1 TO NUM-ENTRIES(ConsolidationList.CompanyList
):
1126 FIND Company
WHERE Company.CompanyCode
= INT( ENTRY(i
, ConsolidationList.CompanyList
)) NO-LOCK.
1132 FOR EACH Property
WHERE Property.PropertyCode
>= entity-1
1133 AND Property.PropertyCode
<= entity-n
NO-LOCK
1134 BY Property.Manager
BY Property.PropertyCode
:
1139 FOR EACH Company
WHERE Company.CompanyCode
>= entity-1
1140 AND Company.CompanyCode
<= entity-n
NO-LOCK:
1146 IF last-break-value
<> ?
THEN RUN total-line
( this-break-name
).
1148 RUN total-line
( "Grand" ).
1153 /* _UIB-CODE-BLOCK-END
*/
1158 &IF DEFINED(EXCLUDE-total-line) = 0 &THEN
1160 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE total-line Procedure
1161 PROCEDURE total-line
:
1162 /*------------------------------------------------------------------------------
1166 ------------------------------------------------------------------------------*/
1167 DEF INPUT PARAMETER type
AS CHAR NO-UNDO.
1169 DEF VAR i
AS INT NO-UNDO.
1170 DEF VAR tot-desc
AS CHAR NO-UNDO.
1171 DEF VAR dbt-desc
AS CHAR NO-UNDO.
1172 DEF VAR other-debits
AS DEC NO-UNDO INITIAL 0.
1173 DEF VAR other-credits
AS DEC NO-UNDO INITIAL 0.
1175 IF type
= "Grand" AND (NOT summary
) THEN RUN skip-line
(2).
1176 IF summary
AND type
= "Non-Property" THEN DO:
1177 tot-desc
= "L" + STRING( Company.CompanyCode
, "99999") + " - Non-Property Debtors".
1179 ELSE IF summary
AND type
= "Property" THEN DO:
1180 tot-desc
= STRING( Property.PropertyCode
, "99999") + " - " + Property.Name.
1185 WHEN "Non-Property" THEN
1186 tot-desc
= "Total: L" + STRING(Company.CompanyCode
) + " - non-property debtors".
1187 WHEN "Property" THEN
1188 tot-desc
= "Total: " + Property.Name
+ " (" + STRING(Property.PropertyCode
) + ")".
1189 WHEN "Company" THEN DO:
1190 DEF BUFFER AltCo
FOR Company.
1191 FIND AltCo
WHERE AltCo.CompanyCode
= last-break-value
NO-LOCK.
1192 tot-desc
= "Total: " + AltCo.LegalName
+ " (" + STRING(AltCo.CompanyCode
) + ")".
1195 tot-desc
= type
+ " Totals".
1199 IF exporting
THEN DO:
1200 IF NOT( summary
AND (type
= "Non-Property" OR type
= "Property")) THEN DO:
1201 PUT UNFORMATTED '
,'
+ FILL( '
,'
+ FILL('
-'
,14), 7).
1204 PUT UNFORMATTED '
"' + tot-desc + '",'.
1206 PUT UNFORMATTED "," + STRING( IF type
= "Grand" THEN gnd-tot
[i
]
1207 ELSE IF type
= "Portfolio" THEN brk-tot
[i
]
1208 ELSE IF type
= "Company" THEN brk-tot
[i
]
1213 IF NOT( summary
AND (type
= "Non-Property" OR type
= "Property") ) AND NOT hide-ignored
THEN DO:
1214 other-credits
= IF type
= "Grand" THEN gnd-tot
[6] ELSE
1215 IF type
= "Portfolio" THEN brk-tot
[6] ELSE
1216 IF type
= "Company" THEN brk-tot
[6] ELSE
1218 other-debits
= IF type
= "Grand" THEN gnd-tot
[7] ELSE
1219 IF type
= "Portfolio" THEN brk-tot
[7] ELSE
1220 IF type
= "Company" THEN brk-tot
[7] ELSE
1222 IF other-credits
<> 0 OR other-debits
<> 0 THEN DO:
1223 PUT UNFORMATTED SPACE(53) FILL( " " + FILL('
-'
,14), 5).
1225 PUT UNFORMATTED STRING( REPLACE( tot-desc
, "Total", "Debit"), "X(54)").
1227 PUT UNFORMATTED STRING( IF type
= "Grand" THEN gnd-tot
[i
] ELSE
1228 IF type
= "Portfolio" THEN brk-tot
[i
] ELSE
1229 IF type
= "Company" THEN brk-tot
[i
] ELSE prp-tot
[i
], amt-fmt
).
1233 IF other-credits
<> 0 THEN DO:
1234 PUT UNFORMATTED STRING( " Credit balances not shown", "X(114)")
1235 + STRING( other-credits
, amt-fmt
).
1238 IF other-debits
<> 0 THEN DO:
1239 PUT UNFORMATTED STRING( " Minor debit balances not shown", "X(114)")
1240 + STRING( other-debits
, amt-fmt
).
1246 IF NOT( summary
AND (type
= "Non-Property" OR type
= "Property")) THEN DO:
1247 PUT UNFORMATTED SPACE(53) FILL( " " + FILL('
-'
,14), 5).
1250 PUT UNFORMATTED STRING( tot-desc
, "X(54)").
1252 PUT UNFORMATTED STRING( (IF type
= "Grand" THEN gnd-tot
[i
] ELSE
1253 IF type
= "Portfolio" THEN brk-tot
[i
] ELSE
1254 IF type
= "Company" THEN brk-tot
[i
] ELSE prp-tot
[i
])
1255 + (IF i
=5 AND NOT hide-ignored
THEN other-credits
+ other-debits
ELSE 0.0), amt-fmt
).
1258 RUN skip-line
( IF type
= "Portfolio" OR type
= "Company" THEN 3 ELSE IF summary
THEN 1 ELSE 2 ).
1262 /* _UIB-CODE-BLOCK-END
*/
1267 &IF DEFINED(EXCLUDE-update-brk-totals) = 0 &THEN
1269 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-brk-totals Procedure
1270 PROCEDURE update-brk-totals
:
1271 /*------------------------------------------------------------------------------
1275 ------------------------------------------------------------------------------*/
1277 DEF VAR i
AS INT NO-UNDO.
1279 brk-tot
[i
] = brk-tot
[i
] + prp-tot
[i
].
1280 gnd-tot
[i
] = gnd-tot
[i
] + prp-tot
[i
].
1285 /* _UIB-CODE-BLOCK-END
*/
1290 /* ************************ Function Implementations
***************** */
1292 &IF DEFINED(EXCLUDE-include-tenant) = 0 &THEN
1294 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION include-tenant Procedure
1295 FUNCTION include-tenant
RETURNS LOGICAL
1296 ( INPUT tenant-code
AS INT, INPUT bal-0
AS DEC, INPUT bal-1
AS DEC, INPUT bal-2
AS DEC, INPUT bal-3
AS DEC ) :
1297 /*------------------------------------------------------------------------------
1300 ------------------------------------------------------------------------------*/
1301 DEF VAR bal-t
AS DEC NO-UNDO.
1302 DEF VAR bal-overdue
AS DEC NO-UNDO.
1304 bal-overdue
= bal-3.
1305 IF overdue-periods
< 3 THEN bal-overdue
= bal-overdue
+ bal-2.
1306 IF overdue-periods
< 2 THEN bal-overdue
= bal-overdue
+ bal-1.
1308 bal-t
= bal-0
+ bal-1
+ bal-2
+ bal-3.
1310 IF min-abs-balance
>= 0.01 OR min-debit-balance
>= 0.01 THEN DO:
1311 IF (overdue-balance
<> ?
AND bal-overdue
>= overdue-balance
) THEN DO:
1312 IF bal-t
< 0 THEN DO:
1313 prp-tot
[6] = prp-tot
[6] + bal-t.
1316 /* else fall through to show debtor on report
*/
1318 ELSE IF (min-debit-balance
<> ?
AND bal-t
< min-debit-balance
) THEN DO:
1319 IF bal-t
< 0 THEN prp-tot
[6] = prp-tot
[6] + bal-t.
1320 ELSE ASSIGN prp-tot
[7] = prp-tot
[7] + bal-t
1321 prp-tot
[1] = prp-tot
[1] + bal-3
1322 prp-tot
[2] = prp-tot
[2] + bal-2
1323 prp-tot
[3] = prp-tot
[3] + bal-1
1324 prp-tot
[4] = prp-tot
[4] + bal-0 .
1327 ELSE IF (min-abs-balance
<> ?
AND ABS(bal-t
) < ABS(min-abs-balance
)) THEN DO:
1328 IF bal-t
< 0 THEN prp-tot
[6] = prp-tot
[6] + bal-t.
1329 ELSE ASSIGN prp-tot
[7] = prp-tot
[7] + bal-t
1330 prp-tot
[1] = prp-tot
[1] + bal-3
1331 prp-tot
[2] = prp-tot
[2] + bal-2
1332 prp-tot
[3] = prp-tot
[3] + bal-1
1333 prp-tot
[4] = prp-tot
[4] + bal-0 .
1338 prp-tot
[1] = prp-tot
[1] + bal-3.
1339 prp-tot
[2] = prp-tot
[2] + bal-2.
1340 prp-tot
[3] = prp-tot
[3] + bal-1.
1341 prp-tot
[4] = prp-tot
[4] + bal-0.
1342 prp-tot
[5] = prp-tot
[5] + bal-t.
1348 /* _UIB-CODE-BLOCK-END
*/
1353 &IF DEFINED(EXCLUDE-include-tenant-entity) = 0 &THEN
1355 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION include-tenant-entity Procedure
1356 FUNCTION include-tenant-entity
RETURNS LOGICAL
1357 ( /* parameter-definitions
*/ ) :
1358 /*------------------------------------------------------------------------------
1361 ------------------------------------------------------------------------------*/
1363 IF entity-type
= "" THEN RETURN TRUE.
1364 IF entity-type
<> Tenant.EntityType
THEN RETURN FALSE.
1365 IF NOT(check-entity-range
) OR (Tenant.EntityCode
>= entity-1
AND Tenant.EntityCode
<= entity-n
) THEN RETURN TRUE.
1371 /* _UIB-CODE-BLOCK-END
*/
1376 &IF DEFINED(EXCLUDE-non-zero-property) = 0 &THEN
1378 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION non-zero-property Procedure
1379 FUNCTION non-zero-property
RETURNS LOGICAL
1380 ( /* parameter-definitions
*/ ) :
1381 /*------------------------------------------------------------------------------
1382 Purpose
: Decide if a property was zero or not
1384 ------------------------------------------------------------------------------*/
1386 DEF VAR i
AS INT NO-UNDO.
1388 IF prp-tot
[i
] <> 0.00 THEN RETURN Yes.
1391 RETURN No.
/* All balances were zero
*/
1395 /* _UIB-CODE-BLOCK-END
*/
1400 &IF DEFINED(EXCLUDE-non-zero-tenant) = 0 &THEN
1402 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION non-zero-tenant Procedure
1403 FUNCTION non-zero-tenant
RETURNS LOGICAL
1404 ( /* parameter-definitions
*/ ) :
1405 /*------------------------------------------------------------------------------
1406 Purpose
: Decide if a tenant was zero or not
1408 ------------------------------------------------------------------------------*/
1410 DEF VAR i
AS INT NO-UNDO.
1412 IF tnt-tot
[i
] <> 0.00 THEN RETURN Yes.
1415 RETURN No.
/* All balances were zero
*/
1419 /* _UIB-CODE-BLOCK-END
*/