<?php $PageSecurity = 11;
include('includes/session.inc');
include('includes/SQL_CommonFunctions.inc');
$sql=DB_query("select * from empmaster where id='".$_REQUEST['emp']."'",$db);
$row=DB_fetch_array($sql);

$appp_master=DB_fetch_assoc(DB_query("SELECT * FROM perf_appraisal_master WHERE salary_from<=".$row['net_sal']." AND salary_to>=".$row['net_sal']." AND valid_from<='".date('Y-m-d')."' AND valid_to>='".date('Y-m-d')."' and companyid='".$_SESSION['ACGCompanyId']."' ",$db)); 

$grth=DB_fetch_assoc(DB_query("SELECT SUM(total_com)as tot,COUNT(*)as cnt FROM perf_task_assign a,perf_task_assign_details b WHERE a.user_id='".$row['mst_www_userid']."' and a.id=b.task_id ",$db)) ;
 
$avg_grth=$grth['tot']/$grth['cnt'];
echo
// $app_rate=DB_fetch_assoc(DB_query( "select * from perf_appraisal_master_details where masterid='".$appp_master['id']."' and growth_from<=".$avg_grth." and  growth_to>=".$avg_grth." ",$db));

if($row['net_sal']>0){
$last_sal=$row['net_sal']+(($app_rate['appraisal']*$row['net_sal'])/100);
}
$data1=$row['emp_code']."__".$row['net_sal']."__".$avg_grth."__".$app_rate['appraisal']."__".round($last_sal,2);

echo $data=$data1;


?>