1.0
This commit is contained in:
parent
063295110d
commit
87202c1117
14
main.py
14
main.py
|
|
@ -17,7 +17,7 @@ if "invoice_counter" not in st.session_state:
|
||||||
st.session_state.invoice_counter = 0
|
st.session_state.invoice_counter = 0
|
||||||
|
|
||||||
# ==========================================
|
# ==========================================
|
||||||
# 1. API-CLIENT FÜR EXTERNE BACKENDS (vLLM / Ollama)
|
# 1. API-CLIENT FÜR EXTERNE BACKENDS
|
||||||
# ==========================================
|
# ==========================================
|
||||||
class LLMClient:
|
class LLMClient:
|
||||||
"""Client für Ollama und vLLM (OpenAI-kompatibel) mit JSON-Schema-Unterstützung."""
|
"""Client für Ollama und vLLM (OpenAI-kompatibel) mit JSON-Schema-Unterstützung."""
|
||||||
|
|
@ -89,7 +89,7 @@ class LLMClient:
|
||||||
|
|
||||||
|
|
||||||
# ==========================================
|
# ==========================================
|
||||||
# 2. METADATEN SCHREIBSCHEMA (ERWEITERT FÜR VORLAUFTEXTE)
|
# 2. METADATEN SCHREIBSCHEMA
|
||||||
# ==========================================
|
# ==========================================
|
||||||
class InvoiceMetadata(BaseModel):
|
class InvoiceMetadata(BaseModel):
|
||||||
invoice_number: str = Field(description="Die Rechnungsnummer nach 'Nummer:' (z.B. R26-219)")
|
invoice_number: str = Field(description="Die Rechnungsnummer nach 'Nummer:' (z.B. R26-219)")
|
||||||
|
|
@ -112,7 +112,7 @@ class InvoiceMetadata(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
# ==========================================
|
# ==========================================
|
||||||
# 3. MATHEMATISCHE & PARSING-FUNKTIONEN (ERWEITERT FÜR BT-154)
|
# 3. MATHEMATISCHE & PARSING-FUNKTIONEN
|
||||||
# ==========================================
|
# ==========================================
|
||||||
def kaufmaennisches_runden(betrag, nachkommastellen=2):
|
def kaufmaennisches_runden(betrag, nachkommastellen=2):
|
||||||
if not betrag:
|
if not betrag:
|
||||||
|
|
@ -282,7 +282,7 @@ def generate_compliant_xrechnung(data):
|
||||||
ET.SubElement(contact_supp, f"{{{CBC}}}Telephone").text = "+49 3302 4940537"
|
ET.SubElement(contact_supp, f"{{{CBC}}}Telephone").text = "+49 3302 4940537"
|
||||||
ET.SubElement(contact_supp, f"{{{CBC}}}ElectronicMail").text = "office@scitech-gmbh.de"
|
ET.SubElement(contact_supp, f"{{{CBC}}}ElectronicMail").text = "office@scitech-gmbh.de"
|
||||||
|
|
||||||
# --- RECIPIENT ---
|
# --- Empfänger ---
|
||||||
customer = ET.SubElement(root, f"{{{CAC}}}AccountingCustomerParty")
|
customer = ET.SubElement(root, f"{{{CAC}}}AccountingCustomerParty")
|
||||||
party_cust = ET.SubElement(customer, f"{{{CAC}}}Party")
|
party_cust = ET.SubElement(customer, f"{{{CAC}}}Party")
|
||||||
ET.SubElement(party_cust, f"{{{CBC}}}EndpointID", {"schemeID": "EM"}).text = str(data["recipient_email"]) if data.get("recipient_email") else "rechnung@kunde.de"
|
ET.SubElement(party_cust, f"{{{CBC}}}EndpointID", {"schemeID": "EM"}).text = str(data["recipient_email"]) if data.get("recipient_email") else "rechnung@kunde.de"
|
||||||
|
|
@ -474,7 +474,7 @@ with col2:
|
||||||
|
|
||||||
# UI-Eingabefelder für die Daten vor Position 1 (BT-22 etc.)
|
# UI-Eingabefelder für die Daten vor Position 1 (BT-22 etc.)
|
||||||
st.markdown("---")
|
st.markdown("---")
|
||||||
st.markdown("🔗 **Globale Referenzen & Vorlauftexte (Vor Position 1):**")
|
st.markdown("**Globale Referenzen & Vorlauftexte:**")
|
||||||
c_ref1, c_ref2, c_ref3 = st.columns(3)
|
c_ref1, c_ref2, c_ref3 = st.columns(3)
|
||||||
with c_ref1:
|
with c_ref1:
|
||||||
dn_id = st.text_input("Lieferscheinnummer (BT-16)", value=data.get("delivery_note_id", ""))
|
dn_id = st.text_input("Lieferscheinnummer (BT-16)", value=data.get("delivery_note_id", ""))
|
||||||
|
|
@ -510,7 +510,6 @@ 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", ""))
|
||||||
|
|
||||||
# --- RECHTE POSITIONEN-OBERFLÄCHE ---
|
|
||||||
st.markdown("### 3. Positionen")
|
st.markdown("### 3. Positionen")
|
||||||
|
|
||||||
if st.button("➕ Neue Position hinzufügen"):
|
if st.button("➕ Neue Position hinzufügen"):
|
||||||
|
|
@ -542,7 +541,6 @@ with col2:
|
||||||
|
|
||||||
c_qty, c_unit, c_price, c_total = st.columns(4)
|
c_qty, c_unit, c_price, c_total = st.columns(4)
|
||||||
with c_qty:
|
with c_qty:
|
||||||
# 🔥 GEÄNDERT: Format auf %.3f gesetzt, step bleibt bei 0.1
|
|
||||||
item_quantity = st.number_input("Menge", value=float(item.get("quantity") or 0.0), format="%.3f", step=0.1, key=f"item_qty_{inv_id}_{idx}")
|
item_quantity = st.number_input("Menge", value=float(item.get("quantity") or 0.0), format="%.3f", step=0.1, key=f"item_qty_{inv_id}_{idx}")
|
||||||
with c_unit:
|
with c_unit:
|
||||||
item_unit = st.text_input("Einheit", value=item.get("unit", "Stk."), key=f"item_unit_{inv_id}_{idx}")
|
item_unit = st.text_input("Einheit", value=item.get("unit", "Stk."), key=f"item_unit_{inv_id}_{idx}")
|
||||||
|
|
@ -596,7 +594,7 @@ with col2:
|
||||||
st.download_button(label="📥 Download XML", data=generate_compliant_xrechnung(final_invoice_dict), file_name=f"XRechnung_{inv_num}.xml", mime="text/xml")
|
st.download_button(label="📥 Download XML", data=generate_compliant_xrechnung(final_invoice_dict), file_name=f"XRechnung_{inv_num}.xml", mime="text/xml")
|
||||||
|
|
||||||
# ==========================================
|
# ==========================================
|
||||||
# DYNAMISCHER FOOTER
|
# FOOTER
|
||||||
# ==========================================
|
# ==========================================
|
||||||
st.markdown("---")
|
st.markdown("---")
|
||||||
st.caption(
|
st.caption(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue