<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********************************************************/
include("../../include/db.php");
$show = 20;
$num_links = 9;
$from = $_GET['from'];
if (empty($from))
	 {
		$from = "0";
	 } 
else 
	{
	    $html_query = $html_query. "&from=$from";
	}
include("../../include/db.php"); 
 $from_date=date('Y-m-d',strtotime($_GET['from_date']));
 $to_date=date('Y-m-d',strtotime($_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=""; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(entry_date,'%Y-%m-%d')<='$to_date'";}else{$to_date1="";}
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_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_customer_wise_report_print('report/sample_customer_wise_report/customer_wise_jobcard_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 width="185"  align="left" style="border:1px solid #ddd" >&nbsp;Designer</th>
    <th width="185"  align="left" style="border:1px solid #ddd" >&nbsp;Design Name</th>
    <th width="164"  align="right" style="border:1px solid #ddd" >&nbsp;No.of Pcs</th>
    <th width="169"  align="right" style="border:1px solid #ddd" >&nbsp;Sample Value</th>
    
    </tr>
  <?php
include("../../include/db.php"); 


 $from_date=date('Y-m-d',strtotime($_GET['from_date']));
 $to_date=date('Y-m-d',strtotime($_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=""; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(entry_date,'%Y-%m-%d')<='$to_date'";}else{$to_date1="";}
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 ";
}
}	
  
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  ";

}

  
if($_GET['to_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  ";

}

  
if($_GET['customer_name']!='')
{
   $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'];
				 
 ?>
    <tr>
    <td width="75"  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="185" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $jobcard_no; ?></td>
             <td width="185" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $design; ?></td>
          <td width="185" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $designer_name; ?></td>
    <td colspan="2" style="border:1px solid #ddd"> <table width="100%" style="border:0px; color:#000">
   <tbody >   <?php
     $sql_user="select * from sample_jobcard_sublist where jobcard_no='$jobcard_no'";	
	$rs_user=mysql_query($sql_user);
	$usercount=mysql_num_rows($rs_user);
	if($usercount!='0')
	{
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$job_id=$rsdata_user->job_id;
	$jobcard_no=$rsdata_user->jobcard_no;
	$particulars=$rsdata_user->particulars;
	
	$qtys=$rsdata_user->amount;

	$total=$rsdata_user->conformed_amt;
	
	
	?>
    <tr>
  
   
          <th width="49%" align="right" style="border:0px; color:#000"><?php echo number_format($qtys,2); ?>&nbsp;</th>

     <th width="51%" align="right" style="border:0px; color:#000"><?php echo $total; ?>&nbsp;</th>
    </tr><?php $total1+=$qtys; 
	$total2+=$total; 
	$total3+=$balance_qty;} } ?></tbody></table></td>    </tr>
  <?php } ?>
  <tr>
 
   <td colspan="5" 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>
</div>
</div>
</div>
</div>