update query data for origami

This commit is contained in:
Aung Myo
2017-06-06 09:18:01 +06:30
36 changed files with 259 additions and 141 deletions

View File

@@ -11,21 +11,61 @@ class OrderItemPdf < Prawn::Document
stroke_horizontal_rule
move_down 5
cashier_info(order_item.order_by,order_item.order_at, order_item.customer)
#order_info
order_info(order_item.order_by,order_item.order_at, order_item.customer)
# order items
order_items(order_item)
end
def cashier_info(order_by, order_at, customer)
move_down 5
# Write Order Information to PDF
def order_info(order_by, order_at, customer)
y_position = cursor
bounding_box([0,y_position], :width =>200, :height => 20) do
text "OrderBy:#{order_by} Customer:#{customer} Date:#{order_at.strftime("%Y %m %d")}", :size => 7,:align => :left
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
end
stroke_horizontal_rule
move_down 20
end
# Write Order items to PDF
def order_items(order_item)
y_position = cursor
bounding_box([0,y_position], :width => 180, :height => 15) do
text "Item", :size => 7,:align => :left
end
bounding_box([160,y_position], :width => 20, :height => 15) do
text "Qty", :size => 7,:align => :right
end
stroke_horizontal_rule
move_down 5
#Add Order Item
add_order_items(order_item)
end
# Add order items under order info
def add_order_items(order_item)
y_position = cursor
move_down 5
bounding_box([0,y_position], :width => 180, :height => 20) do
text "#{order_item.item_name}", :size => 7,:align => :left
end
bounding_box([160,y_position], :width => 20, :height => 20) do
text "#{order_item.qty}", :size => 7,:align => :right
end
move_down 5
end
end

View File

@@ -7,11 +7,68 @@ class OrderSummaryPdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
font_size 9
text "#{"table_name"}", :size => 15
text "#{order[0].dining}", :size => 15
stroke_horizontal_rule
move_down 5
#order_info
order_info(order[0].order_by,order[0].order_at, order[0].customer)
# order items
order_items(order)
end
# Write Order Information to PDF
def order_info(order_by, order_at, customer)
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
end
stroke_horizontal_rule
move_down 20
end
# Write Order items to PDF
def order_items(order_item)
y_position = cursor
bounding_box([0,y_position], :width => 180, :height => 15) do
text "Item", :size => 7,:align => :left
end
bounding_box([160,y_position], :width => 20, :height => 15) do
text "Qty", :size => 7,:align => :right
end
stroke_horizontal_rule
move_down 5
#Add Order Item
add_order_items(order_item)
end
# Add order items under order info
def add_order_items(order_item)
y_position = cursor
move_down 5
order_item.each do|odi|
bounding_box([0,y_position], :width => 180, :height => 20) do
text "#{odi.item_name}", :size => 7,:align => :left
end
bounding_box([160,y_position], :width => 20, :height => 20) do
text "#{odi.qty}", :size => 7,:align => :right
end
end
move_down 5
end
end