fixed conflict

This commit is contained in:
Nweni
2019-12-04 17:06:58 +06:30
33 changed files with 397 additions and 149 deletions

View File

@@ -1,5 +1,5 @@
class Api::PaymentsController < Api::ApiController
skip_before_action :authenticate
# skip_before_action :authenticate
#Payment by Invoice ID
# Payment Method - [Cash | CreditNote | VISA | MASTER | etc..]
@@ -25,6 +25,9 @@ class Api::PaymentsController < Api::ApiController
if params[:sale_id] && params[:card_no]
sale = Sale.find_by_sale_id(params[:sale_id])
if !sale.nil?
sale_id =sale.sale_id
sale_items = SaleItem.get_all_sale_items(sale_id)
@shop =Shop.find_by_shop_code(sale.shop_code)
if sale.sale_status == "new"
if !params[:card_no].empty?
current_shift = ShiftSale.current_shift
@@ -39,8 +42,125 @@ class Api::PaymentsController < Api::ApiController
status = sale_payment.process_payment(sale, current_login_employee, 0, "cash")
#card_balance amount for Paymal payment
card_balance_amount, transaction_ref = SaleAudit.getCardBalanceAmount(params[:sale_id])
puts card_balance_amount
puts "Card Balance Amount"
rebate_amount = nil
# For Cashier by Zone
# bookings = Booking.where("sale_id='#{sale_id}'")
bookings = Booking.find_by_sale_id(sale_id)
shift = ShiftSale.current_open_shift(current_login_employee)
if !shift.nil?
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
else
if bookings.dining_facility_id.to_i > 0
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
else
shift = ShiftSale.find(sale.shift_sale_id)
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
end
end
# 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 !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(sale.customer_id)
# 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,sale.receipt_no)
current_balance = SaleAudit.paymal_search(sale_id)
end
end
#orders print out
# if type == "quick_service"
booking = Booking.find_by_sale_id(sale_id)
if booking.dining_facility_id.to_i>0
table_id = booking.dining_facility_id
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
end
booking.booking_orders.each do |order|
# Order.pay_process_order_queue(order.order_id, table_id)
oqs = OrderQueueStation.new
oqs.pay_process_order_queue(order.order_id, table_id)
assign_order = AssignedOrderItem.assigned_order_item_by_job(order.order_id)
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
end
# end
#for card sale data
card_data = Array.new
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
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
card_no = cash_sale_trans.pan.last(4)
card_no = card_no.rjust(19,"**** **** **** ")
card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
end
end
#card_balance amount for Paymal payment
card_balance_amount,transaction_ref = SaleAudit.getCardBalanceAmount(sale_id)
# 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_items)
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
render json: JSON.generate({:status => true, :balance_amount => card_balance_amount,:receipt_no => sale.receipt_no, :message => "Payment successful."})
else
if @membership_data
@@ -183,4 +303,13 @@ class Api::PaymentsController < Api::ApiController
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee)
end
end
#get cloud domain
def getCloudDomain
from = ""
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain.to_s + "." + request.domain.to_s
end
return from
end
end

View File

@@ -9,18 +9,18 @@ module TokenVerification
protected
# Authenticate the user with token based authentication
def authenticate
def authenticate
authenticate_token || render_unauthorized
end
def authenticate_token
authenticate_with_http_token do |token, options|
authenticate_with_http_token do |token, options|
# Rails.logger.debug "token - " + token.to_s
if(options.length !=0 && options["from"] == "DOEMAL")
if(ENV["SERVER_MODE"] === "cloud")
from = request.subdomain.downcase + "." + request.domain.downcase #"local"
aes = MyAesCrypt.new
return aes.checkKeyForAuth(from, token)
return aes.checkKeyForAuth(from, token)
end
end

View File

@@ -35,12 +35,13 @@ class Foodcourt::FoodCourtController < ApplicationController
end
end
end
@app_order_new_count =Booking.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
@app_order_new_count = Booking.select("bookings.*,customers.*")
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
.where("orders.source='app' and bookings.shop_code='#{Shop.current_shop.shop_code}' and bookings.booking_status='assign'").uniq.length
puts @app_order_new_count
.where("orders.source='app' and bookings.shop_code='#{Shop.current_shop.shop_code}' and DATE(bookings.created_at) = '#{Date.today}' and bookings.booking_status='assign'").uniq.length
render "foodcourt/addorders/detail"
end

View File

@@ -62,18 +62,19 @@ class Foodcourt::OrdersController < BaseFoodcourtController
.where("orders.source='app' and bookings.booking_id='#{params[:booking_id]}'").first
@customer_id =@booking.customer_id
@booking_id =@booking.booking_id
@order_id =@booking.order_id
end
@bookings = Booking.select("bookings.*,customers.*")
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
.where("orders.source='app'").order("bookings.created_at desc").uniq
.where("orders.source='app' and DATE(bookings.created_at) = '#{Date.today}' and bookings.shop_code='#{Shop.current_shop.shop_code}'").order("bookings.created_at desc").uniq
end
def completed
customer =Customer.find_by_customer_id(params[:customer_id])
phone_number =customer.contact_no
if Order.send_message(phone_number,params[:booking_id])
if Order.send_message(phone_number,params[:order_id])
booking =Booking.find(params[:booking_id])
booking.booking_status ='completed'
booking.save!

View File

@@ -5,7 +5,7 @@ class Reports::PaymentMethodController < BaseReportController
@payments = [["All Payment",''],["Cash Payment","cash"], ["KBZ Payment", KbzPay::KBZ_PAY], ["Credit Payment","creditnote"],
["FOC Payment","foc"], ["MPU Payment","mpu"], ["Visa Payment","visa"],
["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","unionpay"],
["Alipay Payment","alipay"],["Paymal Payment", "paymal"],["Dinga Payment","dinga"],
["Alipay Payment","alipay"],["Card Payment", "paymal"],["Dinga Payment","dinga"],
["JunctionPay","junctionpay"],["Redeem Payment","paypar"],["Gift Voucher","giftvoucher"]]
from, to = get_date_range_from_params

View File

@@ -591,8 +591,8 @@ class Order < ApplicationRecord
Rails.logger.debug '...... order sync completed .....'
end
end
def self.send_message(phone, booking_id)
url = "http://smspoh.com/api/http/send?key=5QfyN0OtGsFXnOqwtpVAGZCyPGP28nbX_Nm_oPsUw2ybq714T_951ycz3Ypl5URA&message=Your order "+booking_id.to_s+" is ready to pick up&recipients="+ phone.to_s
def self.send_message(phone, order_id)
url = "http://smspoh.com/api/http/send?key=5QfyN0OtGsFXnOqwtpVAGZCyPGP28nbX_Nm_oPsUw2ybq714T_951ycz3Ypl5URA&message=Your order "+order_id.to_s+" is ready to pick up&recipients="+ phone.to_s
begin
@result = HTTParty.get(url.to_str)

View File

@@ -39,8 +39,8 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# end
shop = Shop.current_shop
directory_name = 'public/orders_'+shop.shop_code
# shop = Shop.current_shop
directory_name = 'public/orders_'+oqs.shop_code
Dir.mkdir(directory_name) unless File.exists?(directory_name)
filename = directory_name + "/order_item_#{order_id}_#{order_item_id}" + ".pdf"
@@ -82,8 +82,9 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
order=print_query('order_summary', order_id)
shop = Shop.current_shop
directory_name = 'public/orders_'+ shop.shop_code
# shop = Shop.current_shop
directory_name = 'public/orders_'+ oqs.shop_code
Dir.mkdir(directory_name) unless File.exists?(directory_name)
# For Print Per Item
@@ -195,8 +196,8 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
order=print_query('booking_summary', booking_id)
shop = Shop.current_shop
directory_name = 'public/orders_'+shop.shop_code
# shop = Shop.current_shop
directory_name = 'public/orders_'+oqs.shop_code
Dir.mkdir(directory_name) unless File.exists?(directory_name)
# For Print Per Item
@@ -297,7 +298,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# Query for OQS with status
def print_query(type, id)
if type == "order_item"
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
OrderItem.select("orders.source,cus.contact_no,rder_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
.joins("left join orders ON orders.order_id = order_items.order_id
left join booking_orders AS bo ON bo.order_id=order_items.order_id
left join bookings AS b ON b.booking_id = bo.booking_id
@@ -307,7 +308,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
.where("order_items.order_items_id = '#{ id }'")
.group("order_items.item_code")
elsif type == "order_summary"
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
OrderItem.select("orders.source,cus.contact_no,order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
.joins("left join orders ON orders.order_id = order_items.order_id
left join booking_orders AS bo ON bo.order_id=order_items.order_id
left join bookings AS b ON b.booking_id = bo.booking_id
@@ -318,7 +319,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
.group("order_items.order_items_id")
else
# order summary for booking
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
OrderItem.select("orders.source,cus.contact_no,order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
.joins("left join orders ON orders.order_id = order_items.order_id
left join booking_orders AS bo ON bo.order_id=order_items.order_id
left join bookings AS b ON b.booking_id = bo.booking_id

View File

@@ -43,7 +43,7 @@ class CloseCashierCustomisePdf < Prawn::Document
stroke_horizontal_rule
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
end
def header (shop_details)
@@ -322,7 +322,7 @@ class CloseCashierCustomisePdf < Prawn::Document
if other.paymal_amount && other.paymal_amount.to_f > 0
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Paymal Payment :", :size => self.item_font_size, :align => :right
text "Card Payment :", :size => self.item_font_size, :align => :right
end
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
text "#{ number_format(other.paymal_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right

View File

@@ -276,7 +276,7 @@ class CloseCashierPdf < Prawn::Document
if other.paymal_amount && other.paymal_amount.to_f > 0
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Paymal Payment :", :size => self.item_font_size, :align => :right
text "Card Payment :", :size => self.item_font_size, :align => :right
end
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
text "#{ number_format(other.paymal_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right

View File

@@ -43,7 +43,7 @@ class CloseCashierPdf < Prawn::Document
stroke_horizontal_rule
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_waste,total_spoile,total_other_charges,total_credit_payments)
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_waste,total_spoile,total_other_charges,total_credit_payments)
end
@@ -263,7 +263,7 @@ class CloseCashierPdf < Prawn::Document
if other.paymal_amount && other.paymal_amount.to_f > 0
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Paymal Payment :", :size => self.item_font_size, :align => :right
text "Card Payment :", :size => self.item_font_size, :align => :right
end
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
text "#{ number_format(other.paymal_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right

View File

@@ -34,15 +34,20 @@ class OrderItemCustomisePdf < Prawn::Document
# font "public/fonts/Zawgyi-One.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
if order_item.source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{order_item.contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
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
#order_info
order_info(order_item.order_id, order_item.order_by,order_item.order_at)

View File

@@ -32,18 +32,23 @@ class OrderItemPdf < Prawn::Document
font "#{print_settings.font}"
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
end
# font "public/fonts/Zawgyi-One.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
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
#font "public/fonts/Chinese.ttf"
if order_item.source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{order_item.contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
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
#order_info
order_info(order_item.order_id, order_item.order_by,order_item.order_at)

View File

@@ -34,15 +34,20 @@ class OrderItemSlimCustomisePdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
#font "public/fonts/Chinese.ttf"
if !order_item_slim.dining.nil?
text "#{ order_item_slim.type + '-' + order_item_slim.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 1
if order_item_slim.source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{order_item_slim.contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
if !order_item_slim.dining.nil?
text "#{ order_item_slim.type + '-' + order_item_slim.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 1
#order_info
order_info(order_item_slim.order_id, order_item_slim.order_by,order_item_slim.order_at)

View File

@@ -34,14 +34,20 @@ class OrderItemSlimPdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
#font "public/fonts/Chinese.ttf"
if !order_item_slim.dining.nil?
text "#{ order_item_slim.type + '-' + order_item_slim.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
if order_item_slim.source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{order_item_slim.contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
if !order_item_slim.dining.nil?
text "#{ order_item_slim.type + '-' + order_item_slim.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 1
stroke_horizontal_rule
move_down 1
#order_info
order_info(order_item_slim.order_id, order_item_slim.order_by,order_item_slim.order_at)

View File

@@ -35,14 +35,20 @@ class OrderItemStarPdf < Prawn::Document
# font "public/fonts/Zawgyi-One.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
if order_item.source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{order_item.contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
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
stroke_horizontal_rule
move_down 3
#order_info
order_info(order_item.order_id, order_item.order_by,order_item.order_at)

View File

@@ -34,13 +34,19 @@ class OrderSetItemCustomisePdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
#font "public/fonts/Chinese.ttf"
if !order_set_item.dining.nil?
text "#{ order_set_item.type + '-' + order_set_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
if order_set_item.source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{order_set_item.contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
if !order_set_item.dining.nil?
text "#{ order_set_item.type + '-' + order_set_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
#order_info
order_info(order_set_item.order_id, order_set_item.order_by,order_set_item.order_at)

View File

@@ -33,13 +33,19 @@ class OrderSetItemPdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
#font "public/fonts/Chinese.ttf"
if !order_set_item.dining.nil?
text "#{ order_set_item.type + '-' + order_set_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
if order_set_item.source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{order_set_item.contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
if !order_set_item.dining.nil?
text "#{ order_set_item.type + '-' + order_set_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
#order_info
order_info(order_set_item.order_id, order_set_item.order_by,order_set_item.order_at)

View File

@@ -34,6 +34,12 @@ class OrderSummaryCustomisePdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
if order[0].source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{order[0].contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
if !order[0].dining.nil?
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
else

View File

@@ -32,7 +32,12 @@ class OrderSummaryPdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
if order[0].source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{order[0].contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
if !order[0].dining.nil?
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
else
@@ -41,7 +46,6 @@ class OrderSummaryPdf < Prawn::Document
stroke_horizontal_rule
move_down 5
#order_info
order_info(order[0].order_id, order[0].order_by,order[0].order_at)

View File

@@ -33,6 +33,13 @@ class OrderSummarySetCustomisePdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
if order[0].source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{order[0].contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
if !order[0].dining.nil?
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
else
@@ -41,7 +48,6 @@ class OrderSummarySetCustomisePdf < Prawn::Document
stroke_horizontal_rule
move_down 5
#order_info
order_info(order[0].order_id, order[0].order_by,order[0].order_at)

View File

@@ -32,6 +32,13 @@ class OrderSummarySetPdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
if order[0].source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{order[0].contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
if !order[0].dining.nil?
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
else
@@ -40,7 +47,6 @@ class OrderSummarySetPdf < Prawn::Document
stroke_horizontal_rule
move_down 5
#order_info
order_info(order[0].order_id, order[0].order_by,order[0].order_at)

View File

@@ -33,6 +33,12 @@ class OrderSummarySlimCustomisePdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
if order[0].source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{order[0].contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
if !order[0].dining.nil?
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
else

View File

@@ -32,6 +32,12 @@ class OrderSummarySlimPdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
if order[0].source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{order[0].contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
if !order[0].dining.nil?
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
else

View File

@@ -42,7 +42,12 @@ class ReceiptBillA5Pdf < Prawn::Document
# font "public/fonts/padauk.ttf"
header(shop_details)
if sale_data.orders[0].source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{sale_data.customer.contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
stroke_horizontal_rule
cashier_info(sale_data, customer_name, latest_order_no)
@@ -405,12 +410,16 @@ class ReceiptBillA5Pdf < Prawn::Document
y_position = cursor
if payment.payment_method == "paypar"
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
text "Redeem Payment", :size => self.item_font_size,:align => :left
end
text "Redeem Payment", :size => self.item_font_size,:align => :left
end
else
payment_method = payment.payment_method.capitalize
if payment.payment_method == "paymal"
payment_method ='Card'
end
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
end
text "#{payment_method} Payment", :size => self.item_font_size,:align => :left
end
end
bounding_box([self.description_width,y_position], :width =>self.label_width) do

View File

@@ -43,7 +43,12 @@ class ReceiptBillOrderPdf < Prawn::Document
# font "public/fonts/padauk.ttf"
header(shop_details)
if sale_data.orders[0].source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{sale_data.customer.contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
stroke_horizontal_rule
cashier_info(sale_data, customer_name, latest_order_no,order_reservation)

View File

@@ -45,7 +45,12 @@ class ReceiptBillPdf < Prawn::Document
# font "public/fonts/padauk.ttf"
header(shop_details)
if sale_data.orders[0].source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{sale_data.customer.contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
stroke_horizontal_rule
cashier_info(sale_data, customer_name, latest_order_no)
@@ -464,8 +469,12 @@ class ReceiptBillPdf < Prawn::Document
text "Redeem Payment", :size => self.item_font_size,:align => :left
end
else
payment_method = payment.payment_method.capitalize
if payment.payment_method == "paymal"
payment_method ='Card'
end
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
text "#{payment_method} Payment", :size => self.item_font_size,:align => :left
end
end

View File

@@ -44,7 +44,12 @@ class ReceiptBillStarPdf < Prawn::Document
# font "public/fonts/padauk.ttf"
header(shop_details)
if sale_data.orders[0].source =='app'
text "Mobile Order", :size => self.header_font_size,:align => :left
move_down 1
text "Customer Ph : #{sale_data.customer.contact_no}", :size => self.header_font_size,:align => :left
move_down 1
end
stroke_horizontal_rule
cashier_info(sale_data, customer_name, latest_order_no)
@@ -403,8 +408,12 @@ class ReceiptBillStarPdf < Prawn::Document
text "Redeem Payment", :size => self.item_font_size,:align => :left
end
else
payment_method = payment.payment_method.capitalize
if payment.payment_method == "paymal"
payment_method ='Card'
end
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
text "#{payment_method} Payment", :size => self.item_font_size,:align => :left
end
end

View File

@@ -147,7 +147,7 @@
</div>
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10">
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-12" id='app_order'>
Application Orders <span class="badge badge-danger" style="font-size: 0.75rem;border-radius: 5px;"><%= @app_order_new_count %></span>
Mobile Orders <span class="badge badge-danger" style="font-size: 0.75rem;border-radius: 5px;"><%= @app_order_new_count %></span>
</button>
<br>
<div class="card-header" style="padding: 0.12rem 0.25rem">

View File

@@ -11,7 +11,7 @@
<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= foodcourt_food_court_path %>">Foodcourt</a></li>
<li class="breadcrumb-item active">Application Orders</li>
<li class="breadcrumb-item active">Mobile Orders</li>
<span class="float-right">
<%= link_to 'Back', foodcourt_food_court_path %>
</span>
@@ -30,23 +30,27 @@
<% end %>
<div id="custom-slimscroll">
<div class="card-columns">
<% bk_status ='' %>
<% bk_color ='' %>
<% @bookings.each do |bk|
bk_status ='completed'
if bk.booking_status =='assign'
bk_status ='new'
end
if !@booking.nil?
if bk.booking_id == @booking.booking_id
bk_status ='bg-red'
bk_color ='bg-red'
else
bk_status =bk.booking_status
bk_color =bk.booking_status
end
else
bk_status =bk.booking_status
bk_color =bk.booking_status
end %>
<%= link_to foodcourt_app_order_by_booking_path(booking_id:bk.booking_id) do %>
<div class="card <%= bk_status %> text-white" data-id ="<%= bk.booking_id %>">
<div class="card <%= bk_color %> text-white" data-id ="<%= bk.booking_id %>">
<div class="card-block">
Cus Ph :<%= bk.contact_no %><span style="font-size:12px;float:right;line-height:inherit;">Order Time :<%= bk.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
BK :<%= bk.booking_id %>
</div>
Order No :<%= bk.orders[0].order_id %><span style="font-size:12px;float:right;line-height:inherit;"><%= bk_status %></span> </div>
</div>
<% end %>
<% end %>
@@ -60,6 +64,7 @@
<div class="col-md-9 col-lg-9 col-sm-9">
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@booking.dining_facility.name%></span><br>
<strong class="font-14 p-l-10">Booking - <%=@booking.booking_id%></strong>
<strong class="font-14 p-l-10">Order No- <%=@booking.order_id%></strong>
</div>
<div class="col-md-3 col-lg-3 col-sm-3">
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
@@ -117,32 +122,38 @@
</div>
</div>
<script type="text/javascript">
$('#back').on('click', function () {
window.location.href ="<%=foodcourt_food_court_path %>";
});
$('#done_order').on('click', function () {
swal({
title: "Alert !",
text: 'This order is really done!',
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes!",
cancelButtonClass: 'btn btn-danger',
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
$('.confirm').prop("disabled",true);
$.ajax({
type: "POST",
url: "/foodcourt/<%=@booking_id %>/completed",
data: {customer_id:"<%=@customer_id %>"},
dataType: "json",
success: function(data) {
window.location.href ="<%=foodcourt_app_order_by_booking_path %>";
}
});
}
});
});
  $('#back').on('click', function () {
     window.location.href ="<%=foodcourt_food_court_path %>";
  });
  $('#done_order').on('click', function () {
    swal({
      title: "Alert !",
      text: 'Order Complete?',
      type: "warning",
      showCancelButton: true,
      confirmButtonColor: "#DD6B55",
      confirmButtonText: "Yes",
      cancelButtonClass: 'btn btn-danger',
      closeOnConfirm: false
    }, function (isConfirm) {
      if (isConfirm) {
        $('.confirm').prop("disabled",true);
        $.ajax({
          type: "POST",
          url: "/foodcourt/<%=@booking_id %>/<%=@order_id %>/completed",
          data: {customer_id:"<%=@customer_id %>"},
          dataType: "json",
          success: function(data) {
            swal({
             title: "Information!",
             text: 'Send sms to customer ',
             type: "success",
           }, function () {
             window.location.href ="<%=foodcourt_app_order_by_booking_path %>";
           });
          }
        });
      }
    });
  });
</script>

View File

@@ -427,9 +427,6 @@
<% if (@cashier_type=="quick_service" || @cashier_type=="food_court") && @sale_payment.nil? %>
<hr>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<% else %>
@@ -1388,11 +1385,13 @@ $(document).ready(function(){
url: "/foodcourt/payment/"+cashier_type+"/foc",
data: params,
success:function(result){
$('#focModal').modal('hide');
customer_display_view(null,"reload");
if (cash >= 0) {
swal({
title: "Information!",
text: 'Thank You !',
type: "success",
}, function () {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {

View File

@@ -1,11 +1,11 @@
# 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!
# threads 1,1
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!
threads 1,1

View File

@@ -688,7 +688,7 @@ scope "(:locale)", locale: /en|mm/ do
post '/customer_view' => "second_display#customer_view",:as => "customer_view", :defaults => { :format => 'json' }
get "food_court" => "food_court#index"
get "app_orders" => "orders#app_orders",:as => "app_order_by_booking"
post ':booking_id/completed' => "orders#completed", :defaults => { :format => 'json' }
post ':booking_id/:order_id/completed' => "orders#completed", :defaults => { :format => 'json' }
end
end
end

1
server2.pid Normal file
View File

@@ -0,0 +1 @@
12343