Phase C: Add Manual Journal Entries (double-entry GL)
- JournalEntry + JournalEntryLine entities with Draft/Posted/Reversed lifecycle - JournalEntryStatus enum (Draft, Posted, Reversed) - Migration AddJournalEntries: two new tables with self-referencing reversal FK - IUnitOfWork/UnitOfWork wired with JournalEntries + JournalEntryLines repos - ApplicationDbContext: DbSets, tenant query filters, reversal FK config - LedgerService: JE lines added as 10th source in GetAccountLedgerAsync and ComputePriorBalanceAsync - JournalEntriesController: Index (All/Draft/Posted tabs), Create, Details, Post, Reverse, Delete - Views: Index, Create (dynamic balanced line grid with running debit/credit totals), Details - journal-entry-create.js: dynamic line management with balance indicator - Nav: Journal Entries added to Finance section in _Layout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
@model IEnumerable<PowderCoating.Core.Entities.JournalEntry>
|
||||
@using PowderCoating.Core.Enums
|
||||
@{
|
||||
ViewData["Title"] = "Journal Entries";
|
||||
var statusFilter = ViewBag.StatusFilter as string ?? "All";
|
||||
}
|
||||
|
||||
<div class="d-flex align-items-center mb-3 gap-2">
|
||||
<h4 class="mb-0 fw-semibold">Journal Entries</h4>
|
||||
<a asp-action="Create" class="btn btn-sm btn-primary ms-auto">
|
||||
<i class="bi bi-plus-lg me-1"></i>New Entry
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@if (TempData["Success"] != null)
|
||||
{
|
||||
<div class="alert alert-success alert-permanent alert-dismissible fade show">
|
||||
@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">
|
||||
@TempData["Error"]
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
}
|
||||
|
||||
<ul class="nav nav-tabs mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link @(statusFilter == "All" ? "active" : "")" asp-action="Index">
|
||||
All <span class="badge bg-secondary ms-1">@ViewBag.TotalCount</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link @(statusFilter == "Draft" ? "active" : "")" asp-action="Index" asp-route-status="Draft">
|
||||
Draft <span class="badge bg-warning text-dark ms-1">@ViewBag.DraftCount</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link @(statusFilter == "Posted" ? "active" : "")" asp-action="Index" asp-route-status="Posted">
|
||||
Posted <span class="badge bg-success ms-1">@ViewBag.PostedCount</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Entry #</th>
|
||||
<th>Date</th>
|
||||
<th>Description</th>
|
||||
<th>Reference</th>
|
||||
<th>Status</th>
|
||||
<th class="text-end">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (!Model.Any())
|
||||
{
|
||||
<tr>
|
||||
<td colspan="6" class="text-center text-muted py-4">
|
||||
No journal entries found.
|
||||
<a asp-action="Create">Create the first one.</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@foreach (var je in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<a asp-action="Details" asp-route-id="@je.Id" class="fw-semibold text-decoration-none">
|
||||
@je.EntryNumber
|
||||
</a>
|
||||
@if (je.IsReversal)
|
||||
{
|
||||
<span class="badge bg-secondary ms-1" title="Reversal entry">REV</span>
|
||||
}
|
||||
</td>
|
||||
<td>@je.EntryDate.ToString("MMM d, yyyy")</td>
|
||||
<td class="text-truncate" style="max-width:280px">@je.Description</td>
|
||||
<td class="text-muted small">@je.Reference</td>
|
||||
<td>
|
||||
@if (je.Status == JournalEntryStatus.Draft)
|
||||
{
|
||||
<span class="badge bg-warning text-dark">Draft</span>
|
||||
}
|
||||
else if (je.Status == JournalEntryStatus.Posted)
|
||||
{
|
||||
<span class="badge bg-success">Posted</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="badge bg-secondary">Reversed</span>
|
||||
}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<a asp-action="Details" asp-route-id="@je.Id" class="btn btn-sm btn-outline-secondary">
|
||||
View
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user