Fixed SQL queries for the top status box on homepage

This did start out as device count was blank on a new install but I found:

The queries being used here didn't match up for admin users to lower level users. I've sorted these all out and updated the queries so they should work fine.