Fix account dropdowns: vendor auto-select + sub-type filtering

Inventory vendor auto-select: match the dropdown off the Manufacturer
field (almost always populated and equal to the vendor for the shop's
distributors) instead of the AI's price-conditional vendorName, which was
only returned when a price was scraped. Centralizes the logic in a shared
inventory-vendor-match.js used by catalog lookup, AI lookup, label scan,
and manual entry; skips brands sold by multiple distributors (PPG, KP
Pigments) so those stay manual.

Account dropdowns filtered by sub-type now filter by parent AccountType,
so accounts a company classifies under a non-standard sub-type still
appear: Inventory account (Asset), AP account (Liability), pay-from/bank
and Bank Reconciliation pickers (Asset + Liability).

Deposit account is now a user-selectable dropdown on the Job and Quote
deposit modals (Asset + Liability accounts) instead of a silent auto-pick
of the first Checking/Cash account; falls back to the old behavior when
left blank, and validates the chosen account belongs to the company.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-20 09:26:52 -04:00
parent 8b9a3dff41
commit 687aedf7a4
15 changed files with 186 additions and 48 deletions
@@ -366,11 +366,13 @@ public class BankReconciliationsController : Controller
private async Task PopulateAccountDropdownAsync()
{
var companyId = _tenantContext.GetCurrentCompanyId() ?? 0;
// Reconcilable accounts: any Asset (bank/cash) or Liability (credit card, line of
// credit) account. Filter by parent AccountType, not sub-type, so an account the
// company classified differently still shows up for reconciliation.
var accounts = await _unitOfWork.Accounts.FindAsync(
a => a.CompanyId == companyId && a.IsActive
&& (a.AccountSubType == AccountSubType.Checking
|| a.AccountSubType == AccountSubType.Savings
|| a.AccountSubType == AccountSubType.Cash));
&& (a.AccountType == AccountType.Asset
|| a.AccountType == AccountType.Liability));
ViewBag.AccountSelectList = accounts
.OrderBy(a => a.AccountNumber)