update receipt
This commit is contained in:
@@ -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, item_price_by_accounts, member_info = nil,rebate_amount = nil)
|
||||
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details)
|
||||
self.page_width = 210
|
||||
self.page_height = 2500
|
||||
self.margin = 5
|
||||
@@ -24,7 +24,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
self.header_font_size = 10
|
||||
self.item_font_size = 8
|
||||
|
||||
header( "Beauty In the Pot", printer_settings.name)
|
||||
header( shop_details)
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
@@ -44,12 +44,15 @@ class ReceiptBillPdf < Prawn::Document
|
||||
footer
|
||||
end
|
||||
|
||||
def header (printer_name, name)
|
||||
text "#{printer_name}", :left_margin => -10, :size => self.header_font_size,:align => :center
|
||||
def header (shop_details)
|
||||
move_down 7
|
||||
text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center
|
||||
move_down 5
|
||||
text "#{name}", :size => self.header_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
|
||||
move_down 5
|
||||
|
||||
stroke_horizontal_rule
|
||||
end
|
||||
@@ -264,22 +267,23 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
end
|
||||
if member_info["status"] == true
|
||||
balance = 0.0
|
||||
member_info["data"].each do |res|
|
||||
|
||||
if res["accountable_type"]== "RebateAccount"
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Current Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ res["balance"] }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||
balance = balance + res["balance"]
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Current Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ balance }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user