| Current Path : /var/www/html/mmishra/iws8/html/backup/mcell/master/ |
| Current File : /var/www/html/mmishra/iws8/html/backup/mcell/master/scrap_item_entry.php |
<?php
include "../page_header.inc";
echo "<form method='post' action='/php/mcell/master/scrap_item_entry.php'>";
$submit = $_REQUEST["submit"];
$item_code = strtoupper($_REQUEST["item_code"]);
$status = $_REQUEST["status"];
echo "<b>Scrap Item Entry</b> (on " . date("d-m-Y") . ")</b><p>";
switch ($submit){
case "SAVE":
$sql = "update item_master set status='$status' where item_code='$item_code'";
$result = mysql_query($sql, $link_id);
if(!$result) echo sql_error();
//update stock_quantity & total_cost in category_master table, first get available stock status
$sql = "select count(item_code) qty from item_master where status in ('new', 'old')";
$result = mysql_query($sql, $link_id);
$query_data = mysql_fetch_array($result);
$qty1 = $query_data["qty"];
$sql = "select count(item_code) qty from item_master where status in ('issued')";
$result = mysql_query($sql, $link_id);
$query_data = mysql_fetch_array($result);
$qty2 = $query_data["qty"];
$sql = "select count(item_code) qty from item_master where status in ('scrap')";
$result = mysql_query($sql, $link_id);
$query_data = mysql_fetch_array($result);
$qty3 = $query_data["qty"];
//update into item_master table
$sql = "update category_master set stock_quantity=$qty1, issued_quantity=$qty2, scrap_quantity=$qty3 where category_code='$category_code'";
$result = mysql_query($sql, $link_id);
if(!$result) echo sql_error();
break;
default:
break;
}
echo "<table><tr><th nowrap>Item Code</th><td><input type='text' name='item_code' value='$item_code' size='10'></td>";
echo "<td><input type='submit' name='submit' value='FIND'></td></tr></table>";
if ($item_code == ""){
}else{
$sql = "select * from item_master where item_code='$item_code'";
$result = mysql_query($sql, $link_id);
if(!$result) echo sql_error();
if (mysql_num_rows($result)){
$query_data = mysql_fetch_array($result);
$description = $query_data["description"];
$unit_price = $query_data["unit_price"];
if ($unit_price == "") $unit_price = 0;
$model = $query_data["model"];
$make = $query_data["make"];
$receive_date = $query_data["receive_date"];
$status = $query_data["status"];
$supplier_code = strtoupper($query_data["supplier_code"]);
$remark = $query_data["remark"];
//see whether it is configurable or not
$sql = "select configuration from category_master where category_code='$category_code'";
$result = mysql_query($sql, $link_id);
$query_data = mysql_fetch_array($result);
$configuration = $query_data["configuration"];
echo "<center><table><tr><td nowrap>Item Code</td><th>$item_code</th><td>Received On</td><td>$receive_date</td></tr>";
echo "<tr valign='top'><td>Description</td><td colspan='3'>$description</td></tr>";
echo "<tr><td>Unit Price</td><td>Rs. $unit_price</td><th>Status</th><th><del>$status</del>";
if ($status == "scrap") echo "<input type='checkbox' name='status' value='old'> Old</th></tr>";
else echo "<input type='checkbox' name='status' value='scrap'> Scrap</th></tr>";
echo "<tr><td>Model</td><td>$model</td></tr>";
echo "<tr><td>Make</td><td>$make</td></tr>";
echo "<tr valign='top'><td>Remark</td><td colspan='3'>$remark</td></tr>";
if ($configuration == "YES") echo "<tr><td><a href='/php/mcell/master/configuration_entry.php?category_code=$category_code&configuration_code=$item_code' target='center'>Configuration</a></td>";
else echo "<tr><td></td><td colspan='2'><input type='submit' name='submit' value='SAVE'> <input type='reset' name='submit' value='RESET'></td></tr>";
echo "<tr><td colspan='5'><b>Item Details</b><br><iframe src='/php/mcell/master/item_details_view.php?category_code=$category_code' name='center' width='100%' height='120'></iframe></td></tr>";
echo "</table>";
}else{
echo "Invalid item code";
}
}
?>
</form>
<?php
include "../page_footer.inc";
?>