<style type="text/css">
.style20 {
	font-family: Verdana;
	font-size: 12px;
}
.style4 {font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
}
.text {font-family: Verdana; font-size:13px;}
.stylebottom
{
	border-top:1px dashed #000000;

	
	border-bottom:1px dashed #000000;
}	
</style>
<?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="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 Designer wise Report</span>
  </tr>

</table>
<table width="850px" align="center" height="40" border="0"  cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" 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"><strong>Designer Name :</strong>  <?php if($_GET['designer_name']==''){ echo "All";} else { echo $_GET['designer_name'];}?></td>
<td colspan="3" 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="45" height="26" align="center"class="stylebottom  style20"><strong>S.No</strong></td>
      <td width="90" align="left"class="stylebottom  style20" scope="col"><strong>&nbsp;Date</strong><strong>&nbsp;</strong></td>
      <td width="110" align="left"class="stylebottom  style20" scope="col"><strong>&nbsp;Jobcard No</strong></td>
      <td width="225" scope="col" align="left"class="stylebottom  style20" ><strong>&nbsp;Customer Name</strong>&nbsp;</td>
      <td width="75" 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="85"   align="right"class="stylebottom  style20"   scope="col"><strong>&nbsp;No.Of Pcs</strong></td>
      <td width="125"  align="right"class="stylebottom  style20"    scope="col"><strong>Sample Value&nbsp;</strong></td>
     
  </tr>
  <?php
function get_design_no_pcs_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))
  			{
   				 
          	$amt=$rsdata->amount;
	        $con_amt=$rsdata->conformed_amt;
				
			}
			return array($amt,$con_amt);
  }


$from_date=$_GET['from_date'];
$to_date=$_GET['to_date'];
$designer_name=$_GET['designer_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($designer_name!=""){ $designer_name1 = "design='$designer_name'";}else{$designer_name1="";}

{
$all_value102 = $from_date1."/".$to_date1."/".$designer_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($design_no_of_pcs,$con_amount)=get_design_no_pcs_print($jobcard_no);
				 
 ?>
    <tr>
    <td width="45"  height="26" align="center" class="style20">&nbsp;<?php echo $from; ?></td>
    <td width="90" align="left" class="style20" >&nbsp;<?php echo date("d-m-Y",strtotime($entry_date));?></td>
    <td width="110" align="left" class="style20" >&nbsp;<?php echo $jobcard_no; ?></td>
    <td width="225" align="left" class="style20" >&nbsp;<?php echo $cust_name; ?></td>
    <td width="75" align="left" class="style20" >&nbsp;<?php echo $design; ?></td>
    <td width="95" align="left" class="style20" >&nbsp;<?php echo $designer_name; ?></td>
    <td width="85" align="right" class="style20" >&nbsp;<?php echo $design_no_of_pcs; ?></td>
    <td width="125" align="right" class="style20" >&nbsp;<?php echo $con_amount; ?></td>

  <?php $total1+=$design_no_of_pcs; 
	$total2+=$con_amount; 
	}  ?>
 
   <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');?>&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;</strong></p></td>
</table>
