Page 1 of 1

SCRIPT SAMPLE: Credit Limits Set By Head Office

Posted: Thu Jun 21, 2018 4:34 pm
by COBS Tech Support
Here is a sample script that changes the credit limit checking behaviour of the system to use the credit limit of a head office for associated branch customers.

Code: Select all

* R-CLIMIT.MAC COBS (example script)
* Centralise Head Office Credit Control

* If a branch, locate head office
If .NOT. IsEmpty(Custrec->Cusacc)
   Custrec->(Find(Custrec->Cusacc))
   TotalDue := Custrec->FPay0 + Custrec->Pay30 + Custrec->Pay60 + Custrec->Pay90
Endif

If TotalDue + Amount > Custrec->Cuscredit
   Echo("Sorry, the credit limit of account " + Alltrim(Custrec->Cuscode) + " has been exceeded by " + NTrim((TotalDue + Amount) - Custrec->Cuscredit, 12, 2) + ";;Credit limit: " + NTrim(Custrec->Cuscredit, 12, 2))
   Return FALSE
Endif

Return TRUE