<style>
.style15 
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
}
</style>

<script>
function pending_jobcard_print(url)
{	
onmouseover10= window.open(url,'onmouseover10','height=500,width=1100,scrollbars=no,resizable=no,left=50,top=50,toolbar=no,location=no,directories=no,status=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%">&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:pending_jobcard_print('production/pending_jobcard/pending_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="35" title="Print" value="Print"/></a></td>
</tr>
</table>

<div class="row-fluid">
<div class="span12">
<div class="table-responsive">
<div class="CSSTableGenerator">  
<table width="99%" border="0" align="center"  cellpadding="0" cellspacing="0" style="border:2px solid #eaeaea;border:1px solid #ddd"  >
      <tr>
      <th height="25" align="center" style="border:1px solid #ddd" >S.No</th>
      <th scope="col" align="left" style="border:1px solid #ddd" >&nbsp;Date</th>
      <th width="154" align="left" style="border:1px solid #ddd" scope="col">&nbsp;&nbsp;Jobcard No</th>
      <th scope="col" align="left" style="border:1px solid #ddd" >Customer Name</th>
      <th width="154" align="left" scope="col" style="border:1px solid #ddd" >Job Created</th>
      <th width="162" align="left" scope="col" style="border:1px solid #ddd" >Fabric Type</th>
      <th width="152" align="left" scope="col" style="border:1px solid #ddd" >Style Name&nbsp;</th>
      <th width="136" align="right" scope="col" style="border:1px solid #ddd" >Printed Qty</th>
</tr>

  <?php
 include ("../../include/db.php");
 $from_date=$_GET['from_date'];
 $to_date=$_GET['to_date'];
 $current_date=date('Y-m-d');

if($from_date!=""){ $from_date1= "DATE_FORMAT(print_date,'%Y-%m-%d')>='$from_date'"; }else{$from_date1="DATE_FORMAT(print_date,'%Y-%m-%d')='$current_date'"; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(print_date,'%Y-%m-%d')<='$to_date'";}else{$to_date1="DATE_FORMAT(print_date,'%Y-%m-%d')='$current_date'";}
$all_value10 = $from_date1."@".$to_date1;
$all_array10 = explode('@',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
$get_query103 .= $value10." AND ";
}
}
 
if($from_date!=""){ $from_date1= "DATE_FORMAT(a.entry_time,'%Y-%m-%d')>='$from_date'"; }else{$from_date1="DATE_FORMAT(a.entry_time,'%Y-%m-%d')='$current_date'"; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(a.entry_time,'%Y-%m-%d')<='$to_date'";}else{$to_date1="DATE_FORMAT(a.entry_time,'%Y-%m-%d')='$current_date'";}
$all_value10 = $from_date1."@".$to_date1;
$all_array10 = explode('@',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
$get_query1031 .= $value10." AND ";
}
}	  


//$sql="select * from printer_production_main where printer_status='0' and billed_status='0' and job_type='sticker' and $get_query103 p_id!='' union select * from fusing_production_main where printer_status='0' and billed_status='0'  and $get_query103 p_id!='' order by job_card_no ASC";
//$sql="select a.job_id as p_id,a.particulars as style_name,a.customer_name as cust_name,a.jobcard_no as job_card_no,sum(a.qty) as printed_qty,a.entry_time as print_date,a.created_by as job_created from jobcard_sublist as a LEFT JOIN printer_production_main as b ON a.jobcard_no=b.job_card_no where $get_query1031 b.job_card_no IS NULL group by a.jobcard_no ASC ";

//$sql="select p_id,style_name,cust_name,job_card_no,printed_qty,print_date,job_created,fabric_type from printer_production_main where printer_status='0' and billed_status='0' and job_type='sticker' and $get_query103 p_id!='' union select p_id,style_name,cust_name,job_card_no,printed_qty,print_date,job_created,fabric_type from fusing_production_main where printer_status='0' and billed_status='0'  and $get_query103 p_id!='' 
   // UNION 
   // select a.job_id as p_id,a.particulars as style_name,a.customer_name as cust_name,a.jobcard_no as job_card_no,sum(a.qty) as printed_qty,a.entry_time as print_date,a.created_by as job_created,a.fabric_type as fabric_type from jobcard_sublist as a LEFT JOIN printer_production_main as b ON a.jobcard_no=b.job_card_no where $get_query1031 b.job_card_no IS NULL group by a.jobcard_no ASC";
    $sql="select p_id,style_name,cust_name,job_card_no,printed_qty,print_date,job_created,fabric_type from printer_production_main where printer_status='0' and billed_status='0' and job_type='sticker' and $get_query103 p_id!='' union select p_id,style_name,cust_name,job_card_no,printed_qty,print_date,job_created,fabric_type from fusing_production_main where printer_status='0' and billed_status='0'  and $get_query103 p_id!='' 
    UNION 
    select a.job_id as p_id,a.particulars as style_name,a.customer_name as cust_name,a.jobcard_no as job_card_no,sum(a.qty) as printed_qty,a.entry_time as print_date,a.created_by as job_created,a.fabric_type as fabric_type from jobcard_sublist as a LEFT JOIN printer_production_main as b ON a.jobcard_no=b.job_card_no left JOIN fusing_production_main as c ON a.jobcard_no=c.job_card_no where $get_query1031 b.job_card_no IS NULL and  c.job_card_no IS NULL group by a.jobcard_no ORDER BY print_date asc  ";
//echo $sql;

    $rs=mysql_query($sql);
	$sno=0;
	$from=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{
   				$sno=$sno+1;
				$from=$from+1;
   				$p_id=$rsdata['p_id'];
   				$job_card_no=$rsdata['job_card_no'];
				$print_date=$rsdata['print_date'];
	   			$cust_name=$rsdata['cust_name'];
	   			$job_created=$rsdata['job_created'];
				$cust_po=$rsdata['cust_po'];
	   			$fabric_type=$rsdata['fabric_type'];
	   			$style_name=$rsdata['style_name'];
				$combo=$rsdata['combo'];
	   			$printed_qty=$rsdata['printed_qty'];
				$billed_status=$rsdata['billed_status'];
			    $refer=$rsdata['refer'];
  ?>
  <tr>
    <td width="55"  align="center" style="border:1px solid #ddd"><?php echo $from; ?></td>
    <td width="131" align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo date("d-m-Y",strtotime($print_date));?></td>
    <td align="left" style="border:1px solid #ddd">&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $job_card_no;?></td>
    <td width="261" align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo $cust_name;?></td>
    <td align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo $job_created;?></td>
    <td align="left" style="border:1px solid #ddd">&nbsp;<?php echo $fabric_type;?></td>
    <td align="left" style="border:1px solid #ddd"><?php echo $style_name;?>&nbsp;</td>
    <td align="right" style="border:1px solid #ddd"><?php echo number_format($printed_qty,3);?></td>
  <?php if($_GET['status']!=1) { ?>  <?php } ?>
    </tr>
  <?php $tot_print_qty+=$printed_qty; } ?>
  <tr>
   
    <td align="right" colspan="7" style="border:1px solid #ddd"><strong>Total&nbsp;</strong></td>
    <td align="right" style="border:1px solid #ddd"><strong><?php echo number_format($tot_print_qty,3);?></strong></td> <?php if($_GET['status']!=1) { ?><?php } ?>
  </tr>
</table>
</div>
</div>
</div>
</div>