Skip to content

Instantly share code, notes, and snippets.

@airspeed
Last active December 14, 2015 00:09
Show Gist options
  • Save airspeed/4996761 to your computer and use it in GitHub Desktop.
Save airspeed/4996761 to your computer and use it in GitHub Desktop.
Erstellt ein neues Mahndokument - 1. Rechnung
def print_invoice(invoice, out)
i = invoice
o = i.order_cart
l = i.customer.lang[0..1].downcase === 'de' ? 'de' : 'en' # unoptimal, reicht aber im Augenblick
params = {:@invoice_address => o.invoice_address, :@order_cart => o, :@shipments => o.shipments, :@invoice => i, :@filedate => Date.today}
Clixxie::PdfGenerator.from_template "invoice_mailer/invoice_#{l}.pdf.erb", out, "#{i.invoice_number}.pdf", params
end
# Usage
# print_invoice(Invoice.last, "~/Downloads")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment