From b0886b685cfbaaa346d651f2fe80ff7ce55c5174 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 2 Aug 2017 12:14:03 +0630 Subject: [PATCH] update clone --- app/controllers/oqs/home_controller.rb | 2 +- .../origami/request_bills_controller.rb | 6 +- app/models/ability.rb | 4 + app/views/layouts/_header.html.erb | 2 + app/views/origami/home/show.html.erb | 9 +- .../origami/room_invoices/index.html.erb | 10 +- app/views/origami/room_invoices/show.html.erb | 13 ++- app/views/origami/rooms/show.html.erb | 17 ++-- app/views/origami/sales/show.html.erb | 6 +- .../origami/table_invoices/index.html.erb | 10 +- .../origami/table_invoices/show.html.erb | 13 ++- app/views/reports/void_sale/index.html.erb | 7 +- app/views/reports/void_sale/index.xls.erb | 92 ++++++++++++------- 13 files changed, 127 insertions(+), 64 deletions(-) diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb index d8731ecb..cef7c6b6 100644 --- a/app/controllers/oqs/home_controller.rb +++ b/app/controllers/oqs/home_controller.rb @@ -98,7 +98,7 @@ class Oqs::HomeController < BaseOqsController left join booking_orders as bo on bo.order_id = assigned_order_items.order_id left join bookings as bk on bk.booking_id = bo.booking_id left join dining_facilities as df on df.id = bk.dining_facility_id") - .where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0") + .where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}'") .group("assigned_order_items.assigned_order_item_id") .order("assigned_order_items.created_at") end diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 687c872f..7fa51da4 100644 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -5,7 +5,7 @@ class Origami::RequestBillsController < BaseOrigamiController @sale = Sale.new sale_order=SaleOrder.new - if ShiftSale.current_open_shift(current_user.id) + if shift = ShiftSale.current_open_shift(current_user.id) order_id = params[:id] # order_id bk_order = BookingOrder.find_by_order_id(order_id) check_booking = Booking.find_by_booking_id(bk_order.booking_id) @@ -20,6 +20,10 @@ class Origami::RequestBillsController < BaseOrigamiController @sale_data = Sale.find_by_sale_id(check_booking.sale_id) @sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id) end + + # Bind shift sale id to sale + @sale_data.shift_sale_id = shift.id + @sale_data.save else @status = false @error_message = "No Current Open Shift for This Employee" diff --git a/app/models/ability.rb b/app/models/ability.rb index 00bb5b2c..1938fb45 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -37,6 +37,8 @@ class Ability can :index, :saleitem can :index, :receipt_no can :index, :shiftsale + can :index, :credit_payment + can :index, :void_sale can :get_customer, Customer can :add_customer, Customer @@ -113,6 +115,8 @@ class Ability can :index, :saleitem can :index, :receipt_no can :index, :shiftsale + can :index, :credit_payment + can :index, :void_sale elsif user.role == "supervisour" diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 2a328cc9..904749e6 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -43,6 +43,8 @@
  • <%= link_to "Sales Item Report", reports_saleitem_index_path, :tabindex =>"-1" %>
  • <%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %>
  • <%= link_to "Shift Sale Report", reports_shiftsale_index_path, :tabindex =>"-1" %>
  • +
  • <%= link_to "Credit Sale Report", reports_credit_payment_index_path, :tabindex =>"-1" %>
  • +
  • <%= link_to "Void Sale Report", reports_void_sale_index_path, :tabindex =>"-1" %>