def deposits(): record = None if request.method == 'POST': if Verify.till_is_linked(login_session['username']): cr_account_number = int(request.form['client_account']) if Verify.account_exists(cr_account_number): system_date = Getters.getSysDate( ).date # use system date for transactions dep_ref = request.form['deposit_ref'] amount = float(request.form['deposit_amount']) AccountTransaction( date=system_date, amount=amount, cr_account=cr_account_number).deposit(dep_ref) TransactionUpdate.ttUpdate(TransactionType.DEBIT, amount, system_date, dep_ref, cr_account_number) flash('Account Credited') return redirect( url_for('banking.deposits', user=Profile().user_details())) else: flash('Account Cannot be found: Search again') return redirect( url_for('banking.deposits', user=Profile().user_details())) else: flash('User is NOT linked to Any Till. Please Open a Till First') return redirect(url_for('banking.deposits')) else: return render_template('banking/deposits.html', record=record, user=Profile().user_details())
def amend_cus(): record = None if request.method == 'POST': acc_num = int(request.form['acc_number']) if Verify.account_exists(acc_num): a_record = session.query(Customer).filter_by( acc_number=acc_num).one() if request.form['first_name'] == a_record.first_name: pass else: a_record.first_name = request.form['first_name'] if request.form['last_name'] == a_record.last_name: pass else: a_record.last_name = request.form['last_name'] if request.form['dob'] == a_record.dob: pass else: a_record.dob = request.form['dob'] if request.form['gender'] == a_record.gender: pass else: a_record.gender = request.form['gender'] if request.form['contact_number'] == a_record.contact_number: pass else: a_record.contact_number = int(request.form['contact_number']) if request.form['email'] == a_record.email: pass else: a_record.email = request.form['email'] if request.form['address'] == a_record.address: pass else: a_record.address = request.form['address'] if request.form['country'] == a_record.country: pass else: a_record.country = request.form['country'] if request.form['account_type'] == a_record.account_type: pass else: a_record.account_type = request.form['account_type'] a_record.create_date = a_record.create_date session.add(a_record) session.commit() return redirect( url_for('customer.my_cus', user=Profile().user_details())) else: flash('Account Cannot be modified, Search Again') record = None return redirect(url_for('customer.amend_cus')) else: return render_template('customer/amend_cus.html', record=record, user=Profile().user_details(), account=Getters.getAccountType())
def add_cus(): new_account = Auto().account_number_generator() # name = request.form['first_name'] if request.method == 'POST': first_name = request.form['first_name'] last_name = request.form['last_name'] dob = request.form['dob'] gender = request.form['gender'] contact_number = request.form['contact_number'] email = request.form['email'] address = request.form['address'] country = request.form['country'] acc_number = request.form['acc_number'] initial_deposit = request.form['working_bal'] if initial_deposit == "": working_bal = float(0) else: working_bal = float(initial_deposit) account_type = request.form['account_type'] CustomerController( first_name=first_name, last_name=last_name, dob=dob, gender=gender, contact_number=contact_number, email=email, address=address, country=country, new_account=new_account, working_bal=working_bal, account_type=account_type, inputter_id=Profile().user_details().uid).create_customer() result = AccountTransaction(date=time.strftime('%Y-%m-%d'), amount=working_bal, cr_account=new_account).create_account() if result == 0: flash("account Creation Failed") else: flash("Account Created Successfully") return redirect(url_for('customer.my_cus')) else: return render_template('customer/add_cus.html', new_account=new_account, user=Profile().user_details(), account=Getters.getAccountType())
def account_search(): if request.method == 'POST': acc_num = int(request.form['account_number']) record = Search.search_by_account(acc_num) if record is not None: return render_template('banking/deposits.html', record=record, user=Profile().user_details()) else: flash('The Account Number Provided Is NOT In The System') return render_template('banking/deposits.html', record=record, user=Profile().user_details()) else: return redirect(url_for('banking.deposits'))
def till_details(self): _teller_id_list = [i.id for i in self.teller_list] _profile_id = Profile().user_details().uid if _profile_id in _teller_id_list: return session.query(Till).filter_by(user_id=_profile_id).first() else: return []
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 transfer(): if request.method == 'POST': from_acc = request.form['from_acc'] to_acc = request.form['to_acc'] remark = request.form['remark'] amount = float(request.form['amount']) if amount > Getters.getCustomerAccountDetails(from_acc).working_bal: flash('The Account ' + from_acc + ' has no overdraft facility ') return redirect(url_for('banking.transfer')) else: TransactionUpdate.transferTransactionUpdate( from_acc, to_acc, amount, remark, Getters.getSysDate().date) # TransactionUpdate.accChargeUpdate('TR', from_acc, Getters.getSysDate().date) ChargeTransaction(Getters.getSysDate().date, from_acc).charges(TransactionType.TRANSFER) flash('Transfer Successful') return redirect(url_for('banking.transfer')) else: record = [] fad = None tad = None return render_template('banking/transfer.html', user=Profile().user_details(), record=record, fad=fad, tad=tad)
def reversal_teller(): record = None if request.method == 'POST': pass else: return render_template('reconciliation/teller_reversal.html', record=record, user=Profile().user_details())
def statement(): start_date, end_date = '', '' date_time = time.strftime('%Y-%m-%d') return render_template('banking/statement.html', record=None, stmt=[], dt=date_time, sd=start_date, ed=end_date, user=Profile().user_details())
def account_search(): if request.method == 'POST': acc_num = int(request.form['account_number']) 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('customer/amend_cus.html', record=record, user=Profile().user_details(), account=Getters.getAccountType()) else: flash('The Account Number Provided Is NOT In The System') record = None return render_template('customer/amend_cus.html', record=record, user=Profile().user_details()) else: return redirect( url_for('customer.amend_cus', user=Profile().user_details()))
def id_search(): if request.method == 'POST': id_num = int(request.form['customer_id']) if session.query(Customer).filter_by(custid=id_num).first(): record = session.query(Customer).filter_by(custid=id_num).first() return render_template('customer/amend_cus.html', record=record, user=Profile().user_details(), account=Getters.getAccountType()) else: flash('The Customer System ID Provided Is NOT Valid') record = None return render_template('customer/amend_cus.html', record=record, user=Profile().user_details()) else: flash('Failed to go through the IF STMT') return redirect( url_for('customer.amend_cus', user=Profile().user_details()))
def bulk_salaries(): record = [] if request.method == 'POST': file_name = secure_filename(request.files['salary_file'].filename) # load the file from the form file = request.files['salary_file'] if file and allowed_file(file.filename): filename = secure_filename(file.filename) # Upload the file in the in the folder file.save(os.path.join(UPLOAD_FOLDER, filename)) location_and_name = os.path.join(UPLOAD_FOLDER, filename) with open('Uploads\\' + filename, 'r') as f: # f_contents = f.readline() for line in f: record_line = line.split(',') from_acc = int(record_line[0]) to_acc = int(record_line[1]) amount = float(record_line[2]) remark = record_line[3] print(record_line) TransactionUpdate.transferTransactionUpdate( from_acc, to_acc, amount, remark, Getters.getSysDate().date) ChargeTransaction(Getters.getSysDate().date, from_acc).charges( TransactionType.TRANSFER) # print(line, end='') flash("uploaded and posted") else: flash("Please Check file extension") return redirect(url_for('bulk.bulk_salaries')) return render_template('bulk/bulk_salaries.html', record=record, user=Profile().user_details()) else: return render_template('bulk/bulk_salaries.html', record=record, user=Profile().user_details())
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'))
def with_account_search(): if request.method == 'POST': acc_num = int(request.form['account_number']) record = Search.search_by_account(acc_num) if record is not None: return render_template('banking/withdrawal.html', record=record, user=Profile().user_details()) else: flash('The Account Number Provided Is NOT In The System') return render_template('banking/withdrawal.html', record=record, user=Profile().user_details()) # 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/withdrawal.html', record=record, user_view=Profile().user_details()) # else: # flash('The Account Number Provided Is NOT In The System') # record = None # return render_template('banking/withdrawal.html', record=record, user_view=Profile().user_details()) else: return redirect(url_for('banking.withdrawal'))
def stmt_print(account, start_date, end_date): dt = Getters.getSysDate().date # time.strftime('%Y-%m-%d') acc_num = int(account) start_date = start_date end_date = end_date # record = session.query(Customer).filter_by(acc_number=acc_num).first() record, statement_records = Search.search_stmt_transactions( acc_num, start_date, end_date) return render_template('banking/stmt_printed.html', record=record, stmt=statement_records, dt=dt, sd=start_date, ed=end_date, user=Profile().user_details())
def withdrawal(): record = None if request.method == 'POST': if Verify.till_is_linked(login_session['username']): acc_num = int(request.form['client_account']) if Verify.account_exists(acc_num): date = Getters.getSysDate().date # time.strftime('%Y-%m-%d') dep_ref = request.form['withdrawal_ref'] ref = Auto.reference_string_generator() amount = float(request.form['withdrawal_amount']) # TransactionUpdate.withdrawalTransactionUpdate(date, acc_num, amount, ref) AccountTransaction(date, amount, acc_num).withdrawal(ref) # TransactionUpdate.accChargeUpdate(TransactionType.CREDIT, acc_num, date) ChargeTransaction(date, acc_num).charges(TransactionType.CREDIT) TransactionUpdate.ttUpdate(TransactionType.CREDIT, amount, date, dep_ref, acc_num) flash('Account Debited') return redirect( url_for('banking.withdrawal', user=Profile.user_details())) else: flash('Account Cannot be found: Search again') return redirect( url_for('banking.withdrawal', user=Profile.user_details())) else: flash('User is not linked to Any Till. Please Open a Till First') return redirect( url_for('banking.withdrawal', user=Profile().user_details())) else: return render_template('banking/withdrawal.html', record=record, user=Profile().user_details())
def stmt_search(): dt = Getters.getSysDate().date # time.strftime('%Y-%m-%d') start_date = '' end_date = '' if request.method == 'POST': acc_num = int(request.form['account_number']) start_date = request.form['start_date'] end_date = request.form['end_date'] record, statement_records = Search.search_stmt_transactions( acc_num, start_date, end_date) if record is not None and statement_records: return render_template('banking/statement.html', record=record, stmt=statement_records, dt=dt, sd=start_date, ed=end_date, user=Profile().user_details()) else: flash('The Account Number Provided Is NOT In The System') return render_template('banking/statement.html', record=record, stmt=statement_records, dt=dt, sd=start_date, ed=end_date, user=Profile().user_details()) else: return redirect( url_for('banking.statement', dt=dt, sd=start_date, ed=end_date, user=Profile().user_details()))
def transfer_search(): if request.method == 'POST': from_account = request.form['from_account'] to_account = request.form['to_account'] if from_account == to_account: flash('The Accounts submitted are the same') return redirect(url_for('banking.transfer')) if Verify.account_exists(from_account): if Verify.account_exists(to_account): record = [from_account, to_account] return render_template( 'banking/transfer.html', user=Profile().user_details(), record=record, fad=Getters.getCustomerAccountDetails(from_account), tad=Getters.getCustomerAccountDetails(to_account)) else: flash('To Account number is not valid') return redirect(url_for('banking.transfer')) else: flash('from account is not valid') return redirect(url_for('banking.transfer'))
def account_reset(): record = [] return render_template('enquiry/account_reset.html', record=record, user=Profile().user_details())
def bulk_transfers(): record = [] return render_template('bulk/bulk_transfers.html', record=record, user=Profile().user_details())
def authorise_cus(): return render_template('customer/authorise.html', user=Profile().user_details())
def my_cus(): all_customer = session.query(Customer).all() return render_template('customer/my_cus.html', customer=all_customer, user=Profile().user_details())
def stmt_drill_down(ft_reference): # record = [] record = Getters.getTransactionDetails(ft_reference) return render_template('enquiry/stmt_drilldown.html', record=record, user=Profile().user_details())
def teller_status(self): mylist = [i.user_id for i in self.teller_list] if Profile().user_details().uid in mylist: return True
def teller_transactions(): record = None return render_template('reconciliation/teller_transactions.html', my_tt=Getters.getAllTts(), record=record, user=Profile().user_details())