|
@@ -2,8 +2,8 @@ import pandas as pd
|
|
|
import numpy as np
|
|
|
from pathlib import Path
|
|
|
|
|
|
-
|
|
|
-export_dir = '/home/robert/Dropbox/Jugendchor 2000/Kasse/2020/Export'
|
|
|
+year = '2021'
|
|
|
+export_dir = f'/home/robert/Dropbox/Jugendchor 2000/Kasse/{year}/Export'
|
|
|
kst = {'3115532': '0', '3123981': '1', '3124005': '2', '3123999': '3', '3124039': '4', '3123973': '5', '3124013': '6'}
|
|
|
from_label = ['Buchungstag', 'Internet', 'Verwendungszweckzeile 1', 'Kommentar', 'KST',
|
|
|
'Verwendungszweckzeile 3', 'Verwendungszweckzeile 4', 'Verwendungszweckzeile 5',
|
|
@@ -18,14 +18,19 @@ def import_csv(filename):
|
|
|
df['Einnahmen'] = np.where(df['Betrag'] > 0, df['Betrag'], 0)
|
|
|
df['Ausgaben'] = np.where(df['Betrag'] < 0, 0 - df['Betrag'], 0)
|
|
|
df['KST'] = kst[kto]
|
|
|
- first_saldo = df.loc[0]['Saldo']
|
|
|
- last_saldo = df.loc[len(df)-1]['Saldo']
|
|
|
+ first_saldo = df.loc[0]['Saldo'] - df.loc[0]['Betrag']
|
|
|
+ last_saldo = df.loc[len(df) - 1]['Saldo']
|
|
|
df = df[df['Betrag'] != 0]
|
|
|
df['row_num'] = np.arange(1, len(df) + 1)
|
|
|
df = df[from_label]
|
|
|
print(df.shape)
|
|
|
- df = pd.DataFrame([['01.01.2020', '', 'Anfangsbestand - SLS ' + kto, 'AB', kst[kto], '', '', '', 0, first_saldo, 0]], columns=from_label).append(df).append(
|
|
|
- pd.DataFrame([['31.12.2020', '', 'Endbestand - SLS ' + kto, 'EB', kst[kto], '', '', '', len(df) + 1, last_saldo, 0]], columns=from_label))
|
|
|
+ first_row = [f'01.01.{year}', '', 'Anfangsbestand - SLS ' + kto, 'AB', kst[kto], '', '', '', 0, first_saldo, 0]
|
|
|
+ last_row = [f'31.12.{year}', '', 'Endbestand - SLS ' + kto, 'EB', kst[kto], '', '', '', len(df) + 1, last_saldo, 0]
|
|
|
+ df = pd.concat([
|
|
|
+ pd.DataFrame([first_row], columns=from_label),
|
|
|
+ df,
|
|
|
+ pd.DataFrame([last_row], columns=from_label)
|
|
|
+ ])
|
|
|
print(df.shape)
|
|
|
return df
|
|
|
|