Developer forum

Forum » Integration » Is OrderPriceVATPercent calculated?

Is OrderPriceVATPercent calculated?

Søren Jakobsen
Reply

Hi community,

We are getting some weird VAT rates/calculations on orders. See attachment.

We are running on a DW 9.10.17 using custom live-integration project version 4.0.0 with integration to NAV.

Is database field OrderPriceVATPercent calculated? if so which prices are the calculation based on?

 

Best regards Søren

MicrosoftTeams-image.png

Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Soren,

yes, the VatPercent field is a calculated field and it uses the Order VAT and PriceWithoutVat fields values for calculation.
In the standard Live Integration code those values are set in those lines of code:

var orderPriceNode = orderNode.SelectSingleNode("column [@columnName='OrderPrice']");

            if (orderPriceNode == null)
            {
                orderPriceNode = orderNode.SelectSingleNode("column [@columnName='OrderPriceWithVat']");
            }

            if (orderPriceNode != null)
            {
                order.Price.PriceWithVAT = Helpers.ToDouble(orderPriceNode.InnerText);
            }

            var orderPriceWithoutVatNode = orderNode.SelectSingleNode("column [@columnName='OrderPriceWithoutVat']");

            if (orderPriceWithoutVatNode != null)
            {
                order.Price.PriceWithoutVAT = Helpers.ToDouble(orderPriceWithoutVatNode.InnerText);
            }

            if (order.Price.PriceWithVAT > 0 && order.Price.PriceWithoutVAT > 0)
            {
                order.Price.VAT = order.Price.PriceWithVAT - order.Price.PriceWithoutVAT;
            }

So you can check your custom Live Integration code in the OrderHandler.cs and also you need to check what prices are in the response from NAV codeunit:
if the order prices are correct With/Without VAT in the response and also the xml tags form the NAV response and in the OrderHandler.cs.
On the screenshot you made it shows that the order price with Vat and price without VAT is the same number, so that is why VAT percent is 0.
BR, Dmitrij

 

You must be logged in to post in the forum