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:
parent
80287aeea4
commit
9eb2125f15
98 changed files with 1121 additions and 1717 deletions
|
|
@ -10,8 +10,8 @@
|
|||
<td><%= @article.unit_quantity -%></td>
|
||||
<td class="currency">
|
||||
<acronym title="zuletzt geändert: <%= format_date(@article.updated_at) -%>
|
||||
| Brutto: <%= number_to_currency(@article.gross_price) -%>">
|
||||
<%= number_to_currency(@article.net_price) -%>
|
||||
| Brutto: <%= number_to_currency(@article.fc_price) -%>">
|
||||
<%= number_to_currency(@article.price) -%>
|
||||
</acronym>
|
||||
</td>
|
||||
<td><%= number_to_percentage(@article.tax) if @article.tax != 0 -%></td>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
%th Pfand
|
||||
%tbody
|
||||
%tr
|
||||
%td= form.text_field :net_price, :size => 5
|
||||
%td= form.text_field :price, :size => 5
|
||||
%td= form.text_field :unit_quantity, :size => 5
|
||||
%td= form.text_field :order_number, :size => 10
|
||||
%td= form.text_field :tax, :size => 5
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<%= form.text_field 'name', :size => 0 -%>
|
||||
</td>
|
||||
<td><%= form.text_field 'unit', :size => 5 -%></td>
|
||||
<td><%= form.text_field 'net_price', :size => 4 -%></td>
|
||||
<td><%= form.text_field 'price', :size => 4 -%></td>
|
||||
<td><%= form.text_field 'unit_quantity', :size => 4 -%></td>
|
||||
<td><%= form.text_field 'order_number', :size => 6 -%></td>
|
||||
<td><%= form.text_field 'note', :size => 15 -%></td>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
%td= form.text_field 'manufacturer', :size => 6
|
||||
%td= form.text_field 'origin', :size => 6
|
||||
%td= form.text_field 'unit', :size => 5
|
||||
%td= form.text_field 'net_price', :size => 4
|
||||
%td= form.text_field 'price', :size => 4
|
||||
%td= form.text_field 'tax', :size => 4
|
||||
%td= form.text_field 'deposit', :size => 4
|
||||
%td= form.text_field 'unit_quantity', :size => 4
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
%td= article.origin
|
||||
%td= article.unit
|
||||
%td= article.unit_quantity
|
||||
%td= article.net_price
|
||||
%td= article.price
|
||||
%td= article.tax
|
||||
%td= article.deposit
|
||||
%td= article.article_category.name if article.article_category
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
%td{:style => highlight_new(unequal_attributes, :origin)}= form.text_field 'origin', :size => 5
|
||||
%td{:style => highlight_new(unequal_attributes, :unit)}= form.text_field 'unit', :size => 5
|
||||
%td{:style => highlight_new(unequal_attributes, :unit_quantity)}= form.text_field 'unit_quantity', :size => 5
|
||||
%td{:style => highlight_new(unequal_attributes, :net_price)}= form.text_field 'net_price', :size => 5
|
||||
%td{:style => highlight_new(unequal_attributes, :price)}= form.text_field 'price', :size => 5
|
||||
%td{:style => highlight_new(unequal_attributes, :tax)}= form.text_field 'tax', :size => 4
|
||||
%td{:style => highlight_new(unequal_attributes, :deposit)}= form.text_field 'deposit', :size => 4
|
||||
%td= select 'article[]', 'article_category_id', ArticleCategory.find(:all).collect {|a| [ a.name, a.id ] }, { :include_blank => true }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
||||
|
|
@ -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}, |
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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...
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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%'}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
= _("There are") + " #{@unassigned_tasks_number} " + link_to(_("unassigned task(s)"), :controller => "tasks")
|
||||
%p{:style => "clear:both"}= link_to _("My tasks"), :controller => "tasks", :action => "myTasks"
|
||||
|
||||
- if @orderGroup
|
||||
- if @ordergroup
|
||||
// Current orders
|
||||
= render :partial => 'ordering/currentOrders'
|
||||
|
||||
|
|
@ -42,13 +42,13 @@
|
|||
%h2=_ "My ordergroup"
|
||||
.column_content
|
||||
%p
|
||||
%b= @orderGroup.name
|
||||
%b= @ordergroup.name
|
||||
|
|
||||
=_ "Account balance:"
|
||||
= number_to_currency(@orderGroup.account_balance)
|
||||
= number_to_currency(@ordergroup.account_balance)
|
||||
%span{:style => "color:grey"}
|
||||
(zuletzt aktualisiert vor
|
||||
= distance_of_time_in_words(Time.now, @orderGroup.account_updated) + ")"
|
||||
= distance_of_time_in_words(Time.now, @ordergroup.account_updated) + ")"
|
||||
%h3=_ "Last transactions"
|
||||
%table
|
||||
%tr
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
Liebe <%= group.name %>,
|
||||
|
||||
die Bestellung "<%= order.name %>" wurde am <%= order.ends.strftime('%d.%m.%Y um %H:%M') %> von <%= order.updated_by.nick %> beendet.
|
||||
die Bestellung für "<%= order.supplier.name %>" wurde am <%= order.ends.strftime('%d.%m.%Y um %H:%M') %> von <%= order.updated_by.nick %> beendet.
|
||||
|
||||
Für Euch wurden die folgenden Artikel bestellt:
|
||||
<% for result in results
|
||||
article = result.order_article_result -%>
|
||||
<%= article.name %>: <%= result.quantity %> x <%= article.unit %> = <%= result.quantity * article.gross_price %>
|
||||
<% for group_order_article in group_order.group_order_articles.all(:include => :order_article)
|
||||
article = group_order_article.order_article.article -%>
|
||||
<%= article.name %>: <%= group_order_article.quantity %> x <%= article.unit %> = <%= group_order_article.quantity * article.fc_price %>
|
||||
<% end -%>
|
||||
Gesamtpreis: <%= total %>
|
||||
Gesamtpreis: <%= group_order.price %>
|
||||
|
||||
Bestellung online einsehen: <%= ApplicationController.current.url_for(:controller => 'ordering', :action => 'my_order_result', :id => order.id) %>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
- if controller.action_name == 'myOrders'
|
||||
= pagination_links_remote @bookedOrders, :per_page => 10, :params => {:show_all => params[:show_all]}
|
||||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
%th=_ 'Name'
|
||||
%th=_ 'Supplier'
|
||||
%th=_ 'End'
|
||||
%th=_ 'Sum'
|
||||
%tbody
|
||||
- @bookedOrders.each do |order|
|
||||
- if order.is_a?(GroupOrder) || order.is_a?(GroupOrderResult)
|
||||
%tr{:class=> cycle('even', 'odd', :name => 'bookedOrders')}
|
||||
%td= link_to order.order.name, :action => 'my_order_result', :id => order.order
|
||||
%td=h order.order.supplier ? order.order.supplier.name : _("nonexistent")
|
||||
%td= format_time(order.order.ends)
|
||||
%td{:class => "currency"}= number_to_currency(order.price)
|
||||
- else
|
||||
// check if the Ordergroup has ordered
|
||||
- if groupOrder = order.group_order(@orderGroup)
|
||||
%tr{:class=> cycle('even', 'odd', :name => 'bookedOrders')}
|
||||
%td= link_to order.name, :action => 'my_order_result', :id => order
|
||||
%td=h order.supplier ? order.supplier.name : _("nonexistent")
|
||||
%td= format_time(order.ends)
|
||||
%td{:class => "currency"}= number_to_currency(groupOrder.price)
|
||||
- else
|
||||
%tr{:class=> cycle('even', 'odd', :name => 'bookedOrders'), :style => "color:grey"}
|
||||
%td= link_to truncate(order.name), {:action => "my_order_result", :id => order}, :style => "color:grey"
|
||||
%td= order.supplier ? order.supplier.name : _("nonexistent")
|
||||
%td= format_time(order.ends)
|
||||
%td{:class => "currency"} --
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
.box_title
|
||||
%h2=_ "Running orders"
|
||||
.column_content
|
||||
- unless @currentOrders.empty?
|
||||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
%th=_ "Name"
|
||||
%th=_ "Supplier"
|
||||
%th=_ "End"
|
||||
%th=_ "Who ordered?"
|
||||
%th=_ "Sum"
|
||||
%tbody
|
||||
- total = 0
|
||||
- @currentOrders.each do |order|
|
||||
%tr{:class => cycle('even', 'odd', :name => 'current_orders')}
|
||||
%td= link_to order.name, :controller => 'ordering', :action => 'order', :id => order
|
||||
%td=h order.supplier.name
|
||||
%td=h format_time(order.ends) unless order.ends.nil?
|
||||
- if (groupOrder = order.group_orders.find(:first, :conditions => ["ordergroup_id = ?", @orderGroup.id]))
|
||||
- total += groupOrder.price
|
||||
%td=h groupOrder.updated_by.nil? ? '??' : "#{groupOrder.updated_by.nick} (#{format_time(groupOrder.updated_on)})"
|
||||
%td= number_to_currency(groupOrder.price)
|
||||
- else
|
||||
%td
|
||||
%td
|
||||
- if total > 0
|
||||
%p
|
||||
=_ "Total sum"
|
||||
%b= number_to_currency(total)
|
||||
- else
|
||||
%i=_ "There aren't current orders at the moment."
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
%th=_ 'Name'
|
||||
%th=_ 'Supplier'
|
||||
%th=_ 'End'
|
||||
%th=_ 'Sum'
|
||||
%tbody
|
||||
- @finishedOrders.each do |order|
|
||||
- if order.is_a?(GroupOrder) or order.is_a?(GroupOrderResult)
|
||||
%tr{:class=> cycle('even', 'odd', :name => 'bookedOrders')}
|
||||
%td= link_to order.order.name, :action => 'my_order_result', :id => order.order
|
||||
%td=h order.order.supplier ? order.order.supplier.name : _("nonexistent")
|
||||
%td= format_time(order.order.ends)
|
||||
%td{:class => "currency"}= number_to_currency(order.price)
|
||||
- else
|
||||
// check if the Ordergroup has ordered
|
||||
- if groupOrder = order.group_order(@orderGroup)
|
||||
%tr{:class=> cycle('even', 'odd', :name => 'finishedOrders')}
|
||||
%td= link_to order.name, :action => 'my_order_result', :id => order
|
||||
%td=h order.supplier ? order.supplier.name : _("nonexistent")
|
||||
%td= format_time(order.ends)
|
||||
%td{:class => "currency"}= number_to_currency(groupOrder.price)
|
||||
- else
|
||||
%tr{:class=> cycle('even', 'odd', :name => 'finishedOrders'), :style => "color:grey"}
|
||||
%td= link_to truncate(order.name), {:action => "my_order_result", :id => order}, :style => "color:grey"
|
||||
%td= order.supplier ? order.supplier.name : _("nonexistent")
|
||||
%td= format_time(order.ends)
|
||||
%td{:class => "currency"} --
|
||||
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
%th{:style => "width:40%"}=_ "Name"
|
||||
%th=_ "Unit quantity"
|
||||
%th=_ "Unit price"
|
||||
%th=_ "Received"
|
||||
%th=_ "Total price"
|
||||
%tbody
|
||||
- for article in @groupOrderResult.group_order_article_results
|
||||
- price = article.order_article_result.gross_price
|
||||
- quantity = article.quantity
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles')}
|
||||
%td{:style=>"width:40%"}
|
||||
=h article.order_article_result.name
|
||||
- unless article.order_article_result.note.nil?
|
||||
= image_tag "lamp_grey.png", {:alt => "Notiz anzeigen", :size => "15x16", :border => "0", :onmouseover => "$('note_#{article.id}').show();", :onmouseout => "$('note_#{article.id}').hide();" }
|
||||
%td
|
||||
= article.order_article_result.unit_quantity
|
||||
x
|
||||
= article.order_article_result.unit
|
||||
%td= number_to_currency(price)
|
||||
%td= quantity
|
||||
%td= number_to_currency(quantity * price)
|
||||
|
||||
- unless article.order_article_result.note.nil?
|
||||
%tr{:id => "note_#{article.id}", :style => "display:none"}
|
||||
%td{:colspan => "5"}
|
||||
Notiz:
|
||||
=h article.order_article_result.note
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles')}
|
||||
%th{:colspan => "4"}=_ "Sum"
|
||||
%th= number_to_currency(@groupOrderResult.price)
|
||||
30
app/views/ordering/_open_orders.html.haml
Normal file
30
app/views/ordering/_open_orders.html.haml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
.box_title
|
||||
%h2 Laufende Bestellungen
|
||||
.column_content
|
||||
- unless Order.open.empty?
|
||||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
%th Lieferant
|
||||
%th Ende
|
||||
%th Wer hat bestellt?
|
||||
%th Summe
|
||||
%tbody
|
||||
- total = 0
|
||||
- Order.open.each do |order|
|
||||
%tr{:class => cycle('even', 'odd', :name => 'open_orders')}
|
||||
%td= link_to h(order.supplier.name), :controller => 'ordering', :action => 'order', :id => order
|
||||
%td=h format_time(order.ends) unless order.ends.nil?
|
||||
- if group_order = order.group_order(@ordergroup)
|
||||
- total += group_order.price
|
||||
%td=h "#{group_order.updated_by.nick} (#{format_time(group_order.updated_on)})"
|
||||
%td= number_to_currency(group_order.price)
|
||||
- else
|
||||
%td
|
||||
%td
|
||||
- if total > 0
|
||||
%p
|
||||
Gesamtsumme:
|
||||
%b= number_to_currency(total)
|
||||
- else
|
||||
%i Derzeit gibt es keine laufenden Bestellungen
|
||||
17
app/views/ordering/_orders.html.haml
Normal file
17
app/views/ordering/_orders.html.haml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
- if controller.action_name == 'myOrders'
|
||||
= pagination_links_remote @closed_orders, :per_page => 10, :update => 'closed_orders'
|
||||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
%th Lieferant
|
||||
%th Ende
|
||||
%th Summe
|
||||
%tbody
|
||||
- for order in orders
|
||||
- group_order = order.group_order(@ordergroup) # Get GroupOrder if possible
|
||||
- order_class = group_order ? "" : "color:grey"
|
||||
%tr{:class=> cycle('even', 'odd', :name => 'orders'), :style => order_class}
|
||||
%td= link_to order.supplier.name, :action => 'my_order_result', :id => order
|
||||
%td= format_time(order.ends)
|
||||
%td{:class => "currency"}= group_order ? number_to_currency(group_order.price) : "--"
|
||||
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
%th{:style => "width:40%"} Name
|
||||
%th Gebinde
|
||||
%th Einzelpreis
|
||||
%th
|
||||
%abbr{:title => "Menge + Toleranz"} Bestellt
|
||||
%th
|
||||
%abbr{:title => "Unter Berücksichtigung der anderen Gruppen"} Zugeteilt
|
||||
%th Gesamtpreis
|
||||
%tbody
|
||||
- total = 0 #set counter for order-sum
|
||||
- for category, order_articles in @order.get_articles
|
||||
%tr{:style => "background-color:#EFEFEF"}
|
||||
%td{:style => "text-align:left;"}=h category
|
||||
%td{:colspan => "9"}
|
||||
- for order_article in order_articles
|
||||
- article = order_article.article
|
||||
- # get the order-results for the ordergroup
|
||||
- group_order_article = GroupOrderArticle.find_by_group_order_id_and_order_article_id @group_order.id, order_article.id
|
||||
- if group_order_article
|
||||
- quantity = group_order_article.quantity
|
||||
- tolerance = group_order_article.tolerance
|
||||
- result = group_order_article.orderResult[:quantity] + group_order_article.orderResult[:tolerance]
|
||||
- sub_total = article.gross_price * (quantity + tolerance)
|
||||
- else
|
||||
- quantity, tolerance, result, sub_total = 0, 0, 0, 0
|
||||
- total += sub_total
|
||||
- # give the article different colors, dependent on order-result
|
||||
- style = "grey"
|
||||
- if (quantity > 0)
|
||||
- style = result > 0 ? 'green' : 'red'
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles'), :style => "color:#{style}"}
|
||||
%td{:style => "width:40%"}
|
||||
=h order_article.article.name
|
||||
- unless order_article.article.note.empty?
|
||||
= image_tag("lamp_grey.png", {:alt => "Notiz anzeigen", :size => "15x16", :border => "0", :onmouseover => "$('note_#{order_article.id}').show();", :onmouseout => "$('note_#{order_article.id}').hide();"})
|
||||
%td= "#{article.unit_quantity} x #{order_article.article.unit}"
|
||||
%td= number_to_currency(article.gross_price)
|
||||
%td
|
||||
= quantity
|
||||
= "+ #{tolerance}" if article.unit_quantity > 1
|
||||
%td= result > 0 ? result : "0"
|
||||
%td= number_to_currency(sub_total)
|
||||
- unless order_article.article.note.empty?
|
||||
%tr{:id => "note_#{order_article.id}", :class => "note even", :style => "display:none"}
|
||||
%td{:colspan => "6"}=h order_article.article.note
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles')}
|
||||
%th{:colspan => "5"} Summe
|
||||
%th= number_to_currency(total)
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,45 +1,44 @@
|
|||
%h1= _('Order Overview')
|
||||
- title "Bestellüberblick"
|
||||
|
||||
// Ordergroups Account Balance
|
||||
.left_column{:style => "width:26%"}
|
||||
.box_title
|
||||
%h2=h @orderGroup.name
|
||||
%h2=h @ordergroup.name
|
||||
.column_content
|
||||
%table
|
||||
%tr
|
||||
%td= _('Account balance')
|
||||
%td{:class => "currency", :style => "width:5em"}= number_to_currency(@orderGroup.account_balance)
|
||||
%td Kontostand:
|
||||
%td{:class => "currency", :style => "width:5em"}= number_to_currency(@ordergroup.account_balance)
|
||||
%tr
|
||||
%td= "- " + _('Current orders')
|
||||
%td{:class => "currency"}= number_to_currency(@currentOrdersValue)
|
||||
%td - laufende Bestellungen:
|
||||
%td{:class => "currency"}= number_to_currency(@ordergroup.value_of_open_orders)
|
||||
%tr
|
||||
%td= "- " +_('Unrecorded orders')
|
||||
%td{:class => "currency"}= number_to_currency(@nonbookedOrdersValue)
|
||||
%td - nicht abgerechnete Bestellungen:
|
||||
%td{:class => "currency"}= number_to_currency(@ordergroup.value_of_finished_orders)
|
||||
%tr
|
||||
%th= _('Available')
|
||||
%th{:class => "currency"}= number_to_currency(@orderGroup.account_balance - @currentOrdersValue - @nonbookedOrdersValue)
|
||||
%th verfügbares Guthaben:
|
||||
%th{:class => "currency"}= number_to_currency(@ordergroup.get_available_funds)
|
||||
|
||||
.right_column{:style => "width:70%"}
|
||||
// Current Orders
|
||||
- if @orderGroup
|
||||
= render :partial => "currentOrders"
|
||||
// open orders
|
||||
= render :partial => "open_orders"
|
||||
|
||||
// finished, nonbooked Orders
|
||||
- unless @finishedOrders.empty?
|
||||
// finished orders
|
||||
- unless Order.finished.empty?
|
||||
.box_title
|
||||
%h2= _('unrecorded orders')
|
||||
%h2 Nicht abgerechnete Bestellungen
|
||||
.column_content
|
||||
= render :partial => "finishedOrders"
|
||||
- if @nonbookedOrdersValue > 0
|
||||
= render :partial => "orders", :locals => {:orders => Order.finished}
|
||||
- if @ordergroup.value_of_finished_orders > 0
|
||||
%p
|
||||
= _('total order value')
|
||||
%b= number_to_currency(@nonbookedOrdersValue)
|
||||
Gesamtsumme:
|
||||
%b= number_to_currency(@ordergroup.value_of_finished_orders)
|
||||
|
||||
// bookedOrders
|
||||
- unless @bookedOrders.empty?
|
||||
// closed orders
|
||||
- unless Order.closed.empty?
|
||||
.box_title
|
||||
%h2= _('balanced orders')
|
||||
%h2 Abgerechnete Bestellungen
|
||||
.column_content
|
||||
= render :partial => "bookedOrders"
|
||||
= render :partial => "orders", :locals => {:orders => Order.closed.all(:limit => 5)}
|
||||
%br/
|
||||
= link_to _('more...'), :action => "myOrders"
|
||||
= link_to "mehr...", :action => "myOrders"
|
||||
|
|
@ -1,27 +1,17 @@
|
|||
%h1
|
||||
=_ "Orders of"
|
||||
= @orderGroup.name
|
||||
- title "Bestellungen der #{@ordergroup.name}"
|
||||
%p
|
||||
%i
|
||||
=_ "See current orders in"
|
||||
= link_to _("Overview"), :action => "index"
|
||||
%p
|
||||
%i{:style => "float:left"}=_ "Also show orders, your ordergroup haven't participated:"
|
||||
- form_tag({:action => "myOrders"}, :method => "get") do
|
||||
-unless @show_all
|
||||
%input{:type => "checkbox", :name => :show_all, :value => "1", :onclick => "submit();"}
|
||||
-else
|
||||
%input{:type => "checkbox", :name => :show_all, :value => "0", :checked => "checked", :onclick => "submit();"}
|
||||
|
||||
Siehe hier alle
|
||||
= link_to "laufenden Bestellungen.", :action => "index"
|
||||
|
||||
.single_column{:style => "width:50em"}
|
||||
.box_title
|
||||
%h2=_ "finished/not balanced"
|
||||
%h2 beendet/nicht abgerechnet
|
||||
.column_content
|
||||
= render :partial => "finishedOrders"
|
||||
= render :partial => "orders", :locals => {:orders => Order.finished}
|
||||
|
||||
.single_column{:style => "width:50em"}
|
||||
.box_title
|
||||
%h2=_ "balanced"
|
||||
%h2 abgerechnet
|
||||
.column_content
|
||||
#bookedOrders
|
||||
= render :partial => "bookedOrders"
|
||||
#closed_orders
|
||||
= render :partial => "orders", :locals => {:orders => @closed_orders}
|
||||
|
|
|
|||
|
|
@ -1,86 +1,126 @@
|
|||
%h1= _("Your result for") + " #{@order.name}"
|
||||
- title "Dein Bestellergebnis für #{@order.supplier.name}"
|
||||
#element_navigation
|
||||
= link_to_unless @order.previous == @order, _("Previous order"), :action => "my_order_result", :id => @order.previous
|
||||
= link_to_unless @order.previous == @order, "<< #{@order.previous.supplier.name}", :action => "my_order_result", :id => @order.previous
|
||||
|
|
||||
= link_to _("Overview"), :controller => 'ordering'
|
||||
|
|
||||
= link_to_unless @order.next == @order, _("Next order"), :action => "my_order_result", :id => @order.next
|
||||
= link_to_unless @order.next == @order, "#{@order.next.supplier.name} >>", :action => "my_order_result", :id => @order.next
|
||||
|
||||
// Order summary
|
||||
.left_column{:style => "width:45em"}
|
||||
.box_title
|
||||
%h2=_ "Summary"
|
||||
%h2 Zusammenfassung
|
||||
.column_content
|
||||
%table
|
||||
%tr{:valign => "top"}
|
||||
%td{:style => "width:50%"}
|
||||
%p
|
||||
= _("Name") + ":"
|
||||
%b=h @order.name
|
||||
|
|
||||
= _("Supplier") + ":"
|
||||
%b=h @order.supplier ? @order.supplier.name : _("nonexistent")
|
||||
Lieferant:
|
||||
%b=h @order.supplier.name
|
||||
- unless @order.note.empty?
|
||||
%p
|
||||
= _("Note") + ":"
|
||||
Notiz:
|
||||
=h @order.note
|
||||
%p
|
||||
= _("End") + ":"
|
||||
Ende:
|
||||
%b=h format_time(@order.ends)
|
||||
%p
|
||||
= _("Order value") + ":"
|
||||
- if @order_value
|
||||
%b=h number_to_currency(@order_value)
|
||||
Bestellsumme:
|
||||
- if @group_order
|
||||
%b=h number_to_currency(@group_order.price)
|
||||
- else
|
||||
%b --
|
||||
%b Du hast nicht bestellt.
|
||||
%p
|
||||
- if @finished
|
||||
= @order.booked ? _("Cleared by") + " #{@order.updated_by.nick}" : "<b>" + _("Order isn't balanced yet") + "</b>"
|
||||
= link_to _("read/add comments"), "#comments"
|
||||
= "Abgerechnet von #{@order.updated_by.nick}" if @order.finished?
|
||||
= "<b>Bestellung</b>" if @order.closed?
|
||||
= link_to "Kommentare lesen/schreiben", "#comments"
|
||||
|
||||
// directly switch to active orders
|
||||
.right_column{:style => "width:23em;"}
|
||||
.box_title
|
||||
%h2= _("Running orders")
|
||||
%h2 Laufende Bestellungen
|
||||
.column_content
|
||||
%table
|
||||
- @current_orders.each do |order|
|
||||
- for order in Order.open
|
||||
%tr
|
||||
%td= link_to order.name, :action => 'order', :id => order
|
||||
%td= "("+ time_ago_in_words(order.ends) + ")" if @order.ends
|
||||
%td= link_to order.supplier.name, :action => 'order', :id => order
|
||||
%td= "("+ time_ago_in_words(order.ends) + ")" if order.ends
|
||||
|
||||
// Article box
|
||||
// Article box
|
||||
.single_column{:style => "clear:both; width:70em;"}
|
||||
.box_title
|
||||
%h2=_ "Overview of articles"
|
||||
%h2 Artikelübersicht
|
||||
.column_content#result
|
||||
- if @finished
|
||||
// order is finished, show results ...
|
||||
- unless @groupOrderResult.nil?
|
||||
= render :partial => "finished_order_result"
|
||||
- else
|
||||
=_ "You haven't ordered"
|
||||
- if @group_order
|
||||
%p= link_to("Bestellung ändern", :action => "order", :id => @order) if @order.open?
|
||||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
%th{:style => "width:40%"} Name
|
||||
%th Gebinde
|
||||
%th Einzelpreis
|
||||
%th
|
||||
%abbr{:title => "Menge + Toleranz"} Bestellt
|
||||
%th
|
||||
%abbr{:title => "Unter Berücksichtigung der anderen Gruppen"} Zugeteilt
|
||||
%th Gesamtpreis
|
||||
%tbody
|
||||
- total = 0 #set counter for order-sum
|
||||
- for category_name, order_articles in @order.get_articles
|
||||
%tr{:style => "background-color:#EFEFEF"}
|
||||
%td{:style => "text-align:left;"}=h category_name
|
||||
%td{:colspan => "9"}
|
||||
- for oa in order_articles
|
||||
- # get the order-results for the ordergroup
|
||||
- goa = oa.group_order_articles.first :conditions => {:group_order_id => @group_order.id}
|
||||
- if goa
|
||||
- quantity = goa.quantity
|
||||
- tolerance = goa.tolerance
|
||||
- result = goa.orderResult[:quantity] + goa.orderResult[:tolerance]
|
||||
- sub_total = oa.price.fc_price * (quantity + tolerance)
|
||||
- else
|
||||
- quantity, tolerance, result, sub_total = 0, 0, 0, 0
|
||||
- total += sub_total
|
||||
- # give the article different colors, dependent on order-result
|
||||
- style = "grey"
|
||||
- if (quantity > 0)
|
||||
- style = result > 0 ? 'green' : 'red'
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles'), :style => "color:#{style}"}
|
||||
%td{:style => "width:40%"}
|
||||
=h oa.article.name
|
||||
- unless oa.article.note.empty?
|
||||
= image_tag("lamp_grey.png", {:alt => "Notiz anzeigen", :size => "15x16", :border => "0", :onmouseover => "$('note_#{oa.id}').show();", :onmouseout => "$('note_#{oa.id}').hide();"})
|
||||
%td= "#{oa.price.unit_quantity} x #{oa.article.unit}"
|
||||
%td= number_to_currency(oa.price.fc_price)
|
||||
%td
|
||||
= quantity
|
||||
= "+ #{tolerance}" if oa.price.unit_quantity > 1
|
||||
%td= result > 0 ? result : "0"
|
||||
%td= number_to_currency(sub_total)
|
||||
- unless oa.article.note.empty?
|
||||
%tr{:id => "note_#{oa.id}", :class => "note even", :style => "display:none"}
|
||||
%td{:colspan => "6"}=h oa.article.note
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles')}
|
||||
%th{:colspan => "5"} Summe
|
||||
%th= number_to_currency(total)
|
||||
%br/
|
||||
= link_to_top
|
||||
- else
|
||||
// order isn't finished yet, show ordered articles
|
||||
- if @group_order
|
||||
%p= link_to("Bestellung ändern", :action => "order", :id => @order) if @order.current?
|
||||
= render :partial => 'unfinished_order_result'
|
||||
%br/
|
||||
= link_to_top
|
||||
- else
|
||||
= _("You haven't ordered yet.")
|
||||
= link_to _("Order now"), :action => "order", :id => @order
|
||||
Du hast noch nicht bestellt.
|
||||
= link_to "Das ist Deine Chance!", :action => "order", :id => @order
|
||||
|
||||
// Comments box
|
||||
- if @finished
|
||||
.single_column{:style => "width:70em;"}
|
||||
.box_title
|
||||
%h2=_ "Comments"
|
||||
.column_content#comments
|
||||
= render :partial => 'shared/comments'
|
||||
.single_column{:style => "width:70em;"}
|
||||
.box_title
|
||||
%h2=_ "Comments"
|
||||
.column_content#comments
|
||||
= render :partial => 'shared/comments', :locals => { :comments => @order.comments }
|
||||
%p
|
||||
- form_for :comment, :url => { :action => :add_comment, :id => @order } do |form|
|
||||
%p
|
||||
= link_to_remote _("New comment"), :url => {:action => 'newComment', :id => @order}, |
|
||||
:before => "Element.show('loader')", |
|
||||
:success => "Element.hide('loader')" |
|
||||
#newComment
|
||||
= link_to_top
|
||||
%b Neuen Kommentar hinzufügen:
|
||||
%br/
|
||||
= form.text_area :text, :cols => 50, :rows => 6
|
||||
%br/
|
||||
= submit_tag "Kommentar hinzufügen"
|
||||
= link_to_top
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<h1>Bestellen</h1>
|
||||
|
||||
<div class="left_column" style="width:49em">
|
||||
<div class="box_title"><h2><%=h @order.name %></h2></div>
|
||||
<div class="box_title"><h2><%=h @order.supplier.name %></h2></div>
|
||||
<div class="column_content">
|
||||
<table>
|
||||
<tr valign="top">
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
<% end %>
|
||||
<p>
|
||||
<b><%=_ "Order quanitity so far" %>:</b>
|
||||
<%= number_to_currency @order.sumPrice %>
|
||||
<%= number_to_currency @order.sum %>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
<% for order in @other_orders -%>
|
||||
<tr>
|
||||
<td>
|
||||
<%= link_to_function order.name, "if (confirmSwitchOrder()) (window.location = '#{ url_for(:action => 'order', :id => order) }' )" %>
|
||||
<%= link_to_function order.supplier.name, "if (confirmSwitchOrder()) (window.location = '#{ url_for(:action => 'order', :id => order) }' )" %>
|
||||
</td>
|
||||
<td>noch <%= time_ago_in_words(order.ends) if order.ends -%></td>
|
||||
</tr>
|
||||
|
|
@ -125,7 +125,7 @@
|
|||
<%= button_to_function('-', "decreaseTolerance(#{i})") %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<td id="td_price_<%= i %>" style="text-align:right; padding-right:10px; width:4em"><span id="price_<%= i %>_display"><%= number_to_currency(article_total, :unit => "") %></span> <%= L18n.number.currency.format.unit %></td>
|
||||
<td id="td_price_<%= i %>" style="text-align:right; padding-right:10px; width:4em"><span id="price_<%= i %>_display"><%= number_to_currency(article_total, :unit => "") %></span> €</td>
|
||||
</tr>
|
||||
<% unless order_article.article.note.empty? -%>
|
||||
<tr id="note_<%= i %>" class="note" style="display:none">
|
||||
|
|
@ -139,7 +139,7 @@
|
|||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="6"></td>
|
||||
<td colspan="3" class="currency"><%=_ "Total amount" %>: <span id="total_price"><%= total %></span> <%= L18n.number.currency.format.unit %></td>
|
||||
<td colspan="3" class="currency"><%=_ "Total amount" %>: <span id="total_price"><%= total %></span> €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6"></td>
|
||||
|
|
@ -147,7 +147,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td colspan="6"></td>
|
||||
<td colspan="3" class="currency"><%=_ "New account balance"%>: <strong><span id="new_balance"><%= @ordergroup.account_balance - total %></span> <%= L18n.number.currency.format.unit %></strong></td>
|
||||
<td colspan="3" class="currency"><%=_ "New account balance"%>: <strong><span id="new_balance"><%= @ordergroup.account_balance - total %></span> €</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left;"><%= link_to_top %></td>
|
||||
|
|
@ -171,7 +171,7 @@
|
|||
setGroupBalance(<%= @availableFunds %>);
|
||||
|
||||
// localization
|
||||
setDecimalSeparator("<%= L18n.number.currency.format.separator %>");
|
||||
setDecimalSeparator(",");
|
||||
|
||||
// initialize javascript
|
||||
updateBalance();
|
||||
|
|
|
|||
31
app/views/orders/_articles.html.haml
Normal file
31
app/views/orders/_articles.html.haml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
%table
|
||||
%tr
|
||||
%th Name
|
||||
%th Gebinde
|
||||
%th Netto/FC-Preis
|
||||
%th Bestellte Einheiten
|
||||
%th Volle Gebinde
|
||||
- total_net, total_gross, counter = 0, 0, 0
|
||||
- order.get_articles.each do |category_name, order_articles|
|
||||
%tr{:style => "background-color:#EFEFEF"}
|
||||
%td{:style => "text-align:left; color: grey;"}=h category_name
|
||||
%td{:colspan => "9"}
|
||||
- order_articles.each do |order_article|
|
||||
- net_price = order_article.price.price
|
||||
- fc_price = order_article.price.fc_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
|
||||
%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= "#{order_article.quantity} + #{order_article.tolerance}" if unit_quantity > 1
|
||||
%td= units
|
||||
%p
|
||||
Summe (Netto/FC-Preise):
|
||||
= "#{number_to_currency(total_net)} / #{number_to_currency(total_gross)}"
|
||||
%p
|
||||
Bestellte Artikel.
|
||||
= order.order_articles.ordered.count
|
||||
23
app/views/orders/_articles_by_articles.html.haml
Normal file
23
app/views/orders/_articles_by_articles.html.haml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
.legend
|
||||
%table.legend{:style => "margin-bottom:1em"}
|
||||
%tr
|
||||
%th{:colspan => '3'} Legende
|
||||
%tr
|
||||
%th{:style => 'width:70%'} Bestellgruppe
|
||||
%th Menge
|
||||
%th Gesamtpreis
|
||||
|
||||
- for order_article in order.order_articles.all(:include => [:article, :article_price])
|
||||
%table{:style => "margin-bottom:1em"}
|
||||
%thead
|
||||
%tr
|
||||
%th{:colspan => "3"}
|
||||
= order_article.article.name
|
||||
= "(#{order_article.article.unit} | #{order_article.price.unit_quantity} | #{number_to_currency(order_article.price.fc_price)})"
|
||||
%tbody
|
||||
- for goa in order_article.group_order_articles
|
||||
%tr{:class => cycle('even', 'odd', :name => 'groups')}
|
||||
%td{:style => "width:70%"}=h goa.group_order.ordergroup.name
|
||||
%td= "#{goa.quantity} (#{goa.tolerance})"
|
||||
%td= number_to_currency(order_article.price.fc_price * goa.quantity)
|
||||
- reset_cycle('groups')
|
||||
36
app/views/orders/_articles_by_groups.html.haml
Normal file
36
app/views/orders/_articles_by_groups.html.haml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
.legend
|
||||
%table.legend{:style => "margin-bottom:1em"}
|
||||
%tr
|
||||
%th{:style => "width:40%"} Name
|
||||
%th
|
||||
%acronym{:title => "zugeteilte Einheiten (davon aus Toleranzmenge)"} Menge
|
||||
%th
|
||||
%acronym{:title => "Preis incl. MwSt, Pfand und Foodcoop-Aufschlag"} FC-Preis
|
||||
%th
|
||||
%acronym{:title => "Gebindegröße"} GebGr
|
||||
%th Einheit
|
||||
%th Gesamtpreis
|
||||
|
||||
- for group_order in order.group_orders.all
|
||||
%table{:style => "margin-bottom:1em"}
|
||||
%thead
|
||||
%tr
|
||||
%th{:colspan => "6"}=h group_order.ordergroup.name
|
||||
%tbody
|
||||
- total = 0
|
||||
- for goa in group_order.group_order_articles.all(:include => :order_article)
|
||||
- fc_price = goa.order_article.price.fc_price
|
||||
- subTotal = fc_price * goa.quantity
|
||||
- total += subTotal
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles')}
|
||||
%td{:style => "width:40%"}=h goa.order_article.article.name
|
||||
%td= "#{goa.quantity} (#{goa.tolerance})"
|
||||
%td= number_to_currency(fc_price)
|
||||
%td= goa.order_article.price.unit_quantity
|
||||
%td= goa.order_article.article.unit
|
||||
%td= number_to_currency(subTotal)
|
||||
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles')}
|
||||
%th{:colspan => "5"} Summe
|
||||
%th= number_to_currency(total)
|
||||
- reset_cycle("articles")
|
||||
|
|
@ -1,31 +1,28 @@
|
|||
= error_messages_for 'order'
|
||||
= form.error_messages
|
||||
|
||||
.single_column
|
||||
.box_title
|
||||
%h2=_ "Order"
|
||||
%h2 Bestellung
|
||||
.column_content
|
||||
= hidden_field 'order', 'supplier_id'
|
||||
= form.hidden_field :supplier_id
|
||||
%p
|
||||
=h _("Supplier") + ": #{@order.supplier.name}"
|
||||
Lieferant:
|
||||
= @order.supplier.name
|
||||
%p
|
||||
%label{:for => 'order_name'}=_ "Name"
|
||||
Notiz
|
||||
%br/
|
||||
= text_field 'order', 'name'
|
||||
= form.text_area :note, :cols => 50, :rows => 5
|
||||
%p
|
||||
%label{:for => 'order_note'}=_ "Note"
|
||||
Start
|
||||
%br/
|
||||
= text_area 'order', 'note', :cols => 50, :rows => 5
|
||||
= form.datetime_select :starts, :start_year => Time.now.year - 1
|
||||
%p
|
||||
%label{:for => 'order_starts'}=_ "Start"
|
||||
Ende
|
||||
%br/
|
||||
= datetime_select 'order', 'starts', :start_year => Time.now.year - 1
|
||||
%p
|
||||
%label{:for => 'order_ends'}=_ "End"
|
||||
%br/
|
||||
= datetime_select 'order', 'ends', :start_year => Time.now.year - 1, :include_blank => true
|
||||
= form.datetime_select :ends, :start_year => Time.now.year - 1, :include_blank => true
|
||||
|
||||
.box_title
|
||||
%h2=_ "Articles"
|
||||
%h2 Artikel
|
||||
.column_content
|
||||
- if (@template_orders && !@template_orders.empty?)
|
||||
%p
|
||||
|
|
@ -34,7 +31,7 @@
|
|||
%option{:value => "-1", :selected => "selected"}=_ "Choose an order..."
|
||||
- i = -1
|
||||
- for order in @template_orders
|
||||
%option{:value => (i += 1)}=h order.name
|
||||
%option{:value => (i += 1)}=h order.supplier.name
|
||||
%table.list
|
||||
%tr
|
||||
%th= check_box_tag 'checkall', "1", false, { :onclick => "checkUncheckAll(this)" }
|
||||
|
|
@ -52,14 +49,15 @@
|
|||
- for article in articles
|
||||
/ check if the article is selected
|
||||
- included = @order.order_articles.detect { |order_article| order_article.article_id == article.id }
|
||||
%tr{:class => cycle('even', 'odd') + (included ? ' selected' : ''), :id => article.id.to_s, :onclick => "checkRow('#{article.id}')"}
|
||||
%td= check_box_tag "order[article_ids][]", article.id.to_s, included, { :id => "checkbox_#{article.id}", :onclick => "checkRow('#{article.id}')" }
|
||||
- included_class = included ? ' selected' : ''
|
||||
%tr{:class => cycle('even', 'odd') + ' click-me' + included_class, :id => article.id.to_s, :onclick => "checkRow('#{article.id}')"}
|
||||
%td= check_box_tag "order[article_ids][]", article.id, included, { :id => "checkbox_#{article.id}", :onclick => "checkRow('#{article.id}')" }
|
||||
%td=h article.name
|
||||
%td=h truncate article.note, 25
|
||||
%td=h truncate article.origin, 15
|
||||
%td=h truncate article.manufacturer, 15
|
||||
%td=h truncate article.note, :length => 25
|
||||
%td=h truncate article.origin, :length => 15
|
||||
%td=h truncate article.manufacturer, :length => 15
|
||||
%td= "#{article.unit_quantity} x #{article.unit}"
|
||||
%td= "#{number_to_currency(article.net_price)} / #{number_to_currency(article.gross_price)}"
|
||||
%td= "#{number_to_currency(article.price)} / #{number_to_currency(article.fc_price)}"
|
||||
%tr
|
||||
%td{:colspan => "6"}
|
||||
= check_box_tag 'checkall', "1", false, { :onclick => "checkUncheckAll(this)" }
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
= pagination_links_remote @orders, :params => {:sort => params[:sort]}
|
||||
%table.list{:style => "width: 100%"}
|
||||
%thead
|
||||
%tr
|
||||
%th=_ "Name"
|
||||
%th[sort_td_class_helper "supplier"]
|
||||
= sort_link_helper _("Supplier"), "supplier"
|
||||
%th=_ "Start"
|
||||
%th[sort_td_class_helper "ends"]
|
||||
= sort_link_helper _("End"), "ends"
|
||||
%th=_ "Status"
|
||||
%th{:colspan => "2"}
|
||||
%tbody
|
||||
- @orders.each do |order|
|
||||
%tr{:class => cycle('even', 'odd', :name => 'orders') + ((!order.finished? and order.ends < Time.now) ? " active" : "")}
|
||||
%td= link_to order.name, :action => "show", :id => order
|
||||
%td=h order.supplier ? order.supplier.name : _("nonexistent")
|
||||
%td=h format_time(order.starts)
|
||||
%td=h format_time(order.ends)
|
||||
%td= order.status == _("expired") ? link_to( _("finish now") + (" !!"), {:action => 'finish', :id => order}, :confirm => _("Are you really sure to finish the order?"), :method => "post") : order.status
|
||||
%td= link_to(image_tag('b_edit.png', :size => "16x16", :border => "0", :alt => _('Edit')), :action => 'edit', :id => order) unless order.finished?
|
||||
%td= link_to image_tag('b_drop.png', :size => "16x16", :border => "0", :alt => _("Destroy")), { :action => 'destroy', :id => order }, :confirm => _("Are you really sure you want to destroy the order?"), :method => "post"
|
||||
19
app/views/orders/_orders.html.haml
Normal file
19
app/views/orders/_orders.html.haml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
= pagination_links_remote @orders, :params => {:sort => params[:sort]}
|
||||
%table.list{:style => "width: 100%"}
|
||||
%thead
|
||||
%tr
|
||||
%th[sort_td_class_helper "supplier"]
|
||||
= sort_link_helper "Lieferant", "supplier"
|
||||
%th Start
|
||||
%th[sort_td_class_helper "ends"]
|
||||
= sort_link_helper "Ende", "ends"
|
||||
%th Status
|
||||
%th{:colspan => "2"}
|
||||
%tbody
|
||||
- @orders.each do |order|
|
||||
%tr{:class => cycle('even', 'odd', :name => 'orders')}
|
||||
%td=h order.supplier.name
|
||||
%td=h format_time(order.starts)
|
||||
%td=h format_time(order.ends)
|
||||
%td= order.state
|
||||
%td= link_to "Anzeigen", order
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><acronym title="Bestellnummer">Nr.</acronym></th>
|
||||
<th><acronym title="Gebinde insgesamt">Menge</acronym></th>
|
||||
<th>Artikel</th>
|
||||
<th><acronym title="Gebindegröße">GebGr</acronym></th>
|
||||
<th>Einheit</th>
|
||||
<th>Notiz</th>
|
||||
<th><acronym title="Bruttopreis inkl. MwSt, Aufschlag, Pfand">Preis</acronym></th>
|
||||
<th>MwSt</th>
|
||||
<th>Pfand</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for article in @order_articles %>
|
||||
<tr class="<%= cycle('even', 'odd', :name => 'articles') %>">
|
||||
<td><%=h article.order_number %></td>
|
||||
<td><%=h article.units_to_order %></td>
|
||||
<td><%=h article.name %></td>
|
||||
<td><%=h article.unit_quantity %></td>
|
||||
<td><%=h article.unit %></td>
|
||||
<td><%=h article.note %></td>
|
||||
<td><%= number_to_currency(article.gross_price) %></td>
|
||||
<td><%=h article.tax %></td>
|
||||
<td><%=h article.deposit %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<div class="legend">
|
||||
<table style="margin-bottom:1em" class="legend">
|
||||
<tr>
|
||||
<th colspan="3">Legende</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:70%">Bestellgruppe</td>
|
||||
<td>Menge</td>
|
||||
<td>Gesamtpreis</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<% for article in @order_articles %>
|
||||
<table style="margin-bottom:1em">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3"><%= article.name %> (<%= article.unit %> | <%= article.unit_quantity %> | <%= number_to_currency(article.gross_price) %>)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for result in article.group_order_article_results %>
|
||||
<tr class="<%= cycle('even', 'odd', :name => 'groups') %>">
|
||||
<td style="width:70%"><%=h result.group_order_result.group_name %></td>
|
||||
<td><%=h result.quantity %> (<%=h result.tolerance %>)</td>
|
||||
<td><%= number_to_currency(article.gross_price * result.quantity) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%- reset_cycle("groups") -%>
|
||||
<% end %>
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
<div class="legend">
|
||||
<table style="margin-bottom:1em" class="legend">
|
||||
<tr>
|
||||
<th style="width:40%">Name</th>
|
||||
<th><acronym title="zugeteilte Einheiten (davon aus Toleranzmenge)">Menge</acronym></th>
|
||||
<th><acronym title="Bruttopreis incl. MwSt, Aufschlag, Pfand">Preis</acronym></th>
|
||||
<th><acronym title="Gebindegröße">GebGr</acronym></th>
|
||||
<th>Einheit</th>
|
||||
<th>Gesamtpreis</th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<% for groupOrderResult in @order.group_order_results %>
|
||||
<table style="margin-bottom:1em">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="6"><%=h groupOrderResult.group_name %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
total = 0
|
||||
for result in groupOrderResult.group_order_article_results
|
||||
price = result.order_article_result.gross_price
|
||||
quantity = result.quantity
|
||||
subTotal = price * quantity
|
||||
total += subTotal
|
||||
%>
|
||||
<tr class="<%= cycle('even', 'odd', :name => 'articles') %>">
|
||||
<td style="width:40%"><%=h result.order_article_result.name %></td>
|
||||
<td><%=h quantity %> (<%=h result.tolerance %>)</td>
|
||||
<td><%= number_to_currency(price) %></td>
|
||||
<td><%=h result.order_article_result.unit_quantity %></td>
|
||||
<td><%=h result.order_article_result.unit %></td>
|
||||
<td><%= number_to_currency(subTotal) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr class="<%= cycle('even', 'odd', :name => 'articles') %>">
|
||||
<th colspan="5">Summe</th>
|
||||
<th><%= number_to_currency(total) %></th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%- reset_cycle("articles") -%>
|
||||
<% end %>
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
%table
|
||||
%tr
|
||||
%th=_ "Name"
|
||||
%th=_ "Unit quantity"
|
||||
%th=_ "Price"
|
||||
%th=_ "Units ordered"
|
||||
%th=_ "Result/Unit quantity"
|
||||
- totalNetto, totalBrutto, counter = 0, 0, 0
|
||||
- @order_articles.each do |category, order_articles|
|
||||
%tr{:style => "background-color:#EFEFEF"}
|
||||
%td{:style => "text-align:left; color: grey;"}=h category
|
||||
%td{:colspan => "9"}
|
||||
- order_articles.each do |order_article|
|
||||
- nettoPrice = order_article.article.net_price
|
||||
- bruttoPrice = order_article.article.gross_price
|
||||
- units = order_article.units_to_order
|
||||
- unitQuantity = order_article.article.unit_quantity
|
||||
- totalNetto += units * unitQuantity * nettoPrice
|
||||
- totalBrutto += units * unitQuantity * bruttoPrice
|
||||
- counter += 1 if units > 0
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles'), :style => "color: #{units > 0 ? 'green' : 'red'}"}
|
||||
%td=h order_article.article.name
|
||||
%td= "#{unitQuantity} x #{order_article.article.unit}"
|
||||
%td= "#{number_to_currency(nettoPrice)} / #{number_to_currency(bruttoPrice)}"
|
||||
%td= "#{order_article.quantity} + #{order_article.tolerance}" if unitQuantity > 1
|
||||
%td= units
|
||||
%p
|
||||
=_ "Total value"
|
||||
=_ "(net/gross)"
|
||||
= "#{number_to_currency(totalNetto)} / #{number_to_currency(totalBrutto)}"
|
||||
%p
|
||||
=_ "Ordered articles:"
|
||||
= counter
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
# Get ActiveRecord objects
|
||||
order_articles = @order.order_article_results
|
||||
end_date = @order.ends.strftime('%d.%m.%Y')
|
||||
title = "#{@order.name} | beendet am #{end_date}"
|
||||
title = "#{@order.supplier.name} | beendet am #{end_date}"
|
||||
|
||||
# Define header and footer
|
||||
pdf.header [pdf.margin_box.left,pdf.margin_box.top+30] do
|
||||
|
|
@ -14,15 +12,16 @@ end
|
|||
|
||||
# Start rendering
|
||||
|
||||
for article in order_articles
|
||||
pdf.text "#{article.name} (#{article.unit} | #{article.unit_quantity.to_s} | #{number_to_currency(article.gross_price)})",
|
||||
for order_article in @order.order_articles.ordered
|
||||
pdf.text "#{order_article.article.name} (#{order_article.article.unit} |\
|
||||
#{order_article.price.unit_quantity.to_s} | #{number_to_currency(order_article.price.fc_price)})",
|
||||
:style => :bold, :size => 10
|
||||
pdf.move_down 5
|
||||
data = []
|
||||
for result in article.group_order_article_results
|
||||
data << [result.group_order_result.group_name,
|
||||
result.quantity,
|
||||
article.gross_price * result.quantity]
|
||||
for goa in order_article.group_order_articles
|
||||
data << [goa.group_order.ordergroup.name,
|
||||
goa.quantity,
|
||||
number_with_precision(order_article.price.fc_price * goa.quantity)]
|
||||
end
|
||||
|
||||
pdf.table data,
|
||||
|
|
@ -31,6 +30,7 @@ for article in order_articles
|
|||
:widths => { 0 => 200, 1 => 40, 2 => 40 },
|
||||
:border_style => :grid,
|
||||
:row_colors => ['ffffff','ececec'],
|
||||
:vertical_padding => 3
|
||||
:vertical_padding => 3,
|
||||
:align => { 2 => :right }
|
||||
pdf.move_down 10
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
- title _("Edit order")
|
||||
|
||||
- form_tag :action => 'update', :id => @order do
|
||||
= render :partial => 'form'
|
||||
- form_for @order do |form|
|
||||
= render :partial => 'form', :locals => { :form => form }
|
||||
= submit_tag _("Save")
|
||||
|
|
||||
= link_to _("Cancel"), :action => 'show', :id => @order
|
||||
|
|
@ -41,12 +41,13 @@ pdf.text "Ansprechpartner: " + @order.supplier.contact_person
|
|||
pdf.move_down 10
|
||||
|
||||
# Articles
|
||||
data = @order.order_article_results.collect do |a|
|
||||
[a.order_number, a.units_to_order, a.name,
|
||||
a.unit_quantity, a.unit, a.net_price]
|
||||
data = @order.order_articles.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
|
||||
pdf.table data,
|
||||
:font_size => 8,
|
||||
:vertical_padding => 3,
|
||||
:border_style => :grid,
|
||||
:headers => ["BestellNr.", "Menge","Name", "Gebinde", "Einheit","Preis/Einheit"]
|
||||
:headers => ["BestellNr.", "Menge","Name", "Gebinde", "Einheit","Preis/Einheit"],
|
||||
:align => {0 => :left}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
end_date = @order.ends.strftime('%d.%m.%Y')
|
||||
title = "Gruppensortierung für #{@order.name}, beendet am #{end_date}"
|
||||
title = "Gruppensortierung für #{@order.supplier.name}, beendet am #{end_date}"
|
||||
|
||||
# Define header and footer
|
||||
pdf.header [pdf.margin_box.left,pdf.margin_box.top+20] do
|
||||
|
|
@ -12,28 +12,28 @@ end
|
|||
|
||||
|
||||
# Start rendering
|
||||
groups = @order.group_order_results.size
|
||||
groups = @order.group_orders.size
|
||||
counter = 1
|
||||
for group_result in @order.group_order_results
|
||||
pdf.text group_result.group_name, :style => :bold
|
||||
for group_order in @order.group_orders
|
||||
pdf.text group_order.ordergroup.name, :style => :bold
|
||||
pdf.move_down 5
|
||||
pdf.text "Gruppe #{counter.to_s}/#{groups.to_s}", :size => 8
|
||||
pdf.move_down 5
|
||||
|
||||
total = 0
|
||||
data = []
|
||||
group_result.group_order_article_results.each do |result|
|
||||
price = result.order_article_result.gross_price
|
||||
quantity = result.quantity
|
||||
group_order.group_order_articles.each do |goa|
|
||||
price = goa.order_article.price.fc_price
|
||||
quantity = goa.quantity
|
||||
sub_total = price * quantity
|
||||
total += sub_total
|
||||
data << [result.order_article_result.name,
|
||||
quantity, price,
|
||||
result.order_article_result.unit_quantity,
|
||||
result.order_article_result.unit,
|
||||
sub_total]
|
||||
data << [goa.order_article.article.name,
|
||||
quantity, number_with_precision(price),
|
||||
goa.order_article.price.unit_quantity,
|
||||
goa.order_article.article.unit,
|
||||
number_with_precision(sub_total)]
|
||||
end
|
||||
data << [ {:text => "Summe", :colspan => 5}, total]
|
||||
data << [ {:text => "Summe", :colspan => 5}, number_with_precision(total)]
|
||||
|
||||
pdf.table data,
|
||||
:font_size => 8,
|
||||
|
|
@ -41,7 +41,8 @@ for group_result in @order.group_order_results
|
|||
:vertical_padding => 3,
|
||||
:headers => ["Artikel", "Menge", "Preis", "GebGr", "Einheit", "Summe"],
|
||||
:widths => { 0 => 250 },
|
||||
:row_colors => ['ffffff','ececec']
|
||||
:row_colors => ['ffffff','ececec'],
|
||||
:align => { 0 => :right, 5 => :right }
|
||||
|
||||
counter += 1
|
||||
pdf.move_down 10
|
||||
|
|
|
|||
|
|
@ -3,39 +3,40 @@
|
|||
- if @current_user.role_orders?
|
||||
%p
|
||||
- form_tag do
|
||||
=_ "New Order"
|
||||
=_ "for"
|
||||
Neue Bestellung anlegen für
|
||||
%select{:onchange => "redirectTo(this)", :style => "font-size: 0.9em;margin-left:1em;"}
|
||||
%option{:selected => 'selected'}=_ "Choose a supplier..."
|
||||
= options_for_select(Supplier.find(:all).collect {|s| [ s.name, url_for(:action => "new", :id => s)] })
|
||||
= options_for_select(Supplier.find(:all).collect {|s| [ s.name, url_for(:action => "new", :supplier_id => s)] })
|
||||
%br/
|
||||
.left_column{:style => "width:55em"}
|
||||
.box_title
|
||||
%h2=_ "Running orders"
|
||||
%h2 Laufende Bestellungen
|
||||
.column_content
|
||||
- if (@current_orders.length > 0)
|
||||
- unless @open_orders.empty?
|
||||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
%th=_ "Name"
|
||||
%th=_ "Supplier"
|
||||
%th=_ "End"
|
||||
%th Lieferant
|
||||
%th Ende
|
||||
%th Notiz
|
||||
%th{:colspan => "2"}
|
||||
%tbody
|
||||
- for order in @current_orders
|
||||
%tr{:class => cycle('even', 'odd', :name => 'current_orders')}
|
||||
%td= link_to order.name, :controller => 'orders', :action => 'show', :id => order
|
||||
- for order in @open_orders
|
||||
- active = (order.open? and order.ends < Time.now) ? " active" : ""
|
||||
%tr{:class => cycle('even', 'odd', :name => 'open_orders') + active}
|
||||
%td=h order.supplier.name
|
||||
%td=h format_time(order.ends) unless order.ends.nil?
|
||||
%td= link_to _("finish"), {:action => 'finish', :id => order}, :confirm => _("Are you really sure to finish the order?"), :method => "post"
|
||||
%td=h truncate(order.note)
|
||||
%td= link_to "Beenden", finish_order_path(order), :confirm => _("Are you really sure to finish the order?"), :method => :post
|
||||
%td
|
||||
= link_to image_tag('b_edit.png', :size => "16x16", :border => 0, :alt => _("Edit")), :action => 'edit', :id => order
|
||||
= link_to image_tag('b_drop.png', :size => "16x16", :border => 0, :alt => _("Destroy")), { :action => 'destroy', :id => order }, :confirm => _("Are you really sure you want to destroy the order?"), :method => "post"
|
||||
= link_to "Anzeigen", order
|
||||
= link_to icon(:edit), edit_order_path(order)
|
||||
= link_to icon(:delete), order, :confirm => _("Are you really sure you want to destroy the order?"), :method => :delete
|
||||
- else
|
||||
=_ "There aren't current orders at the moment."
|
||||
=_ "There aren't open orders at the moment."
|
||||
|
||||
.left_column{:style => "width:75em"}
|
||||
.box_title
|
||||
%h2=_ "Expired/finished orders"
|
||||
%h2 Beendete Bestellungen
|
||||
.column_content#orders_table
|
||||
= render :partial => 'list'
|
||||
= render :partial => 'orders'
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
title = "#{@order.name}, beendet am #{@order.ends.strftime('%d.%m.%Y')}"
|
||||
title = "#{@order.supplier.name}, beendet am #{@order.ends.strftime('%d.%m.%Y')}"
|
||||
|
||||
# Define header and footer
|
||||
pdf.header [pdf.margin_box.left,pdf.margin_box.top+20] do
|
||||
|
|
@ -9,64 +9,64 @@ pdf.footer [pdf.margin_box.left, pdf.margin_box.bottom-5] do
|
|||
pdf.text "Seite #{pdf.page_count}", :size => 8
|
||||
end
|
||||
|
||||
max_articles_per_page = 17 # How many articles shoud written on a page
|
||||
articles = @order.order_article_results
|
||||
max_order_articles_per_page = 17 # How many order_articles shoud written on a page
|
||||
order_articles = @order.order_articles
|
||||
|
||||
pdf.text "Artikelübersicht", :style => :bold
|
||||
pdf.move_down 5
|
||||
pdf.text "Insgesamt #{articles.size} Artikel", :size => 8
|
||||
pdf.text "Insgesamt #{order_articles.size} Artikel", :size => 8
|
||||
pdf.move_down 10
|
||||
|
||||
articles_data = articles.collect do |a|
|
||||
[a.name, a.unit, a.unit_quantity, a.gross_price, a.units_to_order]
|
||||
order_articles_data = order_articles.collect do |a|
|
||||
[a.article.name, a.article.unit, a.price.unit_quantity, a.price.fc_price, a.units_to_order]
|
||||
end
|
||||
pdf.table articles_data,
|
||||
pdf.table order_articles_data,
|
||||
:font_size => 8,
|
||||
:border_style => :grid,
|
||||
:vertical_padding => 3,
|
||||
:headers => ["Artikel", "Einheit", "Gebinde", "Preis", "Menge"]
|
||||
:headers => ["Artikel", "Einheit", "Gebinde", "Preis", "Menge"],
|
||||
:align => { 3 => :right }
|
||||
|
||||
|
||||
page_number = 0
|
||||
total_num_articles = articles.size
|
||||
total_num_order_articles = order_articles.size
|
||||
|
||||
while (page_number * max_articles_per_page < total_num_articles) do # Start page generating
|
||||
while (page_number * max_order_articles_per_page < total_num_order_articles) do # Start page generating
|
||||
|
||||
page_number += 1
|
||||
pdf.start_new_page(:layout => :landscape)
|
||||
|
||||
# Collect articles for this page
|
||||
current_articles = articles.select do |a|
|
||||
articles.index(a) >= (page_number-1) * max_articles_per_page and
|
||||
articles.index(a) < page_number * max_articles_per_page
|
||||
# Collect order_articles for this page
|
||||
current_order_articles = order_articles.select do |a|
|
||||
order_articles.index(a) >= (page_number-1) * max_order_articles_per_page and
|
||||
order_articles.index(a) < page_number * max_order_articles_per_page
|
||||
end
|
||||
|
||||
# Make articles header
|
||||
# Make order_articles header
|
||||
header = [""]
|
||||
for header_article in current_articles
|
||||
name = header_article.name.split("-").join(" ").split(".").join(". ").split("/").join(" ")
|
||||
for header_article in current_order_articles
|
||||
name = header_article.article.name.split("-").join(" ").split(".").join(". ").split("/").join(" ")
|
||||
name = name.split.collect { |w| truncate(w, 8, "..") }.join(" ")
|
||||
header << truncate(name, 30, " ..")
|
||||
end
|
||||
|
||||
# Collect group results
|
||||
groups_data = []
|
||||
for group_order_result in @order.group_order_results
|
||||
for group_order in @order.group_orders.all(:include => :ordergroup)
|
||||
|
||||
group_result = [truncate(group_order_result.group_name, 20)]
|
||||
group_result = [truncate(group_order.ordergroup.name, 20)]
|
||||
|
||||
for article in current_articles
|
||||
# get the OrdergroupResult for this article
|
||||
result = GroupOrderArticleResult.find(:first,
|
||||
:conditions => ['order_article_result_id = ? AND group_order_result_id = ?', article.id, group_order_result.id])
|
||||
group_result << ((result.nil? || result == 0) ? "" : result.quantity.to_i)
|
||||
for order_article in current_order_articles
|
||||
# get the Ordergroup result for this order_article
|
||||
goa = order_article.group_order_articles.first :conditions => { :group_order_id => group_order.id }
|
||||
group_result << ((goa.nil? || goa == 0) ? "" : goa.quantity.to_i)
|
||||
end
|
||||
groups_data << group_result
|
||||
end
|
||||
|
||||
# Make table
|
||||
widths = { }
|
||||
(max_articles_per_page + 1).times { |i| widths.merge!({ i => 40 }) unless i == 0 }
|
||||
widths = { } # Generate widths-hash for table layout
|
||||
(max_order_articles_per_page + 1).times { |i| widths.merge!({ i => 40 }) unless i == 0 }
|
||||
pdf.table groups_data,
|
||||
:font_size => 8,
|
||||
:border_style => :grid,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
- title _("New order")
|
||||
|
||||
- form_tag :action => 'create' do
|
||||
= render :partial => 'form'
|
||||
- form_for @order do |form|
|
||||
= render :partial => 'form', :locals => { :form => form }
|
||||
= submit_tag _("Put the order online")
|
||||
|
|
||||
= link_to _("Cancel"), :action => 'index'
|
||||
= link_to "Abbrechen", orders_path
|
||||
|
|
@ -1,90 +1,88 @@
|
|||
- title _("Show order")
|
||||
#element_navigation
|
||||
= link_to_unless @order.previous == @order, _("Previous order"), :action => "show", :id => @order.previous
|
||||
= link_to_unless @order.previous == @order, _("Previous order"), @order.previous
|
||||
|
|
||||
= link_to _("Overview"), :controller => 'orders'
|
||||
= link_to _("Overview"), orders_path
|
||||
|
|
||||
= link_to_unless @order.next == @order, _("Next order"), :action => "show", :id => @order.next
|
||||
= link_to_unless @order.next == @order, _("Next order"), @order.next
|
||||
|
||||
// Order summary
|
||||
.left_column{:style => "width:55em"}
|
||||
.left_column{:style => "width:65em"}
|
||||
.box_title
|
||||
%h2=_ "Summary"
|
||||
%h2 Zusammenfassung
|
||||
.column_content
|
||||
- if !@order.booked? and @finished
|
||||
- if @order.finished? and !@order.closed?
|
||||
%p
|
||||
%b{:style => "color:red"}=_ "Order isn't balanced yet"
|
||||
%b{:style => "color:red"}=_ "Order isn't closed yet"
|
||||
%p
|
||||
= _("Name") + ":"
|
||||
%b=h @order.name
|
||||
|
|
||||
= _("Supplier") + ":"
|
||||
%b=h @order.supplier ? @order.supplier.name : _('nonexistent')
|
||||
Lieferant:
|
||||
%b=h @order.supplier.name
|
||||
- unless @order.note.empty?
|
||||
%p
|
||||
= _("Note") + ":"
|
||||
Notiz:
|
||||
=h @order.note
|
||||
%p
|
||||
= _("Begin") + ":"
|
||||
Beginn:
|
||||
%b=h format_time(@order.starts)
|
||||
|
|
||||
= _("End") + ":"
|
||||
Ende:
|
||||
%b=h format_time(@order.ends)
|
||||
%p
|
||||
= _("Groups ordered") + ":"
|
||||
%b= @group_orders.size
|
||||
- unless @finished
|
||||
= "[#{@group_orders.collect{|g| g.ordergroup.name}.join(', ')}]" unless @group_orders.empty?
|
||||
- else
|
||||
= "[#{@group_orders.collect{|g| g.group_name}.join(', ')}]" unless @group_orders.empty?
|
||||
Gruppenbestellungen:
|
||||
%b= @order.group_orders.count
|
||||
= "[#{@order.group_orders.find(:all, :include => :ordergroup).collect{|g| g.ordergroup.name}.join(', ')}]"
|
||||
|
||||
%p
|
||||
=_ "Total price"
|
||||
%b= number_to_currency(@order.sumPrice('gross'))
|
||||
- if @order.finished
|
||||
Bruttosummer aller Artikel
|
||||
%b= number_to_currency(@order.sum(:gross))
|
||||
- if @order.finished?
|
||||
|
|
||||
=_ "Ordered articles:"
|
||||
%b= @order_articles.size
|
||||
- unless @finished
|
||||
= link_to(image_tag('b_edit.png', :size => "16x16", :border => "0", :alt => 'Edit'), :action => 'edit', :id => @order)
|
||||
= link_to(image_tag('b_drop.png', :size => "16x16", :border => "0", :alt => 'Delete'), { :action => 'destroy', :id => @order }, :confirm => "Willst du wirklich die Bestellung '#{@order.name}' löschen?", :method => "post")
|
||||
= link_to('[beenden]', {:action => 'finish', :id => @order}, :confirm => "Willst du wirklich die Bestellung '#{@order.name}' beenden?", :method => "post")
|
||||
- else
|
||||
Bestellte Artikel:
|
||||
%b= @order.order_articles.ordered.count
|
||||
|
||||
- if @order.open?
|
||||
%p
|
||||
= link_to_remote _("All articles"), :update => 'result', :url => {:action => 'show', :id => @order, :view => 'normal'}, :before => "Element.show('loader')", :success => "Element.hide('loader')"
|
||||
= 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
|
||||
|
||||
- unless @order.open?
|
||||
%p
|
||||
= update_articles_link(@order, "Artikelübersicht", :normal)
|
||||
|
|
||||
= link_to_remote _("Sort by groups"), :update => 'result', :url => {:action => 'show', :id => @order, :view => 'groups'}, :before => "Element.show('loader')", :success => "Element.hide('loader')"
|
||||
= link_to image_tag("save_pdf.png", :size => "16x16", :border => "0", :alt => "PDF erstellen"), { :action => 'groupsPdf', :id => @order, :format => :pdf }, { :title => _("Download file") }
|
||||
= update_articles_link(@order, "Sortiert nach Gruppen", :groups)
|
||||
= link_to_pdf(@order, 'groupsPdf')
|
||||
|
|
||||
= link_to_remote _("Sort by articles"), :update => 'result', :url => {:action => 'show', :id => @order, :view => 'articles'}, :before => "Element.show('loader')", :success => "Element.hide('loader')"
|
||||
= link_to image_tag("save_pdf.png", :size => "16x16", :border => "0", :alt => "PDF erstellen"), { :action => 'articlesPdf', :id => @order, :format => :pdf}, { :title => _("Download file") }
|
||||
= update_articles_link(@order, "Sortiert nach Artikeln", :articles)
|
||||
= link_to_pdf(@order, 'articlesPdf')
|
||||
|
|
||||
=_ "Matrix" + ":"
|
||||
= link_to image_tag("save_pdf.png", :size => "16x16", :border => "0", :alt => "PDF erstellen"), { :action => 'matrixPdf', :id => @order, :format => :pdf }, { :title => _("Download file") }
|
||||
Matrix:
|
||||
= link_to_pdf(@order, 'matrixPdf')
|
||||
|
|
||||
=_ "FAX-template" + ":"
|
||||
= link_to image_tag("save_pdf.png", :size => "16x16", :border => "0", :alt => "PDF erstellen"), { :action => 'faxPdf', :id => @order, :format => :pdf }, { :title => _("Download file") }
|
||||
Faxvorlage:
|
||||
= link_to_pdf(@order, 'faxPdf')
|
||||
= link_to image_tag("text_file.png", :size => "16x16", :border => "0", :alt => "Textdatei erstellen"), { :action => 'text_fax_template', :id => @order }, { :title => _("Download file") }
|
||||
|
|
||||
= link_to 'Kommentare', '#comments'
|
||||
|
||||
// Ordered articles
|
||||
.single_column{:style => "clear:both; width:70em;"}
|
||||
.box_title
|
||||
%h2=_ "Articles"
|
||||
.column_content#result
|
||||
- unless @finished
|
||||
= render :partial => "show_unfinished"
|
||||
- else
|
||||
= render :partial => "showResult"
|
||||
%h2 Artikel
|
||||
.column_content#articles
|
||||
= render :partial => 'articles', :locals => { :order => @order }
|
||||
|
||||
// comments
|
||||
- if @finished
|
||||
.single_column{:style => "width:70em;"}
|
||||
.box_title
|
||||
%h2=_ "Comments"
|
||||
.column_content#comments
|
||||
= render :partial => "/shared/comments"
|
||||
%p
|
||||
= link_to_remote "neuer Kommentar", :url => {:action => 'newComment', :id => @order}
|
||||
#newComment
|
||||
= link_to_top
|
||||
.single_column{:style => "width:70em;"}
|
||||
.box_title
|
||||
%h2 Kommentare
|
||||
.column_content#comments
|
||||
= render :partial => "/shared/comments", :locals => { :comments => @order.comments }
|
||||
%p
|
||||
- form_for :comment, :url => add_comment_order_path(@order) do |form|
|
||||
%p
|
||||
%b Neuen Kommentar hinzufügen:
|
||||
%br/
|
||||
= form.text_area :comment, :cols => 50, :rows => 6
|
||||
%br/
|
||||
= submit_tag "Kommentar hinzufügen"
|
||||
|
||||
= link_to_top
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
- unless @comments.empty?
|
||||
- @comments.each do |comment|
|
||||
- unless comments.empty?
|
||||
- comments.each do |comment|
|
||||
.comment[comment]
|
||||
%h3
|
||||
= "#{comment.user.find_ordergroup.name} :" if comment.user.find_ordergroup
|
||||
=h comment.title
|
||||
= simple_format(comment.comment)
|
||||
= simple_format(comment.text)
|
||||
.timestamp
|
||||
Erstellt am
|
||||
= format_time(comment.created_at)
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
- form_for :comment, :url => {:action => 'addComment', :id => @order } do |form|
|
||||
%p
|
||||
Titel:
|
||||
%br/
|
||||
= form.text_field :title, :cols => 40
|
||||
%p
|
||||
Kommentar:
|
||||
%br/
|
||||
= form.text_area :comment, :cols => 60, :rows => 8
|
||||
= submit_tag "Speichern"
|
||||
|
|
||||
= link_to_function "Abbrechen", "Element.hide('newComment')"
|
||||
|
|
@ -23,5 +23,5 @@
|
|||
%td=h article.name
|
||||
%td= article.quantity
|
||||
%td= article.unit
|
||||
%td= article.net_price
|
||||
%td= article.price
|
||||
%td= link_to article.supplier.name, article.supplier
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue