1 TRIGGER PROCEDURE FOR DELETE OF AccountBalance.
3 DEF VAR d-bal
LIKE AccountBalance.Balance
INITIAL 0 NO-UNDO.
4 DEF VAR d-bud
LIKE AccountBalance.Budget
INITIAL 0 NO-UNDO.
5 DEF VAR d-rbd
LIKE AccountBalance.RevisedBudget
INITIAL 0 NO-UNDO.
8 d-bal
= 0 - AccountBalance.Balance
9 d-bud
= 0 - AccountBalance.Budget
10 d-rbd
= 0 - AccountBalance.RevisedBudget
13 /* update consequential GL budget record
*/
14 IF AccountBalance.EntityType
<> "L" AND (d-bud
<> 0 OR d-rbd
<> 0) THEN DO:
15 DEF BUFFER cons
FOR AccountBalance.
16 CASE AccountBalance.EntityType
:
18 FIND Property
WHERE Property.PropertyCode
= AccountBalance.EntityCode
NO-LOCK.
19 FIND cons
WHERE cons.EntityType
= "L"
20 AND cons.EntityCode
= Property.CompanyCode
21 AND cons.AccountCode
= AccountBalance.AccountCode
22 EXCLUSIVE-LOCK NO-ERROR.
23 IF NOT AVAILABLE(cons
) THEN DO:
27 cons.EntityCode
= Property.CompanyCode
28 cons.AccountCode
= AccountBalance.AccountCode
32 cons.Budget
= cons.Budget
+ d-bud
33 cons.RevisedBudget
= cons.RevisedBudget
+ d-rbd
40 /* update account summary record
*/
41 IF d-bal
<> 0 OR d-bud
<> 0 OR d-rbd
<> 0 THEN DO:
42 FIND AccountSummary
WHERE AccountSummary.Entitytype
= AccountBalance.EntityType
43 AND AccountSummary.EntityCode
= AccountBalance.EntityCode
44 AND AccountSummary.AccountCode
= AccountBalance.AccountCode
45 EXCLUSIVE-LOCK NO-ERROR.
47 IF NOT AVAILABLE(AccountSummary
) THEN DO:
48 CREATE AccountSummary.
50 AccountSummary.Entitytype
= AccountBalance.EntityType
51 AccountSummary.EntityCode
= AccountBalance.EntityCode
52 AccountSummary.AccountCode
= AccountBalance.AccountCode
57 AccountSummary.Balance
= AccountSummary.Balance
+ d-bal
58 AccountSummary.Budget
= AccountSummary.Budget
+ d-bud
59 AccountSummary.RevisedBudget
= AccountSummary.Revised
+ d-rbd
62 IF AccountSummary.Balance
= 0 AND
63 AccountSummary.Budget
= 0 AND
64 AccountSummary.RevisedBudget
= 0 THEN
65 DELETE AccountSummary.
67 ASSIGN d-bud
= d-bud
NO-ERROR.
/* clear any error status
*/