For each currency independently:
credits = sum(total_price where cd_flag = CREDIT and active) debits = sum(total_price where cd_flag = DEBIT and active) balance = credits - debits
Projected earnings should be computed separately from posted balances and shown as an estimate.
Recommended formula:
projected_earnings = posted_earnings_to_date + estimated_remaining_earnings_to_projected_end
Because commission projection is uncertain, the UI should label it explicitly as estimated and show basis.
There was an error while loading. Please reload this page.