Hello guys,
I'm creating retail transaction which kinda similar of Sales Order using X++, I'm wondering whether there is existing method I can use to calculate sales tax amount that I can re-use ? This retail transaction (can say it is per item line similar like Sales Line records) will be used to create Sales Order later on, but I need to calculate the tax amount first to display it before it is getting converted to Sales Order.
The challenge here is I supposed to not hard-code the tax rate, but to look at SalesTaxGroup and ItemSalesTaxGroup, also I need to consider if the Price is include sales tax.
So basically, if I only have this kind of information:
1. Sales Qty
2. Sales Price
3. TaxGroup
4. ItemSalesTaxGroup
5. flag to identify IsPriceIncludeTax
How to easily calculate the tax amount ?
It is very good also if the method can also considering line discount but this is not a priority at the moment.
Thanks