fix balance sheet report liabilities
This commit is contained in:
@@ -98,7 +98,7 @@ def get_total_liabilites(balances):
|
||||
sum = balance if sum == 0 else sum + balance
|
||||
if sum != 0 and sum.get_only_position() != None:
|
||||
result = sum.get_only_position().units
|
||||
return Amount(Decimal(round(result.number, 2)), result.currency)
|
||||
return Amount(Decimal(round(result.number, 2) * -1), result.currency)
|
||||
else:
|
||||
return Amount(Decimal(0), "EUR")
|
||||
|
||||
@@ -115,7 +115,7 @@ def get_debt_to_assets_ratio(balances, max):
|
||||
liabilities = balance if liabilities == 0 else liabilities + balance
|
||||
total_liabilities = Amount(Decimal(0), "EUR") if liabilities.get_only_position() == None else liabilities.get_only_position().units
|
||||
total_assets = Amount(Decimal(0), "EUR") if assets.get_only_position() == None else assets.get_only_position().units
|
||||
result = round((total_liabilities.number / total_assets.number) * 100, 2)
|
||||
result = round(((total_liabilities.number * -1) / total_assets.number) * 100, 2)
|
||||
return f"{bcolors.FAIL if result >= max else bcolors.OKGREEN}{result} %{bcolors.ENDC}"
|
||||
|
||||
def get_basic_liquidity_ratio(balances, min):
|
||||
@@ -219,12 +219,12 @@ def print_report(date, balances):
|
||||
draw_line()
|
||||
print(f"{bcolors.BOLD}Liabilites{bcolors.ENDC}")
|
||||
print(tabulate([
|
||||
["Hipoteques en vivenda principal", get_position_as_str(balances["Liabilities:Hipoteca:VivendaPrincipal"])],
|
||||
["Hipoteques en vivenda principal", get_position_as_str(balances["Liabilities:Hipoteca:VivendaPrincipal"] * Decimal(-1))],
|
||||
["Hipoteques en vivenda d'inversió", Amount(Decimal(0), "EUR").to_string()],
|
||||
["Crèdit", get_position_as_str(balances["Liabilities:Credit:Caixabank:TargetaCredit"])],
|
||||
["Factures impagades", get_position_as_str(balances["Liabilities:Factures:FacturesPendents"])],
|
||||
["Crèdit", get_position_as_str(balances["Liabilities:Credit:Caixabank:TargetaCredit"] * Decimal(-1))],
|
||||
["Factures impagades", get_position_as_str(balances["Liabilities:Factures:FacturesPendents"] * Decimal(-1))],
|
||||
["Préstecs personals", Amount(Decimal(0), "EUR").to_string()],
|
||||
["Impostos no pagats", get_position_as_str(balances["Liabilities:Taxes:IRPF"])],
|
||||
["Impostos no pagats", get_position_as_str(balances["Liabilities:Taxes:IRPF"] * Decimal(-1))],
|
||||
["Altres passius", Amount(Decimal(0), "EUR").to_string()]
|
||||
]))
|
||||
print(tabulate([
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
Assets:Invest:R4:Vanguard:EMMK 14.99 VANEMMK {181.3768 EUR}
|
||||
Assets:Invest:R4:Fidelity:GLTECH 344.47 FIGLTECH {42.50 EUR}
|
||||
Assets:Invest:R4:Amundi:SUSTINC 11.295 AMNDSUSINC {63.97 EUR}
|
||||
Assets:Benefits:Edenred:TicketsRestaurant 0 EUR
|
||||
Assets:Benefits:Edenred:TicketsRestaurant 1.84 EUR
|
||||
Assets:Benefits:Edenred:TargetaTransport 0 EUR
|
||||
Assets:PersonalProperty:VivendaPrincipal 0 EUR
|
||||
Assets:PersonalProperty:Cotxe 10000 EUR
|
||||
@@ -36,7 +36,7 @@
|
||||
2024-01-01 balance Assets:Invest:R4:BNP:DISTECH 0.359 BNPDISTECH
|
||||
2024-01-01 balance Assets:Invest:R4:PLTR 10 PLTR
|
||||
2024-01-01 balance Assets:Invest:R4:MSFT 4 MSFT
|
||||
2024-01-01 balance Assets:Benefits:Edenred:TicketsRestaurant 0 EUR
|
||||
2024-01-01 balance Assets:Benefits:Edenred:TicketsRestaurant 1.84 EUR
|
||||
2024-01-01 balance Assets:Benefits:Edenred:TargetaTransport 0 EUR
|
||||
2024-01-01 balance Assets:PersonalProperty:VivendaPrincipal 0 EUR
|
||||
2024-01-01 balance Assets:PersonalProperty:Cotxe 10000 EUR
|
||||
@@ -72,7 +72,7 @@
|
||||
2024-02-01 balance Assets:Invest:R4:BNP:DISTECH 0.359 BNPDISTECH
|
||||
2024-02-01 balance Assets:Invest:R4:PLTR 10 PLTR
|
||||
2024-02-01 balance Assets:Invest:R4:MSFT 4 MSFT
|
||||
2024-02-01 balance Assets:Benefits:Edenred:TicketsRestaurant 209 EUR
|
||||
2024-02-01 balance Assets:Benefits:Edenred:TicketsRestaurant 210.84 EUR
|
||||
2024-02-01 balance Assets:Benefits:Edenred:TargetaTransport 40 EUR
|
||||
2024-02-01 balance Assets:PersonalProperty:VivendaPrincipal 0 EUR
|
||||
2024-02-01 balance Assets:PersonalProperty:Cotxe 10000 EUR
|
||||
|
||||
Reference in New Issue
Block a user