1 TRIGGER PROCEDURE FOR WRITE OF Order
NEW NewOrder
OLD OldOrder.
3 DEF VAR change
AS DEC NO-UNDO.
5 FIND Project
OF NewOrder
NO-LOCK NO-ERROR.
6 IF NOT AVAILABLE(Project
) THEN RETURN.
8 FIND ProjectBudget
OF Project
WHERE
9 ProjectBudget.AccountCode
= NewOrder.AccountCode
EXCLUSIVE-LOCK NO-ERROR.
10 IF NOT AVAILABLE ProjectBudget
THEN RETURN.
12 IF ProjectBudget.UncommittedBudget
= 0.00 AND ProjectBudget.CommittedBudget
= 0.00 THEN
13 ASSIGN ProjectBudget.UncommittedBudget
= ProjectBudget.OriginalBudget.
16 change
= NewOrder.ApprovedAmount
- OldOrder.ApprovedAmount
17 ProjectBudget.CommittedBudget
= ProjectBudget.CommittedBudget
+ change
18 ProjectBudget.UncommittedBudget
= ProjectBudget.UncommittedBudget
- change.