From bc9de38da3c4350df19ecb558aeb2272e6dfc4a4 Mon Sep 17 00:00:00 2001 From: Scott Pouliot Date: Fri, 8 May 2026 23:13:24 -0400 Subject: [PATCH] Fix Cash account subtype missing from debit-normal balance check AccountSubType.Cash was not included in IsNormalDebitBalance in both AccountBalanceService and LedgerService, causing Cash accounts to be treated as credit-normal. Payments deposited to a Cash account were debited in the wrong direction, producing a negative balance. Co-Authored-By: Claude Sonnet 4.6 --- .../Services/AccountBalanceService.cs | 3 ++- src/PowderCoating.Infrastructure/Services/LedgerService.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PowderCoating.Infrastructure/Services/AccountBalanceService.cs b/src/PowderCoating.Infrastructure/Services/AccountBalanceService.cs index 59b4918..527d8ff 100644 --- a/src/PowderCoating.Infrastructure/Services/AccountBalanceService.cs +++ b/src/PowderCoating.Infrastructure/Services/AccountBalanceService.cs @@ -117,7 +117,8 @@ public class AccountBalanceService : IAccountBalanceService /// private static bool IsNormalDebitBalance(AccountSubType subType) => subType switch { - AccountSubType.Checking + AccountSubType.Cash + or AccountSubType.Checking or AccountSubType.Savings or AccountSubType.AccountsReceivable or AccountSubType.Inventory diff --git a/src/PowderCoating.Infrastructure/Services/LedgerService.cs b/src/PowderCoating.Infrastructure/Services/LedgerService.cs index c71be3c..5ae07af 100644 --- a/src/PowderCoating.Infrastructure/Services/LedgerService.cs +++ b/src/PowderCoating.Infrastructure/Services/LedgerService.cs @@ -349,7 +349,8 @@ public class LedgerService : ILedgerService private static bool IsNormalDebitBalance(AccountSubType subType) => subType switch { // Asset subtypes → normal debit balance - AccountSubType.Checking + AccountSubType.Cash + or AccountSubType.Checking or AccountSubType.Savings or AccountSubType.AccountsReceivable or AccountSubType.Inventory