Comments (5)
DivisionByZeroError: Division by zero in.../vendor/josemmo/einvoicing/src/InvoiceLine.php:305
Stack trace:
#0 .../vendor/josemmo/einvoicing/src/InvoiceLine.php(343): Einvoicing\InvoiceLine->getNetAmountBeforeAllowancesCharges()
#1 .../vendor/josemmo/einvoicing/src/Models/InvoiceTotals.php(102): Einvoicing\InvoiceLine->getNetAmount()
#2 .../vendor/josemmo/einvoicing/src/Invoice.php(892): Einvoicing\Models\InvoiceTotals::fromInvoice()
#3 .../app/Jobs/MessageDetailsJob.php(54): Einvoicing\Invoice->getTotals()
from einvoicing.
Hello @cornelpopa,
Thanks for reporting this issue.
I can add a check to avoid the DivisionByZeroError
, but shouldn't this be the expected behavior? I mean, an InvoiceLine with a base quantity of 0 (zero) doesn't make sense, so the error is appropiate.
Otherwise, what should be the expected return value of InvoiceLine::getNetAmountBeforeAllowancesCharges()
when the base quantity is zero?
from einvoicing.
@josemmo Yeah, you're right - that line doesn't make sense, and I agree that division by 0 should be checked for and return maybe an Exception? The invoice where I hit the problem was one "received" by me, not generated by me. You can never be assume that data sent by others is proper. :-(
from einvoicing.
Ok, for now I think is best to keep the current behavior and throw an exception.
from einvoicing.
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
- Edge case using VAT HOT 4
- 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.