<link rel="stylesheet" href="css/font.css" type="text/css" />
<script>
function sample_designer_jobcard_report_print(url)
{
onmouseover434= window.open(url,'onmouseover434','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********************************************************/
include("../../include/db.php");
$show = 20;
$num_links = 9;
$from = $_GET['from'];
if (empty($from))
	 {
		$from = "0";
	 } 
else 
	{
	    $html_query = $html_query. "&from=$from";
	}

 $from_date=date('Y-m-d',strtotime($_GET['from_date']));
 $to_date=date('Y-m-d',strtotime($_GET['to_date']));
 $designer_name=$_GET['designer_name'];

$current_date=date('Y-m-d');
if($from_date!=""){ $from_date1= "DATE_FORMAT(entry_date,'%Y-%m-%d')>='$from_date'"; }else{$from_date1=""; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(entry_date,'%Y-%m-%d')<='$to_date'";}else{$to_date1="";}
if($designer_name!=""){ $designer_name1 = "design='$designer_name'";}else{$designer_name1="";}

{
$all_value102 = $from_date1."/".$to_date1."/".$designer_name1;
}
$all_array102 = explode('/',$all_value102);
foreach($all_array102 as $value102)
{ 
if($value102!='')
{
  $get_query105 .= $value102." AND ";
}
}	  
if($_GET['from_date']!='')
{
   $sql="select * from  sample_jobcard_main where $get_query105 main_id!='' order by jobcard_no ASC  ";
}
else
{  $sql="select * from  sample_jobcard_main where DATE_FORMAT(entry_date,'%Y-%m-%d')='$current_date' and main_id!='' order by jobcard_no ASC  ";

}
$html_query = "main_fram.php?file=Date_wise_fusing";
$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:sample_designer_jobcard_report_print('report/designer_wise_report/designer_wise_print.php?from_date=<?php echo $_GET['from_date'];?>&to_date=<?php echo $_GET['to_date'];?>&designer_name=<?php echo $_GET['designer_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="26"  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 width="300"  align="left" style="border:1px solid #ddd" >&nbsp;Customer Name</th>
     <th width="180"  align="left" style="border:1px solid #ddd" >&nbsp;Designer</th>
    <th width="162"  align="left" style="border:1px solid #ddd" >&nbsp;Design Name</th>
    <th width="135"  align="right" style="border:1px solid #ddd" >&nbsp;No.of Pcs</th>
    <th width="182"  align="right" style="border:1px solid #ddd" >&nbsp;Sample Value</th>
    
    </tr>
    
  <?php

  function get_design_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))
  			{
   				 
          	$amt=$rsdata->amount;
	        $con_amt=$rsdata->conformed_amt;
				
			}
			return array($amt,$con_amt);
  }


$from_date=date('Y-m-d',strtotime($_GET['from_date']));
$to_date=date('Y-m-d',strtotime($_GET['to_date']));
$designer_name=$_GET['designer_name'];
$current_date=date('Y-m-d');
if($from_date!=""){ $from_date1= "DATE_FORMAT(entry_date,'%Y-%m-%d')>='$from_date'"; }else{$from_date1=""; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(entry_date,'%Y-%m-%d')<='$to_date'";}else{$to_date1="";}
if($designer_name!=""){ $designer_name1 = "design='$designer_name'";}else{$designer_name1="";}

{
$all_value102 = $from_date1."/".$to_date1."/".$designer_name1;
}
$all_array102 = explode('/',$all_value102);
foreach($all_array102 as $value102)
{ 
if($value102!='')
{
  $get_query103 .= $value102." AND ";
}
}	  
if($_GET['from_date']!='')
{
   $sql="select * from  sample_jobcard_main where $get_query103 main_id!='' order by jobcard_no ASC  ";
}
else
{  $sql="select * from  sample_jobcard_main where DATE_FORMAT(entry_date,'%Y-%m-%d')='$current_date' and 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($design_no_of_pcs,$con_amount)=get_design_no_pcs($jobcard_no);
				 
 ?>
    <tr>
    <td width="75" height="26"  align="center" style="border:1px solid #ddd">&nbsp;<?php echo $from; ?></td>
    <td width="122" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo date("d-m-Y",strtotime($entry_date));?></td>
    <td width="132" 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 $cust_name; ?></td>
    <td width="180" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $design; ?></td>
    <td width="162" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $designer_name; ?></td>
    <td width="135" align="right" style="border:1px solid #ddd" >&nbsp;<?php echo $design_no_of_pcs; ?></td>
    <td width="182" align="right" style="border:1px solid #ddd" >&nbsp;<?php echo $con_amount; ?></td>
     </tr>
   <?php $total1+=$design_no_of_pcs; 
	$total2+=$con_amount; 
	}  ?>
    
  <tr>
 
   <td colspan="6" align="right" class="style1"><strong>Total</strong></td>
  
      <td align="right" class="style1"><strong><?php echo number_format($total1,2); ?></strong></td>

      <td align="right" class="style1"><strong><?php echo number_format($total2,2); ?></strong></td>
    </tr>
    
  </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_links_designer.php");
			  }
	?></th>
 </tr>
</table>
</div>
</div>
</div>

