update comment for rounding adj
This commit is contained in:
@@ -25,6 +25,7 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@shop = Shop::ShopDetail
|
@shop = Shop::ShopDetail
|
||||||
@membership = MembershipSetting::MembershipSetting
|
@membership = MembershipSetting::MembershipSetting
|
||||||
@payment_methods = PaymentMethodSetting.all
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|
||||||
@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
|
||||||
|
|||||||
@@ -30,9 +30,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
if shop_details.is_rounding_adj
|
||||||
a = sale_data.grand_total % 25
|
a = sale_data.grand_total % 25 # Modulus
|
||||||
b = sale_data.grand_total / 25
|
b = sale_data.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)
|
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
rounding_adj = new_total-sale_data.grand_total
|
rounding_adj = new_total-sale_data.grand_total
|
||||||
@@ -73,8 +74,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
if shop_details.is_rounding_adj
|
||||||
a = saleObj.grand_total % 25
|
a = saleObj.grand_total % 25 # Modulus
|
||||||
b = saleObj.grand_total / 25
|
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)
|
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||||
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
|
||||||
@@ -296,8 +299,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
@shop = Shop.find_by_id(1)
|
@shop = Shop.find_by_id(1)
|
||||||
|
|
||||||
if @shop.is_rounding_adj
|
if @shop.is_rounding_adj
|
||||||
a = saleObj.grand_total % 25 #
|
a = saleObj.grand_total % 25 # Modulus
|
||||||
b = saleObj.grand_total / 25 #
|
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)
|
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||||
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
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
@shop = Shop::ShopDetail
|
@shop = Shop::ShopDetail
|
||||||
@membership = MembershipSetting::MembershipSetting
|
@membership = MembershipSetting::MembershipSetting
|
||||||
@payment_methods = PaymentMethodSetting.all
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|
||||||
@room.bookings.active.each do |booking|
|
@room.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
|
||||||
|
|||||||
Reference in New Issue
Block a user