foodsoft/app/views/deliveries/show.html.haml
2012-10-17 20:45:52 +02:00

52 lines
No EOL
1.6 KiB
Text

- title "Lieferung anzeigen"
%dl
%dt Lieferantin
%dd= @delivery.supplier.name
%dt Geliefert am
%dd= @delivery.delivered_on
%dt Rechnungsbetrag:
%dd= link_to_invoice(@delivery)
- if @delivery.invoice
%dt bereinigter Rechnungsbetrag:
%dd= number_to_currency @delivery.invoice.net_amount
%dt Notiz:
%dd= simple_format @delivery.note
%h2 Artikel
%table.table.table-striped(style="width:500px")
%thead
%tr
%th Artikel
%th Einheit
%th.numeric Menge
%th.numeric Nettopreis
%th.numeric Summe
%tbody
- total_net, total_gross = 0,0
- @delivery.stock_changes.all.each do |stock_change|
- quantity = stock_change.quantity
- sum = quantity * stock_change.stock_article.price
- total_net += sum
- total_gross += quantity * stock_change.stock_article.gross_price
%tr
%td= stock_change.stock_article.name
%td= stock_change.stock_article.unit
%td.numeric= quantity
%td.numeric= number_to_currency stock_change.stock_article.price
%td.numeric= number_to_currency sum
%tfoot
%tr
%td(colspan="4") Nettosumme
%td.numeric= number_to_currency total_net
%tr
%td(colspan="4") Bruttosumme
%td.numeric= number_to_currency total_gross
- if @delivery.invoice
%tr
%td(colspan="4") Brutto - bereinigter Rechnungsbetrag:
%td.numeric= number_to_currency total_gross - @delivery.invoice.net_amount
%p
= link_to 'Bearbeiten', edit_supplier_delivery_path(@supplier,@delivery), class: 'btn'
= link_to 'Lieferungsübersicht', supplier_deliveries_path(@supplier)