pull from master
This commit is contained in:
11
README.md
11
README.md
@@ -62,7 +62,12 @@ For Order Printing
|
||||
5)) ********* Order Set Pdf *********
|
||||
1) settings/print_settings
|
||||
(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
|
||||
*** change ReceiptBillPdf to ReceiptBillA5Pdf
|
||||
@@ -185,6 +190,10 @@ For MoveTablePdf in print settings
|
||||
3) settings/lookups => { type:tax_profiles, name: Doemal, value: doemal }
|
||||
/* 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
|
||||
=> 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"
|
||||
|
||||
def check_customer
|
||||
customer_id = 0
|
||||
customer_id = nil
|
||||
status = false
|
||||
if !params[:name]
|
||||
render :json => { :status => false, :message => "name is 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!" }
|
||||
if !params[:name] || !params[:email] || !params[:membership_id]
|
||||
render :json => { :status => false, :message => "name, email and membership_id are required!" }
|
||||
else
|
||||
status = true
|
||||
end
|
||||
@@ -25,7 +21,11 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
||||
customer = OrderReservation.addCustomer(params)
|
||||
customer_id = customer.id
|
||||
end
|
||||
render :json => { :status => true, :data => { :customer_id => customer_id} }
|
||||
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} }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -233,25 +233,23 @@ class Api::OrdersController < Api::ApiController
|
||||
printer = PrintSetting.all
|
||||
|
||||
unique_code="OrderItemPdf"
|
||||
if !order_slim_pdf.empty?
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'OrderItemPdf'
|
||||
unique_code="OrderItemPdf"
|
||||
elsif printer_setting.unique_code == 'OrderItemSlimPdf'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
elsif printer_setting.unique_code == 'OrderSetItemPdf'
|
||||
unique_code="OrderSetItemPdf"
|
||||
elsif printer_setting.unique_code == 'OrderItemSlimCustomisePdf'
|
||||
unique_code="OrderItemSlimCustomisePdf"
|
||||
elsif printer_setting.unique_code == 'OrderItemCustomisePdf'
|
||||
unique_code="OrderItemCustomisePdf"
|
||||
elsif printer_setting.unique_code == 'OrderSetItemCustomisePdf'
|
||||
unique_code="OrderSetItemCustomisePdf"
|
||||
end
|
||||
end
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'OrderItemPdf'
|
||||
unique_code="OrderItemPdf"
|
||||
elsif printer_setting.unique_code == 'OrderItemSlimPdf'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
elsif printer_setting.unique_code == 'OrderSetItemPdf'
|
||||
unique_code="OrderSetItemPdf"
|
||||
elsif printer_setting.unique_code == 'OrderItemSlimCustomisePdf'
|
||||
unique_code="OrderItemSlimCustomisePdf"
|
||||
elsif printer_setting.unique_code == 'OrderItemCustomisePdf'
|
||||
unique_code="OrderItemCustomisePdf"
|
||||
elsif printer_setting.unique_code == 'OrderSetItemCustomisePdf'
|
||||
unique_code="OrderSetItemCustomisePdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
|
||||
@@ -67,8 +67,6 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def get_menu()
|
||||
puts "sssssssssssssss"
|
||||
puts params[:id]
|
||||
if (params[:id])
|
||||
#Pull this menu
|
||||
@menu = Menu.find_by_id(params[:id])
|
||||
@@ -122,11 +120,11 @@ puts params[:id]
|
||||
items_arr.push(items)
|
||||
}
|
||||
# begin
|
||||
# if params[:order_source] == "quick_service"
|
||||
# customer_id = "CUS-000000000002" # for no customer id from mobile
|
||||
# else
|
||||
if params[:order_source] == "quick_service" && params[:table_id].to_i == 0
|
||||
customer_id = "CUS-000000000002" # for no customer id from mobile
|
||||
else
|
||||
customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
# end
|
||||
end
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
@order.order_type = params[:order_type]
|
||||
@@ -182,6 +180,15 @@ puts params[:id]
|
||||
@status, @booking = @order.generate
|
||||
|
||||
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"
|
||||
process_order_queue(@order.order_id,@order.table_id,@order.source)
|
||||
end
|
||||
@@ -194,11 +201,7 @@ puts params[:id]
|
||||
|
||||
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
||||
# for second display
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
else
|
||||
from = ""
|
||||
end
|
||||
from = getCloudDomain #get sub domain in cloud mode
|
||||
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
|
||||
#end
|
||||
result = {:status=> @status, :data => @sale }
|
||||
@@ -307,11 +310,7 @@ puts params[:id]
|
||||
oqs.process_order(order, table_id, order_source)
|
||||
end
|
||||
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
else
|
||||
from = ""
|
||||
end
|
||||
from = getCloudDomain #get sub domain in cloud mode
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
||||
end
|
||||
@@ -325,6 +324,16 @@ puts params[:id]
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
#get cloud domain
|
||||
def getCloudDomain
|
||||
from = ""
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
end
|
||||
|
||||
return from
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
@@ -135,6 +135,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_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
|
||||
shift = ShiftSale.find(saleObj.shift_sale_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)
|
||||
oqs = OrderQueueStation.new
|
||||
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
|
||||
@@ -242,7 +250,11 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@table_no = ''
|
||||
@dining = ''
|
||||
@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
|
||||
|
||||
@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.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
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
# if bookings.count > 1
|
||||
@@ -595,4 +611,14 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
render json: JSON.generate({:status => true})
|
||||
end
|
||||
|
||||
#get cloud domain
|
||||
def getCloudDomain
|
||||
from = ""
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
end
|
||||
|
||||
return from
|
||||
end
|
||||
end
|
||||
@@ -76,7 +76,7 @@ class Order < ApplicationRecord
|
||||
# end
|
||||
|
||||
#send order to broadcast job
|
||||
send_order_broadcast(booking)
|
||||
# send_order_broadcast(booking)
|
||||
|
||||
return true, booking
|
||||
end
|
||||
|
||||
@@ -121,13 +121,13 @@ class OrderQueueStation < ApplicationRecord
|
||||
# oqs = OrderQueueStation.new
|
||||
# oqs.process_order(order, table_id)
|
||||
# end
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
else
|
||||
from = ""
|
||||
end
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
||||
# assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||
# if ENV["SERVER_MODE"] == 'cloud'
|
||||
# from = request.subdomain + "." + request.domain
|
||||
# else
|
||||
# from = ""
|
||||
# end
|
||||
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
||||
|
||||
if table_id.to_i > 0
|
||||
# get dining
|
||||
|
||||
@@ -29,12 +29,13 @@ class Promotion < ApplicationRecord
|
||||
end
|
||||
|
||||
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 = []
|
||||
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
|
||||
|
||||
return itemList
|
||||
end
|
||||
|
||||
@@ -51,10 +52,9 @@ class Promotion < ApplicationRecord
|
||||
end
|
||||
|
||||
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|
|
||||
|
||||
if promo.original_product.downcase.to_s == odr_item[0]
|
||||
if promo.original_product.downcase.to_s == odr_item[0][0]
|
||||
if promo.min_qty.to_i > odr_item[1].to_i
|
||||
return false
|
||||
else
|
||||
@@ -66,13 +66,13 @@ class Promotion < ApplicationRecord
|
||||
|
||||
def self.check_promo_type(promo, orderitem, sale_id)
|
||||
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
|
||||
else
|
||||
# return false, promo_product
|
||||
same = false
|
||||
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 same
|
||||
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
|
||||
charge_qty += qty
|
||||
end
|
||||
item = OrderItem.find_by_item_instance_code(orderitem[0])
|
||||
if promo_product == OrderItem.find_by_item_instance_code(orderitem[0]).item_instance_code
|
||||
item = OrderItem.find_by_item_instance_code(orderitem[0])
|
||||
else
|
||||
item = OrderItem.find_by_item_code(promo_product)
|
||||
item = OrderItem.where("item_instance_code = '#{orderitem[0][0]}' and order_id = '#{orderitem[0][1]}'").first
|
||||
if promo_product.downcase != item.item_instance_code
|
||||
# item = item
|
||||
# else
|
||||
# item = OrderItem.find_by_item_code(promo_product)
|
||||
item = OrderItem.where("item_code = '#{promo_product}' and order_id = '#{orderitem[0][1]}'").first
|
||||
end
|
||||
source = Order.find(item.order_id).source
|
||||
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion", item.price,source)
|
||||
|
||||
puts "Charged - " + charge_qty.to_s
|
||||
@@ -153,7 +153,9 @@ class Promotion < ApplicationRecord
|
||||
if (foc_qty < promotion_qty)
|
||||
promotion_qty = foc_qty
|
||||
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
|
||||
update_existing_item(promotion_qty, item, sale_id, "promotion", item.price,source)
|
||||
end
|
||||
@@ -184,15 +186,17 @@ class Promotion < ApplicationRecord
|
||||
|
||||
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
|
||||
|
||||
if same
|
||||
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
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off,source)
|
||||
else
|
||||
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
||||
item = OrderItem.find_by_item_instance_code(promo_product.item_code)
|
||||
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||
# 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
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off,source)
|
||||
end
|
||||
@@ -202,16 +206,22 @@ 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
|
||||
if same
|
||||
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
|
||||
|
||||
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)
|
||||
else
|
||||
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
||||
item = OrderItem.find_by_item_instance_code(promo_product.item_code)
|
||||
order_qty = find_second_item_qty(sale_id, promo_product.item_code)# need to check for qty
|
||||
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
|
||||
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)
|
||||
end
|
||||
end
|
||||
@@ -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
|
||||
if same
|
||||
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 = item.price
|
||||
price = calculate_discount(total, promo_product.percentage)
|
||||
source = Order.find(item.order_id).source
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion discount", price,source)
|
||||
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
|
||||
#foc_qty = (foc_qty - foc_qty) + 1
|
||||
|
||||
item = OrderItem.find_by_item_instance_code(promo_product.item_code)
|
||||
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
|
||||
# total = item.price * foc_qty
|
||||
total = item.price
|
||||
price = calculate_discount(total, promo_product.percentage)
|
||||
@@ -245,7 +260,7 @@ class Promotion < ApplicationRecord
|
||||
itemList = combine_item(saleObj)
|
||||
itemList.each do |item|
|
||||
item.each do |i|
|
||||
if i[0] == promo_item.downcase
|
||||
if i[0][0] == promo_item.downcase
|
||||
return i[1]
|
||||
end
|
||||
end
|
||||
@@ -253,7 +268,7 @@ class Promotion < ApplicationRecord
|
||||
return 0
|
||||
end
|
||||
|
||||
def self.calculate_discount(total, discount)
|
||||
return (total.to_i * discount.to_i) / 100
|
||||
def self.calculate_discount(total, percentage)
|
||||
return (total.to_i * percentage.to_i) / 100
|
||||
end
|
||||
end
|
||||
|
||||
@@ -619,16 +619,16 @@ class SalePayment < ApplicationRecord
|
||||
table.save
|
||||
end
|
||||
|
||||
type = 'payment'
|
||||
# type = 'payment'
|
||||
#Send to background job for processing
|
||||
# OrderBroadcastJob.perform_later(table,type)
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
else
|
||||
from = ""
|
||||
end
|
||||
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||
# if ENV["SERVER_MODE"] == 'cloud'
|
||||
# from = request.subdomain + "." + request.domain
|
||||
# else
|
||||
# from = ""
|
||||
# end
|
||||
# ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||
#end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@ class OrderItemCustomisePdf < Prawn::Document
|
||||
self.order_no_font_size = 8
|
||||
self.margin = 0
|
||||
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.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
|
||||
@@ -8,7 +8,7 @@ class OrderItemSlimCustomisePdf < Prawn::Document
|
||||
self.item_font_size = print_settings.item_font_size.to_i
|
||||
self.margin = 0
|
||||
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.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
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)
|
||||
self.page_width = print_settings.page_width
|
||||
self.page_height = print_settings.page_height
|
||||
self.header_font_size = printer_settings.header_font_size.to_i
|
||||
self.item_font_size = printer_settings.item_font_size.to_i
|
||||
self.header_font_size = print_settings.header_font_size.to_i
|
||||
self.item_font_size = print_settings.item_font_size.to_i
|
||||
self.margin = 0
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 40
|
||||
@@ -105,14 +105,14 @@ class OrderItemSlimPdf < Prawn::Document
|
||||
|
||||
end
|
||||
|
||||
# if alt_name
|
||||
# if order_item_slim.alt_name
|
||||
# move_down 1
|
||||
# font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||
# text "(#{order_item_slim.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
if alt_name
|
||||
if order_item_slim.alt_name
|
||||
move_down 1
|
||||
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||
text "(#{order_item_slim.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if !options.empty?
|
||||
move_down 1
|
||||
|
||||
@@ -9,7 +9,7 @@ class OrderSetItemCustomisePdf < Prawn::Document
|
||||
self.order_no_font_size = 8
|
||||
self.margin = 0
|
||||
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.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
|
||||
@@ -9,7 +9,7 @@ class OrderSummaryCustomisePdf < Prawn::Document
|
||||
self.order_no_font_size = 8
|
||||
self.margin = 0
|
||||
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.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
|
||||
@@ -9,7 +9,7 @@ class OrderSummarySetCustomisePdf < Prawn::Document
|
||||
self.order_no_font_size = 8
|
||||
self.margin = 0
|
||||
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.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
|
||||
@@ -8,7 +8,7 @@ class OrderSummarySlimCustomisePdf < Prawn::Document
|
||||
self.item_font_size = print_settings.item_font_size.to_i
|
||||
self.margin = 0
|
||||
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.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<!-- <div class="card">
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">Promo Code</strong></div>
|
||||
</div>
|
||||
@@ -233,7 +233,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<!-- Column Three -->
|
||||
<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").on('click', function(e){
|
||||
e.preventDefault();
|
||||
if($('#pay-discount').is(":visible")) {
|
||||
$('#pay-discount').prop("disabled",true);
|
||||
}
|
||||
$("#loading_wrapper").show();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_items = JSON.stringify(get_discount_item_rows());
|
||||
|
||||
@@ -869,6 +869,10 @@
|
||||
|
||||
// Bill Request
|
||||
$('#request_bills').click(function () {
|
||||
if($('#request_bills').is(":visible")) {
|
||||
$('#request_bills').prop("disabled",true);
|
||||
}
|
||||
|
||||
var order_id = $('#save_order_id').attr('data-order');
|
||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||
$.ajax({
|
||||
@@ -893,8 +897,11 @@
|
||||
});
|
||||
|
||||
$('#move').on('click', function () {
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
window.location.href = '/origami/table/' + dining_id + "/movetable";
|
||||
if($('#move').is(":visible")) {
|
||||
$('#move').prop("disabled",true);
|
||||
}
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
window.location.href = '/origami/table/' + dining_id + "/movetable";
|
||||
})
|
||||
|
||||
$('#back').on('click', function () {
|
||||
|
||||
@@ -308,6 +308,9 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
// Calculate Other Charges for Payment
|
||||
$("#charge_other").on('click', function(e){
|
||||
e.preventDefault();
|
||||
if($('#charge_other').is(":visible")) {
|
||||
$('#charge_other').prop("disabled",true);
|
||||
}
|
||||
var sale_id = $('#sale-id').text();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var other_charges_items = JSON.stringify(get_other_item_rows());
|
||||
|
||||
@@ -33,7 +33,10 @@
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
@@ -465,7 +468,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<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 type="button" class="btn-lg btn-block bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
|
||||
CLOSE
|
||||
@@ -622,14 +625,10 @@
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
var customer_id = "<%= @customer.id %>";
|
||||
var customer_name = "<%= @customer.name %>";
|
||||
var pdf_view = '<%=@pdf_view%>';
|
||||
console.log(pdf_view)
|
||||
$(document).ready(function(){
|
||||
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*/
|
||||
var member_id = $('#membership_id').text();
|
||||
@@ -765,8 +764,8 @@ var customer_name = "<%= @customer.name %>";
|
||||
calculate_member_discount(sale_id,tax_type);
|
||||
}
|
||||
|
||||
$("#pdfModal").on('shown.bs.modal', function () {
|
||||
$('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
|
||||
// $("#pdfModal").on('shown.bs.modal', function () {
|
||||
// $('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_cash_path %>",
|
||||
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);
|
||||
$("#printer_name").val(result.printer_name);
|
||||
$("#receipt_pdf").attr("src", pdfPath);
|
||||
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
|
||||
$("#pdfModalLabel").text("Sale Completed");
|
||||
$("#changed_amount").text("");
|
||||
if($('#balance').text() < 0){
|
||||
<% if precision.to_i > 0 %>
|
||||
@@ -804,40 +801,14 @@ var customer_name = "<%= @customer.name %>";
|
||||
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
|
||||
<% end %>
|
||||
}
|
||||
|
||||
//PDF lightbox data
|
||||
// if($('#balance').text() < 0){
|
||||
// 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';
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
if (pdf_view == 1) {
|
||||
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
|
||||
$("#pdfModalLabel").text("Sale Completed");
|
||||
}else{
|
||||
//PDF lightbox data
|
||||
print_receipt();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1074,23 +1045,22 @@ var customer_name = "<%= @customer.name %>";
|
||||
|
||||
//print pdf 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 filename = $("#filename").val();
|
||||
var printer_name = $("#printer_name").val();
|
||||
var receipt_no = $("#sale_receipt_no").val();
|
||||
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({
|
||||
type: "POST",
|
||||
url: "/origami/sale/"+sale_id+"/"+cashier_type+"/payment/print",
|
||||
@@ -1100,18 +1070,43 @@ var customer_name = "<%= @customer.name %>";
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
customer_display_view(null,"reload");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (pdf_view ==1) {
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
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(){
|
||||
@@ -1489,4 +1484,14 @@ var customer_name = "<%= @customer.name %>";
|
||||
$(".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>
|
||||
|
||||
@@ -237,7 +237,7 @@ $(document).ready(function(){
|
||||
swal("Information!", result.error_message);
|
||||
}
|
||||
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
|
||||
$('#request_bills').click(function() {
|
||||
if($('#request_bills').is(":visible")) {
|
||||
$('#request_bills').prop("disabled",true);
|
||||
}
|
||||
var order_id = $('#save_order_id').attr('data-order');
|
||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||
$.ajax({
|
||||
@@ -894,6 +897,9 @@ $('#split_bills').click(function(){
|
||||
});
|
||||
|
||||
$('#move').on('click',function(){
|
||||
if($('#move').is(":visible")) {
|
||||
$('#move').prop("disabled",true);
|
||||
}
|
||||
var dining_id = "<%= @room.id %>"
|
||||
window.location.href = '/origami/table/'+ dining_id + "/moveroom";
|
||||
})
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
</div>
|
||||
<%= 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 class="card">
|
||||
<table class="table table-striped">
|
||||
|
||||
Reference in New Issue
Block a user