Ejemplo n.º 1
0
def expense_by_category():
    results = db.session.query(Category.name.label("Category Name"),
                                Category.description.label("Category Description"),
                                func.sum(Transaction.amount).label("Total Spend")). \
                            outerjoin(TransactionTag). \
                            outerjoin(TransactionToTagMapping). \
                            outerjoin(Transaction). \
                            group_by(Category.name, Category.description)
    results = generate_result_set(results)
    return render_template("report_layout.html", results=results, title="Expense by category")
Ejemplo n.º 2
0
def expense_by_category():
    results = db.session.query(Category.name.label("Category Name"),
                                Category.description.label("Category Description"),
                                func.sum(Transaction.amount).label("Total Spend")). \
                            outerjoin(TransactionTag). \
                            outerjoin(TransactionToTagMapping). \
                            outerjoin(Transaction). \
                            group_by(Category.name, Category.description)
    results = generate_result_set(results)
    return render_template("report_layout.html",
                           results=results,
                           title="Expense by category")
Ejemplo n.º 3
0
def view_table(table_name=None):
    if table_name is None:
        abort(404)
    else:

        results = []

        try:
            table = db.metadata.tables.get(table_name, None)
            query = db.session.query(table)
            results = generate_result_set(query)
        except Exception:
            abort(404)

        if len(results) < 2:
            flash("The table contains no data")

        return render_template("report_layout.html",
                                results=results,
                                title="Table View for {}".format(table_name))
Ejemplo n.º 4
0
def view_table(table_name=None):
    if table_name is None:
        abort(404)
    else:

        results = []

        try:
            table = db.metadata.tables.get(table_name, None)
            query = db.session.query(table)
            results = generate_result_set(query)
        except Exception:
            abort(404)

        if len(results) < 2:
            flash("The table contains no data")

        return render_template("report_layout.html",
                               results=results,
                               title="Table View for {}".format(table_name))