def onl_validatin(request): if 'amount' in request.GET and request.GET['amount']: cid=request.GET['id'] ttid=request.GET['taxtype'] a=request.GET['amount'] custname=request.GET['name'] accno=request.GET['accno'] assyear=request.GET['ayear'] amount=request.GET['amount'] pin=request.GET['pin'] custac = Accounts_dummy.objects.get(account_number=accno) #c=custac. #s=int(custac)==int(pin) #assert False now = datetime.datetime.now() if int(custac.ATM_PIN)==int(pin): p=Online_Transaction_dummy.objects.create(account_number_id=custac.account_number,amount_paid=amount) p.save() p1=Tax_transaction(customer_id_id=cid,account_number_id=accno,tax_type_id_id=ttid,transaction_id_id=p.transaction_id,date=now,amount_paid=amount,asses_year=assyear) p1.save() custac.amount=custac.amount-float(amount) custac.save() return render_to_response('done.html',locals()) else: return HttpResponseRedirect('homePage2/') else: return HttpResponse('Please enter Amount')
def onl_validatin(request): if 'amount' in request.POST and request.POST['amount']: cid=request.POST['id'] ttid=request.POST['taxtype'] a=request.POST['amount'] custname=request.POST['name'] accno=request.POST['accno'] assyear=request.POST['ayear'] amount=request.POST['amount'] pin=request.POST['pin'] try: custac = Accounts_dummy.objects.get(account_number=accno) except: error="Account number not in database" return render_to_response('error.html',locals()) #c=custac. #s=int(custac)==int(pin) #assert False now = datetime.datetime.now() if int(custac.ATM_PIN)==int(pin): ##Creating a new Online Transaction Object/Row pertaining to the tax transaction just made p=Online_Transaction_dummy.objects.create(account_number_id=custac.account_number,amount_paid=amount) p.save() ##Creating a new Tax transaction Object/Row pertaining to the tax transaction just made p1=Tax_transaction(customer_id_id=cid,account_number_id=accno,tax_type_id_id=ttid,transaction_id_id=p.transaction_id,date=now,amount_paid=amount,asses_year=assyear) p1.save() ##Deducting appropriate money from the Customer Account custac.amount=custac.amount-float(amount) custac.save() return render_to_response('done.html',locals()) else: ##Saving the error so that it can be showed in the rendered HTML page error="Invalid PIN Entered.Try Again" return render_to_response('error.html',locals()) else: return HttpResponse('Please enter Amount')