foodsoft/app/helpers/deliveries_helper.rb
Manuel Wiedenmann 7a63394dac Merge remote-tracking branch 'origin/rails3'
Conflicts:
	Gemfile
	Gemfile.lock
2013-06-10 01:53:31 +02:00

17 lines
617 B
Ruby

module DeliveriesHelper
def link_to_invoice(delivery)
if delivery.invoice
link_to number_to_currency(delivery.invoice.amount), [:finance, delivery.invoice],
title: I18n.t('helpers.deliveries.show_invoice')
else
link_to I18n.t('helpers.deliveries.new_invoice'), new_finance_invoice_path(supplier_id: delivery.supplier.id, delivery_id: delivery.id),
class: 'btn btn-mini'
end
end
def stock_articles_for_select(supplier)
supplier.stock_articles.undeleted.reorder('articles.name ASC').map {|a| ["#{a.name} (#{number_to_currency a.price}/#{a.unit})", a.id] }
end
end