Replace failed query with call to existing function
Merge pull request #1000 from JeffPyeBrook/remaining-quantity-query-error

Replace failed query with call to existing function