3 Commits 3540d6d0d8 ... 97efae1704

Autor SHA1 Mensagem Data
  gc-server3 97efae1704 Flow Charts für ETL há 6 meses atrás
  gc-server3 8b81697c3c Übersetzung mit Variante ohne Standort, um die Datensätze zu reduzieren há 6 meses atrás
  gc-server3 f4898a5b9a awork Aufgabe erstellen mit Status "Läuft" há 6 meses atrás

+ 2 - 1
.gitignore

@@ -18,4 +18,5 @@ fehlerbericht/config.py
 mailserver/temp/
 *.zip
 datev/export
-sandbox/sql
+sandbox/sql
+awork/projects.json

+ 13 - 6
awork/awork_tasks.py

@@ -1,13 +1,16 @@
-from credentials import Client
-import typer
-import requests
-import json
 import datetime
+import json
 from pathlib import Path
+
+import requests
+import typer
+from credentials import Client
 from model import AworkProjekt, Comment, User
 from sqlalchemy import create_engine, text
 from sqlalchemy.orm import Session
 
+app = typer.Typer()
+
 DSN = "mysql+pymysql://gaps:Gcbs12ma@192.168.2.41/tasks"
 
 awork_api_url = "https://api.awork.com/api/v1"
@@ -42,6 +45,7 @@ def get_users():
     return data
 
 
+@app.command()
 def import_projects():
     projects = get_projects()
     p = convert_projects(projects)
@@ -85,6 +89,7 @@ def convert_projects(projects):
     return res
 
 
+@app.command()
 def create_task(comment_id: int):
     with Session(create_engine(DSN)) as db_session:
         comment = db_session.get(Comment, comment_id)
@@ -97,7 +102,7 @@ def create_task(comment_id: int):
 
         res = requests.get(awork_api_url + "/projects/" + comment.awork_project_id + "/taskstatuses", headers=header)
         data = res.json()
-        task_status = [s["id"] for s in data if s["name"] == "To do"]
+        task_status = [s["id"] for s in data if s["type"] == "progress"]
         if len(task_status) == 0:
             return 0
         task_status_id = task_status[0]
@@ -242,4 +247,6 @@ def authorize():
 
 if __name__ == "__main__":
     main()
-    typer.run(create_task)
+    app()
+    # create_task(74715)
+    # import_projects()

BIN
gcstruct/dist/gcstruct_uebersetzung.exe


+ 26 - 7
gcstruct/gcstruct.py

@@ -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()

+ 5 - 2
gcstruct/gcstruct_uebersetzung.py

@@ -1,6 +1,9 @@
-from gcstruct import GCStruct
+import sys
 from pathlib import Path
 
+sys.path.insert(0, "C:\\Projekte\\Python\\gcstruct")
+from gcstruct import GCStruct  # noqa:E402
+
 
 def gcstruct_uebersetzung(base_dir=None):
     if base_dir is None:
@@ -16,7 +19,7 @@ def gcstruct_uebersetzung(base_dir=None):
             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.4.21/verwaltung/Kunden/Luchtenberg/1 Umstellung SKR51/")
+        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

+ 158 - 0
mermaid/Verkauf.md

@@ -0,0 +1,158 @@
+---
+title: Verkauf
+---
+
+# Verkauf
+
+```mermaid
+flowchart LR;
+    A[import.UNIT_FILE];
+    B[import.UNIT_HISTORY];
+    C[import.VPP5R];
+    D[import.UNIT_CHANGE_HIST];
+    E[import.VPP5A];
+    Z[data.Transaction_Codes];
+
+    F[Config];
+    G[Unit_File];
+    H[Unit_History];
+
+    I[Unit_Sold];
+    J[Unit_History_mit_Menge];
+    K[VPP5A_Transaction_Codes];
+    L[Transaction_Codes_data];
+    M[Transaction_Codes_Faktor];
+    N[Unit_History_TR_Codes];
+    O[Unit_History_Faktor];
+    P[Unit_History_Summe];
+    Q[Unit_Change_Hist];
+    R[Unit_Change_Hist_max];
+    S[Unit_Change_Department];
+    T[Unit_File_Department];
+    U[VPP5R_Vehicle_Type];
+    V[Unit_File_Veh_Type];
+    W[Unit_File_mit_Hist_Summe];
+    X[Unit_File_mit_Hist_Detail];
+    Y[Unit_File_Union];
+    ZZ[staging.Verkauf];
+
+    A==>G;
+    B==>H;
+    C-->U;
+    D-->Q;
+    E-->K;
+    Z-->L;
+
+    subgraph SG1[Verkaufspositionen]
+    H-->I;
+    
+    H==>J;
+    I-.->|Menge|J;
+
+    K-->M;
+    L-.->M;
+
+    J==>N;
+    M-..->|Aufteilung Kennzahlen|N;
+    N==>O;
+
+    end
+
+    subgraph SG2[Verkaufsvorgang]
+    G-.->|Order Number|I;
+
+    Q-->R;
+    
+    R-.->S;
+    Q-->S;
+
+    G==>T;
+    S-.->T;
+    T==>V;
+    U-....->V;
+    end
+    F-.->V;
+    F-.->W;
+    F-.->X;
+
+    subgraph SG3[Kombination]
+    O-->P;
+
+    V-->W;
+    P-->W;
+    
+    O--->X;
+    V--->X;
+    
+    W-->Y;
+    X-->Y;
+
+    end
+    Y-->ZZ;
+
+```
+
+## Fahrzeug
+
+```mermaid
+flowchart LR;
+    A[import.VEHICLE];
+    B[import.GLOBAL_MAKE];
+    C[import.VPP5Q];
+
+    D[Vehicle];
+    E[Global_Make];
+    F[VPP5Q_Model_Line];
+    
+    G[Fahrzeug_mit_Marke];
+    H[Fahrzeug_mit_Marke_und_Modell];
+
+    J[staging.Fahrzeug];
+
+    A-->D;
+    B-->E;
+    C-->F;
+    D-->G;
+    E-.->G;
+    G-->H;
+    F-..->H;
+    H-->J;
+
+```
+
+## Kunde
+
+```mermaid
+flowchart LR;
+    A[import.CUSTOMER];
+    B[import.VPP48];
+
+    C[Customer];
+    D[Customer_Group];
+
+    E[Kunde_mit_Gruppe];
+    F[staging.Kunde];
+    
+    A-->C;
+    B-->D;
+    C-->E;
+    D-.->E;
+    E-->F;
+```
+
+## Verkäufer
+
+```mermaid
+flowchart LR;
+    A[import.VPP43];
+    B[VPP43];
+    
+    C[Verkaeufer];
+    D[staging.Verkaeufer];
+
+    A-->B;
+    B-->C;
+    C-->D;
+```
+
+

+ 34 - 0
mermaid/flow copy.md

@@ -0,0 +1,34 @@
+---
+title: Verkäufer
+---
+
+# Rechnungsausgangsbuch
+
+```mermaid
+flowchart LR;
+    A[Rechnungspositionen];
+    B[Gutschriftpositionen];
+    C[GC_Produktbuchungsgruppen_Matrix];
+    D[Rechnung];
+    E[Gutschrift];
+
+    F[R/G Pos. Union];
+    G[R/G Union];
+    H[Pos mit Produktbuchungsgruppen];
+
+    I[Summe Re-Nr.];
+    J[(Pos Export)];
+    K[(R/G Export)];
+
+    A-->F;
+    B-->F;
+    C-.->H;
+    D-->G;
+    E-->G;
+    F-->H;
+    H-->I;
+    H-->J;
+    G--->I;
+    I-->K;
+
+```

+ 34 - 0
mermaid/flow.md

@@ -0,0 +1,34 @@
+---
+title: Rechnungsausgangsbuch
+---
+
+# Rechnungsausgangsbuch
+
+```mermaid
+flowchart LR;
+    A[Rechnungspositionen];
+    B[Gutschriftpositionen];
+    C[GC_Produktbuchungsgruppen_Matrix];
+    D[Rechnung];
+    E[Gutschrift];
+
+    F[R/G Pos. Union];
+    G[R/G Union];
+    H[Pos mit Produktbuchungsgruppen];
+
+    I[Summe Re-Nr.];
+    J[(Pos Export)];
+    K[(R/G Export)];
+
+    A-->F;
+    B-->F;
+    C-.->H;
+    D-->G;
+    E-->G;
+    F-->H;
+    H-->I;
+    H-->J;
+    G--->I;
+    I-->K;
+
+```