Order-refactoring part II.
This commit is contained in:
parent
f7b9582261
commit
6fd5d825f9
27 changed files with 228 additions and 231 deletions
|
|
@ -2,7 +2,7 @@
|
|||
%tr
|
||||
%th Name
|
||||
%th Gebinde
|
||||
%th Netto/FC-Preis
|
||||
%th Netto-/Bruttopreis
|
||||
%th Bestellte Einheiten
|
||||
%th Volle Gebinde
|
||||
- total_net, total_gross, counter = 0, 0, 0
|
||||
|
|
@ -12,19 +12,19 @@
|
|||
%td{:colspan => "9"}
|
||||
- order_articles.each do |order_article|
|
||||
- net_price = order_article.price.price
|
||||
- fc_price = order_article.price.fc_price
|
||||
- gross_price = order_article.price.gross_price
|
||||
- units = order_article.units_to_order
|
||||
- unit_quantity = order_article.price.unit_quantity
|
||||
- total_net += units * unit_quantity * net_price
|
||||
- total_gross += units * unit_quantity * fc_price
|
||||
- total_gross += units * unit_quantity * gross_price
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles'), :style => "color: #{units > 0 ? 'green' : 'red'}"}
|
||||
%td=h order_article.article.name
|
||||
%td= "#{unit_quantity} x #{order_article.article.unit}"
|
||||
%td= "#{number_to_currency(net_price)} / #{number_to_currency(fc_price)}"
|
||||
%td= "#{number_to_currency(net_price)} / #{number_to_currency(gross_price)}"
|
||||
%td= "#{order_article.quantity} + #{order_article.tolerance}" if unit_quantity > 1
|
||||
%td= units
|
||||
%p
|
||||
Summe (Netto/FC-Preise):
|
||||
Summe (Netto/Brutto-Preise):
|
||||
= "#{number_to_currency(total_net)} / #{number_to_currency(total_gross)}"
|
||||
%p
|
||||
Bestellte Artikel.
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ pdf.text "Ansprechpartner: " + @order.supplier.contact_person
|
|||
pdf.move_down 10
|
||||
|
||||
# Articles
|
||||
data = @order.order_articles.all(:include => :article).collect do |a|
|
||||
data = @order.order_articles.ordered.all(:include => :article).collect do |a|
|
||||
[a.article.order_number, a.units_to_order, a.article.name,
|
||||
a.price.unit_quantity, a.article.unit, a.price.price]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ for group_order in @order.group_orders
|
|||
|
||||
total = 0
|
||||
data = []
|
||||
group_order.group_order_articles.each do |goa|
|
||||
group_order.group_order_articles.ordered.each do |goa|
|
||||
price = goa.order_article.price.fc_price
|
||||
quantity = goa.quantity
|
||||
sub_total = price * quantity
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ pdf.footer [pdf.margin_box.left, pdf.margin_box.bottom-5] do
|
|||
end
|
||||
|
||||
max_order_articles_per_page = 17 # How many order_articles shoud written on a page
|
||||
order_articles = @order.order_articles
|
||||
order_articles = @order.order_articles.ordered
|
||||
|
||||
pdf.text "Artikelübersicht", :style => :bold
|
||||
pdf.move_down 5
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
- title _("Show order")
|
||||
#element_navigation
|
||||
= link_to_unless @order.previous == @order, _("Previous order"), @order.previous
|
||||
= link_to_unless @order.previous == @order, "<< #{@order.previous.supplier.name}", @order.previous
|
||||
|
|
||||
= link_to _("Overview"), orders_path
|
||||
|
|
||||
= link_to_unless @order.next == @order, _("Next order"), @order.next
|
||||
= link_to_unless @order.next == @order, "#{@order.next.supplier.name} >>", @order.next
|
||||
|
||||
// Order summary
|
||||
.left_column{:style => "width:65em"}
|
||||
|
|
@ -33,18 +33,21 @@
|
|||
= "[#{@order.group_orders.find(:all, :include => :ordergroup).collect{|g| g.ordergroup.name}.join(', ')}]"
|
||||
|
||||
%p
|
||||
Bruttosummer aller Artikel
|
||||
%b= number_to_currency(@order.sum(:gross))
|
||||
- if @order.finished?
|
||||
|
|
||||
Bestellte Artikel:
|
||||
%b= @order.order_articles.ordered.count
|
||||
Netto/Bruttosumme aller Artikel
|
||||
%b= "#{number_to_currency(@order.sum(:net))} / #{number_to_currency(@order.sum(:gross))}"
|
||||
%p
|
||||
Bestellte Artikel:
|
||||
%b= @order.order_articles.ordered.count
|
||||
|
||||
- if @order.open?
|
||||
%p
|
||||
= link_to icon(:edit), edit_order_path(@order)
|
||||
= link_to icon(:delete), @order, :confirm => "Willst du wirklich die Bestellung löschen?", :method => :delete
|
||||
= link_to '[beenden]', finish_order_path(@order), :method => :post
|
||||
|
||||
%p
|
||||
Aktionen:
|
||||
- if @order.open?
|
||||
= link_to "Bearbeiten", edit_order_path(@order)
|
||||
= link_to 'Beenden!', finish_order_path(@order), :method => :post, :confirm => "Willst Du wirklich die Bestellung beenden?\nEs gibt kein zurück.."
|
||||
- unless @order.closed?
|
||||
= link_to "Löschen", @order, :confirm => "Willst du wirklich die Bestellung löschen?", :method => :delete
|
||||
|
||||
|
||||
- unless @order.open?
|
||||
%p
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue