credit payment function

This commit is contained in:
phyusin
2018-07-10 18:12:25 +06:30
parent d0118d2cfc
commit bf0f76ebc7
29 changed files with 879 additions and 462 deletions

View File

@@ -2,8 +2,13 @@ class Origami::VisaController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
@cashier_type = params[:type]
# limit visa_amount
sale_data = Sale.find_by_sale_id(@sale_id)
path = request.fullpath
# limit mpu_amount
if path.include? ("credit_payment")
sale_data = Sale.get_sale_data_for_other_payment_credit(@sale_id)
else
sale_data = Sale.find_by_sale_id(@sale_id)
end
total = 0
@visacount = 0
@shop = Shop.first
@@ -23,8 +28,13 @@ class Origami::VisaController < BaseOrigamiController
new_total = sale_data.grand_total
end
@rounding_adj = new_total-sale_data.grand_total
sale_data.sale_payments.each do |sale_payment|
if path.include? ("credit_payment")
sale_payment_data = SalePayment.get_sale_payment_for_credit(sale_data)
else
sale_payment_data = sale_data.sale_payments
end
sale_payment_data.each do |sale_payment|
if sale_payment.payment_method == "visa"
@visacount = @visacount + sale_payment.payment_amount
else
@@ -62,8 +72,13 @@ class Origami::VisaController < BaseOrigamiController
# saleObj = Sale.find(sale_id)
#end rounding adjustment
path = request.fullpath
payment_for = false
if path.include? ("credit_payment")
payment_for = true
end
sale_payment = SalePayment.new
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "visa",ref_no)
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "visa",ref_no,payment_for)
end
end