|
@@ -1,15 +1,16 @@
|
|
|
-import pandas as pd
|
|
|
-import numpy as np
|
|
|
-import xml.etree.ElementTree as ET
|
|
|
-import json
|
|
|
import csv
|
|
|
+import json
|
|
|
import re
|
|
|
+import xml.etree.ElementTree as ET
|
|
|
+from functools import reduce
|
|
|
+from pathlib import Path
|
|
|
+
|
|
|
import chevron
|
|
|
+import numpy as np
|
|
|
+import pandas as pd
|
|
|
|
|
|
# from shutil import copyfile
|
|
|
from bs4 import BeautifulSoup
|
|
|
-from functools import reduce
|
|
|
-from pathlib import Path
|
|
|
|
|
|
|
|
|
def get_flat(node):
|
|
@@ -622,7 +623,11 @@ class GCStruct:
|
|
|
df_source["Konto_Nr_Händler_mit_KST"] + " - " + df_source["Konto_Bezeichnung_Händler"]
|
|
|
)
|
|
|
|
|
|
- df_amount = df_source[df_source["Ebene1"] == "Umsatzerlöse"].reset_index()
|
|
|
+ kto_amount = df_source["Ebene63"] == "mit STK"
|
|
|
+ if kto_amount.sum() > 0:
|
|
|
+ df_amount = df_source[kto_amount].reset_index()
|
|
|
+ else:
|
|
|
+ df_amount = df_source[df_source["Ebene1"] == "Umsatzerlöse"].reset_index()
|
|
|
df_amount["Ebene1"] = "verkaufte Stückzahlen"
|
|
|
df_amount["Ebene72"] = "verkaufte Stückzahlen"
|
|
|
df_amount["Konto_neu"] = "STK " + df_amount["Konto_neu"]
|
|
@@ -721,6 +726,20 @@ class GCStruct:
|
|
|
encoding="latin-1",
|
|
|
index=False,
|
|
|
)
|
|
|
+ is_quantity = df_source["Konto"].str.startswith("STK")
|
|
|
+ df_source["Konto"] = np.where(
|
|
|
+ is_quantity,
|
|
|
+ df_source["Konto"].str.slice_replace(7, 9, "00"),
|
|
|
+ df_source["Konto"].str.slice_replace(3, 5, "00"),
|
|
|
+ )
|
|
|
+ df_source["Acct_Nr"] = df_source["Acct_Nr"].str.slice_replace(3, 5, "00")
|
|
|
+ df_department = df_source.drop_duplicates()
|
|
|
+ df_department.to_csv(
|
|
|
+ f"{self.config['path2']}/SKR51_Uebersetzung_ohne_Standort.csv",
|
|
|
+ sep=";",
|
|
|
+ encoding="latin-1",
|
|
|
+ index=False,
|
|
|
+ )
|
|
|
|
|
|
def skr51_vars(self):
|
|
|
self.get_structure_and_tree()
|