Implementing invoices counting and logout