Comments (6)
Hi @danielmarschall ,
Please Look for ZugferdSettings...
It is described in the README.md and in the Wiki...
Have a nice evening...
from zugferd.
Thank you for the quick reply!
Unfortunately, the method ZugferdSettings::setAmountDecimals
is very useless, because different prices attributes allow different amount of decimals.
When I do setAmountDecimals(11)
, then I get the error:
BR-DEC-19
The allowed maximum number of decimals for the VAT category taxable amount (BT-116) is 2.
So, I think what I actually need is to have single unit prices to be with high precision and summarization prices as 2 decimals (since the standard defines it this way).
For now, my only workaround is this (but it is very dirty):
public function serializeAmountType(XmlSerializationVisitor $visitor, $data, array $type, Context $context)
{
$node = $visitor->getDocument()->createTextNode(
number_format(
$data->value(),
// Dirty workaround
$visitor->getCurrentNode()->localName=='ChargeAmount'?5:2,//ZugferdSettings::getAmountDecimals(),
ZugferdSettings::getDecimalSeparator(),
ZugferdSettings::getThousandsSeparator()
)
);
Do you have an idea how to make this solution cleaner? Maybe I can try to contribute.
from zugferd.
Hi,
You are welcome to suggest another solution, even as a PR. However, there was no such requirement in the recent and even in the older past.
from zugferd.
Ok, I will think about a solution which is a bit cleaner.
Just to explain why more than 2 decimal places are needed in my case.
Customer pays gross prices ("Brutto-Kunde"). They buy 500 pieces of 0.15 EUR gross price. Price to pay = 500x0.15EUR=75.00EUR (taxes 19% included)
In the ZUGFeRD invoice, since the tax is applied on top of the the sum of the item prices, this means that item prices needs to be net, not gross. So I have to convert the single item prices from gross to net: 0.15 EUR / 1.19 = 0.126050420168067EUR
If I round to 0.13, then the customer will pay 500 x 0.13EUR * 1.19 = 77.35EUR (taxes 19% included). So we have a rounding error of -2.35EUR, that's a lot!
from zugferd.
Fixed in #62
Example usage:
ZugferdSettings::setAmountDecimals(2);
ZugferdSettings::setAmountDecimals(5, "ram:ChargeAmount");
from zugferd.
Hi @danielmarschall,
please review #64 ...
Thanks and best regards
from zugferd.
Related Issues (20)
- [QUESTION] setDocumentShipToAddress() adds no shipping data HOT 6
- [BUG] PDF Merger / Loose Comparison / adherence to PDF/A-3b / EOL marker shall be immediately followed by a % HOT 1
- [FEATURE] Add Creditor ID to addDocumentPaymentMeanToDirectDebit()? HOT 3
- Add static factory ZugferdDocumentPdfBuilder::fromPdfFile()
- Why DateTime instead of DateTimeInterface HOT 2
- [BUG] Wrong filename of embedded file? HOT 1
- [FEATURE] Detailed Input Value References in DocumentBuilder HOT 3
- [BUG] CountryID Rendering PROFILE_MINIMUM HOT 6
- [BUG] Error Message with PROFILE_BASIC Document Generation HOT 23
- [DOC] Documentation error at ...TaxRegistration-functions HOT 1
- [BUG] ZugferdSettings::setUnitAmountDecimals() only works for the first item HOT 4
- [FEATURE]Add the PHP requirement to the Readme HOT 1
- [BUG] BR19 Violation: Missing BG12 in XML HOT 4
- Example how to use getDocumentAdditionalReferencedDocument HOT 5
- Multiple Deprecation Warnings in 1.0.54 HOT 1
- [ENHANCEMENT] Issue with Adding Multiple BT-29 Using ->setDocumentSeller() in BASIC Profile HOT 4
- [FEATURE]Add multiple IDs for several trade parties
- Deprecated: Optional parameter $typeCode declared before required parameter HOT 2
- How to use addDocumentPositionAdditionalReferencedDocument? HOT 3
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 zugferd.