@@ -107,6 +107,13 @@ class function TXRechnungInvoiceAdapter230.LoadDocumentUBL(_Invoice: TInvoice;
107107 _Invoiceline.GlobalID_EAN_GTIN := node2.text;
108108 _Invoiceline.TaxCategory := TXRechnungHelper.InvoiceDutyTaxFeeCategoryCodeFromStr(TXRechnungXMLHelper.SelectNodeText(node,' .//cac:ClassifiedTaxCategory/cbc:ID' ));
109109 _Invoiceline.TaxPercent := TXRechnungHelper.PercentageFromStr(TXRechnungXMLHelper.SelectNodeText(node,' .//cac:ClassifiedTaxCategory/cbc:Percent' ));
110+ if TXRechnungXMLHelper.SelectNodes(node,' .//cac:AdditionalItemProperty' ,nodes) then
111+ for i := 0 to nodes.length-1 do
112+ with _Invoiceline.ItemAttributes.AddItemAttribute do
113+ begin
114+ Name := TXRechnungXMLHelper.SelectNodeText(nodes[i],' .//cbc:Name' );
115+ Value := TXRechnungXMLHelper.SelectNodeText(nodes[i],' .//cbc:Value' );
116+ end ;
110117 // VAT := TXRechnungXMLHelper.SelectNodeText(node,'.//cac:TaxScheme/cbc:ID');
111118 end ;
112119 _Invoiceline.NetPriceAmount := TXRechnungHelper.UnitPriceAmountFromStr(TXRechnungXMLHelper.SelectNodeText(_Node,' .//cac:Price/cbc:PriceAmount' ));
@@ -327,6 +334,7 @@ class function TXRechnungInvoiceAdapter230.LoadDocumentUBL(_Invoice: TInvoice;
327334 _Invoice.AllowanceTotalAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,' //cac:LegalMonetaryTotal/cbc:AllowanceTotalAmount' ));
328335 _Invoice.ChargeTotalAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,' //cac:LegalMonetaryTotal/cbc:ChargeTotalAmount' ));
329336 _Invoice.PrepaidAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,' //cac:LegalMonetaryTotal/cbc:PrepaidAmount' ));
337+ _Invoice.PayableRoundingAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,' //cac:LegalMonetaryTotal/cbc:PayableRoundingAmount' ));
330338 _Invoice.PayableAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,' //cac:LegalMonetaryTotal/cbc:PayableAmount' ));
331339
332340 if TXRechnungXMLHelper.SelectNodes(xml,' .//cac:InvoiceLine' ,nodes) then
@@ -371,6 +379,13 @@ class function TXRechnungInvoiceAdapter230.LoadDocumentUNCEFACT(_Invoice: TInvoi
371379 _Invoiceline.SellersItemIdentification := TXRechnungXMLHelper.SelectNodeText(node2,' .//ram:SellerAssignedID' );
372380 _Invoiceline.Name := TXRechnungXMLHelper.SelectNodeText(node2,' .//ram:Name' );
373381 _Invoiceline.Description := TXRechnungXMLHelper.SelectNodeText(node2,' .//ram:Description' );
382+ if TXRechnungXMLHelper.SelectNodes(node2,' .//ram:ApplicableProductCharacteristic' ,nodes) then
383+ for i := 0 to nodes.length-1 do
384+ with _Invoiceline.ItemAttributes.AddItemAttribute do
385+ begin
386+ Name := TXRechnungXMLHelper.SelectNodeText(nodes[i],' .//ram:Description' );
387+ Value := TXRechnungXMLHelper.SelectNodeText(nodes[i],' .//ram:Value' );
388+ end ;
374389 end ;
375390 if TXRechnungXMLHelper.SelectNode(_Node,' .//ram:SpecifiedLineTradeAgreement' ,node2) then
376391 begin
@@ -791,6 +806,7 @@ class function TXRechnungInvoiceAdapter230.LoadDocumentUNCEFACT(_Invoice: TInvoi
791806 _Invoice.TaxCurrencyCode := TXRechnungXMLHelper.SelectAttributeText(node,' currencyID' );
792807 _Invoice.TaxAmountTotal := TXRechnungHelper.AmountFromStr(node.text);
793808 end ;
809+ _Invoice.PayableRoundingAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(node2,' .//ram:RoundingAmount' ));
794810 _Invoice.TaxInclusiveAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(node2,' .//ram:GrandTotalAmount' ));
795811 _Invoice.PrepaidAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(node2,' .//ram:TotalPrepaidAmount' ));
796812 _Invoice.PayableAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(node2,' .//ram:DuePayableAmount' ));
@@ -896,6 +912,12 @@ class procedure TXRechnungInvoiceAdapter230.SaveDocumentUBL(_Invoice: TInvoice;
896912 AddChild(' cbc:Percent' ).Text := TXRechnungHelper.PercentageToStr(_Invoiceline.TaxPercent);
897913 AddChild(' cac:TaxScheme' ).AddChild(' cbc:ID' ).Text := ' VAT' ;
898914 end ;
915+ for i := 0 to _Invoiceline.ItemAttributes.Count-1 do
916+ with AddChild(' cac:AdditionalItemProperty' ) do
917+ begin
918+ AddChild(' cbc:Name' ).Text := _Invoiceline.ItemAttributes[i].Name ;
919+ AddChild(' cbc:Value' ).Text := _Invoiceline.ItemAttributes[i].Value ;
920+ end ;
899921 end ;
900922 with _Node.AddChild(' cac:Price' ) do
901923 begin
@@ -1335,7 +1357,12 @@ class procedure TXRechnungInvoiceAdapter230.SaveDocumentUBL(_Invoice: TInvoice;
13351357 Attributes[' currencyID' ] := _Invoice.TaxCurrencyCode;
13361358 Text := TXRechnungHelper.AmountToStr(_Invoice.PrepaidAmount);
13371359 end ;
1338- // <cbc:PayableRoundingAmount currencyID="EUR">0</cbc:PayableRoundingAmount>
1360+ if _Invoice.PayableRoundingAmount <> 0.0 then
1361+ with AddChild(' cbc:PayableRoundingAmount' ) do
1362+ begin
1363+ Attributes[' currencyID' ] := _Invoice.TaxCurrencyCode;
1364+ Text := TXRechnungHelper.AmountToStr(_Invoice.PayableRoundingAmount);
1365+ end ;
13391366 with AddChild(' cbc:PayableAmount' ) do
13401367 begin
13411368 Attributes[' currencyID' ] := _Invoice.TaxCurrencyCode;
@@ -1378,6 +1405,14 @@ class procedure TXRechnungInvoiceAdapter230.SaveDocumentUNCEFACT(
13781405 AddChild(' ram:Name' ).Text := _Invoiceline.Name ;
13791406 if not (_Invoiceline.Description = ' ' ) then
13801407 AddChild(' ram:Description' ).Text := _Invoiceline.Description;
1408+ for i := 0 to _Invoiceline.ItemAttributes.Count-1 do
1409+ with AddChild(' ram:ApplicableProductCharacteristic' ) do
1410+ begin
1411+ if _Invoiceline.ItemAttributes[i].Name <> ' ' then
1412+ AddChild(' ram:Description' ).Text := _Invoiceline.ItemAttributes[i].Name ;
1413+ if _Invoiceline.ItemAttributes[i].Value <> ' ' then
1414+ AddChild(' ram:Value' ).Text := _Invoiceline.ItemAttributes[i].Value ;
1415+ end ;
13811416 end ;
13821417 with _Node.AddChild(' ram:SpecifiedLineTradeAgreement' ) do
13831418 begin
@@ -1804,7 +1839,8 @@ class procedure TXRechnungInvoiceAdapter230.SaveDocumentUNCEFACT(
18041839 Attributes[' currencyID' ] := _Invoice.TaxCurrencyCode;
18051840 Text := TXRechnungHelper.AmountToStr(_Invoice.TaxAmountTotal);
18061841 end ;
1807- // <ram:RoundingAmount>0</ram:RoundingAmount>
1842+ if _Invoice.PayableRoundingAmount <> 0.0 then
1843+ AddChild(' ram:RoundingAmount' ).Text := TXRechnungHelper.AmountToStr(_Invoice.PayableRoundingAmount);
18081844 AddChild(' ram:GrandTotalAmount' ).Text := TXRechnungHelper.AmountToStr(_Invoice.TaxInclusiveAmount);
18091845 AddChild(' ram:TotalPrepaidAmount' ).Text := TXRechnungHelper.AmountToStr(_Invoice.PrepaidAmount);
18101846 AddChild(' ram:DuePayableAmount' ).Text := TXRechnungHelper.AmountToStr(_Invoice.PayableAmount);
0 commit comments