<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);
/*********************************Get Found Result And Pagination********************************************************/
include("../../include/db.php");
function get_customer($customer_name)
{
        $sql="select * from  customer_entry where  customer_name='$customer_name' ";
        $rs=mysql_query($sql);
	    $s_no=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{
                 $id=$rsdata['id'];
	        }
return $id;
}
$show = 10;
$num_links = 9;
$from = $_GET['from'];
if (empty($from))
	 {
		$from = "0";
	 } 
else 
	{
	    $html_query = $html_query. "&from=$from";
	}
include("../../include/db.php"); 
$job_card_no=$_GET['job_card_no'];
$customer_name=$_GET['customer_name'];
$customer_id=get_customer($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= "print_date>='$from_date'"; }else{$from_date1="print_date='$current_date'"; }
if($to_date!=""){ $to_date1 = "print_date<='$to_date'";}else{$to_date1="print_date='$current_date'";}
if($job_card_no!=""){ $job_card_no1 = "job_card_no='$job_card_no'";}else{$job_card_no1="";}
if($customer_name!=""){ $customer_name1 = "cust_name='$customer_name'";}else{$customer_name1="";}

{
$all_value102 = $from_date1.",".$to_date1.",".$job_card_no1.",".$customer_name1;
}
$all_array102 = explode(',',$all_value102);
foreach($all_array102 as $value102)
{ 
if($value102!='')
{
  $get_query103 .= $value10." AND ";
}
}	  
if($from_date!='')
{
echo $sql="select print_date as print_date,job_card_no as job_card_no,cust_name as cust_name,fabric_type as fabric_type,job_type as job_type,billed_status as billed_status from  printer_production_main where $get_query106 p_id!='' union select print_date as print_date,job_card_no as job_card_no,cust_name as cust_name,fabric_type as fabric_type,job_type as job_type,billed_status as billed_status  from  fusing_production_main where $get_query103 p_id!=''";
}
else
{  
 $sql="select print_date as print_date,job_card_no as job_card_no,cust_name as cust_name,fabric_type as fabric_type,job_type as job_type,billed_status as billed_status from  printer_production_main union select print_date as print_date,job_card_no as job_card_no,cust_name as cust_name,fabric_type as fabric_type,job_type as job_type,billed_status as billed_status  from  fusing_production_main ";
}
$html_query = "main_fram.php?file=sales_report";
$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.";
} 
$job_card_no=$_GET['job_card_no'];
$customer_name=$_GET['customer_name'];
$from_date=$_GET['from_date'];
$to_date=$_GET['to_date'];
?>
<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/inward_outward/inward_outward_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" >Date</th>
    <th  align="left" style="border:1px solid #ddd" >Jobcard No</th>
    <th  align="left" style="border:1px solid #ddd" >Customer Name</th>
    <th  align="center" style="border:1px solid #ddd" >Job Type</th>
    <th  align="center" style="border:1px solid #ddd" >Fabric Type</th>
    <th  align="right" style="border:1px solid #ddd" >Billed Status</th>
    </tr>
  <?php
include("../../include/db.php"); 
$job_card_no=$_GET['job_card_no'];
$customer_name=$_GET['customer_name'];
$customer_id=get_customer($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= "print_date>='$from_date'"; }else{$from_date1="print_date='$current_date'"; }
if($to_date!=""){ $to_date1 = "print_date<='$to_date'";}else{$to_date1="print_date='$current_date'";}
if($job_card_no!=""){ $job_card_no1 = "job_card_no='$job_card_no'";}else{$job_card_no1="";}
if($customer_name!=""){ $customer_name1 = "cust_name='$customer_name'";}else{$customer_name1="";}

{
$all_value102 = $from_date1.",".$to_date1.",".$job_card_no1.",".$customer_name1;
}
$all_array102 = explode(',',$all_value102);
foreach($all_array102 as $value102)
{ 
if($value102!='')
{
  $get_query103 .= $value10." AND ";
}
}	  
if($from_date!='')
{
echo $sql="select print_date as print_date,job_card_no as job_card_no,cust_name as cust_name,fabric_type as fabric_type,job_type as job_type,billed_status as billed_status from  printer_production_main where $get_query106 p_id!='' union select print_date as print_date,job_card_no as job_card_no,cust_name as cust_name,fabric_type as fabric_type,job_type as job_type,billed_status as billed_status  from  fusing_production_main where $get_query103 p_id!=''  ";
}
else
{  
 $sql="select print_date as print_date,job_card_no as job_card_no,cust_name as cust_name,fabric_type as fabric_type,job_type as job_type,billed_status as billed_status from  printer_production_main union select print_date as print_date,job_card_no as job_card_no,cust_name as cust_name,fabric_type as fabric_type,job_type as job_type,billed_status as billed_status  from  fusing_production_main   ";
}
    $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'];
                 $job_card_no=$rsdata['job_card_no'];
				 $print_date=$rsdata['print_date'];
				 $cust_name=$rsdata['cust_name'];
				 $fabric_type=$rsdata['fabric_type'];
				 $printer_status=$rsdata['billed_status'];
				 $job_type=$rsdata['job_type'];
				 
 ?>
    <tr>
    <td width="64"  align="center" style="border:1px solid #ddd">&nbsp;<?php echo $from; ?></td>
    <td width="165" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo date("d-m-Y",strtotime($print_date));?></td>
    <td width="193" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $job_card_no; ?></td>
    <td width="324" align="left" style="border:1px solid #ddd" >&nbsp;<?php echo $cust_name; ?></td>
    <td width="240" align="center" style="border:1px solid #ddd" >&nbsp;<?php  echo $job_type;?></td>
    <td width="194" align="center" style="border:1px solid #ddd" >&nbsp;<?php  echo $fabric_type; ?></td>
    <td width="114" align="right" style="border:1px solid #ddd" >&nbsp;<?php  if($billed_status==1){ echo "Billed"; } else {echo "UnBilled";} ?></td>
    </tr>
  <?php } ?>
  </thead>
</table>
</div>
</div>
</div>
</div>

