Sha256: 8b7aa02810951bc41df92041ec49551326d1f89b1e061a89b117a1939898f3e8

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

module BrInvoicesPdf
  module Cfe
    module Renderer
      module TaxesInfo
        extend Util::BaseRenderer
        extend BaseRenderer

        module_function

        def execute(pdf, data)
          box(pdf, [0, pdf.cursor], page_content_width(pdf)) do
            tribute_values(pdf, data[:totals])
            sat_params = data[:sat_params]
            sat_number(pdf, sat_params[:sat_number])
            date_values(pdf, sat_params)
          end
        end

        def date_values(pdf, data)
          time = data[:emission_date] + data[:emission_hour]
          pdf.text(Date.parse(time).strftime('%d/%m/%Y %H:%M:%S'), align: :center)
        end
        private_class_method :date_values

        # :reek:FeatureEnvy
        def tribute_values(pdf, payment)
          pdf.text("Tributos\n\n", style: :italic)
          value = format_currency(payment[:approximate_value_of_taxes])
          text = "Informação dos tributos totais incidentes (Lei Federal 12.741/2012):\n R$ #{value}\n\n"
          pdf.text(text, align: :center)
        end
        private_class_method :tribute_values

        def sat_number(pdf, sat_number)
          pdf.text('SAT Número ' + sat_number, align: :center, style: :bold)
        end
        private_class_method :sat_number
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
br_invoices_pdf-0.2.10 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.9 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.8 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.7 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.6.alpha.19 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb