<link rel="stylesheet" href="css/font.css" type="text/css" />
<script>
function date_jobcard_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");
?>
<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:date_jobcard_report_print('report/date_wise_new_jobcard/job_no_wise_print.php?from_date=<?php echo $_GET['from_date'];?>&to_date=<?php echo $_GET['to_date'];?>');" 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="300"  align="left" style="border:1px solid #ddd" >&nbsp;Customer Name</th>
    <th width="279"  align="left" style="border:1px solid #ddd" >&nbsp;Particulars</th>
    <th width="122"  align="right" style="border:1px solid #ddd" >Quantity&nbsp;</th>
    <th width="126"  align="right" style="border:1px solid #ddd" > &nbsp;Confirmed Rate</th>
    <th width="148"  align="right" style="border:1px solid #ddd" >&nbsp;Amt</th>
    
    </tr>
  <?php
include("../../include/db.php"); 
 function get_no_pcs_date($jobcard_no)
  {
    $sql="select sum(amount) as amount,sum(conformed_amt) as conformed_amt from 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=date('Y-m-d',strtotime($_GET['from_date']));
 $to_date=date('Y-m-d',strtotime($_GET['to_date']));
$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="";}

{
$all_value102 = $from_date1."/".$to_date1;
}
$all_array102 = explode('/',$all_value102);
foreach($all_array102 as $value102)
{ 
if($value102!='')
{
  $get_query103 .= $value102." AND ";
}
}	  
if($_GET['from_date']!='')
{
   $sql="select * from  jobcard_main where $get_query103 main_id!='' order by jobcard_no ASC   ";
}
else
{  $sql="select * from  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'];
				 $style_name=$rsdata['style_name'];
				 $style_no=$rsdata['style_no'];
				 $color_profile=$rsdata['color_profile'];
				 $job_type=$rsdata['job_type'];
				 $entry_date=$rsdata['entry_date'];
				 list($no_pcs,$samp)=get_no_pcs_date($jobcard_no);
 ?>
    <tr>
    <td width="75" height="26" 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="130" 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 colspan="4"> <table width="100%" style="border:0px; color:#000">
   <tbody >   <?php
     $sql_user="select * from jobcard_sublist where jobcard_no='$jobcard_no'";	
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$particulars=$rsdata_user->particulars;
	$prod_qty=$rsdata_user->qty;
	$conformed_amt=$rsdata_user->conformed_amt;
	$jobcard_values=$rsdata_user->jobcard_values;
	?>
    
    <th width="41%" align="left" style="border:0px; color:#000">&nbsp;<?php echo $particulars; ?></th>
     <th width="19%" align="right" style="border:0px; color:#000"><?php echo number_format($prod_qty,2); ?>&nbsp;</th>
     <th width="18%" align="right" style="border:0px;color:#000;"><?php echo number_format($conformed_amt,2); ?>&nbsp;</th>
    <th width="22%" align="right" style="border:0px; color:#000">&nbsp;<?php echo number_format($jobcard_values,2); ?></th>
   
    </tr><?php }  ?></tbody></table></td>


 
</tr>  <?php $total1+=$no_pcs; 
	$total2+=$samp; 
	}  ?>
 
   <td colspan="6" height="26" 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>

