Only Accept Valid Sales Rep Codes On Invoices

Locked
COBS Tech Support
Site Admin
Posts: 102
Joined: Sat May 15, 2021 9:57 am

Only Accept Valid Sales Rep Codes On Invoices

Post 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
Locked