<style type="text/css">
.style20 {
	font-family: Verdana;
	font-size: 12px;
}
.style5 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
}
.style3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
}
.style10{ border-top:solid 1px; border-top-color:#999;}
.style11{ border-bottom:dashed 1px; border-bottom-color:#333333;}
.style4 {font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
}
.style23 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
.style27 {font-size: 12px}
.style28 {
	font-size: 16px;
	font-weight: bold;
}
.text {font-family: Verdana; font-size:13px;}
.style29 {	font-family: Verdana;
font-size: 14px;
}
.stylebottom
{
	border-right:1px solid #999;	
	border-bottom:1px solid #999;
}	
</style>

<?php 
  include ("../../include/db.php");
error_reporting(0);
ob_start();
session_start();
$session_branch=$_SESSION['branch'];
$session_user_type=$_SESSION['user_type'];
$branch_name=$_GET['branch_name'];


?>
<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"  >
<table width="980px" height="30" border="0" align="center"  cellpadding="0" cellspacing="0">
<tr style="height:60">
<td width="137" height="106" align="left" style="font-size:12px; border-bottom:1px solid #999;"><img src="../../img/logo_image.png" width="126" height="130"/></td>
<td width="711" colspan="5" align="center" valign="top" style="border-bottom:1px solid #999;"><strong style="font-size: 30px; color: #06F; padding-top: 5px; width: 80px; font-family: Verdana, sans-serif">SRI AMMAN DIGITAL PRINTS</strong><br />
        <span width="80%" class="title1" style="font-size:14px;font-family:Verdana, sans-serif; font-weight:bold"><b></b> DOOR No: 1/2,1/3  KOMBAI THOTTAM MAIN ROAD,</span><br />
       <span width="80%" class="title0" style="font-size:14px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>SELLANDIAMMAN THURAI ROAD,</span><br />
       <span width="80%" class="title0" style="font-size:14px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>TIRUPPUR-641604 TAMILNADU STATE INDIA,</span><br/>
       <span width="80%" class="title00" style="font-size:14px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>Contact Office: 0421-4355333,+91 83442-33555,+91 83442-33888,</span><br/>
       <span width="80%" class="title0" style="font-size:14px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>Email Id : sriammandigitalprints@gmail.com/yahoo.com.</span><br/>
       <br/>
    
   <span width="80%" class="title1" style="font-size:18px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>Billing Unbilling</span></p></td>
  </tr>

</table>


&nbsp;
&nbsp;

<table width="980" border="0" align="center"  cellpadding="0" cellspacing="0" style="border-top:dashed 1px; border-bottom:dashed 1px" >
      <tr>
      <th align="center" style="border-top:dashed 1px" >S.No</th>
      <th scope="col" align="left" style="border-top:dashed 1px" >&nbsp;Date</th>
      <th width="172" align="left" style="border-top:dashed 1px" scope="col">&nbsp;&nbsp;Jobcard No</th>
      <th scope="col" align="left" style="border-top:dashed 1px" >Customer Name</th>
      <th width="179" align="left" scope="col" style="border-top:dashed 1px" >Job Created</th>
      <th width="143" align="left" scope="col" style="border-top:dashed 1px" >Style No</th>
      <th width="157" align="right" scope="col" style="border-top:dashed 1px">Style Name&nbsp;</th>
      <th width="118" align="center" scope="col" style="border-top:dashed 1px">Printed Qty</th>
      </tr>
  <?php
  include ("../../include/db.php");
  
$from_date=$_GET['from_date'];
$to_date=$_GET['to_date'];
 $billing=$_GET['billing'];


$current_date=date('Y-m-d');

if(($from_date=='')&&($to_date==''))
{
	$sql="select * from printer_production_main where printer_status='1' and bill_date='$current_date' union select * from fusing_production_main where printer_status='1' and bill_date='$current_date'";
}
elseif(($from_date!='')&&($to_date!='')&&($billing==''))
{
	$sql="select * from printer_production_main where printer_status='1' and  bill_date>='$from_date' and bill_date<='$to_date'  union select * from fusing_production_main where printer_status='1' and  bill_date>='$from_date' and bill_date<='$to_date'  group by invoice_no,billing_type";
}
else
{
	$sql="select * from printer_production_main where printer_status='1' and billed_status='$billing' and  bill_date>='$from_date' and bill_date<='$to_date' union select * from fusing_production_main where printer_status='1' and billed_status='$billing' and  bill_date>='$from_date' and bill_date<='$to_date'  group by invoice_no,billing_type";
}

    $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'];
				$bill_date=$rsdata['bill_date'];
	   			$cust_name=$rsdata['cust_name'];
	   			$job_created=$rsdata['job_created'];
				$cust_po=$rsdata['cust_po'];
	   			$style_no=$rsdata['style_no'];
	   			$style_name=$rsdata['style_name'];
				$combo=$rsdata['combo'];
	   			$printed_qty=$rsdata['printed_qty'];
				$billed_status=$rsdata['billed_status'];
			    $refer=$rsdata['refer'];
				
  ?>
  <tr>
    <td width="56"  align="center" style="border:1px solid #ddd"><?php echo $from; ?></td>
    <td width="117" align="left" style="border:1px solid #ddd">&nbsp;&nbsp;<?php echo date("d-m-Y",strtotime($bill_date));?></td>
    <td align="left" style="border:1px solid #ddd">&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $job_card_no;?></td>
    <td width="262" 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 $style_no;?></td>
    <td align="right" style="border:1px solid #ddd"><?php echo $style_name;?>&nbsp;</td>
    <td align="center" style="border:1px solid #ddd"><?php echo number_format($printed_qty,3);?></td>
    
    </tr>
  <?php } ?>
</table>
<table width="980" align="center">
  <tr>
<td width="123" align="right" style="font-family:Baskerville, 'Palatino Linotype', Palatino, 'Century Schoolbook L', 'Times New Roman', serif; font-size:14px;"> Printed Date: <?php echo date('d-m-y')?>
  </td>
  </tr>
</table>