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
@@ -211,6 +211,48 @@
</div>
</div>
<!-- Period Lock -->
<div class="row mb-4">
<div class="col-12">
<h6 class="border-bottom pb-2 mb-3 text-muted">Period Locking</h6>
</div>
<div class="col-md-4">
@{
var lockThrough = ViewBag.BookLockedThrough as DateTime?;
}
<label class="form-label">Books Locked Through</label>
@if (lockThrough.HasValue)
{
<div class="input-group">
<span class="input-group-text"><i class="bi bi-lock-fill text-warning"></i></span>
<input type="text" class="form-control" value="@lockThrough.Value.ToString("MMMM d, yyyy")" readonly />
<form asp-action="SetPeriodLock" method="post" class="d-inline">
@Html.AntiForgeryToken()
<button type="submit" class="btn btn-outline-secondary" title="Clear lock">
<i class="bi bi-unlock"></i> Clear
</button>
</form>
</div>
<div class="form-text text-warning">Entries dated on or before this date are blocked.</div>
}
else
{
<div class="text-muted small mb-2">No period lock set — all dates are open.</div>
}
</div>
<div class="col-md-4">
<label class="form-label">Set New Lock Date</label>
<form asp-action="SetPeriodLock" method="post" class="d-flex gap-2">
@Html.AntiForgeryToken()
<input type="date" name="lockThrough" class="form-control" />
<button type="submit" class="btn btn-warning" onclick="return confirm('Lock all accounting periods on or before this date? Users will not be able to post or edit entries in those periods.')">
<i class="bi bi-lock me-1"></i>Lock
</button>
</form>
<div class="form-text">Prevents backdating any GL entry (bills, JEs) into closed periods.</div>
</div>
</div>
<div class="mb-3">
<label for="address" class="form-label">Address</label>
<input type="text" class="form-control" id="address" name="Address" value="@Model.Address" maxlength="200">