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::AlipayController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
@cashier_type = params[:type]
path = request.fullpath
# limit alipay_amount
sale_data = Sale.find_by_sale_id(@sale_id)
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
@alipaycount = 0
@shop = Shop.first
@@ -24,8 +29,13 @@ class Origami::AlipayController < 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 == "alipay"
@alipaycount = @alipaycount + sale_payment.payment_amount
else
@@ -64,8 +74,14 @@ class Origami::AlipayController < BaseOrigamiController
# end
# saleObj = Sale.find(sale_id)
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, "alipay",ref_no)
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "alipay",ref_no,payment_for)
end
end

View File

@@ -35,11 +35,11 @@ class Origami::CreditPaymentsController < BaseOrigamiController
shop_details = Shop.first
# rounding adjustment
if shop_details.is_rounding_adj
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end
# if shop_details.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
# rounding_adj = new_total-saleObj.grand_total
# saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
# end
saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new

View File

@@ -12,8 +12,10 @@ class Origami::CreditSalesController < BaseOrigamiController
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@customers = Customer.pluck("customer_id, name")
@sale_payment = SalePayment.find_by_sale_payment_id(params[:sale_payment_id])
@sale = Sale.find_by_sale_id(@sale_payment.sale_id)
@sale = Sale.find_by_sale_id(params[:sale_id])
@sale_payment = SalePayment.select("SUM(payment_amount) as payment_amount")
.where("sale_id = ? and payment_method=?", @sale.sale_id, "creditnote")
@sale_taxes = []
sale_taxes = SaleTax.where("sale_id = ?", @sale.sale_id)
if !sale_taxes.empty?

View File

@@ -4,23 +4,7 @@ class Origami::DashboardController < BaseOrigamiController
@shop = Shop.first
today = DateTime.now.strftime('%Y-%m-%d')
# @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
# @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
# @top_products = Sale.top_products(today).sum('i.qty')
# @bottom_products = Sale.bottom_products(today).sum('i.qty')
# @hourly_sales = Sale.hourly_sales(today).sum(:grand_total)
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
# .sum(:grand_total)
# @employee_sales = Sale.employee_sales(today)
# .sum('(CASE WHEN sp.payment_method="cash" THEN (sp.payment_amount - sales.amount_changed) ELSE sp.payment_amount END)')
# @inventories = StockJournal.inventory_balances(today).sum(:balance)
# @total_sale = Sale.total_sale(today,current_user)
# @total_count = Sale.total_count(today,current_user)
# @total_card = Sale.total_card_sale(today,current_user)
# @total_credit = Sale.credit_payment(today,current_user)
@display_type = Lookup.find_by_lookup_type("display_type")
@sale_data = Array.new
@@ -92,7 +76,7 @@ def get_all_menu
end
def get_credit_sales
credit_sales = Sale.get_credit_sales(params)
credit_sales = SalePayment.get_credit_sales(params)
if !credit_sales.nil?
result = {:status=> true, :data=> credit_sales }
else

View File

@@ -3,8 +3,13 @@ class Origami::JcbController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
@cashier_type = params[:type]
path = request.fullpath
# limit jcb_amount
sale_data = Sale.find_by_sale_id(@sale_id)
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
@jcbcount = 0
@shop = Shop.first
@@ -25,8 +30,13 @@ class Origami::JcbController < 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 == "jcb"
@jcbcount = @jcbcount + sale_payment.payment_amount
else
@@ -66,8 +76,13 @@ class Origami::JcbController < BaseOrigamiController
# end
# saleObj = Sale.find(sale_id)
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, "jcb",ref_no)
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "jcb",ref_no,payment_for)
end
end

View File

@@ -3,8 +3,13 @@ class Origami::MasterController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
@cashier_type = params[:type]
path = request.fullpath
# limit master_amount
sale_data = Sale.find_by_sale_id(@sale_id)
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
@mastercount = 0
@shop = Shop.first
@@ -25,8 +30,13 @@ class Origami::MasterController < BaseOrigamiController
new_total = sale_data.grand_total
end
@rounding_adj = new_total-sale_data.grand_total
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_data.sale_payments.each do |sale_payment|
sale_payment_data.each do |sale_payment|
if sale_payment.payment_method == "master"
@mastercount = @mastercount + sale_payment.payment_amount
else
@@ -63,8 +73,13 @@ class Origami::MasterController < BaseOrigamiController
# end
# saleObj = Sale.find(sale_id)
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, "master",ref_no)
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "master",ref_no,payment_for)
end
end

View File

@@ -2,8 +2,13 @@ class Origami::MpuController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
@cashier_type = params[:type]
path = request.fullpath
# limit mpu_amount
sale_data = Sale.find_by_sale_id(@sale_id)
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
@mpucount = 0
@shop = Shop.first
@@ -18,14 +23,19 @@ class Origami::MpuController < BaseOrigamiController
others = 0
if @shop.is_rounding_adj
if @shop.is_rounding_adj && (!path.include? ("credit_payment"))
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
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 == "mpu"
@mpucount = @mpucount + sale_payment.payment_amount
else
@@ -64,8 +74,13 @@ class Origami::MpuController < BaseOrigamiController
# end
# saleObj = Sale.find(sale_id)
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, "mpu",ref_no)
@status, @sale = sale_payment.process_payment(saleObj, current_user.name, cash, "mpu",ref_no,payment_for)
end
end

View File

@@ -3,7 +3,12 @@ class Origami::OthersPaymentsController < BaseOrigamiController
@membership_rebate_balance = 0
@sale_id = params[:sale_id]
@cashier_type = params[:type]
@payment_method_setting = PaymentMethodSetting.all
path = request.fullpath
if path.include? ("credit_payment")
@payment_method_setting = PaymentMethodSetting.where("LOWER(payment_method) in ('mpu','visa','master','jcb','unionpay','alipay') and is_active='1'")
else
@payment_method_setting = PaymentMethodSetting.all
end
@rebate = MembershipSetting.find_by_rebate(1)
@sale_data = Sale.find_by_sale_id(@sale_id)

View File

@@ -98,135 +98,142 @@ class Origami::PaymentsController < BaseOrigamiController
member_info = nil
type = params[:type]
tax_type = params[:tax_type]
path = request.fullpath
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
sale_items = SaleItem.get_all_sale_items(sale_id)
#shop_detail = Shop.first
# rounding adjustment
if shop_detail.is_rounding_adj
a = saleObj.grand_total % 25 # Modulus
b = saleObj.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
#calculate rounding if modulus is zero or not zero and division are not even
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
if !path.include? ("credit_payment")
if shop_detail.is_rounding_adj
a = saleObj.grand_total % 25 # Modulus
b = saleObj.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
#calculate rounding if modulus is zero or not zero and division are not even
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end
end
end
#end rounding adjustment
sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, current_user.name, cash, "cash")
rebate_amount = nil
# For Cashier by Zone
# bookings = Booking.where("sale_id='#{sale_id}'")
bookings = Booking.find_by_sale_id(sale_id)
if bookings.dining_facility_id.to_i > 0
table = DiningFacility.find(bookings.dining_facility_id)
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
type = 'payment'
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
if path.include? ("credit_payment")
sale_payment.process_payment(saleObj, current_user.name, cash, "cash", nil, true)
else
shift = ShiftSale.find(saleObj.shift_sale_id)
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
sale_payment.process_payment(saleObj, current_user.name, cash, "cash")
end
# For Print
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
unique_code = "ReceiptBillPdf"
if !receipt_bill_a5_pdf.empty?
receipt_bill_a5_pdf.each do |receipt_bilA5|
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
if receipt_bilA5[1] == '1'
unique_code = "ReceiptBillA5Pdf"
else
unique_code = "ReceiptBillPdf"
if !path.include? ("credit_payment")
rebate_amount = nil
# For Cashier by Zone
# bookings = Booking.where("sale_id='#{sale_id}'")
bookings = Booking.find_by_sale_id(sale_id)
if bookings.dining_facility_id.to_i > 0
table = DiningFacility.find(bookings.dining_facility_id)
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
type = 'payment'
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
else
shift = ShiftSale.find(saleObj.shift_sale_id)
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
end
# For Print
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
unique_code = "ReceiptBillPdf"
if !receipt_bill_a5_pdf.empty?
receipt_bill_a5_pdf.each do |receipt_bilA5|
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
if receipt_bilA5[1] == '1'
unique_code = "ReceiptBillA5Pdf"
else
unique_code = "ReceiptBillPdf"
end
end
end
end
end
customer= Customer.find(saleObj.customer_id)
customer= Customer.find(saleObj.customer_id)
# get member information
rebate = MembershipSetting.find_by_rebate(1)
credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
if customer.membership_id != nil && rebate && credit_data.nil?
member_info = Customer.get_member_account(customer)
if member_info["status"] == true
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
current_balance = SaleAudit.paymal_search(sale_id)
end
end
#orders print out
if params[:type] == "quick_service"
booking = Booking.find_by_sale_id(sale_id)
if booking.dining_facility_id.to_i>0
table_id = booking.dining_facility_id
else
table_id = 0
# get member information
rebate = MembershipSetting.find_by_rebate(1)
credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
if customer.membership_id != nil && rebate && credit_data.nil?
member_info = Customer.get_member_account(customer)
if member_info["status"] == true
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
current_balance = SaleAudit.paymal_search(sale_id)
end
end
booking.booking_orders.each do |order|
# Order.pay_process_order_queue(order.order_id, table_id)
oqs = OrderQueueStation.new
oqs.pay_process_order_queue(order.order_id, table_id)
#orders print out
if params[:type] == "quick_service"
booking = Booking.find_by_sale_id(sale_id)
if booking.dining_facility_id.to_i>0
table_id = booking.dining_facility_id
else
table_id = 0
end
booking.booking_orders.each do |order|
# Order.pay_process_order_queue(order.order_id, table_id)
oqs = OrderQueueStation.new
oqs.pay_process_order_queue(order.order_id, table_id)
assign_order = AssignedOrderItem.assigned_order_item_by_job(order.order_id)
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
assign_order = AssignedOrderItem.assigned_order_item_by_job(order.order_id)
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
end
end
#for card sale data
card_data = Array.new
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
if !card_sale_trans_ref_no.nil?
card_sale_trans_ref_no.each do |cash_sale_trans|
card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
card_no = cash_sale_trans.pan.last(4)
card_no = card_no.rjust(19,"**** **** **** ")
card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
end
end
end
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
#for card sale data
card_data = Array.new
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
if !card_sale_trans_ref_no.nil?
card_sale_trans_ref_no.each do |cash_sale_trans|
card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
card_no = cash_sale_trans.pan.last(4)
card_no = card_no.rjust(19,"**** **** **** ")
card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
end
end
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data)
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data)
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
#end
#end
end
end
end
def show
if params[:sale_id]
sale_id = params[:sale_id]
end
path = request.fullpath
sale_id = params[:sale_id]
@cashier_type = params[:type]
if params[:sale_payment_id]
sale_payment_id = params[:sale_payment_id]
@sale_payment = SalePayment.find(params[:sale_payment_id])
sale_id = @sale_payment.sale_id
if path.include? ("credit_payment")
@sale_payment = SalePayment.select("SUM(payment_amount) as payment_amount")
.where("sale_id = ? and payment_method=?", sale_id, "creditnote")
end
@member_discount = MembershipSetting.find_by_discount(1)
@@ -358,7 +365,12 @@ class Origami::PaymentsController < BaseOrigamiController
end
end
@sale_data.sale_payments.each do |spay|
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 |spay|
if spay.payment_method == "cash"
@cash = spay.payment_amount
end

View File

@@ -2,8 +2,13 @@ class Origami::UnionpayController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
@cashier_type = params[:type]
path = request.fullpath
# limit unionpay_amount
sale_data = Sale.find_by_sale_id(@sale_id)
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
@unionpaycount = 0
@shop = Shop.first
@@ -23,8 +28,13 @@ class Origami::UnionpayController < 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 == "unionpay"
@unionpaycount = @unionpaycount + sale_payment.payment_amount
else
@@ -62,8 +72,13 @@ class Origami::UnionpayController < 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, "unionpay",ref_no)
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "unionpay",ref_no,payment_for)
end
end

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