Added capital works blank section. Synced calling screen.
[capital-apms-progress.git] / process / one-off / reconcil.p
blobe1ef95c92dc22a60bba43214a9486e1e47a39bfb
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:
10 a-total = 0.
11 b-total = 0.
12 c-total = 0.
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.
18 END.
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 ).
22 END.
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 ).
27 END.
28 IF a-total <> b-total OR b-total <> c-total THEN
29 DISPLAY Company.CompanyCode a-total b-total c-total.
30 END.
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.
45 END.
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.
53 END.
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.
64 END.
65 END.
67 END PROCEDURE.