Really, this should be it, for the passing income.
[capital-apms-progress.git] / trigger / wrcheque.p
bloba33584bdde17c161b65289269cc5e35c01fe6d9d
1 TRIGGER PROCEDURE FOR WRITE OF Cheque NEW BUFFER nc OLD BUFFER oc.
3 IF NOT NEW(Cheque) AND oc.ChequeNo <> 0 AND nc.ChequeNo <> oc.ChequeNo THEN DO:
4 FOR EACH Voucher WHERE Voucher.BankAccountCode = oc.BankAccountCode
5 AND Voucher.ChequeNo = oc.ChequeNo EXCLUSIVE-LOCK:
6 Voucher.ChequeNo = nc.ChequeNo.
7 END.
8 FIND Document WHERE Document.BatchCode = oc.BatchCode
9 AND Document.DocumentCode = oc.DocumentCode EXCLUSIVE-LOCK NO-ERROR.
10 IF AVAILABLE(Document) THEN
11 Document.Reference = STRING( nc.ChequeNo ).
13 FIND NewDocument WHERE NewDocument.BatchCode = oc.BatchCode
14 AND NewDocument.DocumentCode = oc.DocumentCode EXCLUSIVE-LOCK NO-ERROR.
15 IF AVAILABLE(NewDocument) THEN
16 NewDocument.Reference = STRING( nc.ChequeNo ).
17 END.