First try making tolerance not costly.
A new configuration setting was introduced: tolerance_is_costly If set to false, article tolerance values do not count for total article price as long as the order is not finished. This reduces the negative effect on using tolerance for the user.
This commit is contained in:
parent
c7e37fc7b2
commit
0adce9d54c
4 changed files with 38 additions and 9 deletions
|
|
@ -78,7 +78,10 @@
|
|||
- tolerance = goa.tolerance
|
||||
- result = goa.result
|
||||
- if @order.open?
|
||||
- sub_total = oa.price.fc_price * (quantity + tolerance)
|
||||
- if Foodsoft.config[:tolerance_is_costly]
|
||||
- sub_total = oa.price.fc_price * (quantity + tolerance)
|
||||
- else
|
||||
- sub_total = oa.price.fc_price * quantity
|
||||
- else
|
||||
- sub_total = oa.price.fc_price * result
|
||||
- else
|
||||
|
|
|
|||
|
|
@ -32,9 +32,12 @@
|
|||
</tr>
|
||||
<%-
|
||||
order_articles.each do |order_article|
|
||||
article_total = @price[i] * (@tolerance[i] + @quantity[i]);
|
||||
if Foodsoft.config[:tolerance_is_costly]
|
||||
article_total = @price[i] * (@tolerance[i] + @quantity[i])
|
||||
else
|
||||
article_total = @price[i] * @quantity[i]
|
||||
end
|
||||
total += article_total
|
||||
|
||||
-%>
|
||||
<tr class="<%= cycle('even', 'odd', :name => 'articles') %>" valign="top">
|
||||
<td class="name">
|
||||
|
|
@ -107,13 +110,22 @@
|
|||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
// preset data
|
||||
<% for i in 0...@price.size -%>
|
||||
<% if Foodsoft.config[:tolerance_is_costly]
|
||||
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] %>, 0);
|
||||
<% end -%>
|
||||
<% end
|
||||
else
|
||||
for j in 0...@price.size -%>
|
||||
addData(<%= @price[j] %>, <%= @unit[j] %>, <%= @price[j] * @quantity[j]%>, <%= @others_quantity[j] %>, <%= @others_tolerance[j] %>, <%= @used_quantity[j] %>, 0);
|
||||
<% end
|
||||
end%>
|
||||
setGroupBalance(<%= @availableFunds %>);
|
||||
|
||||
// localization
|
||||
setDecimalSeparator(",");
|
||||
|
||||
// configuration
|
||||
setToleranceBehaviour(<%= Foodsoft.config[:tolerance_is_costly] %>);
|
||||
|
||||
// initialize javascript
|
||||
updateBalance();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue