Inventory Control
The Inventory control of the IBuySpy Delivery 2005 sample application accesses the Products and Categories database tables. When you use this control, you can purchase additional products at the point of delivery.
Using the Inventory Control
As shown in the following illustration, the Category, Product, and Quantity drop-down lists are populated based on available inventory. A product is considered available for purchase if it is currently in an order record for which the Status is set to Failed.
The Category drop-down box includes all categories that contain at least one product available for purchase.
The Product drop-down box shows the existing products in a particular category that can be purchased. Only products with quantities more than 1 are shown.
The Quantity drop-down box displays the available inventory of a particular product. This is not the availability of the product at the warehouse, but the number of items on the delivery truck that are available for purchase, found in orders that are marked as Failed.
The Price field is stored in the database for each product. The Subtotal field is calculated as the price multiplied by the selected quantity.
Tapping Add Product adds the selected product to the order: The item is appended to the original order as a new record in the Order Details table, and then the Orders Control is loaded. Tapping Cancel also loads the Orders control, but the original order record remains unchanged.
If you arrive at the Inventory control by using the navigation buttons instead of first selecting a customer and an order, Add Product and Cancel are not available.
Besides the application's logo on the control, an image of the selected product is also displayed. The name of the image is stored in the Products table. The actual product image is downloaded onto the device when you first deploy the application. When a product is selected in the Product drop-down list, the image name is retrieved from the database and the appropriate image is displayed.