SQA feedback

This commit is contained in:
phyusin
2018-03-20 15:55:00 +06:30
parent 829c09040d
commit f354e32e31
3 changed files with 28 additions and 6 deletions

View File

@@ -371,6 +371,8 @@ class Sale < ApplicationRecord
end
#compute rounding adjustment
# adjust_rounding
sale.rounding_adjustment = compute_adjust_rounding(sale.grand_total)
sale.save!
end
@@ -552,6 +554,26 @@ class Sale < ApplicationRecord
end
def compute_adjust_rounding(grand_total)
shop_details = Shop::ShopDetail
# rounding adjustment
if shop_details.is_rounding_adj
a = grand_total % 25 # Modulus
b = 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(grand_total)
rounding_adjustment = new_total - grand_total
else
rounding_adjustment = 0.00
end
else
rounding_adjustment = 0.00
end
return rounding_adjustment
end
#Generate new Receipt No when it is not assigned
def generate_receipt_no
#shop_code and client_code