1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- from pathlib import Path
- from gcstruct.gcstruct import GCStruct
- def get_base_and_import_dir(base_dir):
- if base_dir is None:
- base_dir = Path(".").absolute()
- else:
- base_dir = Path(base_dir)
- import_dir = base_dir
- if base_dir.name == "scripts":
- if base_dir.parent.parent.name == "Portal":
- base_dir = base_dir.parent.parent.parent
- import_dir = base_dir.joinpath("Portal/System/IQD/Belege/Kontenrahmen")
- else:
- base_dir = base_dir.parent.parent
- import_dir = base_dir.joinpath("System/OPTIMA/Export")
- elif not base_dir.joinpath("GCStruct_Aufbereitung").exists():
- base_dir = Path("//192.168.2.21/verwaltung/Kunden/Luchtenberg/1 Umstellung SKR51/")
- if not base_dir.exists():
- base_dir = Path("//media/fileserver1/verwaltung/Kunden/Luchtenberg/1 Umstellung SKR51/")
- import_dir = base_dir
- return base_dir, import_dir
- def gcstruct_uebersetzung(base_dir=None):
- base_dir, import_dir = get_base_and_import_dir(base_dir)
- struct = GCStruct(str(base_dir.joinpath("GCStruct_Aufbereitung")))
- input_files = [f for f in import_dir.glob("Kontenrahmen_kombiniert*.csv")]
- print("Quelldateien:")
- for file in input_files:
- print("* " + file.name)
- struct.skr51_translate(input_files)
- print("Kontenrahmen_uebersetzt.csv erstellt.")
-
- struct2 = GCStruct(str(base_dir.joinpath("GCStruct_Modell")))
- struct2.skr51_translate2(str(base_dir.joinpath("GCStruct_Aufbereitung/Export/Kontenrahmen_uebersetzt.csv")))
- print("SKR51_Uebersetzung.csv erstellt.")
- struct2.skr51_vars()
- print("SKR51_Struktur.csv erstellt.")
- if __name__ == "__main__":
- gcstruct_uebersetzung()
|