From b2ab2c9632cfd961b8b2eaabe497445ec71a181e Mon Sep 17 00:00:00 2001 From: Myat Zin Wai Maw Date: Thu, 12 Sep 2019 19:29:04 +0630 Subject: [PATCH 1/2] add account name in saleitem xls --- app/views/reports/saleitem/index.xls.erb | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/app/views/reports/saleitem/index.xls.erb b/app/views/reports/saleitem/index.xls.erb index b5f7f3ef..799ede63 100755 --- a/app/views/reports/saleitem/index.xls.erb +++ b/app/views/reports/saleitem/index.xls.erb @@ -24,7 +24,7 @@ <% end %> -   + <%= t("views.right_panel.header.account_name") %> <%= t("views.right_panel.header.menu_category") %> <%= t("views.right_panel.detail.code") %> <%= t("views.right_panel.detail.product") %> @@ -89,25 +89,18 @@ <% if sale.status_type == "Discount" && sale.grand_total < 0 total_item_dis += sale.grand_total*(-1) end %> - <% if !acc_arr.include?(sale.account_id) %> - - <%= sale.account_name %> -   - <%= t("views.right_panel.detail.total_price_by") %> <%= sale.account_name %> - + <% @totalByAccount.each do |account, total| %> <% if sale.account_id == account %> - <%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) %> + <% grand_total += total %> <% end %> <% end %> - - <% acc_arr.push(sale.account_id) %> <% end %> -   + <%= sale.account_name %> <%= sale.menu_category_name %> <%= sale.item_code rescue '-' %> <%= sale.product_name rescue '-' %> From 8e2a9bd5a11a726ff0d51a5a5e5c0b904bf144b3 Mon Sep 17 00:00:00 2001 From: Myat Zin Wai Maw Date: Fri, 13 Sep 2019 16:20:54 +0630 Subject: [PATCH 2/2] add to existing --- app/controllers/origami/sales_controller.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/app/controllers/origami/sales_controller.rb b/app/controllers/origami/sales_controller.rb index 0549a5a5..4c02a4f0 100755 --- a/app/controllers/origami/sales_controller.rb +++ b/app/controllers/origami/sales_controller.rb @@ -29,11 +29,8 @@ class Origami::SalesController < BaseOrigamiController sale_data = [] table = DiningFacility.find(dining) existing_booking = Booking.find_by_sale_id(sale_id) - table.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ").each do |booking| - # if !booking.checkout_at.nil? - # existing_booking.update_attributes(checkout_at: checkout_at) - # end - if booking.sale_id.nil? + table.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ").each do |booking| + if booking.sale_id.nil? order_array = [] booking.booking_orders.each do |booking_order| @@ -60,8 +57,7 @@ class Origami::SalesController < BaseOrigamiController booking.save order_array.push(order.order_id) - - end + end receipt_no = Sale.find(sale_id).receipt_no action_by = current_user.name @@ -77,10 +73,6 @@ class Origami::SalesController < BaseOrigamiController end end end - # if !sale_data.empty? - # InventoryJob.perform_now(self.id) - # InventoryDefinition.calculate_product_count(nil,sale_data) - end end -end +end \ No newline at end of file