Alert for Customer invoices exceeding X days past due

Hi Gail,

You can't directly setup an alert for when a customer goes over terms, as something a user does has to trigger the alert. We wanted something along these lines so we "cheated".

We have a BPM created so that whenever the user enters a CustID onto a Sales Order, code checks for overdue invoices on that customer and puts the customer on hold if any found.

A seperate BAM checks for a change in a Customers Credit Hold status and sends an email if one is detected.

Below is the code for both. You should be able to combine them into just a BAM alert.

The BPM is a pre-processing directive against the SalesOrder.ChangeCustomer BO. No conditions. One action: synchronously execute 4GL ... record nothing.

Code:
find first ttOrderHed no-lock no-error.
if available ttOrderHed then do:
find first InvcHead where InvcHead.Company=ttOrderHed.Company and InvcHead.CustNum=ttOrderHed.CustNum and InvcHead.OpenInvoice = True and InvcHead.DueDate < (TODAY - 30) and InvcHead.Posted = True and InvcHead.InvoiceBal > 0 no-lock no-error.
if available InvcHead then do:
/* Customer has open, overdue invoices - find Customer account and see if it's already on hold*/
for each Customer where Customer.Company=ttOrderHed.Company and Customer.CustNum=ttOrderHed.CustNum and Customer.CreditHold = False no-lock:
Run lib\UpdateTableBuffer.p(input BUFFER Customer:HANDLE, 'CreditHoldSource',"TERMS").
Run lib\UpdateTableBuffer.p(input BUFFER Customer:HANDLE, 'CreditHoldDate',TODAY).
Run lib\UpdateTableBuffer.p(input BUFFER Customer:HANDLE, 'CreditHold',True).
end.
end.
end.


The BAM is created against the Customer table with selected fields: CreditHold, CreditHoldSource. Alert program code:

/* Send email whenever a Customer goes on Credit Hold */
{ud/GlbAlert.i &TableName = "Customer"}

FIND GlbCustCred WHERE (GlbCustCred.Company = Customer.Company) AND (GlbCustCred.CustNum = Customer.CustNum) NO-LOCK NO-ERROR.

DEFINE VARIABLE NewEmailBody AS CHARACTER NO-UNDO.


/* Create email */
ASSIGN Email-To = "credit_controller@your_company.com"
Email-Subject = "Customer on Credit Hold: " + STRING(Customer.Name) + " (" + STRING(Customer.CustID) + ")"


/* Create the new body of the email */
NewEmailBody = "~nCompany: " + STRING(Customer.Company)
+ "~nName: " + STRING(Customer.Name)
+ "~nCustID: " + STRING(Customer.CustID)
+ "~nHas Parent: " + (IF Customer.ParentCustNum = 0 THEN "No" ELSE "Yes")
+ "~n~nCredit Hold Source: " + STRING(Customer.CreditHoldSource)
+ "~nCredit Limit: " + STRING(Customer.CreditLimit)
+ "~nInvoice Balance: " + STRING(GlbCustCred.ARTotal)
+ "~nOpen Orders: " + STRING(GlbCustCred.SOTotal)
+ "~n~nSales Person: " + STRING(Customer.SalesRepCode)
+ "~nTerms: " + STRING(Customer.TermsCode)
+ "~n~nDO NOT REPLY TO THIS E-MAIL ACCOUNT, IT DOES NOT GET REVIEWED!".


/* Print Email Body */
ASSIGN Email-Text = NewEmailBody



As I said, you should be able to combine these into just a BAM alert, but feel free to come back to me if you're having problems.

HTH,

Nigel.



--- In vantage@yahoogroups.com, "gail.harder" <gail.harder@...> wrote:
>
> Does anyone have an (email) alert set up in Vantage for Accounts Receivable invoices exceeding X days past due date?
>
> Any help on the tables/fields would be appreciated.
>
> I thinking this would be set up in Business Activity Manager.
>
> Gail
>
Does anyone have an (email) alert set up in Vantage for Accounts Receivable invoices exceeding X days past due date?

Any help on the tables/fields would be appreciated.

I thinking this would be set up in Business Activity Manager.

Gail