foodsoft/app/helpers/deliveries_helper.rb

18 lines
617 B
Ruby
Raw Normal View History

module DeliveriesHelper
2009-01-18 17:42:51 +01:00
def link_to_invoice(delivery)
if delivery.invoice
link_to number_to_currency(delivery.invoice.amount), [:finance, delivery.invoice],
2013-04-10 17:29:06 +02:00
title: I18n.t('helpers.deliveries.show_invoice')
2009-01-18 17:42:51 +01:00
else
2013-04-10 17:29:06 +02:00
link_to I18n.t('helpers.deliveries.new_invoice'), new_finance_invoice_path(supplier_id: delivery.supplier.id, delivery_id: delivery.id),
2012-10-17 20:45:52 +02:00
class: 'btn btn-mini'
2009-01-18 17:42:51 +01:00
end
end
def stock_articles_for_select(supplier)
2013-06-07 09:35:22 +02:00
supplier.stock_articles.undeleted.reorder('articles.name ASC').map {|a| ["#{a.name} (#{number_to_currency a.price}/#{a.unit})", a.id] }
end
end