Programmer:Earn Point with Sale Invoice

From AutoCount Resource Center
Revision as of 08:35, 10 August 2018 by DanielY (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Technical Specifications

  1. Requires Bonus Point module.
  2. To learn how AutoCount Bonus Point works, click Bonus Point.
  3. MemberNo must be assigned with valid value.
    Value must be maintained at Bonus Point > Member Maintenance


Assemblies version 1.8, 1.9

BCE.AutoCount.dll
BCE.AutoCount.CommonAccounting.dll
BCE.AutoCount.MainEntry.dll
BCE.Utils.dll
BCE.Utils.UI.dll
BCE.AutoCount.GeneralMaint.dll
BCE.AutoCount.Invoicing.dll
BCE.AutoCount.Invoicing.Sales

Create Sale Invoice and assign bonus point programmatically

  • This sample code shows how to create Sale Invoice with Bonus Point.
  • When Bonus Point is calculated from external system, programmer can assign the bonus point earning to each item.
  • Highlighted lines are the assignment of bonus point to each item.
  • The total earning point of this document must be the sum of dtl.BonusPoint.
public void NewInvoiceWithBonusPoint(BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Invoicing.Sales.Invoice.InvoiceCommand cmd
        = BCE.AutoCount.Invoicing.Sales.Invoice.InvoiceCommand.Create(dbSetting);
    BCE.AutoCount.Invoicing.Sales.Invoice.Invoice doc = cmd.AddNew();
    BCE.AutoCount.Invoicing.Sales.Invoice.InvoiceDetail dtl;

    doc.RecalculateMemberPoint = true;
    doc.DebtorCode = "300-A001";
    doc.Description = "Test API Bonus Point";
    doc.MemberNo = "M-0001";

    dtl = doc.AddDetail();
    dtl.ItemCode = "FG00001";
    dtl.Qty = 1;
    dtl.UnitPrice = 100;       
    //Manual set bonus point earn
    dtl.BonusPoint = 50;

    dtl = doc.AddDetail();
    dtl.ItemCode = "FG00001";
    dtl.Description = "Test Item";
    dtl.Qty = 1;
    dtl.UnitPrice = 200;
    dtl.BonusPoint = 20;

    //without ItemCode test
    dtl = doc.AddDetail();
    dtl.Description = "Test Item";
    dtl.SubTotal = 200;
    dtl.BonusPoint = 20;

    //Call CalcNetTotal to update document total Bonus Point.
    //If CalcNetTotal() method is not called, total Bonus Point result can be incorrect.
    doc.CalcNetTotal();

    try
    {
        doc.Save();
        //Log success
        BCE.Application.AppMessage.ShowMessage($"Invoice {doc.DocNo} is created.");
    }
    catch (BCE.Application.AppException ex)
    {
        //Log failure
        BCE.Application.AppMessage.ShowMessage($"Fail to create new Invoice.\n{ex.Message}");
    }
}


See Also

Maintenance (Master Data)

Transactions

Reporting

  • Member List and Point Balance - [1.8, 1.9] [2.0]

    Go to menu

    IconAC81.png Go to top
    ProgrammerGo.jpg Resources For AutoCount Software Developers