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:
2026-05-10 12:19:32 -04:00
parent a255893ada
commit fde24b09c9
29 changed files with 12520 additions and 3 deletions
@@ -0,0 +1,125 @@
@{
ViewData["Title"] = "Add Fixed Asset";
ViewData["PageIcon"] = "bi-plus-circle";
}
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="mb-4">
<a asp-action="Index" class="btn btn-outline-secondary btn-sm">
<i class="bi bi-arrow-left me-1"></i>Back to Asset Register
</a>
</div>
<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-building-gear me-2 text-primary"></i>New Fixed Asset</h5>
</div>
<div class="card-body">
<form asp-action="Create" method="post">
@Html.AntiForgeryToken()
<!-- Asset Info -->
<h6 class="border-bottom pb-2 mb-3 text-muted">Asset Information</h6>
<div class="row g-3 mb-4">
<div class="col-12">
<label class="form-label">Asset Name <span class="text-danger">*</span></label>
<input type="text" name="Name" class="form-control" maxlength="200" required placeholder="e.g., Blast Cabinet #2, Paint Oven A" />
</div>
<div class="col-12">
<label class="form-label">Description</label>
<input type="text" name="Description" class="form-control" maxlength="1000" placeholder="Optional notes about this asset" />
</div>
<div class="col-md-4">
<label class="form-label">Purchase Date <span class="text-danger">*</span></label>
<input type="date" name="PurchaseDate" class="form-control" value="@DateTime.Today.ToString("yyyy-MM-dd")" required />
</div>
<div class="col-md-4">
<label class="form-label">Purchase Cost <span class="text-danger">*</span></label>
<div class="input-group">
<span class="input-group-text">$</span>
<input type="number" name="PurchaseCost" class="form-control" step="0.01" min="0.01" required placeholder="0.00" />
</div>
</div>
<div class="col-md-4">
<label class="form-label">Salvage Value</label>
<div class="input-group">
<span class="input-group-text">$</span>
<input type="number" name="SalvageValue" class="form-control" step="0.01" min="0" value="0" placeholder="0.00" />
</div>
<div class="form-text">Estimated residual value at end of useful life.</div>
</div>
<div class="col-md-4">
<label class="form-label">Useful Life (months) <span class="text-danger">*</span></label>
<input type="number" name="UsefulLifeMonths" class="form-control" min="1" max="600" value="60" required />
<div class="form-text">60 = 5 years, 120 = 10 years, etc.</div>
</div>
<div class="col-md-4">
<label class="form-label">Prior Accumulated Depreciation</label>
<div class="input-group">
<span class="input-group-text">$</span>
<input type="number" name="AccumulatedDepreciation" class="form-control" step="0.01" min="0" value="0" placeholder="0.00" />
</div>
<div class="form-text">Set if the asset was partially depreciated before being added here.</div>
</div>
</div>
<!-- GL Accounts -->
<h6 class="border-bottom pb-2 mb-3 text-muted">GL Account Mapping</h6>
<div class="row g-3 mb-4">
<div class="col-md-4">
<label class="form-label">Asset Account</label>
<select name="AssetAccountId" class="form-select">
<option value="">— None —</option>
@if (ViewBag.AssetAccounts != null)
{
@foreach (var item in (IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>)ViewBag.AssetAccounts)
{
<option value="@item.Value">@item.Text</option>
}
}
</select>
<div class="form-text">Balance sheet asset account (e.g., 1500 Equipment).</div>
</div>
<div class="col-md-4">
<label class="form-label">Depreciation Expense Account</label>
<select name="DepreciationExpenseAccountId" class="form-select">
<option value="">— None —</option>
@if (ViewBag.ExpenseAccounts != null)
{
@foreach (var item in (IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>)ViewBag.ExpenseAccounts)
{
<option value="@item.Value">@item.Text</option>
}
}
</select>
<div class="form-text">P&amp;L expense account (e.g., 6200 Depreciation Expense).</div>
</div>
<div class="col-md-4">
<label class="form-label">Accumulated Depreciation Account</label>
<select name="AccumDepreciationAccountId" class="form-select">
<option value="">— None —</option>
@if (ViewBag.AccumDeprecAccounts != null)
{
@foreach (var item in (IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>)ViewBag.AccumDeprecAccounts)
{
<option value="@item.Value">@item.Text</option>
}
}
</select>
<div class="form-text">Contra-asset account (e.g., 1510 Accum. Depreciation — Equipment).</div>
</div>
</div>
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">
<i class="bi bi-check-lg me-2"></i>Add Asset
</button>
<a asp-action="Index" class="btn btn-outline-secondary">Cancel</a>
</div>
</form>
</div>
</div>
</div>
</div>