fix bug for supplier display and tables without a section

This commit is contained in:
2012-11-20 21:02:05 +01:00
parent 0717d8d621
commit f1bc6a6978
+2 -2
View File
@@ -49,7 +49,7 @@ class SupplierController < ApplicationController
ho[:total_amount] = order_total.round(2)
ho[:state] = order.state
ho[:table_number] = order.table_number
ho[:section_title] = order.list.table.section.title
ho[:section_title] = order.list.table.section.try(:title)
ho[:id] = order.id
list_total += ho[:total_amount]
h[:orders] << ho
@@ -74,7 +74,7 @@ class SupplierController < ApplicationController
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.price).round(2)}}.round(2)
grand_total += hl[:total_amount]
hl[:section_title] = list.table.section.title
hl[:section_title] = list.table.section.try(:title)
h[:lists] << hl
end
h[:total_amount] = grand_total.round(2)