You are correct about the 'Qty on Hand' equalling the sum of the 5 Qty costing lots, if you mean the 'Qty on Hand' field found in the Item Master table. The Quantites by Location field values has no influence over the 'Qty on Hand' calculated value.
There can be a difference in reported quantities if you have posted invoices in OrderEntry and not yet performed Day End Processing. In this case, the 'Quantity Shipped not Costed' will have a non-zero value and be the difference. You will need to use the Qty Shipped not Costed field as part of your calculations to arrive at a matching quantity value.
_________________________
Regards,
Softrak Tech Support