<link rel="stylesheet" href="css/font.css" type="text/css" />
<script>
function jobcard_report_print(url)
{
onmouseover43= window.open(url,'onmouseover43','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);
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:jobcard_report_print('report/customer_wise_jobcard/customer_wise_jobcard_print.php?from_date=<?php echo $_GET['from_date'];?>&to_date=<?php echo $_GET['to_date'];?>&job_card_no=<?php echo $_GET['job_card_no'];?>&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="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>
    <th width="83"  align="left" style="border:1px solid #ddd" >&nbsp;Bill No</th>
    <th width="83"  align="left" style="border:1px solid #ddd" >&nbsp;Date</th>
    </tr>
  <?php
include("../../include/db.php"); 


function get_bill_date($job_card_nos)
{
$sql="select invoice_no,bill_date from fusing_production_main where job_card_no='$job_card_nos' union select invoice_no,bill_date from printer_production_main where job_card_no='$job_card_nos'";
$rs11=mysql_query($sql);
 while($rsdata=mysql_fetch_array($rs11))
{
$invoice_no[0]=$rsdata['invoice_no'];
$invoice_no[1]=$rsdata['bill_date'];
}
return $invoice_no;
}

$customer_name=$_GET['customer_name'];

if(($_GET['from_date']!='')&&($_GET['to_date']!=''))
{
 $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= "entry_date>='$from_date'"; }else{$from_date1="entry_date='$current_date'"; }
if($to_date!=""){ $to_date1 = "entry_date<='$to_date'";}else{$to_date1="entry_date='$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  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['main_id'];
                 $job_card_nos=$rsdata['jobcard_no'];
				 $bill=get_bill_date($job_card_nos);
				 $entry_date=$rsdata['entry_date'];
				 $cust_name=$rsdata['cust_name'];
				 
				 
 ?>
    <tr>
    <td width="55"  align="center" style="border:1px solid #ddd">&nbsp;<?php echo $s_no; ?></td>
    <td width="100" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo date("d-m-Y",strtotime($entry_date));?></td>
    <td width="152" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $job_card_nos; ?></td>
    <td width="156" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $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='$job_card_nos'";	
	$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>
    <td width="83" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $bill[0]; ?></td>
    <td width="83" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo  date("d-m-Y",strtotime($bill[1])); ?></td>
    </tr>
  <?php } ?>
  </thead>
</table>
</div>
</div>
</div>
</div>

