<link rel="stylesheet" href="css/font.css" type="text/css" />

<?php error_reporting(0);
/*********************************Get Found Result And Pagination********************************************************/

include("../../include/db.php");
$show = 20;
$num_links = 19;
$from = $_GET['from'];
if (empty($from))
	 {
		$from = "0";
	 } 
else 
	{
	$html_query = $html_query. "&from=$from";
	}
$sql="select * from  consumable_creation"; 
$html_query = "main_fram.php?file=consumable_creation";
$result=mysql_query($sql);
$num_results=mysql_num_rows($result);
if ($num_results == 0) 
{
 $confirmation = "No Records!";
} 
elseif ($num_results == 1) 
{
$confirmation = "Found 1 Record.";
} 
else 
{
$confirmation = "Found $num_results Records.";
} 
?>
<style type="text/css">
<!--
.style1 {font-size: 16px}
-->
</style>
<div class="container">
<div class="row-fluid">
<div class="span12">
<div class="table-responsive">
<div class="CSSTableGenerator">  

<table border="0" width="98%"  align="center" cellpadding="0" cellspacing="0" style="border:1px solid #ddd" >
<thead>
<tr>
    <th width="49" height="21"  align="center"  style="border:1px solid #ddd" >S.No</th>
    <th  align="left" style="border:1px solid #ddd" >&nbsp;Item Name</th>
    <th width="134"  align="left" style="border:1px solid #ddd" >&nbsp;Particulars</th>
    <th width="253"  align="left" style="border:1px solid #ddd" >&nbsp;Description</th>
    <th width="100"  align="left" style="border:1px solid #ddd" >&nbsp;Status</th>
    <th  width="91" style="border:1px solid #ddd" >Edit</th>
    <th  width="95" style="border:1px solid #ddd" >Delete</th>
</tr>


  <?php

include("../../include/db.php");


echo $sql="select * from  consumable_creation order by id ASC LIMIT $from,20 ";
    $rs=mysql_query($sql);
	$sno=0;

   while($rsdata=mysql_fetch_array($rs))
  {
    
   $sno=$sno+1;
   $from=$from+1;
   $id=$rsdata['id'];
   $item=$rsdata['item'];
   $particulars=$rsdata['particulars'];
   $description=$rsdata['description'];
   $status_type=$rsdata['status_type'];
//echo "SELECT ink_pur_sublist.particulars FROM ink_purchase
 //JOIN ink_pur_sublist ON ink_purchase.ink_pur_no=ink_pur_sublist.ink_pur_no where ink_pur_sublist.particulars = '$particulars' ";

   $sql1=mysql_num_rows(mysql_query("SELECT ink_pur_sublist.particulars FROM ink_purchase
 JOIN ink_pur_sublist ON ink_purchase.ink_pur_no=ink_pur_sublist.ink_pur_no where ink_pur_sublist.particulars = '$particulars' "));
 echo "SELECT media_pur_sublist.particulars FROM media_purchase
 JOIN media_pur_sublist ON media_purchase.media_pur_no=media_pur_sublist.media_pur_no where media_pur_sublist.particulars = '$particulars' ";

    $sql2=mysql_num_rows(mysql_query("SELECT media_pur_sublist.particulars FROM media_purchase
 JOIN media_pur_sublist ON media_purchase.media_pur_no=media_pur_sublist.media_pur_no where media_pur_sublist.particulars = '$particulars' "));
 ?>
  <tr>
    <td width="49"  align="center" style="border:1px solid #ddd" ><?php echo $sno; ?></td>
    <td width="202" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo ucfirst($item);?></td>
        <td align="left" style="border:1px solid #ddd;" >&nbsp;<?php echo ucfirst($particulars);?></td>
<td align="left" style="border:1px solid #ddd;" >&nbsp;<?php echo ucfirst($description);?></td>
<td align="left" style="border:1px solid #ddd;" >&nbsp;<?php echo ucfirst($status_type);?></td>
    <td align="center" style="border:1px solid #ddd"  ><img src="img/edit.png" style="cursor:pointer"width="13" height="15" title="EDIT" onclick="javascript:add_consumable_creation('master_entry/consumable_creation/consumable_entry.php?edit_id=<?php echo $id;?>')"/></td>
    
    <td align="center" style="border:1px solid #ddd" ><?php if(($sql1 == 0)&&($sql2 == 0)){?><a href="#" onClick="consumable_delete('<?php echo $id;?>');"><img src="img/cross_deletes.png" alt="delete" title="DELETE" border="0" width="13px;" height="14px;" /></a>  <?php }?>  </td>
 
  </tr>
  <?php } ?>
  </thead>
</table>
</div>
<table border="0" width="99%"  align="center" cellpadding="0" cellspacing="0" >

 <tr>
    <th height="19" align="left" style="font-size:12px; font-family:sans-serif; padding-top:10px;" scope="col"><?php echo $confirmation;?></th>
	<th scope="cols" width="8%" align="right"><?php  
			  if ($num_results > $show) 
			  {
			  $show;
			include("include/footer_links.php");
			  }
	?></th>
 </tr>
</table>
</div>
</div>
</div>

