backup push

This commit is contained in:
2012-08-24 16:20:03 +02:00
parent e3c189d187
commit 4765608e2d
17 changed files with 172 additions and 56 deletions
+4 -3
View File
@@ -113,8 +113,8 @@ class SuppliersController < ApplicationController
ho = {products: []}
order_total = 0.0
for product_order in order.product_orders
order_total += (product_order.amount * product_order.product.price).round(2)
ho[:products] << {name: product_order.product.name, id: product_order.product_id, number: product_order.amount, price: product_order.product.price}
order_total += (product_order.amount * product_order.price).round(2)
ho[:products] << {name: product_order.product.name, id: product_order.product_id, number: product_order.amount, price: product_order.price}
end
ho[:total_amount] = order_total.round(2)
ho[:state] = order.state
@@ -141,7 +141,7 @@ class SuppliersController < ApplicationController
grand_total = 0.0
for list in @supplier.active_lists
hl = list.as_json
hl[:total_amount] = list.orders.inject(0.0){|sum, o| sum + o.product_orders.inject(0.0){|s, po| s + (po.amount * po.product.price).round(2)}}.round(2)
hl[:total_amount] = list.orders.inject(0.0){|sum, o| sum + o.product_orders.inject(0.0){|s, po| s + (po.amount * po.price).round(2)}}.round(2)
grand_total += hl[:total_amount]
h[:lists] << hl
end
@@ -150,6 +150,7 @@ class SuppliersController < ApplicationController
end
end
end
private
def set_relation_options