foodsoft/app/views/deliveries/show.html.haml

53 lines
1.8 KiB
Text
Raw Permalink Normal View History

2013-04-10 17:02:16 +02:00
- title t('.title')
2012-10-17 20:45:52 +02:00
%dl
2013-10-09 23:19:40 +02:00
%dt= heading_helper Delivery, :supplier
2012-10-17 20:45:52 +02:00
%dd= @delivery.supplier.name
%dt= heading_helper Delivery, :date
%dd= @delivery.date
2013-04-10 17:02:16 +02:00
%dt= t 'deliveries.invoice_amount'
2012-10-17 20:45:52 +02:00
%dd= link_to_invoice(@delivery)
- if @delivery.invoice
2013-04-10 17:02:16 +02:00
%dt= t 'deliveries.invoice_net_amount'
2012-10-17 20:45:52 +02:00
%dd= number_to_currency @delivery.invoice.net_amount
2013-10-09 23:19:40 +02:00
%dt= heading_helper Delivery, :note
2012-10-17 20:45:52 +02:00
%dd= simple_format @delivery.note
2013-04-10 17:02:16 +02:00
%h2= t '.title_articles'
2012-10-17 20:45:52 +02:00
%table.table.table-striped(style="width:500px")
%thead
%tr
2013-12-12 00:13:19 +01:00
%th= Article.model_name.human
%th= heading_helper StockArticle, :unit
2013-12-14 23:52:59 +01:00
%th.numeric= heading_helper GroupOrderArticle, :quantity # quantity to order, although technically this will be a StockChange
2013-12-12 00:13:19 +01:00
%th.numeric= heading_helper Article, :price
2013-04-10 17:02:16 +02:00
%th.numeric= t '.sum'
2012-10-17 20:45:52 +02:00
%tbody
- total_net, total_gross = 0,0
- @stock_changes.each do |stock_change|
2012-10-17 20:45:52 +02:00
- 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
2013-04-10 17:02:16 +02:00
%td(colspan="4")= t '.sum_net'
2012-10-17 20:45:52 +02:00
%td.numeric= number_to_currency total_net
%tr
2013-04-10 17:02:16 +02:00
%td(colspan="4")= t '.sum_gross'
2012-10-17 20:45:52 +02:00
%td.numeric= number_to_currency total_gross
- if @delivery.invoice
%tr
2013-04-10 17:02:16 +02:00
%td(colspan="4")= t '.sum_diff'
2012-10-17 20:45:52 +02:00
%td.numeric= number_to_currency total_gross - @delivery.invoice.net_amount
2012-10-17 20:45:52 +02:00
%p
2013-04-10 17:02:16 +02:00
= link_to t('ui.edit'), edit_supplier_delivery_path(@supplier,@delivery), class: 'btn'
= link_to t('deliveries.suppliers_overview'), supplier_deliveries_path(@supplier)