Files
PowderCoatingLogix/src/PowderCoating.Web/Views/Accounts/YearEndClose.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

125 lines
6.4 KiB
Plaintext

@using PowderCoating.Core.Entities
@{
ViewData["Title"] = "Year-End Close";
ViewData["PageIcon"] = "bi-calendar-check";
var history = ViewBag.History as List<YearEndClose> ?? new();
var suggested = (int)ViewBag.SuggestedYear;
var closedYears = ViewBag.ClosedYears as HashSet<int> ?? new();
}
<div class="row justify-content-center">
<div class="col-lg-8">
@if (TempData["Success"] != null)
{
<div class="alert alert-success alert-permanent alert-dismissible fade show" role="alert">
<i class="bi bi-check-circle me-2"></i>@TempData["Success"]
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
}
@if (TempData["Error"] != null)
{
<div class="alert alert-danger alert-permanent alert-dismissible fade show" role="alert">
<i class="bi bi-exclamation-triangle me-2"></i>@TempData["Error"]
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
}
<div class="card border-0 shadow-sm mb-4">
<div class="card-header bg-white border-0 py-3">
<h5 class="mb-0 fw-semibold"><i class="bi bi-calendar-check me-2 text-primary"></i>Close a Fiscal Year</h5>
</div>
<div class="card-body">
<div class="alert alert-warning alert-permanent py-2 mb-4">
<i class="bi bi-exclamation-triangle me-2"></i>
<strong>What this does:</strong> Posts a Journal Entry dated December 31 that zeroes all Revenue
and Expense account balances into Retained Earnings &mdash; the standard accounting close.
Run this <strong>after</strong> all entries for the year are posted and the period is locked.
A year can only be closed once.
</div>
<form asp-action="CloseYear" method="post"
onsubmit="return confirm('Close fiscal year ' + document.getElementById('closeYear').value + '? This will post a Journal Entry zeroing all Revenue and Expense balances into Retained Earnings. This cannot be undone.')">
@Html.AntiForgeryToken()
<div class="row g-3 align-items-end">
<div class="col-md-4">
<label class="form-label">Fiscal Year to Close <span class="text-danger">*</span></label>
<input type="number" name="year" id="closeYear" class="form-control"
value="@suggested" min="2000" max="@DateTime.Now.Year" required />
<div class="form-text">All entries for this year should be finalized before closing.</div>
</div>
<div class="col-md-4">
<button type="submit" class="btn btn-warning">
<i class="bi bi-calendar-check me-2"></i>Close Year
</button>
</div>
</div>
</form>
<div class="mt-3">
<h6 class="text-muted">Pre-close checklist:</h6>
<ul class="list-unstyled small">
<li><i class="bi bi-check2-square me-2 text-success"></i>All invoices for the year are sent and collected (or written off)</li>
<li><i class="bi bi-check2-square me-2 text-success"></i>All vendor bills are entered and paid</li>
<li><i class="bi bi-check2-square me-2 text-success"></i>Bank reconciliation is complete through December</li>
<li><i class="bi bi-check2-square me-2 text-success"></i>Depreciation is posted for all 12 months</li>
<li><i class="bi bi-check2-square me-2 text-success"></i>Trial Balance is in balance (debits = credits)</li>
<li><i class="bi bi-check2-square me-2 text-success"></i>Period is locked through December 31 in Company Settings</li>
</ul>
</div>
</div>
</div>
<!-- Close History -->
<div class="card border-0 shadow-sm">
<div class="card-header bg-white border-0 py-3">
<h5 class="mb-0 fw-semibold"><i class="bi bi-clock-history me-2 text-primary"></i>Close History</h5>
</div>
<div class="card-body p-0">
@if (!history.Any())
{
<div class="text-center text-muted py-4">
<p>No years have been closed yet.</p>
</div>
}
else
{
<table class="table table-hover align-middle mb-0">
<thead class="table-light">
<tr>
<th>Fiscal Year</th>
<th>Closed On</th>
<th>Closed By</th>
<th>Journal Entry</th>
</tr>
</thead>
<tbody>
@foreach (var c in history)
{
<tr>
<td class="fw-bold">@c.ClosedYear</td>
<td>@c.ClosedAt.ToLocalTime().ToString("MM/dd/yyyy h:mm tt")</td>
<td>@Html.Raw(c.ClosedBy ?? "&mdash;")</td>
<td>
@if (c.JournalEntry != null)
{
<a asp-controller="JournalEntries" asp-action="Details" asp-route-id="@c.JournalEntryId">
@c.JournalEntry.EntryNumber
</a>
}
else
{
<span class="text-muted">#@c.JournalEntryId</span>
}
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
</div>
</div>