Sha256: 20bd5e755307e76689f7c6a11ce070c8b6217afb80957f170e80d75d861977c0

Contents?: true

Size: 938 Bytes

Versions: 9

Compression:

Stored size: 938 Bytes

Contents

module BrInvoicesPdf
  module Cfe
    module Renderer
      module Header
        extend BaseRenderer

        module_function

        # :reek:FeatureEnvy
        def execute(pdf, data)
          cpf = cpf_vlue(data[:cpf])

          pdf_setup(pdf) do
            add_header_config(pdf, data, cpf)
          end

          pdf.move_down(5)
        end

        def cpf_vlue(cpf)
          cpf ? 'CONSUMIDOR: ' + format_cpf(cpf) : 'CONSUMIDOR NAO IDENTIFICADO'
        end
        private_class_method :cpf_vlue

        def add_header_config(pdf, data, cpf)
          pdf.font('Helvetica', style: :bold)
          pdf.text("Extrato: #{data[:document_number]}", align: :center)
          pdf.text(cpf, align: :center)
          pdf.text('CUPOM FISCAL ELETRONICO - SAT', align: :center)
          pdf.font('Helvetica', style: :normal, align: :center)
        end
        private_class_method :add_header_config
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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