<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>
<table width="850" height="30" border="0" align="center"  cellpadding="0" cellspacing="0">



<tr>
<td align="center" style="font-family:Verdana, sans-serif; font-size:16px; font-family:Verdana, sans-serif; ">

<table width="980px" height="30" border="0" align="center"  cellpadding="0" cellspacing="0">
<tr style="height:60">
<td width="203" 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 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>Wages Wise Print</span></p></td>
  </tr>


    <tr>
      <td width="203" height="26"  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" 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>
      <td width="529" colspan="2" align="right" class="style4" scope="col"><strong>Operator Type : </strong>
        <?php if($_GET['operator_type']!=''){  echo ucfirst($_GET['operator_type']);} ?></td>
    </tr>
  </table></td>
</tr>
<tr>
  <td align="center" style="font-family:Verdana, sans-serif; font-size:16px; font-family:Verdana, sans-serif; "><table  width="100%"  cellpadding="0" cellspacing="0" style="border-top:dashed 1px" >
    <tr>
    <td  align="center" style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;"   >S.No</td>
    <td  align="center"  style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;"   >Date</td>
    <td  align="left"  style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;"   >Shift</td>
    <td  align="left"  style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;"   >Jobcard No</td>
    <td width="102"  align="left"  style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;"   >Machine No</td>
    <td  align="left"  style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;"   >Op Type</td>
    <td width="83"  align="center"  style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;"   >Fab Type</td>
    <td width="114"  align="left"  style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;"   >Particulars</td>
    <td width="37"  align="right" style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;"   >Qty</td>
    <td width="56"  align="right" style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;"   > Rate</td>
    <td width="55"  align="right" style="border-bottom: dashed 1px; font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold;"   >Amt</td>
    </tr>
   <?php
include("../../include/db.php"); 

function get_operator_type11($operator_type)
{
$sql_query11="select * from operator_creation where operator_name='$operator_type' ";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $id=$rsdata11->id;
 } 
return $id;
}


function get_shift_name_from($shift_time)
{
$sql_query11="select * from shift_creation where id='$shift_time' ";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $from_time=$rsdata11->from_time;
 } 
return $from_time;
}


function get_shift_name_to($shift_time)
{
$sql_query11="select * from shift_creation where id='$shift_time' ";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $to_time=$rsdata11->to_time;
 } 
return $to_time;
}



function get_shift_name($shift_time)
{
$sql_query11="select * from shift_creation where id='$shift_time' ";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $shift_name=$rsdata11->shift_name;
 } 
return $shift_name;
}

function get_machine_name($machine_no)
{
 $sql_query11="select * from machine_creation where id='$machine_no'";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $machine_no=$rsdata11->machine_no;
 } 
return $machine_no;
}

function get_operator_id($operator_id)
{
$sql_query11="select * from operator_creation where id='$operator_id' ";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $operator_name=$rsdata11->operator_name;
 } 
return $operator_name;
}


function get_fabric_type($job_card_no)
{
$sql_query11="select fabric_type as fabric_type from fusing_production_main where job_card_no='$job_card_no' union  select fabric_type as fabric_type from printer_production_main where job_card_no='$job_card_no'";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $fabric_type=$rsdata11->fabric_type;
 } 
return $fabric_type;
}


function get_contract_rate($fabric_type)
{
$sql_query11="select * from fabric_type_creation where fabric_type='$fabric_type' ";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $contract_rate=$rsdata11->contract_rate;
 } 
return $contract_rate;
}

 $operator_typess=get_operator_type11($_GET['operator_type']);
 $from_date=$_GET['from_date'];
 $to_date=$_GET['to_date'];
 $current_date=date('Y-m-d');
 
if($from_date!=""){ $from_date1= "DATE_FORMAT(production_time,'%Y-%m-%d')>='$from_date'"; }else{$from_date1="DATE_FORMAT(production_time,'%Y-%m-%d')='$current_date'"; }
if($to_date!=""){ $to_date1 = "DATE_FORMAT(production_time,'%Y-%m-%d')<='$to_date'";}else{$to_date1="DATE_FORMAT(production_time,'%Y-%m-%d')='$current_date'";}
if($operator_type!=""){ $operator_types = "operator_name='$operator_typess'";}else{$operator_types="";}
{
$all_value102 = $from_date1."@".$to_date1."@".$operator_types;
}
$all_array102 = explode('@',$all_value102);
foreach($all_array102 as $value102)
{ 
if($value102!='')
{
  $get_query103 .= $value102." AND ";
}
}	  
if($from_date!='')
{
$sql="select production_time as production_time1,shift_time as shift_time1,machine_no as machine_no1,operator_name as operator_name1,prod_qty as prod_qty1,job_card_no  as job_card_no1,prod_size as prod_size1 from  fusing_production_sublist where $get_query103 pr_id!=''  and deliv_status!='1'";
}
else
{ 
$sql="select production_time as production_time1,shift_time as shift_time1,machine_no as machine_no1,operator_name as operator_name1,prod_qty as prod_qty1,job_card_no  as job_card_no1,prod_size as prod_size1 from  fusing_production_sublist where  pr_id!=''  and deliv_status!='1' ";
}

    $rs=mysql_query($sql);
   		while($rsdata=mysql_fetch_array($rs))
  			{
				 $from=$from+1;
                 $production_time=$rsdata['production_time1'];
				 $shift_time=$rsdata['shift_time1'];
				 $shift_name_from=get_shift_name_from($shift_time);
				 $shift_name_to=get_shift_name_to($shift_time);
				 $machine_no=$rsdata['machine_no1'];
				 $machine_name=get_machine_name($machine_no);
				 $operator_id=$rsdata['operator_name1'];
				 $operator_name=get_operator_id($operator_id);
				 $prod_qty=$rsdata['prod_qty1'];
				 $prod_qty=$rsdata['prod_qty1'];
				 $prod_size=$rsdata['prod_size1'];
				 $job_card_no=$rsdata['job_card_no1'];
				 $fabric_type=get_fabric_type($job_card_no);
				 $contract_rate=get_contract_rate($fabric_type);
				 $shift_names=get_shift_name($shift_time);

 ?>
 <tr>
 <td width="31" height="26" style=" font-family:Verdana, sans-serif; font-size:12px;"   align="center" ><?php echo $from; ?></td>
 <td width="85"  align="left" style=" font-family:Verdana, sans-serif; font-size:12px;" >&nbsp;<?php echo date("d-m-Y",strtotime($production_time));?></td>
      <td width="89"  align="left" style=" font-family:Verdana, sans-serif; font-size:12px;" >&nbsp;<?php echo $shift_names;?></td>
      <td width="113"  align="left" style=" font-family:Verdana, sans-serif; font-size:12px;" >&nbsp;<?php echo $job_card_no;?></td>
      <td align="left" style=" font-family:Verdana, sans-serif; font-size:12px;"  >&nbsp;<?php echo $machine_name;?></td>
      <td width="83" style=" font-family:Verdana, sans-serif; font-size:12px;"  align="left" ><?php echo $operator_name;?>&nbsp;</td>
      <td align="center" style=" font-family:Verdana, sans-serif; font-size:12px;"><?php echo $fabric_type;?>&nbsp;</td>
      <td align="left" style=" font-family:Verdana, sans-serif; font-size:12px;"><?php echo $prod_size;?>&nbsp;</td>
      <td align="right" style=" font-family:Verdana, sans-serif; font-size:12px;"><?php echo $prod_qty;?>&nbsp;</td>
      <td align="right" style=" font-family:Verdana, sans-serif; font-size:12px;"><?php echo number_format($contract_rate,2);?>&nbsp;</td>
      <td align="right" style=" font-family:Verdana, sans-serif; font-size:12px;"><?php echo number_format($prod_qty,2);?>&nbsp;</td>
      </tr>
    <?php 
  $net_tot+=$net_total;
  } ?>
  <td height="30" colspan="16"align="right" style="font-family: Verdana, sans-serif; font-size: 12px; font-weight: bold; border-top:dashed 1px;">Printed Date : <?php echo $curdate=date('d-m-Y h:m a');?>&nbsp;
    </p></td>
  </table></td>
</tr>
</table>
