print service
This commit is contained in:
@@ -84,12 +84,12 @@ For ReceiptBillAltName options
|
||||
|
||||
For Using Star Printer
|
||||
*** Need to change these print settings
|
||||
1) settings/print_settings => OrderItemStarPdf
|
||||
2) settings/print_settings => ReceiptBillStarPdf
|
||||
3) settings/print_settings => SaleItemsStarPdf
|
||||
1) settings/print_settings/unique_code => OrderItemStarPdf
|
||||
2) settings/print_settings/unique_code => ReceiptBillStarPdf
|
||||
3) settings/print_settings/unique_code => SaleItemsStarPdf
|
||||
*** Other print settings aren't need to change.
|
||||
|
||||
For Sale Items Summary Include at CloseCashierPrint
|
||||
For Show Sale Items Summary at CloseCashierPrint
|
||||
1) settings/print_settings
|
||||
a) Check => Shift Sale Items
|
||||
|
||||
|
||||
@@ -38,22 +38,21 @@ class Oqs::EditController < BaseOqsController
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" #&& order.source == 'cashier' #no print in cloud server
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code_and_order_id(order_item.item_instance_code, order_item.order_id)
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code_and_order_id(order_item.item_instance_code, order_item.order_id)
|
||||
assigned_items = nil
|
||||
if !assigned_item.nil?
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
|
||||
end
|
||||
end
|
||||
if !assigned_items.nil?
|
||||
assigned_items.each do |assign_item|
|
||||
# order queue stations
|
||||
oqs = assign_item.order_queue_station
|
||||
|
||||
printer = PrintSetting.all
|
||||
|
||||
unique_code="OrderItemPdf"
|
||||
printer = PrintSetting.all
|
||||
unique_code= ""
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'OrderItemPdf'
|
||||
if printer_setting.unique_code == 'OrderItemPdf'
|
||||
unique_code="OrderItemPdf"
|
||||
elsif printer_setting.unique_code == 'OrderItemSlimPdf'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
@@ -62,12 +61,14 @@ class Oqs::EditController < BaseOqsController
|
||||
elsif printer_setting.unique_code == 'OrderItemCustomisePdf'
|
||||
unique_code="OrderItemCustomisePdf"
|
||||
elsif printer_setting.unique_code == 'OrderSetItemCustomisePdf'
|
||||
unique_code="OrderSetItemCustomisePdf"
|
||||
unique_code="OrderSetItemCustomisePdf"
|
||||
elsif printer_setting.unique_code == 'OrderItemSlimCustomisePdf'
|
||||
unique_code="OrderItemSlimCustomisePdf"
|
||||
end
|
||||
elsif printer_setting.unique_code == 'OrderItemStarPdf'
|
||||
unique_code="OrderItemStarPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
|
||||
@@ -8,14 +8,14 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
sale_data = Sale.find_by_sale_id(sale_id)
|
||||
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||
member_info = nil
|
||||
|
||||
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
# if bookings.count > 1
|
||||
# if bookings.count > 1
|
||||
# # for Multiple Booking
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# else
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# end
|
||||
shift = ShiftSale.current_open_shift(current_user.id)
|
||||
if !shift.nil?
|
||||
@@ -48,7 +48,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
if !receipt_bill_a5_pdf.empty?
|
||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[1] == '1'
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
else
|
||||
@@ -59,7 +59,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
#shop detail
|
||||
## shop_detail = Shop.first
|
||||
## shop_detail = Shop.first
|
||||
# customer= Customer.where('customer_id=' +.customer_id)
|
||||
customer = Customer.find(sale_data.customer_id)
|
||||
# rounding adjustment
|
||||
@@ -71,14 +71,14 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
rounding_adj = new_total-sale_data.grand_total
|
||||
sale_data.update_attributes(grand_total: new_total,old_grand_total: sale_data.grand_total,rounding_adjustment:rounding_adj)
|
||||
sale_data.update_attributes(grand_total: new_total,old_grand_total: sale_data.grand_total,rounding_adjustment:rounding_adj)
|
||||
end
|
||||
end
|
||||
#end rounding adjustment
|
||||
#record for sale audit
|
||||
action_by = current_user.name
|
||||
type = "FIRST_BILL"
|
||||
|
||||
|
||||
remark = "#{action_by} print out first bill for Receipt No #{sale_data.receipt_no}"
|
||||
sale_audit = SaleAudit.record_audit_sale(sale_id,remark,action_by,type )
|
||||
# get member information
|
||||
@@ -102,12 +102,12 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount,nil,nil,nil)
|
||||
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount,nil,nil,nil)
|
||||
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
}
|
||||
|
||||
# Mobile Print
|
||||
@@ -127,7 +127,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||
#shop_detail = Shop.first
|
||||
#shop_detail = Shop.first
|
||||
# rounding adjustment
|
||||
if !path.include? ("credit_payment")
|
||||
if shop_detail.is_rounding_adj
|
||||
@@ -138,12 +138,12 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||
rounding_adj = new_total-saleObj.grand_total
|
||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||
end
|
||||
end
|
||||
end
|
||||
#end rounding adjustment
|
||||
|
||||
|
||||
sale_payment = SalePayment.new
|
||||
if path.include? ("credit_payment")
|
||||
sale_payment.process_payment(saleObj, current_user, cash, "cash", nil, true)
|
||||
@@ -166,7 +166,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
table = DiningFacility.find(bookings.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
|
||||
@@ -193,11 +193,11 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
if !receipt_bill_a5_pdf.empty?
|
||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[1] == '1'
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
# else
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -208,16 +208,16 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
|
||||
|
||||
|
||||
if customer.membership_id != nil && rebate && credit_data.nil?
|
||||
member_info = Customer.get_member_account(customer)
|
||||
|
||||
|
||||
if member_info["status"] == true
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#orders print out
|
||||
if params[:type] == "quick_service"
|
||||
booking = Booking.find_by_sale_id(sale_id)
|
||||
@@ -226,7 +226,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
else
|
||||
table_id = 0
|
||||
end
|
||||
|
||||
|
||||
latest_order = booking.booking_orders.order("order_id DESC").limit(1).first()
|
||||
if !latest_order.nil?
|
||||
latest_order_no = latest_order.order_id
|
||||
@@ -241,13 +241,13 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
from = getCloudDomain #get sub domain in cloud mode
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
#for card sale data
|
||||
card_data = Array.new
|
||||
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
||||
if !card_sale_trans_ref_no.nil?
|
||||
if !card_sale_trans_ref_no.nil?
|
||||
card_sale_trans_ref_no.each do |cash_sale_trans|
|
||||
card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
|
||||
card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
|
||||
@@ -259,7 +259,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
#card_balance amount for Paymal payment
|
||||
card_balance_amount = SaleAudit.getCardBalanceAmount(sale_id)
|
||||
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
@@ -274,7 +274,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
#end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@@ -287,11 +287,11 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
else
|
||||
@cashier_type = params[:type]
|
||||
end
|
||||
|
||||
|
||||
if path.include? ("credit_payment")
|
||||
@sale_payment = SalePayment.get_credit_amount_due_left(sale_id)
|
||||
end
|
||||
|
||||
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@membership_rebate_balance=0
|
||||
|
||||
@@ -326,15 +326,15 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
lookup_changable_tax = Lookup.collection_of('changable_tax')
|
||||
if !lookup_changable_tax.empty?
|
||||
lookup_changable_tax.each do |changable_tax|
|
||||
if changable_tax[0].downcase == "change"
|
||||
if changable_tax[1] == '0'
|
||||
if changable_tax[0].downcase == "change"
|
||||
if changable_tax[1] == '0'
|
||||
@changable_tax = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@shop = shop_detail #show shop info
|
||||
|
||||
@shop = shop_detail #show shop info
|
||||
|
||||
@customer_lists = Customer.where("customer_id = 'CUS-000000000001' or customer_id = 'CUS-000000000002'")
|
||||
|
||||
@@ -373,7 +373,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||
@rounding_adj = new_total-saleObj.grand_total
|
||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj)
|
||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj)
|
||||
@sale_data.grand_total = new_total
|
||||
@sale_data.old_grand_total = saleObj.grand_total
|
||||
@sale_data.rounding_adjustment = @rounding_adj
|
||||
@@ -418,11 +418,11 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#end customer amount
|
||||
|
||||
#paymal payment
|
||||
#paymal payment
|
||||
|
||||
@sale_data.bookings.each do |sbk|
|
||||
if sbk.dining_facility_id.to_i >0
|
||||
@@ -444,13 +444,13 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@sale_payment_data = SalePayment.get_sale_payments(@sale_data)
|
||||
end
|
||||
@sale_payment_data.each do |spay|
|
||||
if spay.payment_method == "cash"
|
||||
if spay.payment_method == "cash"
|
||||
@cash += spay.payment_amount
|
||||
end
|
||||
if spay.payment_method !="creditnote"
|
||||
if spay.payment_method !="creditnote"
|
||||
@other_payment += spay.payment_amount
|
||||
end
|
||||
|
||||
|
||||
if spay.payment_method == "mpu"
|
||||
@other += spay.payment_amount
|
||||
elsif spay.payment_method == "paypar"
|
||||
@@ -485,7 +485,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
member_info = nil
|
||||
latest_order_no = nil
|
||||
saleObj = Sale.find(sale_id)
|
||||
|
||||
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
|
||||
@@ -494,11 +494,11 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
if !latest_order.nil?
|
||||
latest_order_no = latest_order.order_id
|
||||
end
|
||||
# if bookings.count > 1
|
||||
# if bookings.count > 1
|
||||
# # for Multiple Booking
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# else
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# end
|
||||
shift = ShiftSale.current_open_shift(current_user.id)
|
||||
if !shift.nil?
|
||||
@@ -512,14 +512,14 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
shift = ShiftSale.find(saleObj.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
unique_code = "ReceiptBillPdf"
|
||||
if !receipt_bill_a5_pdf.empty?
|
||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[1] == '1'
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
else
|
||||
@@ -531,7 +531,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
#shop detail
|
||||
#shop_detail = Shop.first
|
||||
#shop_detail = Shop.first
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
if customer.membership_id != nil && rebate
|
||||
@@ -543,7 +543,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
#for card sale data
|
||||
card_data = Array.new
|
||||
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
||||
if !card_sale_trans_ref_no.nil?
|
||||
if !card_sale_trans_ref_no.nil?
|
||||
card_sale_trans_ref_no.each do |cash_sale_trans|
|
||||
card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
|
||||
card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
|
||||
@@ -566,20 +566,20 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil)
|
||||
|
||||
result = {
|
||||
|
||||
result = {
|
||||
:status => true,
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
}
|
||||
|
||||
|
||||
# Mobile Print
|
||||
render :json => result.to_json
|
||||
# end
|
||||
end
|
||||
|
||||
def foc
|
||||
def foc
|
||||
cash = params[:cash]
|
||||
sale_id = params[:sale_id]
|
||||
sub_total = params[:sub_total]
|
||||
@@ -598,7 +598,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
|
||||
saleObj.compute_by_sale_items(sale_id, saleObj.sale_items,0,order_source)
|
||||
end
|
||||
|
||||
|
||||
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
|
||||
|
||||
sale_payment = SalePayment.new
|
||||
@@ -612,7 +612,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
@@ -629,18 +629,31 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
shift = ShiftSale.find(saleObj.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Re-call Sale Data
|
||||
saleObj = Sale.find(sale_id)
|
||||
|
||||
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
unique_code = "ReceiptBillPdf"
|
||||
# unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
#shop detail
|
||||
#shop_detail = Shop.first
|
||||
|
||||
#shop detail
|
||||
#shop_detail = Shop.first
|
||||
printer = PrintSetting.all
|
||||
|
||||
unique_code="ReceiptBillPdf"
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'ReceiptBillPdf'
|
||||
unique_code="ReceiptBillPdf"
|
||||
elsif printer_setting.unique_code == 'ReceiptBillA5Pdf'
|
||||
unique_code="ReceiptBillA5Pdf"
|
||||
elsif printer_setting.unique_code == 'ReceiptBillStarPdf'
|
||||
unique_code="ReceiptBillStarPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
@@ -652,11 +665,11 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "FOC",nil,nil,other_amount,nil,nil,nil)
|
||||
result = {
|
||||
result = {
|
||||
:status => true,
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
}
|
||||
|
||||
# Mobile Print
|
||||
@@ -669,26 +682,26 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
else
|
||||
table_id = 0
|
||||
end
|
||||
|
||||
|
||||
booking.booking_orders.each do |order|
|
||||
Order.pay_process_order_queue(order.order_id,table_id)
|
||||
end
|
||||
end
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def rounding_adj
|
||||
|
||||
saleObj = Sale.find(params[:sale_id])
|
||||
@shop = shop_detail
|
||||
|
||||
|
||||
if @shop.is_rounding_adj
|
||||
a = saleObj.grand_total % 25 # Modulus
|
||||
b = saleObj.grand_total / 25 # Division
|
||||
b = saleObj.grand_total / 25 # Division
|
||||
#not calculate rounding if modulus is 0 and division is even
|
||||
#calculate rounding if modulus is zero or not zero and division are not even
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||
rounding_adj = new_total-saleObj.grand_total
|
||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||
@@ -697,12 +710,12 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
#print function for receipt
|
||||
def print
|
||||
def print
|
||||
filename = params[:filename]
|
||||
receipt_no = params[:receipt_no]
|
||||
printer_name = params[:printer_name]
|
||||
cashier_type = params[:type]
|
||||
|
||||
|
||||
if cashier_type.strip.downcase == "doemal_order"
|
||||
unique_code = "ReceiptBillOrderPdf"
|
||||
else
|
||||
@@ -720,7 +733,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
if !receipt_bill_a5_pdf.empty?
|
||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[1] == '1'
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
# else
|
||||
@@ -734,12 +747,12 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name)
|
||||
|
||||
result = {
|
||||
|
||||
result = {
|
||||
:status => true,
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
}
|
||||
Rails.logger.debug "$$$$$$$$$ result ::"
|
||||
Rails.logger.debug result
|
||||
@@ -755,7 +768,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
tax_type = params[:tax_type]
|
||||
sale = Sale.find(sale_id)
|
||||
sale.compute_by_sale_items(sale.sale_id, sale.sale_items, sale.total_discount,nil,order_source,tax_type)
|
||||
|
||||
|
||||
render json: JSON.generate({:status => true})
|
||||
end
|
||||
|
||||
@@ -768,4 +781,4 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
return from
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class Origami::QuickServiceController < ApplicationController
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
today = DateTime.now
|
||||
day = Date.today.wday
|
||||
@@ -14,7 +14,7 @@ class Origami::QuickServiceController < ApplicationController
|
||||
@menus = []
|
||||
@menu = []
|
||||
# else
|
||||
# @menus = Menu.all
|
||||
# @menus = Menu.all
|
||||
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
|
||||
# end
|
||||
@zone = Zone.all
|
||||
@@ -28,20 +28,22 @@ class Origami::QuickServiceController < ApplicationController
|
||||
else
|
||||
@display_type = nil
|
||||
end
|
||||
|
||||
|
||||
#checked quick_service only
|
||||
@quick_service_only = true
|
||||
lookup_dine_in = Lookup.collection_of('dinein_cashier')
|
||||
@quick_service_only = false
|
||||
lookup_dine_in = Lookup.collection_of('quickservice_add_order')
|
||||
puts 'lookup_dine_in!!!!'
|
||||
puts lookup_dine_in
|
||||
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
|
||||
if dine_in[0].downcase == "quickserviceaddorder"
|
||||
if dine_in[1] == '1'
|
||||
@quick_service_only = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
render "origami/addorders/detail"
|
||||
end
|
||||
|
||||
@@ -53,7 +55,7 @@ class Origami::QuickServiceController < ApplicationController
|
||||
@menus = []
|
||||
@menu = []
|
||||
# else
|
||||
# @menus = Menu.all
|
||||
# @menus = Menu.all
|
||||
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
|
||||
# end
|
||||
if(params[:id][0,3] == "BKI")
|
||||
@@ -65,7 +67,7 @@ class Origami::QuickServiceController < ApplicationController
|
||||
@table = DiningFacility.find(@table_id)
|
||||
@booking = @table.get_booking
|
||||
end
|
||||
|
||||
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
if @booking
|
||||
@@ -96,7 +98,7 @@ class Origami::QuickServiceController < ApplicationController
|
||||
@cashier_type = "quick_service"
|
||||
|
||||
items_arr = []
|
||||
JSON.parse(params[:order_items]).each { |i|
|
||||
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
|
||||
@@ -169,7 +171,7 @@ class Origami::QuickServiceController < ApplicationController
|
||||
end
|
||||
|
||||
@status, @booking = @order.generate
|
||||
if(params[:sale_id][0,3] == "SAL")
|
||||
if(params[:sale_id][0,3] == "SAL")
|
||||
if @status && @booking && @order.source == 'quick_service'
|
||||
if params[:sale_id]
|
||||
@sale = Sale.find(params[:sale_id])
|
||||
@@ -180,17 +182,17 @@ class Origami::QuickServiceController < ApplicationController
|
||||
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
|
||||
end
|
||||
elsif (params[:sale_id][0,3] == "BKI")
|
||||
result = {:status=> true, :data => 'OK' }
|
||||
render :json => result.to_json
|
||||
render :json => result.to_json
|
||||
else
|
||||
result = {:status=> true, :data => nil }
|
||||
render :json => result.to_json
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -216,9 +218,9 @@ class Origami::QuickServiceController < ApplicationController
|
||||
return @sub_menu
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def get_all_product()
|
||||
@product = Product.all
|
||||
@product = Product.all
|
||||
end
|
||||
|
||||
# render json for http status code
|
||||
|
||||
@@ -28,7 +28,7 @@ class Origami::VoidController < BaseOrigamiController
|
||||
shift.save
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
sale.rounding_adjustment = 0.0
|
||||
sale.payment_status = 'void'
|
||||
sale.sale_status = 'void'
|
||||
@@ -71,16 +71,16 @@ class Origami::VoidController < BaseOrigamiController
|
||||
table = nil
|
||||
end
|
||||
|
||||
# FOr Sale Audit
|
||||
# FOr Sale Audit
|
||||
action_by = current_user.name
|
||||
if access_code != "null" && current_user.role == "cashier"
|
||||
action_by = Employee.find_by_emp_id(access_code).name
|
||||
end
|
||||
|
||||
|
||||
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
||||
sale_audit = SaleAudit.record_audit_for_edit(sale_id,current_user.name, action_by,remark,"SALEVOID" )
|
||||
|
||||
# For Print
|
||||
# For Print
|
||||
|
||||
member_info = nil
|
||||
rebate_amount = nil
|
||||
@@ -88,7 +88,7 @@ class Origami::VoidController < BaseOrigamiController
|
||||
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
if bookings.count > 1
|
||||
if bookings.count > 1
|
||||
# for Multiple Booking
|
||||
if bookings[0].dining_facility_id.to_i>0
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
@@ -102,12 +102,20 @@ class Origami::VoidController < BaseOrigamiController
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
|
||||
|
||||
|
||||
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
unique_code = "ReceiptBillPdf"
|
||||
# get printer info
|
||||
# print_settings = PrintSetting.find_by_unique_code('ReceiptBillPdf') # SaleItemsPdf
|
||||
#
|
||||
# if !print_settings.nil?
|
||||
# unique_code = 'ReceiptBillPdf'
|
||||
# elsif
|
||||
# unique_code = 'ReceiptBillStarPdf'
|
||||
# end
|
||||
|
||||
customer= Customer.find(sale.customer_id)
|
||||
|
||||
|
||||
#shop detail
|
||||
shop_details = current_shop
|
||||
# get member information
|
||||
@@ -119,34 +127,48 @@ class Origami::VoidController < BaseOrigamiController
|
||||
current_balance = 0
|
||||
end
|
||||
|
||||
printer = PrintSetting.all
|
||||
|
||||
unique_code="ReceiptBillPdf"
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'ReceiptBillPdf'
|
||||
unique_code="ReceiptBillPdf"
|
||||
elsif printer_setting.unique_code == 'ReceiptBillA5Pdf'
|
||||
unique_code="ReceiptBillA5Pdf"
|
||||
elsif printer_setting.unique_code == 'ReceiptBillStarPdf'
|
||||
unique_code="ReceiptBillStarPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items)
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||
other_amount = SaleItem.calculate_other_charges(sale.sale_items)
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount,nil,nil,nil)
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount,nil,nil,nil)
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
}
|
||||
|
||||
# Mobile Print
|
||||
render :json => result.to_json
|
||||
# end
|
||||
|
||||
|
||||
#end print
|
||||
|
||||
# update complete order items in oqs
|
||||
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
|
||||
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
|
||||
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
|
||||
aoi.delivery_status = 1
|
||||
aoi.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
||||
# sale.compute_by_sale_items(sale_id, sale.sale_items,0,order_source)
|
||||
# add to sale item with foc
|
||||
# sale_items = SaleItem.where("sale_id='#{ sale_id }' and status is null")
|
||||
|
||||
|
||||
sale.sale_items.each do|item|
|
||||
# SaleItem.update_existing_item(item.qty, item, sale_id, remark, item.unit_price, item.price)
|
||||
item.status = remark
|
||||
@@ -53,7 +53,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
||||
table = nil
|
||||
end
|
||||
|
||||
# FOr Sale Audit
|
||||
# FOr Sale Audit
|
||||
action_by = current_user.name
|
||||
if access_code != "null" && current_user.role == "cashier"
|
||||
action_by = Employee.find_by_emp_id(access_code).name
|
||||
@@ -61,7 +61,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
||||
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
||||
sale_audit = SaleAudit.record_audit_for_edit(sale_id,current_user.name, action_by,remark,remark )
|
||||
|
||||
# For Print
|
||||
# For Print
|
||||
|
||||
member_info = nil
|
||||
rebate_amount = nil
|
||||
@@ -69,7 +69,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
||||
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
if bookings.count > 1
|
||||
if bookings.count > 1
|
||||
# for Multiple Booking
|
||||
if bookings[0].dining_facility_id.to_i>0
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
@@ -83,12 +83,12 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
|
||||
|
||||
|
||||
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
unique_code = "ReceiptBillPdf"
|
||||
# unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(sale.customer_id)
|
||||
|
||||
|
||||
#shop detail
|
||||
shop_details = current_shop
|
||||
# get member information
|
||||
@@ -100,34 +100,49 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
||||
current_balance = 0
|
||||
end
|
||||
|
||||
printer = PrintSetting.all
|
||||
|
||||
unique_code="ReceiptBillPdf"
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'ReceiptBillPdf'
|
||||
unique_code="ReceiptBillPdf"
|
||||
elsif printer_setting.unique_code == 'ReceiptBillA5Pdf'
|
||||
unique_code="ReceiptBillA5Pdf"
|
||||
elsif printer_setting.unique_code == 'ReceiptBillStarPdf'
|
||||
unique_code="ReceiptBillStarPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items)
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||
other_amount = SaleItem.calculate_other_charges(sale.sale_items)
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, remark,current_balance,nil,other_amount,nil,nil,nil)
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, remark,current_balance,nil,other_amount,nil,nil,nil)
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
}
|
||||
|
||||
# Mobile Print
|
||||
render :json => result.to_json
|
||||
# end
|
||||
|
||||
|
||||
#end print
|
||||
|
||||
# update complete order items in oqs
|
||||
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
|
||||
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
|
||||
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
|
||||
aoi.delivery_status = 1
|
||||
aoi.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -124,6 +124,11 @@ class Reports::SaleitemController < BaseReportController
|
||||
print_settings = PrintSetting.find_by_unique_code('SaleItemsPdf') # SaleItemsPdf
|
||||
print_settings_star = PrintSetting.find_by_unique_code('SaleItemsStarPdf')
|
||||
|
||||
# if print_settings.nil? && print_settings_star.nil?
|
||||
# @print_setting = PrintSetting.new(name: "SaleItemsPdf", unique_code: "SaleItemsPdf", template: "",font: "Zawgyi-One", header_font_size: "10", item_font_size: "8", printer_name: "", api_settings: "", brand_name: nil, printer_type: nil, page_width: "210", page_height: "1450", print_copies: "1", precision: "0", delimiter: "0", heading_space: "5" )
|
||||
# @print_setting.save
|
||||
# end
|
||||
|
||||
if print_settings.nil?
|
||||
if !print_settings_star.nil?
|
||||
printer = Printer::CashierStationPrinter.new(print_settings_star)
|
||||
|
||||
@@ -11,11 +11,11 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
options = order_item[0].options
|
||||
# filename = "tmp/order_item_#{order_id}_#{order_item_id}" + ".pdf"
|
||||
|
||||
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||
# pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||
print_setting = PrintSetting.all
|
||||
|
||||
# check for item not to show
|
||||
|
||||
pdf = ''
|
||||
# if order_item[0].price != 0
|
||||
if !print_setting.empty?
|
||||
print_setting.each do |print_settings|
|
||||
|
||||
@@ -9,7 +9,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'OrderItemPdf'
|
||||
if printer_setting.unique_code == 'OrderItemPdf'
|
||||
pdf = OrderItemPdf.new
|
||||
elsif printer_setting.unique_code == 'OrderItemSlimPdf'
|
||||
pdf = OrderItemSlimPdf.new
|
||||
@@ -18,12 +18,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
elsif printer_setting.unique_code == 'OrderItemCustomisePdf'
|
||||
pdf = OrderItemCustomisePdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSetItemCustomisePdf'
|
||||
pdf = OrderSetItemCustomisePdf.new
|
||||
pdf = OrderSetItemCustomisePdf.new
|
||||
elsif printer_setting.unique_code == 'OrderItemSlimCustomisePdf'
|
||||
pdf = OrderItemSlimCustomisePdf.new
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
pdf.render_file "tmp/order_item_queue_#{order_id}_#{order_item_id}" + ".pdf"
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
@@ -41,7 +41,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'OrderSummaryPdf'
|
||||
if printer_setting.unique_code == 'OrderSummaryPdf'
|
||||
pdf = OrderSummaryPdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySlimPdf'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
@@ -50,12 +50,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
elsif printer_setting.unique_code == 'OrderSummaryCustomisePdf'
|
||||
pdf = OrderSummaryCustomisePdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySetCustomisePdf'
|
||||
pdf = OrderSummarySetCustomisePdf.new
|
||||
pdf = OrderSummarySetCustomisePdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySlimCustomisePdf'
|
||||
pdf = OrderSummarySlimCustomisePdf.new
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
@@ -72,7 +72,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'OrderSummaryPdf'
|
||||
if printer_setting.unique_code == 'OrderSummaryPdf'
|
||||
pdf = OrderSummaryPdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySlimPdf'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
@@ -81,12 +81,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
elsif printer_setting.unique_code == 'OrderSummaryCustomisePdf'
|
||||
pdf = OrderSummaryCustomisePdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySetCustomisePdf'
|
||||
pdf = OrderSummarySetCustomisePdf.new
|
||||
pdf = OrderSummarySetCustomisePdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySlimCustomisePdf'
|
||||
pdf = OrderSummarySlimCustomisePdf.new
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
@@ -103,7 +103,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'OrderSummaryPdf'
|
||||
if printer_setting.unique_code == 'OrderSummaryPdf'
|
||||
pdf = OrderSummaryPdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySlimPdf'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
@@ -112,12 +112,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
elsif printer_setting.unique_code == 'OrderSummaryCustomisePdf'
|
||||
pdf = OrderSummaryCustomisePdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySetCustomisePdf'
|
||||
pdf = OrderSummarySetCustomisePdf.new
|
||||
pdf = OrderSummarySetCustomisePdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySlimCustomisePdf'
|
||||
pdf = OrderSummarySlimCustomisePdf.new
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
@@ -134,7 +134,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'OrderSummaryPdf'
|
||||
if printer_setting.unique_code == 'OrderSummaryPdf'
|
||||
pdf = OrderSummaryPdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySlimPdf'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
@@ -143,12 +143,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
elsif printer_setting.unique_code == 'OrderSummaryCustomisePdf'
|
||||
pdf = OrderSummaryCustomisePdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySetCustomisePdf'
|
||||
pdf = OrderSummarySetCustomisePdf.new
|
||||
pdf = OrderSummarySetCustomisePdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySlimCustomisePdf'
|
||||
pdf = OrderSummarySlimCustomisePdf.new
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
@@ -165,7 +165,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'OrderSummaryPdf'
|
||||
if printer_setting.unique_code == 'OrderSummaryPdf'
|
||||
pdf = OrderSummaryPdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySlimPdf'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
@@ -174,12 +174,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
elsif printer_setting.unique_code == 'OrderSummaryCustomisePdf'
|
||||
pdf = OrderSummaryCustomisePdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySetCustomisePdf'
|
||||
pdf = OrderSummarySetCustomisePdf.new
|
||||
pdf = OrderSummarySetCustomisePdf.new
|
||||
elsif printer_setting.unique_code == 'OrderSummarySlimCustomisePdf'
|
||||
pdf = OrderSummarySlimCustomisePdf.new
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
@@ -191,7 +191,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount,order_reservation)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
#Print
|
||||
if !printer_settings.nil?
|
||||
if !printer_settings.unique_code.strip.downcase.include? ("receiptbillorder")
|
||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount)
|
||||
@@ -205,11 +205,11 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
if !receipt_bill_a5_pdf.empty?
|
||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[1] == '1'
|
||||
pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount)
|
||||
# else
|
||||
@@ -222,7 +222,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#doemal online order pdf template
|
||||
pdf = ReceiptBillOrderPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount,order_reservation)
|
||||
end
|
||||
|
||||
|
||||
# print as print copies in printer setting
|
||||
count = printer_settings.print_copies
|
||||
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
class MoveTablePdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(printer_settings,to,from,shop_detail,date,type,moved_by,order_items)
|
||||
self.page_width = printer_settings.page_width
|
||||
self.page_height = printer_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.margin = 0
|
||||
self.margin_top = 7
|
||||
self.price_width = 40 # No Need for item
|
||||
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
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
super(:margin => [self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
# db font setup
|
||||
if printer_settings.font != ""
|
||||
@@ -85,7 +86,7 @@ class MoveTablePdf < Prawn::Document
|
||||
move_down 5
|
||||
|
||||
order_items.each do|odi|
|
||||
# check for item not to show
|
||||
# check for item not to show
|
||||
# if odi.price != 0
|
||||
y_position = cursor
|
||||
|
||||
@@ -103,15 +104,15 @@ class MoveTablePdf < Prawn::Document
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
|
||||
if !(odi.alt_name).empty?
|
||||
move_down 4
|
||||
# font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||
# end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
class OrderItemPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
|
||||
def initialize(print_settings,order_item, 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 = print_settings.header_font_size.to_i
|
||||
self.item_font_size = print_settings.item_font_size.to_i
|
||||
self.margin = 0
|
||||
self.margin_top = 7
|
||||
self.price_width = 40 # No Need for item
|
||||
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
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
super(:margin => self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||
|
||||
# db font setup
|
||||
@@ -29,17 +30,17 @@ class OrderItemPdf < Prawn::Document
|
||||
})
|
||||
|
||||
font "#{print_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
if !order_item.dining.nil?
|
||||
text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 3
|
||||
|
||||
@@ -51,31 +52,31 @@ 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
|
||||
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
|
||||
text "OrderNo: #{order_no}", :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 "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
text "OrderBy: #{order_by} ", :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 "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -87,7 +88,7 @@ class OrderItemPdf < Prawn::Document
|
||||
def order_items(order_item, options, alt_name, precision, before_updated_qty)
|
||||
y_position = cursor
|
||||
|
||||
#Add Order Item
|
||||
#Add Order Item
|
||||
add_order_items(order_item, options, alt_name, precision)
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
@@ -155,7 +156,7 @@ class OrderItemPdf < Prawn::Document
|
||||
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()
|
||||
.first()
|
||||
|
||||
return booking.booking_id
|
||||
end
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
class OrderItemStarPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
|
||||
def initialize(print_settings,order_item, 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 = print_settings.header_font_size.to_i
|
||||
self.item_font_size = print_settings.item_font_size.to_i
|
||||
self.margin = 0
|
||||
self.margin_top = 7
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 38
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
super(:margin => [self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||
|
||||
# db font setup
|
||||
@@ -29,17 +30,17 @@ class OrderItemStarPdf < Prawn::Document
|
||||
})
|
||||
|
||||
font "#{print_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
if !order_item.dining.nil?
|
||||
text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 3
|
||||
|
||||
@@ -51,31 +52,31 @@ class OrderItemStarPdf < 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
|
||||
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
|
||||
text "OrderNo: #{order_no}", :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 "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
text "OrderBy: #{order_by} ", :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 "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -87,7 +88,7 @@ class OrderItemStarPdf < Prawn::Document
|
||||
def order_items(order_item, options, alt_name, precision, before_updated_qty)
|
||||
y_position = cursor
|
||||
|
||||
#Add Order Item
|
||||
#Add Order Item
|
||||
add_order_items(order_item, options, alt_name, precision)
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
@@ -155,7 +156,7 @@ class OrderItemStarPdf < Prawn::Document
|
||||
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()
|
||||
.first()
|
||||
|
||||
return booking.booking_id
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class ReceiptBillStarPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
|
||||
|
||||
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount,latest_order_no,card_balance_amount)
|
||||
self.page_width = printer_settings.page_width
|
||||
@@ -9,6 +9,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
self.header_font_size = printer_settings.header_font_size.to_i
|
||||
self.item_font_size = printer_settings.item_font_size.to_i
|
||||
self.margin = 0
|
||||
self.margin_top = 10
|
||||
self.price_width = 60
|
||||
self.qty_width = 20
|
||||
self.total_width = 40
|
||||
@@ -25,7 +26,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
# @double = @qty_width * 1.3
|
||||
# @half_qty = @qty_width / 2
|
||||
#setting page margin and width
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
super(:margin => [self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
#precision checked
|
||||
if printer_settings.precision.to_i > 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<%= stylesheet_link_tag 'addorder', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %>
|
||||
|
||||
|
||||
<% type = request.path_info.include?('quick_service') || request.path_info.include?('food_court')%>
|
||||
@@ -13,7 +13,7 @@
|
||||
<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">
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_data">
|
||||
<li class="list-menu">
|
||||
<a href="javascript:void(0);" class="menu-toggle dropdown-toggle toggled my-toggle " style="">
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
</li>
|
||||
<%end%>
|
||||
</ul>
|
||||
</li>
|
||||
</li>
|
||||
<div id="menu1-slimscroll" data-height="0">
|
||||
<ul class="nav nav-tabs flex-column category_list" role="tablist" id="ul-navbar">
|
||||
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
|
||||
@@ -43,7 +43,7 @@
|
||||
<% if type %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<li class="nav-item">
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
|
||||
</a>
|
||||
<ul class="sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||
@@ -55,7 +55,7 @@
|
||||
<% if @table.get_current_checkout_booking.nil? %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<li class="nav-item ">
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
|
||||
</a>
|
||||
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||
@@ -64,7 +64,7 @@
|
||||
<% end%>
|
||||
<% else %>
|
||||
<li class="nav-item ">
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
|
||||
</a>
|
||||
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||
@@ -88,7 +88,7 @@
|
||||
</a>
|
||||
<ul class="ml-menu menu_list aria-hidden menu_cache_list" style="border-top: 1px solid #fff">
|
||||
</ul>
|
||||
</li>
|
||||
</li>
|
||||
<div id="menu-slimscroll" data-height="0">
|
||||
<ul class="nav nav-tabs flex-column category_list category_cache_list" role="tablist" id="ul-navbar">
|
||||
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
|
||||
@@ -165,15 +165,15 @@
|
||||
Back
|
||||
</button>
|
||||
|
||||
<% if @quick_service_only %>
|
||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-9" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
|
||||
</button>
|
||||
<% else %>
|
||||
<%# <% if @quick_service_only %>
|
||||
<!-- <button type="button" class="btn btn-lg btn-primary waves-effect col-md-9" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
|
||||
</button> -->
|
||||
<%# <% else %>
|
||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
|
||||
</button>
|
||||
<a class="btn btn-lg bg-blue waves-effect select_table col-md-3" data-toggle="modal" data-target="#TableModal" style=" padding: .5rem 0.15rem !important;">Select</a>
|
||||
<input type="hidden" name="table_id" value="" id="table_id">
|
||||
<% end %>
|
||||
<%# <% end %>
|
||||
<%else%>
|
||||
<button type="button" class="btn btn-lg btn-block btn-default waves-effect" id='back'>
|
||||
<i class="material-icons">reply</i>Back
|
||||
@@ -209,7 +209,7 @@
|
||||
<div class="col-md-1 col-lg-1 col-sm-1">
|
||||
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<% else%>
|
||||
<p class="hidden" id="table_type"></p>
|
||||
<div class="col-md-2 col-lg-2 col-sm-2">
|
||||
@@ -218,7 +218,7 @@
|
||||
<div class="col-md-3 col-lg-3 col-sm-3">
|
||||
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
@@ -262,7 +262,7 @@
|
||||
<tr>
|
||||
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
|
||||
<td style="padding:2px;" width="15%"><strong id="total_qty">0</strong></td>
|
||||
|
||||
|
||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">0.00</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -273,7 +273,7 @@
|
||||
<%elsif !modify_order && type%>
|
||||
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
|
||||
<% if current_user.role != "waiter"%>
|
||||
|
||||
|
||||
<% if @quick_service_only %>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-12" id="create_pay_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
|
||||
<% else %>
|
||||
@@ -281,7 +281,7 @@
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
|
||||
<% end %>
|
||||
<%end%>
|
||||
<% if !@quick_service_only && current_user.role == "waiter"%>
|
||||
<% if @quick_service_only && current_user.role == "waiter"%>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
|
||||
<%end%>
|
||||
<%else%>
|
||||
@@ -392,8 +392,8 @@
|
||||
<p class="hidden" id="item_instances"></p>
|
||||
<p class="hidden" id="item_code"></p>
|
||||
</div>
|
||||
<div class="col-md-7 item-detail">
|
||||
<h5>Attributes</h5>
|
||||
<div class="col-md-7 item-detail">
|
||||
<h5>Attributes</h5>
|
||||
<div class="attributes-list">
|
||||
</div>
|
||||
<hr>
|
||||
@@ -471,8 +471,8 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-8">
|
||||
|
||||
<div class="col-md-8">
|
||||
<div class="instance-list row"></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -510,14 +510,14 @@
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="blue"%>
|
||||
<% else %>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -536,13 +536,13 @@
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="blue"%>
|
||||
<% else %>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -594,11 +594,11 @@
|
||||
menu_cache_append(menus);
|
||||
}else{
|
||||
$("#menu_data").removeClass("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
function menu_cache_append(menus){
|
||||
$("#menu_cache").removeClass("hidden");
|
||||
$(".menu_cache_name").text(menus[0]["name"])
|
||||
$(".menu_cache_name").text(menus[0]["name"])
|
||||
for(var i in menus) {
|
||||
menu_list_template(menus[i]);
|
||||
}
|
||||
@@ -607,11 +607,11 @@
|
||||
for(var ii in category) {
|
||||
if (category[ii]["is_available"]== true){
|
||||
if (category[ii]["valid_time"]== true){
|
||||
if (category[ii]["parent_id"] == null ){
|
||||
if (category[ii]["parent_id"] == null ){
|
||||
if(cashier_type){
|
||||
if (category[ii]["code"].includes("SPL") != true) {
|
||||
category_list_template(category[ii]);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if ($("#table_get_current").text()) {
|
||||
if (category[ii]["code"].includes("SPL") != true) {
|
||||
@@ -624,7 +624,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(".tables").on('click', function () {
|
||||
@@ -658,13 +658,13 @@
|
||||
var name = $(this).attr("data-name");
|
||||
var menus = JSON.parse(localStorage.getItem("menus"));
|
||||
|
||||
if (menus != null) {
|
||||
if (menus != null) {
|
||||
menu_click_cache_append(name,menus,menu_id);
|
||||
}else{
|
||||
var url = "get_menu/"+menu_id;
|
||||
show_menu_cat_list(name, url);
|
||||
show_menu_cat_list(name, url);
|
||||
}
|
||||
});
|
||||
});
|
||||
//End menu category Click
|
||||
|
||||
function menu_click_cache_append(name,menus,menu_id) {
|
||||
@@ -681,22 +681,22 @@
|
||||
// +'</li>';
|
||||
// $(".category_cache_list").append(row);
|
||||
|
||||
for(var i in menus) {
|
||||
for(var i in menus) {
|
||||
|
||||
if (menu_id == menus[i]["id"] && menus[i]["is_active"] == true) {
|
||||
|
||||
// menu_list_template(menus[i]);
|
||||
var category = menus[i]["categories"];
|
||||
|
||||
for(var ii in category) {
|
||||
if (category[ii]["is_available"]== true){
|
||||
|
||||
for(var ii in category) {
|
||||
if (category[ii]["is_available"]== true){
|
||||
if (category[ii]["valid_time"]== true){
|
||||
if (category[ii]["parent_id"] == null ){
|
||||
if(cashier_type){
|
||||
if (category[ii]["parent_id"] == null ){
|
||||
if(cashier_type){
|
||||
if (category[ii]["code"].includes("SPL") != true) {
|
||||
category_list_template(category[ii]);
|
||||
}
|
||||
}else{
|
||||
}
|
||||
}else{
|
||||
if ($("#table_get_current").text()) {
|
||||
if (category[ii]["code"].includes("SPL") != true) {
|
||||
category_list_template(category[ii]);
|
||||
@@ -708,7 +708,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -725,7 +725,7 @@
|
||||
+'</ul>'
|
||||
|
||||
+' </li>';
|
||||
$(".category_cache_list").append(row);
|
||||
$(".category_cache_list").append(row);
|
||||
}
|
||||
|
||||
function menu_list_template(menu) {
|
||||
@@ -734,11 +734,11 @@
|
||||
+' <a class="nav-link" data-toggle="tab" href="" role="tab"'
|
||||
+' style="text-transform: lowercase;">'+menu.name+'</a>'
|
||||
+'</li>';
|
||||
$(".menu_cache_list").append(row);
|
||||
}
|
||||
$(".menu_cache_list").append(row);
|
||||
}
|
||||
|
||||
//show menu item list when click menu category
|
||||
function show_menu_cat_list(name, url_item){
|
||||
function show_menu_cat_list(name, url_item){
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
|
||||
@@ -758,13 +758,13 @@
|
||||
url_item = url_item;
|
||||
}
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url_item,
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url_item,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
for(var i in data) {
|
||||
for(var i in data) {
|
||||
if (data[i].is_available == true) {
|
||||
row = '<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="'+ data[i].id +'">'
|
||||
+' <div class="card-block custom-card-block">'
|
||||
@@ -777,7 +777,7 @@
|
||||
list = '<li class="nav-item menu_category sub_click" data-id="'+ data[i].id +'">'
|
||||
+'<p class="hidden menu-id">'+ data[i].id +'</p> '
|
||||
+'<a class="nav-link" data-toggle="tab" href="" role="tab"> '+ data[i].name +''
|
||||
+'<ul class=" sub_category_list hidden fadeInTop animated"'
|
||||
+'<ul class=" sub_category_list hidden fadeInTop animated"'
|
||||
+'id="sub_category_list">'
|
||||
+'</ul>'
|
||||
+'</a>'
|
||||
@@ -787,15 +787,15 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
//end Ajax
|
||||
}
|
||||
//end show list function
|
||||
|
||||
$(document).on('click', '#clear_all', function(event){
|
||||
$(".summary-items tbody").empty();
|
||||
$(".summary-items tbody").empty();
|
||||
$('#sub_total').text("0.00");
|
||||
$(".create").attr("disabled","disabled");
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
if(event.handled !== true) {
|
||||
@@ -818,9 +818,9 @@
|
||||
}
|
||||
break;
|
||||
case 'add':
|
||||
|
||||
|
||||
case 'del' :
|
||||
|
||||
|
||||
case 'clr':
|
||||
$('#modal-qty').val(1);
|
||||
$('#modal-qty').attr('data-value',0);
|
||||
@@ -841,4 +841,4 @@
|
||||
showHideNavbar(webview);
|
||||
<% end %>
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -46,8 +46,6 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% puts 'testing!!!!!!' %>
|
||||
<% puts @print_settings.precision.to_i %>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
|
||||
@@ -21,11 +21,11 @@ class ActionController::Base
|
||||
end
|
||||
else
|
||||
# check for license file
|
||||
#if check_license
|
||||
#current_license(ENV["SX_PROVISION_URL"])
|
||||
#else
|
||||
#redirect_to activate_path
|
||||
#end
|
||||
if check_license
|
||||
current_license(ENV["SX_PROVISION_URL"])
|
||||
else
|
||||
redirect_to activate_path
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#application_path="#{File.expand_path("../..", __FILE__)}"
|
||||
#directory application_path
|
||||
application_path="#{File.expand_path("../..", __FILE__)}"
|
||||
directory application_path
|
||||
#environment ENV.fetch("RAILS_ENV") { "production" }
|
||||
#environment "production"
|
||||
#pidfile "#{application_path}/tmp/puma/pid"
|
||||
#state_path "#{application_path}/tmp/puma/state"
|
||||
#stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||
#port ENV.fetch("PORT") { 62158 }
|
||||
#workers 2
|
||||
#preload_app!
|
||||
environment "production"
|
||||
pidfile "#{application_path}/tmp/puma/pid"
|
||||
state_path "#{application_path}/tmp/puma/state"
|
||||
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||
port ENV.fetch("PORT") { 62158 }
|
||||
workers 2
|
||||
preload_app!
|
||||
|
||||
Reference in New Issue
Block a user