check add to existing invoice
This commit is contained in:
@@ -164,7 +164,25 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
@table_no = ''
|
@table_no = ''
|
||||||
|
|
||||||
@shop = Shop::ShopDetail
|
@shop = Shop::ShopDetail
|
||||||
@rounding_adj = @sale_data.rounding_adjustment
|
|
||||||
|
saleObj = Sale.find(sale_id)
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
#get customer amount
|
#get customer amount
|
||||||
@customer = Customer.find(@sale_data.customer_id)
|
@customer = Customer.find(@sale_data.customer_id)
|
||||||
|
|||||||
@@ -470,17 +470,16 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def adjust_rounding
|
def adjust_rounding
|
||||||
saleObj = Sale.find(self.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 = self.grand_total % 25 # Modulus
|
||||||
b = saleObj.grand_total / 25 # Division
|
b = self.grand_total / 25 # Division
|
||||||
#not calculate rounding if modulus is 0 and division is even
|
#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
|
#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(self.grand_total)
|
||||||
self.rounding_adjustment = new_total-saleObj.grand_total
|
self.rounding_adjustment = new_total - self.grand_total
|
||||||
else
|
else
|
||||||
self.rounding_adjustment = 0.00
|
self.rounding_adjustment = 0.00
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user