Пример #1
0
	def POST(self, id):
		form = self.form()
		invoice = get_from_table('invoice', int(id))
		if not form.validates():
			return render.new(invoice, form)
		db.new('item', 
			description=form.d.description, 
			rate=form.d.rate, 
			hrs=form.d.hrs, 
			date=form.d.date, 
			invoice_id=int(id)
		)
		raise web.seeother('/invoices/' + id)
Пример #2
0
	def POST(self):
		form = self.form()
		if not form.validates():
			title = 'New Invoice'
			type = 'invoice'
			return render.new(form, title, type)
		client = db.get_client_id(form.d.client)
		db.new('invoice', 
			project_title=form.d.title, 
			description=form.d.description, 
			client_id=client, 
			date=form.d.date
		)
		raise web.seeother('/invoices')
Пример #3
0
	def POST(self, id):
		invoice = db.get_from_table('invoice', int(id))[0]
		form = self.form
		if not form.validates():
			form.fill(self.empty)
			return render.add(invoice, form)
		
		db.new('item',
			description=form.d.description,
			rate=float(form.d.rate),
			hrs=float(form.d.hrs),
			date=form.d.date,
			invoice_id=id
		)
		raise web.seeother('/invoices/' + str(id) + '/add')
Пример #4
0
	def POST(self):
		form = self.form()
		if not form.validates():
			type = 'client'
			title = 'New Client'
			return render.new(form, title, type)
		db.new('client', 
			name=form.d.name, 
			address=form.d.address, 
			city=form.d.city, 
			state=form.d.state, 
			zip_code=form.d.zip_code, 
			phone=form.d.phone, 
			email=form.d.email, 
			contact=form.d.contact
		)
		raise web.seeother('/clients')