Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into split_bill
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -431,7 +431,9 @@
|
||||
|
||||
<!-- <button type="button" id="re-print" class="btn btn-block bg-blue waves-effect" >Re.Print</button> -->
|
||||
<% else %>
|
||||
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
|
||||
<% if !@checkout_time.empty? && !@checkout_alert_time.empty? %>
|
||||
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<button type="button" class="btn bg-default btn-block" id='back'><i class="material-icons">reply</i> <%= t("views.btn.back") %> </button>
|
||||
<button type="button" class="btn bg-blue btn-block green" id='close_cashier'> <%= t("views.btn.close_cashier") %> </button>
|
||||
<button type="button" class="btn bg-blue btn-block green" id="card_settlement"> <%= t("views.btn.card_settle") %> </button>
|
||||
<% if @bank_integration == '1' %>
|
||||
<button type="button" class="btn bg-blue btn-block green" id="card_settlement"> <%= t("views.btn.card_settle") %> </button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user