Sha256: 551aaa0c7314f9fd08842121c2320b9d889e33deb9f4c314466021d56e9bead3

Contents?: true

Size: 1.23 KB

Versions: 12

Compression:

Stored size: 1.23 KB

Contents

module BrInvoicesPdf
  module Cfe
    module Renderer
      module TaxesInfo
        extend BaseRenderer

        module_function

        def execute(pdf, data)
          box(pdf, [0, pdf.cursor], page_content_width(pdf)) do
            tribute_values(pdf, data[:payment])
            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(DateTime.parse(time).strftime('%d/%m/%Y %H:%M:%S'), align: :center)
        end
        private_class_method :date_values

        def tribute_values(pdf, payment)
          pdf.text("Tributos\n\n", style: :italic)
          value = format_currency(BigDecimal(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

12 entries across 12 versions & 1 rubygems

Version Path
br_invoices_pdf-0.2.5.alpha.17 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.5 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.5.alpha.16 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.4 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.4.alpha.15 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.4.alpha.14 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.3 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.2 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.1 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.0 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.0.alpha.13 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb
br_invoices_pdf-0.2.0.alpha.12 lib/br_invoices_pdf/cfe/renderer/taxes_info.rb