Fixed the invoice number calculation