dashboard ui and checkin checkout process
This commit is contained in:
78
app/controllers/api/check_in_process_controller.rb
Normal file
78
app/controllers/api/check_in_process_controller.rb
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
class Api::CheckInProcessController < Api::ApiController
|
||||||
|
|
||||||
|
def check_in_process
|
||||||
|
if params[:dining_id]
|
||||||
|
dining_facility = DiningFacility.find(params[:dining_id])
|
||||||
|
if dining_facility.status == "available"
|
||||||
|
dining_charge = DiningCharge.select('charge_type','charge_block')
|
||||||
|
.where('dining_facility_id = ?',params[:dining_id])
|
||||||
|
.first()
|
||||||
|
|
||||||
|
checkout_at = Time.now.utc
|
||||||
|
|
||||||
|
if !dining_charge.nil?
|
||||||
|
hr = (dining_charge.charge_block.utc.strftime("%H").to_i).to_int
|
||||||
|
min = (dining_charge.charge_block.utc.strftime("%M").to_i).to_int
|
||||||
|
# if dining_charge.charge_type == 'hr'
|
||||||
|
checkout_at = checkout_at + hr.hour + min.minutes
|
||||||
|
# else
|
||||||
|
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
||||||
|
dining_facility.status = "occupied"
|
||||||
|
dining_facility.save!
|
||||||
|
|
||||||
|
if dining_facility.type == "Table"
|
||||||
|
type = "TableBooking"
|
||||||
|
else
|
||||||
|
type = "RoomBooking"
|
||||||
|
end
|
||||||
|
|
||||||
|
booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
|
||||||
|
:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign" })
|
||||||
|
booking.save!
|
||||||
|
|
||||||
|
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.strftime("%Y-%m-%d %H:%M") }
|
||||||
|
else
|
||||||
|
error_message = "#{dining_facility.type} is not available!"
|
||||||
|
render :json => { :status => false, :error_message => error_message }
|
||||||
|
end
|
||||||
|
else
|
||||||
|
error_message = "dining_id is required!"
|
||||||
|
render :json => { :status => false, :error_message => error_message }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def request_time
|
||||||
|
if !params[:booking_id].nil? && !params[:time].nil?
|
||||||
|
time = Time.parse(params[:time])
|
||||||
|
booking = Booking.find(params[:booking_id])
|
||||||
|
|
||||||
|
checkout_at = booking.checkout_at.utc
|
||||||
|
|
||||||
|
hr = (time.strftime("%H").to_i).to_int
|
||||||
|
min = (time.strftime("%M").to_i).to_int
|
||||||
|
checkout_at = checkout_at + hr.hour + min.minutes
|
||||||
|
|
||||||
|
booking.checkout_at = checkout_at
|
||||||
|
booking.save!
|
||||||
|
|
||||||
|
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.strftime("%Y-%m-%d %H:%M") }
|
||||||
|
elsif !params[:booking_id].nil? && params[:time].nil?
|
||||||
|
error_message = "time is required!"
|
||||||
|
render :json => { :status => false, :error_message => error_message }
|
||||||
|
elsif params[:booking_id].nil? && !params[:time].nil?
|
||||||
|
error_message = "booking_id is required!"
|
||||||
|
render :json => { :status => false, :error_message => error_message }
|
||||||
|
else
|
||||||
|
error_message = "booking_id and time are required!"
|
||||||
|
render :json => { :status => false, :error_message => error_message }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def check_in_process_params
|
||||||
|
params.permit(:dining_id,:booking_id,:time)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -74,18 +74,42 @@ class HomeController < ApplicationController
|
|||||||
@employee_sales = Sale.employee_sales(today).sum(:grand_total)
|
@employee_sales = Sale.employee_sales(today).sum(:grand_total)
|
||||||
@inventories = StockJournal.inventory_balances(today).sum(:balance)
|
@inventories = StockJournal.inventory_balances(today).sum(:balance)
|
||||||
|
|
||||||
#@employee_sales = Hash.new
|
|
||||||
#employee_sales.each do |key, value|
|
|
||||||
# if(@employee_sales.has_key? key[1])
|
|
||||||
# @employee_sales[key[1]].push({key[0] => value})
|
|
||||||
# else
|
|
||||||
# @employee_sales[key[1]] = [key[0] => value]
|
|
||||||
# end
|
|
||||||
#end
|
|
||||||
@total_sale = Sale.total_sale(today)
|
@total_sale = Sale.total_sale(today)
|
||||||
@total_count = Sale.total_count(today)
|
@total_count = Sale.total_count(today)
|
||||||
@total_card = Sale.total_card_sale(today)
|
@total_card = Sale.total_card_sale(today)
|
||||||
@total_credit = Sale.credit_payment(today)
|
@total_credit = Sale.credit_payment(today)
|
||||||
|
|
||||||
|
@sale_data = Array.new
|
||||||
|
@total_payment_methods = Sale.total_payment_methods(today)
|
||||||
|
@total_payment_methods.each do |payment|
|
||||||
|
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
|
||||||
|
pay = Sale.payment_sale('card', today)
|
||||||
|
@sale_data.push({'card' => pay})
|
||||||
|
else
|
||||||
|
pay = Sale.payment_sale(payment.payment_method, today)
|
||||||
|
@sale_data.push({payment.payment_method => pay})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@summ_sale = Sale.summary_sale_receipt(today)
|
||||||
|
|
||||||
|
@total_customer = Sale.total_customer(today)
|
||||||
|
@total_dinein = Sale.total_dinein(today)
|
||||||
|
@total_takeaway = Sale.total_takeaway(today)
|
||||||
|
@total_other_customer = Sale.total_other_customer(today)
|
||||||
|
@total_membership = Sale.total_membership(today)
|
||||||
|
|
||||||
|
@total_order = Sale.total_order(today)
|
||||||
|
@total_accounts = Sale.total_account(today)
|
||||||
|
@account_data = Array.new
|
||||||
|
@total_accounts.each do |account|
|
||||||
|
acc = Sale.account_data(account.account_id, today)
|
||||||
|
if !acc.nil?
|
||||||
|
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@top_items = Sale.top_items(today)
|
||||||
|
@total_foc_items = Sale.total_foc_items(today)
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|||||||
38
app/controllers/origami/check_in_process_controller.rb
Normal file
38
app/controllers/origami/check_in_process_controller.rb
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
class Origami::CheckInProcessController < BaseOrigamiController
|
||||||
|
|
||||||
|
def check_in_process
|
||||||
|
dining_charge = DiningCharge.select('charge_type','charge_block')
|
||||||
|
.where('dining_facility_id = ?',params[:dining_id])
|
||||||
|
.first()
|
||||||
|
|
||||||
|
checkout_at = Time.now.utc
|
||||||
|
|
||||||
|
if !dining_charge.nil?
|
||||||
|
hr = (dining_charge.charge_block.utc.strftime("%H").to_i).to_int
|
||||||
|
min = (dining_charge.charge_block.utc.strftime("%M").to_i).to_int
|
||||||
|
# if dining_charge.charge_type == 'hr'
|
||||||
|
checkout_at = checkout_at + hr.hour + min.minutes
|
||||||
|
# else
|
||||||
|
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
@dining_facility = DiningFacility.find(params[:dining_id])
|
||||||
|
@dining_facility.status = "occupied"
|
||||||
|
@dining_facility.save!
|
||||||
|
|
||||||
|
if @dining_facility.type == "Table"
|
||||||
|
type = "TableBooking"
|
||||||
|
else
|
||||||
|
type = "RoomBooking"
|
||||||
|
end
|
||||||
|
|
||||||
|
@booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
|
||||||
|
:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign" })
|
||||||
|
@booking.save!
|
||||||
|
|
||||||
|
respond = {:status => 'ok'}
|
||||||
|
respond_to do |format|
|
||||||
|
format.json { render json: respond }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -7,7 +7,7 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||||
@orders = Order.all.order('date desc')
|
@orders = Order.all.order('date desc')
|
||||||
@shop = Shop.find_by_id(1)
|
@shop = Shop.find_by_id(1)
|
||||||
|
|
||||||
# @shift = ShiftSale.current_open_shift(current_user.id)
|
# @shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -23,10 +23,12 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@sale_array = Array.new
|
@sale_array = Array.new
|
||||||
|
|
||||||
@dining.bookings.active.each do |booking|
|
@dining.bookings.active.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
|
@order_items = Array.new
|
||||||
@order_items = Array.new
|
if booking.booking_orders.empty?
|
||||||
booking.booking_orders.each do |booking_order|
|
@booking = booking
|
||||||
|
else
|
||||||
|
booking.booking_orders.each do |booking_order|
|
||||||
order = Order.find(booking_order.order_id)
|
order = Order.find(booking_order.order_id)
|
||||||
if (order.status == "new")
|
if (order.status == "new")
|
||||||
@obj_order = order
|
@obj_order = order
|
||||||
@@ -43,29 +45,30 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@account_arr.push(account)
|
@account_arr.push(account)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@status_order = 'order'
|
|
||||||
else
|
|
||||||
sale = Sale.find(booking.sale_id)
|
|
||||||
if sale.sale_status != "completed" && sale.sale_status != 'void'
|
|
||||||
|
|
||||||
@sale_array.push(sale)
|
|
||||||
if @status_order == 'order'
|
|
||||||
@status_order = 'sale'
|
|
||||||
end
|
|
||||||
@booking= booking
|
|
||||||
@date = sale.created_at
|
|
||||||
@status_sale = 'sale'
|
|
||||||
@obj_sale = sale
|
|
||||||
@customer = sale.customer
|
|
||||||
accounts = @customer.tax_profiles
|
|
||||||
@account_arr =[]
|
|
||||||
accounts.each do |acc|
|
|
||||||
account = TaxProfile.find(acc)
|
|
||||||
@account_arr.push(account)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@status_order = 'order'
|
||||||
|
else
|
||||||
|
sale = Sale.find(booking.sale_id)
|
||||||
|
if sale.sale_status != "completed" && sale.sale_status != 'void'
|
||||||
|
|
||||||
|
@sale_array.push(sale)
|
||||||
|
if @status_order == 'order'
|
||||||
|
@status_order = 'sale'
|
||||||
|
end
|
||||||
|
@booking= booking
|
||||||
|
@date = sale.created_at
|
||||||
|
@status_sale = 'sale'
|
||||||
|
@obj_sale = sale
|
||||||
|
@customer = sale.customer
|
||||||
|
accounts = @customer.tax_profiles
|
||||||
|
@account_arr =[]
|
||||||
|
accounts.each do |acc|
|
||||||
|
account = TaxProfile.find(acc)
|
||||||
|
@account_arr.push(account)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class DiningFacility < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_current_booking
|
def get_current_booking
|
||||||
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
|
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}'").limit(1) #and checkout_at is null
|
||||||
if booking.count > 0 then
|
if booking.count > 0 then
|
||||||
return booking[0]
|
return booking[0]
|
||||||
else
|
else
|
||||||
@@ -65,4 +65,32 @@ class DiningFacility < ApplicationRecord
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_current_checkout_booking
|
||||||
|
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id is null and checkout_at is not null and checkout_by is null").limit(1)
|
||||||
|
if booking.count > 0 then
|
||||||
|
return booking[0]
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_checkout_booking
|
||||||
|
booking = self.get_current_checkout_booking
|
||||||
|
if booking
|
||||||
|
now = Time.now.utc
|
||||||
|
hr = (now.strftime("%H").to_i).to_int
|
||||||
|
min = (now.strftime("%M").to_i).to_int
|
||||||
|
|
||||||
|
checkout_at = booking.checkout_at.utc
|
||||||
|
|
||||||
|
checkout_at = checkout_at - hr.hour
|
||||||
|
checkout_at = checkout_at - min.minutes
|
||||||
|
checkout_at = checkout_at.utc.strftime("%M").to_i
|
||||||
|
|
||||||
|
if checkout_at <= 15
|
||||||
|
return booking
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -941,9 +941,9 @@ end
|
|||||||
# .joins("join sale_payments on sale_id = sales.sale_id")
|
# .joins("join sale_payments on sale_id = sales.sale_id")
|
||||||
# .group("sales.sale_id")
|
# .group("sales.sale_id")
|
||||||
|
|
||||||
query = SalePayment.where('s.sale_status = "completed" and payment_method = "mpu" or payment_method = "visa" or payment_method = "master" or payment_method = "jcb" and DATE_FORMAT(s.receipt_date,"%Y-%m-%d") = ?',today)
|
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb"',today)
|
||||||
.joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id")
|
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
|
||||||
.sum("payment_amount")
|
.sum("sp.payment_amount")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -953,6 +953,99 @@ end
|
|||||||
.sum("payment_amount")
|
.sum("payment_amount")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.summary_sale_receipt(today)
|
||||||
|
query = Sale.select('count(sale_id) as total_receipt, sum(total_amount) as total_amount, sum(grand_total) as grand_total, sum(total_discount) as total_discount, sum(total_tax) as total_tax')
|
||||||
|
.where('sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today)
|
||||||
|
.first()
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.total_payment_methods(today)
|
||||||
|
query = Sale.select("sp.payment_method")
|
||||||
|
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ?',today)
|
||||||
|
.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.payment_sale(payment_method, today)
|
||||||
|
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
|
||||||
|
if payment_method == 'card'
|
||||||
|
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb"',today)
|
||||||
|
else
|
||||||
|
query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||||
|
end
|
||||||
|
query.sum("sp.payment_amount")
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.total_customer(today)
|
||||||
|
query = Sale.select("count(distinct sales.customer_id) as total_cus")
|
||||||
|
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ?',today)
|
||||||
|
.first()
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.total_dinein(today)
|
||||||
|
query = Sale.select("count(distinct sales.customer_id) as total_dinein_cus")
|
||||||
|
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||||
|
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and c.customer_type = "Dinein" and c.membership_id is null',today)
|
||||||
|
.first()
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.total_takeaway(today)
|
||||||
|
query = Sale.select("count(distinct sales.customer_id) as total_take_cus")
|
||||||
|
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||||
|
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and c.customer_type = "Takeaway" and c.membership_id is null',today)
|
||||||
|
.first()
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.total_membership(today)
|
||||||
|
query = Sale.select("count(distinct sales.customer_id) as total_memb_cus")
|
||||||
|
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||||
|
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and c.customer_type = "Takeaway" and c.membership_id is not null',today)
|
||||||
|
.first()
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.total_other_customer(today)
|
||||||
|
query = Sale.select("count(distinct sales.customer_id) as total_cus")
|
||||||
|
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||||
|
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and c.customer_type is null and c.membership_id is null',today)
|
||||||
|
.first()
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.total_order(today)
|
||||||
|
query = Sale.select("count(distinct a.order_id) as total_order")
|
||||||
|
.joins("JOIN sale_orders as a ON a.sale_id = sales.sale_id")
|
||||||
|
.joins("JOIN orders as b ON b.order_id = a.order_id")
|
||||||
|
.where('b.status = "billed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ?',today)
|
||||||
|
.first()
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.total_account(today)
|
||||||
|
query = Sale.select("distinct b.id as account_id, b.title as title")
|
||||||
|
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
|
.joins("JOIN accounts as b ON b.id = a.account_id")
|
||||||
|
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ?',today)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.account_data(account_id, today)
|
||||||
|
query = Sale.select("count(*) as cnt_acc, SUM(a.price) as total_acc")
|
||||||
|
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
|
.where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||||
|
.first()
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.top_items(today)
|
||||||
|
query = Sale.select("a.product_name as item_name, SUM(a.price) as item_total_price")
|
||||||
|
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
|
.where("sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||||
|
.group("a.product_code")
|
||||||
|
.order("SUM(a.price) DESC")
|
||||||
|
.first()
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.total_foc_items(today)
|
||||||
|
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
|
.where("sales.sale_status = 'completed' and a.remark='foc' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||||
|
.count()
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
|
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
<div class="col-xs-9 col-sm-9 col-md-9 col-lg-9">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@@ -102,13 +102,165 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
<div class="card">
|
<div class="row">
|
||||||
<div class="body">
|
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||||
|
<% if !@summ_sale.nil? %>
|
||||||
|
<div class="card">
|
||||||
|
<div class="body">
|
||||||
|
<h6>Sale</h6>
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<td>Total Receipt : </td>
|
||||||
|
<td><%= @summ_sale.total_receipt %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Total Sale : </td>
|
||||||
|
<td><%= @summ_sale.total_amount %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Total Discount : </td>
|
||||||
|
<td><%= @summ_sale.total_discount %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Tax (Services+Commercial) : </td>
|
||||||
|
<td><%= @summ_sale.total_tax %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Grand Total : </td>
|
||||||
|
<td><%= @summ_sale.grand_total %></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table class="table">
|
||||||
|
<% if !(@total_payment_methods.nil?) %>
|
||||||
|
<% @total_payment_methods.each do |payment| %>
|
||||||
|
<% if !@sale_data[0].empty? %>
|
||||||
|
<% if payment.payment_method == 'mpu' || payment.payment_method == 'visa' || payment.payment_method == 'master' || payment.payment_method == 'jcb' %>
|
||||||
|
<tr>
|
||||||
|
<td>Card Sale : </td>
|
||||||
|
<td><%= @sale_data[0]['card'] %></td>
|
||||||
|
</tr>
|
||||||
|
<% else %>
|
||||||
|
<tr>
|
||||||
|
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
|
||||||
|
<td>
|
||||||
|
<% @sale_data.each do |data| %>
|
||||||
|
<% pay_mth = payment.payment_method %>
|
||||||
|
<%= data[""+pay_mth+""] %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="body">
|
||||||
|
<h6>Customer</h6>
|
||||||
|
<table class="table">
|
||||||
|
<% if !@total_customer.nil? %>
|
||||||
|
<% if @total_customer.total_cus > 0 %>
|
||||||
|
<tr>
|
||||||
|
<td>Total Customer : </td>
|
||||||
|
<td><%= @total_customer.total_cus %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% if !@total_dinein.nil? %>
|
||||||
|
<% if @total_dinein.total_dinein_cus > 0 %>
|
||||||
|
<tr>
|
||||||
|
<td>Dine in : </td>
|
||||||
|
<td><%= @total_dinein.total_dinein_cus %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% if !@total_takeaway.nil? %>
|
||||||
|
<% if @total_takeaway.total_take_cus > 0 %>
|
||||||
|
<tr>
|
||||||
|
<td>Takeaway : </td>
|
||||||
|
<td><%= @total_takeaway.total_take_cus %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% if !@total_other_customer.nil? %>
|
||||||
|
<% if @total_other_customer.total_cus > 0 %>
|
||||||
|
<tr>
|
||||||
|
<td>Customer : </td>
|
||||||
|
<td><%= @total_other_customer.total_cus %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% if !@total_membership.nil? %>
|
||||||
|
<% if @total_membership.total_memb_cus > 0 %>
|
||||||
|
<tr>
|
||||||
|
<td>Membership : </td>
|
||||||
|
<td><%= @total_membership.total_memb_cus %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="body">
|
||||||
|
<h6>Order</h6>
|
||||||
|
<table class="table">
|
||||||
|
<% if !@total_order.nil? %>
|
||||||
|
<% if @total_order.total_order > 0 %>
|
||||||
|
<tr>
|
||||||
|
<td>Total Order : </td>
|
||||||
|
<td><%= @total_order.total_order %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if !(@total_accounts.nil?) %>
|
||||||
|
<% @total_accounts.each do |account| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= account.title %> (Account) : </td>
|
||||||
|
<td>
|
||||||
|
<% @account_data.each do |data| %>
|
||||||
|
<% acc = account.title %>
|
||||||
|
<%= data[""+acc+""] %> <% if !data[''+acc+''].nil? %> ( <%= data[''+acc+'_amount'] %> ) <% end %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% if !@top_items.nil? %>
|
||||||
|
<tr>
|
||||||
|
<td>Top Item : </td>
|
||||||
|
<td><%= @top_items.item_name %> ( <%= @top_items.item_total_price %> )</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% if !@total_foc_items.nil? %>
|
||||||
|
<% if @total_foc_items > 0 %>
|
||||||
|
<tr>
|
||||||
|
<td>Total FOC Item : </td>
|
||||||
|
<td><%= @total_foc_items %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -48,17 +48,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="card tables blue text-white" data-id="<%= table.id %>">
|
<% if table.get_checkout_booking.nil? %>
|
||||||
<div class="card-block">
|
<div class="card tables blue text-white" data-id="<%= table.id %>">
|
||||||
|
<% else %>
|
||||||
|
<div class="card tables orange text-white" data-id="<%= table.id %>">
|
||||||
|
<% end %>
|
||||||
|
<div class="card-block">
|
||||||
Zone <%= table.zone_id %> <br>
|
Zone <%= table.zone_id %> <br>
|
||||||
Table <%= table.name %> ( <%= table.seater %> Seat )
|
Table <%= table.name %> ( <%= table.seater %> Seat )
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= table.get_booking %>
|
|
||||||
Zone <%= table.zone_id %> <br>
|
Zone <%= table.zone_id %> <br>
|
||||||
Table <%= table.name %> ( <%= table.seater %> Seat )
|
Table <%= table.name %> ( <%= table.seater %> Seat )
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,16 +5,16 @@
|
|||||||
<!-- Nav tabs -->
|
<!-- Nav tabs -->
|
||||||
<ul class="nav nav-tabs tab-col-teal" role="tablist">
|
<ul class="nav nav-tabs tab-col-teal" role="tablist">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">Completed</a>
|
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab"><%= t :tables %></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab"><%= t :rooms %></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
<a class="nav-link" data-toggle="tab" href="#orders" role="tab"><%= t :orders %></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- Nav tabs - End -->
|
<!-- Nav tabs - End -->
|
||||||
@@ -37,9 +37,8 @@
|
|||||||
<!--- Panel 1 - Table Orders -->
|
<!--- Panel 1 - Table Orders -->
|
||||||
<div class="tab-pane dining active " id="tables" role="tabpanel">
|
<div class="tab-pane dining active " id="tables" role="tabpanel">
|
||||||
<div class="card-columns">
|
<div class="card-columns">
|
||||||
<% @tables.each do |table| %>
|
<% @tables.each do |table| %>
|
||||||
<% if table.status == 'occupied' %>
|
<% if table.status == 'occupied' %>
|
||||||
|
|
||||||
<% if table.get_booking.nil? %>
|
<% if table.get_booking.nil? %>
|
||||||
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
@@ -49,12 +48,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
<% if table.get_checkout_booking.nil? %>
|
||||||
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||||
<div class="card-block">
|
<% else %>
|
||||||
<%= table.name %>
|
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||||
<span class="pull-right font-12 new_text_<%= table.id %>"> new</span>
|
<% end %>
|
||||||
</div>
|
<div class="card-block">
|
||||||
|
<%= table.name %>
|
||||||
|
<span class="pull-right font-12 new_text_<%= table.id %>"> new</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||||
@@ -119,7 +122,11 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||||
|
<% if !@obj_order.nil? %>
|
||||||
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
|
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
|
||||||
|
<% else %>
|
||||||
|
<div id="save_order_id" data-order="">
|
||||||
|
<% end %>
|
||||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||||
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||||
</div>
|
</div>
|
||||||
@@ -132,29 +139,38 @@
|
|||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="card-title">
|
<div class="card-title">
|
||||||
<div class="row p-l-5 p-r-5">
|
<div class="row p-l-5 p-r-5">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<% if (!@sale_array.empty?) && (!@date.nil?) %>
|
||||||
Receipt No: <span id="receipt_no">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
<% if @status_sale == 'sale' %>
|
Receipt No: <span id="receipt_no">
|
||||||
<%= @sale_array[0].receipt_no rescue '' %>
|
<% if @status_sale == 'sale' %>
|
||||||
|
<%= @sale_array[0].receipt_no rescue '' %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
<br>
|
<br>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span>
|
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span>
|
||||||
<br>
|
<br>
|
||||||
</div>
|
</div>
|
||||||
|
<% elsif !@date.nil? %>
|
||||||
|
<div class="col-lg-12 col-md-12 col-sm-12 text-right">
|
||||||
|
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="row p-l-5 p-r-5">
|
<div class="row p-l-5 p-r-5">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
<% if @status_sale == 'sale' %>
|
<% if !@sale_array.empty? %>
|
||||||
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
|
<% if @status_sale == 'sale' %>
|
||||||
Customer : <%= @sale_array[0].customer.name rescue '' %>
|
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
|
||||||
<% else %>
|
Customer : <%= @sale_array[0].customer.name rescue '' %>
|
||||||
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
|
<% else %>
|
||||||
Customer : <%= @customer.name rescue "" %>
|
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
|
||||||
<% end %>
|
Customer : <%= @customer.name rescue "" %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -328,10 +344,10 @@
|
|||||||
|
|
||||||
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||||
<i class="material-icons">reply</i>
|
<i class="material-icons">reply</i>
|
||||||
Back
|
<%= t("views.btn.back") %>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect">Add Order</button>
|
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
|
||||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect">Survey</button>
|
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
||||||
<% if @dining.status != "available" %>
|
<% if @dining.status != "available" %>
|
||||||
<% if @status_order == 'order' %>
|
<% if @status_order == 'order' %>
|
||||||
<!-- <button type="button" id="customer" class="btn btn-block bg-blue waves-effect" disabled>Customer</button> -->
|
<!-- <button type="button" id="customer" class="btn btn-block bg-blue waves-effect" disabled>Customer</button> -->
|
||||||
@@ -360,6 +376,8 @@
|
|||||||
<!-- Cashier Buttons -->
|
<!-- Cashier Buttons -->
|
||||||
|
|
||||||
<!-- <button type="button" id="re-print" class="btn btn-block bg-blue waves-effect" >Re.Print</button> -->
|
<!-- <button type="button" id="re-print" class="btn btn-block bg-blue waves-effect" >Re.Print</button> -->
|
||||||
|
<% else %>
|
||||||
|
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -628,7 +646,24 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#add_order').on('click', function () {
|
$('#add_order').on('click', function () {
|
||||||
var dining_id = "<%= @dining.id %>"
|
var dining_id = "<%= @dining.id %>";
|
||||||
window.location.href = '/origami/addorders/' + dining_id;
|
window.location.href = '/origami/addorders/' + dining_id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* check in process */
|
||||||
|
$('#check_in').on('click',function(){
|
||||||
|
var dining_id = "<%= @dining.id %>";
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
data: {dining_id : dining_id},
|
||||||
|
datatype: 'JSON',
|
||||||
|
url: '/origami/check_in',
|
||||||
|
success: function(data) {
|
||||||
|
if(data.status == 'ok'){
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ en:
|
|||||||
new_inventory_product: "NEW INVENTORY PRODUCT"
|
new_inventory_product: "NEW INVENTORY PRODUCT"
|
||||||
generate_report: "GENERATE REPORT"
|
generate_report: "GENERATE REPORT"
|
||||||
exp_to_excel: "EXPORT TO EXCEL"
|
exp_to_excel: "EXPORT TO EXCEL"
|
||||||
|
check_in: "Check In"
|
||||||
|
|
||||||
pagination:
|
pagination:
|
||||||
first: "« First"
|
first: "« First"
|
||||||
|
|||||||
@@ -65,10 +65,12 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
post "payment/:payment_method" => "payment#create"
|
post "payment/:payment_method" => "payment#create"
|
||||||
put "payment/:id" => "payment#update"
|
put "payment/:id" => "payment#update"
|
||||||
resources :receipt, only: [:create, :show] #generate receipt, show receipt
|
resources :receipt, only: [:create, :show] #generate receipt, show receipt
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
namespace :origami do
|
||||||
|
post "check_in/:dining_id" => "check_in_process#check_in_process"
|
||||||
|
post "request_time" => "check_in_process#request_time"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#--------- Cashier ------------#
|
#--------- Cashier ------------#
|
||||||
@@ -199,7 +201,8 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
post 'select_sale_item' => 'product_commissions#select_sale_item', as: 'select_sale_item'
|
post 'select_sale_item' => 'product_commissions#select_sale_item', as: 'select_sale_item'
|
||||||
post 'select_commissioner' => 'product_commissions#set_commissioner_to_sale_item', as: 'select_commissioner'
|
post 'select_commissioner' => 'product_commissions#set_commissioner_to_sale_item', as: 'select_commissioner'
|
||||||
|
|
||||||
|
#check_in
|
||||||
|
post '/check_in' => "check_in_process#check_in_process"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
5
spec/controllers/api/check_in_process_controller_spec.rb
Normal file
5
spec/controllers/api/check_in_process_controller_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Api::CheckInProcessController, type: :controller do
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Origami::CheckInProcessController, type: :controller do
|
||||||
|
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user