<?
ob_start();
session_start();
if(isset($_SESSION['ses_name']))
{
$user=$_SESSION['ses_name'];
}else{
header("location:index.php");
}
$tyrenum_veh='';$client_main='';
$cclient_name='';$rproduct_client_code='';
include("include/config.php");
require_once "include/Database_functions.php";
$sqlObj=new sqlclass();

$rproduct_name='';$rproduct_category='';
	

$tablename='cf_deduction_earning';
         
		 $pdate=date("Y-m-d");
			
			
			if(isset($_POST['empid'])){
			$empid=addslashes($_POST['empid']);
			}	
			
			if(isset($_POST['basic_earning'])){
			$basicearning=$_POST['basic_earning'];
			}
			
			if(isset($_POST['ta_earning'])){
			$taearning=$_POST['ta_earning'];
			}	
			
			if(isset($_POST['da_earning'])){
			$da_earning=addslashes($_POST['da_earning']);
			}
			
			if(isset($_POST['hra_deduct'])){
			$hra_deduct=addslashes($_POST['hra_deduct']);
			}	
			
			if(isset($_POST['lop_deduct'])){
			$lop_deduct=addslashes($_POST['lop_deduct']);
			}	
			
			if(isset($_POST['pf_deduct'])){
			$pf_deduct=addslashes($_POST['pf_deduct']);
			}	
			
			if(isset($_POST['other_deduct'])){
			$other_deduct=addslashes($_POST['other_deduct']);
			}	
			
			if(isset($_POST['save'])){	
			$rdeductid = $_REQUEST['deductid'];		
			$sqlObj->tablename=$tablename;									
			$sqlObj->fieldname='(emp_id,basic_ear,da_ear,ta_ear,HRA_ded,LOP_ded,PF_ded,other_ded)';
			$sqlObj->fieldvalue='"'.$empid.'","'.$basicearning.'","'.$da_earning.'","'.$taearning.'","'.$hra_deduct.'","'.$lop_deduct.'","'.$pf_deduct.'","'.$other_deduct.'"';
			if($rdeductid==""){			
			$qsy= "insert into ".$tablename.$sqlObj->fieldname." values(".$sqlObj->fieldvalue.")";
			$CreateClient 	= mysql_query($qsy);
			}else{
			$updata="basic_ear='".$basicearning."',da_ear='".$da_earning."',ta_ear='".$taearning."',HRA_ded='".$hra_deduct."',LOP_ded='".$lop_deduct."',PF_ded='".$pf_deduct."',other_ded='".$other_deduct."'";
			$qsy= "update ".$tablename." set ".$updata." where deduct_ear_id='".$rdeductid."'";
			$CreateClient 	= mysql_query($qsy);
							
			}			
			
			header("location:manage_deduct_earning_list.php?msg=You Have Successfully Saved");
			
		}
		
$empid='';
$basicear='';
$daear='';
$taear='';
$HRAded='';
$LOPded='';
$PFded='';
$otherded='';

if(isset($_REQUEST['deductid'])){
	$dedid=mysql_escape_string($_REQUEST['deductid']);
	$rqry="SELECT *  FROM cf_deduction_earning where deduct_ear_id='".$dedid."'";
	
	$sqry=mysql_query($rqry);
	if($sqry && mysql_num_rows($sqry)>0)
	{
		while($sobj=mysql_fetch_object($sqry))
		{
			$empid=$sobj->emp_id;
			$basicear=$sobj->basic_ear;
			$daear=$sobj->da_ear;
			$taear=$sobj->ta_ear;
			$HRAded=$sobj->HRA_ded;
			$LOPded=$sobj->LOP_ded;
			$PFded=$sobj->PF_ded;
			$otherded=$sobj->other_ded;
			
		}
		}
	}	

?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>OIL FILL</title>
<link href="css/styles.css" rel="stylesheet"  />
<link type="text/css" href="css_date/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script type="text/javascript" src="scripts_date/jquery.js"></script>
<script type="text/javascript" src="scripts_date/jquery-calendar-1.7.2.js"></script>
<script src="js/addmoretown.js"></script>




<script type="text/javascript">

$(document).ready(function(){
$('#leavefrom').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});

$('#leaveto').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});

});

<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->


</script>

	<script type='text/javascript'>
	
function validationprod()
{

	if(document.prodfrmname.clientname.value=='')
	{
		alert("Enter Client Name");
		document.prodfrmname.clientname.focus();
		return false;
	}
	if(document.prodfrmname.productname.value=='')
	{
		alert("Enter Product Name");
		document.prodfrmname.productname.focus();
		return false;
	}
}
//--client code dropdown

</script>
<style>
.lableentrytext{
font-size: 12px;
color: #505050;
clear: both;
margin-bottom: 5px;
text-transform: capitalize;
}
.addimgs{
font-size: 12px;
color: #505050;
clear: both;
margin-bottom: 5px;
text-transform: capitalize;
cursor:hand;
cursor:pointer;
}
.addimgs a:hover{
color: #000;
}
.rimg{
font-size: 12px;
color: #505050;
clear: both;
margin-bottom: 5px;
text-transform: capitalize;
cursor:hand;
cursor:pointer;
}
.rimg a:hover{
color: #000;
}

</style>
</head>

<body>
<div class="wrapper">
  <div>
<?php 
	include("header.php");
?>
 
</div>
 
 
 <div class="tabbedArea">
  
  <div class="tabBody">
   <h1>Manage Deduction Earnings</h1>
   <form name="prodfrmname" method="post" action="">
    <div class="addEmp" style="margin-bottom:0px; border-bottom:0px solid;width:1000px;">
        <table width="70%" border="0" cellspacing="0" cellpadding="10">
          <tr>
            <td width="51%" valign="top">
      <div class="form1">
        <p class="input1">Employee</p>
		<?php $sqlemp = mysql_query("select * from cf_employee where user_type != 'Superadmin' and status = 1 order by e_fname asc");  ?>
                               <select name="empid" id="empid" class="input1 input3" onChange="get_time()" >  
                               <option value="">-Select-</option>
                               <?php while($rw = mysql_fetch_array($sqlemp)){ ?>                            
                               <option value="<?=$rw['e_id']?>" <?php if($rw['e_id'] == $empid){?> selected <?php } ?>><?=$rw['e_fname']?></option>
                               <?php } ?>
                               </select>
     </div>

     <div class="form1">
        <p class="input1">Basic</p>
        <input type="text" name="basic_earning" id="basic_earning" class="input1 input3" value="<?=$basicear?>" >
     </div>
     
     <div class="form1">
        <p class="input1">DA</p>
        <input type="text" name="da_earning" id="da_earning" class="input1 input3" value="<?=$daear?>" >
     </div>
     
     <div class="form1">
        <p class="input1">TA</p>
        <input type="text" name="ta_earning" id="ta_earning" class="input1 input3" value="<?=$taear?>" >
     </div>
     
        </td>
            <td width="49%" valign="top">
            <div>     
              <p class="input1">HRA</p>
                <input type="text" name="hra_deduct" id="hra_deduct" class="input1 input3" value="<?=$HRAded?>" >
            </div>      
            
            <div>     
              <p class="input1">LOP</p>
                <input type="text" name="lop_deduct" id="lop_deduct" class="input1 input3" value="<?=$LOPded?>" >
            </div> 
            
            <div>     
              <p class="input1">PF</p>
                <input type="text" name="pf_deduct" id="pf_deduct" class="input1 input3" value="<?=$PFded?>" >
            </div>
            
            <div>     
              <p class="input1">Other Deduction</p>
                <input type="text" name="other_deduct" id="other_deduct" class="input1 input3" value="<?=$otherded?>" >
            </div>  
          </td>
          </tr>
        </table>
	
	<table width="70%" border="0" cellspacing="0" cellpadding="10">
       <tr>
         <td colspan="2"><div class="searchField1">
        <?php
	 	if(isset($_REQUEST['brchid'])){
		$rbrchid = $_REQUEST['brchid'];
	  ?><input name="brchid" type="hidden" value="<?=$rbrchid?>">  
	 
      <input name="save" type="submit" class="input1" value="Edit" onClick="return validationprod();"/>
      <?php }else { ?>   
     <input name="save" type="submit" class="input1" value="Save" onClick="return validationprod();"/>
	  
     <?php } ?>

         <input type="button" class="input1" value="Cancel" >
        </div>
        </td>
          </tr>
        </table>
       

<div class="mand"><p>Fields marked <span style="color:#FF3300">*</span> are Mandatory</p></div>
</div>
   </form>
   </div>
 </div>
 <div class="footer"><p>Powered by <a href="http://www.aadhocc.co.uk/" target="_blank">Aadhocc</a></p></div>
 
</div>
<div class="quicLInksCover">
  <?php 
	include("leftlink.php");
?>

</div>
</body>
</html>


		






