Skip to content

Commit

Permalink
Fix: Creates invalid xml when tax value is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
yogi70 committed Dec 20, 2024
1 parent 8054662 commit e6f8206
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/XmlConverterCiiToUbl.php
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,14 @@ function ($taxTotalAmountNode) {
'currencyID',
$taxTotalAmountNode->getAttribute('currencyID')
);
},
function() use ($invoiceHeaderSettlement) {
$this->destination->elementWithAttribute(
'cbc:TaxAmount',
0.0,
'currencyID',
$this->source->queryValue('./ram:InvoiceCurrencyCode', $invoiceHeaderSettlement)
);
}
);

Expand All @@ -1236,12 +1244,14 @@ function ($tradeTaxNode) use ($invoiceHeaderSettlement) {
$this->formatAmount($this->source->queryValue('./ram:BasisAmount', $tradeTaxNode)),
'currencyID',
$this->source->queryValue('./ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount/@currencyID', $invoiceHeaderSettlement)
?? $this->source->queryValue('./ram:InvoiceCurrencyCode', $invoiceHeaderSettlement)
);
$this->destination->elementWithAttribute(
'cbc:TaxAmount',
$this->formatAmount($this->source->queryValue('./ram:CalculatedAmount', $tradeTaxNode)),
'currencyID',
$this->source->queryValue('./ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount/@currencyID', $invoiceHeaderSettlement)
?? $this->source->queryValue('./ram:InvoiceCurrencyCode', $invoiceHeaderSettlement)
);

$this->destination->startElement('cac:TaxCategory');
Expand Down

0 comments on commit e6f8206

Please sign in to comment.