update payper and redeem
This commit is contained in:
@@ -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 = "paypar"
|
self.payment_method = "redeem"
|
||||||
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 == "paypar"
|
if pp.payment_method == "redeem"
|
||||||
payparcost = payparcost + pp.payment_amount
|
payparcost = payparcost + pp.payment_amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -265,32 +265,34 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
rebate = 0
|
rebate = 0
|
||||||
rebate_amount["data"].each do |res|
|
rebate_amount["data"].each do |res|
|
||||||
|
|
||||||
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Rebate"
|
|
||||||
|
|
||||||
rebate = rebate + res["rebate"]
|
|
||||||
|
|
||||||
end
|
|
||||||
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
|
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Current Redeem Amount", :size => self.item_font_size,:align => :left
|
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
||||||
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(res["redeem"], :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(res["redeem"], :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Rebate"
|
||||||
|
|
||||||
|
rebate = rebate + res["rebate"]
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Current Rebate Amount", :size => self.item_font_size,:align => :left
|
text "Rebate Earn", :size => self.item_font_size,:align => :left
|
||||||
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(rebate, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(res["rebate"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if member_info["status"] == true && member_info["data"].present?
|
if member_info["status"] == true && member_info["data"].present?
|
||||||
@@ -306,7 +308,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
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
|
text "Total Balance", :size => self.item_font_size,:align => :left
|
||||||
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(balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
|
|||||||
Reference in New Issue
Block a user