add settings for order item, order summary slim and receiptbillA5, receiptbillShowAltName

This commit is contained in:
phyusin
2018-01-17 12:08:14 +06:30
parent 21a39dc390
commit 06686b06bb
8 changed files with 221 additions and 61 deletions

View File

@@ -199,6 +199,15 @@ class ReceiptBillPdf < Prawn::Document
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
if show_alt_name
if !(item.product_alt_name).empty?
move_down 2
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
text "(#{item.product_alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
end
end
end
}
move_down 5
end
@@ -532,5 +541,23 @@ class ReceiptBillPdf < Prawn::Document
end
end
end
#check ReceiptBillAltName included
def show_alt_name
bill_alt_name = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
status = false
if !bill_alt_name.empty?
bill_alt_name.each do |alt_name|
if alt_name[0] == 'ReceiptBillAltName'
if alt_name[1] == '1'
status = true
else
status = false
end
end
end
end
return status
end
end