Expiry time of session not considered.

We logout the user, when the user logs out by clicking the logout
button.
Placing the report calculation code in a separate function.