Update to Total Outstanding function

To ensure that pending payments are not deducted from total amount outstanding.