예제 #1
0
    // }
    $query = "SELECT p.upc AS UPC, \n\tp.description AS description,\n\tp.normal_price AS price, \n\td.dept_name AS dept, \n\ts.subdept_name AS subdept, \n\tp.props AS props,\n\tp.foodstamp AS fs, \n\tp.scale AS scale, \n\tp.inuse AS inuse, \n\tp.special_price AS sale\n    FROM " . PRODUCTS_TBL . " AS p \n\t\tINNER JOIN subdepts AS s ON s.subdept_no = p.subdept \n\t\tINNER JOIN departments as d ON d.dept_no = p.department\n    WHERE p.department IN ({$deptArray})\n    {$inuse_filter}";
    // echo $query;
    $result = mysql_query($query);
    $num = mysql_num_rows($result);
    $dictR = mysql_query("SELECT * FROM item_properties");
    echo "<center><h1>Product List</h1></center>";
    // echo "<div id='filterbox'>";
    // while ($filter = mysql_fetch_assoc($dictR)) {
    // echo "<input type='checkbox' name='property[]' value='".$filter['bit']."' onchange='filterTable(this.value);'>".ucwords(strtolower($filter['name']));
    // }
    // echo "<button>show/hide item properties</button>";
    // echo "</div>";
    echo "<table id='output' cellpadding=0 cellspacing=0 border=0 class=\"sortable-onload-1 rowstyle-alt colstyle-alt\">\n\n  <caption>Department range: " . $arrayName . ". Search yielded (" . $num . ") results. Generated on " . date('n/j/y \\a\\t h:i A') . " &mdash; <a id='clearfilters' href='#'>Clear Filters</a></caption>\n\n  <thead>\n\n    <tr>\n\n      <th class=\"sortable-numeric\">UPC</th>\n\n      <th class=\"sortable-text\">Description</th>\n\n      <th class=\"sortable-currency\">Price</th>\n\n      <th filter-type='ddl' class=\"sortable-text\">Dept.</th>\n\n      <th filter-type='ddl' class=\"sortable-text\">Subdept.</th>\n\n      <th class=\"sortable-text\">Item Properties</th>\n\n      <th filter-type='ddl' class=\"sortable-text\">FS</th>\n\n      <th filter-type='ddl' class=\"sortable-text\">wgh.</th>\n\n      <th class=\"sortable-text\">Sale</th>\n\t\t\n    </tr>\n\n  </thead>\n\n  <tbody>\n";
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $b = bindecValues($row["props"]);
        // echo $b . "<br />";
        $prop_arr = explode("|", $b);
        echo '<tr>
		<td align=right><a class="opener" href="../item/itemMaint.php?upc=' . $row["UPC"] . '">' . $row["UPC"] . '</a></td>
		<td>' . $row["description"] . '</td>
		<td align=right>' . money_format('%n', $row["price"]) . '</td>
		<td>' . substr($row["dept"], 0, 10) . '</td>
		<td>' . substr($row["subdept"], 0, 20) . '</td>
		<td>';
        if (!$row["props"] || $row["props"] == 0) {
            echo "";
        } else {
            // print_r($prop_arr);
            foreach ($prop_arr as $i) {
                $tagR = mysql_query("SELECT * FROM item_properties WHERE bit = {$i}");
예제 #2
0
function itemMaintenance($new, $input)
{
    if ($new != 1) {
        $upc = str_pad($input, 13, 0, STR_PAD_LEFT);
        $queryItem = "SELECT p.*, d.* FROM " . PRODUCTS_TBL . " p, product_details d WHERE p.upc = d.upc AND p.upc = '{$upc}'";
        $resultItem = mysql_query($queryItem);
        if (!$resultItem) {
            die("Query: {$queryItem}<br />Error:" . mysql_error());
        }
        $rowItem = mysql_fetch_assoc($resultItem);
    }
    $upc = $new != 1 ? $rowItem['upc'] : $input;
    $upch = $new != 1 ? "<input type=hidden value='" . $rowItem['upc'] . "' name=upc>" : "";
    $cost = $new != 1 ? "value='" . $rowItem['cost'] . "'" : "";
    $desc = $new != 1 ? "value='" . $rowItem['description'] . "'" : "";
    $pric = $new != 1 ? "value='" . $rowItem['normal_price'] . "'" : "";
    $vend = $new != 1 ? "value='" . $rowItem['brand'] . "'" : "";
    // $acti = ($new != 1) ? "action='updateItems.php'" : "action='insertItem.php'";
    $acti = "action='updateItems.php/?new={$new}&upc={$upc}'";
    $csel = $new != 1 ? $rowItem : $row;
    echo "<head><title>Fannie - Item Maintenance</title>";
    echo "</head>";
    echo "<BODY onLoad='putFocus(0,1);'>";
    // print_r($rowItem);
    echo "<form name=itemMaint {$acti} method=post>\n";
    echo "<h3 class=\"acc_head\">Basic Item Information</h3>\n<div class=\"acc_content\">\n";
    echo "<div class='acc_box'>\n<table border=0 cellpadding=5 cellspacing=0>\n";
    echo "<tr><td align=right><b>UPC</b></td>\n\n\t\t<td><font color='red'>{$upc}</font>{$upch}</td>\n<input type='hidden' name='upc' value='{$upc}' />\n\t\t<td>&nbsp;</td>\n\t\t<td>&nbsp;</td></tr>\n";
    echo "<tr><td><b>Description</b></td>\n\n\t\t<td><input type=text size=30 {$desc} name=descript></td>\n\n\t\t<td align='right'><b>Price \$</b></td>\n\n\t\t<td><input type=text {$pric} name=price size=6></td></tr>";
    if ($new != 1 && $rowItem['special_price'] != 0) {
        echo "<tr><td><font color=green><b>Sale Price:</b></font></td>\n<td><font color=green>{$rowItem['6']}</font></td>\n<td>";
        echo "<font color=green>End Date:</td>\n<td><font color=green>{$rowItem['11']}</font></td><tr>\n";
    }
    echo "<tr><td align=right><b>Vendor</b></td>\n\t\t<td><input type=text size=30 {$vend} name=vendor></td>\n\t\t<td align=right><b>Cost \$</b></td>\n\n\t\t<td><input type=text {$cost} name=cost size=6></td></tr>\n";
    echo "</table>\n";
    echo "<hr>\n";
    echo "<table border=0 cellpadding=5 cellspacing=0 width='100%'>\n<tr>";
    echo "<th>Dept & SubDept</th><th>FS</th><th>Scale</th><th>QtyFrc</th><th>NoDisc</th><th>Active</th>";
    echo "</tr>\n";
    echo "<tr valign=top>";
    echo "<td align=left>";
    $dresult = mysql_query("SELECT * FROM departments");
    echo "<select id=\"dept_list\" name=\"department\">\n";
    echo "<option value=\"\">----------------</option>\n";
    while ($drow = mysql_fetch_array($dresult)) {
        echo "<option value=" . $drow['dept_no'];
        if ($new != 1) {
            if ($drow['dept_no'] == $rowItem['department']) {
                echo " selected=\"selected\"";
            }
        }
        echo ">" . $drow['dept_name'] . "</option>\n";
    }
    echo "</select>\n\n";
    $sresult = mysql_query("SELECT * FROM subdepts");
    echo "<select id=\"subdept_list\" name=\"subdepartment\">\n";
    echo "<option value=\"\">----------------</option>\n";
    while ($srow = mysql_fetch_array($sresult)) {
        echo "<option value=" . $srow['subdept_no'] . " class=" . $srow['dept_ID'];
        if ($new != 1) {
            if ($srow['subdept_no'] == $rowItem['subdept']) {
                echo " selected=\"selected\"";
            }
        }
        echo ">" . $srow['subdept_name'] . "</option>\n";
    }
    echo "</select>\n\n";
    echo "</td>\n<td align=center><input type=checkbox value=1 name=FS";
    if ($new != 1 && $rowItem["foodstamp"] == 1) {
        echo " checked";
    }
    echo "></td>\n<td align=center><input type=checkbox value=1 name=Scale";
    if ($new != 1 && $rowItem["scale"] == 1) {
        echo " checked";
    }
    echo "></td>\n<td align=center><input type=checkbox value=1 name=QtyFrc";
    if ($new != 1 && $rowItem["qttyEnforced"] == 1) {
        echo " checked";
    }
    echo "></td>\n<td align=center><input type=checkbox value=0 name=NoDisc";
    if ($new != 1 && $rowItem["discount"] == 0) {
        echo " checked";
    }
    echo "></td>\n<td align=center><input type=checkbox value=1 name=inUse";
    if ($new != 1 && $rowItem["inUse"] == 1) {
        echo " checked";
    } elseif ($new == 1) {
        echo " checked";
    }
    echo "></td></tr>\n<tr><td>&nbsp;</td>\n<td colspan='2' align='right'>\$<input type='text'";
    if (!isset($rowItem['deposit']) || $rowItem['deposit'] == 0) {
        echo "value='0'";
    } else {
        echo "value='" . $rowItem['deposit'] . "'";
    }
    echo "name='deposit' size='5'></td>";
    echo "<td colspan='3' align='left'>Bottle deposit</td></tr></table>";
    echo "</div>\n</div>\n";
    // close first accordian
    echo "<h3 class=\"acc_head\">Item Details</h3>\n<div class=\"acc_content\">\n";
    echo "<div class='acc_box'>\n";
    echo "<table border=0 cellspacing=2 cellpadding=2>\n";
    $dictR = mysql_query("SELECT * FROM item_properties");
    if (!$dictR) {
        die("Query: {$queryItem}<br />Error:" . mysql_error());
    }
    if ($new != 1) {
        $p = $rowItem['props'];
        $b = bindecValues($p);
        $prop_arr = explode("|", $b);
    }
    while ($dict = mysql_fetch_assoc($dictR)) {
        $value = $dict['bit'];
        echo "<tr><td><input type=checkbox name=prop[] value=" . $value . " id=chkbox-" . $value;
        if ($new != 1) {
            if (in_array($value, $prop_arr)) {
                echo " CHECKED";
            }
        }
        echo "></input></td>\n<td><p><b><label for=chkbox-" . $value . ">" . ucwords(strtolower($dict['name'])) . "</label></b></p></td>\n\t\t\t<td><a class='itemtag' href='#' title='" . $dict['name'] . "'>" . acronymize($dict['name']) . "</a></td>\n\t\t\t<td>" . $dict['notes'] . "</td></tr>\n";
    }
    echo "</table>\n";
    echo "</div>\n</div>\n";
    // close 2nd accordion
    echo "<br /><br />\n<table border=0><tr><td><input type='submit' name='submit' value='submit'>&nbsp;<a href='../item/itemMaint.php'><font size='-1'>cancel</font></a>";
    echo "</td><td colspan=5>&nbsp;</td></tr>\n</table>\n";
    echo "<script src=\"" . SRCROOT . "/js/jquery.chained.js\" type=\"text/javascript\"></script>\n";
    ?>
		<script type="text/javascript"> 
			$(function(){
				$("#subdept_list").chained("#dept_list"); 
			});
		</script>


	<?php 
}
예제 #3
0
if ($row["discount"] == 0) {
    echo " checked";
}
echo "></td><td align=center><input type=checkbox value=1 name=inUse";
if ($row["inUse"] == 1) {
    echo " checked";
}
echo "></td><td align=center><input type=text value='" . $row["deposit"] . "' name=deposit size='5'";
echo "></td></tr>";
//echo "<tr><td>" . $row[4] . "</td><td>" . $row[5]. "</td><td>" . $row[6] ."</td><td>" . $row[7] . "</td><td>" . $row[8] . "</td></tr>";
//echo "<tr><td>" . $row[9] . "</td><td>" . $row[10] . "</td><td>" . $row[11] . "</td><td>" . $row[12] . "</td>";
echo "<tr><td colspan='8'>";
$dictR = mysql_query("SELECT * FROM item_properties");
$p = $row[29];
// echo "\$props = " . $p . "<br />";
$b = bindecValues($p);
// echo $b . "<br />";
$prop_arr = explode("|", $b);
// print_r($prop_arr);
echo "<b>Item Properties: </b>";
while ($dict = mysql_fetch_assoc($dictR)) {
    $value = $dict['bit'];
    if (in_array($value, $prop_arr)) {
        echo "<span class='itemtag'>" . $dict['name'] . "</span>";
    }
}
echo "</td></tr>";
echo "</table>";
echo "<hr>";
echo "<form action='" . DOCROOT . "/item/itemMaint.php' method=post>";
echo "<input name=upc type=text id=upc> Enter UPC/PLU here<br>";