From 74200bb2e738947337b949997277e8ed61d7b661 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 15 Aug 2017 10:16:25 +0630 Subject: [PATCH] update receipt bill pdf for foc and credit --- app/pdf/receipt_bill_pdf.rb | 39 ++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 1dbea502..00ef0a7b 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -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