merge with old_town_aston req

This commit is contained in:
phyusin
2018-03-12 12:10:52 +06:30
parent 6e9ecd342b
commit 92401ab4f9
6 changed files with 99 additions and 27 deletions

View File

@@ -228,6 +228,23 @@ class Origami::PaymentsController < BaseOrigamiController
@individual_total.push({'total_customer' => saleObj.equal_persons.to_i, 'per_person_amount' => per_person_amount.to_f })
end
# rounding adjustment
# if @shop.is_rounding_adj
# 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
# @rounding_adj = @sale_data.rounding_adjustment
# end
#end rounding adjustment
# rounding adjustment
if @shop.is_rounding_adj
a = saleObj.grand_total % 25 # Modulus
@@ -237,6 +254,7 @@ class Origami::PaymentsController < BaseOrigamiController
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
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj)
else
@rounding_adj = @sale_data.rounding_adjustment
end

View File

@@ -46,6 +46,7 @@ class Origami::TableInvoicesController < BaseOrigamiController
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(sale.grand_total)
sale.rounding_adjustment = new_total-sale.grand_total
sale.update_attributes(grand_total: new_total,old_grand_total: sale.grand_total,rounding_adjustment:sale.rounding_adjustment)
end
end
#end rounding adjustment