Initial commit - Stand 26.04.2026
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import psycopg2
|
||||
|
||||
conn = psycopg2.connect(
|
||||
host='localhost', port=5432, database='buchhaltung',
|
||||
user='postgres', password='postgres'
|
||||
)
|
||||
cur = conn.cursor()
|
||||
|
||||
print('=== NEBENKOSTEN VERIFIZIERUNG ===\n')
|
||||
|
||||
cur.execute("""
|
||||
SELECT jahr, mieter, wohnung,
|
||||
nebenkosten, versicherung, heizkosten, wasser, muell, sonstiges
|
||||
FROM nebenkosten
|
||||
WHERE jahr BETWEEN 2020 AND 2024
|
||||
ORDER BY jahr, mieter
|
||||
""")
|
||||
|
||||
total_sum = 0
|
||||
for row in cur.fetchall():
|
||||
print(f'{row[0]} - {row[1]} ({row[2]})')
|
||||
print(f' Nebenkosten: {float(row[3]):.2f} EUR')
|
||||
print(f' Versicherung: {float(row[4] or 0):.2f} EUR')
|
||||
print(f' Heizkosten: {float(row[5] or 0):.2f} EUR')
|
||||
print(f' Wasser: {float(row[6] or 0):.2f} EUR')
|
||||
print(f' Muell: {float(row[7] or 0):.2f} EUR')
|
||||
print(f' Sonstiges: {float(row[8] or 0):.2f} EUR')
|
||||
total_sum += float(row[3])
|
||||
print()
|
||||
|
||||
print(f'Gesamtsumme aller Nebenkosten 2020-2024: {total_sum:.2f} EUR')
|
||||
|
||||
cur.close()
|
||||
conn.close()
|
||||
print('\nImport erfolgreich verifiziert!')
|
||||
Reference in New Issue
Block a user