update customer and receipt old balance
This commit is contained in:
@@ -217,7 +217,8 @@ end
|
||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
|
||||
|
||||
# Check for paypar account exists
|
||||
if paypar_account_no != nil || paypar_account_no != ''
|
||||
# if paypar_account_no != nil || paypar_account_no != ''
|
||||
if paypar_account_no.present?
|
||||
member_params = { name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||
paypar_account_no: paypar_account_no,
|
||||
@@ -274,7 +275,7 @@ end
|
||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
|
||||
|
||||
# Check for paypar account exists
|
||||
if paypar_account_no != nil || paypar_account_no != ''
|
||||
if paypar_account_no.present?
|
||||
member_params = { name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||
paypar_account_no: paypar_account_no,
|
||||
|
||||
@@ -280,9 +280,12 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
if rebate_amount["status"] == true
|
||||
stroke_horizontal_rule
|
||||
total = 0
|
||||
balance = 0
|
||||
rebate_balance =0
|
||||
redeem = 0
|
||||
rebate_amount["data"].each do |res|
|
||||
total = total + res["balance"]
|
||||
#total redeem amount
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
|
||||
redeem = redeem + res["redeem"]
|
||||
@@ -292,7 +295,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
#total Rebate Earn
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateAccount" && res["status"]== "Rebate"
|
||||
|
||||
# balance = balance + res["balance"]
|
||||
rebate_balance = rebate_balance + res["rebate"]
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
@@ -306,7 +309,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
# Total Rebate Amount if birthday
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateBonusAccount" && res["status"]== "Rebate"
|
||||
# balance = balance + res["balance"]
|
||||
rebate_balance = rebate_balance + res["rebate"]
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
@@ -328,7 +331,12 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
old = balance + redeem
|
||||
|
||||
if redeem == 0
|
||||
old = total - rebate_balance
|
||||
else
|
||||
old = balance + redeem
|
||||
end
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
@@ -343,11 +351,11 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
|
||||
if member_info["status"] == true && member_info["data"].present?
|
||||
balance = 0
|
||||
total_balance = 0
|
||||
member_info["data"].each do |res|
|
||||
|
||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||
balance = balance + res["balance"]
|
||||
total_balance = total_balance + res["balance"]
|
||||
|
||||
end
|
||||
|
||||
@@ -358,7 +366,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Total Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
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(total_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user