1 DEF VAR sundry-db
AS DEC NO-UNDO INITIAL 7610.00 .
2 DEF VAR month-n
AS INT NO-UNDO.
3 DEF VAR a-total
AS DEC NO-UNDO INITIAL 0.
4 DEF VAR b-total
AS DEC NO-UNDO INITIAL 0.
5 DEF VAR c-total
AS DEC NO-UNDO INITIAL 0.
6 FIND Month
WHERE Month.StartDate
= DATE(12,1,1997) NO-LOCK.
7 month-n
= Month.MonthCode.
9 FOR EACH Company
NO-LOCK:
13 FOR EACH AccountBalance
WHERE AccountBalance.EntityType
= "L"
14 AND AccountBalance.EntityCode
= Company.CompanyCode
15 AND AccountBalance.AccountCode
= sundry-db
16 AND AccountBalance.MonthCode
<= month-n
NO-LOCK:
17 a-total
= a-total
+ AccountBalance.Balance.
19 FOR EACH Tenant
WHERE Tenant.EntityType
= "L"
20 AND Tenant.EntityCode
= Company.CompanyCode
NO-LOCK:
21 RUN add-tenant-balance
( INPUT-OUTPUT b-total
, INPUT-OUTPUT c-total
).
23 FOR EACH Property
OF Company
NO-LOCK,
24 EACH Tenant
WHERE Tenant.EntityType
= "P"
25 AND Tenant.EntityCode
= Property.PropertyCode
NO-LOCK:
26 RUN add-tenant-balance
( INPUT-OUTPUT b-total
, INPUT-OUTPUT c-total
).
28 IF a-total
<> b-total
OR b-total
<> c-total
THEN
29 DISPLAY Company.CompanyCode a-total b-total c-total.
36 PROCEDURE add-tenant-balance.
37 DEF INPUT-OUTPUT PARAMETER bal
AS DEC NO-UNDO.
38 DEF INPUT-OUTPUT PARAMETER trn
AS DEC NO-UNDO.
40 FOR EACH AccountBalance
WHERE AccountBalance.EntityType
= "T"
41 AND AccountBalance.EntityCode
= Tenant.TenantCode
42 AND AccountBalance.AccountCode
= sundry-db
43 AND AccountBalance.MonthCode
<= month-n
NO-LOCK:
44 bal
= bal
+ AccountBalance.Balance.
47 FOR EACH AcctTran
WHERE AcctTran.EntityType
= "T"
48 AND AcctTran.EntityCode
= Tenant.TenantCode
49 AND AcctTran.AccountCode
= sundry-db
50 AND AcctTran.MonthCode
<= month-n
51 AND AcctTran.ClosedState
<> "F" NO-LOCK:
52 trn
= trn
+ AcctTran.Amount.
55 DEF BUFFER ClosedTran
FOR AcctTran.
56 FOR EACH ClosedTran
WHERE ClosedTran.EntityType
= "T"
57 AND ClosedTran.EntityCode
= Tenant.TenantCode
58 AND ClosedTran.AccountCode
= sundry-db
59 AND ClosedTran.MonthCode
> month-n
60 AND ClosedTran.ClosedState
= "F" NO-LOCK:
61 FIND ClosingGroup
OF ClosedTran
NO-LOCK.
62 FOR EACH AcctTran
OF ClosingGroup
WHERE AcctTran.MonthCode
<= month-n
NO-LOCK:
63 trn
= trn
+ AcctTran.Amount.