def total():
    transactions = transaction_repository.select_all()
    all_amounts = transaction_repository.total()
    total = sum(all_amounts) / 100
    return render_template("/transactions/total.html",
                           transactions=transactions,
                           total=total)
示例#2
0
def delete_user(id):
    transactions = transaction_repository.select_all()
    user = user_repository.select(id)
    for transaction in transactions:
        if transaction.user.id == user.id:
            transaction_repository.delete(transaction.id)
    user_repository.delete(user.id)
    return redirect("/users")
示例#3
0
def transactions():
    transactions = transaction_repository.select_all()
    total = 0
    for transaction in transactions:
        total += transaction.amount
    return render_template("transactions/index.html",
                           transactions=transactions,
                           total=total)
def transactions():
    transactions = transaction_repository.select_all()
    total_amount = transaction_repository.total_amount()
    user_budget = []
    users = user_repository.select_all()
    for user in users:
        user_budget.append(user.budget)
    sum_total = sum(user_budget)
    track = round((total_amount/sum_total) * 100, 2)
    return render_template("transactions/index.html", transactions=transactions, total_amount=total_amount, track=track)
def edit(id):
    tag = tag_repository.select(id)
    transactions = transaction_repository.select_all()
    total = 0
    for transaction in transactions:
        if transaction.tag.id == tag.id:
            total += transaction.amount
    return render_template("tags/edit.html",
                           tag=tag,
                           transactions=transactions,
                           total=total)
示例#6
0
def transactions():
    all_transactions = transaction_repository.select_all()
    total = transaction_repository.total_amount(all_transactions)
    transactions = transaction_repository.sort_transactions(all_transactions)
    users = user_repository.select_all()
    categorys = category_repository.select_all()
    return render_template("transactions/index.html",
                           transactions=transactions,
                           total=total,
                           categorys=categorys,
                           users=users)
def transactions():
    transactions = transaction_repository.select_all()
    users = user_repository.select_all()
    tags = tag_repository.select_all()
    total_amount = 0.00
    for transaction in transactions:
        total_amount += float(transaction.amount)
    return render_template("transactions/index.html",
                           transactions=transactions,
                           users=users,
                           total_amount=total_amount,
                           tags=tags,
                           title="Transactions")
示例#8
0
def transactions():
    transactions = transaction_repository.select_all()
    total = transaction_repository.total()
    return render_template("transactions/index.html", transactions=transactions, total=total)
示例#9
0
merchant_1 = Merchant("Asda")
merchant_repository.save(merchant_1)
merchant_2 = Merchant("Vodafone")
merchant_repository.save(merchant_2)
merchant_3 = Merchant("Adidas")
merchant_repository.save(merchant_3)

tag_1 = Tag("Finances")
tag_repository.save(tag_1)
tag_2 = Tag("Groceries")
tag_repository.save(tag_2)
tag_3 = Tag("Shopping")
tag_repository.save(tag_3)

transaction_1 = Transaction(50, merchant_1, tag_2)
transaction_repository.save(transaction_1)
transaction_2 = Transaction(65, merchant_3, tag_3)
transaction_repository.save(transaction_2)
transaction_3 = Transaction(20, merchant_2, tag_1)
transaction_repository.save(transaction_3)

merchant_repository.select_all()
tag_repository.select_all()
transaction_repository.select_all()

merchant_1.name = "Tesco"
merchant_repository.update(merchant_1)

tag_1.category = "Bills"
tag_repository.update(tag_1)
示例#10
0
def transactions():
    transactions = transaction_repository.select_all()
    budget = budget_repository.select(1)
    
    total = round(get_total(transactions), 2)
    return render_template("index.html", all_transactions=transactions, total=total, budget=budget)