Sha256: 16d4fd9c6e433a666017e23dddeabe6982f4d46d374aaa21a72f864e5d2b9119
Contents?: true
Size: 1.22 KB
Versions: 23
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true module BrInvoicesPdf module Cfe module Renderer module Header extend Util::BaseRenderer extend BaseRenderer module_function # :reek:FeatureEnvy def execute(pdf, data) pdf_setup(pdf) do add_header_config(pdf, data, identificator(data)) end pdf.move_down(5) end def identificator(data) cpf = data[:cpf] cnpj = data[:cnpj] if cpf.to_s.empty? if cnpj.to_s.empty? 'CONSUMIDOR NAO IDENTIFICADO' else 'CONSUMIDOR: ' + format_cnpj(cnpj) end else 'CONSUMIDOR: ' + format_cpf(cpf) end end private_class_method :identificator def add_header_config(pdf, data, identificator) pdf.font('Helvetica', style: :bold) pdf.text("Extrato: #{data[:document_number]}", align: :center) pdf.text(identificator, 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
23 entries across 23 versions & 1 rubygems