示例#1
0
include_once "../model/Vendor.php";
$opcion = $_GET["opcion"];
switch ($opcion) {
    case "addVendorPrices":
        $vendor = new Vendor();
        $idvendor = $_POST["cmbVendor"];
        $count = $_POST["count"];
        $max = $_POST["max"];
        $items = array();
        for ($i = 0; $i <= $max; $i++) {
            if (isset($_POST["txtItem" . $i])) {
                $items[] = array("iditem" => $_POST["hidItem" . $i], "price" => $_POST["txtPrice" . $i], "adjPrice" => $_POST["txtAdjPrice" . $i], "order" => $_POST["hidOrder" . $i]);
            }
        }
        $msg = $vendor->addVendorPrices($idvendor, $items);
        if ($msg == "true") {
            $msg = "Vendor prices added";
        } else {
            $msg = utf8_encode($msg);
        }
        header("Location: ../view/vendorPriceAdd.php?edit=true&idvendor={$idvendor}&msg=" . $msg);
        break;
    case "editVendorPrices":
        $vendor = new Vendor();
        $idvendor = $_POST["cmbVendor"];
        $count = $_POST["count"];
        $max = $_POST["max"];
        $items = array();
        for ($i = 0; $i <= $max; $i++) {
            if (isset($_POST["txtItem" . $i])) {