|
@@ -202,15 +202,17 @@ class GCStruct():
|
|
df_temp = pd.DataFrame([x['id'].split(';') for x in entries], columns=cols)
|
|
df_temp = pd.DataFrame([x['id'].split(';') for x in entries], columns=cols)
|
|
self.json_result['struct_export'][s] = df_temp.to_dict(orient='records')
|
|
self.json_result['struct_export'][s] = df_temp.to_dict(orient='records')
|
|
|
|
|
|
- # json.dump(self.json_result, open(f"{self.config['path2']}/{self.config['output']}", 'w'), indent=2)
|
|
|
|
- return df
|
|
|
|
|
|
+ # {'accounts': {}, 'tree': {}, 'flat': {}, 'struct_export': {}, 'skr51_vars': {}}
|
|
|
|
+ json.dump(self.json_result, open(f"{self.config['path2']}/{self.config['output']}", 'w'), indent=2)
|
|
|
|
+ return self.json_result
|
|
|
|
|
|
def get_accounts(self, structure, id):
|
|
def get_accounts(self, structure, id):
|
|
- res = self.structure_ids.groups.get((structure, id))
|
|
|
|
- if res is None:
|
|
|
|
- return []
|
|
|
|
- return res.values
|
|
|
|
- # return [x['Konto_Nr'] for x in self.json_result['accounts'] if x[structure] == id]
|
|
|
|
|
|
+ return [x['Konto_Nr'] for x in self.json_result['accounts'] if x[structure] == id]
|
|
|
|
+ # return []
|
|
|
|
+ # res = self.structure_ids.groups.get((structure, id))
|
|
|
|
+ # if res is None:
|
|
|
|
+ # return []
|
|
|
|
+ # return res.values
|
|
|
|
|
|
def export(self):
|
|
def export(self):
|
|
for s in self.config['export'].keys():
|
|
for s in self.config['export'].keys():
|
|
@@ -347,14 +349,14 @@ class GCStruct():
|
|
df_source = pd.read_csv(accounts_combined_file, decimal=',', sep=';', encoding='latin-1',
|
|
df_source = pd.read_csv(accounts_combined_file, decimal=',', sep=';', encoding='latin-1',
|
|
converters={i: str for i in range(0, 200)})
|
|
converters={i: str for i in range(0, 200)})
|
|
df_source = df_source[df_source['Konto_Nr'].str.contains('_STK') == False]
|
|
df_source = df_source[df_source['Konto_Nr'].str.contains('_STK') == False]
|
|
- df_source['Konto_Nr_Gesamt'] = df_source['Konto_Nr']
|
|
|
|
|
|
+ df_source['Konto_Nr_Gesamt'] = df_source['Konto_Nr']
|
|
df_source['Konto_Nr'] = np.where(df_source['Konto_Nr'].str.contains(r'^[4578]'), df_source['Konto_Nr'] + '_' +
|
|
df_source['Konto_Nr'] = np.where(df_source['Konto_Nr'].str.contains(r'^[4578]'), df_source['Konto_Nr'] + '_' +
|
|
df_source['Kostenstelle'].str.slice(stop=1), df_source['Konto_Nr'])
|
|
df_source['Kostenstelle'].str.slice(stop=1), df_source['Konto_Nr'])
|
|
df_source['Konto_Nr'] = np.where(df_source['Konto_Nr'].str.contains(r'^5\d+_4'), df_source['Konto_Nr'] +
|
|
df_source['Konto_Nr'] = np.where(df_source['Konto_Nr'].str.contains(r'^5\d+_4'), df_source['Konto_Nr'] +
|
|
df_source['Kostenstelle'].str.slice(start=1, stop=2), df_source['Konto_Nr'])
|
|
df_source['Kostenstelle'].str.slice(start=1, stop=2), df_source['Konto_Nr'])
|
|
|
|
|
|
df_source = df_source.merge(df, how='left', on=['Konto_Nr'])
|
|
df_source = df_source.merge(df, how='left', on=['Konto_Nr'])
|
|
- rows = df_source.shape[0]
|
|
|
|
|
|
+ # rows = df_source.shape[0]
|
|
df_source['value'] = ''
|
|
df_source['value'] = ''
|
|
|
|
|
|
cols = get_default_cols(0)
|
|
cols = get_default_cols(0)
|
|
@@ -424,12 +426,11 @@ class GCStruct():
|
|
df_source['Konto_KST'] = ''
|
|
df_source['Konto_KST'] = ''
|
|
df_source['GuV_Bilanz'] = df_source['Konto_Art']
|
|
df_source['GuV_Bilanz'] = df_source['Konto_Art']
|
|
|
|
|
|
-
|
|
|
|
from_label = ['Konto_neu', 'Konto_Nr_Händler']
|
|
from_label = ['Konto_neu', 'Konto_Nr_Händler']
|
|
to_label = ['Konto', 'Acct_Nr']
|
|
to_label = ['Konto', 'Acct_Nr']
|
|
|
|
|
|
df_source = df_source.rename(columns=dict(zip(from_label, to_label)))
|
|
df_source = df_source.rename(columns=dict(zip(from_label, to_label)))
|
|
-
|
|
|
|
|
|
+
|
|
df_source = df_source[['Konto', 'Acct_Nr', 'Konto_Bezeichnung', 'GuV_Bilanz', 'Konto_KST', 'Konto_STK',
|
|
df_source = df_source[['Konto', 'Acct_Nr', 'Konto_Bezeichnung', 'GuV_Bilanz', 'Konto_KST', 'Konto_STK',
|
|
'Konto_1', 'Konto_2', 'Konto_3', 'Konto_4', 'Konto_5'] +
|
|
'Konto_1', 'Konto_2', 'Konto_3', 'Konto_4', 'Konto_5'] +
|
|
get_default_cols(0) + get_default_cols(7) + get_default_cols(8) +
|
|
get_default_cols(0) + get_default_cols(7) + get_default_cols(8) +
|
|
@@ -508,12 +509,15 @@ def dresen():
|
|
struct.export()
|
|
struct.export()
|
|
|
|
|
|
|
|
|
|
|
|
+def reisacher():
|
|
|
|
+ struct = GCStruct('X:/Robert/Planung Reisacher/GCStruct_neue_Struktur_Planung')
|
|
|
|
+ struct.get_structure_and_tree()
|
|
|
|
+ # json.dump(res['flat'], open(f"{self.config['path2']}/{self.config['output']}", 'w'), indent=2)
|
|
|
|
+
|
|
|
|
+
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
# struct = GCStruct('c:/projekte/gcstruct_dresen')
|
|
# struct = GCStruct('c:/projekte/gcstruct_dresen')
|
|
# struct = GCStruct('c:/projekte/python/gcstruct')
|
|
# struct = GCStruct('c:/projekte/python/gcstruct')
|
|
# struct = GCStruct('c:/projekte/python/gcstruct_reisacher_planung')
|
|
# struct = GCStruct('c:/projekte/python/gcstruct_reisacher_planung')
|
|
- # struct = GCStruct('X:/Robert/Planung Reisacher/GCStruct_neue_Struktur_Planung')
|
|
|
|
- # print(struct.config['struct'])
|
|
|
|
- # struct.post_structure_and_tree()
|
|
|
|
- gcstruct_uebersetzung()
|
|
|
|
|
|
+ reisacher()
|
|
# dresen()
|
|
# dresen()
|