<link rel="stylesheet" href="css/font.css" type="text/css" />
<script>
function sample_customer_wise_report_print(url)
{
onmouseover433= window.open(url,'onmouseover433','height=580,width=1100,scrollbars=yes,left=50,top=50,toolbar=no,location=no,directories=no,status=no,menubar=no');
}
</script>
<?php error_reporting(0);
/*********************************Get Found Result And Pagination********************************************************/
?>
<style type="text/css">
.style1 {font-size: 28px; font-weight:bold;}
.style20 {
	font-family: Verdana;
	font-size: 12px;
}
</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:sample_customer_wise_report_print('report/sample_customer_wise_report/sample_customer_wise_print.php?from_date=<?php echo $_GET['from_date'];?>&to_date=<?php echo $_GET['to_date'];?>&customer_name=<?php echo $_GET['customer_name'];?>');" 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="97%"  align="center" cellpadding="0" cellspacing="0" style="border:1px solid #ddd" >
<thead>
<tr>
    <th  height="23"  align="center" style="border:1px solid #ddd" >S.No</th>
    <th  align="left" style="border:1px solid #ddd" >&nbsp;Date</th>
    <th  align="left" style="border:1px solid #ddd" >&nbsp;Jobcard No</th>
    <th  align="left" style="border:1px solid #ddd">&nbsp;Customer Name</th>
    <th width="160"  align="left" style="border:1px solid #ddd" >&nbsp;Designer</th>
    <th width="160"  align="left" style="border:1px solid #ddd" >&nbsp;Design Name</th>
    <th width="143"  align="right" style="border:1px solid #ddd" >&nbsp;No.of Pcs</th>
    <th width="185"  align="right" style="border:1px solid #ddd" >&nbsp;Sample Value</th>
    
    </tr>
  <?php
  function get_no_pcs($jobcard_no)
  {
    $sql="select sum(amount) as amount,sum(conformed_amt) as conformed_amt from sample_jobcard_sublist where jobcard_no='$jobcard_no'";

    $rs=mysql_query($sql);
	
   		while($rsdata=mysql_fetch_object($rs))
  			{
   				 
          	$qtys=$rsdata->amount;
	 $total=$rsdata->conformed_amt;
				
			}
			return array($qtys,$total);
  }
  
 $from_date=$_GET['from_date'];
 $to_date=$_GET['to_date'];
$customer_name=$_GET['customer_name'];
$current_date=date('Y-m-d');
if($from_date!=""){ $from_date1= "DATE_FORMAT(entry_date,'%Y-%m-%d')>='$from_date'"; }else{$from_date1= "DATE_FORMAT(entry_date,'%Y-%m-%d')='$current_date'";  }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(entry_date,'%Y-%m-%d')<='$to_date'";}else{$to_date1 = "DATE_FORMAT(entry_date,'%Y-%m-%d')='$current_date'";}
if($customer_name!=""){ $customer_name1 = "cust_name='$customer_name'";}else{$customer_name1="";}

{
$all_value102 = $from_date1."/".$to_date1."/".$customer_name1;
}
$all_array102 = explode('/',$all_value102);
foreach($all_array102 as $value102)
{ 
if($value102!='')
{
  $get_query103 .= $value102." AND ";
}
}	
   $sql="select * from  sample_jobcard_main where $get_query103 main_id!='' order by jobcard_no ASC  ";

    $rs=mysql_query($sql);
	$s_no=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{
   				 $s_no=$s_no+1;
				 $from=$from+1;
                 $id=$rsdata['p_id'];
                 $jobcard_no=$rsdata['jobcard_no'];
				 $cust_name=$rsdata['cust_name'];
				 $designer_name=$rsdata['designer_name'];
				 $design=$rsdata['design'];
				 $color_profile=$rsdata['color_profile'];
				 $job_type=$rsdata['job_type'];
				 $entry_date=$rsdata['entry_date'];
			
				 list($no_pcs,$samp)=get_no_pcs($jobcard_no);
				 
 ?>
    <tr>
    <td width="70" height="28" align="center" style="border:1px solid #ddd">&nbsp;<?php echo $from; ?></td>
    <td width="120" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo date("d-m-Y",strtotime($entry_date));?></td>
    <td width="150" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $jobcard_no; ?></td>
    <td width="300" align="left" style="border:1px solid #ddd">&nbsp;<?php echo ucfirst($cust_name); ?></td>
    <td width="160" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo ucfirst($design); ?></td>
    <td width="160" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo ucfirst($designer_name); ?></td>
   <td width="143"  align="right" style="border:1px solid #ddd" >&nbsp;<?php echo number_format($no_pcs,2); ?></td>
     <td width="185" align="right" style="border:1px solid #ddd" >&nbsp;<?php echo number_format($samp,2); ?></td>
    </tr> <?php $total1+=$no_pcs; 
	$total2+=$samp; 
	}  ?>
  <tr>
   <td colspan="6" height="26" align="right" style="font-size:14px"><strong>Total</strong></td>
      <td align="right" style="font-size:14px"><strong><?php echo number_format($total1,2); ?></strong></td>

   <td align="right" style="font-size:14px"><strong><?php echo number_format($total2,2); ?></strong></td>
    </tr>
  </thead>
</table>
</div>

</div>
</div>
</div>
</div>