improvement

This commit is contained in:
Myat Zin Wai Maw
2020-02-07 09:31:20 +06:30
parent 0582587f75
commit a645e3348d
8 changed files with 96 additions and 151 deletions

View File

@@ -87,6 +87,8 @@ class Foodcourt::AddordersController < BaseFoodcourtController
end
def create
new_booking =true
booking_id =nil
if params[:booking_id].present?
booking = Booking.find(params[:booking_id])
end
@@ -124,27 +126,25 @@ class Foodcourt::AddordersController < BaseFoodcourtController
else
customer_id = params[:customer_id].present? ? params[:customer_id] : Customer.walkin.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 = customer_id
@order.items = items_arr
@order.guest = params[:guest_info]
@order.table_id = params[:table_id] # this is dining facilities's id
@order.new_booking = true
@order.waiters = current_login_employee.name
@order.employee_name = current_login_employee.name
@order.is_extra_time = is_extra_time
@order.extra_time = extra_time
if booking.nil? || booking.sale_id.present? || booking.booking_status == 'moved'
@order.new_booking = true
new_booking = true
else
@order.new_booking = false
@order.booking_id = booking.booking_id
new_booking = false
booking_id = booking.booking_id
end
@order =Order.create(source: params[:order_source],
order_type: params[:order_type],
customer_id: customer_id,
items: items_arr,
guest: params[:guest_info],
table_id: params[:table_id],
new_booking: new_booking,
waiters: current_login_employee.name,
employee_name: current_login_employee.name,
is_extra_time: is_extra_time,
extra_time: extra_time,
booking_id: booking_id
)
@status, @booking = @order.generate
if @status && @booking
@@ -162,8 +162,6 @@ class Foodcourt::AddordersController < BaseFoodcourtController
end
end
# Order.send_customer_view(@booking)
if current_user.role != "waiter" && params[:create_type] == "create_pay"
if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court')

View File

@@ -64,32 +64,13 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
# 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"
print_settings = PrintSetting.all
if !print_settings.nil?
print_settings.each do |setting|
if setting.unique_code == 'ReceiptBillPdf'
unique_code = "ReceiptBillPdf"
elsif setting.unique_code == 'ReceiptBillStarPdf'
unique_code = "ReceiptBillStarPdf"
end
end
end
if Lookup.collection_of("print_settings").any? { |x| x == ["ReceiptBillA5Pdf", "1"] } #print_settings with name:ReceiptBillA5Pdf
unique_code = "ReceiptBillA5Pdf"
else
unique_code = PrintSetting.where("unique_code REGEXP ?", "receipt.*bill.*pdf").first.unique_code
end
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
end
end
end
end
customer= Customer.find(saleObj.customer_id)
customer = saleObj.customer
# get member information
rebate = MembershipSetting.find_by_rebate(1)