Programmer:Earn Point with Sale Invoice v2
Technical Specifications
- Requires Bonus Point module.
- To learn how AutoCount Bonus Point works, click Bonus Point.
- 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
- AR Debtor (Customer) - [1.8, 1.9] [2.0]
- Stock Item (Item Maintenance) - [1.8, 1.9] [2.0]
Maintenance (Master Data)
- Member - [1.8, 1.9] [2.0]
- Member Type - [1.8, 1.9] [2.0]
- Race - [1.8, 1.9] [2.0]
Transactions
- Bonus Point Adjustment - [1.8, 1.9] [2.0]
- Bonus Point Redemption - [1.8, 1.9] [2.0]
- Earn Point with Sale Invoice - [1.8, 1.9] [2.0]
Reporting
Go to top
|
Resources For AutoCount Software Developers
|