File: /home/barbeatleanalyti/www/baris.beatleanalytics.com/newrunajax.php
<?php
// Include common files.
include_once("site/include/config.php");
include_once(INCLUDE_PATH."/dbClass.php");
$objDB = new MySQLCN();
include_once(INCLUDE_PATH."/functions.php");
include_once(INCLUDE_PATH."/storeconfig.php");
$storeconfig = new storeconfig();
include_once(TEMPLATE_PATH."/common_include.php");
// Create a new object for MySQLCN
// Check if data is variable is exists or not into query string or post data.
if(isset($_REQUEST['data'])){
$data = urldecode(base64_decode($_REQUEST['data']));
// Convert string to array of a data.
$DataExplode = explode("&",$data);
foreach($DataExplode as $key=>$val){
for($i=0; $i<count($DataExplode); $i++ ){
$DataExpSub = explode("=",$DataExplode[$i]);
if(preg_match('/acn=/',$DataExplode[$i])){
$acn = $DataExpSub[1];
}else if(preg_match('/pg=/',$DataExplode[$i])){
$pg = $DataExpSub[1];
}else if(preg_match('/val1/',$DataExplode[$i])){
$val1 = $DataExpSub[1];
}
}
}
if($acn == 'FetchTotalDays'){
include_once(INCLUDE_PATH."/leavedetails.php");
$objAdmin = new include_leavedetails();
$rsState = $objAdmin->FetchTotalBalance($val1);
$rsLeavedetails = $objAdmin->FetchLeaveBeforeTodayDate($val1);
//print_r($rsLeavedetails);
if($val1 == 'CL'){
$data = 2*$rsState[0]['CLCurrentBalance'] - $rsLeavedetails[0]['SUM(TotalDays)'];
echo $data;
}else if($val1 == 'SL'){
$da = "";
if(count($rsLeavedetails)>0){
for($i=0; $i<count($rsLeavedetails); $i++){
if($rsLeavedetails[$i]['HalfDay'] == '2ND'){
$da = 2*$rsState[0]['SLCurrentBalance'] - 1;
}else if($rsLeavedetails[$i]['HalfDay'] == '1ST'){
$da = 2*$rsState[0]['SLCurrentBalance'] - 0.5;
}
}
}else{
$da = 2*$rsState[0]['SLCurrentBalance'];
}
echo $da;
}else if($val1 == 'PL'){
$data = $rsState[0]['PLCurrentBalance'] - $rsLeavedetails[0]['SUM(TotalDays)'];
echo $data;
}
exit;
}
}
?>