Complete refactoring of orders-workflow.

OrderResult tables are removed. Data consistency is now possible through new article.price-history (ArticlePrice).
Balancing-workflow needs to be updated.
This commit is contained in:
Benjamin Meichsner 2009-01-29 01:57:51 +01:00
parent 80287aeea4
commit 9eb2125f15
98 changed files with 1121 additions and 1717 deletions

View file

@ -3,8 +3,8 @@
%td= @article.order_number
%td= @article.units_to_order
%td= @article.unit_quantity.to_s + ' * ' + @article.unit.to_s
%td= number_to_currency(@article.net_price)
%td= number_to_currency(@article.gross_price)
%td= number_to_currency(@article.price)
%td= number_to_currency(@article.fc_price)
%td= @article.tax
%td= @article.deposit
%td

View file

@ -19,7 +19,7 @@
%td= @form.text_field 'units_to_order', :size => 5
%td= @form.text_field 'unit_quantity', :size => 3
%td= @form.text_field 'unit', :size => 5
%td= @form.text_field 'net_price', :size => 3
%td= @form.text_field 'price', :size => 3
%td= @form.text_field 'tax', :size => 3
%td= @form.text_field 'deposit', :size => 3
= @form.hidden_field "order_id"

View file

@ -6,12 +6,12 @@
%table{:style=> "margin-bottom:1em; width:40em;"}[article]
%thead
%tr
%th{:colspan => "3"}= article.name + " (" + article.unit + " | " + article.unit_quantity.to_s + " | " + article.gross_price.to_s + ")"
%th{:colspan => "3"}= article.name + " (" + article.unit + " | " + article.unit_quantity.to_s + " | " + article.fc_price.to_s + ")"
%tbody
- for result in article.group_order_article_results
%tr{ :class => cycle('even', 'odd', :name => 'group')}
%td{:style=>"width:70%"}= result.group_order_result.group_name
%td= result.quantity
%td= article.gross_price * result.quantity
%td= article.fc_price * result.quantity
- reset_cycle("group")

View file

@ -1,7 +1,7 @@
%td
%td{:style=>"width:50%"}= @result.group_order_result.group_name
%td{:id => "group_order_article_result_#{@result.id}_quantity"}= @result.quantity
%td{:class => "currency"}= number_to_currency(@result.order_article_result.gross_price * @result.quantity)
%td{:class => "currency"}= number_to_currency(@result.order_article_result.fc_price * @result.quantity)
%td{:style=>"width:1em", :class => "actions"}
= link_to_remote image_tag('b_edit.png', :size => "16x16", :border => 0, :alt => 'Menge ändern'), |
:url => {:action => 'updateGroupResult', :id => @result}, |

View file

@ -11,7 +11,7 @@
%tbody
- total = 0
- for result in groupOrderResult.group_order_article_results
- price = result.order_article_result.gross_price
- price = result.order_article_result.fc_price
- quantity = result.quantity
- subTotal = price * quantity
- total += subTotal

View file

@ -18,7 +18,7 @@
%tr
%td
%abbr{:title => "gelieferten Artikel x Nettopreis"} Nettobetrag:
%td= number_to_currency(@order.sumPrice("clear"))
%td= number_to_currency(@order.sum(:clear))
%td
Rechnungsbetrag
%small (incl. Pfand/Gutschriften)
@ -26,7 +26,7 @@
%tr
%td
%abbr{:title => "Nettobetrag mit Pfand und MwSt."} Bruttobetrag:
%td= number_to_currency(@order.sumPrice("gross"))
%td= number_to_currency(@order.sum(:gross))
%td
%span - extra Pfand
%small (Kistenpfand etc.)
@ -34,7 +34,7 @@
%tr
%td
%abbr{:title => "Bruttobetrag mit Foodcoop Aufschlag"} FC Summe:
%td= number_to_currency(@order.sumPrice("fc"))
%td= number_to_currency(@order.sum(:fc))
%td{:style => "border-bottom: 1px solid grey"}
+ Pfandgutschriften
%td{:style => "border-bottom: 1px solid grey"}
@ -42,7 +42,7 @@
%tr
%td
%abbr{:title => "Zugeteilte Mengen x Bruttopreise (inkl. Aufschlag)"} Gruppenbeträge:
%td#groups_amount= number_to_currency(@order.sumPrice("groups"))
%td#groups_amount= number_to_currency(@order.sum(:groups))
%td
Summe
%small (Rechungsbetrag ohne Pfand)
@ -51,10 +51,10 @@
%td{:colspan => "4"}
%abbr{:title => "Gruppenbeträge ohne Aufschlag minus Rechnung ohne Pfand. |
Im Idealfall sollte hier 0.00 stehen."} Differenz ohne Aufschlag: |
%span#fcProfit= number_to_currency(@order.fcProfit(false))
%span#profit= number_to_currency(@order.profit(false))
%tr
%td{:colspan => "4"}
%b
%abbr{:title => "= Gruppenbeträge - Rechnung ohne Pfand"} Differenz mit Aufschlag
= "(#{number_to_percentage(APP_CONFIG[:price_markup])}):"
%span#fcProfit= number_to_currency(@order.fcProfit)
%span#profit= number_to_currency(@order.profit)

View file

@ -55,9 +55,9 @@
%tbody
- @orders.each do |order|
%tr{:class => cycle("even","odd", :name => "order")}
%td= order.name
%td= order.supplier.name
%td= format_date(order.ends)
%td{:class => "currency"}= number_to_currency(order.sumPrice("fc"))
%td{:class => "currency"}= number_to_currency(order.sum(:fc))
%td= link_to "abrechnen", :action => "editOrder", :id => order
- else
Super, alles schon abgerechnet...

View file

@ -23,13 +23,13 @@
%tbody
- @orders.each do |order|
%tr{:class => cycle("even","odd", :name => "order")}
%td= link_to truncate(order.name), :action => "new", :id => order
%td= link_to truncate(order.supplier.name), :action => "new", :id => order
%td=h order.supplier ? order.supplier.name : _('nonexistent')
%td=h format_time(order.ends) unless order.ends.nil?
%td= order.booked ? "abgerechnet (#{number_to_currency order.fcProfit})" : "beendet"
%td= order.closed? ? "abgerechnet (#{number_to_currency order.profit})" : "beendet"
%td= order.updated_by.nil? ? '??' : order.updated_by.nick
%td
- unless order.booked
- unless order.closed?
= link_to "abrechnen", :action => "new", :id => order
|
= link_to 'auf "gebucht" setzen', {:action => 'setAllBooked', :id => order}, :confirm => 'Wirklich alle Gruppenbestellungen für diese Bestellung auf "gebucht" setzen?', :method => "post"

View file

@ -1,12 +1,12 @@
%h1 Bestellung abrechnen
- if @order.booked
- if @order.closed?
%p
%b Achtung, Bestellung wurde schon abgerechnet!
.left_column{:style => 'width: 50em'}
.box_title
%h2
= @order.name + " | " + format_date(@order.starts) + ' --> ' + format_date(@order.ends)
= @order.supplier.name + " | " + format_date(@order.starts) + ' --> ' + format_date(@order.ends)
.column_content#summary
#order_summary
= render :partial => "summary"
@ -15,7 +15,7 @@
%h2 Aktionen
.column_content
%ul
- unless @order.booked
- unless @order.closed?
%li= link_to "Bestellung abschließen", :action => "confirm", :id => @order
.right_column{:style => 'clear:both;width: 28%'}