def create_form(self, id): project_name = id c.date = datetime.date.today() c.project = Project.objects.get(name=project_name) c.timesheets = Timesheet.objects(project=c.project, __raw__={"invoice": None}) 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.objects(project=c.project) if previous_invoices.count(): c.bill_to = previous_invoices[previous_invoices.count() - 1].bill_to return render("/invoice/invoice_form.html")
def project(self, id): c.project = Project.objects.get(name=id) c.timesheets = Timesheet.objects(project=c.project, __raw__={'invoice': None}).order_by("-date") 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.objects(project=c.project) c.invoice_totals = {'duration': 0, 'fee': 0, 'total': 0} for i in c.invoices: c.invoice_totals['duration'] += i.total_duration() c.invoice_totals['fee'] += i.total_fee() c.invoice_totals['total'] += i.total() return render('/timesheet/project_summary.html')
def create_form(self, id): project_name = id c.date = datetime.date.today() c.project = Project.objects.get(name=project_name) c.timesheets = Timesheet.objects(project=c.project, __raw__={'invoice': None}) 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.objects(project=c.project) if previous_invoices.count(): c.bill_to = previous_invoices[previous_invoices.count() - 1].bill_to return render("/invoice/invoice_form.html")
def project(self, id): c.project = Project.objects.get(name=id) c.timesheets = Timesheet.objects(project=c.project, __raw__={ 'invoice': None }).order_by("-date") 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.objects(project=c.project) c.invoice_totals = {'duration': 0, 'fee': 0, 'total': 0} for i in c.invoices: c.invoice_totals['duration'] += i.total_duration() c.invoice_totals['fee'] += i.total_fee() c.invoice_totals['total'] += i.total() return render('/timesheet/project_summary.html')
def list(self): c.invoices = Invoice.objects(number__ne=-1).order_by('-number') return render("/invoice/invoice_list.html")
def list(self): c.invoices = Invoice.objects(number__ne=-1).order_by("-number") return render("/invoice/invoice_list.html")