Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into split_bill

This commit is contained in:
phyusin
2018-02-01 18:04:17 +06:30
7 changed files with 60 additions and 38 deletions

View File

@@ -25,9 +25,10 @@ class Api::CheckInProcessController < Api::ApiController
alert_time_min = checkout_time[1].to_i alert_time_min = checkout_time[1].to_i
end end
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 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 else
render :json => { :status => false, :error_message => "No current booking!" } render :json => { :status => false, :error_message => "No current booking!" }
end end
@@ -41,31 +42,36 @@ class Api::CheckInProcessController < Api::ApiController
lookup_checkout_time = Lookup.collection_of("checkout_time") lookup_checkout_time = Lookup.collection_of("checkout_time")
if !lookup_checkout_time.empty? 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| lookup_checkout_time.each do |checkout_time|
arr_time = checkout_time[0].split("-") arr_time = checkout_time[0].split("-")
start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p") start_time = Time.parse(arr_time[0].strip).utc.getlocal.strftime("%H:%M%p")
end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p") end_time = Time.parse(arr_time[1].strip).utc.getlocal.strftime("%H:%M%p")
if start_time <= checkout_at && checkout_at <= end_time 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 checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
end end
end end
dining_facility.status = "occupied" if checkout_at.strftime("%Y-%m-%d %H:%M%p") > today.strftime("%Y-%m-%d %H:%M%p")
dining_facility.save! dining_facility.status = "occupied"
dining_facility.save!
if dining_facility.type == "Table" if dining_facility.type == "Table"
type = "TableBooking" 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 else
type = "RoomBooking" render :json => { :status => true }
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!
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") }
else else
render :json => { :status => true } render :json => { :status => true }
end end

View File

@@ -2,31 +2,34 @@ class Origami::CheckInProcessController < BaseOrigamiController
def check_in_process def check_in_process
lookup_checkout_time = Lookup.collection_of("checkout_time") 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? if !lookup_checkout_time.empty?
lookup_checkout_time.each do |checkout_time| lookup_checkout_time.each do |checkout_time|
arr_time = checkout_time[0].split("-") arr_time = checkout_time[0].split("-")
start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p") start_time = Time.parse(arr_time[0].strip).utc.getlocal.strftime("%H:%M%p")
end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p") end_time = Time.parse(arr_time[1].strip).utc.getlocal.strftime("%H:%M%p")
if start_time <= checkout_at && checkout_at <= end_time 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 checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
end end
end end
end
@dining_facility = DiningFacility.find(params[:dining_id]) if checkout_at.strftime("%Y-%m-%d %H:%M%p") > today.strftime("%Y-%m-%d %H:%M%p")
@dining_facility.status = "occupied" @dining_facility = DiningFacility.find(params[:dining_id])
@dining_facility.save! @dining_facility.status = "occupied"
@dining_facility.save!
if @dining_facility.type == "Table" if @dining_facility.type == "Table"
type = "TableBooking" type = "TableBooking"
else else
type = "RoomBooking" 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 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 = {:status => 'ok'}
respond_to do |format| respond_to do |format|
format.json { render json: respond } format.json { render json: respond }

View File

@@ -84,7 +84,10 @@ class Origami::HomeController < BaseOrigamiController
end end
end end
end end
#for bank integration
@checkout_time = Lookup.collection_of('checkout_time')
@checkout_alert_time = Lookup.collection_of('checkout_alert_time')
end end
private private

View File

@@ -4,6 +4,12 @@ class Origami::ShiftsController < BaseOrigamiController
def show def show
@shift = ShiftSale.current_open_shift(current_user.id) @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 end
def new def new

View File

@@ -87,7 +87,7 @@ class Origami::VoidController < BaseOrigamiController
rebate = MembershipSetting.find_by_rebate(1) rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate if customer.membership_id != nil && rebate
member_info = Customer.get_member_account(customer) 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) current_balance = SaleAudit.paymal_search(sale_id)
end end

View File

@@ -431,7 +431,9 @@
<!-- <button type="button" id="re-print" class="btn btn-block bg-blue waves-effect" >Re.Print</button> --> <!-- <button type="button" id="re-print" class="btn btn-block bg-blue waves-effect" >Re.Print</button> -->
<% else %> <% 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 %> <% end %>
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>"> <input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<span class="hidden" id="member_discount"><%= @membership.discount%></span> <span class="hidden" id="member_discount"><%= @membership.discount%></span>

View File

@@ -31,7 +31,9 @@
<div class="col-lg-2 col-md-2 col-sm-2"> <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-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='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>
</div> </div>