Exemple #1
0
def projects_index():
    ps = Project.query.all()

    for project in ps:
        project.customer_name = Customer.query.filter_by(
            id=project.customer_id).first().name
        project.budget = float(str(project.budget))
        project.costs = Project.get_costs(project.id)
        project.revenues = Project.get_revenues(project.id)

    return render_template("projects/list.html", projects=ps)
Exemple #2
0
def project(project_id):
    p = Project.query.filter_by(id=project_id).first()

    p.customer_name = Customer.query.filter_by(id=p.customer_id).first().name

    p.budget = float(str(p.budget))
    p.costs = Project.get_costs(project_id)
    p.revenues = Project.get_revenues(project_id)

    cleared_tls = TimeLog.find_cleared_timelogs_by_project(project_id)
    uncleared_tls = TimeLog.find_uncleared_timelogs_by_project(project_id)

    return render_template("projects/view.html",
                           project=p,
                           cleared_timelogs=cleared_tls,
                           uncleared_timelogs=uncleared_tls)
Exemple #3
0
def index():
    projects = Project.find_projects_user_is_assigned_to(current_user.id)

    for project in projects:
        project.customer_name = Customer.query.filter_by(
            id=project.customer_id).first().name
        project.budget = float(str(project.budget))
        project.costs = Project.get_costs(project.id)
        project.revenues = Project.get_revenues(project.id)

    timelogs = TimeLog.query.filter_by(account_id=current_user.id).order_by(
        TimeLog.date_created.desc()).limit(5).all()

    for timelog in timelogs:
        timelog.customer_name = Customer.query.filter_by(
            id=Project.query.filter_by(
                id=timelog.project_id).first().customer_id).first().name
        timelog.project_name = Project.query.filter_by(
            id=timelog.project_id).first().name
        timelog.work_type_name = WorkType.query.filter_by(
            id=timelog.work_type_id).first().name

    return render_template("index.html", projects=projects, timelogs=timelogs)