Merge branch 'staging' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-08-01 12:08:06 +06:30
2 changed files with 17 additions and 8 deletions

View File

@@ -216,7 +216,8 @@ end
merchant_uid:merchant_uid,auth_token:auth_token}.to_json merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists # 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, member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no, dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no, paypar_account_no: paypar_account_no,
@@ -273,7 +274,7 @@ end
merchant_uid:merchant_uid,auth_token:auth_token}.to_json merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists # 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, member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no, dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no, paypar_account_no: paypar_account_no,

View File

@@ -280,9 +280,12 @@ class ReceiptBillPdf < Prawn::Document
if rebate_amount["status"] == true if rebate_amount["status"] == true
stroke_horizontal_rule stroke_horizontal_rule
total = 0
balance = 0 balance = 0
rebate_balance =0
redeem = 0 redeem = 0
rebate_amount["data"].each do |res| rebate_amount["data"].each do |res|
total = total + res["balance"]
#total redeem amount #total redeem amount
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem" if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
redeem = redeem + res["redeem"] redeem = redeem + res["redeem"]
@@ -292,7 +295,7 @@ class ReceiptBillPdf < Prawn::Document
#total Rebate Earn #total Rebate Earn
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateAccount" && res["status"]== "Rebate" 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 move_down 5
y_position = cursor y_position = cursor
@@ -306,7 +309,7 @@ class ReceiptBillPdf < Prawn::Document
end end
# Total Rebate Amount if birthday # Total Rebate Amount if birthday
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateBonusAccount" && res["status"]== "Rebate" 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 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
@@ -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 text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end end
old = balance + redeem
if redeem == 0
old = total - rebate_balance
else
old = balance + redeem
end
move_down 5 move_down 5
y_position = cursor y_position = cursor
@@ -343,11 +351,11 @@ class ReceiptBillPdf < Prawn::Document
end end
if member_info["status"] == true && member_info["data"].present? if member_info["status"] == true && member_info["data"].present?
balance = 0 total_balance = 0
member_info["data"].each do |res| member_info["data"].each do |res|
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount" if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
balance = balance + res["balance"] total_balance = total_balance + res["balance"]
end end
@@ -358,7 +366,7 @@ class ReceiptBillPdf < Prawn::Document
text "Total 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(total_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end end
end end