Skip to content

Instantly share code, notes, and snippets.

@airspeed
Last active December 15, 2015 06:59
Show Gist options
  • Save airspeed/5220389 to your computer and use it in GitHub Desktop.
Save airspeed/5220389 to your computer and use it in GitHub Desktop.
Erstellt eine CSV-Darstellung aller Rechnungen im Status :m2.
def report_per_status(status)
include ActionView::Helpers::NumberHelper
m2list = Invoice.where(:state => status.to_s)
m2list.each do |r|
puts r.invoice_number + ";" + I18n.l(r.created_at.to_date) + ";" + number_with_precision(r.order_cart.final_amount) + ";5,00"
end
end
# usage report_per_status(:m2)
def ink_report
include ActionView::Helpers::NumberHelper
Invoice.where(:state => 'ink').order(:customer_id).each do |r|
puts r.customer_id.to_s + ";" + r.invoice_number + ";" + I18n.l(r.created_at.to_date) + ";" + number_with_precision(r.order_cart.final_amount)
end
end
# usage ink_report
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment