food court and Booking ID for order and receipt

This commit is contained in:
phyusin
2018-10-08 17:41:22 +06:30
parent 5535a5db81
commit 03fd7c79b8
44 changed files with 1155 additions and 378 deletions

View File

@@ -193,6 +193,7 @@ For MoveTablePdf in print settings
1) settings/lookups => { type:tax_profiles, name: Cashier, value:cashier }
2) settings/lookups => { type:tax_profiles, name: Quick Service, value: quick_service }
3) settings/lookups => { type:tax_profiles, name: Doemal, value: doemal }
4) settings/lookups => { type:tax_profiles, name: Food Court, value: food_court }
/* Tax Profile Group Types in lookups */
/*Receipt Pdf View in lookups */
@@ -261,6 +262,13 @@ For Food Court Settings On/Off
** '0' means can not use food court and '1' means can use food court **
=> settings/lookups => { type:food_court, name: FoodCourt, value:'{0 or 1}' }
/* Customer Types in lookups */
1) settings/lookups => { type:customer_type, name: Dinein, value:Dinein }
2) settings/lookups => { type:customer_type, name: Takeaway, value: Takeaway }
3) settings/lookups => { type:customer_type, name: Doemal, value: Doemal }
4) settings/lookups => { type:customer_type, name: FoodCourt, value: FoodCourt }
/* Tax Profile Group Types in lookups */
* ToDo list
1. Migration

View File

@@ -2,7 +2,7 @@ $(function() {
var role = $('#role').val();
var second_display_lookup = $("#display_type");
console.log(second_display_lookup)
type = window.location.href.indexOf("quick_service");
type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court");
modify_order = window.location.href.indexOf("modify_order");
//click menu sidebar menu category
@@ -146,7 +146,7 @@ $(function() {
}
}else{
type = window.location.href.indexOf("quick_service");
type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court");
modify_order = window.location.href.indexOf("modify_order");
if (type != -1 && modify_order != -1) {
@@ -155,7 +155,7 @@ $(function() {
url_item = 'addorders/'+url_item;
}
if (type ==-1 && modify_order == -1){
url_item = url_item
url_item = url_item;
}
//Start Ajax
@@ -241,7 +241,7 @@ $(function() {
}
}
}else{
type = window.location.href.indexOf("quick_service");
type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court");
modify_order = window.location.href.indexOf("modify_order");
if (type != -1 && modify_order != -1) {
url = '../../../addorders/get_item_instance/'+value[i]["id"];
@@ -848,17 +848,18 @@ $(function() {
$(this).attr('disabled', 'disabled');
e.preventDefault();
$("#oqs_loading_wrapper").show();
var cashier_type = $("#link_type").val();
quick_service = window.location.href.indexOf("quick_service");
if (quick_service != -1) {
type = 'quick_service'
food_court = window.location.href.indexOf("food_court");
if (quick_service != -1 || food_court != -1) {
type = cashier_type;
var table_type = $('#table_type').text();
var table_id = $('#table_id').val();
var customer_id = $('#customer_id').val();
var booking_id = $('#booking_id').text();
var ajax_url = 'addorders/create';
}else{
type = 'cashier'
type = 'cashier';
var table_type = $('#table_type').text();
var table_id = $('#table_id').text();
var customer_id = $('#customer_id').text();
@@ -886,14 +887,14 @@ $(function() {
data: params,
dataType: "json",
success:function(result){
if (type == "quick_service") {
window.location.href = "/origami/quick_service"
if (type == "quick_service" || type=="food_court") {
window.location.href = "/origami/"+type;
}else{
if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id
window.location.href = "/origami/table/" + table_id;
}
else {
window.location.href = "/origami/room/" + table_id
window.location.href = "/origami/room/" + table_id;
}
}
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
@@ -914,11 +915,11 @@ $(function() {
$("#create_pay_order").on('click', function(e){
$(this).attr('disabled', 'disabled');
e.preventDefault();
type = "quick_service"
type = $("#link_type").val();
modify_order = window.location.href.indexOf("modify_order");
$("#oqs_loading_wrapper").show();
if (modify_order !=-1) {
var ajax_url = '../../../quick_service/update_modify_order';
var ajax_url = '../../../'+type+'/update_modify_order';
var table_type = $('#table_type').text();
var table_id = $('#table_id').text();
var customer_id = $('#customer_id').text();
@@ -962,13 +963,13 @@ $(function() {
confirmButtonText: "Ok",
closeOnConfirm: false
}, function () {
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text();
});
}else if(result.data == 'OK'){
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text();
}else{
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment";
}
}
}
@@ -1096,13 +1097,14 @@ $(function() {
$("#back").on("click", function(){
var table_id = $('#table_id').text();
var table_type = $('#table_type').text();
type = window.location.href.includes("quick_service");
var cashier_type = $("#link_type").val();
type = window.location.href.includes("quick_service") || window.location.href.includes("food_court");
if (type == true) {
var table_type = $('#table_id').find("option:selected").data('type');
var table_id = $('#table_id').val();
if(window.location.href.includes("modify_order")){
var link_url = window.location.href.split("/");
window.location.href = "/origami/quick_service/pending_order/"+link_url[link_url.length - 1];
window.location.href = "/origami/"+cashier_type+"/pending_order/"+link_url[link_url.length - 1];
}else{
window.location.href = "/origami/dashboard";
}

View File

@@ -9,16 +9,18 @@ App.order = App.cable.subscriptions.create('BillChannel', {
var hostname = location.hostname.trim();
if(data.from == "" || hostname == data.from)
{
if($('.table_'+data.table.id).hasClass('blue')){
$('.table_'+data.table.id).removeClass('blue');
$('.table_'+data.table.id).removeClass('green');
$('.table_'+data.table.id).addClass('red');
}else{
$('.table_'+data.table.id).removeClass('orange');
$('.table_'+data.table.id).addClass('red');
}
$('.new_text_'+data.table.id).removeClass('hide');
$('.new_text_'+data.table.id).text('billed');
if(data.table != undefined && data.table != null && data.table!=""){
if($('.table_'+data.table.id).hasClass('blue')){
$('.table_'+data.table.id).removeClass('blue');
$('.table_'+data.table.id).removeClass('green');
$('.table_'+data.table.id).addClass('red');
}else{
$('.table_'+data.table.id).removeClass('orange');
$('.table_'+data.table.id).addClass('red');
}
$('.new_text_'+data.table.id).removeClass('hide');
$('.new_text_'+data.table.id).text('billed');
}
}
}
});

View File

@@ -228,6 +228,7 @@ function getOnlineOrderCount(){
url: "/origami/get_order_info",
dataType: "json",
success: function(data){
console.log(data);
if(parseInt(data) > 0){
count = parseInt(data);
}

View File

@@ -14,6 +14,7 @@ class Origami::AddordersController < BaseOrigamiController
end
def detail
@cashier_type = params[:type]
@webview = false
if check_mobile
@webview = true
@@ -194,7 +195,7 @@ class Origami::AddordersController < BaseOrigamiController
end
if params[:order_source] != "quick_service"
if params[:order_source] != "quick_service" && params[:order_source] != "food_court"
process_order_queue(@order.order_id,@order.table_id,@order.source)
end
end
@@ -202,13 +203,16 @@ class Origami::AddordersController < BaseOrigamiController
# Order.send_customer_view(@booking)
if current_user.role != "waiter" && params[:create_type] == "create_pay"
if @status && @booking && @order.source == 'quick_service'
if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court')
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
# for second display
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
#end
if @order.source == 'quick_service'
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
end
#end
result = {:status=> @status, :data => @sale }
render :json => result.to_json
end

View File

@@ -59,6 +59,16 @@ class Origami::DashboardController < BaseOrigamiController
if !quick_service[0].nil?
@quick_service = quick_service[0][1]
end
#fourt court
food_court = Lookup.collection_of('food_court')
@food_court = 0
@food_court_name = nil
if !food_court[0].nil?
@food_court = food_court[0][1]
@food_court_name = food_court[0][0]
end
#order reservation
order_reservation = Lookup.collection_of('order_reservation')
@order_reservation = 0

View File

@@ -0,0 +1,262 @@
class Origami::FoodCourtController < ApplicationController
# before_action :set_dining, only: [:detail]
before_action :check_user
def check_user
if current_user.nil?
redirect_to root_path
end
end
def index
today = DateTime.now
day = Date.today.wday
# if params[:menu] == "true"
@menus = []
@menu = []
# else
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
@zone = Zone.all
@customer = Customer.all
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@cashier_type = "food_court"
#checked quick_service only
@quick_service_only = true
lookup_dine_in = Lookup.collection_of('dinein_cashier')
if !lookup_dine_in.empty?
lookup_dine_in.each do |dine_in|
if dine_in[0].downcase == "dineincashier"
if dine_in[1] == '1'
@quick_service_only = false
end
end
end
end
render "origami/addorders/detail"
end
def modify_order
@cashier_type = "food_court"
today = DateTime.now
day = Date.today.wday
# if params[:menu] == "true"
@menus = []
@menu = []
# else
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
if(params[:id][0,3] == "BKI")
@table_id = nil
@table = nil
@booking = Booking.find(params[:id])
else
@table_id = params[:id]
@table = DiningFacility.find(@table_id)
@booking = @table.get_booking
end
@sale_id = params[:sale_id]
if @booking
@booking_id = @booking.booking_id
@order_items = Array.new
@booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
if (order.status == "new")
@obj_order = order
@customer = order.customer
@date = order.created_at
order.order_items.each do |item|
@order_items.push(item)
end
end
end
else
@booking = nil
end
render "origami/addorders/detail"
end
def update_modify_order
Rails.logger.debug "Order Source - " + params[:order_source].to_s
Rails.logger.debug "Table ID - " + params[:table_id].to_s
is_extra_time = false
extra_time = ''
@cashier_type = "food_court"
items_arr = []
JSON.parse(params[:order_items]).each { |i|
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
if i["item_instance_code"].include? "ext"
is_extra_time = true
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
if i["parent_order_item_id"]
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": i["options"]}
else
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]}
end
items_arr.push(items)
}
# begin
@order = Order.new
@order.source = params[:order_source]
@order.order_type = params[:order_type]
@order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
@order.items = items_arr
@order.guest = params[:guest_info]
@order.table_id = params[:table_id] # this is dining facilities's id
@order.new_booking = true
@order.waiters = current_login_employee.name
@order.employee_name = current_login_employee.name
@order.is_extra_time = is_extra_time
@order.extra_time = extra_time
#Create Table Booking or Room Booking
if !params["booking_id"].nil?
# check booking id is already completed.
booking = Booking.find(params[:booking_id])
if params[:table_id].to_i > 0
table_status = booking.dining_facility_id.to_i == params[:table_id].to_i
else
table_status = true
end
if booking
if table_status && booking.booking_status != 'moved'
if !booking.sale_id.nil?
sale_status = check_order_with_booking(booking)
if sale_status
return return_json_status_with_code(400, "bill requested")
end
else
@order.new_booking = false
@order.booking_id = params[:booking_id]
end
else
if params[:table_id].to_i > 0
sale_status = check_order_with_table(params[:table_id])
if sale_status
return return_json_status_with_code(400, "bill requested")
end
end
end
end #booking exists
else
if params[:table_id].to_i > 0
sale_status = check_order_with_table(params[:table_id])
if sale_status
# return false , @message = "bill requested"
return return_json_status_with_code(400, "bill requested")
end
end
end
@status, @booking = @order.generate
if(params[:sale_id][0,3] == "SAL")
if @status && @booking && (@order.source == 'quick_service' || @order.source == 'food_court')
if params[:sale_id]
@sale = Sale.find(params[:sale_id])
if @order.table_id.to_i > 0
@table_id = @order.table_id
else
@table_id = nil
end
update = Sale.add_to_existing_pending_invoice(@table_id,params[:sale_id],@booking)
end
result = {:status=> true, :data => @sale }
render :json => result.to_json
end
elsif (params[:sale_id][0,3] == "BKI")
result = {:status=> true, :data => 'OK' }
render :json => result.to_json
else
result = {:status=> true, :data => nil }
render :json => result.to_json
end
end
def get_menu_category ()
if (params[:id])
puts params[:id]
#Pull this menu
@menu = MenuCategory.find_by_id(params[:id])
# puts @menu.menu_items[1].item_attributes.to_json
return @menu
else
MenuCategory.current_menu
end
end
def get_menu_sub_category ()
id = params[:id]
if (id)
#Pull this menu
@sub_menu = MenuCategory.where("menu_category_id = #{id}").active
# puts @menu.menu_items[1].item_attributes.to_json
return @sub_menu
end
end
def get_all_product()
@product = Product.all
end
# render json for http status code
def return_json_status_with_code(code, msg)
render status: code, json: {
message: msg,
booking_id: booking_id
}.to_json
end
def check_order_with_table(table_id)
table = DiningFacility.find(table_id)
if table
booking = table.get_current_booking
# puts booking
if booking
if !booking.sale_id.nil?
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
@order.new_booking = true
return false
end
else
@order.new_booking = false
@order.booking_id = booking.booking_id
return false
end
end
end
end
def check_user
if current_user.nil?
redirect_to root_path
end
end
# this can always true
def check_order_with_booking(booking)
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
@order.new_booking = true
return false
else
@order.new_booking = false
@order.booking_id = params[:booking_id]
return false
end
end
end

View File

@@ -1,68 +1,66 @@
class Origami::PaymalController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
payment_method = params[:payment_method]
@cashier_type = params[:type]
@membership_rebate_balance=0
sale_data = Sale.find_by_sale_id(@sale_id)
@receipt_no = sale_data.receipt_no
@shop = Shop.first
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
new_total = sale_data.grand_total
end
@rounding_adj = new_total-sale_data.grand_total
# @rounding_adj = sale_data.rounding_adjustment
@sale_id = params[:sale_id]
payment_method = params[:payment_method]
@cashier_type = params[:type]
@membership_rebate_balance=0
sale_data = Sale.find_by_sale_id(@sale_id)
@receipt_no = sale_data.receipt_no
@shop = Shop.first
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
new_total = sale_data.grand_total
end
@rounding_adj = new_total-sale_data.grand_total
# @rounding_adj = sale_data.rounding_adjustment
@payparcount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "paypar"
@payparcount = @payparcount + sale_payment.payment_amount
@payparcount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "paypar"
@payparcount = @payparcount + sale_payment.payment_amount
else
others = others + sale_payment.payment_amount
end
end
@payment_prices = sale_data.grand_total - @payparcount -others
if sale_data
if sale_data.customer_id
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
if customer_data
@membership_id = customer_data.membership_id
if !@membership_id.nil?
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
if membership_setting.gateway_url
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
if member_actions.gateway_url
@campaign_type_id = nil
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
merchant_uid= member_actions.merchant_account_id
auth_token = member_actions.auth_token.to_s
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
if membership_data["status"]==true
@membership_rebate_balance=membership_data["balance"]
@out = true, @membership_rebate_balance,@membership_id
end
else
others = others + sale_payment.payment_amount
@out =false,0
end
end
@payment_prices = sale_data.grand_total - @payparcount -others
if sale_data
if sale_data.customer_id
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
if customer_data
@membership_id = customer_data.membership_id
if !@membership_id.nil?
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
if membership_setting.gateway_url
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
if member_actions.gateway_url
@campaign_type_id = nil
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
merchant_uid= member_actions.merchant_account_id
auth_token = member_actions.auth_token.to_s
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
if membership_data["status"]==true
@membership_rebate_balance=membership_data["balance"]
@out = true, @membership_rebate_balance,@membership_id
end
else
@out =false,0
end
else
else
@out = false,0
end
else
@out = false, 0
end
else
@out = false, 0
end
else
@out = false, 0
end
else
@out = false, 0
end
else
@out = false, 0
end
else
@out = false, 0
end

View File

@@ -271,7 +271,8 @@ class Origami::PaymentsController < BaseOrigamiController
end
@member_discount = MembershipSetting.find_by_discount(1)
@membership_rebate_balance=0
if Sale.exists?(sale_id)
@cash = 0.0
@other = 0.0
@@ -399,6 +400,8 @@ class Origami::PaymentsController < BaseOrigamiController
#end customer amount
#paymal payment
@sale_data.bookings.each do |sbk|
if sbk.dining_facility_id.to_i >0
df = DiningFacility.find(sbk.dining_facility_id)

View File

@@ -2,17 +2,21 @@ class Origami::PendingOrderController < BaseOrigamiController
def index
# @dining= DiningFacility.where("status = 'occupied'")
# @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d'))
@sale = Sale.pending_sale
@order = Sale.pending_order
@completed = Sale.completed_sale("quick_service")
@cashier_type = params[:type]
@sale = Sale.pending_sale(@cashier_type)
@order = Sale.pending_order(@cashier_type)
@completed = Sale.completed_sale(@cashier_type)
@customers = Customer.pluck("customer_id, name")
@occupied_table = @sale.count.length + @order.count.length
end
def show
@sales = Sale.pending_sale
@orders = Sale.pending_order
@completed = Sale.completed_sale("quick_service")
@cashier_type = params[:type]
@sales = Sale.pending_sale(@cashier_type)
@orders = Sale.pending_order(@cashier_type)
@completed = Sale.completed_sale(@cashier_type)
@customers = Customer.pluck("customer_id, name")
@occupied_table = @sales.count.length + @orders.count.length
@@ -51,9 +55,10 @@ class Origami::PendingOrderController < BaseOrigamiController
end
def completed_sale
@sales = Sale.pending_sale
@orders = Sale.pending_order
@completed = Sale.completed_sale("quick_service")
@cashier_type = params[:type]
@sales = Sale.pending_sale(@cashier_type)
@orders = Sale.pending_order(@cashier_type)
@completed = Sale.completed_sale(@cashier_type)
@customers = Customer.pluck("customer_id, name")
@occupied_table = @sales.count.length + @orders.count.length
@@ -76,16 +81,19 @@ class Origami::PendingOrderController < BaseOrigamiController
end
def cash_ins
@cashier_type = params[:type]
render "origami/cash_ins/new"
end
def cash_outs
@cashier_type = params[:type]
render "origami/cash_outs/new"
end
def credit_sale
@sales = Sale.pending_sale
@orders = Sale.pending_order
@completed = Sale.completed_sale("quick_service")
@cashier_type = params[:type]
@sales = Sale.pending_sale(@cashier_type)
@orders = Sale.pending_order(@cashier_type)
@completed = Sale.completed_sale(@cashier_type)
@occupied_table = @sales.count.length + @orders.count.length

View File

@@ -21,7 +21,7 @@ class Origami::QuickServiceController < ApplicationController
@customer = Customer.all
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@cashier_type = "quick_service"
#checked quick_service only
@quick_service_only = true
lookup_dine_in = Lookup.collection_of('dinein_cashier')
@@ -39,6 +39,7 @@ class Origami::QuickServiceController < ApplicationController
end
def modify_order
@cashier_type = "quick_service"
today = DateTime.now
day = Date.today.wday
# if params[:menu] == "true"
@@ -85,6 +86,7 @@ class Origami::QuickServiceController < ApplicationController
Rails.logger.debug "Table ID - " + params[:table_id].to_s
is_extra_time = false
extra_time = ''
@cashier_type = "quick_service"
items_arr = []
JSON.parse(params[:order_items]).each { |i|

View File

@@ -62,8 +62,10 @@ class Origami::RequestBillsController < ApplicationController
from = ""
end
ActionCable.server.broadcast "bill_channel",table: table, from: from
if order.source == "quick_service"
if order.source == "cashier" || order.source == "quick_service"
ActionCable.server.broadcast "bill_channel",table: table, from: from
end
if order.source == "quick_service" || order.source == "food_court"
result = {:status=> @status, :data => @sale.sale_id }
render :json => result.to_json
else

View File

@@ -64,7 +64,7 @@ class Origami::SurveysController < BaseOrigamiController
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(shift.cashier_terminal_id,nil)
end
if @type == "quick_service"
if @type == "quick_service" || @type == "food_court"
@url = "/origami/sale/"+@sale_id+"/"+@type+"/payment"
else
@url = "/origami/"+@dining_facility.type.downcase+"/"+params[:table_id]

View File

@@ -2889,18 +2889,18 @@ end
end
end
def self.pending_sale
def self.pending_sale(type)
query = Sale.all
query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id")
.joins("join orders as orders on orders.order_id = sale_orders.order_id")
query = query.where("sales.sale_status = 'new' AND orders.status = 'billed' AND orders.source =? ","quick_service")
query = query.where("sales.sale_status = 'new' AND orders.status = 'billed' AND orders.source =? ","#{type}")
.group("sales.sale_id")
end
def self.pending_order
def self.pending_order(type)
query = Booking.all
query = query.joins("join booking_orders as booking_orders on booking_orders.booking_id = bookings.booking_id")
.joins("join orders as orders on orders.order_id = booking_orders.order_id")
query = query.where("bookings.booking_status = 'assign' AND orders.status = 'new' AND orders.source =? ","quick_service")
query = query.where("bookings.booking_status = 'assign' AND orders.status = 'new' AND orders.source =? ","#{type}")
.group("bookings.booking_id")
end
def self.completed_sale(type)

View File

@@ -52,6 +52,15 @@ class OrderItemCustomisePdf < Prawn::Document
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left
@@ -142,4 +151,12 @@ class OrderItemCustomisePdf < Prawn::Document
end
end
def get_booking_id(order_no)
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
.joins(" JOIN orders o ON o.order_id=bo.order_id")
.where("o.order_id='#{order_no}'")
.first()
return booking.booking_id
end
end

View File

@@ -50,7 +50,16 @@ class OrderItemPdf < Prawn::Document
end
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
end
move_down 2
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no}", :size => self.item_font_size,:align => :left
@@ -141,4 +150,12 @@ class OrderItemPdf < Prawn::Document
end
end
def get_booking_id(order_no)
booking = Order.joins(" JOIN booking_orders bo ON bo.order_id = orders.order_id")
.joins(" JOIN bookings b ON b.booking_id=bo.booking_id")
.where("orders.order_id='#{order_no}'")
.first()
return booking.booking_id
end
end

View File

@@ -52,6 +52,15 @@ class OrderItemSlimCustomisePdf < Prawn::Document
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.item_slim_font_size,:align => :left
@@ -141,4 +150,13 @@ class OrderItemSlimCustomisePdf < Prawn::Document
end
end
end
def get_booking_id(order_no)
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
.joins(" JOIN orders o ON o.order_id=bo.order_id")
.where("o.order_id='#{order_no}'")
.first()
return booking.booking_id
end
end

View File

@@ -51,6 +51,15 @@ class OrderItemSlimPdf < Prawn::Document
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
@@ -140,4 +149,13 @@ class OrderItemSlimPdf < Prawn::Document
end
end
def get_booking_id(order_no)
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
.joins(" JOIN orders o ON o.order_id=bo.order_id")
.where("o.order_id='#{order_no}'")
.first()
return booking.booking_id
end
end

View File

@@ -51,6 +51,15 @@ class OrderSetItemCustomisePdf < Prawn::Document
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left
@@ -157,4 +166,13 @@ class OrderSetItemCustomisePdf < Prawn::Document
end
end
def get_booking_id(order_no)
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
.joins(" JOIN orders o ON o.order_id=bo.order_id")
.where("o.order_id='#{order_no}'")
.first()
return booking.booking_id
end
end

View File

@@ -50,6 +50,15 @@ class OrderSetItemPdf < Prawn::Document
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
end
move_down 2
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
@@ -143,17 +152,26 @@ class OrderSetItemPdf < Prawn::Document
end
#add updated qty text
def add_updated_qty_text(before_updated_qty, updated_qty, precision)
if before_updated_qty.to_i > 0 && !before_updated_qty.nil?
move_down 5
#add updated qty text
def add_updated_qty_text(before_updated_qty, updated_qty, precision)
if before_updated_qty.to_i > 0 && !before_updated_qty.nil?
move_down 5
# add option
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
# add option
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
end
end
end
end
def get_booking_id(order_no)
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
.joins(" JOIN orders o ON o.order_id=bo.order_id")
.where("o.order_id='#{order_no}'")
.first()
return booking.booking_id
end
end

View File

@@ -55,7 +55,16 @@ class OrderSummaryCustomisePdf < Prawn::Document
end
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left
@@ -144,4 +153,13 @@ class OrderSummaryCustomisePdf < Prawn::Document
# end
end
end
def get_booking_id(order_no)
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
.joins(" JOIN orders o ON o.order_id=bo.order_id")
.where("o.order_id='#{order_no}'")
.first()
return booking.booking_id
end
end

View File

@@ -54,7 +54,16 @@ class OrderSummaryPdf < Prawn::Document
end
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
end
move_down 5
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
@@ -154,4 +163,13 @@ class OrderSummaryPdf < Prawn::Document
# end
end
end
def get_booking_id(order_no)
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
.joins(" JOIN orders o ON o.order_id=bo.order_id")
.where("o.order_id='#{order_no}'")
.first()
return booking.booking_id
end
end

View File

@@ -55,6 +55,15 @@ class OrderSummarySetCustomisePdf < Prawn::Document
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left
@@ -159,4 +168,13 @@ class OrderSummarySetCustomisePdf < Prawn::Document
# end
end
end
def get_booking_id(order_no)
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
.joins(" JOIN orders o ON o.order_id=bo.order_id")
.where("o.order_id='#{order_no}'")
.first()
return booking.booking_id
end
end

View File

@@ -54,6 +54,15 @@ class OrderSummarySetPdf < Prawn::Document
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
end
move_down 5
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
@@ -169,4 +178,13 @@ class OrderSummarySetPdf < Prawn::Document
# end
end
end
def get_booking_id(order_no)
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
.joins(" JOIN orders o ON o.order_id=bo.order_id")
.where("o.order_id='#{order_no}'")
.first()
return booking.booking_id
end
end

View File

@@ -54,7 +54,16 @@ class OrderSummarySlimCustomisePdf < Prawn::Document
end
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.item_slim_font_size,:align => :left
@@ -145,4 +154,13 @@ class OrderSummarySlimCustomisePdf < Prawn::Document
# end
end
end
def get_booking_id(order_no)
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
.joins(" JOIN orders o ON o.order_id=bo.order_id")
.where("o.order_id='#{order_no}'")
.first()
return booking.booking_id
end
end

View File

@@ -54,6 +54,15 @@ class OrderSummarySlimPdf < Prawn::Document
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
@@ -152,4 +161,13 @@ class OrderSummarySlimPdf < Prawn::Document
# end
end
end
def get_booking_id(order_no)
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
.joins(" JOIN orders o ON o.order_id=bo.order_id")
.where("o.order_id='#{order_no}'")
.first()
return booking.booking_id
end
end

View File

@@ -118,12 +118,17 @@ class ReceiptBillA5Pdf < Prawn::Document
end
def cashier_info(sale_data, customer_name, latest_order_no)
move_down line_move
text "Booking : #{ sale_data.bookings[0].booking_id }", :size => self.header_font_size+5,:align => :left
move_down line_move
move_down line_move
if !latest_order_no.nil?
move_down line_move
text "OrderNo : #{ latest_order_no }", :size => self.header_font_size,:align => :left
text "OrderNo : #{ latest_order_no }", :size => self.header_font_size+2,:align => :left
end
move_down line_move
# move_down 2
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do

View File

@@ -118,12 +118,17 @@ class ReceiptBillPdf < Prawn::Document
end
def cashier_info(sale_data, customer_name, latest_order_no)
move_down line_move
text "Booking : #{ sale_data.bookings[0].booking_id }", :size => self.header_font_size+2,:align => :left
move_down line_move
move_down line_move
if !latest_order_no.nil?
move_down line_move
text "OrderNo : #{ latest_order_no }", :size => self.header_font_size,:align => :left
text "OrderNo : #{ latest_order_no }", :size => self.header_font_size+2,:align => :left
end
move_down line_move
# move_down 2
y_position = cursor
bounding_box([0,y_position], :width =>self.description_width + self.price_num_width, :height => self.item_height) do

View File

@@ -2,7 +2,7 @@
<%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %>
<% type = request.path_info.include?('quick_service')%>
<% type = request.path_info.include?('quick_service') || request.path_info.include?('food_court')%>
<% modify_order = request.path_info.include?('modify_order')%>
<div class="container-fluid " style="padding:0px 3px 0px 3px;">
@@ -11,6 +11,7 @@
</div>
<input type="hidden" name="type" id="role" value="<%= current_user.role%>">
<input type="hidden" name="cashier_type" id="cashier_type" value="<%= type%>">
<input type="hidden" name="link_type" id="link_type" value="<%= @cashier_type %>">
<input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>">
<div class="row m-t--20">
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_data">
@@ -650,7 +651,7 @@
});
$('#pending_order').on('click', function () {
window.location.href = '/origami/quick_service/pending_order';
window.location.href = '/origami/'+'<%= @cashier_type %>'+'/pending_order';
});
$(document).on('click', '.menu_click', function(event){

View File

@@ -56,7 +56,7 @@
</div>
<script>
cashier_type = window.location.href.indexOf("quick_service");
cashier_type = '<%= @cashier_type %>';
console.log(cashier_type)
var payment_method = "";
@@ -83,19 +83,19 @@
url: "<%= origami_cash_ins_path %>",
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount + "&payment_method="+payment_method + "&payment_method_reference="+ payment_method_reference,
success:function(result){
if (cashier_type == -1) {
window.location.href = '/origami';
if (cashier_type == 'quick_service' || cashier_type == 'food_court') {
window.location.href = '/origami/'+cashier_type+'/pending_order';
}else{
window.location.href = '/origami/quick_service/pending_order';
window.location.href = '/origami';
}
}
});
})
$('#back').on('click',function(){
if (cashier_type == -1) {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service/pending_order';
}
if (cashier_type == 'quick_service' || cashier_type == 'food_court') {
window.location.href = '/origami/'+cashier_type+'/pending_order';
}else{
window.location.href = '/origami';
}
})
</script>

View File

@@ -25,7 +25,7 @@
</div>
</div>
<script>
cashier_type = window.location.href.indexOf("quick_service");
cashier_type = '<%= @cashier_type %>';
$('#cash_out').on('click',function(){
var reference = $('#reference').val();
var remark = $('#remark').val();
@@ -34,22 +34,20 @@
url: "<%= origami_cash_outs_path %>",
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount,
success:function(result){
if (cashier_type == -1) {
window.location.href = '/origami';
if (cashier_type == 'quick_service' || cashier_type == 'food_court') {
window.location.href = '/origami/'+cashier_type+'/pending_order';
}else{
window.location.href = '/origami/quick_service/pending_order';
window.location.href = '/origami';
}
}
});
})
$('#back').on('click',function(){
cashier_type = window.location.href.indexOf("quick_service");
if (cashier_type == -1) {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service/pending_order';
}
if (cashier_type == 'quick_service' || cashier_type == 'food_court') {
window.location.href = '/origami/'+cashier_type+'/pending_order';
}else{
window.location.href = '/origami';
}
})
</script>

View File

@@ -120,7 +120,7 @@
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
<input type="hidden" id="table_type" name="table_type" value="<%= @dining_facility.type %>" />
<% elsif @cashier_type == 'quick_service' %>
<% elsif @cashier_type == 'quick_service' || @cashier_type == "food_court" %>
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
<input type="hidden" id="page" name="page" value="<%= @page %>" />
@@ -643,7 +643,7 @@
<% if !@booking_order.nil? %>
booking_id = "<%= @booking_order.booking_id %>";
<% end %>
if (cashier_type == "quick_service") {
if (cashier_type == "quick_service" || cashier_type == "food_court") {
if(booking_id!= "" && page == "pending"){
window.location.href = '/origami/'+cashier_type+'/pending_order/'+booking_id;
}else{
@@ -673,7 +673,7 @@
var id = $("#table_id").val();
var type = $("#table_type").val();
var sale_id = $("#sale_id").val();
if (cashier_type == "quick_service") {
if (cashier_type == "quick_service" || cashier_type == "food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(page == "pending"){

View File

@@ -31,6 +31,16 @@
</div>
</div>
<% end %>
<% if @food_court == '1' %>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 fc_view">
<div class="info-box bg-pink">
<div class="icon" >
<i class="material-icons">arrow_forward</i>
</div>
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= @food_court_name %></div>
</div>
</div>
<% end %>
<% if @dinein_cashier == '1' %>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 cashier_view">
<div class="info-box bg-green">
@@ -242,6 +252,19 @@ $(function() {
window.location.href = '/origami/quick_service';
});
$(".fc_view").on('click', function() {
var display_type = '<%= @display_type %>';
if (display_type.length>0) {
display_type = '<%= @display_type %>';
}else{
display_type = null;
}
if ($('#server_mode').val() != "cloud" && display_type == 2) {
document.getElementById('second_view').click();
}
window.location.href = '/origami/food_court';
});
$(".order_reservation").on('click', function() {
window.location.href = '/origami/order_reservation';
});

View File

@@ -265,7 +265,7 @@ var cashier_type = "<%= @cashier_type %>";
var id = $("#table_id").text();
var type = $("#table_type").text();
var sale_id = $('#sale-id').text();
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") {
@@ -454,7 +454,7 @@ var cashier_type = "<%= @cashier_type %>";
title: "Information!",
text: result.status,
}, function () {
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){
@@ -504,7 +504,7 @@ var cashier_type = "<%= @cashier_type %>";
text: result.status,
type: "success",
}, function () {
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){
@@ -531,7 +531,7 @@ var cashier_type = "<%= @cashier_type %>";
text: result.status,
type: "success",
}, function () {
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){
@@ -580,7 +580,7 @@ var cashier_type = "<%= @cashier_type %>";
confirmButtonText: 'OK',
confirmButtonColor: btn_color,
}, function () {
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){

View File

@@ -333,7 +333,7 @@
title: "Information!",
text: "Success",
}, function () {
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){

View File

@@ -35,7 +35,7 @@
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<strong>Customer :</strong>
<% if @cashier_type == 'quick_service' %>
<% if @cashier_type == 'quick_service' || @cashier_type == 'food_court' %>
<button type="button" class="btn bg-info waves-effect" id='customer_name'><%= @sale_data.customer.name%></button>
<% else %>
<span id="customer_name"><%= @sale_data.customer.name%></span>
@@ -193,7 +193,7 @@
<%= number_with_precision(@cash, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
</div>
</div>
<% if @sale_payment.nil? %>
<% if @sale_payment.nil? && @cashier_type != "food_court" %>
<div class="row payment credit-color p-l-5 p-r-5" id="credit_payment" >
<div class="col-md-8">Credit</div>
<div class="col-md-4" id="credit"><%= number_with_precision(@credit, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
@@ -209,7 +209,7 @@
</div>
</div>
<% else %>
<div class="row payment other-payment-color" id="card_payment" >
<div class="row payment other-payment-color" id="card_payment" >
<div class="col-md-8">Other Payments</div>
<div class="col-md-4" id="other_payment_amount">
<%= number_with_precision(@other_payment, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>
@@ -432,7 +432,7 @@
<% end %>
<% end %>
<% if @cashier_type=="quick_service" && @sale_payment.nil? %>
<% if (@cashier_type=="quick_service" || @cashier_type=="food_court") && @sale_payment.nil? %>
<hr>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
@@ -669,6 +669,32 @@
</div>
</div>
<!-- customer light box -->
<div class="modal fade" id="is_paymemberModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title" id="is_paymemberModalLabel">Are you Member?</h1>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
<input type="hidden" name="qr_code" id="qr_code" />
<div class="row text-center m-t-20">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_paymal_member">Card Member</button>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_paymal_qr_code">QR Code</button>
</div>
</div>
</div>
<div class="modal-footer"></div>
</div>
</div>
</div>
<script type="text/javascript">
// //control borwser back
window.location.hash="no-back-button";
@@ -681,6 +707,9 @@ var pdf_view = '<%=@pdf_view%>';
var trans_flag = <%= @trans_flag %>;
// console.log(pdf_view)
$(document).ready(function(){
<%if @cashier_type == "food_court" && @paymalcount == 0.0 %>
$("#is_paymemberModal").modal({show : true, backdrop : false, keyboard : false});
<% end %>
setHeaderBreadCrumb(_PAYMENTS_);
/* replace url type*/
@@ -743,7 +772,7 @@ var trans_flag = <%= @trans_flag %>;
if (cashier_type=="cashier") {
window.location.href = '/origami/table/'+ dining_id;
}else{
window.location.href = '/origami/quick_service/pending_order/'+sale_id;
window.location.href = '/origami/'+cashier_type+'/pending_order/'+sale_id;
}
}
@@ -775,124 +804,130 @@ var trans_flag = <%= @trans_flag %>;
if(location.pathname.includes("credit_payment")){
url_param = "credit_payment";
}
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/"+url_param+"/others_payment";
return false;
if(cashier_type != "food_court"){
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/"+url_param+"/others_payment";
return false;
}else{
<% if @paymalcount == 0.0 %>
$("#is_paymemberModal").modal({show : true, backdrop : false, keyboard : false});
<% end %>
}
});
$('#pay').click(function() {
sub_total = $('#sub-total').text();
member = $('#membership_id').text();
// console.log(member)
if (parseInt(jQuery.inArray("MPU", payment_type)) != -1 && $('.mpu').text() == 0 && sub_total != 0.0 && member) {
swal("Oops","Please Pay with MPU Payment","warning");
}else if(parseInt(jQuery.inArray("Redeem", payment_type)) != -1 && $('#ppamount').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Redeem Payment","warning");
}else if(parseInt(jQuery.inArray("VISA", payment_type)) != -1 && $('#visacount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Visa Payment","warning");
}else if(parseInt(jQuery.inArray("JCB", payment_type)) != -1 && $('#jcbcount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with jcb Payment","warning");
}
else if(parseInt(jQuery.inArray("Master", payment_type)) != -1 && $('#mastercount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Master Payment","warning");
}
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with UNIONPAY Payment","warning");
}
else if(parseInt(jQuery.inArray("Alipay", payment_type)) != -1 && $('#alipaycount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Alipay Payment","warning");
}
else if(parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 && $('#junctionpaycount').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with JUNCTIONPAY Payment","warning");
}
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Credit Payment","warning");
}else if(parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 && $('#paymalcount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Paymal Payment","warning");
}else if(parseInt(jQuery.inArray("DINGA", payment_type)) != -1 && $('#dingacount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Dinga Payment","warning");
}else if(parseInt(jQuery.inArray("GiftVoucher", payment_type)) != -1 && $('#giftvouchercount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Gift Voucher","warning");
}else{
$( "#loading_wrapper").show();
if($('#balance').text() > 0){
swal ( "Oops", "Insufficient Amount!" , "error" );
$("#loading_wrapper").hide();
}else{
$(this).off("click");
var sale_id = $('#sale_id').text();
// var item_row = $('.is_card');
// payment
var cash = $('#cash').text();
var credit = $('#credit').text();
var card = $('#card').text();
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
if (credit <= 0 && (!location.pathname.includes("credit_payment"))) {
calculate_member_discount(sale_id,tax_type);
}
// $("#pdfModal").on('shown.bs.modal', function () {
// $('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
/* check credit payment or not*/
if(location.pathname.includes("credit_payment")){
var url = "<%= origami_credit_payment_cash_path %>";
}else{
var url = "<%= origami_payment_cash_path %>";
}
$.ajax({type: "POST",
url: url,
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type,
success:function(result){
/* start delete receipt no in first bill*/
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
var receipt_no = ($("#receipt_no").html()).trim();
deleteReceiptNoInFirstBillData(receipt_no);
}
/* end delete receipt no in first bill*/
localStorage.removeItem("cash");
if (result.status) {
var msg = result.message;
}
else{
var msg = '';
}
$("#loading_wrapper" ).hide();
if(location.pathname.includes("credit_payment")){
payment_success_alert();
}else{
//PDF lightbox data
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
$("#sale_receipt_no").val(result.receipt_no);
$("#filename").val(result.filename);
$("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", pdfPath);
$("#changed_amount").text("");
if($('#balance').text() < 0){
<% if precision.to_i > 0 %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
<% else %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
<% end %>
}
if (pdf_view == 1) {
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Sale Completed");
}else{
//PDF lightbox data
print_receipt();
}
}
}
});
}
if (parseInt(jQuery.inArray("MPU", payment_type)) != -1 && $('.mpu').text() == 0 && sub_total != 0.0 && member) {
swal("Oops","Please Pay with MPU Payment","warning");
}else if(parseInt(jQuery.inArray("Redeem", payment_type)) != -1 && $('#ppamount').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Redeem Payment","warning");
}else if(parseInt(jQuery.inArray("VISA", payment_type)) != -1 && $('#visacount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Visa Payment","warning");
}else if(parseInt(jQuery.inArray("JCB", payment_type)) != -1 && $('#jcbcount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with jcb Payment","warning");
}
else if(parseInt(jQuery.inArray("Master", payment_type)) != -1 && $('#mastercount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Master Payment","warning");
}
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with UNIONPAY Payment","warning");
}
else if(parseInt(jQuery.inArray("Alipay", payment_type)) != -1 && $('#alipaycount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Alipay Payment","warning");
}
else if(parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 && $('#junctionpaycount').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with JUNCTIONPAY Payment","warning");
}
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Credit Payment","warning");
}else if(parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 && $('#paymalcount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Paymal Payment","warning");
}else if(parseInt(jQuery.inArray("DINGA", payment_type)) != -1 && $('#dingacount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Dinga Payment","warning");
}else if(parseInt(jQuery.inArray("GiftVoucher", payment_type)) != -1 && $('#giftvouchercount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Gift Voucher","warning");
}else{
$( "#loading_wrapper").show();
if($('#balance').text() > 0){
swal ( "Oops", "Insufficient Amount!" , "error" );
$("#loading_wrapper").hide();
}else{
$(this).off("click");
var sale_id = $('#sale_id').text();
// var item_row = $('.is_card');
// payment
var cash = $('#cash').text();
var credit = $('#credit').text();
var card = $('#card').text();
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
if (credit <= 0 && (!location.pathname.includes("credit_payment"))) {
calculate_member_discount(sale_id,tax_type);
}
// $("#pdfModal").on('shown.bs.modal', function () {
// $('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
/* check credit payment or not*/
if(location.pathname.includes("credit_payment")){
var url = "<%= origami_credit_payment_cash_path %>";
}else{
var url = "<%= origami_payment_cash_path %>";
}
$.ajax({type: "POST",
url: url,
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type,
success:function(result){
/* start delete receipt no in first bill*/
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
var receipt_no = ($("#receipt_no").html()).trim();
deleteReceiptNoInFirstBillData(receipt_no);
}
/* end delete receipt no in first bill*/
localStorage.removeItem("cash");
if (result.status) {
var msg = result.message;
}
else{
var msg = '';
}
$("#loading_wrapper" ).hide();
if(location.pathname.includes("credit_payment")){
payment_success_alert();
}else{
//PDF lightbox data
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
$("#sale_receipt_no").val(result.receipt_no);
$("#filename").val(result.filename);
$("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", pdfPath);
$("#changed_amount").text("");
if($('#balance').text() < 0){
<% if precision.to_i > 0 %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
<% else %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
<% end %>
}
if (pdf_view == 1) {
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Sale Completed");
}else{
//PDF lightbox data
print_receipt();
}
}
}
});
}
}
});
// $('#void').on('click',function () {
@@ -1160,8 +1195,10 @@ var trans_flag = <%= @trans_flag %>;
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
customer_display_view(null,"reload");
window.location.href = '/origami/'+cashier_type;
if (cashier_type=="quick_service"){
customer_display_view(null,"reload");
}
}
}
}else{
@@ -1195,10 +1232,12 @@ var trans_flag = <%= @trans_flag %>;
}else{
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
customer_display_view(null,"reload");
}
}else {
window.location.href = '/origami/'+cashier_type;
if(cashier_type=="quick_service"){
customer_display_view(null,"reload");
}
}
}
});
}
@@ -1213,7 +1252,7 @@ var trans_flag = <%= @trans_flag %>;
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
window.location.href = '/origami/'+cashier_type;
}
}
@@ -1452,7 +1491,7 @@ var trans_flag = <%= @trans_flag %>;
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
window.location.href = '/origami/'+cashier_type;
}
}
});
@@ -1497,7 +1536,7 @@ var trans_flag = <%= @trans_flag %>;
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
window.location.href = '/origami/'+cashier_type;
}
}
}
@@ -1539,8 +1578,10 @@ var trans_flag = <%= @trans_flag %>;
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
customer_display_view(null,"reload");
window.location.href = '/origami/'+cashier_type;
if(cashier_type=="quick_service"){
customer_display_view(null,"reload");
}
}
}
}
@@ -1611,10 +1652,178 @@ var trans_flag = <%= @trans_flag %>;
/* customer light-box */
$("#customer_name").on("click",function(){
//start customer modal popup
if((cashier_type=='quick_service') && (customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
if((cashier_type=='quick_service' || cashier_type=='food_court') && (customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
// if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){
$("#is_memberModal").modal({show : true, backdrop: false, keyboard : false});
// }
}
});
// Read Card Reader
$(".btn_paymal_member").on('click', function(){
var cardNo = "";
var sale_id = $("#sale_id").text() || 0;
var receipt_no = "";
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim();
}
var customer_mamber_card_no = 0;
var payment_amount = parseFloat($("#grand_total").text());
$("#is_paymemberModal").hide();
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();
customer_mamber_card_no = $("#paypar_account_no").val();
if (customer_mamber_card_no == 0) {
customer_mamber_card_no = $("#membership_id").text() || 0;
}
if(sale_id != 0 && customer_mamber_card_no !=0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
// $("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:customer_mamber_card_no},
success: function(result){
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal({
title: 'Oops',
text: result.message,
type: 'warning',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
}
});
}else{
swal({
title: 'Oops',
text: data.message.toString(),
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
}
});
}else{
swal({
title: 'Oops',
text: 'Please Check Member',
type: 'warning',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
},100);
});
// QR Code Reader
$(".btn_paymal_qr_code").on('click', function(e){
$("#is_paymemberModal").hide();
var code = "";
var sale_id = $("#sale_id").text() || 0;
var receipt_no = "";
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim();
}
var payment_amount = parseFloat($("#grand_total").text());
setTimeout(function(){
code=getQRCode();
if(sale_id != 0 && code != ""){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : code, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
// $("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:code},
success: function(result){
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal({
title: 'Oops',
text: result.message,
type: 'warning',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
}
});
}else{
swal({
title: 'Oops',
text: 'Please Check Member',
type: 'warning',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
}
});
}
},100);
});
</script>

View File

@@ -10,10 +10,11 @@
<li class="nav-item">
<a class="nav-link " data-toggle="tab" href="#pending_order" role="tab">Pending</a>
</li>
<% if @cashier_type == "quick_service" %>
<li class="nav-item credit_items">
<a class="nav-link" data-toggle="tab" href="#credits" role="tab"><%= t :credits %></a>
</li>
<% end %>
</ul>
<div id="custom-slimscroll">
<div class="tab-content m-t-15">
@@ -49,37 +50,39 @@
</div>
<!-- Credit Sale Panel -->
<div class="tab-pane dining" id="credits" role="tabpanel">
<div class="card-block">
<div class="row m-t-10 m-l-10 clearfix">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<input type="text" name="filter" id="filter" onchange="getCreditData('quick_service');" style="height: 32px;" placeholder="Receipt No." class="form-control">
<% if @cashier_type == "quick_service" %>
<div class="tab-pane dining" id="credits" role="tabpanel">
<div class="card-block">
<div class="row m-t-10 m-l-10 clearfix">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<input type="text" name="filter" id="filter" onchange="getCreditData('quick_service');" style="height: 32px;" placeholder="Receipt No." class="form-control">
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<select class="form-control" id="sel_customer" name="sel_customer" placeholder="Select Customer" onchange="getCreditData('quick_service');">
<option value="">-- Select Customer --</option>
<% if !@customers.empty? %>
<% @customers.each do |cus| %>
<option value="<%= cus[0] %>"><%= cus[1] %></option>
<% end %>
<% end %>
</select>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<select class="form-control" id="sel_customer" name="sel_customer" placeholder="Select Customer" onchange="getCreditData('quick_service');">
<option value="">-- Select Customer --</option>
<% if !@customers.empty? %>
<% @customers.each do |cus| %>
<option value="<%= cus[0] %>"><%= cus[1] %></option>
<% end %>
<% end %>
</select>
<div class="row clearfix m-t-20 m-l-10">
<table class="table table-responsive tbl_credit_lists">
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>
</table>
</div>
</div>
<div class="row clearfix m-t-20 m-l-10">
<table class="table table-responsive tbl_credit_lists">
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>
</table>
</div>
</div>
</div>
<% end %>
<!-- Credit Sale Panel -->
</div>
</div>
@@ -303,17 +306,17 @@
<!-- script data for credit lists -->
<script>
var cashier_type = "quick_service";
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){
getCreditSales("","",cashier_type); //credit sales script data binding
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
window.location.href = '/origami/'+cashier_type+'/pending_order/' + sale_id;
})
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
window.location.href = '/origami/'+cashier_type+'/completed_sale/' + sale_id;
})
$('#reprint').on('click', function () {
var sale_id = $('#sale_id').val();
@@ -333,12 +336,12 @@ $(document).ready(function(){
});
});
$('#back').on('click', function () {
window.location.href = '/origami/quick_service/pending_order';
window.location.href = '/origami/'+cashier_type+'/pending_order';
});
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
var linkURL = '/origami/shift/'+cashier_type+'/close';
occupied_count = $(this).data("count");
warnBeforeRedirect(linkURL,occupied_count);
});
@@ -364,11 +367,11 @@ $(document).ready(function(){
}
$('#cash_in').on('click',function(){
window.location.href = '/origami/quick_service/cash_ins';
window.location.href = '/origami/'+cashier_type+'/cash_ins';
})
$('#cash_out').on('click',function(){
window.location.href = '/origami/quick_service/cash_outs';
window.location.href = '/origami/'+cashier_type+'/cash_outs';
});
$('#void').on('click', function () {
@@ -397,7 +400,7 @@ $(document).ready(function(){
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
window.location.href = '/origami/quick_service';
window.location.href = '/origami/'+cashier_type;
}
});
}

View File

@@ -10,9 +10,11 @@
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#pending_order" role="tab">Pending</a>
</li>
<li class="nav-item credit_items">
<a class="nav-link" data-toggle="tab" href="#credits" role="tab"><%= t :credits %></a>
</li>
<%if @cashier_type=='quick_service' %>
<li class="nav-item credit_items">
<a class="nav-link" data-toggle="tab" href="#credits" role="tab"><%= t :credits %></a>
</li>
<% end %>
</ul>
<!-- Nav tabs - End -->
<div id="custom-slimscroll">
@@ -49,6 +51,7 @@
</div>
<!-- Credit Sales Panel -->
<%if @cashier_type=='quick_service' %>
<div class="tab-pane dining" id="credits" role="tabpanel">
<div class="card-block">
<div class="row m-t-10 m-l-10 clearfix">
@@ -80,6 +83,7 @@
</div>
</div>
</div>
<% end %>
<!-- Credit Sales Panel -->
</div>
</div>
@@ -112,39 +116,39 @@
<!-- script data for credit lists -->
<script>
var cashier_type = "quick_service";
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){
getCreditSales("","",cashier_type); //credit sales script data binding
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
window.location.href = '/origami/'+cashier_type+'/pending_order/' + sale_id;
});
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
window.location.href = '/origami/'+cashier_type+'/completed_sale/' + sale_id;
});
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
window.location.href = '/origami/sale/' + sale_id + "/"+cashier_type+"/payment";
});
$('#back').on('click', function () {
window.location.href = '/origami/quick_service';
window.location.href = '/origami/'+cashier_type;
});
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
var linkURL = '/origami/shift/'+cashier_type+'/close';
occupied_count = $(this).data("count");
warnBeforeRedirect(linkURL,occupied_count);
});
$('#cash_in').on('click',function(){
window.location.href = '/origami/quick_service/cash_ins';
window.location.href = '/origami/'+cashier_type+'/cash_ins';
});
$('#cash_out').on('click',function(){
window.location.href = '/origami/quick_service/cash_outs';
window.location.href = '/origami/'+cashier_type+'/cash_outs';
});
});

View File

@@ -9,9 +9,11 @@
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#pending_order" role="tab">Pending</a>
</li>
<% if @cashier_type == "quick_service" %>
<li class="nav-item credit_items">
<a class="nav-link" data-toggle="tab" href="#credits" role="tab"><%= t :credits %></a>
</li>
<% end %>
</ul>
<div id="custom-slimscroll">
<div class="tab-content m-t-15">
@@ -47,37 +49,39 @@
</div>
<!-- Credit Sale Panel -->
<div class="tab-pane dining" id="credits" role="tabpanel">
<div class="card-block">
<div class="row m-t-10 m-l-10 clearfix">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<input type="text" name="filter" id="filter" onchange="getCreditData('quick_service');" style="height: 32px;" placeholder="Receipt No." class="form-control">
<% if @cashier_type == "quick_service" %>
<div class="tab-pane dining" id="credits" role="tabpanel">
<div class="card-block">
<div class="row m-t-10 m-l-10 clearfix">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<input type="text" name="filter" id="filter" onchange="getCreditData('quick_service');" style="height: 32px;" placeholder="Receipt No." class="form-control">
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<select class="form-control" id="sel_customer" name="sel_customer" placeholder="Select Customer" onchange="getCreditData('quick_service');">
<option value="">-- Select Customer --</option>
<% if !@customers.empty? %>
<% @customers.each do |cus| %>
<option value="<%= cus[0] %>"><%= cus[1] %></option>
<% end %>
<% end %>
</select>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<select class="form-control" id="sel_customer" name="sel_customer" placeholder="Select Customer" onchange="getCreditData('quick_service');">
<option value="">-- Select Customer --</option>
<% if !@customers.empty? %>
<% @customers.each do |cus| %>
<option value="<%= cus[0] %>"><%= cus[1] %></option>
<% end %>
<% end %>
</select>
<div class="row clearfix m-t-20 m-l-10">
<table class="table table-responsive tbl_credit_lists">
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>
</table>
</div>
</div>
<div class="row clearfix m-t-20 m-l-10">
<table class="table table-responsive tbl_credit_lists">
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>
</table>
</div>
</div>
</div>
<% end %>
<!-- Credit Sale Panel -->
</div>
</div>
@@ -244,40 +248,40 @@
<!-- script data for credit lists -->
<script>
var cashier_type = "quick_service";
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){
getCreditSales("","",cashier_type); //credit sales script data binding
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
window.location.href = '/origami/'+cashier_type+'/pending_order/' + sale_id;
})
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
window.location.href = '/origami/'+cashier_type+'/completed_sale/' + sale_id;
})
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
window.location.href = '/origami/sale/' + sale_id + "/"+cashier_type+"/payment";
});
$('#back').on('click', function () {
window.location.href = '/origami/quick_service';
window.location.href = '/origami/'+cashier_type;
});
$('#addorder').on('click', function () {
var table_id = "<%=@table_id%>";
var booking_id = "<%=@bookings.booking_id%>";
var sale_id = $("#sale_id").val();
if (table_id) {
window.location.href = '/origami/quick_service/modify_order/' + table_id+"/"+sale_id;
window.location.href = '/origami/'+cashier_type+'/modify_order/' + table_id+"/"+sale_id;
}else{
window.location.href = '/origami/quick_service/modify_order/'+ booking_id+"/" +sale_id;
window.location.href = '/origami/'+cashier_type+'/modify_order/'+ booking_id+"/" +sale_id;
}
});
// Bill Request
$('#request_bills').click(function () {
var order_id = $('#save_order_id').val();
var ajax_url = "../../../origami/" +order_id+ "/request_bills";
var ajax_url = "/origami/" +order_id+ "/request_bills";
console.log(ajax_url)
$.ajax({
type: "GET",
@@ -288,7 +292,7 @@ $(document).ready(function(){
swal("Information!", result.error_message);
}
else {
window.location.href = '/origami/sale/'+result.data+'/quick_service/payment';
window.location.href = '/origami/sale/'+result.data+'/'+cashier_type+'/payment';
}
}
});
@@ -352,7 +356,7 @@ $(document).ready(function(){
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
var linkURL = '/origami/shift/'+cashier_type+'/close';
occupied_count = $(this).data("count");
warnBeforeRedirect(linkURL,occupied_count);
});
@@ -385,11 +389,11 @@ $(document).ready(function(){
});
$('#cash_in').on('click',function(){
window.location.href = '/origami/quick_service/cash_ins';
window.location.href = '/origami/'+cashier_type+'/cash_ins';
})
$('#cash_out').on('click',function(){
window.location.href = '/origami/quick_service/cash_outs';
window.location.href = '/origami/'+cashier_type+'/cash_outs';
})
});
</script>

View File

@@ -321,7 +321,7 @@ var access_code = localStorage.getItem("access_code");
$('#back').on('click', function () {
var table_id = '<%= @table_id %>'
var sale_id = "<%= @saleobj.sale_id %>"
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type == "food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
window.location.href = '/origami/table/' + table_id;
@@ -350,7 +350,7 @@ var access_code = localStorage.getItem("access_code");
url: ajax_url,
data: 'sale_id=' + sale_id+'&type='+cashier_type,
success: function (result) {
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
window.location.href = '/origami/table/' + table_id;

View File

@@ -429,7 +429,7 @@ var cashier_type = "<%= @cashier_type %>";
var table_type = $('#table_type').val();
var table_id = $('#table_id').val();
if (cashier_type == "quick_service") {
if (cashier_type == "quick_service" || cashier_type == "food_court") {
window.location.href = '/origami/sale/<%= @id %>/<%= @cashier_type %>/payment/';
}else{
if(table_type == "Table"){

View File

@@ -105,16 +105,24 @@ scope "(:locale)", locale: /en|mm/ do
get "quick_service" => "quick_service#index"
get "quick_service/pending_order" => "pending_order#index"
get "quick_service/pending_order/:sale_id" => "pending_order#show"
get "quick_service/completed_sale/:sale_id" => "pending_order#completed_sale"
get ":type/pending_order" => "pending_order#index"
get ":type/pending_order/:sale_id" => "pending_order#show"
get ":type/completed_sale/:sale_id" => "pending_order#completed_sale"
get "quick_service/modify_order/:id/:sale_id" => "quick_service#modify_order"
get "quick_service/modify_order/:sale_id" => "quick_service#modify_order"
post 'quick_service/update_modify_order' => "quick_service#update_modify_order", :defaults => { :format => 'json' }
get "quick_service/cash_ins" => "pending_order#cash_ins"
get "quick_service/cash_outs" => "pending_order#cash_outs"
get ":type/cash_ins" => "pending_order#cash_ins"
get ":type/cash_outs" => "pending_order#cash_outs"
#food court routes
get "food_court" => "food_court#index"
get "food_court/modify_order/:id/:sale_id" => "food_court#modify_order"
get "food_court/modify_order/:sale_id" => "food_court#modify_order"
post 'food_court/update_modify_order' => "food_court#update_modify_order", :defaults => { :format => 'json' }
#food court routes
resources :cash_ins, only: [:new, :create]
resources :cash_outs, only: [:new, :create]

View File

@@ -95,6 +95,7 @@ float_value = Lookup.create([{lookup_type:'float_value', name: '500', value: '50
# customer type
customer_type = Lookup.create([{lookup_type:'customer_type', name: 'Dinein', value: 'Dinein'},
{lookup_type:'customer_type', name: 'FoodCourt', value: 'FoodCourt'},
{lookup_type:'customer_type', name: 'Takeaway', value: 'Takeaway'},
{lookup_type:'customer_type', name: 'Delivery', value: 'Delivery'}])