How to check the customer whether it is already exceeded credit limit or not, programmatically?

SOLVED

Hi all,

How to check the customer whether it is already exceeded credit limit or not, programmatically? Because I do not find any standard function to check it. I only find the exceptions, but I do not know how to trigger the exception during customer selection on my custom form. 

Thank you.

Parents
  • +1
    verified answer

    Checked the standard coding and just copy how standard do the validation.

    /*
             * <summary>
             * Check if the customer has exceeded credit limit
             * </summary>
             */
            internal bool hasExceededCreditLimit(Sage.Accounting.SalesLedger.Customer customer)
            {
                bool isovercreditlimit = false;
                decimal zero = 0;
                if(customer.TradingAccount.CreditLimit > zero)
                {
                    if ((customer.PendingNotificationDocumentsValue + customer.AccountBalance) <= customer.TradingAccount.CreditLimit)
                    {
                        isovercreditlimit = false;
                    }
                    else
                    {
                        isovercreditlimit = true;
                    }
                }
                return isovercreditlimit;
            }

Reply
  • +1
    verified answer

    Checked the standard coding and just copy how standard do the validation.

    /*
             * <summary>
             * Check if the customer has exceeded credit limit
             * </summary>
             */
            internal bool hasExceededCreditLimit(Sage.Accounting.SalesLedger.Customer customer)
            {
                bool isovercreditlimit = false;
                decimal zero = 0;
                if(customer.TradingAccount.CreditLimit > zero)
                {
                    if ((customer.PendingNotificationDocumentsValue + customer.AccountBalance) <= customer.TradingAccount.CreditLimit)
                    {
                        isovercreditlimit = false;
                    }
                    else
                    {
                        isovercreditlimit = true;
                    }
                }
                return isovercreditlimit;
            }

Children
No Data