app order

This commit is contained in:
Myat Zin Wai Maw
2019-12-04 14:37:21 +06:30
19 changed files with 97 additions and 138 deletions

View File

@@ -68,7 +68,7 @@ class Foodcourt::OrdersController < BaseFoodcourtController
.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}'").order("bookings.created_at desc").uniq
end
def completed
customer =Customer.find_by_customer_id(params[:customer_id])

View File

@@ -1,4 +1,5 @@
class Foodcourt::PaymalController < BaseFoodcourtController
def index
@sale_id = params[:sale_id]
payment_method = params[:payment_method]
@@ -6,7 +7,9 @@ class Foodcourt::PaymalController < BaseFoodcourtController
@membership_rebate_balance=0
sale_data = Sale.find_by_sale_id(@sale_id)
@receipt_no = sale_data.receipt_no
# @shop = Shop.first
@shop = Shop.current_shop
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else

View File

@@ -7,7 +7,8 @@ class Foodcourt::PayparPaymentsController < BaseFoodcourtController
payment_method = "paypar"
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
# shop_details = Shop.first
@shop = Shop.current_shop
# rounding adjustment
if @shop.is_rounding_adj

View File

@@ -8,7 +8,7 @@ class Foodcourt::RequestBillsController < ApplicationController
end
# Print Request Bill and add to sale tables
def print
if !ShiftSale.current_shift(@shop.shop_code).nil?
if !ShiftSale.current_shift.nil?
order_id = params[:id] # order_id
order = Order.find(order_id)
booking = order.booking
@@ -45,7 +45,7 @@ class Foodcourt::RequestBillsController < ApplicationController
sale_audit = SaleAudit.record_audit_sale(sale_data.sale_id,remark,action_by,type )
# Promotion Activation
Promotion.promo_activate(sale_data,@shop.shop_code)
Promotion.promo_activate(sale_data)
#bill channel
if ENV["SERVER_MODE"] == 'cloud'
@@ -62,14 +62,14 @@ class Foodcourt::RequestBillsController < ApplicationController
render :json => result.to_json
else
#check checkInOut pdf print
checkout_time = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of('checkout_time')
checkout_time = Lookup.collection_of('checkout_time')
if !booking.dining_facility_id.nil?
terminal = DiningFacility.find_by_id(booking.dining_facility_id)
cashier_terminal = CashierTerminal.find_by_id(terminal.zone_id)
if (!checkout_time.empty?) && (ENV["SERVER_MODE"] != "cloud") #no print in cloud server
unique_code = "CheckInOutPdf"
printer = PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code)
printer = PrintSetting.find_by_unique_code(unique_code)
# print when complete click
order_queue_printer = Printer::OrderQueuePrinter.new(printer)

View File

@@ -7,7 +7,7 @@ class Foodcourt::SalesController < BaseFoodcourtController
@tables = Table.unscoped.all.active.order('status desc')
@rooms = Room.unscoped.all.active.order('status desc')
@complete = Sale.completed_sale("cashier",@shop.shop_code)
@complete = Sale.completed_sale("cashier")
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@customers = Customer.pluck("customer_id, name")
@sale = Sale.find(params[:sale_id])