Page 1 of 1

Only Accept Valid Sales Rep Codes On Invoices

Posted: Wed Oct 20, 2021 10:18 am
by COBS Tech Support
This script prevents an invoice from being saved or re-saved if a salesperson code is specified on it but does not match any staff member currently found in your staff profile list.

Code: Select all

If .NOT. IsEmpty(ReadTranValue("Salesperson"))
   OpenTable("COMRATE")
   If .NOT. COMRATE->(Find(ReadTranValue("Salesperson")))
      Echo("Sorry, the sales rep code '" + ALLTRIM(ReadTranValue("Salesperson")) + "' does not exist. Please correct this before proceeding.")
      Return FALSE
   Endif
Endif