-
-
Notifications
You must be signed in to change notification settings - Fork 181
Open
Description
The following code does not write ChargeAmount if it is present obviously following PEPPOL rule PEPPOL-EN16931-R046.
ZUGFeRD-csharp/ZUGFeRD/InvoiceDescriptor23CIIWriter.cs
Lines 350 to 383 in 5c8bed7
| #region GrossPriceProductTradePrice (Comfort, Extended, XRechnung) | |
| bool needToWriteGrossUnitPrice = false; | |
| bool hasGrossUnitPrice = tradeLineItem.GrossUnitPrice.HasValue; | |
| bool hasAllowanceCharges = tradeLineItem.GetTradeAllowanceCharges().Count > 0; | |
| if ((descriptor.Profile == Profile.XRechnung) || (descriptor.Profile == Profile.XRechnung1) || (descriptor.Profile == Profile.Comfort)) | |
| { | |
| // PEPPOL-EN16931-R046: For XRechnung, both must be present | |
| needToWriteGrossUnitPrice = hasGrossUnitPrice && hasAllowanceCharges; | |
| } | |
| else | |
| { | |
| // For other profiles, either is sufficient | |
| needToWriteGrossUnitPrice = hasGrossUnitPrice || hasAllowanceCharges; | |
| } | |
| if (needToWriteGrossUnitPrice) | |
| { | |
| _Writer.WriteStartElement("ram", "GrossPriceProductTradePrice", PROFILE_COMFORT_EXTENDED_XRECHNUNG); | |
| _writeOptionalAdaptiveAmount(_Writer, "ram", "ChargeAmount", tradeLineItem.GrossUnitPrice, 2, 4); // BT-148 | |
| if (tradeLineItem.GrossQuantity.HasValue) | |
| { | |
| _writeElementWithAttributeWithPrefix(_Writer, "ram", "BasisQuantity", "unitCode", tradeLineItem.UnitCode.EnumToString(), _formatDecimal(tradeLineItem.GrossQuantity.Value, 4)); | |
| } | |
| foreach (AbstractTradeAllowanceCharge tradeAllowanceCharge in tradeLineItem.GetTradeAllowanceCharges()) // BT-147 | |
| { | |
| _WriteItemLevelAppliedTradeAllowanceCharge(_Writer, tradeAllowanceCharge); | |
| } | |
| _Writer.WriteEndElement(); // ram:GrossPriceProductTradePrice(Comfort|Extended|XRechnung) | |
| } | |
| #endregion // !GrossPriceProductTradePrice(Comfort|Extended|XRechnung) | |
But is this really o.k. not to write ChargeAmount ? For example the official sample
has a ChargeAmount but no TradeAllowanceCharges. If I read this document and write it ChargeAmount is missing.
Metadata
Metadata
Assignees
Labels
No labels