def view_account_statement_date(): if session.get('userId') and session.get('roleId')=="2222": acct_id=request.form.get('ws_acct_id') start_date=request.form.get('start_date') start_date=datetime.strptime(start_date,'%Y-%m-%d') start_date1=dateutil.parser.parse(str(start_date)).date() end_date=request.form.get('end_date') end_date=datetime.strptime(end_date,'%Y-%m-%d') end_date1=dateutil.parser.parse(str(end_date)).date() print(start_date) print('from form') print(type(start_date)) print(end_date) print('from form') print(type(end_date)) data=[] Transactions=Transaction.objects(ws_acct_id=acct_id) for x in Transactions: print(x.ws_trxn_date) print(type(x.ws_trxn_date)) if(x.ws_trxn_date >= start_date1 and x.ws_trxn_date <= end_date1): print('in') data.append(x) return render_template('view_account_statement.html',Transactions=data,ws_acct_id=acct_id,start_date=start_date1,end_date=end_date1) else: flash("Sorry You are not authorised to access this page","danger") return redirect("/")
def generate_Transaction_Id(): st="50" num2=random.randint(1000000,9999999) transaction_id=int(st+str(num2)) transaction=Transaction.objects(ws_transaction_id=transaction_id).first() if transaction: generate_Transaction_Id() return str(transaction_id)
def view_account_statement_number(): if session.get('userId') and session.get('roleId')=="2222": acct_id=request.form.get('ws_acct_id') number= request.form.get('number_of_Transactions') Transactions=Transaction.objects(ws_acct_id=acct_id) tra=Transactions.order_by('-ws_trxn_date').limit(int(number)) return render_template('view_account_statement.html',Transactions=tra,ws_acct_id=acct_id,records=number) else: flash("Sorry You are not authorised to access this page","danger") return redirect("/")