
<body background="i.jpg">
<?php include("../../include/dbconnect.php");


// Get all _POST VALUES HERE..

  foreach($_POST as $p=>$t)
  {
     $_POST[$p] = trim($t);
  }

  $myDate = $_POST['Date'];
?>

<title>Requirement Items View / Edit</title>
<body background=blater01.gif  topmargin=0>
<center>
<table cellpadding=0 cellspacing=4 width=790>
<tr>
<td style="padding:3px;" colspan=2 bgcolor="#93BEE2"><font face="Verdana, Arial, Helvetica, sans-serif"><b><b>Requirement Items View / Edit</b></font></td>
</tr><tr valign="top"><td colspan=2>
<font >&nbsp;</font>
</td>
</tr>
</table>
<table border=0 cellpadding=3 cellspacing=4 width="970">
       

      <tr > 
        <td width="139" height="31" align="right" ><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#003366">Date of Indent
          &nbsp;</font></b></font></td><td>

<?

// Pull all the data from Date master & populate it

$stQuery = mysql_query("select distinct date  from matindent order by date desc");

?>
  <form name='myForm01' method='POST' action='<?=$_SERVER[PHP_SELF]?>'>
  <SELECT name='Date' onChange="javascript:submit();">

<?
     echo "<option selected value=\" 0\"> Select Date";
    while($row = mysql_fetch_row($stQuery))
    {

		$date = british($row[0]);
        if(isset($myDate) && eregi("$myDate",$row[0]))
	    {
            echo "<option selected value=\"$row[0]\">$date";
        }
        else{
            echo "<option value=\"$row[0]\">$date";
        }
    }
?>
        </SELECT>
</td></tr>
</form>



<?

// Pull all Customers from Customer  based on Selected Date id and populate it.





// This form contain a hidden field DateID which can be later used in next  page..
?>

  <form name='myForm02' method='POST' action='editview.php' >
  <?
$result=mysql_query("select distinct matindent.record,indent_no,prodname,qty,unit,date,used_for,req_date,remarks,approved,approved_qty,po_issued_qty,app_date,approved_by,received_qty,po_prepared,pur_ref,account_year from matindent,rawmaterial  where date='$myDate' and matindent.prodcode=rawmaterial.prodcode order by date") or
die(mysql_error());

$number_cols=mysql_num_fields($result);
echo "<table border=1> \n";
echo "<tr align=center> \n";
for($i=0;$i<$number_cols;$i++)
{
echo "<th>" . mysql_field_name($result,$i).   "</th>\n";
}
echo "<tr>\n";

//layout table

while($row = mysql_fetch_row($result))
{
echo "<tr align=left> \n";
echo "<td>";
if(!isset($row[0])) //test for null value
{
echo "NULL";
}
else
{
?>
<a href = "editview.php?record=<?echo($row[0]);?>"><?echo($row[0]);?></a>
<?

}

for($i=1;$i<$number_cols;$i++)
{
echo "<td>";
if(!isset($row[$i])) //test for null value
{
echo "NULL";
}
else
{
echo $row[$i];
}
echo "</td>\n";
}
echo "</tr> \n";
}


?>
</table>
<input type="hidden" name="fname" value="<?echo $filename;?>">
<form><br><br><font size=1><center><a href= "index.html">Return to index page</center></font>
</body>
</form>