Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Under the action created, click add to add a profile question, configure it as below (both for percentage or flat fee). When you add the action to credit rating, it will request the percentage or flat fee you want to add according to the action you've selected in this KBarticle.

...

Code Block
//Name: LateFeeFlatFee
//Description:
//EventCode:
if (context.ContainsKey("InvoiceID"))
{
    var invoice = Invoice.GetByID(Convert.ToInt32(context["InvoiceID"]));

    if (Logic.Core.User.GetUserBalance(invoice.UserID) > 0)
    {
        var rate = Convert.ToDouble(context["Rate"]);
        var statement = Logisense.Boss.Logic.Billing.Bill.RetrieveStatement(Logisense.Boss.Logic.Billing.Bill.FindTopLevelParent(invoice.UserID));

        using (var invoiceSummaryCalculator = new InvoiceSummaryCalculator(statement))
        {
            Logisense.Boss.Logic.Billing.Bill.AddCharge(statement.ID, invoice.UserID, rate, "Late charge", DateTime.MinValue, DateTime.MinValue,
                false, invoiceSummaryCalculator, Service.SearchByName("Invoice Late Fee CDN")[0]);
            invoiceSummaryCalculator.UpdateAggregate();
        }
    }
    return true;
}
return false;

...

  • EventLogMessage - Profile question with a datatype of text. This message will be added to the Event Log report if the user is NOT canceled. Otherwise there is Event Log text in the action that can be adjusted

  • UserStatus - this is the status to which you would like the user to be set, i.e. you should have a status named 'Write Off' and that value should be in the profile question as well. The name needs to match the status type exactly.

This write off script is fired by payment terms for invoices that are past due by a set amount. It will set the user status on the account to that which you have selected and add a credit to the account to zero out the accounts balance effectively removing it from reports (because its balanced).

...