Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -15,12 +15,16 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||
alert_time_min = 0
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'min'
|
||||
alert_time_min = (lookup_checkout_time[0][1]).to_i
|
||||
else
|
||||
alert_time_min = 15
|
||||
end
|
||||
if !lookup_checkout_time.empty?
|
||||
now = Time.now.utc
|
||||
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 <= now && now <= end_time
|
||||
alert_time_min = checkout_time[1].to_i
|
||||
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 }
|
||||
@@ -39,11 +43,12 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
if !lookup_checkout_time.empty?
|
||||
checkout_at = Time.now.utc
|
||||
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'hr'
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
|
||||
else
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
|
||||
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
|
||||
checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -54,22 +54,13 @@ class Api::OrdersController < Api::ApiController
|
||||
extra_time = ''
|
||||
|
||||
params[:order_items].each { |i|
|
||||
if i["item_instance_code"] == 'Extim60' || i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extim45' || i["item_instance_code"] == 'Extim15' || i["item_instance_code"] == 'Extie60' || i["item_instance_code"] == 'Extie30' || i["item_instance_code"] == 'Extie45' || i["item_instance_code"] == 'Extie15'
|
||||
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
|
||||
if i["item_instance_code"].include? "ext"
|
||||
is_extra_time = true
|
||||
if i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie30'
|
||||
t = Time.now
|
||||
time = 30*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
elsif i["item_instance_code"] == 'Extim15' || i["item_instance_code"] == 'Extie15'
|
||||
time = 15*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
elsif i["item_instance_code"] == 'Extim45' || i["item_instance_code"] == 'Extie45'
|
||||
time = 45*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
else
|
||||
t = Time.now
|
||||
time = 60*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
arr_exts = i["item_instance_code"].split("_")
|
||||
if arr_exts[1].match(/^(\d)+$/)
|
||||
time = arr_exts[1].to_i*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
@@ -16,15 +16,24 @@ class Oqs::EditController < BaseOqsController
|
||||
order_item.remark = remarks
|
||||
order_item.save
|
||||
|
||||
# print
|
||||
# assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
# # order queue stations
|
||||
# oqs = assigned_item.order_queue_station
|
||||
|
||||
# unique_code="OrderItemPdf"
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
# order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Updated)" )
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
|
||||
unique_code="OrderItemPdf"
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
end
|
||||
end
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Updated)" )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,61 +1,80 @@
|
||||
class Oqs::PrintController < ApplicationController
|
||||
# Print Order Item
|
||||
def print
|
||||
# unique_code="OrderItemPdf"
|
||||
# assigned_item_id = params[:id]
|
||||
# options = params[:options]
|
||||
# assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
# assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
unique_code="OrderItemPdf"
|
||||
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
end
|
||||
end
|
||||
|
||||
assigned_item_id = params[:id]
|
||||
options = params[:options]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
|
||||
# # order queue stations
|
||||
# oqs = assigned_item.order_queue_station
|
||||
# order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
||||
|
||||
# # Check Printed
|
||||
# print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
# Check Printed
|
||||
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
|
||||
# # print when complete click
|
||||
# print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
# order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
# order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, options )
|
||||
|
||||
# # update print status for completed same order items
|
||||
# assigned_items.each do |ai|
|
||||
# ai.print_status=true
|
||||
# ai.save
|
||||
# end
|
||||
# print when complete click
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, options )
|
||||
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
ai.print_status=true
|
||||
ai.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Print Order Details with booking id
|
||||
def print_order_summary
|
||||
# unique_code="OrderSummaryPdf"
|
||||
# assigned_item_id = params[:id]
|
||||
# table_name = params[:table_name]
|
||||
# assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
# assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
unique_code="OrderSummaryPdf"
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
unique_code="OrderSummarySlimPdf"
|
||||
end
|
||||
end
|
||||
|
||||
# # order queue stations
|
||||
# oqs = assigned_item.order_queue_station
|
||||
assigned_item_id = params[:id]
|
||||
table_name = params[:table_name]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
|
||||
# # Check Printed
|
||||
# print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
# # get dining
|
||||
# # dining = DiningFacility.find_by_name(table_name);
|
||||
# # booking = Booking.find_by_dining_facility_id(dining.id)
|
||||
# Check Printed
|
||||
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
|
||||
# # Get Booking ID
|
||||
# booking_id = BookingOrder.where("order_id='#{assigned_item.order_id}'").pluck(:booking_id)[0]
|
||||
|
||||
# # print when complete click
|
||||
# print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
# order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
# order_queue_printer.print_booking_summary(print_settings,oqs, booking_id, print_status)
|
||||
# get dining
|
||||
# dining = DiningFacility.find_by_name(table_name);
|
||||
# booking = Booking.find_by_dining_facility_id(dining.id)
|
||||
|
||||
# # update print status for completed same order items
|
||||
# assigned_items.each do |ai|
|
||||
# ai.print_status = true
|
||||
# ai.save
|
||||
# end
|
||||
# Get Booking ID
|
||||
booking_id = BookingOrder.where("order_id='#{assigned_item.order_id}'").pluck(:booking_id)[0]
|
||||
|
||||
# print when complete click
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_booking_summary(print_settings,oqs, booking_id, print_status)
|
||||
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
ai.print_status = true
|
||||
ai.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -67,20 +67,13 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
|
||||
items_arr = []
|
||||
JSON.parse(params[:order_items]).each { |i|
|
||||
if i["item_instance_code"] == 'Extim60' || i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extim45' || i["item_instance_code"] == 'Extim15' || i["item_instance_code"] == 'Extie60' || i["item_instance_code"] == 'Extie30' || i["item_instance_code"] == 'Extie45' || i["item_instance_code"] == 'Extie15'
|
||||
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
|
||||
if i["item_instance_code"].include? "ext"
|
||||
is_extra_time = true
|
||||
if i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie30'
|
||||
time = 30*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
elsif i["item_instance_code"] == 'Extim15' || i["item_instance_code"] == 'Extie15'
|
||||
time = 15*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
elsif i["item_instance_code"] == 'Extim45' || i["item_instance_code"] == 'Extie45'
|
||||
time = 45*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
else
|
||||
time = 60*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
arr_exts = i["item_instance_code"].split("_")
|
||||
if arr_exts[1].match(/^(\d)+$/)
|
||||
time = arr_exts[1].to_i*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
end
|
||||
end
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]}
|
||||
|
||||
@@ -3,12 +3,14 @@ class Origami::CheckInProcessController < BaseOrigamiController
|
||||
def check_in_process
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||
checkout_at = Time.now.utc
|
||||
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'hr'
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
|
||||
else
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
|
||||
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
|
||||
checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
|
||||
end
|
||||
end
|
||||
end
|
||||
@dining_facility = DiningFacility.find(params[:dining_id])
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Origami::HomeController < BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
before_action :set_dining, only: [:show]
|
||||
|
||||
def index
|
||||
|
||||
@@ -21,8 +21,6 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||
|
||||
Rails.logger.debug ENV["SERVER_MODE"]
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
# Print for First Bill to Customer
|
||||
unique_code = "ReceiptBillPdf"
|
||||
|
||||
@@ -54,27 +54,26 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
card_sett_trans.save()
|
||||
end
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
unique_code = "CloseCashierPdf"
|
||||
shop_details = Shop.find(1)
|
||||
#get tax
|
||||
shift_obj = ShiftSale.where('id =?',@shift.id)
|
||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||
#other payment details for mpu or visa like card
|
||||
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
|
||||
|
||||
# unique_code = "CloseCashierPdf"
|
||||
# shop_details = Shop.find(1)
|
||||
# #get tax
|
||||
# shift_obj = ShiftSale.where('id =?',@shift.id)
|
||||
# @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||
# #other payment details for mpu or visa like card
|
||||
# @other_payment = ShiftSale.get_by_shift_other_payment(@shift)
|
||||
# Calculate price_by_accounts
|
||||
@total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
|
||||
@total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
|
||||
@total_member_discount = ShiftSale.get_total_member_discount(@shift)
|
||||
# get printer info
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
# # Calculate price_by_accounts
|
||||
# @total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
|
||||
# @total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
|
||||
# @total_member_discount = ShiftSale.get_total_member_discount(@shift)
|
||||
# # get printer info
|
||||
# print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
printer = Printer::CashierStationPrinter.new(print_settings)
|
||||
|
||||
# printer = Printer::CashierStationPrinter.new(print_settings)
|
||||
|
||||
# printer.print_close_cashier(print_settings,cashier_terminal,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount)
|
||||
|
||||
|
||||
printer.print_close_cashier(print_settings,cashier_terminal,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount)
|
||||
end
|
||||
end
|
||||
Employee.logout(session[:session_token])
|
||||
session[:session_token] = nil
|
||||
|
||||
@@ -63,6 +63,7 @@ class Origami::VoidController < BaseOrigamiController
|
||||
|
||||
member_info = nil
|
||||
rebate_amount = nil
|
||||
current_balance = nil
|
||||
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
@@ -87,7 +88,9 @@ class Origami::VoidController < BaseOrigamiController
|
||||
if customer.membership_id != nil && rebate
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
|
||||
Reference in New Issue
Block a user