budget for 2026
This commit is contained in:
@@ -26,19 +26,26 @@ class bcolors:
|
||||
|
||||
def get_budget_entries(entries, period, start_date):
|
||||
budgets = []
|
||||
seen_accounts = set()
|
||||
seen_accounts = {}
|
||||
for entry in entries:
|
||||
if isinstance(entry, Custom) and entry.values[1].value == period \
|
||||
and entry.date <= date.fromisoformat(start_date):
|
||||
account = entry.values[0].value
|
||||
if account not in seen_accounts:
|
||||
seen_accounts.add(account)
|
||||
seen_accounts[account] = len(budgets)
|
||||
budgets.append({
|
||||
"date": entry.date,
|
||||
"account": account,
|
||||
"period": entry.values[1].value,
|
||||
"budget": entry.values[2].value
|
||||
})
|
||||
else:
|
||||
budgets[seen_accounts[account]] = {
|
||||
"date": entry.date,
|
||||
"account": account,
|
||||
"period": entry.values[1].value,
|
||||
"budget": entry.values[2].value
|
||||
}
|
||||
return budgets
|
||||
|
||||
|
||||
@@ -82,17 +89,18 @@ def build_budget(budget_entries, expenses, equity_amounts, total_positive_expens
|
||||
total_perc = 0
|
||||
remaining = entry["budget"]
|
||||
if entry["account"] in expenses:
|
||||
if expenses[entry["account"]].get_only_position() is not None:
|
||||
expense = expenses[entry["account"]].get_only_position().units
|
||||
|
||||
# Apply equity deductions for specific accounts
|
||||
if entry["account"] == "Expenses:Lloguer" and "Equity:LloguerMiquel" in equity_amounts:
|
||||
equity_amount = equity_amounts["Equity:LloguerMiquel"].get_only_position(
|
||||
)
|
||||
expense = sub(expense, equity_amount.units)
|
||||
elif entry["account"] == "Expenses:FacturesUtilitats" and "Equity:FacturesUtilitatsMiquel" in equity_amounts:
|
||||
equity_amount = equity_amounts["Equity:FacturesUtilitatsMiquel"].get_only_position(
|
||||
)
|
||||
expense = sub(expense, equity_amount.units)
|
||||
# if entry["account"] == "Expenses:Lloguer" and "Equity:LloguerMiquel" in equity_amounts:
|
||||
# equity_amount = equity_amounts["Equity:LloguerMiquel"].get_only_position(
|
||||
# )
|
||||
# expense = sub(expense, equity_amount.units)
|
||||
# elif entry["account"] == "Expenses:FacturesUtilitats" and "Equity:FacturesUtilitatsMiquel" in equity_amounts:
|
||||
# equity_amount = equity_amounts["Equity:FacturesUtilitatsMiquel"].get_only_position(
|
||||
# )
|
||||
# expense = sub(expense, equity_amount.units)
|
||||
|
||||
expense_perc = (expense.number /
|
||||
entry["budget"].number) * 100
|
||||
@@ -161,6 +169,7 @@ def main():
|
||||
Decimal(0), budget_entries[0]["budget"].currency)
|
||||
for entry in budget_entries:
|
||||
if entry["account"] in expenses:
|
||||
if expenses[entry["account"]].get_only_position() is not None:
|
||||
expense = expenses[entry["account"]].get_only_position().units
|
||||
|
||||
# Apply equity deductions for specific accounts (same logic as in build_budget)
|
||||
|
||||
@@ -1,3 +1,34 @@
|
||||
;; BUDGET 2026
|
||||
;; Monthly: 3097.00 EUR
|
||||
;; Yearly: 7699.65 EUR
|
||||
;; Total Yearly Run: 44863.65 EUR
|
||||
;; Total Yearly Net Income: 44868 EUR
|
||||
2026-01-01 custom "budget" Expenses:Lloguer "monthly" 625.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:FacturesUtilitats "monthly" 90.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:Internet "monthly" 50.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:Gasolina "monthly" 50.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:Perruqueria "monthly" 17.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:Supermercat "monthly" 185.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:Parking "monthly" 100.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:Mobilitat "monthly" 170.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:Entreteniment "monthly" 60.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:MenjarFora "monthly" 300.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:Altres "monthly" 200.00 EUR
|
||||
2026-01-01 custom "budget" Liabilities:Credit:Renta4:PolissaCredit "monthly" 1300 EUR
|
||||
|
||||
2026-01-01 custom "budget" Expenses:Roba "yearly" 1000 EUR
|
||||
2026-01-01 custom "budget" Expenses:MantenimentCotxe "yearly" 1200.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:Educació "yearly" 180.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:Medic "yearly" 540.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:Vacances "yearly" 3000.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:Taxes:ImpostCirculacio "yearly" 66.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:NintendoOnline "yearly" 35.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:AmazonPrime "yearly" 50.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:Insurance:Cotxe "yearly" 660.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:CarnetJove "yearly" 8.65 EUR
|
||||
2026-01-01 custom "budget" Expenses:Gimnàs "yearly" 720.00 EUR
|
||||
2026-01-01 custom "budget" Expenses:MarcaPersonal "yearly" 240.00 EUR
|
||||
|
||||
;; BUDGET 2025
|
||||
;; TOTAL:
|
||||
;; Monthly: 3027.00 EUR
|
||||
|
||||
Reference in New Issue
Block a user