pull origin master

This commit is contained in:
Yan
2017-09-18 13:53:28 +06:30
parent 4f3b831771
commit 8966f290b5
122 changed files with 3964 additions and 2277 deletions

View File

@@ -1,8 +1,8 @@
class StockResultPdf < 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,:text_width
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, :text_width
def initialize(printer_settings,stockcheck, stockcheck_items,checker_name, shop_details)
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
def initialize(printer_settings, stockcheck, stockcheck_items, checker_name, shop_details)
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
self.page_height = printer_settings.page_height
self.margin = 5
self.price_width = 40
@@ -27,66 +27,68 @@ class StockResultPdf < Prawn::Document
self.header_font_size = 10
self.item_font_size = 8
header( shop_details)
header(shop_details)
stroke_horizontal_rule
detail(stockcheck,stockcheck_items, checker_name)
detail(stockcheck, stockcheck_items, checker_name)
end
def header (shop_details)
move_down 7
text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center
text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size, :align => :center
move_down 5
text "#{shop_details.address}", :size => self.item_font_size,:align => :center
text "#{shop_details.address}", :size => self.item_font_size, :align => :center
# move_down self.item_height
move_down 5
text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center
text "#{shop_details.phone_no}", :size => self.item_font_size, :align => :center
move_down 5
stroke_horizontal_rule
end
def detail(stockcheck, stockcheck_items, checker_name)
move_down 7
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
text "Checker : ", :size => self.item_font_size,:align => :left
end
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
text "#{checker_name}" , :size => self.item_font_size,:align => :left
end
move_down 7
y_position = cursor
bounding_box([0, y_position], :width => self.label_width, :height => self.item_height) do
text "Checker : ", :size => self.item_font_size, :align => :left
end
bounding_box([self.label_width, y_position], :width => self.label_width, :height => self.item_height) do
text "#{checker_name}", :size => self.item_font_size, :align => :left
end
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
text "Check Start Time : ", :size => self.item_font_size,:align => :left
end
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
text "#{ stockcheck.check_start.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }" , :size => self.item_font_size,:align => :left
end
y_position = cursor
bounding_box([0, y_position], :width => self.label_width, :height => self.item_height) do
text "Check Start Time : ", :size => self.item_font_size, :align => :left
end
bounding_box([self.label_width, y_position], :width => self.label_width, :height => self.item_height) do
text "#{ stockcheck.check_start.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }", :size => self.item_font_size, :align => :left
end
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
text "Check End Time ", :size => self.item_font_size,:align => :left
end
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
text "#{ stockcheck.check_start.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }" , :size => self.item_font_size,:align => :left
end
y_position = cursor
bounding_box([0, y_position], :width => self.label_width, :height => self.item_height) do
text "Check End Time ", :size => self.item_font_size, :align => :left
end
bounding_box([self.label_width, y_position], :width => self.label_width, :height => self.item_height) do
text "#{ stockcheck.check_start.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }", :size => self.item_font_size, :align => :left
end
if stockcheck_items.length > 0
stockcheck_items.each do |st|
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{ st.item_code }", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{st.stock_count.to_i}" , :size => self.item_font_size,:align => :right
end
end
end
if stockcheck_items.length > 0
stockcheck_items.each do |st|
move_down 5
stroke_horizontal_rule
y_position = cursor
item_name = MenuItemInstance.get_item_name(st.item_code)
bounding_box([0, y_position], :width => self.item_description_width, :height => self.item_height) do
text item_name.to_s, :size => self.item_font_size, :align => :left
end
bounding_box([self.item_description_width, y_position], :width => self.label_width) do
text "#{st.stock_count.to_i}", :size => self.item_font_size, :align => :right
end
end
end
move_down 5
stroke_horizontal_rule
end
end