Files
sx-fc/app/controllers/crm/home_controller.rb

61 lines
1.5 KiB
Ruby
Executable File

class Crm::HomeController < BaseCrmController
def index
@booking = Booking.all
@customer = Customer.all
from = Time.current.beginning_of_day
to = Time.current.end_of_day
@queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to).order('queue_no ASC')
redirect_to crm_customers_path
# .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
end
def show
end
#print for crm
def print_order
@booking = Booking.find(params[:id])
@total_amount = 0.00
@total_tax = 0.00
if @booking.booking_orders
order_items = []
@booking.booking_orders.each do |bo|
order = Order.find(bo.order_id)
#if (order.status == "new")
order_items = order_items + order.order_items
#end
end
end
# unique_code="CrmOrderPdf"
# print_settings = PrintSetting.find_by_unique_code(unique_code)
# printer = Printer::ReceiptPrinter.new(print_settings)
# printer.print_crm_order(@booking,order_items,print_settings)
end
# def update_sale_by_customer
# sale = Sale.find(params[:sale_id])
# status = sale.update_attributes(customer_id: params[:customer_id])
# if status == true
# render json: JSON.generate({:status => true})
# else
# render json: JSON.generate({:status => false, :error_message => "Record not found"})
# end
# end
end