1 TRIGGER PROCEDURE FOR WRITE OF Creditor
OLD BUFFER OldCr.
3 IF OldCr.CreditorCode
<> 0 AND OldCr.CreditorCode
<> Creditor.CreditorCode
THEN DO:
4 MESSAGE "Creditor codes cannot be re-assigned."
5 VIEW-AS ALERT-BOX ERROR TITLE "Error Writing Creditor".
8 IF OldCr.Active
AND NOT Creditor.Active
THEN DO:
9 IF CAN-FIND( FIRST Voucher
OF Creditor
WHERE Voucher.VoucherStatus
= "U"
10 OR Voucher.VoucherStatus
= "A")
12 MESSAGE "Cannot de-activate a creditor with unpaid vouchers."
13 VIEW-AS ALERT-BOX ERROR TITLE "Error Writing Creditor".
16 FIND Office
WHERE ThisOffice
NO-LOCK.
17 FIND OfficeControlAccount
OF Office
WHERE OfficeControlAccount.Name
= "CREDITORS" NO-LOCK.
18 IF CAN-FIND( AccountSummary
WHERE AccountSummary.EntityType
= "C"
19 AND AccountSummary.EntityCode
= Creditor.CreditorCode
20 AND AccountSummary.AccountCode
= OfficeControlAccount.AccountCode
)
22 MESSAGE "Cannot de-activate a creditor with non-zero balance."
23 VIEW-AS ALERT-BOX ERROR TITLE "Error Writing Creditor".