From d9531814facc59eb1429cdff2f4bd3ae7cb22755 Mon Sep 17 00:00:00 2001 From: Marvin G Date: Tue, 17 Dec 2024 11:14:47 +0100 Subject: [PATCH] + Add SpecifiedTradeAllowanceCharge to IncludedSupplyChainTradeLineItem->SpecifiedLineTradeSettlement --- src/XmlConverterUblToCii.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/XmlConverterUblToCii.php b/src/XmlConverterUblToCii.php index cb2a1c1..9f363f5 100644 --- a/src/XmlConverterUblToCii.php +++ b/src/XmlConverterUblToCii.php @@ -390,6 +390,30 @@ function ($invoiceLineAccountingCostNode) { } ); + $this->source->queryAll('./cac:AllowanceCharge', $invoiceLineNode)->forEach( + function ($allowanceChargeNode) { + $this->destination->startElement('ram:SpecifiedTradeAllowanceCharge'); + + $this->source->whenExists( + './cbc:ChargeIndicator', + $allowanceChargeNode, + function ($chargeIndicatorNode) { + $this->destination->startElement('ram:ChargeIndicator'); + $this->destination->element('udt:Indicator', $chargeIndicatorNode->nodeValue); + $this->destination->endElement(); + } + ); + + $this->destination->element('ram:CalculationPercent', $this->source->queryValue('./cbc:MultiplierFactorNumeric', $allowanceChargeNode)); + $this->destination->element('ram:BasisAmount', $this->source->queryValue('./cbc:BaseAmount', $allowanceChargeNode)); + $this->destination->element('ram:ActualAmount', $this->source->queryValue('./cbc:Amount', $allowanceChargeNode)); + $this->destination->element('ram:ReasonCode', $this->source->queryValue('./cbc:AllowanceChargeReasonCode', $allowanceChargeNode)); + $this->destination->element('ram:Reason', $this->source->queryValue('./cbc:AllowanceChargeReason', $allowanceChargeNode)); + + $this->destination->endElement(); + } + ); + $this->destination->endElement(); $this->destination->endElement();