pull from master
This commit is contained in:
@@ -63,6 +63,11 @@ For Order Printing
|
|||||||
1) settings/print_settings
|
1) settings/print_settings
|
||||||
(a) Unique Code => OrderSetItemCustomisePdf & OrderSummarySetCustomisePdf
|
(a) Unique Code => OrderSetItemCustomisePdf & OrderSummarySetCustomisePdf
|
||||||
(b) Can change Header font size and Item Font Size as you like
|
(b) Can change Header font size and Item Font Size as you like
|
||||||
|
6)) ********* Order Slim Customise PDF
|
||||||
|
1) settings/print_settings
|
||||||
|
(a) Unique Code => OrderItemSlimCustomisePdf & OrderSummarySlimCustomisePdf
|
||||||
|
(b) Can change Header font size and Item Font Size as you like
|
||||||
|
|
||||||
|
|
||||||
For ReceiptBillA5Pdf
|
For ReceiptBillA5Pdf
|
||||||
*** change ReceiptBillPdf to ReceiptBillA5Pdf
|
*** change ReceiptBillPdf to ReceiptBillA5Pdf
|
||||||
@@ -185,6 +190,10 @@ For MoveTablePdf in print settings
|
|||||||
3) settings/lookups => { type:tax_profiles, name: Doemal, value: doemal }
|
3) settings/lookups => { type:tax_profiles, name: Doemal, value: doemal }
|
||||||
/* Tax Profile Group Types in lookups */
|
/* Tax Profile Group Types in lookups */
|
||||||
|
|
||||||
|
/*Receipt Pdf View in lookups */
|
||||||
|
1) settings/lookups => { type:ReceiptPdfView, name: Receipt Pdf View, value:1 or 0 }
|
||||||
|
=> 1 is active and 0 is in-active
|
||||||
|
|
||||||
Add Kitchen Role of Employee
|
Add Kitchen Role of Employee
|
||||||
=> 1) settings/lookups => { type:employee_roles, name: Kitchen, value:kitchen }
|
=> 1) settings/lookups => { type:employee_roles, name: Kitchen, value:kitchen }
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,10 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
|||||||
ORDER_RESERVATION = "order_and_reservation"
|
ORDER_RESERVATION = "order_and_reservation"
|
||||||
|
|
||||||
def check_customer
|
def check_customer
|
||||||
customer_id = 0
|
customer_id = nil
|
||||||
status = false
|
status = false
|
||||||
if !params[:name]
|
if !params[:name] || !params[:email] || !params[:membership_id]
|
||||||
render :json => { :status => false, :message => "name is required!" }
|
render :json => { :status => false, :message => "name, email and membership_id are required!" }
|
||||||
elsif !params[:email]
|
|
||||||
render :json => { :status => false, :message => "email is required!" }
|
|
||||||
elsif !params[:membership_id]
|
|
||||||
render :json => { :status => false, :message => "membership_id is required!" }
|
|
||||||
else
|
else
|
||||||
status = true
|
status = true
|
||||||
end
|
end
|
||||||
@@ -25,9 +21,13 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
|||||||
customer = OrderReservation.addCustomer(params)
|
customer = OrderReservation.addCustomer(params)
|
||||||
customer_id = customer.id
|
customer_id = customer.id
|
||||||
end
|
end
|
||||||
|
if !customer_id.nil?
|
||||||
|
render :json => { :status => false, :message => "email and customer are already existed!" }
|
||||||
|
else
|
||||||
render :json => { :status => true, :data => { :customer_id => customer_id} }
|
render :json => { :status => true, :data => { :customer_id => customer_id} }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
status = false
|
status = false
|
||||||
|
|||||||
@@ -233,7 +233,6 @@ class Api::OrdersController < Api::ApiController
|
|||||||
printer = PrintSetting.all
|
printer = PrintSetting.all
|
||||||
|
|
||||||
unique_code="OrderItemPdf"
|
unique_code="OrderItemPdf"
|
||||||
if !order_slim_pdf.empty?
|
|
||||||
if !printer.empty?
|
if !printer.empty?
|
||||||
printer.each do |printer_setting|
|
printer.each do |printer_setting|
|
||||||
if printer_setting.unique_code == 'OrderItemPdf'
|
if printer_setting.unique_code == 'OrderItemPdf'
|
||||||
@@ -251,7 +250,6 @@ class Api::OrdersController < Api::ApiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_menu()
|
def get_menu()
|
||||||
puts "sssssssssssssss"
|
|
||||||
puts params[:id]
|
|
||||||
if (params[:id])
|
if (params[:id])
|
||||||
#Pull this menu
|
#Pull this menu
|
||||||
@menu = Menu.find_by_id(params[:id])
|
@menu = Menu.find_by_id(params[:id])
|
||||||
@@ -122,11 +120,11 @@ puts params[:id]
|
|||||||
items_arr.push(items)
|
items_arr.push(items)
|
||||||
}
|
}
|
||||||
# begin
|
# begin
|
||||||
# if params[:order_source] == "quick_service"
|
if params[:order_source] == "quick_service" && params[:table_id].to_i == 0
|
||||||
# customer_id = "CUS-000000000002" # for no customer id from mobile
|
customer_id = "CUS-000000000002" # for no customer id from mobile
|
||||||
# else
|
else
|
||||||
customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||||
# end
|
end
|
||||||
@order = Order.new
|
@order = Order.new
|
||||||
@order.source = params[:order_source]
|
@order.source = params[:order_source]
|
||||||
@order.order_type = params[:order_type]
|
@order.order_type = params[:order_type]
|
||||||
@@ -182,6 +180,15 @@ puts params[:id]
|
|||||||
@status, @booking = @order.generate
|
@status, @booking = @order.generate
|
||||||
|
|
||||||
if @status && @booking
|
if @status && @booking
|
||||||
|
#send order broadcast to order_channel
|
||||||
|
if @order.table_id.to_i > 0
|
||||||
|
table = DiningFacility.find(@booking.dining_facility_id)
|
||||||
|
type = 'order'
|
||||||
|
from = getCloudDomain #get sub domain in cloud mode
|
||||||
|
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
if params[:order_source] != "quick_service"
|
if params[:order_source] != "quick_service"
|
||||||
process_order_queue(@order.order_id,@order.table_id,@order.source)
|
process_order_queue(@order.order_id,@order.table_id,@order.source)
|
||||||
end
|
end
|
||||||
@@ -194,11 +201,7 @@ puts params[:id]
|
|||||||
|
|
||||||
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
||||||
# for second display
|
# for second display
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
from = getCloudDomain #get sub domain in cloud mode
|
||||||
from = request.subdomain + "." + request.domain
|
|
||||||
else
|
|
||||||
from = ""
|
|
||||||
end
|
|
||||||
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
|
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
|
||||||
#end
|
#end
|
||||||
result = {:status=> @status, :data => @sale }
|
result = {:status=> @status, :data => @sale }
|
||||||
@@ -307,11 +310,7 @@ puts params[:id]
|
|||||||
oqs.process_order(order, table_id, order_source)
|
oqs.process_order(order, table_id, order_source)
|
||||||
end
|
end
|
||||||
|
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
from = getCloudDomain #get sub domain in cloud mode
|
||||||
from = request.subdomain + "." + request.domain
|
|
||||||
else
|
|
||||||
from = ""
|
|
||||||
end
|
|
||||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
||||||
end
|
end
|
||||||
@@ -326,6 +325,16 @@ puts params[:id]
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#get cloud domain
|
||||||
|
def getCloudDomain
|
||||||
|
from = ""
|
||||||
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
from = request.subdomain + "." + request.domain
|
||||||
|
end
|
||||||
|
|
||||||
|
return from
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# def set_dining
|
# def set_dining
|
||||||
|
|||||||
@@ -135,6 +135,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
|
|
||||||
|
type = 'payment'
|
||||||
|
from = getCloudDomain #get sub domain in cloud mode
|
||||||
|
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||||
else
|
else
|
||||||
shift = ShiftSale.find(saleObj.shift_sale_id)
|
shift = ShiftSale.find(saleObj.shift_sale_id)
|
||||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||||
@@ -184,6 +188,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
# Order.pay_process_order_queue(order.order_id, table_id)
|
# Order.pay_process_order_queue(order.order_id, table_id)
|
||||||
oqs = OrderQueueStation.new
|
oqs = OrderQueueStation.new
|
||||||
oqs.pay_process_order_queue(order.order_id, table_id)
|
oqs.pay_process_order_queue(order.order_id, table_id)
|
||||||
|
|
||||||
|
assign_order = AssignedOrderItem.assigned_order_item_by_job(order.order_id)
|
||||||
|
from = getCloudDomain #get sub domain in cloud mode
|
||||||
|
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -242,7 +250,11 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
@table_no = ''
|
@table_no = ''
|
||||||
@dining = ''
|
@dining = ''
|
||||||
@other_payment = 0.0
|
@other_payment = 0.0
|
||||||
|
@pdf_view = nil
|
||||||
|
@lookup_pdf = Lookup.find_by_lookup_type("ReceiptPdfView")
|
||||||
|
if !@lookup_pdf.nil?
|
||||||
|
@pdf_view = @lookup_pdf.value
|
||||||
|
end
|
||||||
@shop = Shop.first #show shop info
|
@shop = Shop.first #show shop info
|
||||||
|
|
||||||
@customer_lists = Customer.where("customer_id = 'CUS-000000000001' or customer_id = 'CUS-000000000002'")
|
@customer_lists = Customer.where("customer_id = 'CUS-000000000001' or customer_id = 'CUS-000000000002'")
|
||||||
@@ -468,6 +480,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
sale_payment.process_payment(saleObj, current_user.name, cash, "foc" ,remark)
|
sale_payment.process_payment(saleObj, current_user.name, cash, "foc" ,remark)
|
||||||
|
type = 'payment'
|
||||||
|
from = getCloudDomain #get sub domain in cloud mode
|
||||||
|
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||||
|
|
||||||
# For Cashier by Zone
|
# For Cashier by Zone
|
||||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
# if bookings.count > 1
|
# if bookings.count > 1
|
||||||
@@ -595,4 +611,14 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
render json: JSON.generate({:status => true})
|
render json: JSON.generate({:status => true})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#get cloud domain
|
||||||
|
def getCloudDomain
|
||||||
|
from = ""
|
||||||
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
from = request.subdomain + "." + request.domain
|
||||||
|
end
|
||||||
|
|
||||||
|
return from
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@@ -76,7 +76,7 @@ class Order < ApplicationRecord
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
#send order to broadcast job
|
#send order to broadcast job
|
||||||
send_order_broadcast(booking)
|
# send_order_broadcast(booking)
|
||||||
|
|
||||||
return true, booking
|
return true, booking
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -121,13 +121,13 @@ class OrderQueueStation < ApplicationRecord
|
|||||||
# oqs = OrderQueueStation.new
|
# oqs = OrderQueueStation.new
|
||||||
# oqs.process_order(order, table_id)
|
# oqs.process_order(order, table_id)
|
||||||
# end
|
# end
|
||||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
# assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
# if ENV["SERVER_MODE"] == 'cloud'
|
||||||
from = request.subdomain + "." + request.domain
|
# from = request.subdomain + "." + request.domain
|
||||||
else
|
# else
|
||||||
from = ""
|
# from = ""
|
||||||
end
|
# end
|
||||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
||||||
|
|
||||||
if table_id.to_i > 0
|
if table_id.to_i > 0
|
||||||
# get dining
|
# get dining
|
||||||
|
|||||||
@@ -29,12 +29,13 @@ class Promotion < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.combine_item(saleObj)
|
def self.combine_item(saleObj)
|
||||||
# order_id = saleObj.sale_orders[0].order_id
|
# order_id = saleObj.sale_orders[0][0].order_id
|
||||||
# itemList = OrderItem.where("order_id = ?", order_id).group(:item_instance_code).sum(:qty)
|
# itemList = OrderItem.where("order_id = ?", order_id).group(:item_instance_code).sum(:qty)
|
||||||
itemList = []
|
itemList = []
|
||||||
saleObj.sale_orders.each do |so|
|
saleObj.sale_orders.each do |so|
|
||||||
itemList << OrderItem.where("order_id = ?",so.order_id).group(:item_instance_code).sum(:qty)
|
itemList << OrderItem.where("order_id = ?",so.order_id).group(["item_instance_code", "order_id"]).sum(:qty)
|
||||||
end
|
end
|
||||||
|
|
||||||
return itemList
|
return itemList
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -51,10 +52,9 @@ class Promotion < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.find_promo_item(promo, orderitem, sale_id)
|
def self.find_promo_item(promo, orderitem, sale_id)
|
||||||
# item_code = OrderItem.find_by_item_instance_code(orderitem[0]).item_code
|
# item_code = OrderItem.find_by_item_instance_code(orderitem[0][0]).item_code
|
||||||
orderitem.each do |odr_item|
|
orderitem.each do |odr_item|
|
||||||
|
if promo.original_product.downcase.to_s == odr_item[0][0]
|
||||||
if promo.original_product.downcase.to_s == odr_item[0]
|
|
||||||
if promo.min_qty.to_i > odr_item[1].to_i
|
if promo.min_qty.to_i > odr_item[1].to_i
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
@@ -66,13 +66,13 @@ class Promotion < ApplicationRecord
|
|||||||
|
|
||||||
def self.check_promo_type(promo, orderitem, sale_id)
|
def self.check_promo_type(promo, orderitem, sale_id)
|
||||||
promo.promotion_products.each do |promo_product|
|
promo.promotion_products.each do |promo_product|
|
||||||
if promo_product.item_code == orderitem[0]
|
if promo_product.item_code.downcase == orderitem[0][0]
|
||||||
same = true
|
same = true
|
||||||
else
|
else
|
||||||
# return false, promo_product
|
# return false, promo_product
|
||||||
same = false
|
same = false
|
||||||
end
|
end
|
||||||
# same, promo_product = check_giveaway_product(promo, orderitem[0])
|
# same, promo_product = check_giveaway_product(promo, orderitem[0][0])
|
||||||
if promo.promo_type == Promotion::PROMO_TYPE1
|
if promo.promo_type == Promotion::PROMO_TYPE1
|
||||||
if same
|
if same
|
||||||
give_promotion_same_product(orderitem[1], promo.min_qty, promo_product.min_qty, orderitem, sale_id,promo_product.item_code)
|
give_promotion_same_product(orderitem[1], promo.min_qty, promo_product.min_qty, orderitem, sale_id,promo_product.item_code)
|
||||||
@@ -132,14 +132,14 @@ class Promotion < ApplicationRecord
|
|||||||
else
|
else
|
||||||
charge_qty += qty
|
charge_qty += qty
|
||||||
end
|
end
|
||||||
item = OrderItem.find_by_item_instance_code(orderitem[0])
|
item = OrderItem.where("item_instance_code = '#{orderitem[0][0]}' and order_id = '#{orderitem[0][1]}'").first
|
||||||
if promo_product == OrderItem.find_by_item_instance_code(orderitem[0]).item_instance_code
|
if promo_product.downcase != item.item_instance_code
|
||||||
item = OrderItem.find_by_item_instance_code(orderitem[0])
|
# item = item
|
||||||
else
|
# else
|
||||||
item = OrderItem.find_by_item_code(promo_product)
|
# item = OrderItem.find_by_item_code(promo_product)
|
||||||
|
item = OrderItem.where("item_code = '#{promo_product}' and order_id = '#{orderitem[0][1]}'").first
|
||||||
end
|
end
|
||||||
source = Order.find(item.order_id).source
|
source = Order.find(item.order_id).source
|
||||||
|
|
||||||
update_existing_item(foc_qty, item, sale_id, "promotion", item.price,source)
|
update_existing_item(foc_qty, item, sale_id, "promotion", item.price,source)
|
||||||
|
|
||||||
puts "Charged - " + charge_qty.to_s
|
puts "Charged - " + charge_qty.to_s
|
||||||
@@ -153,7 +153,9 @@ class Promotion < ApplicationRecord
|
|||||||
if (foc_qty < promotion_qty)
|
if (foc_qty < promotion_qty)
|
||||||
promotion_qty = foc_qty
|
promotion_qty = foc_qty
|
||||||
end
|
end
|
||||||
item = OrderItem.find_by_item_instance_code(promo_product)
|
# item = OrderItem.find_by_item_instance_code(promo_product)
|
||||||
|
item = OrderItem.where("item_instance_code = '#{promo_product}' and order_id = '#{orderitem[0][1]}'").first
|
||||||
|
|
||||||
source = Order.find(item.order_id).source
|
source = Order.find(item.order_id).source
|
||||||
update_existing_item(promotion_qty, item, sale_id, "promotion", item.price,source)
|
update_existing_item(promotion_qty, item, sale_id, "promotion", item.price,source)
|
||||||
end
|
end
|
||||||
@@ -184,15 +186,17 @@ class Promotion < ApplicationRecord
|
|||||||
|
|
||||||
def self.give_promotion_nett_off(same, promo_product, foc_min_qty, orderitem, sale_id)
|
def self.give_promotion_nett_off(same, promo_product, foc_min_qty, orderitem, sale_id)
|
||||||
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
||||||
|
|
||||||
if same
|
if same
|
||||||
foc_qty = orderitem[1].to_i / foc_min_qty
|
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||||
item = OrderItem.find_by_item_instance_code(orderitem[0])
|
# item = OrderItem.find_by_item_instance_code(orderitem[0][0])
|
||||||
|
item = OrderItem.where("item_instance_code = '#{orderitem[0][0]}' and order_id = '#{orderitem[0][1]}'").first
|
||||||
source = Order.find(item.order_id).source
|
source = Order.find(item.order_id).source
|
||||||
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off,source)
|
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off,source)
|
||||||
else
|
else
|
||||||
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||||
item = OrderItem.find_by_item_instance_code(promo_product.item_code)
|
# foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
||||||
|
# item = OrderItem.find_by_item_instance_code(promo_product.item_code)
|
||||||
|
item = OrderItem.where("item_instance_code = '#{promo_product.item_code}' and order_id = '#{orderitem[0][1]}'").first
|
||||||
source = Order.find(item.order_id).source
|
source = Order.find(item.order_id).source
|
||||||
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off,source)
|
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off,source)
|
||||||
end
|
end
|
||||||
@@ -202,14 +206,20 @@ class Promotion < ApplicationRecord
|
|||||||
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
||||||
if same
|
if same
|
||||||
foc_qty = orderitem[1].to_i / foc_min_qty
|
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||||
item = OrderItem.find_by_item_instance_code(orderitem[0]) # need to specify with menu item instance
|
# item = OrderItem.find_by_item_instance_code(orderitem[0][0]) # need to specify with menu item instance
|
||||||
|
item = OrderItem.where("item_instance_code = '#{orderitem[0][0]}' and order_id = '#{orderitem[0][1]}'").first
|
||||||
price = item.price.to_i - promo_product.net_price.to_i
|
price = item.price.to_i - promo_product.net_price.to_i
|
||||||
|
|
||||||
source = Order.find(item.order_id).source
|
source = Order.find(item.order_id).source
|
||||||
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price,source)
|
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price,source)
|
||||||
else
|
else
|
||||||
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
order_qty = find_second_item_qty(sale_id, promo_product.item_code)# need to check for qty
|
||||||
item = OrderItem.find_by_item_instance_code(promo_product.item_code)
|
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||||
|
|
||||||
|
if foc_qty > order_qty
|
||||||
|
foc_qty = order_qty
|
||||||
|
end
|
||||||
|
# item = OrderItem.find_by_item_instance_code(promo_product.item_code)
|
||||||
|
item = OrderItem.where("item_instance_code = '#{promo_product.item_code}' and order_id = '#{orderitem[0][1]}'").first
|
||||||
price = item.price - promo_product.net_price
|
price = item.price - promo_product.net_price
|
||||||
source = Order.find(item.order_id).source
|
source = Order.find(item.order_id).source
|
||||||
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price,source)
|
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price,source)
|
||||||
@@ -220,18 +230,23 @@ class Promotion < ApplicationRecord
|
|||||||
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
||||||
if same
|
if same
|
||||||
foc_qty = orderitem[1].to_i / foc_min_qty
|
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||||
item = OrderItem.find_by_item_instance_code(orderitem[0])
|
# item = OrderItem.find_by_item_instance_code(orderitem[0][0])
|
||||||
|
item = OrderItem.where("item_instance_code = '#{orderitem[0][0]}' and order_id = '#{orderitem[0][1]}'").first
|
||||||
# total = orderitem[1].to_i * item.price
|
# total = orderitem[1].to_i * item.price
|
||||||
total = item.price
|
total = item.price
|
||||||
price = calculate_discount(total, promo_product.percentage)
|
price = calculate_discount(total, promo_product.percentage)
|
||||||
source = Order.find(item.order_id).source
|
source = Order.find(item.order_id).source
|
||||||
update_existing_item(foc_qty, item, sale_id, "promotion discount", price,source)
|
update_existing_item(foc_qty, item, sale_id, "promotion discount", price,source)
|
||||||
else
|
else
|
||||||
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
order_qty = find_second_item_qty(sale_id, promo_product.item_code) #need to check
|
||||||
|
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||||
# give total qty is 1
|
# give total qty is 1
|
||||||
#foc_qty = (foc_qty - foc_qty) + 1
|
#foc_qty = (foc_qty - foc_qty) + 1
|
||||||
|
if foc_qty > order_qty
|
||||||
item = OrderItem.find_by_item_instance_code(promo_product.item_code)
|
foc_qty = order_qty
|
||||||
|
end
|
||||||
|
# item = OrderItem.find_by_item_instance_code(promo_product.item_code)
|
||||||
|
item = OrderItem.where("item_instance_code = '#{promo_product.item_code}' and order_id = '#{orderitem[0][1]}'").first
|
||||||
# total = item.price * foc_qty
|
# total = item.price * foc_qty
|
||||||
total = item.price
|
total = item.price
|
||||||
price = calculate_discount(total, promo_product.percentage)
|
price = calculate_discount(total, promo_product.percentage)
|
||||||
@@ -245,7 +260,7 @@ class Promotion < ApplicationRecord
|
|||||||
itemList = combine_item(saleObj)
|
itemList = combine_item(saleObj)
|
||||||
itemList.each do |item|
|
itemList.each do |item|
|
||||||
item.each do |i|
|
item.each do |i|
|
||||||
if i[0] == promo_item.downcase
|
if i[0][0] == promo_item.downcase
|
||||||
return i[1]
|
return i[1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -253,7 +268,7 @@ class Promotion < ApplicationRecord
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.calculate_discount(total, discount)
|
def self.calculate_discount(total, percentage)
|
||||||
return (total.to_i * discount.to_i) / 100
|
return (total.to_i * percentage.to_i) / 100
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -619,16 +619,16 @@ class SalePayment < ApplicationRecord
|
|||||||
table.save
|
table.save
|
||||||
end
|
end
|
||||||
|
|
||||||
type = 'payment'
|
# type = 'payment'
|
||||||
#Send to background job for processing
|
#Send to background job for processing
|
||||||
# OrderBroadcastJob.perform_later(table,type)
|
# OrderBroadcastJob.perform_later(table,type)
|
||||||
#if ENV["SERVER_MODE"] != 'cloud'
|
#if ENV["SERVER_MODE"] != 'cloud'
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
# if ENV["SERVER_MODE"] == 'cloud'
|
||||||
from = request.subdomain + "." + request.domain
|
# from = request.subdomain + "." + request.domain
|
||||||
else
|
# else
|
||||||
from = ""
|
# from = ""
|
||||||
end
|
# end
|
||||||
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
# ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||||
#end
|
#end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class OrderItemCustomisePdf < Prawn::Document
|
|||||||
self.order_no_font_size = 8
|
self.order_no_font_size = 8
|
||||||
self.margin = 0
|
self.margin = 0
|
||||||
self.price_width = 40 # No Need for item
|
self.price_width = 40 # No Need for item
|
||||||
self.qty_width = 25
|
self.qty_width = 40
|
||||||
self.total_width = 40 # No Need for item
|
self.total_width = 40 # No Need for item
|
||||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||||
self.item_height = 15
|
self.item_height = 15
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class OrderItemSlimCustomisePdf < Prawn::Document
|
|||||||
self.item_font_size = print_settings.item_font_size.to_i
|
self.item_font_size = print_settings.item_font_size.to_i
|
||||||
self.margin = 0
|
self.margin = 0
|
||||||
self.price_width = 40 # No Need for item
|
self.price_width = 40 # No Need for item
|
||||||
self.qty_width = 25
|
self.qty_width = 40
|
||||||
self.total_width = 40 # No Need for item
|
self.total_width = 40 # No Need for item
|
||||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||||
self.item_height = 15
|
self.item_height = 15
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ class OrderItemSlimPdf < Prawn::Document
|
|||||||
def initialize(print_settings,order_item_slim, print_status, options, alt_name, before_updated_qty)
|
def initialize(print_settings,order_item_slim, print_status, options, alt_name, before_updated_qty)
|
||||||
self.page_width = print_settings.page_width
|
self.page_width = print_settings.page_width
|
||||||
self.page_height = print_settings.page_height
|
self.page_height = print_settings.page_height
|
||||||
self.header_font_size = printer_settings.header_font_size.to_i
|
self.header_font_size = print_settings.header_font_size.to_i
|
||||||
self.item_font_size = printer_settings.item_font_size.to_i
|
self.item_font_size = print_settings.item_font_size.to_i
|
||||||
self.margin = 0
|
self.margin = 0
|
||||||
self.price_width = 40 # No Need for item
|
self.price_width = 40 # No Need for item
|
||||||
self.qty_width = 40
|
self.qty_width = 40
|
||||||
@@ -105,14 +105,14 @@ class OrderItemSlimPdf < Prawn::Document
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# if alt_name
|
if alt_name
|
||||||
# if order_item_slim.alt_name
|
if order_item_slim.alt_name
|
||||||
# move_down 1
|
move_down 1
|
||||||
# font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||||
# text "(#{order_item_slim.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
text "(#{order_item_slim.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
|
|
||||||
if !options.empty?
|
if !options.empty?
|
||||||
move_down 1
|
move_down 1
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class OrderSetItemCustomisePdf < Prawn::Document
|
|||||||
self.order_no_font_size = 8
|
self.order_no_font_size = 8
|
||||||
self.margin = 0
|
self.margin = 0
|
||||||
self.price_width = 40 # No Need for item
|
self.price_width = 40 # No Need for item
|
||||||
self.qty_width = 25
|
self.qty_width = 40
|
||||||
self.total_width = 40 # No Need for item
|
self.total_width = 40 # No Need for item
|
||||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||||
self.item_height = 15
|
self.item_height = 15
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class OrderSummaryCustomisePdf < Prawn::Document
|
|||||||
self.order_no_font_size = 8
|
self.order_no_font_size = 8
|
||||||
self.margin = 0
|
self.margin = 0
|
||||||
self.price_width = 40 # No Need for item
|
self.price_width = 40 # No Need for item
|
||||||
self.qty_width = 25
|
self.qty_width = 40
|
||||||
self.total_width = 40 # No Need for item
|
self.total_width = 40 # No Need for item
|
||||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||||
self.item_height = 15
|
self.item_height = 15
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class OrderSummarySetCustomisePdf < Prawn::Document
|
|||||||
self.order_no_font_size = 8
|
self.order_no_font_size = 8
|
||||||
self.margin = 0
|
self.margin = 0
|
||||||
self.price_width = 40 # No Need for item
|
self.price_width = 40 # No Need for item
|
||||||
self.qty_width = 25
|
self.qty_width = 40
|
||||||
self.total_width = 40 # No Need for item
|
self.total_width = 40 # No Need for item
|
||||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||||
self.item_height = 15
|
self.item_height = 15
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class OrderSummarySlimCustomisePdf < Prawn::Document
|
|||||||
self.item_font_size = print_settings.item_font_size.to_i
|
self.item_font_size = print_settings.item_font_size.to_i
|
||||||
self.margin = 0
|
self.margin = 0
|
||||||
self.price_width = 40 # No Need for item
|
self.price_width = 40 # No Need for item
|
||||||
self.qty_width = 25
|
self.qty_width = 40
|
||||||
self.total_width = 40 # No Need for item
|
self.total_width = 40 # No Need for item
|
||||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||||
self.item_height = 15
|
self.item_height = 15
|
||||||
|
|||||||
@@ -211,7 +211,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<!-- <div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div><strong id="order-title">Promo Code</strong></div>
|
<div><strong id="order-title">Promo Code</strong></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -233,7 +233,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
<!-- Column Three -->
|
<!-- Column Three -->
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
@@ -432,6 +432,9 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
// Pay Discount for Payment
|
// Pay Discount for Payment
|
||||||
$("#pay-discount").on('click', function(e){
|
$("#pay-discount").on('click', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
if($('#pay-discount').is(":visible")) {
|
||||||
|
$('#pay-discount').prop("disabled",true);
|
||||||
|
}
|
||||||
$("#loading_wrapper").show();
|
$("#loading_wrapper").show();
|
||||||
var sale_id = $('#sale-id').text();
|
var sale_id = $('#sale-id').text();
|
||||||
var discount_items = JSON.stringify(get_discount_item_rows());
|
var discount_items = JSON.stringify(get_discount_item_rows());
|
||||||
|
|||||||
@@ -869,6 +869,10 @@
|
|||||||
|
|
||||||
// Bill Request
|
// Bill Request
|
||||||
$('#request_bills').click(function () {
|
$('#request_bills').click(function () {
|
||||||
|
if($('#request_bills').is(":visible")) {
|
||||||
|
$('#request_bills').prop("disabled",true);
|
||||||
|
}
|
||||||
|
|
||||||
var order_id = $('#save_order_id').attr('data-order');
|
var order_id = $('#save_order_id').attr('data-order');
|
||||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -893,6 +897,9 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#move').on('click', function () {
|
$('#move').on('click', function () {
|
||||||
|
if($('#move').is(":visible")) {
|
||||||
|
$('#move').prop("disabled",true);
|
||||||
|
}
|
||||||
var dining_id = "<%= @dining.id %>";
|
var dining_id = "<%= @dining.id %>";
|
||||||
window.location.href = '/origami/table/' + dining_id + "/movetable";
|
window.location.href = '/origami/table/' + dining_id + "/movetable";
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -308,6 +308,9 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
// Calculate Other Charges for Payment
|
// Calculate Other Charges for Payment
|
||||||
$("#charge_other").on('click', function(e){
|
$("#charge_other").on('click', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
if($('#charge_other').is(":visible")) {
|
||||||
|
$('#charge_other').prop("disabled",true);
|
||||||
|
}
|
||||||
var sale_id = $('#sale-id').text();
|
var sale_id = $('#sale-id').text();
|
||||||
var sub_total = $('#order-sub-total').text();
|
var sub_total = $('#order-sub-total').text();
|
||||||
var other_charges_items = JSON.stringify(get_other_item_rows());
|
var other_charges_items = JSON.stringify(get_other_item_rows());
|
||||||
|
|||||||
@@ -33,7 +33,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row p-l-5 p-r-5">
|
<div class="row p-l-5 p-r-5">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6"><strong>Customer :</strong> <span id="customer_name"> <%= @sale_data.customer.name%></span> <span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span>
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<strong>Customer :</strong>
|
||||||
|
<button type="button" class="btn bg-info waves-effect" id='customer_name'><%= @sale_data.customer.name%></button>
|
||||||
|
<span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span>
|
||||||
<span class="hidden" id="member_discount"><%= @member_discount%></span></div>
|
<span class="hidden" id="member_discount"><%= @member_discount%></span></div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Checkin Time : </strong> <%if !@checkin_time.nil?%><%= @checkin_time.utc.getlocal.strftime("%I:%M %p") %>
|
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Checkin Time : </strong> <%if !@checkin_time.nil?%><%= @checkin_time.utc.getlocal.strftime("%I:%M %p") %>
|
||||||
<%end%></div>
|
<%end%></div>
|
||||||
@@ -465,7 +468,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="mr-2 m-t-5 btn-lg btn-block bg-red waves-effect print_receipt"> Print
|
<button type="button" class="mr-2 m-t-5 btn-lg btn-block bg-red waves-effect print_receipt" id="print_receipt"> Print
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn-lg btn-block bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
|
<button type="button" class="btn-lg btn-block bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
|
||||||
CLOSE
|
CLOSE
|
||||||
@@ -622,14 +625,10 @@
|
|||||||
var cashier_type = "<%= @cashier_type %>";
|
var cashier_type = "<%= @cashier_type %>";
|
||||||
var customer_id = "<%= @customer.id %>";
|
var customer_id = "<%= @customer.id %>";
|
||||||
var customer_name = "<%= @customer.name %>";
|
var customer_name = "<%= @customer.name %>";
|
||||||
|
var pdf_view = '<%=@pdf_view%>';
|
||||||
|
console.log(pdf_view)
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
setHeaderBreadCrumb(_PAYMENTS_);
|
setHeaderBreadCrumb(_PAYMENTS_);
|
||||||
//start customer modal popup
|
|
||||||
if((cashier_type=='quick_service') && (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});
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* start check first bill or not*/
|
/* start check first bill or not*/
|
||||||
var member_id = $('#membership_id').text();
|
var member_id = $('#membership_id').text();
|
||||||
@@ -765,8 +764,8 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
calculate_member_discount(sale_id,tax_type);
|
calculate_member_discount(sale_id,tax_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#pdfModal").on('shown.bs.modal', function () {
|
// $("#pdfModal").on('shown.bs.modal', function () {
|
||||||
$('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
|
// $('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_cash_path %>",
|
url: "<%= origami_payment_cash_path %>",
|
||||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type,
|
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type,
|
||||||
@@ -794,8 +793,6 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
$("#filename").val(result.filename);
|
$("#filename").val(result.filename);
|
||||||
$("#printer_name").val(result.printer_name);
|
$("#printer_name").val(result.printer_name);
|
||||||
$("#receipt_pdf").attr("src", pdfPath);
|
$("#receipt_pdf").attr("src", pdfPath);
|
||||||
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
|
|
||||||
$("#pdfModalLabel").text("Sale Completed");
|
|
||||||
$("#changed_amount").text("");
|
$("#changed_amount").text("");
|
||||||
if($('#balance').text() < 0){
|
if($('#balance').text() < 0){
|
||||||
<% if precision.to_i > 0 %>
|
<% if precision.to_i > 0 %>
|
||||||
@@ -805,39 +802,13 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
<% end %>
|
<% end %>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pdf_view == 1) {
|
||||||
|
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
|
||||||
|
$("#pdfModalLabel").text("Sale Completed");
|
||||||
|
}else{
|
||||||
//PDF lightbox data
|
//PDF lightbox data
|
||||||
// if($('#balance').text() < 0){
|
print_receipt();
|
||||||
// swal({
|
}
|
||||||
// title: "Payment Successful!",
|
|
||||||
// text: 'Changed amount ' + $('#balance').text() * (-1),
|
|
||||||
// html: true,
|
|
||||||
// closeOnConfirm: false,
|
|
||||||
// closeOnCancel: false,
|
|
||||||
// allowOutsideClick: false
|
|
||||||
// }, function () {
|
|
||||||
// if (cashier_type=="cashier") {
|
|
||||||
// window.location.href = '/origami';
|
|
||||||
// }else{
|
|
||||||
// window.location.href = '/origami/quick_service';
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }else{
|
|
||||||
// $('#pay').text("Pay");
|
|
||||||
// swal({
|
|
||||||
// title: "Payment Successful!",
|
|
||||||
// text: 'Thank You !',
|
|
||||||
// html: true,
|
|
||||||
// closeOnConfirm: false,
|
|
||||||
// closeOnCancel: false,
|
|
||||||
// allowOutsideClick: false
|
|
||||||
// }, function () {
|
|
||||||
// if (cashier_type=="cashier") {
|
|
||||||
// window.location.href = '/origami';
|
|
||||||
// }else{
|
|
||||||
// window.location.href = '/origami/quick_service';
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1074,23 +1045,22 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
|
|
||||||
//print pdf function
|
//print pdf function
|
||||||
// $(".print_receipt").on('click',function(){
|
// $(".print_receipt").on('click',function(){
|
||||||
$(document).on('touchstart click', '.print_receipt', function(event){
|
$("#print_receipt").on('click touchstart', function(event){
|
||||||
|
$(this).off("click touchstart touchend");
|
||||||
|
print_receipt();
|
||||||
|
});
|
||||||
|
|
||||||
|
function print_receipt() {
|
||||||
|
if($('#pay').is(":visible")) {
|
||||||
|
$('#pay').prop("disabled",true);
|
||||||
|
}
|
||||||
|
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
var filename = $("#filename").val();
|
var filename = $("#filename").val();
|
||||||
var printer_name = $("#printer_name").val();
|
var printer_name = $("#printer_name").val();
|
||||||
var receipt_no = $("#sale_receipt_no").val();
|
var receipt_no = $("#sale_receipt_no").val();
|
||||||
var params = { 'filename':filename, 'receipt_no':receipt_no, 'printer_name':printer_name };
|
var params = { 'filename':filename, 'receipt_no':receipt_no, 'printer_name':printer_name };
|
||||||
|
|
||||||
// swal({
|
|
||||||
// title: "Alert",
|
|
||||||
// text: "Are you sure want to print?",
|
|
||||||
// type: "warning",
|
|
||||||
// showCancelButton: true,
|
|
||||||
// confirmButtonColor: "#DD6B55",
|
|
||||||
// confirmButtonText: "Print",
|
|
||||||
// closeOnConfirm: false
|
|
||||||
// }, function (isConfirm) {
|
|
||||||
// if (isConfirm) {
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/origami/sale/"+sale_id+"/"+cashier_type+"/payment/print",
|
url: "/origami/sale/"+sale_id+"/"+cashier_type+"/payment/print",
|
||||||
@@ -1100,18 +1070,43 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
if ($("#server_mode").val() == "cloud") {
|
if ($("#server_mode").val() == "cloud") {
|
||||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (pdf_view ==1) {
|
||||||
if (cashier_type=="cashier") {
|
if (cashier_type=="cashier") {
|
||||||
window.location.href = '/origami';
|
window.location.href = '/origami';
|
||||||
}else{
|
}else{
|
||||||
window.location.href = '/origami/quick_service';
|
window.location.href = '/origami/quick_service';
|
||||||
customer_display_view(null,"reload");
|
customer_display_view(null,"reload");
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
var title = "Payment Successful!";
|
||||||
|
if($('#balance').text() < 0){
|
||||||
|
var text = 'Changed amount ' + $('#balance').text() * (-1);
|
||||||
|
}else{
|
||||||
|
$('#pay').text("Pay");
|
||||||
|
var text = 'Thank You !';
|
||||||
|
}
|
||||||
|
swal({
|
||||||
|
title: "Payment Successful!",
|
||||||
|
text: text,
|
||||||
|
html: true,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false
|
||||||
|
}, function () {
|
||||||
|
if (cashier_type=="cashier") {
|
||||||
|
window.location.href = '/origami';
|
||||||
|
}else{
|
||||||
|
window.location.href = '/origami/quick_service';
|
||||||
|
customer_display_view(null,"reload");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// }
|
}
|
||||||
// });
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$(".btn_pdf_close").on('click',function(){
|
$(".btn_pdf_close").on('click',function(){
|
||||||
@@ -1489,4 +1484,14 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
$(".change_tax").hide();
|
$(".change_tax").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){
|
||||||
|
$("#is_memberModal").modal({show : true, backdrop: false, keyboard : false});
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ $(document).ready(function(){
|
|||||||
swal("Information!", result.error_message);
|
swal("Information!", result.error_message);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.location.href = '/origami/quick_service/pending_order';
|
window.location.href = '/origami/sale/'+result.data+'/quick_service/payment';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -870,6 +870,9 @@ $('#pay').on('click',function() {
|
|||||||
});
|
});
|
||||||
// Bill Request
|
// Bill Request
|
||||||
$('#request_bills').click(function() {
|
$('#request_bills').click(function() {
|
||||||
|
if($('#request_bills').is(":visible")) {
|
||||||
|
$('#request_bills').prop("disabled",true);
|
||||||
|
}
|
||||||
var order_id = $('#save_order_id').attr('data-order');
|
var order_id = $('#save_order_id').attr('data-order');
|
||||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -894,6 +897,9 @@ $('#split_bills').click(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#move').on('click',function(){
|
$('#move').on('click',function(){
|
||||||
|
if($('#move').is(":visible")) {
|
||||||
|
$('#move').prop("disabled",true);
|
||||||
|
}
|
||||||
var dining_id = "<%= @room.id %>"
|
var dining_id = "<%= @room.id %>"
|
||||||
window.location.href = '/origami/table/'+ dining_id + "/moveroom";
|
window.location.href = '/origami/table/'+ dining_id + "/moveroom";
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -32,8 +32,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<%= link_to t("views.btn.new"),new_settings_menu_path,:class => 'btn btn-primary btn-lg float-right waves-effect"' %>
|
<%= link_to t("views.btn.new"),new_settings_menu_path,:class => 'btn btn-primary btn-lg float-right waves-effect"' %>
|
||||||
|
|
||||||
<%= link_to "Export", settings_menus_path(format: "xlsx"),:class => 'btn btn-info btn-lg waves-effect float-right m-r-10' %>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
|
|||||||
Reference in New Issue
Block a user