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,5 +1,5 @@
|
||||
class OrderSummaryCustomisePdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:order_no_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(print_settings,order, print_status, order_items = nil,alt_name,before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
@@ -48,9 +48,9 @@ class OrderSummaryCustomisePdf < Prawn::Document
|
||||
|
||||
# order items
|
||||
if order_items == nil
|
||||
order_items(order, alt_name, print_settings.precision)
|
||||
order_items(order, alt_name, precision)
|
||||
else
|
||||
order_items(order_items, alt_name, print_settings.precision)
|
||||
order_items(order_items, alt_name, precision)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -113,7 +113,7 @@ class OrderSummaryCustomisePdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width - 10,y_position], :width => self.qty_width) do
|
||||
text " [#{number_with_precision(odi.qty, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text " [#{number_format(odi.qty, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
|
||||
Reference in New Issue
Block a user