update receipt bill pdf for foc and credit

This commit is contained in:
Aung Myo
2017-08-15 10:16:25 +06:30
parent d5f6bca2b8
commit 74200bb2e7

View File

@@ -54,8 +54,9 @@ class ReceiptBillPdf < Prawn::Document
end
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
sign(sale_data)
footer(printed_status)
end
@@ -409,6 +410,42 @@ class ReceiptBillPdf < Prawn::Document
end
end
def sign(sale_data)
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
if payment.payment_method == "creditnote"
y_position = cursor
stroke_horizontal_rule
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
move_down 35
stroke_horizontal_rule
end
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
move_down 38
text "Approved By" , :size => self.item_font_size,:align => :center
end
end
end
if sale_data.sale_status == "FOC"
y_position = cursor
stroke_horizontal_rule
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
move_down 35
stroke_horizontal_rule
end
bounding_box([0,y_position], :width =>self.item_width, :height => self.item_height) do
move_down 38
text "Acknowledged By", :size => self.item_font_size,:align => :center
end
end
end
def footer(printed_status)
move_down 5
stroke_horizontal_rule