Class: AUB::Payroll::SummaryFile::Generator
- Inherits:
-
Object
- Object
- AUB::Payroll::SummaryFile::Generator
- Defined in:
- lib/aub/payroll/summary_file/generator.rb
Instance Method Summary collapse
- #generate ⇒ Object
- #html_generator ⇒ Object
-
#initialize(company_info:, payroll_info:, transactions:) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(company_info:, payroll_info:, transactions:) ⇒ Generator
Returns a new instance of Generator.
6 7 8 9 10 |
# File 'lib/aub/payroll/summary_file/generator.rb', line 6 def initialize(company_info:, payroll_info:, transactions:) @company_info = CompanyInfo.build(company_info) @payroll_info = PayrollInfo.build(payroll_info) @transactions = transactions.map { |transaction| Transaction.build(transaction) } end |
Instance Method Details
#generate ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/aub/payroll/summary_file/generator.rb', line 12 def generate html_generator.generate do # wkhtmltopdf needs qt patches for header and footer options to work, # otherwise silently ignored, and the ubuntu package comes without it # that was the reason for static binary downloads in Docker kit = File.open('body.html', 'r') do |body_file| = { page_size: 'Letter', header_html: 'header.html', footer_html: 'footer.html', margin_top: 38, margin_bottom: 5, margin_left: 0, margin_right: 0, enable_local_file_access: true, } CustomPDFKit.new(body_file, ) end kit.to_pdf end end |
#html_generator ⇒ Object
34 35 36 |
# File 'lib/aub/payroll/summary_file/generator.rb', line 34 def html_generator HTMLGenerator.new(company_info: @company_info, payroll_info: @payroll_info, transactions: @transactions) end |