Add company default GL accounts; move QB sign-fix to platform

Default accounts: companies can now set a default Revenue, COGS, and
Inventory account (Chart of Accounts -> "Default Accounts" card). Stored
on CompanyPreferences (3 nullable FKs + migration). Used as the fallback
when an item or invoice line leaves its account blank:
 - Invoice lines fall back to the default Revenue account, then to 4000.
 - New inventory/catalog items are pre-filled with the COGS/Inventory
   defaults, so the value is stored on the item and both live posting and
   the balance-recompute path stay consistent.
Blank defaults = unchanged behavior, so nothing changes until a company
opts in. Setting both COGS + Inventory enables perpetual-inventory COGS
posting (warned in the UI and help docs). Help KB + Settings article
updated.

Also moves the "Fix QB Import Signs" tool off the company Chart of
Accounts page (was CompanyAdmin-visible) to the SuperAdmin-only platform
Company Details page, operating on the target company.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-20 10:03:11 -04:00
parent 687aedf7a4
commit ee86d7aaf6
14 changed files with 11913 additions and 44 deletions
@@ -18,6 +18,18 @@ public class CompanyPreferences : BaseEntity
public string InvoiceNumberPrefix { get; set; } = "INV";
public bool UseMetricSystem { get; set; } = false; // False = Imperial (ft, lb), True = Metric (m, kg)
// Default GL Accounts — used as the fallback when an item leaves its account field blank.
// Null means "no default": revenue falls back to account 4000, and inventory-consumption
// COGS simply isn't posted (consistent with expensing materials at purchase). A company
// only opts into perpetual-inventory COGS posting by setting both the COGS and Inventory
// defaults (or the per-item accounts). FKs are nullable with no cascade — accounts soft-delete.
/// <summary>Default Revenue account for invoice lines that don't specify one (fallback before account 4000).</summary>
public int? DefaultRevenueAccountId { get; set; }
/// <summary>Default COGS account pre-filled on new inventory/catalog items. Drives inventory-consumption COGS posting when paired with an inventory account.</summary>
public int? DefaultCogsAccountId { get; set; }
/// <summary>Default Inventory asset account pre-filled on new inventory items. Drives inventory-consumption COGS posting when paired with a COGS account.</summary>
public int? DefaultInventoryAccountId { get; set; }
// Job / Workflow Defaults
public string DefaultJobPriority { get; set; } = "Normal";
public bool RequireCustomerPO { get; set; } = false;