Commit Graph

87 Commits

Author SHA1 Message Date
dfuhrmann3 3e0975102f fix(parser): recognize abbreviated unit 'pausch.' (Rechnung R26-231 Anfahrt)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-13 12:51:09 +02:00
dfuhrmann3 df81c011d3 fix(zugferd): robust factur-x embedding for varied PDF structures
Fehler 'unable to find page tree' beim ZUGFeRD-Export mancher PDFs (z.B. von PDF-XChange
erzeugte degewo-Rechnung): factur-x bettete die XML nicht ein und zerstoerte den Seitenbaum.

- build_zugferd_pdf versucht zuerst die Original-PDF; schlaegt das fehl (Absturz ODER XML
  nicht eingebettet), wird die PDF mit pikepdf normalisiert (neu gespeichert) und erneut
  versucht. Manche PDFs funktionieren nur original, andere nur normalisiert - beide Wege
  abgedeckt, Erfolgskontrolle via pdf_has_embedded_facturx.
- Neue Helfer normalize_pdf_bytes() und pdf_has_embedded_facturx() in invoice_logic.
- Verifiziert auf beiden echten Rechnungen (degewo -> Fallback, Gemeinde -> Original).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-13 11:48:48 +02:00
dfuhrmann3 29034d8501 fix(parser): capture positions with split serial numbers; keep Angebot out of BT-12/BT-17
- Positionsscan bricht nur noch bei der ECHTEN Positionsnummer (len(items)+1) ab, nicht
  bei alleinstehenden Ziffern-Fragmenten aufgesplitteter Seriennummern (Rechnung R26-224:
  Position wurde sonst ganz verworfen). Seriennummern landen jetzt in der Beschreibung (BT-154).
- Angebotsnummer wird aus Vertrag (BT-12)/Vergabeangebot (BT-17) entfernt, falls das LLM sie
  dort eingeordnet hat - Angebot gehoert nur in den Freitext (BT-22). Schema-Beschreibungen
  entsprechend praezisiert.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-13 11:30:27 +02:00
dfuhrmann3 cd2bd56377 fix(parser): recognize 'pauschal' as a billing unit (Anfahrt-Position)
Rechnung R26-232 Position 3 (Anfahrt, '2,00 pauschal') wurde uebersprungen, weil
'pauschal' nicht in der Einheiten-Erkennung stand. Ergaenzt: Pauschale/Pauschal/Psch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-13 11:06:01 +02:00
dfuhrmann3 5a9929aa9e feat: BT-46 Kundennummer, BT-10 Leitweg-ID, BT-17 Vergabeangebot, Angebot->Freitext, format-abh. Pflichtfelder
- Kundennummer jetzt BT-46 (eigenes Feld), getrennt von Leitweg-ID (BT-10)
- BT-10 Leitweg-ID: eigenes Feld, leer per Default; nur bei XRechnung Pflicht (BR-DE-15),
  bei ZUGFeRD optional (kein Blocker, kein XML-Eintrag wenn leer)
- BT-12 nur noch Vertrag; Vergabeangebot/Ausschreibung als neues Feld BT-17
  (UBL OriginatorDocumentReference, CII AdditionalReferencedDocument TypeCode 50)
- 'Angebot <Nr> vom <Datum>' wird erkannt und in den Freitext (BT-22) uebernommen
- BT-49 elektronische Adresse: bei ZUGFeRD optional (kein Blocker, in CII weggelassen wenn leer),
  bei XRechnung weiterhin Pflicht; Hinweis: E-Mail oder Netzwerkcode

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-13 10:38:56 +02:00
dfuhrmann3 9a7dca1498 feat: descriptive export filenames, Vorkasse note (BT-20), dynamic BT-49 scheme
- Export-Dateiname: <Rechnungsnummer>_<Empfaenger>_<Rechnungsdatum> (dateisicher)
- Vorkasse-Schalter schreibt Hinweis in Zahlungsbedingungen (BT-20); Zahlungsmittelcode unveraendert
- BT-49 elektronische Kaeufer-Adresse: Schema (BT-49-1) manuell waehlbar (EM/0204/0088), Default EM

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 11:03:32 +02:00
dfuhrmann3 27f6d8bab7 fix(cii): format ZUGFeRD BilledQuantity like UBL (no trailing 1.0000)
Ganze Mengen erscheinen als 1.00 statt 1.0000; gebrochene Mengen (z.B. 1.375
Tage) bleiben vollstaendig erhalten. Vereinheitlicht mit dem UBL-Generator.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 16:35:19 +02:00
dfuhrmann3 8a7990f95f refactor(ui): move ZUGFeRD validation hint from per-export box into footer
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 16:31:55 +02:00
dfuhrmann3 19cdff820d feat(ui): rename tabs to Kopfdaten/Adressen/Positionen
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 16:24:42 +02:00
dfuhrmann3 1992c30991 feat(ui): PDF-Text back under PDF preview; one-click export+download
- Extracted-text expander moved back to left column under PDF preview (PDF-Text tab removed, now 3 tabs)
- Export button now generates and downloads in a single click via st.download_button
- ZUGFeRD generation cached (st.cache_data) so it doesn't rerun on every keystroke

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 16:21:53 +02:00
dfuhrmann3 c07eb860fa feat(ui): group validation fields into tabs (Basis/Parteien/Positionen/PDF-Text)
Reduces scrolling - Summen und Export bleiben unterhalb der Tabs immer sichtbar.
Reine UI-Umgruppierung, keine Aenderung an Feldern oder Berechnungslogik.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 16:14:17 +02:00
dfuhrmann3 efdee4cfd6 feat: default export format to ZUGFeRD instead of XRechnung
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 16:01:53 +02:00
dfuhrmann3 36af456cd8 chore: keep tests, test-config and planning docs local-only (untrack from repo)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 15:57:09 +02:00
dfuhrmann3 e4f2315179 chore: ignore __pycache__/*.pyc in git and docker, untrack committed bytecode
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 15:49:56 +02:00
dfuhrmann3 656040b64b test 2026-07-07 15:36:46 +02:00
dfuhrmann3 16566ef858 chore: remove unused Decimal import from main.py (final review cleanup)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 15:32:37 +02:00
dfuhrmann3 3a621eb805 test: add end-to-end integration test covering all Phase 1 features together 2026-07-07 15:27:00 +02:00
dfuhrmann3 3b3a2dce90 feat: extend regex parser for IT-Systemhaus service periods, contract types, and serial numbers
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 15:16:30 +02:00
dfuhrmann3 0dd9916079 feat: add document-level discount (BT-21) and Skonto payment terms (BT-20) 2026-07-07 15:10:35 +02:00
dfuhrmann3 d7b851ae36 feat: support mixed VAT rates per line (BG-23) in both XML generators 2026-07-07 15:03:09 +02:00
dfuhrmann3 6ecd59e5ea feat: make payment means code (BT-81) dynamically selectable 2026-07-07 14:54:17 +02:00
dfuhrmann3 ae986b4f3f refactor: extract pure invoice logic into invoice_logic.py for testability
Move all dependency-free business logic (metadata schema, rounding/parsing
helpers, item extraction, and the XRechnung/ZUGFeRD XML generators plus the
PDF/A output-intent helpers) out of main.py into a new invoice_logic.py that
imports only pydantic and pikepdf. This makes the logic unit-testable without
a Streamlit runtime. Pure cut-and-paste, no behavior change; main.py now
imports these names from invoice_logic instead of defining them locally.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 13:43:13 +02:00
dfuhrmann3 4181346f4a docs: add Phase 1 backend implementation plan
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 13:32:04 +02:00
dfuhrmann3 994ad03387 Footer Text Update 2026-07-07 11:12:06 +02:00
dfuhrmann3 eb7aa73653 Update 2026-07-07 11:09:47 +02:00
dfuhrmann3 a0d80c5d08 Merge branch 'test-version' Update auf ZUGFeRD mit Konformität und PDF-Ansicht 2026-07-07 10:58:46 +02:00
dfuhrmann3 7b5cd86974 Test 2026-07-07 10:52:43 +02:00
dfuhrmann3 fa977594eb Test 2026-07-07 10:23:51 +02:00
dfuhrmann3 aad83afd54 Test 2026-07-07 10:03:41 +02:00
dfuhrmann3 ebf172276a Test 2026-07-07 09:49:28 +02:00
dfuhrmann3 e80d011c88 Test 2026-07-06 14:09:15 +02:00
dfuhrmann3 076e976298 Test 2026-07-06 13:42:28 +02:00
dfuhrmann3 75c9d113bc Test 2026-07-06 12:53:48 +02:00
dfuhrmann3 3e59cd188e Test 2026-07-06 11:22:11 +02:00
dfuhrmann3 37b7986831 Test 2026-07-06 11:12:39 +02:00
dfuhrmann3 ec8352682e Test 2026-07-06 10:54:43 +02:00
dfuhrmann3 381216d619 Test 2026-07-06 10:51:36 +02:00
dfuhrmann3 00fe916c06 Test 2026-07-06 10:30:35 +02:00
dfuhrmann3 a5c27f5475 Test 2026-07-06 10:13:30 +02:00
dfuhrmann3 aae15f96db Test 2026-07-06 09:23:01 +02:00
dfuhrmann3 2384b27ae1 Test 2026-07-06 09:16:26 +02:00
dfuhrmann3 91fd15621c Stuff 2026-07-03 15:20:25 +02:00
dfuhrmann3 26293f1e1e Stuff 2026-07-03 14:23:20 +02:00
dfuhrmann3 c71d632e83 Stuff 2026-07-03 14:11:22 +02:00
dfuhrmann3 6f74a040e7 Stuff 2026-07-03 14:03:47 +02:00
dfuhrmann3 ae5126898e #### 2026-07-03 13:50:07 +02:00
dfuhrmann3 88e75f71c9 stuff 2026-07-03 13:45:35 +02:00
dfuhrmann3 7094f80f89 ZUGFeRD fix 5 2026-07-03 13:36:20 +02:00
dfuhrmann3 f1a63b7457 ZUGFeRD fix 5 2026-07-03 13:32:45 +02:00
dfuhrmann3 f1f8a5b97d ZUGFeRD fix 4 2026-07-03 13:29:29 +02:00