Added capital works blank section. Synced calling screen.
[capital-apms-progress.git] / trigger / wrorder.p
blob7ce226b6b8418f3fbdbd255110d8387bb33b3751
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.
15 ASSIGN
16 change = NewOrder.ApprovedAmount - OldOrder.ApprovedAmount
17 ProjectBudget.CommittedBudget = ProjectBudget.CommittedBudget + change
18 ProjectBudget.UncommittedBudget = ProjectBudget.UncommittedBudget - change.