Sha256: 465058bea3e80af007c6b38c0f537c9ea04f232377753a67d963009a3fdb2bb0

Contents?: true

Size: 652 Bytes

Versions: 21

Compression:

Stored size: 652 Bytes

Contents

# frozen_string_literal: true

module BrInvoicesPdf
  module Nfce
    module Parser
      module Totals
        extend Util::XmlLocate

        module_function

        def total_root_path(xml)
          "#{root_path(xml)}/total/ICMSTot"
        end

        def execute(xml)
          root_path = total_root_path(xml)

          {
            items: Products.execute(xml).count,
            subtotal: locate_element(xml, "#{root_path}/vProd"),
            discounts: locate_element(xml, "#{root_path}/vDesc"),
            total: locate_element(xml, "#{root_path}/vNF"),
            cashback: '0.00'
          }
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
br_invoices_pdf-0.2.24 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.23 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.22 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.21 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.20 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.19 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.18 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.17 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.16 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.15 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.14 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.14.alpha.23 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.13 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.13.alpha.22 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.12.alpha.21 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.12.alpha.20 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.12 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.11 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.10 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.9 lib/br_invoices_pdf/nfce/parser/totals.rb