<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">

<?php
$PageSecurity = 2;
$title = _('View Employee') ;
include('includes/SQL_CommonFunctions.inc');
$sql1=DB_query("Select * from empmaster where id='".$_GET['id']."'",$db);
$myrow1=DB_fetch_array($sql1);
$sql2=DB_query("Select * from employee_address where emp_id='".$_GET['id']."'",$db);
$myrow2=DB_fetch_array($sql2);
$sql5=DB_query("Select * from emp_leave where emp_id ='".$_GET['id']."'",$db);
?>
<h1 align="center">Details of <?php echo $myrow1['emp_name'];?></h1>
<!--<h4 align="center">Code - <?php echo $myrow1['emp_code'];?></h4>-->
<br />
<h3>Employee Details</h3>
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr class="row1">
<td width="80%">
<table width="100%" border="1" style="border:1px solid #808080" cellpadding="3" cellspacing="0" align="center">
  <tr class="OddTableRows">
    <td width="13%"><strong>Labor Type </strong></td>
    <td width="20%"><?php echo $myrow1['employment_type'];?></td>
    <td width="13%"><strong>Labor Code</strong></td>
    <td width="20%"><?php echo $myrow1['emp_code'];?></td>
    <td width="13%"><strong>Labor Name</strong></td>
    <td><?php echo $myrow1['emp_name'];?></td>
  </tr> 
  <tr class="EvenTableRows">
    <td><strong>Nationality</strong></td>
    <td><?php echo $myrow1['nationality'];?></td>
    <td><strong>Religion</strong></td>
    <td><?php echo $myrow1['religion'];?></td>
    <td><strong>Date of Birth</strong></td>
    <td><?php if($myrow1['dob']=='0000-00-00'){echo "N/A";} else {echo ConvertSQLDate($myrow1['dob']);}?></td>
  </tr> 
  <tr class="OddTableRows">
    <td><strong>Gender</strong></td>
    <td><?php 
    if($myrow1['sex']=='M')
    {echo "Male";}
    else
    echo "Female";
    ?></td>
    <td colspan="1">Blood Group</td>
    <td colspan="1"><?php echo $myrow1['bloodgroup'];?></td>
    <td><strong>Date of joining</strong></td>
    <td><?php if($myrow1['doj']=='0000-00-00'){echo "N/A";} else {echo ConvertSQLDate($myrow1['doj']);}?></td>
  </tr>
  <tr class="EvenTableRows">
    <td><strong>Marital Status </strong></td>
    <td><?php echo $myrow1['marital_status'];?></td>
    <td>UID Type</td>
    <td><?php if($myrow1['uid_type']=='DL'){} else if($myrow1['uid_type']=='PC'){} else if($myrow1['uid_type']=='GID'){ echo 'Govt issued ID'; } 
    else if($myrow1['uid_type']=='AC'){ echo 'Aadhar Card'; } echo $myrow1['uid_type'];?></td>
    <td>UID No</td>
    <td><?php echo $myrow1['uid_no'];?></td>
  </tr>
  <tr class="OddTableRows">
    <td><strong>Number of Children </strong></td>
    <td><strong>Sons - </strong><?php echo $myrow1['sons'];?> | <strong>Daughters -</strong> <?php echo $myrow1['daughters'];?></td>    
    <td><strong>Father's Name</strong></td>
    <td><?php echo $myrow1['fh_name'];?></td>
    <td><strong>Date of leave</strong></td>
    <td><?php if($myrow1['dol']=='0000-00-00'){echo "N/A";} else {echo ConvertSQLDate($myrow1['dol']);}?></td>
  </tr>
  <tr class="EvenTableRows">
    <td><strong>Project Name</strong></td>
    <td><?php 
    echo $s->getField("manufacturing_advice","id",$myrow1['emp_site'],"project_name"); ?></td>
    <td><strong>Department</strong></td>
    <td><?php 
    echo $s->getField("deptmaster","id",$myrow1['department'],"deptname"); ?></td>
    <td><strong>Designation</strong></td>
    <td><?php
    echo $s->getField("desigmaster","id",$myrow1['designation'],"designame"); ?></td>
  </tr>
  <tr class="OddTableRows">
    <td><strong>Labor Type</strong></td>
    <td><?php 
    $grade_sql=DB_query("Select * from emp_grade where id='".$myrow1['grade']."'",$db);
    $grade_row=DB_fetch_array($grade_sql);
    echo $grade_row['grade_name'];?></td>
    <td><strong>PF type</strong></td>
    <td><?php echo $myrow1['pf_type']; ?></td>
    <td><strong>Labor Shift </strong></td>
    <td><?php
     $emp_shift_sql=DB_query("Select * from shift_master where id='".$myrow1['emp_shift']."'",$db);
     $emp_shift_row=DB_fetch_array($emp_shift_sql);

     echo $emp_shift_row['shift_for'].'('.$emp_shift_row['shift_category'].')-'.$emp_shift_row['shift_start'].$emp_shift_row['start_AMPM'].' to '.$emp_shift_row['shift_end'].$emp_shift_row['end_AMPM']; ?></td>
  </tr>
 <?php 
	if($myrow1['document']!='') {?>
	<tr><td colspan="6"><a href="uploaded_docs/<?php echo $myrow1['document'];?>" target="_blank">UPLOADED DOCUMENT</a> </td></tr><?php } ?>
</table>   </td>
<td width="20%" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
		<tr>
		<td style="text-align:center">
		<img src="uploaded_images/<?php echo $myrow1['image'];?>" width="auto" height="140" /></td>
		</tr>
		</table>
</td></tr></table>
<br />

<h3>Address Details</h3>
<table width="100%" border="0" style="border:1px solid #808080" cellpadding="3" cellspacing="0">
  <tr>
  <td width="50%" valign="top"><h3><strong> Present Address</strong></h3>
  <table style="border:#808080 1px solid; border-collapse:collapse;" border="1" width="100%" cellpadding="3" cellspacing="0">
  <tbody>
  <tr>
    <td rowspan="3" width="13%"><strong>Address</strong></td>
    <td width="30%"><?php echo $myrow2['pre_address1'];?></td>
  </tr>  
  <tr>    
    <td><?php echo $myrow2['pre_address2'];?></td>
  </tr>
  <tr>
    <td><?php echo $myrow2['pre_address3'];?></td>
  </tr>
  <tr class="OddTableRows">
    <td><strong>Country</strong></td>
    <td><?php 
    $cntry_sql=DB_query("Select * from country_master where id='".$myrow2['pre_country']."'",$db);
    $cntry_row=DB_fetch_array($cntry_sql);
    echo $cntry_row['country'];?></td>
  </tr>
  <tr>
    <td><strong>State</strong></td>
    <td><?php 
    $state_sql=DB_query("Select * from state_master where id='".$myrow2['pre_state']."'",$db);
    $state_row=DB_fetch_array($state_sql); 
    echo $state_row['state'];?></td>
  </tr>
  <tr class="OddTableRows">
    <td><strong>City</strong></td>
    <td><?php 
    $city_sql=DB_query("Select * from city_master where id='".$myrow2['pre_city']."'",$db);
    $city_row=DB_fetch_array($city_sql); 
    echo $city_row['city'];?></td>
  </tr>
  <tr>
    <td><strong>Pin Code</strong></td>
    <td><?php echo $myrow2['pre_pincode'];?></td>
  </tr>
  <tr class="OddTableRows">
    <td><strong>Mobile</strong></td>
    <td><?php echo $myrow2['pre_mobile'];?></td>
  </tr>
  <tr>
    <td><strong>Phone </strong></td>
    <td><?php echo $myrow2['pre_phone'];?></td>
  </tr>
  <!--<tr class="OddTableRows">
    <td><strong>Alt. Phone </strong></td>
    <td><?php echo $myrow2['pre_alt_phone'];?></td>
  </tr>
  <tr>
    <td><strong>Alt. Mobile </strong></td>
    <td><?php echo $myrow2['pre_alt_phone'];?></td>
  </tr> -->
  </tbody>
  </table>
  </td>

  <td valign="top"><h3><strong> Permanent Address</strong></h3>   
  <table style="border:#808080 1px solid; border-collapse:collapse;" border="1" width="100%" cellpadding="3" cellspacing="0">
      <tbody>
        <tr>
          <td width="13%" rowspan="3"><strong>Address</strong></td>
          <td width="30%"><?php echo $myrow2['per_address1'];?></td>
        </tr>
        <tr>
          <td><?php echo $myrow2['per_address2'];?></td>
        </tr>
        <tr>
          <td><?php echo $myrow2['per_address3'];?></td>
        </tr> 
        <tr class="OddTableRows">
          <td><strong>Country</strong></td>
          <td><?php 
          $cntry_sql=DB_query("Select * from country_master where id='".$myrow2['per_country']."'",$db);
          $cntry_row=DB_fetch_array($cntry_sql);
          echo $cntry_row['country'];?></td>
        </tr>   
        <tr>
          <td><strong>State</strong></td>
          <td><?php 
          $state_sql=DB_query("Select * from state_master where id='".$myrow2['per_state']."'",$db);
          $state_row=DB_fetch_array($state_sql);
          echo $state_row['state'];?></td>
        </tr>
        <tr class="OddTableRows">
          <td><strong>City</strong></td>
          <td><?php 
          $city_sql=DB_query("Select * from city_master where id='".$myrow2['per_city']."'",$db);
          $city_row=DB_fetch_array($city_sql); 
          echo $city_row['city'];?></td>
        </tr>
        <tr>  
          <td><strong>Pin Code</strong></td>
          <td><?php echo $myrow2['per_pincode'];?></td>
        </tr>
        <tr class="OddTableRows">  
          <td><strong>Mobile</strong></td>
          <td><?php echo $myrow2['per_mobile'];?></td>
        </tr>
        <tr>  
          <td><strong>Phone </strong></td>
          <td><?php echo $myrow2['per_phone'];?></td>
        </tr>
        <!--<tr class="OddTableRows">  
          <td><strong>Alt. Phone </strong></td>
          <td><?php echo $myrow2['per_alt_phone'];?></td>
        </tr>
        <tr>  
          <td><strong>Alt. Mobile </strong></td> 
          <td><?php echo $myrow2['per_alt_phone'];?></td>
        </tr> -->
      </tbody>
  </table>
  </td>

  </tr>
  </table>

 <br />

<!--<h3>Salary Details</h3>
<?php 
$sql3=DB_query("Select * from emp_salary where emp_id ='".$_GET['id']."' and all_ded_prefix='A'",$db);
$sql4=DB_query("Select * from emp_salary where emp_id ='".$_GET['id']."' and all_ded_prefix='D'",$db);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="3" >
    <tr class="row1">
      <td colspan="2"><strong>GROSS (G) :</strong> <strong><?php echo $myrow1['gross_sal'];?></strong></td>
    </tr>
  <tr>
    <td width="50%" valign="top">    
      <h3>ALLOWANCES(A)<input type="hidden" name="prefix1" id="prefix1" value="A" /></h3>
    <table width="100%" border="1" style="border:1px solid #808080" cellspacing="0" cellpadding="3">
      <tr>
        <td width="24%"><strong>DESCRIPTION</strong></td>
        <td><strong>%</strong></td>-->
        <!--<td><strong>VALUE</strong></td>
      </tr>
	  <tr>
	  <td><strong>BASIC</strong></th>
	  <td><?php echo trim($myrow1['basic_salary']);?></td>
	  </tr>
      <?php
	  while($myrow3=DB_fetch_array($sql3))
	  {
	  ?>
	  <tr>
        <td><strong><?php 
		$all_sql=DB_query("Select allowname from allowmaster where id='".$myrow3['allowance_deduction']."'",$db);
		$all_row=DB_fetch_array($all_sql);
		echo $all_row['allowname'];?></strong></th>
		<td><?php echo $myrow3['percentage'];?></td>
        <td><?php echo $myrow3['percentage_value'];?></td>
      </tr>
	  <?php } ?>
	 <tr>
	 <td><strong>TOTAL ALLOWANCE </strong></td>
	 <td colspan="2"><strong><?php echo $myrow1['allow_tot'];?></strong></td>
	 </tr>
    </table></td>
    <td valign="top">
      <h3>DEDUCTION(D) <input type="hidden" name="prefix2" id="prefix2" value="D" /></h3>
    <table width="100%" border="1" style="border:1px solid #808080" cellspacing="0" cellpadding="3">
      <tr>
        <td width="20%"><strong>DESCRIPTION</strong></td>
        <td width="40%"><strong>%</strong></td>
        <td><strong>VALUE</strong></td>
      </tr>
     <?php
	  while($myrow4=DB_fetch_array($sql4))
	  {
	  ?>
	  <tr>
        <td><strong><?php 
		$ded_sql=DB_query("Select name from deduction_master where id='".$myrow4['allowance_deduction']."'",$db);
		$ded_row=DB_fetch_array($ded_sql);
		echo $ded_row['name'];?></strong></td>
		<td><?php echo $myrow4['percentage'];?></td>
        <td><?php echo $myrow4['percentage_value'];?></td>
      </tr>
	  <?php } ?>
	  <tr>
	 <td><strong>TOTAL DEDUCTION </strong></td>
	 <td colspan="2"><strong><?php echo $myrow1['deduct_tot'];?></strong></td>
	 </tr>
    </table></td>
  </tr>
  
  <tr>
    <td colspan="2">
	<table width="100%" cellpadding="3" cellspacing="0" border="1" style="border:#808080 1px solid; border-collapse:collapse;">
	<tr>
	<td width="20%"><strong>Salary Effective From </strong></td>
	<td width="30%"><?php echo ConvertSQLDate($myrow1['eff_sal_date']);?></td>
	<td width="20%"><strong>PF Calculation On</strong></td>
	<td><select name="pf_calculation" id="pf_calculation">
      <option value="salary">As Per Salary</option>
    </select></td>
	</tr>
	<tr>
	<td><strong>Gross Salary (B+A+D) </strong></td>
	<td><strong><?php echo $myrow1['gross_sal'];?></strong></td>
	<td><strong>Net Salary (Gross-D) </strong></td>
	<td><strong><?php echo $myrow1['net_sal'];?></strong></td>
	</tr>
	<tr>
    <td><strong>Advance Money</strong></td>
	  <?php if($myrow1['adv_amount']=='0.00') {$p="No";} else {$p="Yes";} ?>
    <td><?php echo $p; ?></td>
	  <td><strong>Advance Amount</strong></td>
	  <td><?php if($myrow1['adv_amount']=='0.00'){echo "N/A";} else echo $myrow1['adv_amount']; ?></td>
	</tr>
  <tr>
    <td><strong>Date</strong></td>
    <td><?php if($myrow1['adv_amount']=='0.00'){echo "N/A";} else echo ConvertSQLDate($myrow1['adv_date']); ?></td>
    <td>Over Time</td>
    <td><?php if($myrow1['over_time']=='Yes'){echo $myrow1['overtime_salary'];}else{echo "N/A";}?></td>
  </tr>
	</table>
	</td>
  </tr>
</table> -->
<br />
<h3>Leave Details</h3>
 <table width="100%" border="1"  style="border:1px solid #808080" cellpadding="3" cellspacing="0">
 <tr>
     <td colspan="2"><strong>Effective Date :</strong> <?php echo ConvertSQLDate($myrow1['leave_eff_date']);?></td>
   </tr>
   		<tr>
       <tH width="50%"><strong>Leave Type</strong></th>
       <th><strong>Number of days </strong></th>
     </tr>
<?php 
while($myrow5=DB_fetch_array($sql5))
{
?>
<tr>
<td><?php 
$leave_sql=DB_query("Select leavename from leavemaster where leavecode='".$myrow5['leave_type']."'",$db);
$leave_row=DB_fetch_array($leave_sql);
echo $leave_row['leavename'];?></td>
<td><?php echo $myrow5['leave_days'];?></td>
</tr>
<?php } ?>
</table>

</div>
</div>
<?php 
include('includes/footer.inc');
?>