merge with master
This commit is contained in:
@@ -59,10 +59,11 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
||||
order_reservation = params
|
||||
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
|
||||
|
||||
order_reservation = OrderReservation.find(order_reservation_id)
|
||||
# if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
|
||||
# end
|
||||
if flag #&& ENV["SERVER_MODE"] != 'cloud'
|
||||
order_reservation = OrderReservation.get_pending_orders #find(order_reservation_id)
|
||||
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
|
||||
end
|
||||
|
||||
if flag
|
||||
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
|
||||
else
|
||||
|
||||
@@ -39,7 +39,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
@membership_types = Lookup.collection_of("member_group_type")
|
||||
|
||||
@taxes = TaxProfile.all.order("order_by asc")
|
||||
@taxes = TaxProfile.where(:group_type => 'cashier')
|
||||
|
||||
@filter = filter
|
||||
|
||||
|
||||
@@ -89,6 +89,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
|
||||
# Query for OQS with delivery status
|
||||
def queue_items_query(status)
|
||||
byebug
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type as type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||
|
||||
@@ -5,7 +5,8 @@ class Oqs::HomeController < BaseOqsController
|
||||
# @queue_items_details = queue_items_query(false)
|
||||
|
||||
# Query for OQS with delivery status true
|
||||
@tables = DiningFacility.all.active.order('status desc')
|
||||
# @tables = DiningFacility.all.active.order('status desc')
|
||||
@tables = DiningFacility.where(:type => 'Table').order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
|
||||
@filter = params[:filter]
|
||||
@@ -161,9 +162,9 @@ class Oqs::HomeController < BaseOqsController
|
||||
oqs = "and assigned_order_items.order_queue_station_id = '#{oqs_id}' "
|
||||
end
|
||||
|
||||
if table_id.to_i>0
|
||||
table = "and df.id = '#{table_id}' "
|
||||
|
||||
if !table_id.empty?
|
||||
tableId = table_id.to_a.map{|h| h}.join(",")
|
||||
table = "and df.id IN (#{tableId})"
|
||||
else
|
||||
table = ''
|
||||
end
|
||||
|
||||
@@ -86,7 +86,7 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
@crm_customer = Customer.new
|
||||
@count_customer = Customer.count_customer
|
||||
|
||||
@taxes = TaxProfile.all.order("order_by asc")
|
||||
@taxes = TaxProfile.where(:group_type => 'cashier')
|
||||
# if flash["errors"]
|
||||
# @crm_customer.valid?
|
||||
# end
|
||||
|
||||
@@ -56,6 +56,22 @@ class Origami::DashboardController < BaseOrigamiController
|
||||
# get printer info
|
||||
@print_settings = PrintSetting.get_precision_delimiter()
|
||||
@current_user = current_user
|
||||
#quick service
|
||||
quick_service = Lookup.collection_of('quick_service')
|
||||
@quick_service = 0
|
||||
if !quick_service[0].nil?
|
||||
@quick_service = quick_service[0][1]
|
||||
end
|
||||
#order reservation
|
||||
order_reservation = Lookup.collection_of('order_reservation')
|
||||
@order_reservation = 0
|
||||
if !order_reservation.empty?
|
||||
order_reservation.each do |order_reserve|
|
||||
if order_reserve[0] == 'OrderReservation'
|
||||
@order_reservation = order_reserve[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -86,11 +86,12 @@ def create
|
||||
|
||||
# saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no)
|
||||
if status == true
|
||||
status, @sale,@membership_data = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no)
|
||||
|
||||
if status == true && @membership_data["status"] == true
|
||||
@out = true, "Success!"
|
||||
else
|
||||
@out =false, "Please try again payment!"
|
||||
@out =false, @membership_data["message"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,6 +3,8 @@ class Origami::MoveroomController < BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
|
||||
def move_dining
|
||||
@webview = check_mobile
|
||||
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
|
||||
@@ -3,6 +3,8 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
|
||||
def move_dining
|
||||
@webview = check_mobile
|
||||
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
class Origami::OrderReservationController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@order = OrderReservation.all
|
||||
@order = OrderReservation.latest_order
|
||||
@count_on_order = OrderReservation.get_count_on_order
|
||||
end
|
||||
|
||||
def update
|
||||
@id = params[:order_id]
|
||||
@status = params[:status]
|
||||
@status = params[:status]
|
||||
expected_waiting_time = params[:expected_time]
|
||||
@order_reservation = OrderReservation.find(@id)
|
||||
|
||||
status = true
|
||||
@@ -25,7 +27,7 @@ class Origami::OrderReservationController < BaseOrigamiController
|
||||
OrderReservation.update_order_reservation(@id, nil, "cancelled")
|
||||
result = {:status=> true, :message => "rejected" }
|
||||
else
|
||||
OrderReservation.update_order_reservation(@id, nil, "accepted")
|
||||
OrderReservation.update_order_reservation(@id, nil, "accepted", expected_waiting_time)
|
||||
result = {:status=> true, :message => "accepted" }
|
||||
end
|
||||
end
|
||||
@@ -50,7 +52,7 @@ class Origami::OrderReservationController < BaseOrigamiController
|
||||
status = params[:status]
|
||||
end
|
||||
|
||||
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status)
|
||||
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status,params[:waiting_time])
|
||||
|
||||
render :json => response
|
||||
end
|
||||
|
||||
@@ -88,11 +88,11 @@ def create
|
||||
|
||||
# saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no)
|
||||
if status == true
|
||||
status, @sale,@membership_data = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no)
|
||||
if status == true && @membership_data["status"] == true
|
||||
@out = true, "Success!"
|
||||
else
|
||||
@out =false, "Please try again payment!"
|
||||
@out =false, @membership_data["message"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
def first_bill
|
||||
sale_id = params[:sale_id] # sale_id
|
||||
sale_data = Sale.find_by_sale_id(sale_id)
|
||||
sale_items = SaleItem.where("sale_id=?",sale_id)
|
||||
sale_items = SaleItem.unscoped.select("sale_id,product_code,item_instance_code,product_name,product_alt_name,account_id,status,remark,SUM(qty) as qty,SUM(unit_price) as unit_price,SUM(taxable_price) as taxable_price,SUM(price) as price,is_taxable").where("sale_id=?",sale_id).group("item_instance_code,unit_price")
|
||||
member_info = nil
|
||||
|
||||
# For Cashier by Zone
|
||||
@@ -99,6 +99,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_items = SaleItem.unscoped.select("sale_id,product_code,item_instance_code,product_name,product_alt_name,account_id,status,remark,SUM(qty) as qty,SUM(unit_price) as unit_price,SUM(taxable_price) as taxable_price,SUM(price) as price,is_taxable").where("sale_id=?",sale_id).group("item_instance_code,unit_price")
|
||||
shop_details = Shop.first
|
||||
# rounding adjustment
|
||||
if shop_details.is_rounding_adj
|
||||
@@ -204,7 +205,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
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)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,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})
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ class Origami::PendingOrderController < BaseOrigamiController
|
||||
# @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@sale = Sale.pending_sale
|
||||
@order = Sale.pending_order
|
||||
|
||||
@completed = Sale.completed_sale
|
||||
end
|
||||
def show
|
||||
@sales = Sale.pending_sale
|
||||
@orders = Sale.pending_order
|
||||
@completed = Sale.completed_sale
|
||||
@id = params[:sale_id]
|
||||
if(@id[0,3] == "SAL")
|
||||
@sale = Sale.find(@id)
|
||||
@@ -41,4 +42,27 @@ class Origami::PendingOrderController < BaseOrigamiController
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def completed_sale
|
||||
@sales = Sale.pending_sale
|
||||
@orders = Sale.pending_order
|
||||
@completed = Sale.completed_sale
|
||||
@id = params[:sale_id]
|
||||
|
||||
@sale = Sale.find(@id)
|
||||
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
||||
@booking = BookingOrder.find_by_order_id(@order).booking_id
|
||||
@bookings = Booking.find(@booking)
|
||||
@status = "sale"
|
||||
|
||||
if @bookings.dining_facility_id.to_i > 0
|
||||
@table_id = Booking.find(@bookings.booking_id).dining_facility_id
|
||||
@dining = DiningFacility.find(@table_id)
|
||||
else
|
||||
@table_id = nil
|
||||
@dining = nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
63
app/controllers/reports/order_reservation_controller.rb
Normal file
63
app/controllers/reports/order_reservation_controller.rb
Normal file
@@ -0,0 +1,63 @@
|
||||
class Reports::OrderReservationController < BaseReportController
|
||||
# authorize_resource :class => false
|
||||
def index
|
||||
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"], ["Other Payment","card"]]
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
@shift = ''
|
||||
if params[:shift_name].to_i != 0
|
||||
shift_sale = ShiftSale.find(params[:shift_name])
|
||||
if to.blank?
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
|
||||
else
|
||||
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
||||
end
|
||||
end
|
||||
payment_type = params[:payment_type]
|
||||
@sale_data = Sale.get_sales_by_order_reservation(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@from = from
|
||||
@to = to
|
||||
# get printer info
|
||||
@print_settings = PrintSetting.get_precision_delimiter()
|
||||
if @shift.present?
|
||||
@shift.each do |sh|
|
||||
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_data = sh
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
|
||||
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
|
||||
shift_id = sale.id.nil? ? '-' : sale.id
|
||||
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
|
||||
date_arr.push(str)
|
||||
end
|
||||
|
||||
out = {:status => 'ok', :message => date_arr}
|
||||
|
||||
respond_to do |format|
|
||||
format.json { render json: out }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -20,7 +20,7 @@ authorize_resource :class => false
|
||||
payment_type = params[:payment_type]
|
||||
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@tax_profiles = TaxProfile.order('order_by asc')
|
||||
@tax_profiles = TaxProfile.order('order_by asc').limit(2)
|
||||
@from = from
|
||||
@to = to
|
||||
# get printer info
|
||||
|
||||
Reference in New Issue
Block a user