precision
This commit is contained in:
@@ -452,6 +452,7 @@ class Sale < ApplicationRecord
|
||||
self.total_amount = subtotal_price
|
||||
self.total_discount = total_discount
|
||||
self.grand_total = (self.total_amount - self.total_discount) + self.total_tax
|
||||
self.grand_total_round
|
||||
#compute rounding adjustment
|
||||
adjust_rounding
|
||||
|
||||
@@ -461,6 +462,7 @@ class Sale < ApplicationRecord
|
||||
|
||||
#compute - invoice total
|
||||
def compute_by_sale_items(sale_id, sale_itemss, total_discount,discount_type=nil,order_source=nil,tax_type=nil)
|
||||
shop = Shop.first
|
||||
sale = Sale.find(sale_id)
|
||||
sales_items = sale_itemss
|
||||
|
||||
@@ -484,6 +486,7 @@ class Sale < ApplicationRecord
|
||||
sale.total_amount = subtotal_price
|
||||
sale.total_discount = total_discount
|
||||
sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax
|
||||
sale.grand_total_round
|
||||
if discount_type == "member_discount"
|
||||
sale.discount_type = discount_type
|
||||
end
|
||||
@@ -519,6 +522,7 @@ class Sale < ApplicationRecord
|
||||
self.total_amount = subtotal_price
|
||||
self.total_discount = total_discount
|
||||
self.grand_total = (self.total_amount - self.total_discount) + self.total_tax
|
||||
self.grand_total_round
|
||||
#compute rounding adjustment
|
||||
adjust_rounding
|
||||
|
||||
@@ -2948,6 +2952,17 @@ end
|
||||
|
||||
# End hourly sale item report
|
||||
|
||||
|
||||
#not to show decimal in grand total
|
||||
def grand_total_round
|
||||
shop =Shop.first
|
||||
print_settings = PrintSetting.get_precision_delimiter()
|
||||
if !print_settings.nil?
|
||||
self.grand_total =self.grand_total.round(print_settings.precision.to_i)
|
||||
puts self.grand_total
|
||||
puts "Hello grand_total_round"
|
||||
end
|
||||
end
|
||||
private
|
||||
|
||||
def generate_custom_id
|
||||
|
||||
Reference in New Issue
Block a user