Order-refactoring part II.
This commit is contained in:
parent
f7b9582261
commit
6fd5d825f9
27 changed files with 228 additions and 231 deletions
|
|
@ -54,7 +54,7 @@
|
|||
|
|
||||
= link_to _('Upload articles'), upload_supplier_articles_path(@supplier)
|
||||
|
|
||||
= link_to_if @current_user.role_orders?, _('Create order'), {:controller => 'orders', :action => 'new', :id => @supplier }
|
||||
= link_to_if @current_user.role_orders?, _('Create order'), {:controller => 'orders', :action => 'new', :supplier_id => @supplier }
|
||||
|
||||
#article_filter
|
||||
#article_search_form{:style=>"display:inline;"}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
%table
|
||||
%tr
|
||||
%td Nettobetrag:
|
||||
%td= number_to_currency(order.sum(:clear))
|
||||
%td= number_to_currency(order.sum(:net))
|
||||
%tr
|
||||
%td Bruttobetrag:
|
||||
%td= number_to_currency(order.sum(:gross))
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
%th=_ "Who"
|
||||
%th=_ "Note"
|
||||
%th=_ "Amount"
|
||||
- for ft in @financial_transactions
|
||||
- for ft in @ordergroup.financial_transactions.all(:limit => 5)
|
||||
%tr{:class => cycle('even','odd')}
|
||||
%td= format_time(ft.created_on)
|
||||
%td= h(ft.user.nil? ? '?' : ft.user.nick)
|
||||
|
|
|
|||
|
|
@ -20,22 +20,22 @@
|
|||
:subnav => [
|
||||
{ :name => "Order", :url => "/ordering" },
|
||||
{ :name => "My orders", :url => "/ordering/myOrders" },
|
||||
{ :name => "Manage orders", :url => "/orders", :access? => (u.role_orders?) }
|
||||
{ :name => "Manage orders", :url => "/orders", :access_denied? => (!u.role_orders?) }
|
||||
]
|
||||
},
|
||||
{ :name => "Articles", :url => "/suppliers",
|
||||
:active => ["articles", "suppliers", "deliveries", "article_categories", "stockit"],
|
||||
:access? => (u.role_article_meta? || u.role_suppliers?),
|
||||
:access_denied? => (!u.role_article_meta? && !u.role_suppliers?),
|
||||
:subnav => [
|
||||
{ :name => "Artikel", :url => supplier_articles_path(Supplier.first) },
|
||||
{ :name => "Lager", :url => "/stockit" },
|
||||
{ :name => "Lieferantinnen", :url => suppliers_path, :access? => (u.role_suppliers?) },
|
||||
{ :name => "Lieferantinnen", :url => suppliers_path, :access_denied? => (!u.role_suppliers?) },
|
||||
{ :name => "Kategorien", :url => "/article_categories"}
|
||||
]
|
||||
},
|
||||
{ :name => "Finance", :url => "/finance",
|
||||
:active => ["finance/invoices", "finance/transactions", "finance/balancing"],
|
||||
:access? => (u.role_finance?),
|
||||
:access_denied? => (!u.role_finance?),
|
||||
:subnav => [
|
||||
{ :name => "Manage accounts", :url => "/finance/transactions" },
|
||||
{ :name => "Balance orders", :url => "/finance/balancing/list" },
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
},
|
||||
{ :name => "Administration", :url => "/admin",
|
||||
:active => ["admin", "admin/users", "admin/ordergroups", "admin/workgroups"],
|
||||
:access? => (u.role_admin?),
|
||||
:access_denied? => (!u.role_admin?),
|
||||
:subnav => [
|
||||
{ :name => "Users", :url => admin_users_path },
|
||||
{ :name => "Ordergroups", :url => admin_ordergroups_path },
|
||||
|
|
@ -55,12 +55,12 @@
|
|||
-%>
|
||||
<ul>
|
||||
<% for tab in tabs -%>
|
||||
<% unless tab[:access?] and tab[:access?] == false -%>
|
||||
<% unless tab[:access_denied?] -%>
|
||||
<li class="<%= 'current' if tab_is_active?(tab) %>">
|
||||
<%= link_to tab[:name], tab[:url] %>
|
||||
<ul>
|
||||
<% for subtab in tab[:subnav] -%>
|
||||
<% unless subtab[:access?] and subtab[:access?] == false -%>
|
||||
<% unless subtab[:access_denied?] -%>
|
||||
<li><%= link_to subtab[:name], subtab[:url] %></li>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
%p
|
||||
Lieferant:
|
||||
%b=h @order.supplier.name
|
||||
- unless @order.note.empty?
|
||||
- unless @order.note.blank?
|
||||
%p
|
||||
Notiz:
|
||||
=h @order.note
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
- if goa
|
||||
- quantity = goa.quantity
|
||||
- tolerance = goa.tolerance
|
||||
- result = goa.orderResult[:quantity] + goa.orderResult[:tolerance]
|
||||
- result = goa.result[:total]
|
||||
- sub_total = oa.price.fc_price * (quantity + tolerance)
|
||||
- else
|
||||
- quantity, tolerance, result, sub_total = 0, 0, 0, 0
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
%tr{:class => cycle('even', 'odd', :name => 'articles'), :style => "color:#{style}"}
|
||||
%td{:style => "width:40%"}
|
||||
=h oa.article.name
|
||||
- unless oa.article.note.empty?
|
||||
- unless oa.article.note.blank?
|
||||
= 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)
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
= "+ #{tolerance}" if oa.price.unit_quantity > 1
|
||||
%td= result > 0 ? result : "0"
|
||||
%td= number_to_currency(sub_total)
|
||||
- unless oa.article.note.empty?
|
||||
- unless oa.article.note.blank?
|
||||
%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')}
|
||||
|
|
|
|||
|
|
@ -96,14 +96,14 @@
|
|||
-%>
|
||||
<tr class="<%= cycle('even', 'odd', :name => 'articles') %>" valign="top">
|
||||
<td class="name">
|
||||
<% unless order_article.article.note.empty? %>
|
||||
<% unless order_article.article.note.blank? %>
|
||||
<%= order_article.article.name %> <%= image_tag "lamp_grey.png", {:alt => _("Show note"), :size => "15x16", :border => "0", :onmouseover => "$('note_#{i}').show();", :onmouseout => "$('note_#{i}').hide();" }%>
|
||||
<% else %>
|
||||
<%= order_article.article.name %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%=h order_article.article.origin %></td>
|
||||
<td><%=h truncate order_article.article.manufacturer, 11 %></td>
|
||||
<td><%=h truncate order_article.article.manufacturer, :length => 11 %></td>
|
||||
<td><%= @unit[i] %> * <%=h order_article.article.unit %></td>
|
||||
<td><%= number_to_currency(@price[i]) %></td>
|
||||
<td id="units_<%= i %>"><%= order_article.units_to_order %></td>
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
</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? -%>
|
||||
<% unless order_article.article.note.blank? -%>
|
||||
<tr id="note_<%= i %>" class="note" style="display:none">
|
||||
<td colspan="10"><%=h order_article.article.note %> | <%=h order_article.article.manufacturer %></td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -4,20 +4,23 @@
|
|||
%th{:colspan => '3'} Legende
|
||||
%tr
|
||||
%th{:style => 'width:70%'} Bestellgruppe
|
||||
%th Menge
|
||||
%th Bestellt
|
||||
%th Bekommen
|
||||
%th Gesamtpreis
|
||||
|
||||
- for order_article in order.order_articles.all(:include => [:article, :article_price])
|
||||
- for order_article in order.order_articles.ordered.all(:include => [:article, :article_price])
|
||||
%table{:style => "margin-bottom:1em"}
|
||||
%thead
|
||||
%tr
|
||||
%th{:colspan => "3"}
|
||||
%th{:colspan => "4"}
|
||||
= order_article.article.name
|
||||
= "(#{order_article.article.unit} | #{order_article.price.unit_quantity} | #{number_to_currency(order_article.price.fc_price)})"
|
||||
= "(#{order_article.article.unit} | #{order_article.price.unit_quantity} | #{number_to_currency(order_article.price.gross_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
|
||||
%b= "#{goa.quantity_result} + #{goa.tolerance_result}"
|
||||
%td= number_to_currency(order_article.price.fc_price * goa.quantity)
|
||||
- reset_cycle('groups')
|
||||
|
|
@ -18,13 +18,13 @@
|
|||
%th{:colspan => "6"}=h group_order.ordergroup.name
|
||||
%tbody
|
||||
- total = 0
|
||||
- for goa in group_order.group_order_articles.all(:include => :order_article)
|
||||
- for goa in group_order.group_order_articles.ordered.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= "#{goa.result[:quantity]} (#{goa.result[:tolerance]})"
|
||||
%td= number_to_currency(fc_price)
|
||||
%td= goa.order_article.price.unit_quantity
|
||||
%td= goa.order_article.article.unit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue