remove con္ူငခအဓ
This commit is contained in:
@@ -82,7 +82,15 @@ $(document).ready(function() {
|
|||||||
touchScrollStep : 45
|
touchScrollStep : 45
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#pending-order-slimscroll').slimScroll({
|
||||||
|
height: height-$('#pending-order-slimscroll').attr('data-height'),
|
||||||
|
size: '5px',
|
||||||
|
color: 'rgba(0,0,0,0.5)',
|
||||||
|
alwaysVisible: false,
|
||||||
|
borderRadius: '0',
|
||||||
|
railBorderRadius: '0',
|
||||||
|
touchScrollStep : 50
|
||||||
|
});
|
||||||
// $('.delete').click(function(){
|
// $('.delete').click(function(){
|
||||||
// var method = $(this).attr('data-method');
|
// var method = $(this).attr('data-method');
|
||||||
// var url = $(this).attr('data-ref');
|
// var url = $(this).attr('data-ref');
|
||||||
|
|||||||
@@ -520,3 +520,8 @@ nav.pagination .page a:hover,
|
|||||||
filter: alpha(opacity=100); /* ie */
|
filter: alpha(opacity=100); /* ie */
|
||||||
-moz-opacity: 1; /* mozilla */
|
-moz-opacity: 1; /* mozilla */
|
||||||
}
|
}
|
||||||
|
.existing_invoice{
|
||||||
|
background-color:#ffab51;
|
||||||
|
color:#fff;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -246,6 +246,7 @@ class Ability
|
|||||||
|
|
||||||
can :move_dining, :moveroom
|
can :move_dining, :moveroom
|
||||||
|
|
||||||
|
can :manage, Sale
|
||||||
can :manage, Customer
|
can :manage, Customer
|
||||||
can :manage, DiningQueue
|
can :manage, DiningQueue
|
||||||
|
|
||||||
|
|||||||
@@ -1361,7 +1361,7 @@ end
|
|||||||
.order("SUM(i.qty) ASC").limit(20)
|
.order("SUM(i.qty) ASC").limit(20)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," +
|
query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," +
|
||||||
" i.price as unit_price,mi.name as product_name")
|
" i.price as unit_price,mi.name as product_name")
|
||||||
.joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code")
|
.joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code")
|
||||||
@@ -1416,7 +1416,7 @@ end
|
|||||||
query = query.order("SUM(i.qty) ASC").limit(20)
|
query = query.order("SUM(i.qty) ASC").limit(20)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," +
|
query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," +
|
||||||
" i.price as unit_price,mi.name as product_name")
|
" i.price as unit_price,mi.name as product_name")
|
||||||
.joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code")
|
.joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code")
|
||||||
@@ -1460,7 +1460,7 @@ end
|
|||||||
query = query.group("date_format(CONVERT_TZ(receipt_date,'+00:00', 'SYSTEM'), '%I %p')")
|
query = query.group("date_format(CONVERT_TZ(receipt_date,'+00:00', 'SYSTEM'), '%I %p')")
|
||||||
.order('receipt_date')
|
.order('receipt_date')
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("grand_total")
|
query = Sale.select("grand_total")
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
query = query.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time)
|
query = query.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time)
|
||||||
@@ -1490,7 +1490,7 @@ end
|
|||||||
.group("date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')")
|
.group("date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')")
|
||||||
.order('receipt_date')
|
.order('receipt_date')
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("grand_total")
|
query = Sale.select("grand_total")
|
||||||
.where('sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today)
|
.where('sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today)
|
||||||
.group("date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')")
|
.group("date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')")
|
||||||
@@ -1521,7 +1521,7 @@ end
|
|||||||
query = query.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay' or sp.payment_method='giftvoucher') THEN 'card' ELSE sp.payment_method END)","e.name")
|
query = query.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay' or sp.payment_method='giftvoucher') THEN 'card' ELSE sp.payment_method END)","e.name")
|
||||||
.order("e.name")
|
.order("e.name")
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id")
|
query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id")
|
||||||
.joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id")
|
.joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id")
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
@@ -1554,7 +1554,7 @@ end
|
|||||||
.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay' or sp.payment_method='giftvoucher') THEN 'card' ELSE sp.payment_method END)","e.name")
|
.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay' or sp.payment_method='alipay' or sp.payment_method='paymal' or sp.payment_method='dinga' or sp.payment_method='JunctionPay' or sp.payment_method='giftvoucher') THEN 'card' ELSE sp.payment_method END)","e.name")
|
||||||
.order("e.name")
|
.order("e.name")
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id")
|
query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id")
|
||||||
.joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id")
|
.joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id")
|
||||||
.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = '#{today}'")
|
.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = '#{today}'")
|
||||||
@@ -1583,7 +1583,7 @@ end
|
|||||||
total = Sale.select("SUM(grand_total) as total_sale, COUNT(sales.sale_id) as total_count").where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to)
|
total = Sale.select("SUM(grand_total) as total_sale, COUNT(sales.sale_id) as total_count").where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
total = Sale.select("SUM(grand_total) as total_sale, COUNT(sales.sale_id) as total_count").where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ?',from,to,from_time,to_time)
|
total = Sale.select("SUM(grand_total) as total_sale, COUNT(sales.sale_id) as total_count").where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ?',from,to,from_time,to_time)
|
||||||
else
|
else
|
||||||
@@ -1604,7 +1604,7 @@ end
|
|||||||
if current_user.nil?
|
if current_user.nil?
|
||||||
total = Sale.select("SUM(grand_total) as total_sale, COUNT(sales.sale_id) as total_count").where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',today,today)
|
total = Sale.select("SUM(grand_total) as total_sale, COUNT(sales.sale_id) as total_count").where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',today,today)
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
total = Sale.select("SUM(grand_total) as total_sale, COUNT(sales.sale_id) as total_count").where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',today,today)
|
total = Sale.select("SUM(grand_total) as total_sale, COUNT(sales.sale_id) as total_count").where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',today,today)
|
||||||
else
|
else
|
||||||
shift = ShiftSale.current_open_shift(current_user.id)
|
shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
@@ -1629,7 +1629,7 @@ end
|
|||||||
.sum("sp.payment_amount")
|
.sum("sp.payment_amount")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',from,to,from_time,to_time)
|
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',from,to,from_time,to_time)
|
||||||
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
|
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
|
||||||
@@ -1660,7 +1660,7 @@ end
|
|||||||
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
|
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
|
||||||
.sum("sp.payment_amount")
|
.sum("sp.payment_amount")
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',today,today)
|
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")',today,today)
|
||||||
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
|
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
|
||||||
.sum("sp.payment_amount")
|
.sum("sp.payment_amount")
|
||||||
@@ -1689,7 +1689,7 @@ end
|
|||||||
.sum("payment_amount")
|
.sum("payment_amount")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ?',from,to,from_time,to_time)
|
query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ?',from,to,from_time,to_time)
|
||||||
.joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id")
|
.joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id")
|
||||||
@@ -1720,7 +1720,7 @@ end
|
|||||||
.joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id")
|
.joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id")
|
||||||
.sum("payment_amount")
|
.sum("payment_amount")
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',today,today)
|
query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',today,today)
|
||||||
.joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id")
|
.joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id")
|
||||||
.sum("payment_amount")
|
.sum("payment_amount")
|
||||||
@@ -1749,7 +1749,7 @@ end
|
|||||||
.first()
|
.first()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax')
|
query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax')
|
||||||
.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ?',from,to,from_time,to_time)
|
.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%i") between ? and ?',from,to,from_time,to_time)
|
||||||
@@ -1780,7 +1780,7 @@ end
|
|||||||
.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ?',today)
|
.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ?',today)
|
||||||
.first()
|
.first()
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax')
|
query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax')
|
||||||
.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ?',today)
|
.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ?',today)
|
||||||
.first()
|
.first()
|
||||||
@@ -1809,7 +1809,7 @@ end
|
|||||||
.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
|
.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
query = Sale.select("distinct sp.payment_method")
|
query = Sale.select("distinct sp.payment_method")
|
||||||
.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%i") between ? and ?',from,to,from_time,to_time)
|
.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%i") between ? and ?',from,to,from_time,to_time)
|
||||||
@@ -1840,7 +1840,7 @@ end
|
|||||||
.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ?',today)
|
.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ?',today)
|
||||||
.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
|
.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("distinct sp.payment_method")
|
query = Sale.select("distinct sp.payment_method")
|
||||||
.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ?',today)
|
.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ?',today)
|
||||||
.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
|
.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
|
||||||
@@ -1881,7 +1881,7 @@ end
|
|||||||
query.select("(CASE WHEN sp.payment_method='cash' THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE SUM(sp.payment_amount) END) as payment_amount").first()
|
query.select("(CASE WHEN sp.payment_method='cash' THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE SUM(sp.payment_amount) END) as payment_amount").first()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
|
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
|
||||||
if payment_method == 'card'
|
if payment_method == 'card'
|
||||||
@@ -1994,7 +1994,7 @@ end
|
|||||||
.first()
|
.first()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
query = Sale.select("(CASE WHEN c.customer_type='Dinein' THEN count(sales.customer_id) ELSE 0 END) as total_dinein_cus, (CASE WHEN c.customer_type='Takeaway' THEN count(sales.customer_id) ELSE 0 END) as total_take_cus")
|
query = Sale.select("(CASE WHEN c.customer_type='Dinein' THEN count(sales.customer_id) ELSE 0 END) as total_dinein_cus, (CASE WHEN c.customer_type='Takeaway' THEN count(sales.customer_id) ELSE 0 END) as total_take_cus")
|
||||||
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||||
@@ -2063,7 +2063,7 @@ end
|
|||||||
.first()
|
.first()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
query = Sale.select("count(distinct sales.customer_id) as total_memb_cus")
|
query = Sale.select("count(distinct sales.customer_id) as total_memb_cus")
|
||||||
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||||
@@ -2095,7 +2095,7 @@ end
|
|||||||
.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null))',today)
|
.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null))',today)
|
||||||
.first()
|
.first()
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("count(distinct sales.customer_id) as total_memb_cus")
|
query = Sale.select("count(distinct sales.customer_id) as total_memb_cus")
|
||||||
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||||
.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null))',today)
|
.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null))',today)
|
||||||
@@ -2126,7 +2126,7 @@ end
|
|||||||
# .first()
|
# .first()
|
||||||
# end
|
# end
|
||||||
# else
|
# else
|
||||||
# if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
# if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
# query = Sale.select("count(sales.customer_id) as total_cus")
|
# query = Sale.select("count(sales.customer_id) as total_cus")
|
||||||
# .joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
# .joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||||
# if !from_time.nil? && !to_time.nil?
|
# if !from_time.nil? && !to_time.nil?
|
||||||
@@ -2158,7 +2158,7 @@ end
|
|||||||
# .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ? and c.customer_type is null and c.membership_id is null',today)
|
# .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ? and c.customer_type is null and c.membership_id is null',today)
|
||||||
# .first()
|
# .first()
|
||||||
# else
|
# else
|
||||||
# if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
# if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
# query = Sale.select("count(sales.customer_id) as total_cus")
|
# query = Sale.select("count(sales.customer_id) as total_cus")
|
||||||
# .joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
# .joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||||
# .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ? and c.customer_type is null and c.membership_id is null',today)
|
# .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ? and c.customer_type is null and c.membership_id is null',today)
|
||||||
@@ -2190,7 +2190,7 @@ end
|
|||||||
.first()
|
.first()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("count(distinct a.order_id) as total_order")
|
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 sale_orders as a ON a.sale_id = sales.sale_id")
|
||||||
.joins("JOIN orders as b ON b.order_id = a.order_id")
|
.joins("JOIN orders as b ON b.order_id = a.order_id")
|
||||||
@@ -2225,7 +2225,7 @@ end
|
|||||||
.where('b.status = "billed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ?',today)
|
.where('b.status = "billed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ?',today)
|
||||||
.first()
|
.first()
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("count(distinct a.order_id) as total_order")
|
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 sale_orders as a ON a.sale_id = sales.sale_id")
|
||||||
.joins("JOIN orders as b ON b.order_id = a.order_id")
|
.joins("JOIN orders as b ON b.order_id = a.order_id")
|
||||||
@@ -2257,7 +2257,7 @@ end
|
|||||||
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to)
|
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("distinct b.id as account_id, b.title as title")
|
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 sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
.joins("JOIN accounts as b ON b.id = a.account_id")
|
.joins("JOIN accounts as b ON b.id = a.account_id")
|
||||||
@@ -2287,7 +2287,7 @@ end
|
|||||||
.joins("JOIN accounts as b ON b.id = a.account_id")
|
.joins("JOIN accounts as b ON b.id = a.account_id")
|
||||||
.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ?',today)
|
.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") = ?',today)
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("distinct b.id as account_id, b.title as title")
|
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 sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
.joins("JOIN accounts as b ON b.id = a.account_id")
|
.joins("JOIN accounts as b ON b.id = a.account_id")
|
||||||
@@ -2318,7 +2318,7 @@ end
|
|||||||
.first()
|
.first()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("count(*) as cnt_acc, SUM(a.price) as total_acc")
|
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")
|
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
@@ -2350,7 +2350,7 @@ end
|
|||||||
.where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
.where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||||
.first()
|
.first()
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("count(*) as cnt_acc, SUM(a.price) as total_acc")
|
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")
|
.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)
|
.where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||||
@@ -2382,7 +2382,7 @@ end
|
|||||||
.order("SUM(a.qty) DESC")
|
.order("SUM(a.qty) DESC")
|
||||||
.first()
|
.first()
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("a.product_name as item_name, SUM(a.price) as item_total_price")
|
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")
|
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
@@ -2418,7 +2418,7 @@ end
|
|||||||
.order("SUM(a.qty) DESC")
|
.order("SUM(a.qty) DESC")
|
||||||
.first()
|
.first()
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.select("a.product_name as item_name, SUM(a.price) as item_total_price")
|
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")
|
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
.where("(a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
.where("(a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||||
@@ -2452,7 +2452,7 @@ end
|
|||||||
.count()
|
.count()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
if !from_time.nil? && !to_time.nil?
|
if !from_time.nil? && !to_time.nil?
|
||||||
query = query.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%i') between ? and ?",from,to,from_time,to_time)
|
query = query.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%i') between ? and ?",from,to,from_time,to_time)
|
||||||
@@ -2481,7 +2481,7 @@ end
|
|||||||
.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||||
.count()
|
.count()
|
||||||
else
|
else
|
||||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account'
|
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||||
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||||
.count()
|
.count()
|
||||||
|
|||||||
@@ -53,11 +53,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= table.name %>
|
<%= table.name %>
|
||||||
<!-- <% if !@order_items_count.nil? %>
|
|
||||||
<% if @order_items_count.key?(table.id) %>
|
|
||||||
(Orders : <%= @order_items_count[table.id] %>)
|
|
||||||
<% end %>
|
|
||||||
<% end %> -->
|
|
||||||
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
|
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
|
||||||
<div style="font-size:12px;"></div>
|
<div style="font-size:12px;"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -70,11 +65,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= table.name %>
|
<%= table.name %>
|
||||||
<!-- <% if !@order_items_count.nil? %>
|
|
||||||
<% if @order_items_count.key?(table.id) %>
|
|
||||||
(Orders : <%= @order_items_count[table.id] %>)
|
|
||||||
<% end %>
|
|
||||||
<% end %> -->
|
|
||||||
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
|
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -104,11 +94,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= room.name %>
|
<%= room.name %>
|
||||||
<!-- <% if !@order_items_count.nil? %>
|
|
||||||
<% if @order_items_count.key?(room.id) %>
|
|
||||||
(Orders : <%= @order_items_count[room.id] %>)
|
|
||||||
<% end %>
|
|
||||||
<% end %> -->
|
|
||||||
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
|
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -120,11 +105,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= room.name %>
|
<%= room.name %>
|
||||||
<!-- <% if !@order_items_count.nil? %>
|
|
||||||
<% if @order_items_count.key?(room.id) %>
|
|
||||||
(Orders : <%= @order_items_count[room.id] %>)
|
|
||||||
<% end %>
|
|
||||||
<% end %> -->
|
|
||||||
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
|
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -147,22 +127,22 @@
|
|||||||
<% @orders.each do |order| %>
|
<% @orders.each do |order| %>
|
||||||
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
|
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%
|
<% order_status = "" %>
|
||||||
order_status = ""
|
<% sale_order = order.sale_orders.first %>
|
||||||
sale_order = order.sale_orders.first
|
<% if sale_order %>
|
||||||
if sale_order
|
<% unless sale_order.sale_id.nil? %>
|
||||||
unless sale_order.sale_id.nil?
|
<% sale = Sale.find(sale_order.sale_id) %>
|
||||||
sale = Sale.find(sale_order.sale_id)
|
<% order_status = sale.sale_status %>
|
||||||
order_status = sale.sale_status
|
<% if order_status == 'new' %>
|
||||||
if order_status == 'new'
|
<% order_status = order.status %>
|
||||||
order_status = order.status
|
<% end %>
|
||||||
end
|
<% end %>
|
||||||
end
|
<% else %>
|
||||||
else
|
<% order_status = order.status %>
|
||||||
order_status = order.status
|
<% end %>
|
||||||
end
|
<%= order.order_id %>
|
||||||
%>
|
<% if !order_status.empty? %>| <%= order_status %>
|
||||||
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -211,7 +191,13 @@
|
|||||||
<!-- Column Two -->
|
<!-- Column Two -->
|
||||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<% existing_class = "" %><% existing_order = false %>
|
||||||
|
<% if @status_sale == 'sale' && (!@order_items.nil?) %>
|
||||||
|
<% existing_class = "existing_invoice"%>
|
||||||
|
<% existing_order = true %>
|
||||||
|
<% tooltip = ' data-toggle=modal title=Add_To_Existing data-target=#invoiceModal'%>
|
||||||
|
<%end%>
|
||||||
|
<div class="card-header <%= existing_class %>" <%= tooltip %>>
|
||||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||||
<% if !@obj_order.nil? %>
|
<% 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 %>">
|
||||||
@@ -259,7 +245,6 @@
|
|||||||
Order No: <span id="order_no">
|
Order No: <span id="order_no">
|
||||||
<% if @status_order == 'order' %>
|
<% if @status_order == 'order' %>
|
||||||
<%= @obj_order.order_id rescue '' %>
|
<%= @obj_order.order_id rescue '' %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
<br>
|
<br>
|
||||||
@@ -272,7 +257,6 @@
|
|||||||
</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 @status_sale == 'sale' %>
|
||||||
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
|
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
|
||||||
Customer : <%= @sale_array[0].customer.name rescue '' %>
|
Customer : <%= @sale_array[0].customer.name rescue '' %>
|
||||||
@@ -281,7 +265,6 @@
|
|||||||
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
|
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
|
||||||
Customer : <%= @customer.name rescue "" %>
|
Customer : <%= @customer.name rescue "" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -290,73 +273,54 @@
|
|||||||
<table class="table table-striped" id="order-items-table">
|
<table class="table table-striped" id="order-items-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<th>#</th>
|
<th>#</th>
|
||||||
<th class="item-name">Items</th>
|
<th class="item-name">Items</th>
|
||||||
<th class="item-attr">QTY
|
<th class="item-attr">QTY</th>
|
||||||
</th>
|
<th class="item-attr">Price</th>
|
||||||
<th class="item-attr">Price
|
|
||||||
</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<%
|
<% count = 0
|
||||||
count = 0
|
|
||||||
sub_total = 0
|
sub_total = 0
|
||||||
if @status_sale == "sale"
|
if @status_sale == "sale"
|
||||||
@sale_array[0].sale_items.each do |sale_item|
|
@sale_array[0].sale_items.each do |sale_item|
|
||||||
|
sub_total = sub_total + sale_item.price%>
|
||||||
sub_total = sub_total + sale_item.price
|
|
||||||
%>
|
|
||||||
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
||||||
<%
|
<%count += 1 %>
|
||||||
# Can't check for discount
|
|
||||||
# unless sale_item.price == 0
|
|
||||||
count += 1
|
|
||||||
%>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= count %></td>
|
<td><%= count %></td>
|
||||||
<td class='item-name'><%= sale_item.product_name %></td>
|
<td class='item-name'><%= sale_item.product_name %></td>
|
||||||
<td class='item-attr'><%= sale_item.qty %></td>
|
<td class='item-attr'><%= sale_item.qty %></td>
|
||||||
<td class='item-attr'><%= sale_item.price %></td>
|
<td class='item-attr'><%= sale_item.price %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<%end %>
|
||||||
<%
|
<% end %>
|
||||||
end
|
<% if @status_order == 'order' && @status_sale != 'sale'
|
||||||
end
|
|
||||||
|
|
||||||
if @status_order == 'order' && @status_sale != 'sale'
|
|
||||||
puts
|
|
||||||
unless @order_items.nil? || @order_items.empty?
|
unless @order_items.nil? || @order_items.empty?
|
||||||
count = 0
|
count = 0
|
||||||
@order_items.each do |order_item|
|
@order_items.each do |order_item|
|
||||||
set_item_prices = 0
|
set_item_prices = 0
|
||||||
count += 1
|
count += 1
|
||||||
sub_total = sub_total + (order_item.price * order_item.qty)
|
sub_total = sub_total + (order_item.price * order_item.qty)
|
||||||
|
|
||||||
# unless order_item.price == 0 %>
|
# unless order_item.price == 0 %>
|
||||||
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
|
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
|
||||||
<td><%= count %></td>
|
<td><%= count %></td>
|
||||||
<td class='item-name'>
|
<td class='item-name'><%= order_item.item_name %>
|
||||||
<%= order_item.item_name %>
|
|
||||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||||
<% JSON.parse(order_item.options).each do |option| %>
|
<% JSON.parse(order_item.options).each do |option| %>
|
||||||
<br><span class="font-13">
|
<br><span class="font-13"><%= option %></span>
|
||||||
<%= option %>
|
|
||||||
</span>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]'
|
<% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]'
|
||||||
JSON.parse(order_item.set_menu_items).each do |item_instance|
|
JSON.parse(order_item.set_menu_items).each do |item_instance|
|
||||||
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %>
|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %>
|
||||||
<br><span class="font-13">
|
<br>
|
||||||
|
<span class="font-13">
|
||||||
<%= item_instance["item_instance_name"] %>
|
<%= item_instance["item_instance_name"] %>
|
||||||
<% if !item_instance["options"].nil? && !item_instance["options"].empty? %>
|
<% if !item_instance["options"].nil? && !item_instance["options"].empty? %>
|
||||||
<% (item_instance["options"]).each do |set_item_option| %>
|
<% (item_instance["options"]).each do |set_item_option| %>
|
||||||
<br><span class="font-13">
|
<br><span class="font-13"> <%= set_item_option %></span>
|
||||||
<%= set_item_option %>
|
|
||||||
</span>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
@@ -367,13 +331,9 @@
|
|||||||
<td class='item-attr'><%= order_item.qty %></td>
|
<td class='item-attr'><%= order_item.qty %></td>
|
||||||
<td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
|
<td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<% end %>
|
||||||
|
<% end %>
|
||||||
# end
|
<% end %>
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
%>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -427,18 +387,14 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%
|
<% if @status_sale == 'sale'
|
||||||
if @status_sale == 'sale'
|
unless @order_items.nil? || @order_items.empty?%>
|
||||||
unless @order_items.nil? || @order_items.empty?
|
<!-- Pending New Order
|
||||||
%>
|
|
||||||
Pending New Order
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<%
|
<% count = 0
|
||||||
count = 0
|
|
||||||
@order_items.each do |order_item|
|
@order_items.each do |order_item|
|
||||||
set_item_prices = 0
|
set_item_prices = 0
|
||||||
count += 1
|
count += 1 %>
|
||||||
%>
|
|
||||||
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
|
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
|
||||||
<td><%= count %>
|
<td><%= count %>
|
||||||
<td class='item-name'>
|
<td class='item-name'>
|
||||||
@@ -475,9 +431,9 @@
|
|||||||
<%
|
<%
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
</table>
|
</table> -->
|
||||||
|
|
||||||
<button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice</button>
|
<!-- <button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice</button> -->
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @sale_array.size > 1 %>
|
<% if @sale_array.size > 1 %>
|
||||||
<br><br>
|
<br><br>
|
||||||
@@ -487,7 +443,6 @@
|
|||||||
if @sale_array.size > 1
|
if @sale_array.size > 1
|
||||||
unless sale.receipt_no == @sale_array[0].receipt_no
|
unless sale.receipt_no == @sale_array[0].receipt_no
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Receipt No - <%= sale.receipt_no %></td>
|
<td>Receipt No - <%= sale.receipt_no %></td>
|
||||||
@@ -498,12 +453,10 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<%
|
<%end%>
|
||||||
end
|
<% end%>
|
||||||
end
|
<% end%>
|
||||||
end
|
<%end %>
|
||||||
end
|
|
||||||
%>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -568,12 +521,12 @@
|
|||||||
<!-- first bill not used in cloud -->
|
<!-- first bill not used in cloud -->
|
||||||
|
|
||||||
<%if @membership.discount && @obj_sale.customer.membership_id %>
|
<%if @membership.discount && @obj_sale.customer.membership_id %>
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
|
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal" data-order="<%= existing_order %>">First Bill</button>
|
||||||
<%else%>
|
<%else%>
|
||||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
<button type="button" id="first_bill" data-order="<%= existing_order %>" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|
||||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
<button type="button" id="pay" data-order="<%= existing_order %>" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||||
|
|
||||||
<!--<% if current_login_employee.role != "waiter" %>
|
<!--<% if current_login_employee.role != "waiter" %>
|
||||||
<button type="button" class="btn action-btn bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
|
<button type="button" class="btn action-btn bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
|
||||||
@@ -679,6 +632,84 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% if @status_sale == 'sale' && (!@order_items.nil?) %>
|
||||||
|
<div class="modal fade" id="invoiceModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="invoiceModalLabel">Pending New Order</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="card">
|
||||||
|
<div id="pending-order-slimscroll" data-height="160">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th class="item-name">Items</th>
|
||||||
|
<th class="item-attr">QTY</th>
|
||||||
|
<th class="item-attr">Price</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% count = 0
|
||||||
|
@order_items.each do |order_item|
|
||||||
|
set_item_prices = 0
|
||||||
|
count += 1 %>
|
||||||
|
|
||||||
|
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
|
||||||
|
<td><%= count %></td>
|
||||||
|
<td class='item-name'>
|
||||||
|
<%= order_item.item_name %>
|
||||||
|
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||||
|
<% JSON.parse(order_item.options).each do |option| %>
|
||||||
|
<br><span class="font-13">
|
||||||
|
<%= option %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if !order_item.set_menu_items.nil?
|
||||||
|
JSON.parse(order_item.set_menu_items).each do |item_instance|
|
||||||
|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
|
||||||
|
%>
|
||||||
|
<br><span class="font-13">
|
||||||
|
<%= item_instance["item_instance_name"] %>
|
||||||
|
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
|
||||||
|
<% (item_instance["options"]).each do |set_item_option| %>
|
||||||
|
<br><span class="font-13">
|
||||||
|
<%= set_item_option %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<% end
|
||||||
|
sub_total += set_item_prices
|
||||||
|
end %>
|
||||||
|
</td>
|
||||||
|
<td class='item-attr'><%= order_item.qty %></td>
|
||||||
|
<td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
|
||||||
|
</tr>
|
||||||
|
<%end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer ">
|
||||||
|
<div class="row p-r-20">
|
||||||
|
<div class="col-md-9">
|
||||||
|
<button class='btn btn-link bg-blue waves-effect' data-dismiss="modal" id='add_invoice'> Add to existing invoice</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%end%>
|
||||||
<!-- change tax modal -->
|
<!-- change tax modal -->
|
||||||
<div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog">
|
<div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog">
|
||||||
<div class="modal-dialog modal-md" role="document">
|
<div class="modal-dialog modal-md" role="document">
|
||||||
@@ -993,7 +1024,24 @@
|
|||||||
|
|
||||||
$('#pay').on('click', function () {
|
$('#pay').on('click', function () {
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
|
var data_order = $(this).data("order");
|
||||||
|
if (data_order) {
|
||||||
|
swal({
|
||||||
|
title: "Alert! This Receipt has another item",
|
||||||
|
text: "Are you sure want to pay this receipt !",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes, Pay it !",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
|
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Bill Request
|
// Bill Request
|
||||||
|
|||||||
Reference in New Issue
Block a user