payment bill added and origami bug fixed

This commit is contained in:
Yan
2017-06-14 19:41:32 +06:30
15 changed files with 155 additions and 185 deletions

View File

@@ -1,6 +1,6 @@
class ReceiptBillPdf < 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(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total)
def initialize(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info = nil)
self.page_width = 250
self.page_height = 1450
self.margin = 10
@@ -31,7 +31,12 @@ class ReceiptBillPdf < Prawn::Document
cashier_info(sale_data, customer_name)
line_items(sale_items, food_total, beverage_total)
all_total(sale_data)
all_total(sale_data)
if member_info != nil
member_info(member_info)
end
footer
end
@@ -183,7 +188,24 @@ class ReceiptBillPdf < Prawn::Document
end
move_down 5
# stroke_horizontal_rule
end
# show member information
def member_info(member_info)
move_down 7
if member_info["data"] == true
member_info["data"].each do |res|
stroke_horizontal_rule
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
text "#{ res["accountable_type"] } : #{ res["balance"] }", :size => self.item_font_size,:align => :left
end
move_down 5
end
end
end
def footer