Programmer:Earn Point with Sale Invoice v2: Difference between revisions

From AutoCount Resource Center
Content added Content deleted
(Created page with "__toc__ ==Technical Specifications== #Requires '''Bonus Point''' module. #To learn how AutoCount Bonus Point works, click Bonus Point. <br/> ==Assemblies version 2.0== {{...")
 
No edit summary
 
Line 3: Line 3:
#Requires '''Bonus Point''' module.
#Requires '''Bonus Point''' module.
#To learn how AutoCount Bonus Point works, click [[Bonus Point]].
#To learn how AutoCount Bonus Point works, click [[Bonus Point]].
#'''MemberNo''' must be assigned with valid value.
#:Value must be maintained at Bonus Point > [[Programmer:Member v2|Member Maintenance]]


<br/>
<br/>

Latest revision as of 08:35, 10 August 2018

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 2.0

AutoCount.Accounting.dll
AutoCount.Accounting.UI.dll
AutoCount.dll
AutoCount.MainEntry.dll
AutoCount.UI.dll
AutoCount.GeneralMaint.dll
AutoCount.Invoicing.dll
AutoCount.Invoicing.Sales.dll

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(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.Invoicing.Sales.Invoice.InvoiceCommand cmd
        = AutoCount.Invoicing.Sales.Invoice.InvoiceCommand.Create(userSession, userSession.DBSetting);
    AutoCount.Invoicing.Sales.Invoice.Invoice doc = cmd.AddNew();
    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
        AutoCount.AppMessage.ShowMessage($"Invoice {doc.DocNo} is created.");
    }
    catch (AutoCount.AppException ex)
    {
        //Log failure
        AutoCount.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

    Go to top
    Resources For AutoCount Software Developers