How Customer Balance and Credit Calculations Work
Source: `customer.rb`
- Customer balance is calculated as the sum of
balance_duefrom processed invoices only; invoices in open or closed status are excluded from the balance calculation - Credit balance is calculated as the total of processed credit notes minus any amounts that have already been applied to invoices
- When a customer's mobile number changes, SMS logs are automatically reassigned to that customer by matching against possible number variants (with and without country code, leading zero, etc.)
Support scenarios
- "The customer's balance doesn't include an invoice I just created" → Only processed invoices contribute to the balance. If the invoice is still open (in progress) or closed, it won't be included. Process the invoice first.
- "The customer's credit balance seems wrong" → Credit balance only counts processed credit notes minus applied amounts. Check if there are unprocessed credit notes or if credits have already been applied to invoices.
- "SMS history moved to a different customer" → When a mobile number is reassigned to a new customer, SMS logs follow the number. This is by design to keep communication history linked to the correct contact.