Commit Graph

5 Commits

Author SHA1 Message Date
OlgunR
920dce13d5 Add support for invoice attachments
Introduced the `InvoiceAttachment` entity and its relationship with `ZugferdInvoice` to manage extracted invoice attachments. Updated `AppDbContext` and added a migration to create the `InvoiceAttachments` table with cascading delete behavior and an index for optimized queries.

Enhanced the UI to display attachments in `Details.cshtml`, including file type icons, file size, and extraction date. Added a new `ViewAttachment` page to render or download attachments based on their type, with support for XML, plain text, images, and downloads.

Implemented `AttachmentViewerService` to determine viewer types and MIME types for attachments. Registered the service in the DI container. Updated `Upload.cshtml.cs` to save extracted attachments to the database.

Improved user experience with syntax highlighting for XML files and appropriate messages for unsupported file types.
2026-06-02 15:03:37 +02:00
OlgunR
03599addb8 Optimize invoice performance with indexes and DTO
Added indexes for `ImportedAt` and a composite key on
`InvoiceNumber` and `SellerTaxId` to improve query performance.
Updated `AppDbContext` and EF Core migrations to reflect these
changes. Introduced `ZugferdInvoiceListDto` to optimize memory
usage by excluding large fields like `RawXml`. Updated the
frontend (`Index.cshtml`) and backend (`Index.cshtml.cs`) to use
the new DTO for better performance.
2026-06-02 13:45:57 +02:00
OlgunR
6582370c08 Add GuidelineId property to ZugferdInvoice model
Added a new `GuidelineId` property to the `ZugferdInvoice` model to store the ZUGFeRD Guideline ID extracted from XMP metadata. Updated the `AppDbContextModelSnapshot.cs` to reflect this change and created a migration (`20260527133241_AddGuidelineId`) to add the `GuidelineId` column to the `ZugferdInvoices` table.

Generated the corresponding designer file for the migration to define the updated database schema. Minor formatting changes were made to `ZugferdInvoice.cs` without functional impact.
2026-05-27 16:01:32 +02:00
OlgunR
87f27682ce Add support for generating result PDFs
Introduced the `ResultFilePath` property in the `ZugferdInvoice` model to store the path of generated result PDFs. Added a new service, `PdfResultPackageService`, to create result PDFs by converting the original PDF to PDF/A-3b format and attaching a report file. Updated `Upload.cshtml` and `Upload.cshtml.cs` to handle and display the `ResultFilePath`.

Created a migration to add the `ResultFilePath` column to the database. Updated `Program.cs` to register the new service and added configuration sections in `appsettings.json` for input and output directories. Enhanced error handling and logging for better traceability.
2026-05-27 13:43:14 +02:00
OlgunR
c45e837c2b Add ZUGFeRD parsing and invoice storage support
Enhanced `ZugferdInvoice` model with default string values to prevent nulls. Updated `Upload.cshtml` to display parsed invoice data.

Refactored `Upload.cshtml.cs` to handle ZUGFeRD XML parsing and database storage. Introduced `ImportedInvoice` property and buffered file processing with `MemoryStream`.

Extended `ZugferdParserService` to support ZUGFeRD v1, v1.0 FeRD, and v2/Factur-X. Added version-specific parsing methods and namespaces. Improved date and decimal parsing for robustness.

Added database migration (`20260522084606_InitialCreate`) to define `ZugferdInvoices` table. Updated migration snapshot to reflect schema changes.

Fixed localization issue in `Upload.cshtml.cs` error message.
2026-05-22 14:01:07 +02:00