From bba209d53a4b473d16ed91fc8c0a117822d12abe Mon Sep 17 00:00:00 2001 From: Nandeesh Gupta Date: Tue, 24 Sep 2024 18:46:15 +0530 Subject: [PATCH] Added charge total amount (BT-108) --- .../ubl/common_aggregate_components/legal_monetary_total.rb | 5 ++++- spec/fixtures/simplified_invoice.rb | 1 + spec/fixtures/standard_invoice.rb | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/zatca/ubl/common_aggregate_components/legal_monetary_total.rb b/lib/zatca/ubl/common_aggregate_components/legal_monetary_total.rb index db60e8f..9d8f605 100644 --- a/lib/zatca/ubl/common_aggregate_components/legal_monetary_total.rb +++ b/lib/zatca/ubl/common_aggregate_components/legal_monetary_total.rb @@ -1,6 +1,6 @@ class ZATCA::UBL::CommonAggregateComponents::LegalMonetaryTotal < ZATCA::UBL::BaseComponent attr_reader :line_extension_amount, :tax_exclusive_amount, - :tax_inclusive_amount, :allowance_total_amount, :prepaid_amount, + :tax_inclusive_amount, :allowance_total_amount, :charge_total_amount, :prepaid_amount, :payable_amount, :currency_id # @@ -17,6 +17,7 @@ def initialize( tax_exclusive_amount:, tax_inclusive_amount:, allowance_total_amount:, + charge_total_amount:, prepaid_amount: nil, payable_amount: nil, currency_id: "SAR" @@ -25,6 +26,7 @@ def initialize( @tax_exclusive_amount = tax_exclusive_amount @tax_inclusive_amount = tax_inclusive_amount @allowance_total_amount = allowance_total_amount + @charge_total_amount = charge_total_amount @prepaid_amount = prepaid_amount @payable_amount = payable_amount @currency_id = currency_id @@ -52,6 +54,7 @@ def elements ZATCA::UBL::BaseComponent.new(name: "cbc:TaxExclusiveAmount", value: @tax_exclusive_amount, attributes: {"currencyID" => @currency_id}), ZATCA::UBL::BaseComponent.new(name: "cbc:TaxInclusiveAmount", value: @tax_inclusive_amount, attributes: {"currencyID" => @currency_id}), ZATCA::UBL::BaseComponent.new(name: "cbc:AllowanceTotalAmount", value: @allowance_total_amount, attributes: {"currencyID" => @currency_id}), + ZATCA::UBL::BaseComponent.new(name: "cbc:ChargeTotalAmount", value: @charge_total_amount, attributes: {"currencyID" => @currency_id}), prepaid_amount_element, payable_amount_element ] diff --git a/spec/fixtures/simplified_invoice.rb b/spec/fixtures/simplified_invoice.rb index e535efe..522f82f 100644 --- a/spec/fixtures/simplified_invoice.rb +++ b/spec/fixtures/simplified_invoice.rb @@ -104,6 +104,7 @@ tax_exclusive_amount: "201.00", tax_inclusive_amount: "231.15", allowance_total_amount: "0.00", + charge_total_amount: "0.00", prepaid_amount: "0.00", payable_amount: "231.15" ).freeze diff --git a/spec/fixtures/standard_invoice.rb b/spec/fixtures/standard_invoice.rb index 250c715..1799c31 100644 --- a/spec/fixtures/standard_invoice.rb +++ b/spec/fixtures/standard_invoice.rb @@ -97,6 +97,7 @@ def construct_signed_standard_invoice tax_exclusive_amount: "900.00", tax_inclusive_amount: "1035.00", allowance_total_amount: "0.00", + charge_total_amount: "0.00", payable_amount: "1035.00" ) @@ -265,6 +266,7 @@ def construct_unsigned_standard_invoice tax_exclusive_amount: "4.00", tax_inclusive_amount: "4.60", allowance_total_amount: "0.00", + charge_total_amount: "0.00", prepaid_amount: "0.00", payable_amount: "4.60" )