Files
PowderCoatingLogix/src/PowderCoating.Web/Views/Reports/InvoiceAgingDetail.cshtml
T
spouliot 64a9c1531b Fix — HTML entity rendering across 60 views
Razor's @() expression auto-encodes &, turning — into — which
rendered as literal text in the browser. Wrapped all such expressions in
@Html.Raw() so the em-dash entity is passed through unescaped.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 09:27:45 -04:00

111 lines
4.9 KiB
Plaintext

@model PowderCoating.Web.ViewModels.Reports.InvoiceAgingDetailViewModel
@{ ViewData["Title"] = "Invoice Aging Detail"; }
<partial name="_ReportHeader" model="Model" />
<div class="row g-3 mb-3">
<div class="col-sm-6 col-md-3">
<div class="card text-bg-danger">
<div class="card-body py-2">
<div class="small">Total Outstanding</div>
<div class="fs-5 fw-bold">@Model.TotalBalance.ToString("C")</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-3">
<div class="card border-secondary">
<div class="card-body py-2 text-center">
<div class="small text-muted">Open Invoices</div>
<div class="fs-5 fw-bold">@Model.Items.Count</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-3">
<div class="card border-warning">
<div class="card-body py-2 text-center">
<div class="small text-muted">Overdue (1&ndash;30 days)</div>
<div class="fs-5 fw-bold text-warning">
@Model.Items.Where(i => i.AgingBucket == "1&ndash;30 Days").Sum(i => i.BalanceDue).ToString("C")
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-3">
<div class="card border-danger">
<div class="card-body py-2 text-center">
<div class="small text-muted">Overdue (90+ days)</div>
<div class="fs-5 fw-bold text-danger">
@Model.Items.Where(i => i.AgingBucket == "90+ Days").Sum(i => i.BalanceDue).ToString("C")
</div>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-sm table-hover mb-0">
<thead class="table-light">
<tr>
<th>Invoice #</th>
<th>Customer</th>
<th>Invoice Date</th>
<th>Due Date</th>
<th class="text-end">Total</th>
<th class="text-end">Paid</th>
<th class="text-end">Balance Due</th>
<th class="text-end">Days Overdue</th>
<th>Aging Bucket</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Items)
{
var bucketClass = item.AgingBucket switch {
"Current" => "text-success",
"1&ndash;30 Days" => "text-warning",
"31&ndash;60 Days" => "text-orange",
"61&ndash;90 Days" => "text-danger",
"90+ Days" => "fw-bold text-danger",
_ => ""
};
<tr>
<td>
<a asp-controller="Invoices" asp-action="Details" asp-route-id="@item.InvoiceId">
@item.InvoiceNumber
</a>
</td>
<td>
@item.CustomerName
@if (!string.IsNullOrEmpty(item.CustomerEmail))
{
<div class="small text-muted">@item.CustomerEmail</div>
}
</td>
<td>@item.InvoiceDate.ToString("MMM d, yyyy")</td>
<td>@Html.Raw(item.DueDate?.ToString("MMM d, yyyy") ?? "&mdash;")</td>
<td class="text-end">@item.Total.ToString("C")</td>
<td class="text-end text-success">@item.AmountPaid.ToString("C")</td>
<td class="text-end fw-semibold">@item.BalanceDue.ToString("C")</td>
<td class="text-end @bucketClass">
@Html.Raw(item.DaysOverdue > 0 ? item.DaysOverdue.ToString() : "&mdash;")
</td>
<td><span class="badge @bucketClass bg-opacity-10 border">@item.AgingBucket</span></td>
<td><span class="badge bg-secondary-subtle text-secondary">@item.StatusDisplay</span></td>
</tr>
}
</tbody>
<tfoot class="table-light fw-bold">
<tr>
<td colspan="6">Total Outstanding</td>
<td class="text-end">@Model.TotalBalance.ToString("C")</td>
<td colspan="3"></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>