Esempio n. 1
0
	def test001_addAccount(self):
		'''adds an account
		'''
		name="TESTACCOUNT"+str(randint(0,100))
		create_a_thing(Account,[name,100])
			
		self.assertTrue(db.session.query(Account).filter_by(title=name).all()!=[])
Esempio n. 2
0
def adAccount():
	'''adds an account'''
	form=forms.addAccountForm()

	#if request.method=='POST': 
		#the form data has been posted
	if form.validate_on_submit():
		create_a_thing(Account,[form.title.data.lower(),form.entVal.data,form.entDate.data,form.entLow.data])
		return redirect(url_for('welcome'))
	return render_template('budg_Account.html',form=form, edAdd='add')
Esempio n. 3
0
	def test001_addTransfer(self):		
		#create an account
		acc=db.session.query(Account).all()
		if len(acc)<2:
			create_a_thing(Account,["TESTACCOUNT"+str(randint(0,100)),100])
			acc=db.session.query(Account).all()
		acc1=acc[0]
		acc2=acc[1]
		create_a_thing(Transfer,['TestTransfer'+str(randint(0,100)),50,acc1.id,acc2.id,datetime.datetime.today()])

		self.assertTrue(True)
Esempio n. 4
0
def adCashFlow():
	'''add a cashflow to an account'''
	form=forms.addCashFlowForm()
	form.account.choices=[(acc.id,acc.title) for acc in Account.query.order_by('title')]
	if form.validate_on_submit(): 
		create_a_thing(CashFlow,[form.account.data,form.title.data,form.entVal.data,form.sDate.data,\
			form.rType.data,form.rRate.data,form.eDate.data,form.est.data])
			
		return redirect(url_for('welcome'))
	
	return render_template('budg_CashFlow.html',form=form,edAdd="add")
Esempio n. 5
0
def adExpense():
	'''add a single expense to an account'''
	form=forms.addExpenseForm()	#set up theform
	form.account.choices=[(acc.id,acc.title) for acc in Account.query.order_by('title')]
	if form.validate_on_submit(): 
		#if the form data is validated
		create_a_thing(Expense,[form.account.data,form.title.data,form.entVal.data,form.eDate.data])
		return redirect(url_for('welcome'))
	
	#send in the accounts to populate the dropdown menu
	
	return render_template('budg_Expense.html',form=form,edAdd="add")
Esempio n. 6
0
def adTransfer():
	'''add a transfer to two accounts'''
	
	form=forms.transferForm()
	form.f_account.choices=[(acc.id,acc.title) for acc in Account.query.order_by('title')]
	form.t_account.choices=[(acc.id,acc.title) for acc in Account.query.order_by('title')]
	if form.validate_on_submit(): 
		create_a_thing(Transfer,[form.title.data,form.value.data,
			form.f_account.data,form.t_account.data,form.date.data])
			
		return redirect(url_for('welcome'))
	
	return render_template('budg_Transfer.html',form=form,edAdd="add")
Esempio n. 7
0
	def test001_addExpense(self):		
		#create an account
		name="TestExpense"+str(randint(0,100))
		acc=db.session.query(Account).all()[0]
		create_a_thing(Expense,[acc.id,name,5,datetime.datetime.today()])
		self.assertTrue(db.session.query(Expense).filter_by(title=name).all()!=[])