X-Rechnung 3.1 UBL for Deutsche Bahn - gross unit price decimals
Closed this issue · 2 comments
stephanstapel commented
stephanstapel commented
rounding rules from EN16931
#131
goedo commented
I enhanced this. (#258 same change)
Even when
this refers to the internal calulcation, IMHO, but the put value should be round. So:
//_writeOptionalAmount(Writer, "ram:ChargeAmount", tradeLineItem.GrossUnitPrice, 4); //roger
_writeOptionalAmount(Writer, "ram:ChargeAmount", tradeLineItem.GrossUnitPrice, 2); //roger
and I changed _writeOptionalAmount:
//roger
if (numDecimals == 2)
{
value = System.Math.Round(value.Value, 2, MidpointRounding.AwayFromZero);
}
//!roger
writer.WriteValue(_formatDecimal(value.Value, numDecimals));