to do req_bill_format and status changed after pay
This commit is contained in:
@@ -1,29 +1,46 @@
|
||||
class OrderItemPdf < Prawn::Document
|
||||
|
||||
attr_accessor :receipt_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:item_description_width
|
||||
def initialize(order_item, print_settings)
|
||||
super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||
self.page_width = 300
|
||||
self.page_height = 400
|
||||
self.margin = 10
|
||||
self.price_width = 50
|
||||
self.qty_width = 50
|
||||
self.item_width = self.page_width - (self.price_width + self.qty_width)
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width)
|
||||
self.receipt_width=130
|
||||
|
||||
super(:margin => [self.margin, 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
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
font_size 9
|
||||
text "#{order_item.dining}", :size => 15
|
||||
# font "public/fonts/padauk.ttf"
|
||||
self.header_font_size = 12
|
||||
self.item_font_size = 10
|
||||
|
||||
text "#{order_item.dining}", :size => self.header_font_size,:align => :center
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
|
||||
#order_info
|
||||
order_info(order_item.order_by,order_item.order_at, order_item.customer)
|
||||
order_info(order_item.order_by,order_item.order_at)
|
||||
|
||||
# order items
|
||||
order_items(order_item)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
def order_info(order_by, order_at, customer)
|
||||
def order_info(order_by, order_at)
|
||||
y_position = cursor
|
||||
|
||||
bounding_box([0,y_position], :width => 200, :height => 15) do
|
||||
text "OrderBy:#{order_by} Customer:#{customer} Date:#{order_at.strftime("%Y-%m-%d")}", :size => 7,:align => :left
|
||||
bounding_box([0,y_position], :width => self.item_width - 50, :height => self.item_height) do
|
||||
text "OrderBy:#{order_by} ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([self.item_width - 50,y_position], :width => self.item_width + 50, :height => self.item_height) do
|
||||
text "Date:#{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -35,12 +52,12 @@ class OrderItemPdf < Prawn::Document
|
||||
def order_items(order_item)
|
||||
y_position = cursor
|
||||
|
||||
bounding_box([0,y_position], :width => 180, :height => 15) do
|
||||
text "Item", :size => 7,:align => :left
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Item", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([160,y_position], :width => 20, :height => 15) do
|
||||
text "Qty", :size => 7,:align => :right
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||
text "Qty", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -56,12 +73,12 @@ class OrderItemPdf < Prawn::Document
|
||||
|
||||
move_down 5
|
||||
|
||||
bounding_box([0,y_position], :width => 180, :height => 20) do
|
||||
text "#{order_item.item_name}", :size => 7,:align => :left
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "#{order_item.item_name}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([160,y_position], :width => 20, :height => 20) do
|
||||
text "#{order_item.qty}", :size => 7,:align => :right
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||
text "#{order_item.qty}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
move_down 5
|
||||
|
||||
Reference in New Issue
Block a user