def project(self, id): c.project = Project.load_or_create(id) c.timesheets = Timesheet.for_project(id, unbilled=True) c.title = "Project Summary for %s" % id c.total_time = sum(t.duration for t in c.timesheets) c.total_fee = sum(t.fee for t in c.timesheets) c.invoices = Invoice.for_project(id) return render('/timesheet/project_summary.html')
def date(self, date): c.title = "Log Time for %s" % date c.entry_title = "Timesheets for %s" % date c.date = datetime.datetime.strptime(date, "%Y-%m-%d").date() c.timesheets = Timesheet.for_date(c.date) c.total_time = sum(t.duration for t in c.timesheets) c.total_fee = sum(t.fee for t in c.timesheets) c.project_list = Project.objects() return render('/timesheet/timeform.html')
def view(self, id): invoice = Invoice.load(id) c.invoice = invoice c.project = Project.load_or_create(invoice.project) c.timesheets = Timesheet.for_invoice(id) c.total_time = sum(t.duration for t in c.timesheets) c.total_fee = c.total_time * invoice.rate c.taxes = c.total_fee * invoice.tax * Decimal("0.01") c.after_taxes = c.total_fee + c.taxes return render("/invoice/invoice.html")
def date(self, date): c.title = "Log Time for %s" % date c.entry_title = "Timesheets for %s" % date c.timesheets = Timesheet.for_date(date) # Would it be optimal to do this inside couchdb using a reduce function? c.total_time = sum(t.duration for t in c.timesheets) c.total_fee = sum(t.fee for t in c.timesheets) c.date = datetime.datetime.strptime(date, "%Y-%m-%d").date() c.project_list = Project.project_list() return render('/timesheet/timeform.html')
def index(self): today = datetime.date.today() c.title = "Log Time" c.entry_title = "Uninvoiced Entries" c.timesheets = Timesheet.all_timesheets(unbilled=True) c.total_time = sum(t.duration for t in c.timesheets) c.total_fee = sum(t.fee for t in c.timesheets) c.project_list = Project.project_list() c.date = datetime.date.today() c.delete_column = True return render('/timesheet/timeform.html')
def create_form(self, id): project_name = id c.date = datetime.date.today() c.project = Project.load_or_create(project_name) c.timesheets = Timesheet.for_project(project_name, unbilled=True) c.total_time = sum(t.duration for t in c.timesheets) c.total_fee = c.total_time * c.project.rate c.next_invoice_number = Invoice.next_invoice_number() previous_invoices = Invoice.for_project(project_name) if previous_invoices.rows: c.bill_to = previous_invoices.rows[-1].bill_to return render("/invoice/invoice_form.html")
def index(self): today = datetime.date.today() c.title = "Log Time" c.entry_title = "Uninvoiced Entries" # FIXME: Surely mongoengine knows how to get References by not set? c.timesheets = Timesheet.objects(__raw__={'invoice': None}).order_by( "-date") c.total_time = sum(Decimal(t.duration) for t in c.timesheets) c.total_fee = sum(t.fee for t in c.timesheets) c.project_list = Project.objects() c.date = datetime.date.today() c.delete_column = True return render('/timesheet/timeform.html')
def index(self): today = datetime.date.today() c.title = "Log Time" c.entry_title = "Uninvoiced Entries" # FIXME: Surely mongoengine knows how to get References by not set? c.timesheets = Timesheet.objects(__raw__={ 'invoice': None }).order_by("-date") c.total_time = sum(Decimal(t.duration) for t in c.timesheets) c.total_fee = sum(t.fee for t in c.timesheets) c.project_list = Project.objects() c.date = datetime.date.today() c.delete_column = True return render('/timesheet/timeform.html')
def create(self, id): # yes, the swapping of id is confusing, thanks laziness # from default routes # id = name of the project # invoice.id = invoice number project_name = id project = Project.load_or_create(project_name) invoice = Invoice( project=project_name, id=self.form_result["invoice_number"], bill_to=self.form_result["bill_to"], tax=self.form_result["tax"], date=self.form_result["date"], rate=project.rate, ) invoice.store() timesheets = Timesheet.for_project(project_name, unbilled=True) for timesheet in timesheets: timesheet.invoice = invoice.id timesheet.store() return redirect(url(controller="invoice", action="summary", id=invoice.id))
def list(self): c.projects = Project.objects() return render('/project/project_list.html')
def list(self): c.projects = Project.objects() return render("/project/project_list.html")
def edit(self, id): project = Project.load_or_create(id) project.rate = self.form_result['rate'] project.store() return redirect(url(controller="timesheet", action="index"))
def view(self, id): project = Project.load_or_create(id) c.project = project return render('/project/project_form.html')
def list(self): c.projects = Project.project_list() return render('/project/project_list.html')