
<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>
<div class="row-fluid">
<div class="span12">
<div class="table-responsive">
<div class="CSSTableGenerator">
<?php 
  include ("../../include/db.php");
  date_default_timezone_set('Asia/Kolkata');
error_reporting(0);
ob_start();
session_start();
$session_branch=$_SESSION['branch'];
$session_user_type=$_SESSION['user_type'];
  $branch_name=$_GET['branch_name'];

function get_categ_branch_id($branch_name)
{
$sql_query11="select * from branch_creation where branch_id='$branch_name' and delete_status!='1'";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $id=$rsdata11->branch_name;
 } 
	return $id;
 }
 $bran_name=get_categ_branch_id($branch_name);
if($session_user_type!=1)
{
$query="select * from branch_creation  WHERE branch_id='$session_branch'";
}
$rs=mysql_query($query);						 
                                                $i=0;
                                                while($list=mysql_fetch_array($rs))
                                                {
                                                $i=$i+1;
												$branch_address=$list['branch_address'];
												$head_off=$list['head_off'];
												$branch_off=$list['branch_off'];
												$branch_ph=$list['branch_ph'];
												$delivery_ph=$list['delivery_ph'];
												$delivery_off=$list['delivery_off'];
											    }
											 ?>
<table width="980px" height="30" border="0" align="center"  cellpadding="0" cellspacing="0">
<tr style="height:60">
<td width="137" height="106" align="right" style="font-size:12px;"><img src="../../img/logo_image.png" width="126" height="130"/></td>
<td width="711" colspan="5" align="center" valign="top" style=""><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/>
    
   <span width="80%" class="title1" style="font-size:18px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>Fusing Jobcard Wise Report</span></p></td>
  </tr>

<tr>
  <td colspan="2"  align="center" style="font-family:Verdana, sans-serif; font-size:16px; font-family:Verdana, sans-serif; "><table width="101%" height="40" border="0"  cellpadding="0" cellspacing="0">
    <tr>
      
      <td width="23%" align="left" class="style4"><strong>From Date :</strong>
        <?php if($_GET['from_date']==''){ echo $curdate=date('d-m-Y');} else { echo date("d-m-Y",strtotime($_GET['from_date']));}?></td>
      <td colspan="2" align="left" class="style4" scope="col"><strong>To Date :</strong>
        <?php if($_GET['to_date']==''){ echo $curdate=date('d-m-Y');} else { echo date("d-m-Y",strtotime($_GET['to_date'])); }?></td>
        <td width="44%" colspan="2" align="left" class="style4" scope="col"><strong>Customer Name : </strong>
          <?php if($_GET['customer_name']!=''){ echo $_GET['customer_name']; }?></td>
      
    </tr>
  </table></td>
</tr>
<tr>
  <td colspan="2"  align="center" style="font-family:Verdana, sans-serif; font-size:16px; font-family:Verdana, sans-serif; "><table  width="101%"  cellpadding="0" cellspacing="0" style="border-top:dashed 1px" >
    <tr>
      <td width="40" height="26" align="center"  style="border-bottom:dashed 1px; font-family:Verdana, sans-serif; font-size:12px;"><strong>S.No</strong></td>
      <td width="79" align="left"  style="border-bottom:dashed 1px; font-family:Verdana, sans-serif; font-size:12px;" scope="col"><strong>&nbsp;&nbsp;Date</strong><strong>&nbsp;</strong></td>
      <td width="123" align="left"  style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;" scope="col">Jobcard No</td>
      <td width="119" align="left"  style="border-bottom:dashed 1px; font-family:Verdana, sans-serif; font-size:12px;" scope="col"><strong>&nbsp;&nbsp;Customer Name</strong></td>
     
      <td width="109" align="center" style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;" > Particulars</td>
      <td width="90"  align="right" style="border-bottom:dashed 1px; font-family:Verdana, sans-serif; font-size:12px;"  scope="col"><strong>Quantity  </strong>&nbsp;</td>
       <td width="109" scope="col" align="right" style="border-bottom:dashed 1px; font-family:Verdana, sans-serif; font-size:12px;" ><strong>Confirmed Rate&nbsp;</strong></td>
      <td width="83"  align="right" style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;" scope="col" >Amt&nbsp;</td>
      <td width="50" align="right" style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;"    scope="col">Bill No</td>
      <td width="46" align="left" style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;"    scope="col">Date</td>
    </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="40"  align="center" class="style20" style="border:0px solid ">&nbsp;<?php echo $s_no; ?></td>
    <td width="79" align="left" class="style20" style="border:0px solid" >&nbsp;<?php echo date("d-m-Y",strtotime($entry_date));?></td>
    <td width="123" align="left" class="style20" style="border:0px solid " >&nbsp;<?php echo $job_card_nos; ?></td>
    <td width="119" align="left" class="style20" style="border:0px solid " >&nbsp;<?php echo $cust_name; ?></td>
    <td colspan="4"> <table width="100%" style="border:1px thin; 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;
	?>
    <td width="27%" height="23" align="center" class="style20" style="border:0px solid ;color:#000;"><?php echo $particulars; ?>&nbsp;</td>
    <td width="22%" align="right" class="style20" style="border:0px solid; color:#000">&nbsp;<?php echo number_format($prod_qty,2); ?></td>
    <td width="31%" align="right" class="style20" style="border:0px solid ; color:#000">&nbsp;<?php echo number_format($conformed_amt,2); ?></td>
    <td width="20%" align="right" class="style20" style="border:0px solid ; color:#000">&nbsp;<?php echo number_format($jobcard_values,2); ?></td>
    </tr><?php $tot_prod_qty+=$prod_qty;
    $tot_conformed_amt+=$conformed_amt;
    $tot_jobcard_values+=$jobcard_values;
     } ?></tbody></table></td>
    <td width="50" align="left" class="style20" style="border:0px solid " >&nbsp;<?php if($bill[0]==0) { echo ""; } else { echo $bill[0]; }?></td>
    <td width="46" align="left" class="style20" style="border:0px solid " >&nbsp;<?php if($bill[1]=='') { echo ""; } else { echo  date("d-m-Y",strtotime($bill[1]));} ?></td>
    </tr>
  <?php

   }?>
   <tr>
  <td   height="30"  align="right" colspan="3" style=" font-family:Verdana, sans-serif; font-size:12px;border-top:dashed 1px; "><strong >Total&nbsp;&nbsp;:</strong></td>
 <td  align="right"  colspan="3"  style=" font-family:Verdana, sans-serif; font-size:12px;border-top:dashed 1px;"><?php echo number_format($tot_prod_qty,2);?></td>
 <td  align="right"  colspan="1" style=" font-family:Verdana, sans-serif; font-size:12px;border-top:dashed 1px;"><?php echo number_format($tot_conformed_amt,2);?></td>
 <td  align="center"  colspan="2"  style=" font-family:Verdana, sans-serif; font-size:12px;border-top:dashed 1px;"><?php echo number_format($tot_jobcard_values,2);?></td>
 <td  align="left"  colspan="3"  style=" font-family:Verdana, sans-serif; font-size:12px;border-top:dashed 1px;"></td>
  </tr>
  </thead>
</table>



<tr>
  <td height="30" colspan="16"align="right" style=" font-family:Verdana, sans-serif; font-size:12px; border-top:dashed 1px;">Printed Date : <?php echo $curdate=date('d-m-Y');?>&nbsp;&nbsp;&nbsp;&nbsp;<br>Printed Time : <?php echo $current_time=date('h:i:s A');?>&nbsp;&nbsp;<br>IP Address   : <?php echo $ip_address = $_SERVER['REMOTE_ADDR'];?>&nbsp;
    </p></td>
  </table></td>
</tr>
</table>
