Tabelle anpassen
This commit is contained in:
parent
4a6d265a7d
commit
0c5dbf5d92
30
main.py
30
main.py
|
|
@ -320,7 +320,7 @@ def generate_compliant_xrechnung(data):
|
||||||
ET.SubElement(monetary_total, f"{{{CBC}}}TaxInclusiveAmount", {"currencyID": "EUR"}).text = f"{data['total_gross_amount']:.2f}"
|
ET.SubElement(monetary_total, f"{{{CBC}}}TaxInclusiveAmount", {"currencyID": "EUR"}).text = f"{data['total_gross_amount']:.2f}"
|
||||||
ET.SubElement(monetary_total, f"{{{CBC}}}PayableAmount", {"currencyID": "EUR"}).text = f"{data['total_gross_amount']:.2f}"
|
ET.SubElement(monetary_total, f"{{{CBC}}}PayableAmount", {"currencyID": "EUR"}).text = f"{data['total_gross_amount']:.2f}"
|
||||||
|
|
||||||
# --- POSITIONEN SCHLEIFE (UMGEBAUT FÜR BT-153 & BT-154) ---
|
# --- POSITIONEN SCHLEIFE ---
|
||||||
for index, item in enumerate(data["items"], start=1):
|
for index, item in enumerate(data["items"], start=1):
|
||||||
line = ET.SubElement(root, f"{{{CAC}}}InvoiceLine")
|
line = ET.SubElement(root, f"{{{CAC}}}InvoiceLine")
|
||||||
ET.SubElement(line, f"{{{CBC}}}ID").text = str(index)
|
ET.SubElement(line, f"{{{CBC}}}ID").text = str(index)
|
||||||
|
|
@ -335,10 +335,10 @@ def generate_compliant_xrechnung(data):
|
||||||
|
|
||||||
item_elem = ET.SubElement(line, f"{{{CAC}}}Item")
|
item_elem = ET.SubElement(line, f"{{{CAC}}}Item")
|
||||||
|
|
||||||
# BT-153: Der prägnante Name der Dienstleistung/Ware (Erste Zeile)
|
# BT-153: Der prägnante Name der Dienstleistung/Ware
|
||||||
ET.SubElement(item_elem, f"{{{CBC}}}Name").text = str(item.get("name", "Dienstleistung"))
|
ET.SubElement(item_elem, f"{{{CBC}}}Name").text = str(item.get("name", "Dienstleistung"))
|
||||||
|
|
||||||
# BT-154: Die detaillierte Zusatzbeschreibung (Seriennummern, Laufzeiten etc., falls vorhanden)
|
# BT-154: Die detaillierte Zusatzbeschreibung
|
||||||
if item.get("description") and str(item["description"]).strip() != "":
|
if item.get("description") and str(item["description"]).strip() != "":
|
||||||
ET.SubElement(item_elem, f"{{{CBC}}}Description").text = str(item["description"]).strip()
|
ET.SubElement(item_elem, f"{{{CBC}}}Description").text = str(item["description"]).strip()
|
||||||
|
|
||||||
|
|
@ -509,21 +509,20 @@ with col2:
|
||||||
r_zip = st.text_input("PLZ (Kunde)", value=data.get("recipient_zip", ""))
|
r_zip = st.text_input("PLZ (Kunde)", value=data.get("recipient_zip", ""))
|
||||||
r_city = st.text_input("Stadt (Kunde)", value=data.get("recipient_city", ""))
|
r_city = st.text_input("Stadt (Kunde)", value=data.get("recipient_city", ""))
|
||||||
|
|
||||||
st.markdown("**3. Positionen:**")
|
# ==========================================
|
||||||
|
# 6. ENTKOPPELTES POSITIONEN FRONTEND (VOLLBREITE)
|
||||||
|
# ==========================================
|
||||||
|
# Wir verlassen hier die Spalten-Einschränkung (col2) komplett, damit die Tabelle 100% Breite bekommt.
|
||||||
|
if st.session_state.extracted_data:
|
||||||
|
data = st.session_state.extracted_data
|
||||||
|
|
||||||
# Vorab-Berechnung der Zeilensummen für die UI-Spaltenkonfiguration (nutzt exakt deine Struktur!)
|
st.markdown("### 3. Positionen")
|
||||||
items_to_show = data.get("items", [])
|
|
||||||
for item in items_to_show:
|
|
||||||
if "total_amount" not in item:
|
|
||||||
raw_total = float(item.get("quantity") or 0.0) * float(item.get("unit_price") or 0.0)
|
|
||||||
item["total_amount"] = kaufmaennisches_runden(raw_total)
|
|
||||||
|
|
||||||
# 🔥 REPARATUR-UI: Nutzt exakt deine internen Dictionary-Keys ("name" und "description")
|
# 🔥 NEU: Volle Container-Breite und saubere Spaltenskalierung ohne horizontales Quetschen
|
||||||
# Erzwingt die volle Breite und legt feste proportionale Spaltenbreiten fest, um das Scrollen zu verhindern.
|
|
||||||
edited_items = st.data_editor(
|
edited_items = st.data_editor(
|
||||||
items_to_show,
|
data.get("items", []),
|
||||||
num_rows="dynamic",
|
num_rows="dynamic",
|
||||||
use_container_width=True, # Füllt die volle Bildschirmbreite aus
|
use_container_width=True, # Nutzt die komplette Bildschirmbreite (Wide-Layout)
|
||||||
column_config={
|
column_config={
|
||||||
"name": st.column_config.TextColumn("Artikelname (BT-153)", width="medium", required=True),
|
"name": st.column_config.TextColumn("Artikelname (BT-153)", width="medium", required=True),
|
||||||
"description": st.column_config.TextColumn("Zusatzbeschreibung (BT-154)", width="large"),
|
"description": st.column_config.TextColumn("Zusatzbeschreibung (BT-154)", width="large"),
|
||||||
|
|
@ -533,6 +532,7 @@ with col2:
|
||||||
"total_amount": st.column_config.NumberColumn("Gesamtbetrag (€)", width="small", format="%.2f", disabled=True)
|
"total_amount": st.column_config.NumberColumn("Gesamtbetrag (€)", width="small", format="%.2f", disabled=True)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
vat_rate = st.number_input("Steuersatz (%)", value=float(data.get("vat_rate_percent") or 19.0))
|
vat_rate = st.number_input("Steuersatz (%)", value=float(data.get("vat_rate_percent") or 19.0))
|
||||||
|
|
||||||
for item in edited_items:
|
for item in edited_items:
|
||||||
|
|
@ -575,7 +575,7 @@ st.markdown("---")
|
||||||
st.caption(
|
st.caption(
|
||||||
"📝 **Hinweise:**\n\n"
|
"📝 **Hinweise:**\n\n"
|
||||||
"**Human-in-the-Loop:** "
|
"**Human-in-the-Loop:** "
|
||||||
"Das Tool dient als Automations-Assistent. Vor dem finalen XML-Export ist eine visuelle Endkontrolle der extrahierten Daten "
|
"Das Tool dient als Automation-Assistent. Vor dem finalen XML-Export ist eine visuelle Endkontrolle der extrahierten Daten "
|
||||||
"(insbesondere Rechnungsnummer und Empfängeradresse) durch den Sachbearbeiter zwingend erforderlich.\n\n"
|
"(insbesondere Rechnungsnummer und Empfängeradresse) durch den Sachbearbeiter zwingend erforderlich.\n\n"
|
||||||
"**GoBD-Konformität:** "
|
"**GoBD-Konformität:** "
|
||||||
"Das Tool generiert ausschließlich das strukturierte XML-Format. Für die Einhaltung der GoBD-Richtlinien "
|
"Das Tool generiert ausschließlich das strukturierte XML-Format. Für die Einhaltung der GoBD-Richtlinien "
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue