web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Upload order to BC - divide by zero error

(1) ShareShare
ReportReport
Posted on by 2

🔍 Issue Summary: Incorrect "Amount Including VAT" Calculation in UpdateVATAmounts (SalesLine.dal)

From the attached screenshot, the following issue is observed in the function UpdateVATAmounts under Sales Line.dal:
  • "Amount Including VAT" = 0, but the expected value is 0.01.
  • "VAT Base Amount" = 0.01

🧾 Data Context:

Field Value
Tax Area Code 'QC'
Tax Group Code 'TAXABLE'
Tax Liable Yes
SalesHeader."Posting Date" 2025-09-05
TotalAmount 491.10
Amount 0.01
TotalQuantityBase 3
Quantity (Base) 1
SalesHeader."Currency Factor" 0
TotalAmountInclVAT 564.65
Currency."Amount Rounding Precision" 2

📌 Expected Calculation:

The expected value for "Amount Including VAT" is calculated as:
491.10 + 0.01 + Round((491.10 + 0.01) * 14.975%, 2) - 564.65 = 0.01 

❗ Problem:

The system currently returns "Amount Including VAT" = 0, instead of 0.01, likely due to rounding issues or incorrect calculation logic.
This leads to the following issue:
UpdateVATPercent(0.01, -0.01);
Which results in a divide-by-zero error, since the base is 0.01 and the difference is -0.01.

 
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    90,179 Super User 2025 Season 2 on at
    Upload order to BC - divide by zero error
    I agree with my friend's question. It seems that you did not execute the validate trigger.
    Similar to what I mentioned below
    Dynamics 365 Business Central: The difference between Record.Validate() Method and assignment statement
     
    And if there is no problem, please check the rounding settings.
     
    Thanks
    ZHU
  • Gerardo Rentería García Profile Picture
    22,623 Most Valuable Professional on at
    Upload order to BC - divide by zero error
    Hi
    How do you generate this order? Manually? Through an API? By code?
    Best
    GR

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,669 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,668

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,203

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans