def external_transfer(): if request.method == 'POST': from_acc = request.form['from_acc'] to_bank = request.form['to_bank'] swift = session.query(Banks).filter_by(name=to_bank).first() swift_code = swift.swift_code to_ext_acc = request.form['to_ext_acc'] remark = request.form['remark'] remark += " " + str(swift_code) amount = float(request.form['amount']) if amount > Getters.getCustomerAccountDetails(from_acc).working_bal: flash('Account Balance is Less than Required') return redirect(url_for('banking.external_transfer')) else: TransactionUpdate.externalTransferTransactionUpdate( from_acc, to_ext_acc, amount, remark, Getters.getSysDate().date) # TransactionUpdate.accChargeUpdate('RTGS', from_acc, Getters.getSysDate().date) ChargeTransaction(Getters.getSysDate().date, from_acc).charges(TransactionType.RTGS) flash('RTGS Successful') return redirect(url_for('banking.external_transfer')) else: record = [] # fad = From Account Details # tad = To Account Details fad = None tad = None return render_template('banking/external_transfer.html', fad=fad, tad=tad, record=record, user=Profile().user_details(), banks=Getters.getBanks())
def external_transfer_search(): if request.method == 'POST': acc_num = int(request.form['from_account']) if session.query(Customer).filter_by(acc_number=acc_num).first(): record = session.query(Customer).filter_by( acc_number=acc_num).first() return render_template( 'banking/external_transfer.html', record=Getters.getCustomerAccountDetails(acc_num), user=Profile().user_details(), banks=Getters.getBanks(), fad=Getters.getCustomerAccountDetails(acc_num)) else: flash('The Account Number Provided Is NOT In The System') record = None return render_template('banking/deposits.html', record=record, user=Profile().user_details(), banks=Getters.getBanks()) else: return redirect(url_for('banking.deposits'))