Example #1
0
     break;
 case "getItemQuantity":
     $item = new Item();
     print $item->getQuantity($_POST["iditem"]);
     break;
 case "saveInventory":
     $item = new Item();
     $max = $_POST["max"];
     $items = array();
     for ($i = 0; $i <= $max; $i++) {
         if (isset($_POST["hidItem" . $i]) && $_POST["hidItem" . $i] != "") {
             //shouldn't be empty
             $items[] = array("iditem" => $_POST["hidItem" . $i], "itemName" => $_POST["txtItem" . $i], "system" => $_POST["hidSystem" . $i], "manual" => $_POST["txtManual" . $i], "virtualStock" => $_POST["virtualStock" . $i]);
         }
     }
     $response = $item->saveInventory($items);
     if ($response == "true") {
         header("Location: ../view/inventoryReconciliation.php?msg=The inventory was saved");
     } else {
         header("Location: ../view/inventoryReconciliation.php?msg=" . $response);
     }
     break;
 case "UnitConversion":
     $item = new Item();
     $count = $_POST["count"];
     $items = array();
     for ($i = 0; $i < $count; $i++) {
         $items[] = array("iditem" => $_POST["hidItem" . $i], "units" => $_POST["txtUnits" . $i]);
     }
     $response = $item->saveUnitConversion($items);
     if ($response == "true") {