Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_material_ui
This commit is contained in:
@@ -184,12 +184,16 @@ class Api::OrdersController < Api::ApiController
|
|||||||
#checked checkin and checkout time
|
#checked checkin and checkout time
|
||||||
def checkin_checkout_time(booking_id)
|
def checkin_checkout_time(booking_id)
|
||||||
status = true
|
status = true
|
||||||
today = Time.now.utc
|
if !params[:booking_id].nil?
|
||||||
booking = Booking.find(params[:booking_id])
|
today = Time.now.utc
|
||||||
if !booking.nil?
|
booking = Booking.find(params[:booking_id])
|
||||||
checkout_time = booking.checkout_at.utc
|
if !booking.nil?
|
||||||
if checkout_time <= today
|
if !booking.checkout_at.nil?
|
||||||
status = false
|
checkout_time = booking.checkout_at.utc
|
||||||
|
if checkout_time <= today
|
||||||
|
status = false
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return status
|
return status
|
||||||
|
|||||||
@@ -46,13 +46,13 @@ class Origami::JcbController < BaseOrigamiController
|
|||||||
shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
|
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
# if shop_details.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||||
rounding_adj = new_total-saleObj.grand_total
|
# rounding_adj = new_total-saleObj.grand_total
|
||||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
# saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||||
end
|
# end
|
||||||
|
|
||||||
saleObj = Sale.find(sale_id)
|
# saleObj = Sale.find(sale_id)
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "jcb")
|
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "jcb")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ class Origami::MasterController < BaseOrigamiController
|
|||||||
shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
|
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
# if shop_details.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||||
rounding_adj = new_total-saleObj.grand_total
|
# rounding_adj = new_total-saleObj.grand_total
|
||||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
# saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||||
end
|
# end
|
||||||
|
|
||||||
saleObj = Sale.find(sale_id)
|
# saleObj = Sale.find(sale_id)
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "master")
|
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "master")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ class Origami::MpuController < BaseOrigamiController
|
|||||||
shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
|
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
# if shop_details.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||||
rounding_adj = new_total-saleObj.grand_total
|
# rounding_adj = new_total-saleObj.grand_total
|
||||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
# saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||||
end
|
# end
|
||||||
|
|
||||||
saleObj = Sale.find(sale_id)
|
# saleObj = Sale.find(sale_id)
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "mpu")
|
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "mpu")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
# customer= Customer.where('customer_id=' +.customer_id)
|
# customer= Customer.where('customer_id=' +.customer_id)
|
||||||
customer = Customer.find(sale_data.customer_id)
|
customer = Customer.find(sale_data.customer_id)
|
||||||
|
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
if shop_details.is_rounding_adj
|
||||||
a = sale_data.grand_total % 25 # Modulus
|
a = sale_data.grand_total % 25 # Modulus
|
||||||
@@ -42,7 +41,6 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
#end rounding adjustment
|
#end rounding adjustment
|
||||||
|
|
||||||
# get member information
|
# get member information
|
||||||
rebate = MembershipSetting.find_by_rebate(1)
|
rebate = MembershipSetting.find_by_rebate(1)
|
||||||
if customer.membership_id != nil && rebate
|
if customer.membership_id != nil && rebate
|
||||||
@@ -74,7 +72,6 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
|
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
if shop_details.is_rounding_adj
|
||||||
a = saleObj.grand_total % 25 # Modulus
|
a = saleObj.grand_total % 25 # Modulus
|
||||||
@@ -167,12 +164,25 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
@table_no = ''
|
@table_no = ''
|
||||||
|
|
||||||
@shop = Shop::ShopDetail
|
@shop = Shop::ShopDetail
|
||||||
|
|
||||||
|
saleObj = Sale.find(sale_id)
|
||||||
|
# rounding adjustment
|
||||||
if @shop.is_rounding_adj
|
if @shop.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(@sale_data.grand_total)
|
a = saleObj.grand_total % 25 # Modulus
|
||||||
|
b = saleObj.grand_total / 25 # Division
|
||||||
|
#not calculate rounding if modulus is 0 and division is even
|
||||||
|
#calculate rounding if modulus is zero or not zero and division are not even
|
||||||
|
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||||
|
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||||
|
@rounding_adj = new_total-saleObj.grand_total
|
||||||
|
else
|
||||||
|
@rounding_adj = @sale_data.rounding_adjustment
|
||||||
|
end
|
||||||
else
|
else
|
||||||
new_total = @sale_data.grand_total
|
@rounding_adj = @sale_data.rounding_adjustment
|
||||||
end
|
end
|
||||||
@rounding_adj = new_total-@sale_data.grand_total
|
#end rounding adjustment
|
||||||
|
|
||||||
|
|
||||||
#get customer amount
|
#get customer amount
|
||||||
@customer = Customer.find(@sale_data.customer_id)
|
@customer = Customer.find(@sale_data.customer_id)
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
|
|||||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
|
|
||||||
@shop = Shop::ShopDetail
|
@shop = Shop::ShopDetail
|
||||||
if @shop.is_rounding_adj
|
# if @shop.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
# new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
else
|
# else
|
||||||
new_total = sale_data.grand_total
|
# new_total = sale_data.grand_total
|
||||||
end
|
# end
|
||||||
@rounding_adj = new_total-sale_data.grand_total
|
# @rounding_adj = new_total-sale_data.grand_total
|
||||||
|
@rounding_adj = sale_data.rounding_adjustment
|
||||||
|
|
||||||
@payparcount = 0
|
@payparcount = 0
|
||||||
others = 0
|
others = 0
|
||||||
|
|||||||
@@ -46,13 +46,13 @@ class Origami::UnionpayController < BaseOrigamiController
|
|||||||
shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
|
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
# if shop_details.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||||
rounding_adj = new_total-saleObj.grand_total
|
# rounding_adj = new_total-saleObj.grand_total
|
||||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
# saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||||
end
|
# end
|
||||||
|
|
||||||
saleObj = Sale.find(sale_id)
|
# saleObj = Sale.find(sale_id)
|
||||||
#end rounding adjustment
|
#end rounding adjustment
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "unionpay")
|
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "unionpay")
|
||||||
|
|||||||
@@ -44,13 +44,13 @@ class Origami::VisaController < BaseOrigamiController
|
|||||||
shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
|
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
# if shop_details.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||||
rounding_adj = new_total-saleObj.grand_total
|
# rounding_adj = new_total-saleObj.grand_total
|
||||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
# saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||||
end
|
# end
|
||||||
|
|
||||||
saleObj = Sale.find(sale_id)
|
# saleObj = Sale.find(sale_id)
|
||||||
#end rounding adjustment
|
#end rounding adjustment
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "visa")
|
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "visa")
|
||||||
|
|||||||
@@ -470,8 +470,23 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def adjust_rounding
|
def adjust_rounding
|
||||||
self.grand_total
|
shop_details = Shop::ShopDetail
|
||||||
self.rounding_adjustment = 0.00
|
# rounding adjustment
|
||||||
|
if shop_details.is_rounding_adj
|
||||||
|
a = self.grand_total % 25 # Modulus
|
||||||
|
b = self.grand_total / 25 # Division
|
||||||
|
#not calculate rounding if modulus is 0 and division is even
|
||||||
|
#calculate rounding if modulus is zero or not zero and division are not even
|
||||||
|
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||||
|
new_total = Sale.get_rounding_adjustment(self.grand_total)
|
||||||
|
self.rounding_adjustment = new_total - self.grand_total
|
||||||
|
else
|
||||||
|
self.rounding_adjustment = 0.00
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.rounding_adjustment = 0.00
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#Generate new Receipt No when it is not assigned
|
#Generate new Receipt No when it is not assigned
|
||||||
@@ -740,7 +755,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status)
|
|||||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_status!='void' and sale_payments.payment_amount != 0 ", shift.to_a)
|
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift.to_a)
|
||||||
sale_cash.each do |s_c|
|
sale_cash.each do |s_c|
|
||||||
total_cash_amount += s_c.cash_amount.to_f
|
total_cash_amount += s_c.cash_amount.to_f
|
||||||
total_card_amount += s_c.card_amount.to_f
|
total_card_amount += s_c.card_amount.to_f
|
||||||
@@ -760,7 +775,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status)
|
|||||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_status!='void' and sale_payments.payment_amount != 0 ", shift_sale_range.to_a)
|
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift_sale_range.to_a)
|
||||||
sale_cash.each do |s_c|
|
sale_cash.each do |s_c|
|
||||||
total_cash_amount += s_c.cash_amount.to_f
|
total_cash_amount += s_c.cash_amount.to_f
|
||||||
total_card_amount += s_c.card_amount.to_f
|
total_card_amount += s_c.card_amount.to_f
|
||||||
@@ -780,7 +795,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status)
|
|||||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
.where("sales.receipt_date between ? and ? and sale_status = 'completed' and sale_status!='void' and sale_payments.payment_amount != 0 ", from,to)
|
.where("sales.receipt_date between ? and ? and sale_status = 'completed' and sale_payments.payment_amount != 0 ", from,to)
|
||||||
sale_cash.each do |s_c|
|
sale_cash.each do |s_c|
|
||||||
total_cash_amount += s_c.cash_amount.to_f
|
total_cash_amount += s_c.cash_amount.to_f
|
||||||
total_card_amount += s_c.card_amount.to_f
|
total_card_amount += s_c.card_amount.to_f
|
||||||
|
|||||||
@@ -130,10 +130,7 @@
|
|||||||
<% count = count + 1 %>
|
<% count = count + 1 %>
|
||||||
<% sub_total += sale.grand_total %>
|
<% sub_total += sale.grand_total %>
|
||||||
<% #sub_qty += sale.total_item %>
|
<% #sub_qty += sale.total_item %>
|
||||||
<% if sale.status_type!="Discount" && sale.status_type!="foc"
|
<% if sale.status_type!="Discount" && (!sale.product_name.include? "FOC")
|
||||||
sub_qty += sale.total_item
|
|
||||||
end %>
|
|
||||||
<% if sale.status_type == "foc" && sale.price > 0
|
|
||||||
sub_qty += sale.total_item
|
sub_qty += sale.total_item
|
||||||
end %>
|
end %>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user