Cleanup and formatting

This commit is contained in:
fleaz 2023-02-24 00:07:01 +01:00
parent 50d4f066e3
commit 3c5fc31778
No known key found for this signature in database
GPG key ID: AED15F8FDD04D083
6 changed files with 22 additions and 24 deletions

View file

@ -4,9 +4,6 @@ import sys
import click
import colorful as cf
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from schmeckels.helper import create_tag, get_rules, get_session
from schmeckels.models import Tag, Transaction

View file

@ -54,8 +54,8 @@ class Sparkasse_MT940(Bank):
data = t.data
date = data["date"]
amount = int(data["amount"].amount * 100)
iban = data.get("applicant_iban","")
name = data.get("applicant_name","")
iban = data.get("applicant_iban", "")
name = data.get("applicant_name", "")
description = data["purpose"]
yield models.Transaction(date=date, name=name, iban=iban, amount=amount, description=description)

View file

@ -8,7 +8,7 @@ from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from schmeckels import autosort, importer, info, models, serve, sort, validate, stats, restart
from schmeckels import autosort, importer, info, models, restart, serve, sort, stats, validate
from schmeckels.helper import build_database_filename, build_rules_filename, get_data_dir
__version__ = "0.0.1"

View file

@ -4,7 +4,7 @@ import sys
import click
from sqlalchemy import create_engine
from schmeckels.helper import build_database_filename, build_rules_filename, get_data_dir, get_session, get_rules
from schmeckels.helper import build_database_filename, build_rules_filename, get_data_dir, get_rules, get_session
from schmeckels.models import Tag, Transaction

View file

@ -20,7 +20,7 @@ def command():
print("Found {} unsorted transcations".format(len(unsorted)))
for t in unsorted:
print("-"*20)
print("-" * 20)
print(" Name: {}".format(t.name))
print(" IBAN: {}".format(t.iban))
print(" Datum: {}".format(t.date))

View file

@ -1,12 +1,13 @@
#! /usr/bin/env python3
from sqlalchemy import create_engine
from schmeckels.models import Tag, Transaction
from schmeckels.helper import format_amount, get_session
import click
from datetime import date, datetime
from math import floor
from datetime import datetime, date
from sqlalchemy import func, and_
import click
from dateutil.relativedelta import relativedelta
from sqlalchemy import and_, create_engine, func
from schmeckels.helper import format_amount, get_session
from schmeckels.models import Tag, Transaction
@click.command(name="stats")
@ -20,8 +21,8 @@ def command():
# Get start and end of timerange
year = 2022
start_date = date(year=year,month=1,day=1)
end_date = date(year=year,month=12,day=31)
start_date = date(year=year, month=1, day=1)
end_date = date(year=year, month=12, day=31)
for tag in tags:
if tag.name.find(":") < 0 and tag.name != "Privatentnahme":
@ -58,24 +59,24 @@ def command():
# Ausgaben
for name, data in outgoing.items():
print(" {:<30} {:>10}".format(name.name, data['sum']))
print("-"*44)
print(" {:<30} {:>10}".format(name.name, data["sum"]))
print("-" * 44)
print(" {:<30} {:>10}".format("AUSGABEN", format_amount(sum_outgoing)))
print("\n")
# Einnahmen
for name, data in incoming.items():
print(" {:<30} {:>10}".format(name.name, data['sum']))
print("-"*44)
print(" {:<30} {:>10}".format(name.name, data["sum"]))
print("-" * 44)
print(" {:<30} {:>10}".format("EINNAHMEN", format_amount(sum_incoming)))
print("\n")
# Entnahmen
for name, data in withdrawal.items():
print(" {:<30} {:>10}".format(name.name, data['sum']))
print("-"*44)
print(" {:<30} {:>10}".format(name.name, data["sum"]))
print("-" * 44)
print(" {:<30} {:>10}".format("ENTNAHME", format_amount(sum_withdrawal)))
print("\n")
print("="*44)
print(" {:<30} {:>10}".format("GEWINN", format_amount(sum_incoming+sum_outgoing)))
print("=" * 44)
print(" {:<30} {:>10}".format("GEWINN", format_amount(sum_incoming + sum_outgoing)))