<link rel="stylesheet" href="css/font.css" type="text/css" />
<script>
function media_report_print(url)
{
onmouseover650= window.open(url,'onmouseover650','height=580,width=1200,scrollbars=yes,left=50,top=50,toolbar=no,location=no,directories=no,status=no,menubar=no');
}
function media_return_report_overall_excel(from_date,to_date,supplier_name,roll_size,type_1)
{
	
window.location.href="report/media_report/return_media_excel.php?from_date="+from_date+"&to_date="+to_date+"&supplier_name="+supplier_name+"&roll_size="+roll_size+"&type_1="+type_1;
}
</script>
<?php error_reporting(0);
/*********************************Get Found Result And Pagination********************************************************/
include("../../include/db.php");

function get_item_id_media($roll_size)
{
$sql_query11="select * from consumable_creation where particulars='$roll_size' and item='Media' ";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $id=$rsdata11->id;

 } 
 return $id;
}

$type_1=$_GET['type_1'];
 $job_card_no=$_GET['job_card_no'];
 $supplier_name=$_GET['supplier_name'];
  $roll_size=$_GET['roll_size'];
  $from_date=$_GET['from_date'];
 $to_date=$_GET['to_date'];
 $cur_date=date("Y-m-d");
if($from_date!=""){ $from_date1= "DATE_FORMAT(entrydates,'%Y-%m-%d')>='$from_date'"; }else{$from_date1="DATE_FORMAT(entrydates,'%Y-%m-%d')='$cur_date'"; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(entrydates,'%Y-%m-%d')<='$to_date'";}else{$to_date1="DATE_FORMAT(entrydates,'%Y-%m-%d')='$cur_date'";}
if($supplier_name!=""){ $supplier_name41 = "supplier_name='$supplier_name'";}else{$supplier_name41="";}
if($roll_size!=""){ $roll_size41 = "particulars='$roll_size'";}else{$roll_size41="";}

$all_value10 = $from_date1."@".$to_date1."@".$supplier_name41."@".$roll_size41;
$all_array10 = explode('@',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
$get_query105 .= $value10." AND ";
}
}    ?>

<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 onclick="javascript:media_return_report_overall_excel('<?php echo $_GET['from_date']; ?>','<?php echo $_GET['to_date']; ?>','<?php echo $supplier_name; ?>','<?php echo $roll_size; ?>','<?php echo $type_1; ?>')" style="float:right"><img  align="right" src="img/excel-icon.png" width="30" height="30" border="0" title="click to export"></a>
        </td> 
<td width="7%" align="center"><a href="javascript:media_report_print('report/media_report/return_media_report_print.php?from_date=<?php echo $_GET['from_date']; ?>&to_date=<?php echo $_GET['to_date']; ?>&supplier_name=<?php echo $supplier_name; ?>&roll_size=<?php echo $roll_size; ?>&type_1=<?php echo $type_1; ?>');" style="text-decoration:none;"><img src="img/PrinterBlack.png" width="35" height="30" 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="100%"  align="center" cellpadding="0" cellspacing="0"  >
<thead>
<tr>
 
 <th height="23" colspan="2"  valign="middle">Consumable Return Media</th>


</tr>
<tr>   
   
 <th height="23" colspan="2" valign="middle">

<table border="0" width="99%"  align="center" cellpadding="0" cellspacing="0"  >
<tr>
    <th   align="left" >S.No</th>
    <th   align="left" >Date</th>
	<th  align="left" >Return No</th>
	 <th   align="left" >Purchase No</th>
	 <th   align="left" >Invoice No</th>
	<th   align="left" >Supplier Name</th>    
    <th   align="left" >Particulars</th>
    <th   align="left" >Qty</th>
	 <th   align="left" >Mtr/Qty</th>
    <th   align="left" >Total Mtr</th>
	 
 </tr>
 
 </td>
 
 <td colspan="2">
 
   <?php
$i=0;

$sql="select *  from return_media_pur_sublist where $get_query105 id!='' order by return_no ASC ";


    $rs=mysql_query($sql);
     $rscount=mysql_num_rows($rs);
  if($rscount!='')
  {
  $s_no=0;
      while($rsdata=mysql_fetch_array($rs))
        {
         $entry_date=$rsdata['entrydates'];
		 $return_no=$rsdata['return_no'];
		 $purchase_no=$rsdata['media_pur_no'];
         $invoice_no=$rsdata['invoice_no'];
         $supplier_name=$rsdata['supplier_name'];
          $particulars=$rsdata['particulars'];
         $qty=$rsdata['qty'];
		  $mtr_roll=$rsdata['mtr_roll'];
         $tot_mtr=$rsdata['tot_mtr'];
		 
				
          
        $i=$i+1;
        
        
    ?>
        <tr>
           <td  align="left" style="border:1px solid #ddd" ><?php  echo $i; ?>&nbsp;&nbsp;</td>
          <td  height="28" align="left" style="border:1px solid #ddd;" >&nbsp;&nbsp;&nbsp;<?php echo date("d-m-Y",strtotime($entry_date)); ?></td>
		  <td  align="left" style="border:1px solid #ddd;" ><?php  echo $return_no; ?>&nbsp;&nbsp;</td>
		   <td  align="left" style="border:1px solid #ddd;" ><?php  echo $purchase_no; ?>&nbsp;&nbsp;</td> 
         <td  align="left" style="border:1px solid #ddd;" ><?php  echo $invoice_no; ?>&nbsp;&nbsp;</td>
          <td  align="left" style="border:1px solid #ddd" ><?php  echo $supplier_name; ?>&nbsp;&nbsp;</td>
          <td  align="left" style="border:1px solid #ddd" ><?php  echo $particulars; ?>&nbsp;&nbsp;</td>
		  <td  align="left" style="border:1px solid #ddd" ><?php  echo number_format($qty,2); ?>&nbsp;&nbsp;</td>
          <td  align="left" style="border:1px solid #ddd" ><?php  echo number_format($mtr_roll,2); ?>&nbsp;&nbsp;</td>
          <td  align="right" style="border:1px solid #ddd" ><?php  echo number_format($tot_mtr,2); ?>&nbsp;&nbsp;</td>
     
     </tr>
      <?php 
      $sum_tot2+=$tot_mtr;
      }
      }
      ?>
         <tr>
       <th height="28" colspan="9" align="right" style="border:1px solid #ddd" ><strong>Total&nbsp;&nbsp;</strong></th>
          
          <th width="87" align="right" style="border:1px solid #ddd" ><strong><?php  echo number_format($sum_tot2,2); ?>&nbsp;&nbsp;</strong></th>
    </tr>
    </table>
 </td>
  