route changes
This commit is contained in:
@@ -103,10 +103,15 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
}
|
||||
|
||||
# begin
|
||||
if params[:order_source] == "quick_service"
|
||||
customer_id = "CUS-000000000002" # for no customer id from mobile
|
||||
else
|
||||
customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
end
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
@order.order_type = params[:order_type]
|
||||
@order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
@order.customer_id = customer_id
|
||||
@order.items = items_arr
|
||||
@order.guest = params[:guest_info]
|
||||
@order.table_id = params[:table_id] # this is dining facilities's id
|
||||
|
||||
@@ -50,6 +50,7 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
|
||||
@sale_id = params[:sale_id]
|
||||
@cashier_type = params[:type]
|
||||
@page = params[:page]
|
||||
|
||||
if(@sale_id[0,3] == "SAL")
|
||||
@booking = Booking.find_by_sale_id(@sale_id)
|
||||
@@ -62,7 +63,11 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
else
|
||||
@booking_order = BookingOrder.find_by_order_id(@sale_id)
|
||||
@booking = Booking.find(@booking_order.booking_id)
|
||||
@dining_facility = DiningFacility.find(@booking.dining_facility_id)
|
||||
if @booking.dining_facility_id.to_i > 0
|
||||
@dining_facility = DiningFacility.find(@booking.dining_facility_id)
|
||||
else
|
||||
@dining_facility = nil
|
||||
end
|
||||
end
|
||||
|
||||
filter = params[:filter]
|
||||
|
||||
@@ -30,33 +30,33 @@ class Origami::HomeController < BaseOrigamiController
|
||||
bookings = Booking.all
|
||||
if !bookings.today.nil?
|
||||
@order_items_count = Hash.new
|
||||
bookings.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
if !booking.booking_orders.empty?
|
||||
booking.booking_orders.each do |booking_order|
|
||||
order = Order.find(booking_order.order_id)
|
||||
if !order.order_items.empty?
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||
else
|
||||
@order_items_count[booking.dining_facility_id] += order.order_items.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if !booking.sale_id.nil?
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status !='completed'
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||
else
|
||||
@order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# bookings.each do |booking|
|
||||
# if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
# if !booking.booking_orders.empty?
|
||||
# booking.booking_orders.each do |booking_order|
|
||||
# order = Order.find(booking_order.order_id)
|
||||
# if !order.order_items.empty?
|
||||
# if !@order_items_count.key?(booking.dining_facility_id)
|
||||
# @order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||
# else
|
||||
# @order_items_count[booking.dining_facility_id] += order.order_items.count
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# else
|
||||
# if !booking.sale_id.nil?
|
||||
# sale = Sale.find(booking.sale_id)
|
||||
# if sale.sale_status !='completed'
|
||||
# if !@order_items_count.key?(booking.dining_facility_id)
|
||||
# @order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||
# else
|
||||
# @order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
@dining.bookings.active.each do |booking|
|
||||
|
||||
@@ -28,8 +28,21 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
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
|
||||
# Print for First Bill to Customer
|
||||
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[1] == '1'
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
else
|
||||
unique_code = "ReceiptBillPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#shop detail
|
||||
shop_details = Shop::ShopDetail
|
||||
# customer= Customer.where('customer_id=' +.customer_id)
|
||||
@@ -95,7 +108,6 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, current_user.name, cash, "cash")
|
||||
|
||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error "})
|
||||
rebate_amount = nil
|
||||
|
||||
# For Cashier by Zone
|
||||
@@ -118,7 +130,20 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
# For Print
|
||||
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[1] == '1'
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
else
|
||||
unique_code = "ReceiptBillPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
# get member information
|
||||
@@ -151,7 +176,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
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_details, "Paid",current_balance,card_data)
|
||||
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_details, "Paid",current_balance,card_data)
|
||||
|
||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
||||
|
||||
if params[:type] == "quick_service"
|
||||
booking = Booking.find_by_sale_id(sale_id)
|
||||
@@ -437,5 +464,31 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#print function for receipt
|
||||
def print
|
||||
filename = params[:filename]
|
||||
receipt_no = params[:receipt_no]
|
||||
printer_name = params[:printer_name]
|
||||
|
||||
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[1] == '1'
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
else
|
||||
unique_code = "ReceiptBillPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# get printer info
|
||||
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)
|
||||
|
||||
render :json => {status: true}
|
||||
end
|
||||
end
|
||||
@@ -26,33 +26,33 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
bookings = Booking.all
|
||||
if !bookings.today.nil?
|
||||
@order_items_count = Hash.new
|
||||
bookings.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
if !booking.booking_orders.empty?
|
||||
booking.booking_orders.each do |booking_order|
|
||||
order = Order.find(booking_order.order_id)
|
||||
if !order.order_items.empty?
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||
else
|
||||
@order_items_count[booking.dining_facility_id] += order.order_items.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if !booking.sale_id.nil?
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status !='completed'
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||
else
|
||||
@order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# bookings.each do |booking|
|
||||
# if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
# if !booking.booking_orders.empty?
|
||||
# booking.booking_orders.each do |booking_order|
|
||||
# order = Order.find(booking_order.order_id)
|
||||
# if !order.order_items.empty?
|
||||
# if !@order_items_count.key?(booking.dining_facility_id)
|
||||
# @order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||
# else
|
||||
# @order_items_count[booking.dining_facility_id] += order.order_items.count
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# else
|
||||
# if !booking.sale_id.nil?
|
||||
# sale = Sale.find(booking.sale_id)
|
||||
# if sale.sale_status !='completed'
|
||||
# if !@order_items_count.key?(booking.dining_facility_id)
|
||||
# @order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||
# else
|
||||
# @order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
@room.bookings.active.each do |booking|
|
||||
|
||||
Reference in New Issue
Block a user