Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6451 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hello,

I've been trying to figure out how to get my script (which determines whether a customer is within credit limit) to run based on the customer that is presently being selected for a new invoice. Even if it was a separate button that is selected to determine credit limit status, how can I get run determine a certain customer. Right now the way the script works is it always uses the first customer in the customer table, the script seems to work otherwise.

Code is below.

Any help would be GREATLY appreciated.

Thanks

Dave

Find [Over Credit Limit Invoices] Copy

Perform Script [ “Allow User Abort” ]

Perform Script [ “Set Error Capture” ]

Perform Script [ “Last Layout [store]” ]

Set Field [ QUOTES::KF_CUST_ID_q; QUOTES::KF_CUST_ID_q ]

Perform Find [ Specified Find Requests: Find Records; Criteria: INVOICES::Status: “Billed” ] [ Restore ]

Extend Found Set [ Specified Find Requests: Find Records; Criteria: INVOICES::Status: “Cancel” ] [ Restore ]

Set Variable [ $CreditLimit; Value:Sum(INVOICES::Price _Grand_Total) ]

Set Field [ QUOTES::testfield; $CreditLimit ]

#ABOVE FIELD IS JUST USED TO VIEW THE SUM OF THE INVOICES, USED FOR TESTING ONLY

Show All Records

If [ $CreditLimit ≥ CUSTOMERS::CreditLimit ]

Show Custom Dialog [ Title: "Account over Credit Limit"; Message: " ACCOUNT HAS REACHED IT'S CREDIT LIMIT!"; Buttons: “OK” ]

End If

Perform Script [ “Last Layout [Restore]” ]

Posted

Forgive me if this is not what you're looking for, but ...

I would set up a relationship in your Customer table showing all invoices (from Invoicing) with balance over 0 for that customer and a summary of those invoices. Then, when you go to make an invoice, test to see if that summary is over the CreditLimit.... if so, send back a dialog to halt or make the invoice anyway...or whatever... after the relationship, the script/coding is minimal...

Royce

This topic is 6451 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.