<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-top:1px dashed #000000;

	
	border-bottom:1px dashed #000000;
}	
</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'];

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="850px" 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>Sample Jobcard Date wise Report</span></td>
  </tr>

</table>
<table width="850px" align="center" height="40" border="0"  cellpadding="0" cellspacing="0">
<tr>
<td colspan="4" 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="4" align="right" scope="col" class="style4"><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>
</tr></table>
<table  width="850px" align="center"  cellpadding="0" cellspacing="0"  >
      <tr>
      <td width="47" height="26" align="center"class="stylebottom  style20"><strong>S.No</strong></td>
      <td width="87" align="left"class="stylebottom  style20" scope="col"><strong>&nbsp;Date</strong><strong>&nbsp;</strong></td>
      <td width="112" align="left"class="stylebottom  style20" scope="col"><strong>&nbsp;Jobcard No</strong></td>
      <td width="220" scope="col" align="left"class="stylebottom  style20" ><strong>&nbsp;Customer Name</strong>&nbsp;</td>
      <td width="83" scope="col" align="left"class="stylebottom  style20" ><strong>&nbsp;Designer</strong></td>
      <td width="95"   align="left" scope="col"class="stylebottom  style20" ><strong>&nbsp;Design Name</strong></td>
      <td width="81"   align="right"class="stylebottom  style20"   scope="col"><strong>&nbsp;No.Of Pcs</strong></td>
      <td width="123"  align="right"class="stylebottom  style20"    scope="col"><strong>Sample Value&nbsp;</strong></td>
     
  </tr>
  <?php
include("../../include/db.php");

function get_no_pcs_date_print($jobcard_no)
  {
    $sql="select sum(amount) as amount,sum(conformed_amt) as conformed_amt from sample_jobcard_sublist where jobcard_no='$jobcard_no'";

    $rs=mysql_query($sql);
	
   		while($rsdata=mysql_fetch_object($rs))
  			{
   				 
          	$qtys=$rsdata->amount;
	 $total=$rsdata->conformed_amt;
				
			}
			return array($qtys,$total);
  }

$from_date=$_GET['from_date'];
$to_date=$_GET['to_date'];
$customer_name=$_GET['customer_name'];
$current_date=date('Y-m-d');
if($from_date!=""){ $from_date1= "DATE_FORMAT(entry_date,'%Y-%m-%d')>='$from_date'"; }else{$from_date1=""; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(entry_date,'%Y-%m-%d')<='$to_date'";}else{$to_date1="";}
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_query104 .= $value102." AND ";
}
}	  
if($_GET['from_date']!='')
{
   $sql="select * from  sample_jobcard_main where $get_query104 main_id!='' order by jobcard_no ASC  ";
}
else
{  $sql="select * from  sample_jobcard_main where DATE_FORMAT(entry_date,'%Y-%m-%d')='$current_date' and 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['p_id'];
                 $jobcard_no=$rsdata['jobcard_no'];
				 $cust_name=$rsdata['cust_name'];
				 $designer_name=$rsdata['designer_name'];
				 $design=$rsdata['design'];
				 $color_profile=$rsdata['color_profile'];
				 $job_type=$rsdata['job_type'];
				 $entry_date=$rsdata['entry_date'];
				 list($no_pcs,$samp)=get_no_pcs_date_print($jobcard_no);
				 
 ?>
    <tr>
    <td width="47" height="26" align="center" class="style20">&nbsp;<?php echo $from; ?></td>
    <td width="87" align="left" class="style20" >&nbsp;<?php echo date("d-m-Y",strtotime($entry_date));?></td>
    <td width="112" align="left" class="style20" >&nbsp;<?php echo $jobcard_no; ?></td>
    <td width="220" align="left" class="style20" >&nbsp;<?php echo ucfirst($cust_name); ?></td>
    <td width="83" align="left" class="style20" >&nbsp;<?php echo ucfirst($design); ?></td>
        <td width="95" align="left" class="style20" >&nbsp;<?php echo ucfirst($designer_name); ?></td>
   <td width="81" align="right" class="style20" >&nbsp;<?php echo number_format($no_pcs,2); ?></td>
      <td width="123" align="right" class="style20" >&nbsp;<?php echo number_format($samp,2); ?></td>
   
    </tr>
   <?php $total1+=$no_pcs; 
	$total2+=$samp; 
	}  ?>
   <tr>
   <td colspan="6" height="26" align="right" class="style20" style="border-top:dashed 1px"><strong>Total</strong></td>
   <td align="right" class="style20" style="border-top:dashed 1px"><strong><?php echo number_format($total1,2); ?></strong></td>
      <td align="right" class="style20" style="border-top:dashed 1px"><strong><?php echo number_format($total2,2); ?></strong></td>

    </tr>
<tr style="border-bottom:dashed 1px"></tr>
       <td height="30" colspan="18"align="right" style=" font-family:Verdana, sans-serif; font-size:12px; border-top:dashed 1px;"><strong>Printed Date : <?php echo $curdate=date('d-m-Y h:m a');?>&nbsp;</strong></p></td>
</table>
