Don't use IN clause to filter invoices

In this case, filtering using an IN clause may cost more than just looping over
all invoices as the IN clause could be very large.

review940002