Calculate Unit Price

Hello, Like to make a special Uniti price calculation. When make a Invoice and fill in a item row. I like to recalculate the unit price for one Item with item number say 1000. When i enter manualy the Item price, this is a price inclusive TAX. Then must this price recalculated to a Unitprice without TAX. So where put the code to do this for me in the Sales invoice subform?. regards, Wim

Hi, I suggest that you create a new field called “Unit Price Incl. Tax” in the Sales Line table. This field will be shown on the forms Sales Order, Invoice, etc. On the Validate trigger of this field, you can put some code to calculate the Navision Unit Price (without Taxes), and populate the value. This way, you’ll be sure that the Navision functionality won’t be affected: Unit Price incl. Tax - OnValidate() UnitPriceBeforeTax := MyReverseTaxFun("Unit Price incl. Tax"); // your function returning Unit Price before tax VALIDATE("Unit Price", UnitPriceBeforeTax); // important to put VALIDATE here To have a perfect update between the 2 fields, you must also put this code: Unit Price - OnValidate() “Unit Price incl. Tax” := MyTaxFun(“Unit Price incl. Tax”); In this case, the challenge is really to create the tax calculation function. Tax calculation can be very complex if you are dealing with several states & countries, and several types of taxes (products, services, gas, etc.). For the sales tax calculation in Navision, you can take a look at the Codeunit called “Sales Tax Calculate”.

Have you looked into the “Prices include VAT” field on the Customer Card? I’ve never used it, because it won’t work with North American Sales Tax, but I would assume it might work with VAT (If that is what you are trying to calculate here). If this won’t work, then look at the ReverseCalculateTax function in codeunit 398.