Beispiel #1
0
	def GET(self, id):
		item = db.get_from_table('invoice', int(id))[0]
		client = db.get_from_table('client', item.client_id)[0]
		form = new.form()
		form.fill({
			'title': item.project_title,
			'description': item.description,
			'client': client.name,
			'date': item.date,
		})
		
		invoice_items = []
		if (db.get_invoice_items(id)[0]):
			invoice_items = db.get_invoice_items(id)
		return render.edit(form, item, self.title, self.type, invoice_items)
Beispiel #2
0
	def POST(self, id):
		item = db.get_from_table('item', int(id))[0]
		form = new.form()
		if not form.validates():
			form.fill(item)
			return render.edit(form, item, self.title, self.type, [])
		db.update('item', id,
			description=form.d.description, 
			rate=form.d.rate, 
			hrs=form.d.hrs, 
			date=form.d.date
		)
		raise web.seeother('/invoices/' + str(item.invoice_id))
Beispiel #3
0
	def POST(self, id):
		form = new.form()
		invoice = db.get_from_table('invoice', int(id))
		if not form.validates():
			return render.edit(invoice, form)
		client = db.get_client_id(form.d.client)
		db.update('invoice', id,
			project_title=form.d.title,
			description=form.d.description,
			client_id=client,
			date=form.d.date
		)
		raise web.seeother('/invoices')
Beispiel #4
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')
Beispiel #5
0
	def POST(self, id):
		client = db.get_from_table('client', int(id))[0]
		form = new.form()
		if not form.validates():
			form.fill(client)
			return render.edit(form, client, self.title, self.type, [])
		db.update('client', id,
			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')
Beispiel #6
0
	def GET(self, id):
		client = db.get_from_table('client', int(id))[0]
		form = new.form()
		form.fill(client)
		return render.edit(form, client, self.title, self.type, [])
Beispiel #7
0
	def GET(self, id):
		item = db.get_from_table('item', int(id))[0]
		form = new.form()
		form.fill(item)
		return render.edit(form, item, self.title, self.type, [])
Beispiel #8
0
	def GET(self, id):
		invoice = db.get_from_table('invoice', int(id))[0]
		client = db.get_from_table('client', invoice.client_id)[0]
		items = db.get_invoice_items(int(id))
		return render_print.print_view(invoice, client, items)
Beispiel #9
0
	def GET(self, id):
		invoice = db.get_from_table('invoice', int(id))[0]
		form = self.form
		form.fill(self.empty)
		return render.add(invoice, form)