Added net|gross sum for deliveries-show-page. (Fixed #193)

This commit is contained in:
Benjamin Meichsner 2009-03-11 18:03:28 +01:00
parent 35251576fa
commit 20d4177990
3 changed files with 26 additions and 11 deletions

View file

@ -3,27 +3,27 @@
= form.hidden_field :supplier_id = form.hidden_field :supplier_id
%p %p
= form.label :name Name
%br/ %br/
= form.text_field :name = form.text_field :name
%p %p
= form.label :unit Einheit
%br/ %br/
= form.text_field :unit = form.text_field :unit
%p %p
= form.label :note Notiz
%br/ %br/
= form.text_field :note = form.text_field :note
%p %p
= form.label :price Preis
%br/ %br/
= form.text_field :price = form.text_field :price
%p %p
= form.label :tax MwSt
%br/ %br/
= form.text_field :tax, :value => (stock_article.tax || 7.0) = form.text_field :tax, :value => (stock_article.tax || 7.0)
%p %p
= form.label :deposit Pfand
%br/ %br/
= form.text_field :deposit = form.text_field :deposit
%p %p

View file

@ -11,7 +11,7 @@
= f.error_messages = f.error_messages
= f.hidden_field :supplier_id = f.hidden_field :supplier_id
%p %p
%b= f.label :delivered_on %b Geliefert am:
= f.date_select :delivered_on = f.date_select :delivered_on
%h2 Artikel %h2 Artikel

View file

@ -4,7 +4,7 @@
%b Lieferant: %b Lieferant:
=h @delivery.supplier.name =h @delivery.supplier.name
%p %p
%b Delivered on: %b Geliefert am:
= @delivery.delivered_on = @delivery.delivered_on
%p %p
%b Rechnungsbetrag: %b Rechnungsbetrag:
@ -16,13 +16,28 @@
%th Artikel %th Artikel
%th Einheit %th Einheit
%th Menge %th Menge
%th Nettopreis
%th Summe
- total_net, total_gross = 0,0
- for stock_change in @delivery.stock_changes.find :all, :include => :stock_article - for stock_change in @delivery.stock_changes.find :all, :include => :stock_article
- quantity = stock_change.quantity
- sum = quantity * stock_change.stock_article.price
- total_net += sum
- total_gross += quantity * stock_change.stock_article.gross_price
%tr %tr
%td= stock_change.stock_article.name %td= stock_change.stock_article.name
%td= stock_change.stock_article.unit %td= stock_change.stock_article.unit
%td= stock_change.quantity %td= quantity
%td= number_to_currency stock_change.stock_article.price
%td= number_to_currency sum
%p
Nettosumme:
= number_to_currency total_net
%p
Bruttosumme:
= number_to_currency total_gross
%br/ %br/
= link_to 'Edit', edit_supplier_delivery_path(@supplier,@delivery) = link_to 'Bearbeiten', edit_supplier_delivery_path(@supplier,@delivery)
| |
= link_to 'Back', supplier_deliveries_path(@supplier) = link_to 'Lieferungsübersicht', supplier_deliveries_path(@supplier)