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