update order queue printer
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class OrderItemPdf < Prawn::Document
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(order_item, print_status, options, alt_name)
|
||||
def initialize(print_settings,order_item, print_status, options, alt_name)
|
||||
self.page_width = 210
|
||||
self.page_height = 1450
|
||||
self.margin = 5
|
||||
@@ -12,7 +12,7 @@ class OrderItemPdf < Prawn::Document
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=100
|
||||
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||
|
||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||
@@ -87,8 +87,9 @@ class OrderItemPdf < Prawn::Document
|
||||
if alt_name
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
font "public/fonts/Chinese.ttf"
|
||||
text "(#{order_item.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||
font("public/fonts/Chinese.ttf", :size => 14) do
|
||||
text "(#{order_item.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class OrderSummaryPdf < Prawn::Document
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(order, print_status, order_items = nil,alt_name)
|
||||
def initialize(print_settings,order, print_status, order_items = nil,alt_name)
|
||||
self.page_width = 210
|
||||
self.page_height = 1450
|
||||
self.margin = 5
|
||||
@@ -12,11 +12,11 @@ class OrderSummaryPdf < Prawn::Document
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=100
|
||||
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||
font "public/fonts/Zawgyi-One.ttf"
|
||||
font "public/fonts/padauk.ttf"
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
font "public/fonts/padauk.ttf"
|
||||
self.header_font_size = 12
|
||||
self.item_font_size = 10
|
||||
|
||||
@@ -92,20 +92,26 @@ class OrderSummaryPdf < Prawn::Document
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "#{odi.qty}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 3
|
||||
if alt_name
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
font "public/fonts/Chinese.ttf"
|
||||
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||
|
||||
end
|
||||
|
||||
if alt_name
|
||||
move_down 4
|
||||
font("public/fonts/Chinese.ttf") do
|
||||
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
move_down 5
|
||||
|
||||
# add option
|
||||
|
||||
@@ -31,10 +31,6 @@ class ReceiptBillPdf < Prawn::Document
|
||||
delimiter = ""
|
||||
end
|
||||
|
||||
puts "hhhhhhhhhhh"
|
||||
puts delimiter
|
||||
puts printer_settings.precision
|
||||
|
||||
header( shop_details)
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -143,7 +139,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
pad_top(15) {
|
||||
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||
text_box "%.#{precision}f" % price, :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{qty}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :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_name_width+4),y_position], :width =>self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
}
|
||||
@@ -280,7 +276,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
end
|
||||
end
|
||||
if member_info["status"] == true
|
||||
if member_info["status"] == true && member_info["data"].present?
|
||||
balance = 0
|
||||
member_info["data"].each do |res|
|
||||
|
||||
|
||||
Reference in New Issue
Block a user