Phase F: Add Invoice Write-Off, Fixed Assets, Period Locking, and 1099 Tracking
- Invoice Write-Off: WriteOff POST action in InvoicesController posts bad-debt JE (DR bad debt expense / CR AR), reduces customer balance, marks invoice WrittenOff; write-off modal added to Invoice Details view with expense account selector - Fixed Assets: FixedAsset + FixedAssetDepreciationEntry entities with straight-line depreciation; FixedAssetsController (Index/Create/Edit/Details/PostDepreciation/Delete); PostDepreciation auto-generates one JE per asset per period, skips already-posted, fully-depreciated, and disposed assets; full CRUD views + nav link - Period Locking: Company.BookLockedThrough field; AccountingPeriodValidator static helper; lock check added to JE Post and Bill Create (blocks backdating into closed periods); SetPeriodLock action + date picker UI in Company Settings Accounting section - 1099 Tracking: Is1099Vendor flag on Vendor entity + DTOs; checkbox in Create/Edit views; TaxReporting1099 report action + view lists payments by year, flags vendors >= $600; report card added to Reports Landing - Migration AddFixedAssetsLockAnd1099 applied Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,186 @@
|
||||
@using PowderCoating.Core.Entities
|
||||
@model List<FixedAsset>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Fixed Assets";
|
||||
ViewData["PageIcon"] = "bi-building-gear";
|
||||
var now = DateTime.Now;
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div></div>
|
||||
<div class="d-flex gap-2">
|
||||
<a asp-action="Create" class="btn btn-primary">
|
||||
<i class="bi bi-plus-circle me-2"></i>Add Asset
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@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>
|
||||
}
|
||||
|
||||
<!-- Summary Cards -->
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="col-md-3">
|
||||
<div class="card border-0 shadow-sm text-center">
|
||||
<div class="card-body py-3">
|
||||
<div class="text-muted small">Active Assets</div>
|
||||
<div class="fs-3 fw-bold text-primary">@ViewBag.ActiveCount</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card border-0 shadow-sm text-center">
|
||||
<div class="card-body py-3">
|
||||
<div class="text-muted small">Total Cost</div>
|
||||
<div class="fs-3 fw-bold">@((ViewBag.TotalCost as decimal? ?? 0).ToString("C"))</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card border-0 shadow-sm text-center">
|
||||
<div class="card-body py-3">
|
||||
<div class="text-muted small">Accum. Depreciation</div>
|
||||
<div class="fs-3 fw-bold text-danger">@((ViewBag.TotalAccumDeprec as decimal? ?? 0).ToString("C"))</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card border-0 shadow-sm text-center">
|
||||
<div class="card-body py-3">
|
||||
<div class="text-muted small">Total Book Value</div>
|
||||
<div class="fs-3 fw-bold text-success">@((ViewBag.TotalBookValue as decimal? ?? 0).ToString("C"))</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Post Depreciation -->
|
||||
<div class="card border-0 shadow-sm mb-4">
|
||||
<div class="card-header bg-white border-0 py-3 d-flex justify-content-between align-items-center">
|
||||
<h5 class="mb-0 fw-semibold"><i class="bi bi-calendar-check me-2 text-primary"></i>Post Monthly Depreciation</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form asp-action="PostDepreciation" method="post" class="row g-3 align-items-end">
|
||||
@Html.AntiForgeryToken()
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Year</label>
|
||||
<input type="number" name="year" class="form-control" value="@now.Year" min="2000" max="2099" required />
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Month</label>
|
||||
<select name="month" class="form-select">
|
||||
@for (int m = 1; m <= 12; m++)
|
||||
{
|
||||
<option value="@m" selected="@(m == now.Month ? "selected" : null)">
|
||||
@(new DateTime(now.Year, m, 1).ToString("MMMM"))
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button type="submit" class="btn btn-outline-primary"
|
||||
onclick="return confirm('Post straight-line depreciation for all active assets for this period? Assets already posted for the period will be skipped.')">
|
||||
<i class="bi bi-send me-2"></i>Post Depreciation
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-md-3 text-muted small">
|
||||
Creates one Journal Entry per asset. Fully-depreciated and disposed assets are skipped.
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Asset Table -->
|
||||
<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-table me-2 text-primary"></i>Asset Register</h5>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
@if (!Model.Any())
|
||||
{
|
||||
<div class="text-center text-muted py-5">
|
||||
<i class="bi bi-building-gear display-4 d-block mb-3 opacity-25"></i>
|
||||
<p>No fixed assets yet. <a asp-action="Create">Add your first asset</a> to start tracking depreciation.</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Asset</th>
|
||||
<th>Purchase Date</th>
|
||||
<th class="text-end">Cost</th>
|
||||
<th class="text-end">Salvage Value</th>
|
||||
<th class="text-center">Life (mo.)</th>
|
||||
<th class="text-end">Monthly Depr.</th>
|
||||
<th class="text-end">Accum. Depr.</th>
|
||||
<th class="text-end">Book Value</th>
|
||||
<th class="text-center">Status</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var a in Model)
|
||||
{
|
||||
var fullyDeprec = a.AccumulatedDepreciation >= (a.PurchaseCost - a.SalvageValue);
|
||||
<tr>
|
||||
<td>
|
||||
<a asp-action="Details" asp-route-id="@a.Id" class="fw-semibold text-decoration-none">
|
||||
@a.Name
|
||||
</a>
|
||||
@if (!string.IsNullOrWhiteSpace(a.Description))
|
||||
{
|
||||
<div class="text-muted small">@a.Description</div>
|
||||
}
|
||||
</td>
|
||||
<td>@a.PurchaseDate.ToLocalTime().ToString("MM/dd/yyyy")</td>
|
||||
<td class="text-end">@a.PurchaseCost.ToString("C")</td>
|
||||
<td class="text-end">@a.SalvageValue.ToString("C")</td>
|
||||
<td class="text-center">@a.UsefulLifeMonths</td>
|
||||
<td class="text-end">@a.MonthlyDepreciation.ToString("C")</td>
|
||||
<td class="text-end text-danger">@a.AccumulatedDepreciation.ToString("C")</td>
|
||||
<td class="text-end @(a.BookValue <= 0 ? "text-muted" : "text-success fw-semibold")">
|
||||
@a.BookValue.ToString("C")
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if (a.IsDisposed)
|
||||
{
|
||||
<span class="badge bg-secondary">Disposed</span>
|
||||
}
|
||||
else if (fullyDeprec)
|
||||
{
|
||||
<span class="badge bg-light text-dark border">Fully Depreciated</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="badge bg-success">Active</span>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="Details" asp-route-id="@a.Id" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="bi bi-eye"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user