Files
DXApp/DXApp.TemplateKitProject/Pages/Invoices/Index.cshtml
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

66 lines
2.4 KiB
Plaintext

@page
@model DXApp.TemplateKitProject.Pages.Invoices.IndexModel
@{
ViewData["Title"] = "Rechnungen";
}
<h2>Importierte Rechnungen</h2>
@if (!Model.Invoices.Any())
{
<div class="alert alert-info mt-3">Noch keine Rechnungen importiert.</div>
}
else
{
@(Html.DevExtreme().DataGrid<DXApp.TemplateKitProject.Models.ZugferdInvoiceListDto>()
.DataSource(Model.Invoices)
.KeyExpr("Id")
.ShowBorders(true)
.RowAlternationEnabled(true)
.FilterRow(f => f.Visible(true))
.HeaderFilter(h => h.Visible(true))
.Paging(p => p.PageSize(20))
.Pager(p => p
.ShowPageSizeSelector(true)
.AllowedPageSizes(new[] { 10, 20, 50 })
.ShowInfo(true)
)
.Columns(cols =>
{
cols.Add()
.Caption("Details")
.Width(80)
.CellTemplate(new JS(@"function(container, options) {
$('<a>')
.attr('href', '/Invoices/Details?id=' + options.data.Id)
.attr('class', 'btn btn-sm btn-outline-primary')
.text('Details')
.appendTo(container);
}"));
cols.Add().DataField("Id").Caption("ID").Width(60).AllowEditing(false);
cols.Add().DataField("InvoiceNumber").Caption("Rechnungsnr.");
cols.Add().DataField("InvoiceDate").Caption("Datum")
.DataType(GridColumnDataType.Date)
.Format("dd.MM.yyyy")
.Width(110);
cols.Add().DataField("SellerName").Caption("Verkäufer");
cols.Add().DataField("BuyerName").Caption("Käufer");
cols.Add().DataField("TotalAmount").Caption("Gesamt")
.DataType(GridColumnDataType.Number)
.Format("#,##0.00")
.Width(110);
cols.Add().DataField("TaxAmount").Caption("MwSt.")
.DataType(GridColumnDataType.Number)
.Format("#,##0.00")
.Width(100);
cols.Add().DataField("CurrencyCode").Caption("Währung").Width(80);
cols.Add().DataField("Iban").Caption("IBAN");
cols.Add().DataField("SourceType").Caption("Quelle").Width(90);
cols.Add().DataField("ImportedAt").Caption("Importiert am")
.DataType(GridColumnDataType.DateTime)
.Format("dd.MM.yyyy HH:mm")
.Width(150);
})
)
}