2009-01-16 02:17:49 +01:00
|
|
|
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],
|
2012-10-17 20:45:52 +02:00
|
|
|
title: "Rechnung anzeigen"
|
2009-01-18 17:42:51 +01:00
|
|
|
else
|
2012-10-17 20:45:52 +02:00
|
|
|
link_to "Rechnung anlegen", new_finance_invoice_path(supplier_id: delivery.supplier.id, delivery_id: delivery.id),
|
|
|
|
class: 'btn btn-mini'
|
2009-01-18 17:42:51 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-05-17 16:11:39 +02:00
|
|
|
def stock_articles_for_select(supplier)
|
2011-05-27 14:09:01 +02:00
|
|
|
supplier.stock_articles.map {|a| ["#{a.name} (#{number_to_currency a.price}/#{a.unit})", a.id] }
|
2009-05-17 16:11:39 +02:00
|
|
|
end
|
|
|
|
|
2009-01-16 02:17:49 +01:00
|
|
|
end
|