diff --git a/app/controllers/api/check_in_process_controller.rb b/app/controllers/api/check_in_process_controller.rb index 883fb1ea..6f32c613 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 @@ -41,31 +42,36 @@ class Api::CheckInProcessController < Api::ApiController lookup_checkout_time = Lookup.collection_of("checkout_time") if !lookup_checkout_time.empty? - checkout_at = Time.now.utc + today = Time.now.utc.getlocal + checkout_at = Time.now.utc.getlocal lookup_checkout_time.each do |checkout_time| arr_time = checkout_time[0].split("-") - start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p") - end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p") - if start_time <= checkout_at && checkout_at <= end_time + start_time = Time.parse(arr_time[0].strip).utc.getlocal.strftime("%H:%M%p") + end_time = Time.parse(arr_time[1].strip).utc.getlocal.strftime("%H:%M%p") + if start_time <= checkout_at.strftime("%H:%M%p") && checkout_at.strftime("%H:%M%p") <= end_time checkout_at = checkout_at + (checkout_time[1]).to_i.minutes end end - dining_facility.status = "occupied" - dining_facility.save! + if checkout_at.strftime("%Y-%m-%d %H:%M%p") > today.strftime("%Y-%m-%d %H:%M%p") + dining_facility.status = "occupied" + dining_facility.save! - if dining_facility.type == "Table" - type = "TableBooking" + 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! + + render :json => { :status => true, :checkout_at => booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") } else - type = "RoomBooking" + render :json => { :status => true } 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! - - render :json => { :status => true, :checkout_at => booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") } else render :json => { :status => true } end diff --git a/app/controllers/origami/check_in_process_controller.rb b/app/controllers/origami/check_in_process_controller.rb index 14d5c90c..2c5b0b38 100644 --- a/app/controllers/origami/check_in_process_controller.rb +++ b/app/controllers/origami/check_in_process_controller.rb @@ -2,31 +2,34 @@ class Origami::CheckInProcessController < BaseOrigamiController def check_in_process lookup_checkout_time = Lookup.collection_of("checkout_time") - checkout_at = Time.now.utc + today = Time.now.utc.getlocal + checkout_at = Time.now.utc.getlocal if !lookup_checkout_time.empty? lookup_checkout_time.each do |checkout_time| arr_time = checkout_time[0].split("-") - start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p") - end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p") - if start_time <= checkout_at && checkout_at <= end_time + start_time = Time.parse(arr_time[0].strip).utc.getlocal.strftime("%H:%M%p") + end_time = Time.parse(arr_time[1].strip).utc.getlocal.strftime("%H:%M%p") + if start_time <= checkout_at.strftime("%H:%M%p") && checkout_at.strftime("%H:%M%p") <= end_time 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 checkout_at.strftime("%Y-%m-%d %H:%M%p") > today.strftime("%Y-%m-%d %H:%M%p") + @dining_facility = DiningFacility.find(params[:dining_id]) + @dining_facility.status = "occupied" + @dining_facility.save! - if @dining_facility.type == "Table" - type = "TableBooking" - else - type = "RoomBooking" + 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 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! - respond = {:status => 'ok'} respond_to do |format| format.json { render json: respond } diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index 536defe7..c00b39bf 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -84,7 +84,10 @@ class Origami::HomeController < BaseOrigamiController end end end - + + #for bank integration + @checkout_time = Lookup.collection_of('checkout_time') + @checkout_alert_time = Lookup.collection_of('checkout_alert_time') end private diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb index 6d0fbe02..cb2cc830 100755 --- a/app/controllers/origami/shifts_controller.rb +++ b/app/controllers/origami/shifts_controller.rb @@ -4,6 +4,12 @@ class Origami::ShiftsController < BaseOrigamiController def show @shift = ShiftSale.current_open_shift(current_user.id) + #for bank integration + bank_integration = Lookup.collection_of('bank_integration') + @bank_integration = 0 + if !bank_integration[0].nil? + @bank_integration = bank_integration[0][1] + end end def new 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 diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 4f81116d..bc068a1d 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -431,7 +431,9 @@ <% else %> - + <% if !@checkout_time.empty? && !@checkout_alert_time.empty? %> + + <% end %> <% end %> "> <%= @membership.discount%> diff --git a/app/views/origami/shifts/show.html.erb b/app/views/origami/shifts/show.html.erb index f2ee019e..4ea71dec 100755 --- a/app/views/origami/shifts/show.html.erb +++ b/app/views/origami/shifts/show.html.erb @@ -31,7 +31,9 @@