Add generic query to find last invoice in a series