Open harzmann opened 1 month ago
Thanks for your suggestion. I'd be more than happy if you could create a PR. I propose to format the decimal with two digits in case the actual value has two or less digits and use four digits only in case they are really set in the decimal value.
This will do it:
Math.Round(tradeLineItem.GrossUnitPrice.Value, 3) != tradeLineItem.GrossUnitPrice.Value
Please add a test case to https://github.com/stephanstapel/ZUGFeRD-csharp/blob/master/ZUGFeRD-Test/XRechnungUBLTests.cs
And the same would be useful for the AllowanceCharge.Amount.
@HolgerPfeifer : would you like to contribute?
Yes, I would like. It will take me some time to get my devolopment environment ready for GitHub. Currently I only use local BitBucket repositories.
Same problem here. With Version 12.8.0 of the DLL the following lines are written:
<ram:GrossPriceProductTradePrice>
<ram:ChargeAmount>24.8600</ram:ChargeAmount>
<ram:BasisQuantity unitCode="C62">1.0000</ram:BasisQuantity>
</ram:GrossPriceProductTradePrice>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>22.3700</ram:ChargeAmount>
<ram:BasisQuantity unitCode="C62">1.0000</ram:BasisQuantity>
</ram:NetPriceProductTradePrice>
Both price fields are defined with 4 decimals.
With Version 15.0.0 both fields are filled with 2 decimals even when they come with 4 decimals. I need 4 decimals when a rabate has to be calculated. Please return to the behavior of 12.8.0
Hi @ernie1000 ,
This change was made intentionally and cannot be 'just reversed' as this component is part of lots of applications. I am happy if you send in a pull request to add digits on demand as I suggested above,
PriceAmount is formatted or rounded to 2 decimal places. However, for example, for fuel bills, 4 decimal places are required for the price per liter. Temporary Save function modified: Writer.WriteValue(_formatDecimal(tradeLineItem.GrossUnitPrice.Value,4));