Second part of stock-integration.
Introduced StockArticle and a special page for ordering from stock. StockChanges will be created and the StockArticle.quantity updated in 'order.close!'.
This commit is contained in:
parent
1912a3fd80
commit
c17b63b192
37 changed files with 616 additions and 340 deletions
34
app/views/deliveries/_new_stock_article.html.haml
Normal file
34
app/views/deliveries/_new_stock_article.html.haml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
- remote_form_for stock_article, :url => add_stock_article_supplier_deliveries_path(@supplier) do |form|
|
||||
= form.error_messages
|
||||
|
||||
%p
|
||||
remote_link_to "Artikel aus dem Katalog wählen"...
|
||||
%p
|
||||
= form.label :name
|
||||
%br/
|
||||
= form.text_field :name
|
||||
%p
|
||||
= form.label :unit
|
||||
%br/
|
||||
= form.text_field :unit
|
||||
%p
|
||||
= form.label :note
|
||||
%br/
|
||||
= form.text_field :note
|
||||
%p
|
||||
= form.label :price
|
||||
%br/
|
||||
= form.text_field :price
|
||||
%p
|
||||
= form.label :tax
|
||||
%br/
|
||||
= form.text_field :tax, :value => (stock_article.tax || 7.0)
|
||||
%p
|
||||
= form.label :deposit
|
||||
%br/
|
||||
= form.text_field :deposit
|
||||
%p
|
||||
Kategorie:
|
||||
= form.select :article_category, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] }
|
||||
%p
|
||||
= submit_tag "Artikel speichern"
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
%p
|
||||
- fields_for "delivery[stock_change_attributes][]", stock_change do |form|
|
||||
= form.select :article_id, articles_for_select(@supplier), :prompt => " -- Artikel auswählen -- "
|
||||
= form.hidden_field :stock_article_id
|
||||
Menge
|
||||
= form.text_field :quantity, :size => 5, :autocomplete => 'off'
|
||||
= link_to_function "Löschen", "$(this).up('p').remove()"
|
||||
- article = stock_change.stock_article
|
||||
%b= article.name
|
||||
= "(#{number_to_currency(article.price)} / #{article.unit})"
|
||||
//= link_to_function "Löschen", "$(this).up('p').remove()"
|
||||
|
|
@ -1,4 +1,27 @@
|
|||
- title "Neue Lieferung von #{@supplier.name}"
|
||||
|
||||
- render :layout => 'form' do
|
||||
= render :partial => 'stock_change', :collection => @delivery.stock_changes
|
||||
.left_column
|
||||
- form_for([@supplier,@delivery]) do |f|
|
||||
.box_title
|
||||
%h2 Lieferung anlegen
|
||||
.column_content
|
||||
= f.error_messages
|
||||
= f.hidden_field :supplier_id
|
||||
%p
|
||||
%b= f.label :delivered_on
|
||||
= f.date_select :delivered_on
|
||||
%h2 Lagerartikel des Lieferanten
|
||||
#stock_changes
|
||||
= render :partial => 'stock_change', :collection => @delivery.stock_changes
|
||||
%p
|
||||
= f.submit "Lieferung anlegen"
|
||||
|
||||
.right_column{:style => "width:35em;"}
|
||||
.box_title
|
||||
%h2 Neuen Lagerartikel anlegen
|
||||
.column_content
|
||||
#new_stock_article
|
||||
= render :partial => 'new_stock_article', :locals => {:stock_article => @supplier.stock_articles.build}
|
||||
|
||||
%p{:style => "clear:both"}
|
||||
= link_to 'Zurück', supplier_deliveries_path(@supplier)
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
%th Artikel
|
||||
%th Einheit
|
||||
%th Menge
|
||||
- for stock_change in @delivery.stock_changes.find :all, :include => :article
|
||||
- for stock_change in @delivery.stock_changes.find :all, :include => :stock_article
|
||||
%tr
|
||||
%td= stock_change.article.name
|
||||
%td= stock_change.article.unit
|
||||
%td= stock_change.stock_article.name
|
||||
%td= stock_change.stock_article.unit
|
||||
%td= stock_change.quantity
|
||||
|
||||
%br/
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
%td{:id => "group_order_article_#{group_order_article.id}_quantity"}
|
||||
= group_order_article.result
|
||||
%td.currency
|
||||
= number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.quantity, :unit => "")
|
||||
= number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.result, :unit => "")
|
||||
%td.actions{:style=>"width:1em"}
|
||||
= remote_link_to icon(:edit), :update => 'edit_box', |
|
||||
:url => {:action => 'edit_group_order_article', :id => group_order_article}, |
|
||||
|
|
|
|||
|
|
@ -8,11 +8,13 @@
|
|||
%h2 Zusammenfassung
|
||||
.column_content#summary
|
||||
= render :partial => "summary", :locals => {:order => @order}
|
||||
.left_column{:style => 'width: 24em'}
|
||||
.box_title
|
||||
%h2 Rechnung
|
||||
.column_content#invoice
|
||||
= render :partial => "invoice", :locals => {:invoice => @order.invoice}
|
||||
|
||||
- unless @order.stockit?
|
||||
.left_column{:style => 'width: 24em'}
|
||||
.box_title
|
||||
%h2 Rechnung
|
||||
.column_content#invoice
|
||||
= render :partial => "invoice", :locals => {:invoice => @order.invoice}
|
||||
|
||||
.right_column{:style => 'width: 20em'}
|
||||
.box_title
|
||||
|
|
|
|||
48
app/views/ordering/_order_head.haml
Normal file
48
app/views/ordering/_order_head.haml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
- title "Bestellen"
|
||||
|
||||
.left_column{:style => "width:49em"}
|
||||
.box_title
|
||||
%h2=h @order.name
|
||||
.column_content
|
||||
%table
|
||||
%tr{:valign => "top"}
|
||||
%td{:width => "60%"}
|
||||
%p
|
||||
%b Lieferant:
|
||||
=h @order.name
|
||||
%p
|
||||
%b Ende:
|
||||
=h format_time(@order.ends)
|
||||
- if @group_order && @group_order.updated_by
|
||||
%p
|
||||
%b Zuletzt bestellt:
|
||||
=h @group_order.updated_by.nick if @group_order.updated_by
|
||||
= "(#{format_time(@group_order.updated_on)})"
|
||||
%p
|
||||
%b Verfügbares Guthaben:
|
||||
= number_to_currency(@availableFunds)
|
||||
%td
|
||||
- unless @order.note.empty?
|
||||
%p
|
||||
%b Notiz:
|
||||
= simple_format(@order.note)
|
||||
- unless @order.stockit? || @order.supplier.min_order_quantity.blank?
|
||||
%p
|
||||
%b Mindestellmenge:
|
||||
=h @order.supplier.min_order_quantity
|
||||
%p
|
||||
%b Gesamtbestellmenge bisher:
|
||||
= number_to_currency @order.sum
|
||||
|
||||
- orders = Order.open.reject{ |order| order == @order }
|
||||
- unless orders.empty?
|
||||
.right_column{:style => "width:22em"}
|
||||
.box_title
|
||||
%h2 Anderer Bestellungen
|
||||
.column_content
|
||||
%table
|
||||
- for order in @other_orders
|
||||
%tr
|
||||
%td
|
||||
= link_to_function order.name, "if (confirmSwitchOrder()) (window.location = '#{ url_for(:action => 'order', :id => order) }' )"
|
||||
%td= "noch #{time_ago_in_words(order.ends)}" if order.ends
|
||||
|
|
@ -1,164 +1,104 @@
|
|||
<h1>Bestellen</h1>
|
||||
<%= render :partial => 'order_head' %>
|
||||
|
||||
<div class="left_column" style="width:49em">
|
||||
<div class="box_title"><h2><%=h @order.name %></h2></div>
|
||||
<div class="column_content">
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td width="60%">
|
||||
<p><b>Lieferant:</b> <%=h @order.name %></p>
|
||||
<p><b>Ende:</b> <%=h format_time(@order.ends) %></p>
|
||||
<% if @group_order && @group_order.updated_by -%>
|
||||
<p><b>Zuletzt bestellt:</b> <%=h @group_order.updated_by.nick if @group_order.updated_by %> (<%= format_time(@group_order.updated_on) %>)</p>
|
||||
<% end -%>
|
||||
<p><b>Verfügbares Guthaben:</b> <%= number_to_currency(@availableFunds) %></p>
|
||||
</td>
|
||||
<td>
|
||||
<% unless @order.note.empty? %>
|
||||
<p>
|
||||
<b>Notiz:</b>
|
||||
</p>
|
||||
<%= simple_format(@order.note) %>
|
||||
<% end %>
|
||||
<% unless @order.stockit? || @order.supplier.min_order_quantity.blank? -%>
|
||||
<p>
|
||||
<b>Mindestellmenge:</b>
|
||||
<%=h @order.supplier.min_order_quantity %>
|
||||
</p>
|
||||
<% end -%>
|
||||
<p>
|
||||
<b>Gesamtbestellmenge bisher:</b>
|
||||
<%= number_to_currency @order.sum %>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%- if !@other_orders.empty? -%>
|
||||
<div class="right_column" style="width:22em">
|
||||
<div class="box_title">
|
||||
<h2>Andere Bestellungen</h2>
|
||||
</div>
|
||||
<div class="column_content">
|
||||
<table>
|
||||
<% for order in @other_orders -%>
|
||||
<tr>
|
||||
<td>
|
||||
<%= link_to_function order.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>
|
||||
<% end -%>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<%- end -%>
|
||||
|
||||
<br style="clear:both" />
|
||||
|
||||
<div class="single_column">
|
||||
<% form_tag(:action => 'saveOrder', :id => @order) do %>
|
||||
<div class="box_title">
|
||||
<h2>Artikel</h2>
|
||||
</div>
|
||||
<div class="column_content">
|
||||
<table id="order" class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th></th>
|
||||
<th>Herstellerin</th>
|
||||
<th style="width:7em;"><%= @order.stockit? ? "im Lager" : "Gebinde" -%></th>
|
||||
<th style="width:4.5em;">Preis</th>
|
||||
<th id="col_packages"><acronym title="insgesamt bestellte Gebinde">Best</acronym></th>
|
||||
<th id="col_required">Menge</th>
|
||||
<% unless @order.stockit? -%>
|
||||
<th id="col_tolerance">Toleranz</th>
|
||||
<% end -%>
|
||||
<th>Summe</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<div class="single_column" style="clear:both;">
|
||||
<% form_tag(:action => 'saveOrder', :id => @order) do %>
|
||||
<div class="box_title">
|
||||
<h2>Artikel</h2>
|
||||
</div>
|
||||
<div class="column_content">
|
||||
<table id="order" class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th></th>
|
||||
<th>Herstellerin</th>
|
||||
<th style="width:7em;">Gebinde</th>
|
||||
<th style="width:4.5em;">Preis</th>
|
||||
<th id="col_packages"><acronym title="insgesamt bestellte Gebinde">Best</acronym></th>
|
||||
<th id="col_required">Menge</th>
|
||||
<th id="col_tolerance">Toleranz</th>
|
||||
<th>Summe</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%-
|
||||
total = 0
|
||||
i = 0
|
||||
@articles_grouped_by_category.each do |category, order_articles|
|
||||
-%>
|
||||
<tr style="background-color:#EFEFEF">
|
||||
<td style="text-align:left"><b><%=h category %></b></td>
|
||||
<td colspan="9"></td>
|
||||
</tr>
|
||||
<tr style="background-color:#EFEFEF">
|
||||
<td style="text-align:left"><b><%=h category %></b></td>
|
||||
<td colspan="9"></td>
|
||||
</tr>
|
||||
<%-
|
||||
order_articles.each do |order_article|
|
||||
article_total = @price[i] * (@tolerance[i] + @quantity[i]);
|
||||
total += article_total
|
||||
|
||||
-%>
|
||||
<tr class="<%= cycle('even', 'odd', :name => 'articles') %>" valign="top">
|
||||
<td class="name">
|
||||
<% 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, :length => 11 %></td>
|
||||
<td><%= @order.stockit? ? order_article.article.quantity_available : @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>
|
||||
<td style="text-align:right;">
|
||||
<input type="hidden" id="q_<%= i %>" name="<%= "ordered[#{order_article.id}][quantity]" %>" value="<%= @quantity[i] %>" size="2" />
|
||||
<span id="q_used_<%= i %>" class="used"><%= @used_quantity[i] %></span> +
|
||||
<span id="q_unused_<%= i %>" class="unused"><%= @quantity[i] - @used_quantity[i] %></span>
|
||||
<span class="total">(<span id="q_total_<%= i %>"><%= @quantity[i] + @others_quantity[i] %></span>)</span>
|
||||
<%= button_to_function('+', "increaseQuantity(#{i})") %>
|
||||
<%= button_to_function('-', "decreaseQuantity(#{i})") %>
|
||||
</td>
|
||||
<td style="text-align:right;">
|
||||
<input type="hidden" id="t_<%= i %>" name="<%= "ordered[#{order_article.id}][tolerance]" %>" value="<%= @tolerance[i] %>" size="2" />
|
||||
<% if (@unit[i] > 1) -%>
|
||||
<span id="t_used_<%= i %>" class="used"><%= @used_tolerance[i] %></span> +
|
||||
<span id="t_unused_<%= i %>" class="unused"><%= @tolerance[i] - @used_tolerance[i] %></span>
|
||||
<span class="total">(<span id="t_total_<%= i %>"><%= @tolerance[i] + @others_tolerance[i] %></span>)</span>
|
||||
<%= button_to_function('+', "increaseTolerance(#{i})") %>
|
||||
<%= 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> €</td>
|
||||
</tr>
|
||||
<% 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>
|
||||
<tr class="<%= cycle('even', 'odd', :name => 'articles') %>" valign="top">
|
||||
<td class="name">
|
||||
<% 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, :length => 11 %></td>
|
||||
<td><%= @order.stockit? ? order_article.article.quantity_available : @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>
|
||||
<td style="text-align:right;">
|
||||
<input type="hidden" id="q_<%= i %>" name="<%= "ordered[#{order_article.id}][quantity]" %>" value="<%= @quantity[i] %>" size="2" />
|
||||
<span id="q_used_<%= i %>" class="used"><%= @used_quantity[i] %></span> +
|
||||
<span id="q_unused_<%= i %>" class="unused"><%= @quantity[i] - @used_quantity[i] %></span>
|
||||
<span class="total">(<span id="q_total_<%= i %>"><%= @quantity[i] + @others_quantity[i] %></span>)</span>
|
||||
<%= button_to_function('+', "increaseQuantity(#{i})") %>
|
||||
<%= button_to_function('-', "decreaseQuantity(#{i})") %>
|
||||
</td>
|
||||
<td style="text-align:right;">
|
||||
<input type="hidden" id="t_<%= i %>" name="<%= "ordered[#{order_article.id}][tolerance]" %>" value="<%= @tolerance[i] %>" size="2" />
|
||||
<% if (@unit[i] > 1) -%>
|
||||
<span id="t_used_<%= i %>" class="used"><%= @used_tolerance[i] %></span> +
|
||||
<span id="t_unused_<%= i %>" class="unused"><%= @tolerance[i] - @used_tolerance[i] %></span>
|
||||
<span class="total">(<span id="t_total_<%= i %>"><%= @tolerance[i] + @others_tolerance[i] %></span>)</span>
|
||||
<%= button_to_function('+', "increaseTolerance(#{i})") %>
|
||||
<%= 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> €</td>
|
||||
</tr>
|
||||
<% 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>
|
||||
<% end -%>
|
||||
<%- i = i + 1
|
||||
end
|
||||
end -%>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="6"></td>
|
||||
<td colspan="3" class="currency"><%=_ "Total amount" %>: <span id="total_price"><%= total %></span> €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6"></td>
|
||||
<td colspan="3" class="currency"><%=_ "Credit available"%>: <%= number_to_currency(@availableFunds) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6"></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>
|
||||
<td colspan="5"></td>
|
||||
<td colspan="3" style="text-align:right;"><span style="font-size:1.2em"><%= submit_tag( _("Save order"), :id => 'submit_button' ) %></span> | <%= link_to _("Cancel"), :controller => 'ordering' %></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="6"></td>
|
||||
<td colspan="3" class="currency"><%=_ "Total amount" %>: <span id="total_price"><%= total %></span> €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6"></td>
|
||||
<td colspan="3" class="currency"><%=_ "Credit available"%>: <%= number_to_currency(@availableFunds) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6"></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>
|
||||
<td colspan="5"></td>
|
||||
<td colspan="3" style="text-align:right;"><span style="font-size:1.2em"><%= submit_tag( _("Save order"), :id => 'submit_button' ) %></span> | <%= link_to _("Cancel"), :controller => 'ordering' %></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<input type="hidden" id="total_balance" name="total_balance" value="<%= @ordergroup.account_balance - total %>"/>
|
||||
<input type="hidden" name="version" value="<%= @version %>"/>
|
||||
<% end %>
|
||||
|
|
@ -168,7 +108,7 @@
|
|||
//<![CDATA[
|
||||
// preset data
|
||||
<% for i in 0...@price.size -%>
|
||||
addData(<%= @price[i] %>, <%= @unit[i] %>, <%= @price[i] * (@tolerance[i] + @quantity[i])%>, <%= @others_quantity[i] %>, <%= @others_tolerance[i] %>, <%= @used_quantity[i] %>);
|
||||
addData(<%= @price[i] %>, <%= @unit[i] %>, <%= @price[i] * (@tolerance[i] + @quantity[i])%>, <%= @others_quantity[i] %>, <%= @others_tolerance[i] %>, <%= @used_quantity[i] %>, 0);
|
||||
<% end -%>
|
||||
setGroupBalance(<%= @availableFunds %>);
|
||||
|
||||
|
|
|
|||
98
app/views/ordering/stock_order.html.haml
Normal file
98
app/views/ordering/stock_order.html.haml
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
= render :partial => 'order_head'
|
||||
|
||||
.single_column{:style => 'clear:both'}
|
||||
- form_tag(:action => 'saveOrder', :id => @order) do
|
||||
.box_title
|
||||
%h2 Anderer Bestellungen
|
||||
.column_content
|
||||
%table#order.list
|
||||
%thead
|
||||
%tr
|
||||
%th Name
|
||||
%th
|
||||
%th Herstellerin
|
||||
%th Lieferantin
|
||||
%th{:style => "width:5em;"} Einheit
|
||||
%th{:style => "width:4.5em;"} Preis
|
||||
%th Verfügbar
|
||||
%th#col_required Menge
|
||||
%th Summe
|
||||
%tbody
|
||||
- total = 0
|
||||
- i = 0
|
||||
- for category_name, order_articles in @articles_grouped_by_category
|
||||
%tr{:style => "background-color:#EFEFEF"}
|
||||
%td{:style => "text-align:left"}
|
||||
%b=h category_name
|
||||
%td{:colspan => "9"}
|
||||
- for order_article in order_articles
|
||||
- article_total = @price[i] * @quantity[i]
|
||||
- total += article_total
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles'), :valign => "top"}
|
||||
%td.name
|
||||
= order_article.article.name
|
||||
- unless order_article.article.note.blank?
|
||||
= image_tag "lamp_grey.png", {:alt => _("Show note"), :size => "15x16", :border => "0", :onmouseover => "$('note_#{i}').show();", :onmouseout => "$('note_#{i}').hide();" }
|
||||
%td=h order_article.article.origin
|
||||
%td=h truncate order_article.article.manufacturer, :length => 11
|
||||
%td=h truncate order_article.article.supplier.name, :length => 11
|
||||
%td=h order_article.article.unit
|
||||
%td= number_to_currency @price[i]
|
||||
%td= @quantity_available[i]
|
||||
%td{:style => "text-align:right;"}
|
||||
= hidden_field_tag "ordered[#{order_article.id}][quantity]", @quantity[i], :id => "q_#{i}", :size => "2"
|
||||
%span.used{:id => "q_used_#{i}"}= @used_quantity[i]
|
||||
%span.total= "(<span id='q_total_#{i}'>#{@quantity[i] + @others_quantity[i]}</span>)"
|
||||
= button_to_function('+', "increaseStockQuantity(#{i})")
|
||||
= button_to_function('-', "decreaseStockQuantity(#{i})")
|
||||
|
||||
%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 => "")
|
||||
€
|
||||
- unless order_article.article.note.blank?
|
||||
%tr.note{:id => "note_#{i}", :style => "display:none"}
|
||||
%td{:colspan => "10"}
|
||||
=h order_article.article.note
|
||||
|
|
||||
=h order_article.article.manufacturer
|
||||
|
||||
- i = i + 1
|
||||
%tfoot
|
||||
%tr
|
||||
%td{:colspan => "5"}
|
||||
%td.currency{:colspan => "3"}
|
||||
Gesamtbetrag:
|
||||
%span#total_price= total
|
||||
€
|
||||
%tr
|
||||
%td{:colspan => "5"}
|
||||
%td.currency{:colspan => "3"}
|
||||
Verfügbares Guthaben:
|
||||
= number_to_currency @availableFunds
|
||||
%tr
|
||||
%td{:colspan => "5"}
|
||||
%td.currency{:colspan => "3"}
|
||||
Neuer Kontostand:
|
||||
%strong
|
||||
%span#new_balance= @ordergroup.account_balance - total
|
||||
€
|
||||
%tr
|
||||
%td{:style => "text-align:left;"}= link_to_top
|
||||
%td{:colspan => "4"}
|
||||
%td{:colspan => "3", :style => "text-align:right;"}
|
||||
%span{:style => "font-size:1.2em"}= submit_tag("Bestellung speichern", :id => 'submit_button' )
|
||||
|
|
||||
= link_to "Abbrechen", :controller => 'ordering'
|
||||
|
||||
= hidden_field_tag "total_balance", @ordergroup.account_balance - total, :id => "total_balance"
|
||||
= hidden_field_tag "version", @version
|
||||
|
||||
%script{:type => "text/" + "javascript"}
|
||||
// preset data
|
||||
- for i in 0...@price.size
|
||||
= "addData(#{@price[i]}, 1, #{@price[i] * @quantity[i]}, #{@others_quantity[i]}, 0, #{@used_quantity[i]}, #{@quantity_available[i]});"
|
||||
= "setGroupBalance(#{@availableFunds});"
|
||||
// localization
|
||||
setDecimalSeparator(",");
|
||||
// initialize javascript
|
||||
updateBalance();
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
%th Einheit
|
||||
%th Preis
|
||||
%th Lieferant
|
||||
%th Kategorie
|
||||
%tbody
|
||||
- for article in @articles
|
||||
%tr{:class => cycle("even", "odd")}
|
||||
|
|
@ -26,3 +27,4 @@
|
|||
%td= article.unit
|
||||
%td= article.price
|
||||
%td= link_to article.supplier.name, article.supplier
|
||||
%td= article.article_category.name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue