add first bill
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,shop_details)
|
||||
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details)
|
||||
self.page_width = 210
|
||||
self.page_height = 7000
|
||||
self.margin = 5
|
||||
@@ -39,6 +39,10 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
customer(customer_name)
|
||||
|
||||
if discount_price_by_accounts.length > 0
|
||||
discount_account(discount_price_by_accounts)
|
||||
end
|
||||
|
||||
items_account(item_price_by_accounts)
|
||||
|
||||
footer
|
||||
@@ -158,7 +162,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
y_position = cursor
|
||||
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Discount", :size => self.item_font_size,:align => :left
|
||||
text "Overall Discount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right
|
||||
@@ -302,6 +306,22 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
end
|
||||
|
||||
def discount_account(discount_price_by_accounts)
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
discount_price_by_accounts.each do |ipa|
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "#{ 'Total ' + ipa[:name] + ' Discounts' }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "(" + "#{ ipa[:price] }" + ")" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def items_account(item_price_by_accounts)
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
|
||||
Reference in New Issue
Block a user