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,91 @@
|
||||
@model PowderCoating.Core.Entities.JournalEntry
|
||||
@{
|
||||
ViewData["Title"] = "New Journal Entry";
|
||||
var accounts = ViewBag.AccountSelectList as List<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>
|
||||
?? new List<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>();
|
||||
}
|
||||
|
||||
<div class="d-flex align-items-center mb-3 gap-2">
|
||||
<a asp-action="Index" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i>Back
|
||||
</a>
|
||||
<h4 class="mb-0 fw-semibold ms-2">New Journal Entry</h4>
|
||||
</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>
|
||||
}
|
||||
|
||||
<form asp-action="Create" method="post" id="jeForm">
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="card shadow-sm mb-3">
|
||||
<div class="card-header fw-semibold">Entry Details</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-3">
|
||||
<label class="form-label fw-semibold">Date <span class="text-danger">*</span></label>
|
||||
<input asp-for="EntryDate" type="date" class="form-control"
|
||||
value="@Model.EntryDate.ToString("yyyy-MM-dd")" required />
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label fw-semibold">Reference</label>
|
||||
<input asp-for="Reference" class="form-control" placeholder="e.g., Invoice #, memo" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label fw-semibold">Description</label>
|
||||
<input asp-for="Description" class="form-control" placeholder="Brief purpose of this entry" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm mb-3">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<span class="fw-semibold">Lines</span>
|
||||
<div class="ms-auto d-flex gap-3 align-items-center small text-muted">
|
||||
<span>Total Debits: <strong id="totalDebits" class="text-dark">$0.00</strong></span>
|
||||
<span>Total Credits: <strong id="totalCredits" class="text-dark">$0.00</strong></span>
|
||||
<span id="balanceStatus" class="badge bg-secondary">Unbalanced</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-sm mb-0" id="linesTable">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th style="width:40%">Account</th>
|
||||
<th>Description</th>
|
||||
<th class="text-end" style="width:130px">Debit</th>
|
||||
<th class="text-end" style="width:130px">Credit</th>
|
||||
<th style="width:40px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="linesBody">
|
||||
<!-- rows injected by JS -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" id="addLineBtn">
|
||||
<i class="bi bi-plus-lg me-1"></i>Add Line
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
<button type="submit" class="btn btn-primary" id="saveBtn">Save as Draft</button>
|
||||
<a asp-action="Index" class="btn btn-outline-secondary">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
<script src="~/js/journal-entry-create.js" asp-append-version="true"></script>
|
||||
<script>
|
||||
JournalEntry.init(@Html.Raw(System.Text.Json.JsonSerializer.Serialize(
|
||||
accounts.Select(a => new { value = a.Value, text = a.Text }))));
|
||||
</script>
|
||||
}
|
||||
Reference in New Issue
Block a user