Bug 26076: Sum the amount due in the database query instead of a loop in Perl