Module: Dorsale::BillingMachine::QuotationPdfCommonMethods

Included in:
QuotationMultipleVatPdf, QuotationSingleVatPdf
Defined in:
app/pdfs/dorsale/billing_machine/quotation_pdf_common_methods.rb

Instance Method Summary collapse

Instance Method Details

#buildObject



4
5
6
7
# File 'app/pdfs/dorsale/billing_machine/quotation_pdf_common_methods.rb', line 4

def build
  super
  build_attachments
end

#build_attachmentsObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/pdfs/dorsale/billing_machine/quotation_pdf_common_methods.rb', line 9

def build_attachments
  main_document.attachments.each do |attachment|
    next unless File.extname(attachment.file.path) == ".pdf"

    file     = attachment.file.path
    nb_pages = ::CombinePDF.load(file).pages.count

    nb_pages.times do |i|
      start_new_page template: file, template_page: (i+1)
    end
  end
end

#build_bank_informationsObject



22
23
# File 'app/pdfs/dorsale/billing_machine/quotation_pdf_common_methods.rb', line 22

def build_bank_informations
end

#build_expiryObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/pdfs/dorsale/billing_machine/quotation_pdf_common_methods.rb', line 25

def build_expiry
  return if main_document.expires_at.nil?

  top    = bounds.top - 11.5.cm
  height = 0.5.cm
  width  = 7.5.cm

  bounding_box [bounds.left, top], height: height, width: width do
    draw_bounds_debug
    text "<b>#{main_document.t(:expires_at)}</b> #{I18n.l(main_document.expires_at)}", inline_format: true, size: 9
  end
end