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.
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
).