Programmer:Earn Point with Sale Invoice
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 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
- 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
|