From 383aeded6088c2e4136572a2fc330572a40893eb Mon Sep 17 00:00:00 2001 From: phyusin Date: Thu, 1 Feb 2018 16:16:26 +0630 Subject: [PATCH] check checkedin exist in lookups and void - sale --- .../api/check_in_process_controller.rb | 5 ++-- .../origami/check_in_process_controller.rb | 26 +++++++++---------- app/controllers/origami/void_controller.rb | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/app/controllers/api/check_in_process_controller.rb b/app/controllers/api/check_in_process_controller.rb index 12075a50..a033c49a 100644 --- a/app/controllers/api/check_in_process_controller.rb +++ b/app/controllers/api/check_in_process_controller.rb @@ -25,9 +25,10 @@ class Api::CheckInProcessController < Api::ApiController alert_time_min = checkout_time[1].to_i end end + render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time, :alert_time_min => alert_time_min, :extra_minutes => extra_minutes } + else + render :json => { :status => true } end - - render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time, :alert_time_min => alert_time_min, :extra_minutes => extra_minutes } else render :json => { :status => false, :error_message => "No current booking!" } end diff --git a/app/controllers/origami/check_in_process_controller.rb b/app/controllers/origami/check_in_process_controller.rb index bab40a83..67191b6e 100644 --- a/app/controllers/origami/check_in_process_controller.rb +++ b/app/controllers/origami/check_in_process_controller.rb @@ -12,21 +12,21 @@ class Origami::CheckInProcessController < BaseOrigamiController checkout_at = checkout_at + (checkout_time[1]).to_i.minutes end end - end - @dining_facility = DiningFacility.find(params[:dining_id]) - @dining_facility.status = "occupied" - @dining_facility.save! - - if @dining_facility.type == "Table" - type = "TableBooking" - else - type = "RoomBooking" - end - @booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type, - :checkin_by=>current_login_employee.name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign", :reserved_at => checkout_at, :reserved_by => current_login_employee.name }) - @booking.save! + @dining_facility = DiningFacility.find(params[:dining_id]) + @dining_facility.status = "occupied" + @dining_facility.save! + if @dining_facility.type == "Table" + type = "TableBooking" + else + type = "RoomBooking" + end + + @booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type, + :checkin_by=>current_login_employee.name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign", :reserved_at => checkout_at, :reserved_by => current_login_employee.name }) + @booking.save! + end respond = {:status => 'ok'} respond_to do |format| format.json { render json: respond } diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index 0d368224..52b2068c 100755 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -87,7 +87,7 @@ class Origami::VoidController < BaseOrigamiController rebate = MembershipSetting.find_by_rebate(1) if customer.membership_id != nil && rebate member_info = Customer.get_member_account(customer) - rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) + rebate_amount = Customer.get_membership_transactions(customer,sale.receipt_no) current_balance = SaleAudit.paymal_search(sale_id) end