Files
baclight/app/services/sample_card_generator_local.rb
T

27 lines
739 B
Ruby
Raw Normal View History

class SampleCardGeneratorLocal
def initialize(process)
@process = process
end
def call
# SampleCard::DataFormatter.new(@process).call
group_sample_cards_pdf = CombinePDF.new
SampleIdCard.where(employer_name: @process.employer_name).each do |card|
url = SampleCard::JasperUrlGenerator.new(@process, card.family_id).call
puts url
card_pdf = SampleCard::JasperPdfGenerator.new(url).call
group_sample_cards_pdf << card_pdf
end
todays_date = DateTime.current.strftime('%Y%m%d%H%M%S')
group_sample_cards_pdf.save("tmp/#{@process.employer_name}_sample_cards_#{todays_date}.pdf")
group_sample_cards_pdf
end
end