improve receipt/details reports and implement number formatting
1) eager load reports for receipt/details 2) introduce number_format lookups to replace print_settings for number formatting 3) implement NumberFormattable concern, reference number_format lookups or print_settings if not exist, to get number format settings and number formatting 4) replace rails NumberHelper.number_with_precision with NumberFormattable.number_format hopefully to reduce overhead, formatting numbers for huge lists of data
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
class SaleItem < ApplicationRecord
|
||||
include NumberFormattable
|
||||
self.primary_key = "sale_item_id"
|
||||
|
||||
#primary key - need to be unique generated for multiple shops
|
||||
@@ -294,8 +295,6 @@ class SaleItem < ApplicationRecord
|
||||
if self.unit_price != self.unit_price_was || self.price != self.price_was
|
||||
if unit_price_fraction > 0 || price_fraction > 0
|
||||
if ['Discount', 'promotion'].include?(self.status)
|
||||
precision = PrintSetting.get_precision_delimiter().precision.to_i
|
||||
|
||||
self.unit_price = self.unit_price.round(precision)
|
||||
self.price = (self.unit_price * self.qty).round(precision)
|
||||
self.taxable_price = self.price
|
||||
|
||||
Reference in New Issue
Block a user