2013-04-10 17:02:16 +02:00
|
|
|
- title t('.title')
|
2009-01-16 02:17:49 +01:00
|
|
|
|
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
|
2013-10-09 23:19:40 +02:00
|
|
|
%dt= heading_helper Delivery, :delivered_on
|
2012-10-17 20:45:52 +02:00
|
|
|
%dd= @delivery.delivered_on
|
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
|
2009-01-16 02:17:49 +01:00
|
|
|
|
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
|
2009-01-16 02:17:49 +01:00
|
|
|
%tr
|
2013-04-10 17:02:16 +02:00
|
|
|
%th= t '.article'
|
|
|
|
%th= t '.unit'
|
|
|
|
%th.numeric= t '.amount'
|
|
|
|
%th.numeric= t '.price'
|
|
|
|
%th.numeric= t '.sum'
|
2012-10-17 20:45:52 +02:00
|
|
|
%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
|
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
|
2009-05-15 17:58:02 +02:00
|
|
|
|
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)
|