Problem with document total
I have problem adding an invoice through DI API with the total amount of 50,000 including VAT. The system is SBO 2005B, PL42; Document Setting is as following:
- Rounding Method = By Document
- Rounding Rule for Tax = Round Down
- Round Tax Amount in Rows = False
The following VBA code is used to add an invoice:
Dim boInv As SAPbobsCOM.Documents
Dim boCom As SAPbobsCOM.Company
Set boCom = GetSboCompany() 'this function returns SBO company
Set boInv = boCom.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
boInv.CardCode = "Customer1"
boInv.DocDate = #9/1/2008#
boInv.DocType = dDocument_Items
boInv.DocCurrency = "JPY"
'Now add a invoice line
'boInv.Lines.Add - No need for the first line
boInv.Lines.ItemCode = "item1"
boInv.Lines.VatGroup = "S01" 'VAT rate for Japan is 5%
boInv.Lines.PriceAfterVAT = 50000
boInv.Add 'add the invoice
What I get is an invoice with:
Gross Price = 50000 (in a line)
Total (LC) = 47619 (in a line)
Tax Amount = 2380.952381 (in a line)
Total Before Discount = 47619 (in a header)
Tax = 2380 (in a header; fractional part was round down because of the Document Setting)
Total = 49999 (in a header; which is different from Gross Price by 1 yen)
However, if I enter this invoice directly from the screen, then there will be no difference between Gross Price (Price after VAT) and Total, so, the invoice will be created correctly.
My question is how to add an invoice with the total amount of 50000? (Of course, 50000 is not the only "difficult" number, for example, 40000 also poses the same problem). I tried to use boInv.Lines.NetTaxAmount property to directly assign the tax amount (which is possible from the SBO screen), but in PL42 there's an error saying that this property is not yet implemented.