Well ... you've actually got three if statements there ... I presume you mean one of the first two, but which?
To be honest, I think all this could be handled by SQL itself. I'm not sure of the precise statement; since I'm not clear about what the existing code is doing, I can't make a translation, but I am certain that a bit more planning in the SQL (rather than just "SELECT *") will simplify the PHP a fair bit. For example, I guess the $balance for a given row could be found by
"SELECT
SUM(((price - $fee) * quantity)) AS balance
FROM
store_order_inv
WHERE
product='$product'
AND (artist_payroll_status='Pending'
OR artist_payroll_status='Queued')
AND status='Complete'"
.That's just a sketch. I can see there's a bit more going on in there which would need to be accommodated - calling on constructs like "GROUP BY" and joins and whatnot - but that does help to illustrate how SQL and databases are designed for making calculations like these.