diff --git a/src/PowderCoating.Web/Controllers/CatalogItemsController.cs b/src/PowderCoating.Web/Controllers/CatalogItemsController.cs index 76dba16..11cf9ce 100644 --- a/src/PowderCoating.Web/Controllers/CatalogItemsController.cs +++ b/src/PowderCoating.Web/Controllers/CatalogItemsController.cs @@ -693,6 +693,13 @@ namespace PowderCoating.Web.Controllers ViewBag.RevenueAccounts = revenueAccounts; ViewBag.CogsAccounts = cogsAccounts; + + // Whether the company has configured default accounts — the views use this to label the + // blank dropdown option "(Default …)" vs "(None)". + var prefs = await _unitOfWork.CompanyPreferences + .FirstOrDefaultAsync(p => p.CompanyId == companyId && !p.IsDeleted); + ViewBag.HasDefaultRevenueAccount = prefs?.DefaultRevenueAccountId != null; + ViewBag.HasDefaultCogsAccount = prefs?.DefaultCogsAccountId != null; } /// diff --git a/src/PowderCoating.Web/Controllers/InventoryController.cs b/src/PowderCoating.Web/Controllers/InventoryController.cs index 633ca9e..7dff1ad 100644 --- a/src/PowderCoating.Web/Controllers/InventoryController.cs +++ b/src/PowderCoating.Web/Controllers/InventoryController.cs @@ -1667,6 +1667,13 @@ public class InventoryController : Controller .OrderBy(a => a.AccountNumber) .Select(a => new SelectListItem($"{a.AccountNumber} – {a.Name}", a.Id.ToString())) .ToList(); + + // Whether the company has configured default accounts — the views use this to label the + // blank dropdown option "(Default …)" vs "(None)". + var prefs = await _unitOfWork.CompanyPreferences + .FirstOrDefaultAsync(p => p.CompanyId == companyId && !p.IsDeleted); + ViewBag.HasDefaultInventoryAccount = prefs?.DefaultInventoryAccountId != null; + ViewBag.HasDefaultCogsAccount = prefs?.DefaultCogsAccountId != null; } /// diff --git a/src/PowderCoating.Web/Views/CatalogItems/Create.cshtml b/src/PowderCoating.Web/Views/CatalogItems/Create.cshtml index 724387b..e6cbadd 100644 --- a/src/PowderCoating.Web/Views/CatalogItems/Create.cshtml +++ b/src/PowderCoating.Web/Views/CatalogItems/Create.cshtml @@ -131,7 +131,7 @@
Account credited when this item is invoiced.
@@ -139,7 +139,7 @@ Account debited when materials are consumed. diff --git a/src/PowderCoating.Web/Views/CatalogItems/Edit.cshtml b/src/PowderCoating.Web/Views/CatalogItems/Edit.cshtml index 56f51ef..41a75ff 100644 --- a/src/PowderCoating.Web/Views/CatalogItems/Edit.cshtml +++ b/src/PowderCoating.Web/Views/CatalogItems/Edit.cshtml @@ -134,7 +134,7 @@
Account credited when this item is invoiced.
@@ -142,7 +142,7 @@ Account debited when materials are consumed. diff --git a/src/PowderCoating.Web/Views/Inventory/Create.cshtml b/src/PowderCoating.Web/Views/Inventory/Create.cshtml index 64d9b7d..bdd41e9 100644 --- a/src/PowderCoating.Web/Views/Inventory/Create.cshtml +++ b/src/PowderCoating.Web/Views/Inventory/Create.cshtml @@ -375,7 +375,7 @@ Asset account where inventory value is tracked (e.g., 1200 Inventory - Powder). @@ -384,7 +384,7 @@ Expense account debited when this material is consumed on a job. diff --git a/src/PowderCoating.Web/Views/Inventory/Edit.cshtml b/src/PowderCoating.Web/Views/Inventory/Edit.cshtml index c4d51a0..d2954bc 100644 --- a/src/PowderCoating.Web/Views/Inventory/Edit.cshtml +++ b/src/PowderCoating.Web/Views/Inventory/Edit.cshtml @@ -374,7 +374,7 @@ Asset account where inventory value is tracked (e.g., 1200 Inventory - Powder). @@ -383,7 +383,7 @@ Expense account debited when this material is consumed on a job.