Skip to content

Commit a788e59

Browse files
committed
PayableRoundingAmount BT-114
1 parent 81e613d commit a788e59

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

intf.Invoice.pas

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ TInvoice = class(TObject)
599599
AllowanceTotalAmount : Currency;
600600
ChargeTotalAmount : Currency;
601601
PrepaidAmount : Currency;
602+
PayableRoundingAmount : Currency; //BT-114
602603
PayableAmount : Currency;
603604
public
604605
constructor Create;
@@ -648,6 +649,15 @@ procedure TInvoice.Clear;
648649
Notes.Clear;
649650
TaxAmountSubtotals.Clear;
650651
PaymentTermsType := iptt_None;
652+
653+
LineAmount := 0;
654+
TaxExclusiveAmount := 0;
655+
TaxInclusiveAmount := 0;
656+
AllowanceTotalAmount := 0;
657+
ChargeTotalAmount := 0;
658+
PrepaidAmount := 0;
659+
PayableRoundingAmount := 0;
660+
PayableAmount := 0;
651661
end;
652662

653663
{ TInvoiceLines }

intf.XRechnung_2_3.pas

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ class function TXRechnungInvoiceAdapter230.LoadDocumentUBL(_Invoice: TInvoice;
327327
_Invoice.AllowanceTotalAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,'//cac:LegalMonetaryTotal/cbc:AllowanceTotalAmount'));
328328
_Invoice.ChargeTotalAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,'//cac:LegalMonetaryTotal/cbc:ChargeTotalAmount'));
329329
_Invoice.PrepaidAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,'//cac:LegalMonetaryTotal/cbc:PrepaidAmount'));
330+
_Invoice.PayableRoundingAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,'//cac:LegalMonetaryTotal/cbc:PayableRoundingAmount'));
330331
_Invoice.PayableAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,'//cac:LegalMonetaryTotal/cbc:PayableAmount'));
331332

332333
if TXRechnungXMLHelper.SelectNodes(xml,'.//cac:InvoiceLine',nodes) then
@@ -791,6 +792,7 @@ class function TXRechnungInvoiceAdapter230.LoadDocumentUNCEFACT(_Invoice: TInvoi
791792
_Invoice.TaxCurrencyCode := TXRechnungXMLHelper.SelectAttributeText(node,'currencyID');
792793
_Invoice.TaxAmountTotal := TXRechnungHelper.AmountFromStr(node.text);
793794
end;
795+
_Invoice.PayableRoundingAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(node2,'.//ram:RoundingAmount'));
794796
_Invoice.TaxInclusiveAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(node2,'.//ram:GrandTotalAmount'));
795797
_Invoice.PrepaidAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(node2,'.//ram:TotalPrepaidAmount'));
796798
_Invoice.PayableAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(node2,'.//ram:DuePayableAmount'));
@@ -1335,7 +1337,12 @@ class procedure TXRechnungInvoiceAdapter230.SaveDocumentUBL(_Invoice: TInvoice;
13351337
Attributes['currencyID'] := _Invoice.TaxCurrencyCode;
13361338
Text := TXRechnungHelper.AmountToStr(_Invoice.PrepaidAmount);
13371339
end;
1338-
// <cbc:PayableRoundingAmount currencyID="EUR">0</cbc:PayableRoundingAmount>
1340+
if _Invoice.PayableRoundingAmount <> 0.0 then
1341+
with AddChild('cbc:PayableRoundingAmount') do
1342+
begin
1343+
Attributes['currencyID'] := _Invoice.TaxCurrencyCode;
1344+
Text := TXRechnungHelper.AmountToStr(_Invoice.PayableRoundingAmount);
1345+
end;
13391346
with AddChild('cbc:PayableAmount') do
13401347
begin
13411348
Attributes['currencyID'] := _Invoice.TaxCurrencyCode;
@@ -1804,7 +1811,8 @@ class procedure TXRechnungInvoiceAdapter230.SaveDocumentUNCEFACT(
18041811
Attributes['currencyID'] := _Invoice.TaxCurrencyCode;
18051812
Text := TXRechnungHelper.AmountToStr(_Invoice.TaxAmountTotal);
18061813
end;
1807-
// <ram:RoundingAmount>0</ram:RoundingAmount>
1814+
if _Invoice.PayableRoundingAmount <> 0.0 then
1815+
AddChild('ram:RoundingAmount').Text := TXRechnungHelper.AmountToStr(_Invoice.PayableRoundingAmount);
18081816
AddChild('ram:GrandTotalAmount').Text := TXRechnungHelper.AmountToStr(_Invoice.TaxInclusiveAmount);
18091817
AddChild('ram:TotalPrepaidAmount').Text := TXRechnungHelper.AmountToStr(_Invoice.PrepaidAmount);
18101818
AddChild('ram:DuePayableAmount').Text := TXRechnungHelper.AmountToStr(_Invoice.PayableAmount);

intf.XRechnung_3_0.pas

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ class function TXRechnungInvoiceAdapter301.LoadDocumentUBL(_Invoice: TInvoice;
327327
_Invoice.AllowanceTotalAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,'//cac:LegalMonetaryTotal/cbc:AllowanceTotalAmount'));
328328
_Invoice.ChargeTotalAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,'//cac:LegalMonetaryTotal/cbc:ChargeTotalAmount'));
329329
_Invoice.PrepaidAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,'//cac:LegalMonetaryTotal/cbc:PrepaidAmount'));
330+
_Invoice.PayableRoundingAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,'//cac:LegalMonetaryTotal/cbc:PayableRoundingAmount'));
330331
_Invoice.PayableAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(xml,'//cac:LegalMonetaryTotal/cbc:PayableAmount'));
331332

332333
if TXRechnungXMLHelper.SelectNodes(xml,'.//cac:InvoiceLine',nodes) then
@@ -791,6 +792,7 @@ class function TXRechnungInvoiceAdapter301.LoadDocumentUNCEFACT(_Invoice: TInvoi
791792
_Invoice.TaxCurrencyCode := TXRechnungXMLHelper.SelectAttributeText(node,'currencyID');
792793
_Invoice.TaxAmountTotal := TXRechnungHelper.AmountFromStr(node.text);
793794
end;
795+
_Invoice.PayableRoundingAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(node2,'.//ram:RoundingAmount'));
794796
_Invoice.TaxInclusiveAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(node2,'.//ram:GrandTotalAmount'));
795797
_Invoice.PrepaidAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(node2,'.//ram:TotalPrepaidAmount'));
796798
_Invoice.PayableAmount := TXRechnungHelper.AmountFromStr(TXRechnungXMLHelper.SelectNodeText(node2,'.//ram:DuePayableAmount'));
@@ -1336,7 +1338,12 @@ class procedure TXRechnungInvoiceAdapter301.SaveDocumentUBL(_Invoice: TInvoice;
13361338
Attributes['currencyID'] := _Invoice.TaxCurrencyCode;
13371339
Text := TXRechnungHelper.AmountToStr(_Invoice.PrepaidAmount);
13381340
end;
1339-
// <cbc:PayableRoundingAmount currencyID="EUR">0</cbc:PayableRoundingAmount>
1341+
if _Invoice.PayableRoundingAmount <> 0.0 then
1342+
with AddChild('cbc:PayableRoundingAmount') do
1343+
begin
1344+
Attributes['currencyID'] := _Invoice.TaxCurrencyCode;
1345+
Text := TXRechnungHelper.AmountToStr(_Invoice.PayableRoundingAmount);
1346+
end;
13401347
with AddChild('cbc:PayableAmount') do
13411348
begin
13421349
Attributes['currencyID'] := _Invoice.TaxCurrencyCode;
@@ -1810,7 +1817,8 @@ class procedure TXRechnungInvoiceAdapter301.SaveDocumentUNCEFACT(
18101817
Attributes['currencyID'] := _Invoice.TaxCurrencyCode;
18111818
Text := TXRechnungHelper.AmountToStr(_Invoice.TaxAmountTotal);
18121819
end;
1813-
// <ram:RoundingAmount>0</ram:RoundingAmount>
1820+
if _Invoice.PayableRoundingAmount <> 0.0 then
1821+
AddChild('ram:RoundingAmount').Text := TXRechnungHelper.AmountToStr(_Invoice.PayableRoundingAmount);
18141822
AddChild('ram:GrandTotalAmount').Text := TXRechnungHelper.AmountToStr(_Invoice.TaxInclusiveAmount);
18151823
AddChild('ram:TotalPrepaidAmount').Text := TXRechnungHelper.AmountToStr(_Invoice.PrepaidAmount);
18161824
AddChild('ram:DuePayableAmount').Text := TXRechnungHelper.AmountToStr(_Invoice.PayableAmount);

0 commit comments

Comments
 (0)