<style>
.style15 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
}
</style>
<script>

function print_fusing_production(url)
{	
onmouseover10= window.open(url,'onmouseover10','height=500,width=1100,scrollbars=no,resizable=no,left=50,top=50,toolbar=no,location=no,directories=no,status=no');	
}
</script>
<?php error_reporting(0);
/***************************** PREVIOUS NEXT CODING ****************************************/
include ("../../include/db.php");
ob_start();
session_start();
 $user_id = $_SESSION['user_type'];

$show = 20;
$num_links = 19;
$from = $_GET['from'];
if (empty($from))
	 {
		$from = "0";
	 } 
else 
	{
	$html_query = $html_query. "&from=$from";
	}
	
$cust_name=$_GET['customer_name'];
$from_date=$_GET['from_date'];
$to_date=$_GET['to_date'];
$current_date=date('Y-m-d');
$job_card_num=$_GET['jobcard_no'];
$fabric_types=$_GET['fabric_type'];
$value=explode(',',$_GET['fabric_type']);
 
                   for($i=0;$i<count($value);$i++){                  
                    $fabric.=$value[$i];                 
				    
				   if($i<(count($value)-1)) {
                   $fabric.="','";
                  
                   }
				   }
if($cust_name!=""){ $customer_name1= "cust_name='$cust_name'"; }else{$customer_name1=''; }
if($from_date!=""){ $from_date1= "DATE_FORMAT( print_date,'%Y-%m-%d' )>='$from_date'"; }else{$from_date1="DATE_FORMAT(print_date,'%Y-%m-%d' )='$current_date'"; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(print_date,'%Y-%m-%d' )<='$to_date'";}else{$to_date1="DATE_FORMAT(print_date,'%Y-%m-%d' )='$current_date'";}
if($job_card_num!=""){ $job_card_nums = "job_card_no='$job_card_num'";}else{$job_card_nums='';}
if($fabric_types!=""){ $fabric_type1 = "fabric_type IN ('$fabric')";}else{$fabric_type1='';}

$all_value10 = $customer_name1.";".$from_date1.";".$to_date1.";".$job_card_nums.";".$fabric_type1;
$all_array10 = explode(';',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
 $get_query104 .= $value10." AND ";
}
}	  

	$sql="select * from fusing_production_main where $get_query104 p_id!='' order by cust_name ASC  ";
$html_query = "main_fram.php?file=fusing_production_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%">&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%"><a onclick="javascript:fusing_production_report_overall_excel('<?php echo $_GET['customer_name']; ?>','<?php echo $_GET['from_date']; ?>','<?php echo $_GET['to_date']; ?>','<?php echo $_GET['jobcard_no']; ?>','<?php echo $fabric_types; ?>')" 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:print_fusing_production('production/fusing_production/fusing_product_print.php?from_date=<?php echo $_GET['from_date'];?>&to_date=<?php echo $_GET['to_date'];?>&customer_name=<?php echo $_GET['customer_name'] ?>&jobcard_no=<?php echo $_GET['jobcard_no']; ?>&fabric_types=<?php echo $fabric_types; ?>');" style="text-decoration:none;"><img src="img/PrinterBlack.png" width="35" height="35" title="Print" value="Print"/></a></td>
  </tr>
</table>
<div class="row-fluid">
<div class="span12">
<div class="table-responsive">
<div class="CSSTableGenerator">  
<table width="99%" border="0" align="center"  cellpadding="0" cellspacing="0" style="border:2px solid #eaeaea;border:1px solid #ddd"  >
      <tr>
      <th align="center" style="border:1px solid #ddd" >S.No</th>
      <th scope="col" align="left" style="border:1px solid #ddd" >&nbsp;Date</th>
      <th width="172" align="left" style="border:1px solid #ddd" scope="col">&nbsp;&nbsp;Jobcard No</th>
      <th scope="col" align="left" style="border:1px solid #ddd" >Customer Name</th>
      <th width="179" align="left" scope="col" style="border:1px solid #ddd" >Job Created</th>
      <th width="143" align="left" scope="col" style="border:1px solid #ddd" >Style No</th>
      <th width="157" align="right" scope="col" style="border:1px solid #ddd" >Style Name&nbsp;</th>
	  <th width="157" align="right" scope="col" style="border:1px solid #ddd" >Fabric Type&nbsp;</th>
      <th width="118" align="center" scope="col" style="border:1px solid #ddd" >Printed Qty</th>
       <?php if(($user_id=='1')||($user_id=='3'))
	 { 
	 ?><th width="59" align="center" scope="col" style="border:1px solid #ddd" >Edit</th>
      <th width="68" align="center" scope="col" style="border:1px solid #ddd" >Delete</th><?php } ?>
      </tr>
  <?php
  include ("../../include/db.php");
  

$cust_name=$_GET['customer_name'];
$from_date=$_GET['from_date'];
$to_date=$_GET['to_date'];
$current_date=date('Y-m-d');
 $job_card_num=$_GET['jobcard_no'];
 $fabric_types=$_GET['fabric_type'];
$value=explode(',',$_GET['fabric_type']);
 
                   for($i=0;$i<count($value);$i++){                  
                    $fabric1.=$value[$i];                 
				    
				   if($i<(count($value)-1)) {
                   $fabric1.="','";
                  
                   }
				   }
if($cust_name!=""){ $customer_name1= "cust_name='$cust_name'"; }else{$customer_name1=''; }
if($from_date!=""){ $from_date1= "DATE_FORMAT( print_date,'%Y-%m-%d' )>='$from_date'"; }else{$from_date1="DATE_FORMAT(print_date,'%Y-%m-%d' )='$current_date'"; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(print_date,'%Y-%m-%d' )<='$to_date'";}else{$to_date1="DATE_FORMAT(print_date,'%Y-%m-%d' )='$current_date'";}
if($job_card_num!=""){ $job_card_nums = "job_card_no='$job_card_num'";}else{$job_card_nums='';}
if($fabric_types!=""){ $fabric_type1 = "fabric_type IN ('$fabric1') ";}else{$fabric_type1='';}

$all_value10 = $customer_name1."/".$from_date1."/".$to_date1."/".$job_card_nums."/".$fabric_type1;
$all_array10 = explode('/',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
 $get_query103 .= $value10." AND ";
}
}	  
	 $sql="select * from fusing_production_main where $get_query103 p_id!='' order by cust_name ASC LIMIT $from,20";
    $rs=mysql_query($sql);
	$sno=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{
   				$sno=$sno+1;
				$from=$from+1;
   				$p_id=$rsdata['p_id'];
   				$job_card_no=$rsdata['job_card_no'];
				$print_date=$rsdata['print_date'];
	   			$cust_name=$rsdata['cust_name'];
	   			$job_created=$rsdata['job_created'];
				$cust_po=$rsdata['cust_po'];
	   			$style_no=$rsdata['style_no'];
	   			$style_name=$rsdata['style_name'];
				$combo=$rsdata['combo'];
	   			$printed_qty=$rsdata['printed_qty'];
				$fabric_type=$rsdata['fabric_type'];
				
  ?>
  <tr>
    <td width="56"  align="center" style="border:1px solid #ddd"><?php echo $from; ?></td>
    <td width="117" align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo date("d-m-Y",strtotime($print_date));?></td>
    <td align="left" style="border:1px solid #ddd">&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $job_card_no;?></td>
    <td width="262" align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo $cust_name;?></td>
    <td align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo $job_created;?></td>
    <td align="left" style="border:1px solid #ddd">&nbsp;<?php echo $style_no;?></td>
    <td align="right" style="border:1px solid #ddd"><?php echo $style_name;?>&nbsp;</td>
	 <td align="right" style="border:1px solid #ddd"><?php echo $fabric_type;?>&nbsp;</td>
    <td align="center" style="border:1px solid #ddd"><?php echo number_format($printed_qty,3);?></td>
    <?php if(($user_id=='1')||($user_id=='3'))
	 { 
	 ?> <td align="center" style="cursor:pointer; border:1px solid #ddd"><img src="img/edit.png" width="17" height="20" title="EDIT" onclick="javascript:edit_fusing_prod_dfetails('<?php echo $p_id;?>','<?php echo $job_card_no;?>');"/></td>
    <td align="center" style="border:1px solid #ddd" ><img src="img/trash.png" style="cursor:pointer" onClick="del_fusing_main('<?php echo $p_id;?>','<?php echo  $job_card_no;?>')" width="20px" height="22px">
   </td><?php } ?>
   </tr>
  <?php } ?>
</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>

