Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/irp/irp/pcstore/
Upload File :
Current File : /var/www/html/mmishra/irp/irp/pcstore/what_where.php

<?php
include "page_header.inc";
echo "<b>Whats Where ?</b><br>";

$submit=$_REQUEST["submit"];
$category_code=$_REQUEST["category_code"];
$date1=$_REQUEST["date1"];
$date2=$_REQUEST["date2"];
if ($date1 == "") $date1 = (date("Y") - 1) . "-04-01";
if ($date2 == "") $date2 = date("Y") . "-03-31";

echo "Select <select name='category_code'><option value=''>Item</option>";
$sql="select row_id, category_code, stock_quantity from category_master order by category_code";
$result=mysql_query($sql, $link_id);
while ($query_data = mysql_fetch_array($result)){
  $row_id1=$query_data["row_id"];
  $category_code1=$query_data["category_code"];
  $qty=$query_data["stock_quantity"];
  echo "<option value='$row_id1'";
  if ($category_code == $row_id1) echo " selected";
  echo ">$category_code1 ($qty)</option>";
}
echo "</select><br>";

echo "Received during <input type='text' name='date1' value='$date1' size='10'> to <input type='text' name='date2' value='$date2' size='10'>";
echo " <input type='submit' name='submit' value='OK'><p>";

echo "<table width='100%'>";
echo "<tr bgcolor='orange'><td colspan='9'>Issued separately to user for project</td></tr>";
echo "<tr><th>No.</th><th>Model/Make</th><th nowrap>Parts Code</th><th nowrap>Price</th><th nowrap>Receive Date</th><th nowrap>Issue Date</th><th>User</th><th>Purpose</th><th>Remark</th></tr>";

if ($category_code != ""){
  $sql="select im.supplier_code, im.model_make, im.unit_price, im.receive_date, pm.parts_code, pi.issue_date, pi.destination, pi.issue_for, pi.user_code, pi.remark from item_master im, parts_master pm, parts_issued pi where im.row_id=pm.item_code and pm.row_id=pi.parts_code and im.category_code=$category_code order by im.supplier_code, im.receive_date, pi.issue_date";
  $rs=mysql_query($sql, $link_id);
  if(!$rs) echo sql_error();
  while ($qd = mysql_fetch_array($rs)){
    $i++;
    if ($supplier_code != $qd["supplier_code"]){
      $supplier_code=$qd["supplier_code"];
      $supplier_detail=supplier_detail($supplier_code, $link_id);
      echo "<tr><td colspan='9'><font color='red'>Supplier: $supplier_detail</font></td></tr>";
    }
    $model_make=$qd["model_make"];
    $unit_price=$qd["unit_price"];
    $receive_date=$qd["receive_date"];
    $parts_code=$qd["parts_code"];
    $issue_date=$qd["issue_date"];
    $destination=$qd["destination"];
    $user_code=$qd["user_code"];
    $user_detail=user_detail($user_code, $link_id);
    $issue_for=$qd["issue_for"];
    $remark=$qd["remark"];
    if ($i % 2) echo "<tr id='row1'>"; else echo "<tr id='row2'>";
    echo "<td>$i</td><td>$model_make</td><td><a href='search_parts.php?parts_code=$parts_code'>$parts_code</a></td><td>$unit_price</td><td align='center'>$receive_date</td><td align='center'>$issue_date</td><td>$user_detail</td><td>$destination ($issue_for)</td><td>$remark</td></tr>";
  }
  echo "<tr bgcolor='orange'><td colspan='9'>Used in PC fabrication/replacement/upgradation</td></tr>";
  echo "<tr><th>No.</th><th>Model/Make</th><th nowrap>Parts Code</th><th nowrap>Price</th><th align='center'nowrap>Receive Date</th><th align='center'nowrap>Issue Date</th><th>PC Code</th><th>Purpose</th><th>Remark</th></tr>";
  $sql="select im.supplier_code, im.model_make, im.unit_price, im.receive_date, pm.parts_code, pc.issue_date, pc.used_for, pc.pc_code, pm.remark from item_master im, parts_master pm, pc_configuration pc where im.row_id=pm.item_code and pm.row_id=pc.parts_code and im.category_code=$category_code order by im.supplier_code, im.receive_date, pc.issue_date";
  $rs=mysql_query($sql, $link_id);
  if(!$rs) echo sql_error();
  while ($qd = mysql_fetch_array($rs)){
    $j++;
    if ($supplier_code != $qd["supplier_code"]){
      $supplier_code=$qd["supplier_code"];
      $supplier_detail=supplier_detail($supplier_code, $link_id);
      echo "<tr><td colspan='9'><font color='red'>Supplier: $supplier_detail</font></td></tr>";
    }
    $model_make=$qd["model_make"];
    $unit_price=$qd["unit_price"];
    $receive_date=$qd["receive_date"];
    $parts_code=$qd["parts_code"];
    $issue_date=$qd["issue_date"];
    $issue_for=$qd["used_for"];
    $pc_code=$qd["pc_code"];
    $pc_detail=pc_detail($pc_code, $link_id);
    $remark=$qd["remark"];
    if ($j % 2) echo "<tr id='row1'>"; else echo "<tr id='row2'>";
    echo "<td>$j</td><td>$model_make</td><td><a href='search_parts.php?parts_code=$parts_code'>$parts_code</a></td><td>$unit_price</td><td align='center'>$receive_date</td><td align='center'>$issue_date</td><td>$pc_detail</td><td>$issue_for</td><td>$remark</td></tr>";
  }
}


echo "</table>";
include "../page_footer.inc";
?>