Added estimate for accounts listing browser, same as the chart of accounts. Requested
[capital-apms-progress.git] / trigger / wrcontrt.p
blobaa2fc755d42b0cf837eef4a8166882dca815fdda
1 TRIGGER PROCEDURE FOR WRITE OF Contract NEW NewContract OLD OldContract.
3 DEF BUFFER OC FOR Contract.
4 DEF VAR st-changed AS LOGI NO-UNDO.
5 DEF VAR pc-changed AS LOGI NO-UNDO.
6 DEF VAR cr-changed AS LOGI NO-UNDO.
8 st-changed = (OldContract.ServiceType <> NewContract.ServiceType).
9 pc-changed = (OldContract.PropertyCode <> NewContract.PropertyCode).
10 cr-changed = (OldContract.CreditorCode <> NewContract.CreditorCode).
12 IF NEW NewContract OR st-changed OR pc-changed OR cr-changed
13 OR CAN-FIND( FIRST OC WHERE OC.PropertyCode = NewContract.PropertyCode
14 AND OC.ContractSeq = NewContract.ContractSeq
15 AND ROWID(OC) <> ROWID(NewContract))
16 THEN DO:
18 DEF BUFFER LastContract FOR Contract.
19 DEF VAR max-seq AS INT NO-UNDO INITIAL 0.
20 FOR EACH LastContract WHERE LastContract.PropertyCode = NewContract.PropertyCode
21 AND ROWID(LastContract) <> ROWID(NewContract) NO-LOCK:
22 IF LastContract.ContractSeq > max-seq THEN max-seq = LastContract.ContractSeq.
23 END.
24 NewContract.ContractSeq = max-seq + 1.
25 END.
28 /* could call workflow/update-task.p if dates have changed */