Demo reset + dev banner suppression for DEMO company

- DemoController: company-code-gated reset action (DEMO only, CSRF protected)
- SeedDataService.Remove: FK-safe topological pre-sweep, all deletes scoped to companyId
- SeedDataService: clock entries, extra seed data, updated customer/worker/job-status seeders
- CompanySettingsController + Index.cshtml: Reset Demo Data button for DEMO company users
- ReportsController + FinancialReportService: supporting report fixes
- _Layout.cshtml: suppress env banner when current company is DEMO (all auth paths)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 09:26:40 -04:00
parent 7735fe3cce
commit 6eb7be0193
13 changed files with 963 additions and 221 deletions
@@ -755,17 +755,20 @@ public class FinancialReportService : IFinancialReportService
var asOfEnd = asOf.AddDays(1).AddTicks(-1);
var companyName = await GetCompanyNameAsync(companyId);
var openBills = await _context.Bills
// BalanceDue is a computed property — filter on persisted columns in SQL,
// then apply BalanceDue > 0 client-side after materialisation.
var openBills = (await _context.Bills
.Include(b => b.Vendor)
.Where(b => b.CompanyId == companyId
&& b.Status != BillStatus.Draft
&& b.Status != BillStatus.Voided
&& b.Status != BillStatus.Paid
&& b.BillDate <= asOfEnd
&& b.BalanceDue > 0)
&& b.BillDate <= asOfEnd)
.OrderBy(b => b.Vendor!.CompanyName)
.ThenBy(b => b.DueDate)
.ToListAsync();
.ToListAsync())
.Where(b => b.BalanceDue > 0)
.ToList();
static string AgingBucket(int d) => d switch
{