Bug fix for inventory and plant details

The count was incorrectly counting the number of jobs an inventory or
plant item was associated to.