<link rel="stylesheet" href="css/font.css" type="text/css" />
<script>function local_cnfrm_print(url)
{
onmouseover43= window.open(url,'onmouseover43','height=580,width=1100,scrollbars=yes,left=50,top=50,toolbar=no,location=no,directories=no,status=no,menubar=no');
}
function cons_edit(edit_id,empty_return_no)
{
window.location.href="main_fram.php?file=empty_can_dc_form&main_id=" + edit_id + "&empty_return_no=" + empty_return_no;
}


</script>
<?php error_reporting(0);
date_default_timezone_set('Asia/Kolkata');
/*********************************Get Found Result And Pagination********************************************************/
include("../../include/db.php");
ob_start();
session_start();
$user_id = $_SESSION['login_user_id'];

$show = 20;
$num_links = 19;
$from = $_GET['from'];
if (empty($from))
	 {
		$from = "0";
	 } 
else 
	{
	$html_query = $html_query. "&from=$from";
	}

 $from_date=$_GET['from_date'];
 $to_date=$_GET['to_date'];
 $return_no=$_GET['return_no'];
 $current_date=date('Y-m-d');

 if($return_no!=""){ $return_no1= "return_no='$return_no'"; }else{$return_no1=''; }
 if($from_date!=""){ $from_date1= "create_date >='$from_date'"; }else{$from_date1="DATE_FORMAT(create_date,'%Y-%m-%d' )='$current_date'"; }
 if($to_date!=""){ $to_date1= "create_date <='$to_date'"; }else{$to_date1="DATE_FORMAT(create_date,'%Y-%m-%d' )='$current_date'"; }

$all_value10 = $from_date1."@".$to_date1."@".$return_no1;
$all_array10 = explode('@',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
$get_query102 .= $value10." AND ";
}
}	

if(($from_date=='')&&($to_date==''))
  {
    $sql="select * from  return_media_purchase where create_date='$current_date'  order by id  ASC ";
  } 

else
  {
 $sql="select * from  return_media_purchase where $get_query102 id!='' order by id ASC";
  }




$html_query = "main_fram.php?file=consumable_return_form_list";
$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>

<table width="100%">
   <tr>
<td width="1%" height="38">&nbsp;</td>
<td width="7%" class="style15">&nbsp;</td> 
<td width="13%" align="center">&nbsp;</td>
<td width="1%">&nbsp;</td>
<td width="6%" class="style15">&nbsp;</td>
<td width="14%" align="center"  class="style15">&nbsp;</td>
<td width="2%">&nbsp;</td>
<td width="11%" class="style15">&nbsp;</td>
<td width="24%" align="left" >&nbsp;</td>
<td width="8%" align="center">&nbsp;</td>
<td width="2%"></td>
<td width="7%" align="center"><a href="javascript:local_cnfrm_print('consumable/empty_can_dc_form/empty_print.php?from_date=<?php echo $_GET['from_date'];?>&to_date=<?php echo $_GET['to_date'];?>&return_no=<?php echo $_GET['return_no']; ?>');" style="text-decoration:none;"><img src="img/PrinterBlack.png" width="35" height="35" title="Print" value="Print"/></a></td>
  </tr>
</table>
<div class="container">
<div class="row-fluid">
<div class="span12">
<div class="table-responsive">
<div class="CSSTableGenerator">  

<table border="0" width="99%"  align="center" cellpadding="0" cellspacing="0" style="border:1px solid #ddd" >
<thead>
<tr>
    <th  align="center" width="47" style="border:1px solid #ddd" >S.No</th>
       <th width="108"  align="left" style="border:1px solid #ddd" >&nbsp;&nbsp;Date</th>
    <th width="108"  align="left" style="border:1px solid #ddd" >&nbsp;&nbsp;Empty Return No</th>
    <th  align="left" style="border:1px solid #ddd" >&nbsp;Packing Total</th>
    <!--th  align="left" style="border:1px solid #ddd" >Ref name</th-->
    <th  align="right" style="border:1px solid #ddd" >Qty Total</th>
    
   <?php if(($user_id=='1')||($user_id=='3'))
	 { 
	 ?>  <th  width="64" style="border:1px solid #ddd" >Edit</th>
    <th  width="58" style="border:1px solid #ddd" >Delete</th><?php } ?>
</tr>
  <?php
include("../../include/db.php");  
ob_start();
session_start();
$show = 10;
$num_links = 9;
$from = $_GET['from'];
if (empty($from))
	 {
		$from = "0";
	 } 
else 
	{
	$html_query = $html_query. "&from=$from";
	}

  $from_date=$_GET['from_date'];
 $to_date=$_GET['to_date'];
 $return_no=$_GET['return_no'];
 $current_date=date('Y-m-d');
 
if($from_date!=""){  $from_date1= "DATE_FORMAT( create_date,'%Y-%m-%d' )>='$from_date'"; }else{$from_date1="DATE_FORMAT(create_date,'%Y-%m-%d' )='$current_date'"; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(create_date,'%Y-%m-%d' )<='$to_date'";}else{$to_date1="DATE_FORMAT(create_date,'%Y-%m-%d' )='$current_date'";}
if($return_no!=""){ $return_no1 = "empty_can_return_no='$return_no'";}else{$return_no1='';}

 $all_value10 = $from_date1.";".$to_date1.";".$return_no1;
$all_array10 = explode(';',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
 $get_query104 .= $value10." AND ";
}
}	 
if(($from_date=='')&&($to_date==''))
{
  $sql="select * from  empty_can_dc where  DATE_FORMAT( create_date,  '%Y-%m-%d' )='$current_date'  order by id  ASC LIMIT $from,20";
  } 
else
{
  $sql="select * from  empty_can_dc where $get_query104 	id!='' order by id ASC LIMIT $from,20";
}
  $rs=mysql_query($sql);
	$s_no=$_GET['from'];
   		while($rsdata=mysql_fetch_array($rs))
  			{
			 	
   				 $s_no=$s_no+1;
                 $id=$rsdata['id'];
                 $empty_return_no=$rsdata['empty_can_return_no'];
				 $media_ink_time=$rsdata['create_date'];
				 $pac_total=$rsdata['packing_total'];
				 $ref_name=$rsdata['ref_name'];
				 $total=$rsdata['qty_total'];
                  

 ?>
  <tr>
    <td width="47"  align="center" style="border:1px solid #ddd">&nbsp;<?php echo $s_no; ?></td>
    <?php $day=date("d-m-Y",strtotime($rsdata['empty_can_time'])); ?>
      <td align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $day; ?></td>
    <td align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $empty_return_no; ?></td>
    <td width="118" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $pac_total; ?></td>
    <!--td width="110" align="left" style="border:1px solid #ddd" >&nbsp;<-?php echo $ref_name; ?></td-->
     <td width="110" align="right" style="border:1px solid #ddd" >&nbsp;<?php echo number_format($total,2); ?></td>
    
  <?php if(($user_id=='1')||($user_id=='3'))
	 { 
	 ?> 
        <td align="center" style="border:1px solid #ddd"  ><img src="img/edit.png" style="cursor:pointer"width="13" height="16" title="EDIT" onclick="javascript:cons_edit('<?php echo $id;?>','<?php echo $empty_return_no;?>');"/></td>
    <td align="center" style="border:1px solid #ddd" ><a href="#" onClick="main_empty_delete('<?php echo $id;?>','<?php echo $empty_return_no;?>');"><img src="img/trash.png" alt="delete" title="DELETE" border="0" width="17px;" height="20px;" /></a></td><?php } ?>
  </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("footer_links1.php");
			  } 
			  
	?></th>
 </tr>
</table>
</div>
</div>
</div>