diff --git a/app/controllers/supplier_controller.rb b/app/controllers/supplier_controller.rb index 60c1d969..a3630100 100644 --- a/app/controllers/supplier_controller.rb +++ b/app/controllers/supplier_controller.rb @@ -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)