93143c28f2
see https://github.com/foodcoops/foodsoft/pull/907 for reference and original work by viehlieb Co-authored-by: viehlieb <pf@pragma-shift.net> fix PDF Pdf make explicit deposit in invoices work add ordergroupname to invoice file name mark bold sum for vat exempt foodcoops download multiple group order invoice as zip
17 lines
577 B
Ruby
17 lines
577 B
Ruby
module Concerns::SendGroupOrderInvoicePdf
|
|
extend ActiveSupport::Concern
|
|
|
|
protected
|
|
|
|
def create_invoice_pdf(group_order_invoice)
|
|
invoice_data = group_order_invoice.load_data_for_invoice
|
|
invoice_data[:title] = t('documents.group_order_invoice_pdf.title', supplier: invoice_data[:supplier])
|
|
invoice_data[:no_footer] = true
|
|
GroupOrderInvoicePdf.new invoice_data
|
|
end
|
|
|
|
def send_group_order_invoice_pdf(group_order_invoice)
|
|
pdf = create_invoice_pdf(group_order_invoice)
|
|
send_data pdf.to_pdf, filename: pdf.filename, type: 'application/pdf'
|
|
end
|
|
end
|