Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_material_ui
This commit is contained in:
49
README.md
49
README.md
@@ -36,23 +36,54 @@ java -jar ~/Documents/Jade.jar http://192.168.1.88:3002
|
||||
Person and Extra Time
|
||||
category_code = SPL... //for menu categories
|
||||
|
||||
Extra Time
|
||||
instance_code = Extim30, Extim60 //for morning menu
|
||||
instance_code = Extie30, Extie60 //for evening menu
|
||||
For Extra Time
|
||||
item_instance_code
|
||||
* must start with 'Ext'[a..z]'_'[1..100]
|
||||
* note : don't add character after '_'
|
||||
|
||||
Order Item & Order Summary Slim
|
||||
For Order Item & Order Summary Slim
|
||||
*** change OrderItemPdf to OrderItemSlimPdf and OrderSummaryPdf to OrderSummarySlimPdf
|
||||
1) settings/print_settings
|
||||
2) app/controllers/oqs/edit_controller.rb
|
||||
3) app/controllers/oqs/print_controller.rb
|
||||
4) app/models/order_queue_station.rb
|
||||
5) app/models/printer/order_queue_printer.rb
|
||||
6) app/models/printer/receipt_printer.rb
|
||||
2) settings/lookups => { type:order_slim_pdf, name:OrderSlimPdf, value:1 }
|
||||
* no need to change these page
|
||||
{ app/controllers/oqs/edit_controller.rb
|
||||
app/controllers/oqs/print_controller.rb
|
||||
app/models/order_queue_station.rb
|
||||
app/models/printer/order_queue_printer.rb
|
||||
app/models/printer/receipt_printer.rb
|
||||
}
|
||||
|
||||
For Bank Integration setting
|
||||
1) rake db:migrate for card_sale_trans, card_settle_trans
|
||||
2) settings/lookups => { type:bank_integration, name: Bank Integration, value:1 }
|
||||
|
||||
For checkout time and checkout alert time
|
||||
1) checkout time => { type: checkout_time, name: 9:00AM - 12:00 PM, value: 120 }
|
||||
2) checkout alert time => { type: checkout_alert_time, name: 8:00AM - 12:00 PM, value: 60 }
|
||||
* you can add multiple record for checkout time and checkout alert time
|
||||
* type must be 'checkout_time' and 'checkout_alert_time'
|
||||
* you can change name and value
|
||||
* name must be time range [8:30 AM - 1:45 PM]
|
||||
* value must be minutes[60]
|
||||
|
||||
For call waiter pdf
|
||||
* Backend > Printer > Print Settings > New
|
||||
i) Name : Calling Waiter
|
||||
ii) Unique Code: CallWaiterPdf
|
||||
iii)Template: ...
|
||||
iv) Font: Zawgyi-One
|
||||
v) Printer: #printer name
|
||||
|
||||
Membership Actions SQL
|
||||
* update membership_actions set additional_parameter='{\"campaign_type_id\":5}' where id=10;
|
||||
|
||||
SQL Update after rake clear:data runned
|
||||
* update seed_generators
|
||||
i) TableBooking, Order, OrderItem, sale, SaleOrder, SaleItem, SaleTax, SalePayment, SaleAudit, AssignedOrderItem => { current:0, next:0 }
|
||||
** Note :: do not update Customer
|
||||
|
||||
|
||||
|
||||
* ToDo list
|
||||
|
||||
1. Cloud Sync
|
||||
|
||||
@@ -15,12 +15,16 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||
alert_time_min = 0
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'min'
|
||||
alert_time_min = (lookup_checkout_time[0][1]).to_i
|
||||
else
|
||||
alert_time_min = 15
|
||||
end
|
||||
if !lookup_checkout_time.empty?
|
||||
now = Time.now.utc
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
arr_time = checkout_time[0].split("-")
|
||||
start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p")
|
||||
end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p")
|
||||
if start_time <= now && now <= end_time
|
||||
alert_time_min = checkout_time[1].to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time, :alert_time_min => alert_time_min, :extra_minutes => extra_minutes }
|
||||
@@ -39,11 +43,12 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
if !lookup_checkout_time.empty?
|
||||
checkout_at = Time.now.utc
|
||||
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'hr'
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
|
||||
else
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
arr_time = checkout_time[0].split("-")
|
||||
start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p")
|
||||
end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p")
|
||||
if start_time <= checkout_at && checkout_at <= end_time
|
||||
checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -16,15 +16,24 @@ class Oqs::EditController < BaseOqsController
|
||||
order_item.remark = remarks
|
||||
order_item.save
|
||||
|
||||
# print
|
||||
# assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
# # order queue stations
|
||||
# oqs = assigned_item.order_queue_station
|
||||
|
||||
# unique_code="OrderItemPdf"
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
# order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Updated)" )
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
|
||||
unique_code="OrderItemPdf"
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
end
|
||||
end
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Updated)" )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,61 +1,80 @@
|
||||
class Oqs::PrintController < ApplicationController
|
||||
# Print Order Item
|
||||
def print
|
||||
# unique_code="OrderItemPdf"
|
||||
# assigned_item_id = params[:id]
|
||||
# options = params[:options]
|
||||
# assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
# assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
unique_code="OrderItemPdf"
|
||||
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
end
|
||||
end
|
||||
|
||||
assigned_item_id = params[:id]
|
||||
options = params[:options]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
|
||||
# # order queue stations
|
||||
# oqs = assigned_item.order_queue_station
|
||||
# order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
||||
|
||||
# # Check Printed
|
||||
# print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
# Check Printed
|
||||
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
|
||||
# # print when complete click
|
||||
# print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
# order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
# order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, options )
|
||||
|
||||
# # update print status for completed same order items
|
||||
# assigned_items.each do |ai|
|
||||
# ai.print_status=true
|
||||
# ai.save
|
||||
# end
|
||||
# print when complete click
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, options )
|
||||
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
ai.print_status=true
|
||||
ai.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Print Order Details with booking id
|
||||
def print_order_summary
|
||||
# unique_code="OrderSummaryPdf"
|
||||
# assigned_item_id = params[:id]
|
||||
# table_name = params[:table_name]
|
||||
# assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
# assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
unique_code="OrderSummaryPdf"
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
unique_code="OrderSummarySlimPdf"
|
||||
end
|
||||
end
|
||||
|
||||
# # order queue stations
|
||||
# oqs = assigned_item.order_queue_station
|
||||
assigned_item_id = params[:id]
|
||||
table_name = params[:table_name]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
|
||||
# # Check Printed
|
||||
# print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
# # get dining
|
||||
# # dining = DiningFacility.find_by_name(table_name);
|
||||
# # booking = Booking.find_by_dining_facility_id(dining.id)
|
||||
# Check Printed
|
||||
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
|
||||
# # Get Booking ID
|
||||
# booking_id = BookingOrder.where("order_id='#{assigned_item.order_id}'").pluck(:booking_id)[0]
|
||||
|
||||
# # print when complete click
|
||||
# print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
# order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
# order_queue_printer.print_booking_summary(print_settings,oqs, booking_id, print_status)
|
||||
# get dining
|
||||
# dining = DiningFacility.find_by_name(table_name);
|
||||
# booking = Booking.find_by_dining_facility_id(dining.id)
|
||||
|
||||
# # update print status for completed same order items
|
||||
# assigned_items.each do |ai|
|
||||
# ai.print_status = true
|
||||
# ai.save
|
||||
# end
|
||||
# Get Booking ID
|
||||
booking_id = BookingOrder.where("order_id='#{assigned_item.order_id}'").pluck(:booking_id)[0]
|
||||
|
||||
# print when complete click
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_booking_summary(print_settings,oqs, booking_id, print_status)
|
||||
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
ai.print_status = true
|
||||
ai.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -3,12 +3,14 @@ class Origami::CheckInProcessController < BaseOrigamiController
|
||||
def check_in_process
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||
checkout_at = Time.now.utc
|
||||
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'hr'
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
|
||||
else
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
|
||||
if !lookup_checkout_time.empty?
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
arr_time = checkout_time[0].split("-")
|
||||
start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p")
|
||||
end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p")
|
||||
if start_time <= checkout_at && checkout_at <= end_time
|
||||
checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
|
||||
end
|
||||
end
|
||||
end
|
||||
@dining_facility = DiningFacility.find(params[:dining_id])
|
||||
|
||||
@@ -165,6 +165,7 @@ class Ability
|
||||
can :create, :discount
|
||||
can :remove_discount_items, :discount
|
||||
can :remove_all_discount, :discount
|
||||
can :member_discount, :discount
|
||||
|
||||
can :manage, Customer
|
||||
can :manage, DiningQueue
|
||||
|
||||
@@ -80,11 +80,15 @@ class DiningFacility < ApplicationRecord
|
||||
if booking
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||
free_time_min = 0
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'min'
|
||||
free_time_min = (lookup_checkout_time[0][1]).to_i
|
||||
else
|
||||
free_time_min = 15
|
||||
if !lookup_checkout_time.empty?
|
||||
now = Time.now.utc
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
arr_time = checkout_time[0].split("-")
|
||||
start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p")
|
||||
end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p")
|
||||
if start_time <= now && now <= end_time
|
||||
free_time_min = checkout_time[1].to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -115,11 +119,15 @@ class DiningFacility < ApplicationRecord
|
||||
if bookings
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||
free_time_min = 0
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'min'
|
||||
free_time_min = (lookup_checkout_time[0][1]).to_i
|
||||
else
|
||||
free_time_min = 15
|
||||
if !lookup_checkout_time.empty?
|
||||
now = Time.now.utc
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
arr_time = checkout_time[0].split("-")
|
||||
start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p")
|
||||
end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p")
|
||||
if start_time <= now && now <= end_time
|
||||
free_time_min = checkout_time[1].to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ class OrderQueueStation < ApplicationRecord
|
||||
validates_presence_of :station_name, :printer_name
|
||||
|
||||
def process_order (order, table_id)
|
||||
|
||||
oqs_stations = OrderQueueStation.active
|
||||
dining=DiningFacility.find(table_id)
|
||||
# oqpbz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
|
||||
@@ -77,47 +78,70 @@ class OrderQueueStation < ApplicationRecord
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# if oqs.auto_print
|
||||
# if oqs_order_items.length > 0
|
||||
# print_slip(oqs, order, oqs_order_items)
|
||||
# is_auto_printed = true
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
if oqs.auto_print
|
||||
if oqs_order_items.length > 0
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
is_auto_printed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
# if oqs.id == oqpbz.order_queue_station_id
|
||||
# # Auto Printing
|
||||
# if oqs.auto_print
|
||||
# if oqs_order_items.length > 0
|
||||
# print_slip(oqs, order, oqs_order_items)
|
||||
# is_auto_printed = true
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
||||
private
|
||||
#Print order_items in 1 slip
|
||||
def print_slip(oqs, order, order_items)
|
||||
# unique_code="OrderSummaryPdf"
|
||||
|
||||
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
# order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="")
|
||||
def print_slip(oqs, order, order_items)
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
unique_code="OrderSummaryPdf"
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
unique_code="OrderSummarySlimPdf"
|
||||
end
|
||||
end
|
||||
|
||||
# AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
|
||||
# # update print status for order items
|
||||
# ai.print_status=true
|
||||
# ai.save
|
||||
# end
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="")
|
||||
|
||||
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
|
||||
# update print status for order items
|
||||
ai.print_status=true
|
||||
ai.save
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#Print order_item in 1 slip per item
|
||||
def print_slip_item(oqs, assigned_item)
|
||||
# unique_code="OrderItemPdf"
|
||||
# order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
||||
# # print when complete click
|
||||
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
# order_queue_printer.print_order_item(print_settings, oqs,item.order_id, order_item.order_items_id, print_status="" )
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
unique_code="OrderItemPdf"
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
end
|
||||
end
|
||||
|
||||
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
||||
# print when complete click
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings, oqs,item.order_id, order_item.order_items_id, print_status="" )
|
||||
|
||||
# # update print status for completed same order items
|
||||
# assigned_order_item.each do |ai|
|
||||
# ai.print_status=true
|
||||
# ai.save
|
||||
# end
|
||||
# update print status for completed same order items
|
||||
assigned_order_item.each do |ai|
|
||||
ai.print_status=true
|
||||
ai.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,9 +14,19 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
filename = "tmp/order_item_#{order_id}_#{order_item_id}" + ".pdf"
|
||||
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
|
||||
# check for item not to show
|
||||
# if order_item[0].price != 0
|
||||
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderItemSlimPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
||||
else
|
||||
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
||||
end
|
||||
else
|
||||
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
if oqs.print_copy
|
||||
@@ -43,6 +53,8 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
print_settings.save!
|
||||
end
|
||||
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
|
||||
order=print_query('order_summary', order_id)
|
||||
# For Print Per Item
|
||||
if oqs.cut_per_item
|
||||
@@ -55,7 +67,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
# check for item not to show
|
||||
#if odi.price != 0
|
||||
pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name)
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderItemSlimPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name)
|
||||
else
|
||||
pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name)
|
||||
end
|
||||
else
|
||||
pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name)
|
||||
end
|
||||
# pdf.render_file "tmp/order_item.pdf"
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
@@ -71,7 +91,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
# For Print Order Summary
|
||||
else
|
||||
filename = "tmp/order_summary_#{order_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
||||
else
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
||||
end
|
||||
else
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
||||
end
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
@@ -94,6 +122,8 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
print_settings.save!
|
||||
end
|
||||
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
|
||||
order=print_query('booking_summary', booking_id)
|
||||
# For Print Per Item
|
||||
if oqs.cut_per_item
|
||||
@@ -104,7 +134,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
# check for item not to show
|
||||
#if odi.price != 0
|
||||
pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name)
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderItemSlimPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name)
|
||||
else
|
||||
pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name)
|
||||
end
|
||||
else
|
||||
pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name)
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
if oqs.print_copy
|
||||
@@ -122,8 +160,16 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
end
|
||||
# For Print Order Summary
|
||||
else
|
||||
filename = "tmp/booking_summary_#{booking_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name)
|
||||
filename = "tmp/booking_summary_#{booking_id}" + ".pdf"
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new(print_settings,order, print_status,oqs.use_alternate_name)
|
||||
else
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name)
|
||||
end
|
||||
else
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name)
|
||||
end
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
|
||||
@@ -24,11 +24,11 @@ class Printer::PrinterWorker
|
||||
end
|
||||
end
|
||||
|
||||
def printers()
|
||||
def self.printers()
|
||||
Cups.show_destinations
|
||||
end
|
||||
|
||||
def default_printer()
|
||||
def self.default_printer()
|
||||
Cups.default_printer
|
||||
end
|
||||
|
||||
|
||||
@@ -4,7 +4,13 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
pdf = OrderItemPdf.new
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderItemSlimPdf.new
|
||||
end
|
||||
end
|
||||
pdf.render_file "tmp/order_item_queue_#{order_id}_#{order_item_id}" + ".pdf"
|
||||
self.print("tmp/receipt.pdf")
|
||||
end
|
||||
@@ -14,7 +20,13 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Generate PDF
|
||||
#Print
|
||||
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
self.print(filename)
|
||||
@@ -24,8 +36,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
self.print(filename)
|
||||
@@ -35,8 +53,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
self.print(filename)
|
||||
@@ -46,8 +70,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
self.print(filename)
|
||||
@@ -57,8 +87,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !order_slim_pdf.empty?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
self.print(filename)
|
||||
|
||||
@@ -605,7 +605,7 @@
|
||||
var sale_id = $('#sale_id').val();
|
||||
type = $('.payment_method').val();
|
||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||
if (parseInt(jQuery.inArray("MPU", type)) > 0 || parseInt(jQuery.inArray("VISA", type)) > 0 || parseInt(jQuery.inArray("JCB", type)) > 0 || parseInt(jQuery.inArray("Master", type)) > 0 || parseInt(jQuery.inArray("UNIONPAY", type)) > 0 || parseInt(jQuery.inArray("Redeem", type)) > 0) {
|
||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) {
|
||||
calculate_member_discount(sale_id,"Card");
|
||||
|
||||
}else{
|
||||
|
||||
@@ -94,11 +94,13 @@
|
||||
<% else %>
|
||||
<div id="save_order_id" data-order="">
|
||||
<% end %>
|
||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
|
||||
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% else %>
|
||||
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% if !@booking.nil? %>
|
||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
|
||||
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% else %>
|
||||
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% elsif @status_sale == 'sale' %>
|
||||
@@ -149,10 +151,10 @@
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<% if @status_sale == 'sale' %>
|
||||
<% if @status_sale == 'sale' && !@sale_array.empty? %>
|
||||
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
|
||||
Customer : <%= @sale_array[0].customer.name rescue '' %>
|
||||
<% elsif @status_order == 'order'
|
||||
<% elsif @status_order == 'order' && !@customer.nil?
|
||||
%>
|
||||
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
|
||||
Customer : <%= @customer.name rescue "" %>
|
||||
|
||||
@@ -312,18 +312,20 @@
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
|
||||
payment_type = '';
|
||||
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
|
||||
if (member_id && member_discount) {
|
||||
|
||||
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
||||
$("#credit_payment").hide();
|
||||
} else{
|
||||
$("#credit_payment").show();
|
||||
}
|
||||
|
||||
if(parseInt(jQuery.inArray("MPU", payment_type)) > 0 || parseInt(jQuery.inArray("VISA", payment_type)) > 0 || parseInt(jQuery.inArray("JCB", payment_type)) > 0 || parseInt(jQuery.inArray("Master", payment_type)) > 0 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) > 0 || parseInt(jQuery.inArray("Redeem", payment_type)) > 0){
|
||||
$("#card_payment").show();
|
||||
if(parseInt(jQuery.inArray("MPU", payment_type)) !=-1 || parseInt(jQuery.inArray("VISA", payment_type)) !=-1 || parseInt(jQuery.inArray("JCB", payment_type)) !=-1 || parseInt(jQuery.inArray("Master", payment_type)) !=-1 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) !=-1 || parseInt(jQuery.inArray("Redeem", payment_type)) !=-1){
|
||||
$("#card_payment").show();
|
||||
} else{
|
||||
$("#card_payment").hide();
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ $(".choose_payment").on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
type = $('.payment_method').val();
|
||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||
if (parseInt(jQuery.inArray("MPU", type)) > 0 || parseInt(jQuery.inArray("VISA", type)) > 0 || parseInt(jQuery.inArray("JCB", type)) > 0 || parseInt(jQuery.inArray("Master", type)) > 0 || parseInt(jQuery.inArray("UNIONPAY", type)) > 0 || parseInt(jQuery.inArray("Redeem", type)) > 0) {
|
||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) {
|
||||
calculate_member_discount(sale_id,"Card");
|
||||
|
||||
}else{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<%= f.input :unique_code %>
|
||||
<%= f.input :template %>
|
||||
<%= f.input :font %>
|
||||
<%= f.input :printer_name %>
|
||||
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
|
||||
<%= f.input :api_settings %>
|
||||
<%= f.input :page_width %>
|
||||
<%= f.input :page_height %>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<%= f.input :auto_print_receipt %>
|
||||
<%= f.label "Select Zones", :class => 'control-label' %>
|
||||
<%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'checkbox form-group'%>
|
||||
<%= f.input :printer_name %>
|
||||
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
|
||||
<%= f.input :font %>
|
||||
<%= f.input :font_size %>
|
||||
<%= f.input :show_tax %>
|
||||
|
||||
@@ -16,7 +16,7 @@ div.form-inputs span{
|
||||
<%= f.input :station_name %>
|
||||
<%= f.input :is_active %>
|
||||
|
||||
<%= f.input :printer_name %>
|
||||
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
|
||||
<!-- <%= f.input :font_size %> -->
|
||||
<%= f.input :print_copy %>
|
||||
<%= f.hidden_field :processing_items %>
|
||||
|
||||
@@ -7,7 +7,10 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
mount Sidekiq::Web => '/kiq'
|
||||
|
||||
# Action Cable Creation
|
||||
mount ActionCable.server => "/cable"
|
||||
# if ENV["SERVER_MODE"] != "cloud"
|
||||
mount ActionCable.server => "/cable"
|
||||
# end
|
||||
|
||||
|
||||
#--------- SmartSales Activation ------------#
|
||||
get 'activate' => 'install#index'
|
||||
|
||||
Reference in New Issue
Block a user