Comments (4)
I think this ->setPrice(100 / 1.19)
is the problem. Try using https://github.com/piggly-dev/php-decimal to fix the issue. I don't think that this is a problem of the library but PHPs precision for this operation 100 / 1.19
. Why do you need to divide it and then add it back anyway, if I get that right?
from einvoicing.
The reason I need to do that is because a customer could set the invoice line's price as 100 RON including VAT (on my platform).
If it does that with quantity = 1, then we have no issue. However, if he wants 100k units of that invoice line, the invoice's total must be 10.000.000.
I believe that the precision is not the issue because of the way rounding is done in this library.
Here's a possible fix I prepared: https://github.com/robert-stanciu/einvoicing/pull/2/files
from einvoicing.
Today I found that this behavior happens in the UBL reader too.
Because of the roundings that might appear, the invoice line price won't have enough precision to calculate the invoice totals.
This is a solution: robert-stanciu#3
P.S.: I am aware that this edge case can appear only in certain countries.
from einvoicing.
Hello @robert-stanciu,
Sorry for the delay.
This is because EN 16931 mandates the price without VAT of an item has to be rounded to 2 decimals. AFAIK, this is just how the specification works.
Maybe CIUS-RO has different decimal precision for some of the invoice fields, but I cannot find the specification in English to verify it.
from einvoicing.
Related Issues (20)
- Question about BaseQuantity HOT 2
- Add support for TaxCurrencyCode (BT-6) HOT 3
- Add support for CompanyLegalForm (BT-33)
- Add support for multiple Invoice Notes (BG-1 -> BT-22)
- PartyTaxScheme xsd validation error with passing null as scheme
- Text for Payment Means (BT-82) is bugged? HOT 3
- decimal rounding number HOT 9
- Peppol compliance status and messaging extension HOT 3
- Invoice rounding problem HOT 5
- Missing fields HOT 2
- CreditNote support HOT 2
- How to add tag SupplierAssignedAccountID HOT 4
- XML validator when there is allowance on lines HOT 2
- How to add the informations payment HOT 1
- Negative PayableRoundingAmount HOT 1
- Add seller iban and bank name HOT 1
- Division by zero for $invoice->getTotals()->taxInclusiveAmount HOT 5
- Support for Purchase Orders (EN16931 UBL Peppol BIS Ordering)
- Wrong totals? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from einvoicing.