Fix invoice class and add new scope to determine unpaid orders.