This commit is contained in:
Aung Myo
2017-07-02 12:06:28 +06:30
parent b78119f848
commit 7994fcc0c3
2 changed files with 12 additions and 5 deletions

View File

@@ -223,7 +223,7 @@ class SalePayment < ApplicationRecord
membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id) membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
if membership_data["status"]==true if membership_data["status"]==true
self.payment_method = "redeem" self.payment_method = "paypar"
self.payment_amount = self.received_amount self.payment_amount = self.received_amount
self.payment_reference = self.voucher_no self.payment_reference = self.voucher_no
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
@@ -307,7 +307,7 @@ class SalePayment < ApplicationRecord
paypar = sObj.sale_payments paypar = sObj.sale_payments
payparcost = 0 payparcost = 0
paypar.each do |pp| paypar.each do |pp|
if pp.payment_method == "redeem" if pp.payment_method == "paypar"
payparcost = payparcost + pp.payment_amount payparcost = payparcost + pp.payment_amount
end end
end end

View File

@@ -233,9 +233,16 @@ class ReceiptBillPdf < Prawn::Document
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment| SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
y_position = cursor y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do if payment.payment_method == "paypar"
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Redeem Payment", :size => self.item_font_size,:align => :left
end
else
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
end end
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end end
@@ -368,8 +375,8 @@ class ReceiptBillPdf < Prawn::Document
bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
text "#{printed_status}", :size => self.item_font_size,:align => :left text "#{printed_status}", :size => self.item_font_size,:align => :left
end end
bounding_box([self.label_width,y_position], :width =>self.label_width, :height => self.item_height) do bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Thank You! See you Again", :left_margin => -10, :size => self.item_font_size,:align => :right text "Thank You! See you Again", :left_margin => -10, :size => self.item_font_size,:align => :left
end end
move_down 5 move_down 5