| Current Path : /var/www/html/mmishra/istore/ |
| Current File : /var/www/html/mmishra/istore/stinitialize.inc |
<h3>Stock Initialize</h3>
<center>
<?php
$category = $_REQUEST["category"];
$subcategory = $_REQUEST["subcategory"];
if ($_POST["submit"] == 'INITIALIZE') {
//initialize stock
if ($subcategory) {
mysql_query("update st_subcategory set qty_in=0,qty_out=0,dated=now() where id=$subcategory");
mysql_query("update st_items set qty_in=0,qty_out=0,dated=now() where category=$category and subcategory=$subcategory");
} else {
mysql_query("update st_category set qty_in=0,qty_out=0,dated=now() where id=$category");
mysql_query("update st_subcategory set qty_in=0,qty_out=0,dated=now() where category=$category");
mysql_query("update st_items set qty_in=0,qty_out=0,dated=now() where category=$category");
}
echo "Done";
}
echo "Select category <select name='category' onchange=\"javascript: document.location.href='?pg=$pg&category='+this.value\">
<option value=''></option>";
$rs = mysql_query("select * from st_category order by code");
while ($o = mysql_fetch_object($rs)) {
echo "<option value='$o->id'";
if ($o->id == $category) echo " selected";
echo ">$o->code ($o->qty_in/$o->qty_out)</option>";
}
echo "</select>
subcategory <select name='subcategory'>
<option value=''></option>";
$rs = mysql_query("select * from st_subcategory where category=$category order by code");
while ($o = mysql_fetch_object($rs)) {
echo "<option value='$o->id'";
if ($o->id == $subcategory) echo " selected";
echo ">$o->code ($o->qty_in/$o->qty_out)</option>";
}
echo "</select>
<input type='submit' name='submit' value='INITIALIZE'>";
?>
</center>