Use this function to check if the given voucher is unpaid. Perhaps this can be done in Sql itself without resorting to set operations.