format("Y-m-d"); error_reporting(0); $comID = $_GET['cID']; $userID = $_GET['uID']; $sDate = $_GET['ksDate']; $eDate = $_GET['keDate']; $compName = mysql_result(mysql_query("SELECT `comp_name` FROM `vts_company` WHERE `comp_id`='$comID'"),0); $FName = mysql_result(mysql_query("SELECT `u_fname` FROM `vts_users` WHERE `u_id`='$userID'"),0); $LName = mysql_result(mysql_query("SELECT `u_lname` FROM `vts_users` WHERE `u_id`='$userID'"),0); $totalCount = mysql_result(mysql_query("SELECT COUNT(1) FROM `cl_clearance_header` WHERE `cl_h_hr_approval`!='DISAPPROVED' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate'"),0); $totalClosed = mysql_result(mysql_query("SELECT COUNT(1) FROM `cl_clearance_header` WHERE `cl_h_hr_approval`='CLOSED' AND `cl_lastpay_released_date` BETWEEN '$sDate' AND '$eDate'"),0); $totalOpen = $totalCount - $totalClosed;//mysql_result(mysql_query("SELECT COUNT(1) FROM `cl_clearance_header` WHERE `cl_h_hr_approval`!='DISAPPROVED' AND `cl_h_hr_approval`!='CLOSED' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate'"),0); mysql_query("DROP TABLE IF EXISTS `CL_TAT_Summary`"); $sql = "CREATE TABLE IF NOT EXISTS `CL_TAT_Summary` (`id` int(11) NOT NULL AUTO_INCREMENT, `days` int(4) NOT NULL,PRIMARY KEY (`id`))"; $sqlResponse = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): ". mysql_error(). '.'); //$getClearanceHead = mysql_query("SELECT * FROM`cl_clearance_header` WHERE `cl_h_hr_approval`!='DISAPPROVEd' AND `cl_h_hr_approval`='CLOSED' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate' AND `cl_sla_start` < `cl_lastpay_released_date`"); $getClearanceHead = mysql_query("SELECT * FROM`cl_clearance_header` WHERE `cl_h_hr_approval`!='DISAPPROVED' AND `cl_h_hr_approval`='CLOSED' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate' AND `cl_sla_start`!='' AND `cl_sla_end`!=''"); while($rowA=mysql_fetch_array($getClearanceHead)){ $coStartDateTSH = $rowA['cl_sla_start']; if($rowA['cl_completion_date'] == ''){ $coEndDateH = strtotime($prfDate); }else{ $coEndDateH = strtotime($rowA['cl_completion_date']); } $your_dateH = strtotime($coStartDateTSH); $datediffH = $coEndDateH - $your_dateH; $mandaysH = round($datediffH / (60 * 60 * 24)); $sql = "INSERT INTO CL_TAT_Summary (id,days) VALUES('','$mandaysH')"; $sqlQuery = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): " . mysql_error() . '.'); } $totalFast = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Summary` WHERE `days`!='' ORDER BY `days` ASC LIMIT 1"),0); $totalAverageSUM = mysql_result(mysql_query("SELECT SUM(`days`) FROM `CL_TAT_Summary` WHERE `days`!=''"),0); $totalAverageCOUNT = mysql_result(mysql_query("SELECT COUNT(id) FROM `CL_TAT_Summary` WHERE `days`!=''"),0); $totalAverage = $totalAverageSUM / $totalAverageCOUNT; $totalSlow = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Summary` WHERE `days`!='' ORDER BY `days` DESC LIMIT 1"),0); $totalSlowS = number_format($totalSlow,1,'.',''). " Days"; $totalFastS = number_format($totalFast,1,'.',''). " Days"; $totalAverageS = number_format($totalAverage,1,'.','')." Days"; if($_GET['AutohubWide']==='No'){ $title = $compName; }else{ $title = "AUTOHUB WIDE"; } ?>
"; echo "CLEARANCE SUMMARY
".$title.""; echo "Period Covered: ".$sDate." - ".$eDate."
"; echo "CLEARANCE PROCESS | "; echo "SHORTEST | "; echo "AVERAGE | "; echo "LONGEST | "; echo ""; echo "
---|---|---|---|
CLEARING OFFICER | "; echo ""; mysql_query("DROP TABLE IF EXISTS `CL_TAT_Analysis`"); $sql = "CREATE TABLE IF NOT EXISTS `CL_TAT_Analysis` (`id` int(11) NOT NULL AUTO_INCREMENT, `days` int(4) NOT NULL,PRIMARY KEY (`id`))"; $sqlResponse = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): ". mysql_error(). '.'); $getClearanceHead = mysql_query("SELECT * FROM`cl_clearance_header` WHERE `cl_h_hr_approval`='CLOSED' AND `cl_h_hr_approval`='CLOSED' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate' AND `cl_sla_start`!='' AND `cl_sla_end`!=''"); while($rowA=mysql_fetch_array($getClearanceHead)){ $coStartDateTS = strtotime($rowA['cl_sla_start']); //$coStartDateEx =explode(" ",$coStartDateTS); //$coStartDate=$coStartDate[0]; //if($rowA['signatory_completion_date'] == ''){ // $coEndDate = strtotime($prfDate); //}else{ $coEndDate = strtotime($rowA['signatory_completion_date']); //} //$your_date = strtotime($coStartDateTS); $datediff = $coEndDate - $coStartDateTS; $mandays = round($datediff / (60 * 60 * 24)); $sql = "INSERT INTO CL_TAT_Analysis (id,days) VALUES('','$mandays')"; $sqlQuery = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): " . mysql_error() . '.'); } //$coFastA = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` ASC LIMIT 1"),0); $coFast = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` ASC LIMIT 1"),0); if($coFast > 1){$pluralText ='Days';}else{$pluralText ='Day';} $coAverageCount = mysql_result(mysql_query("SELECT COUNT(`1`) FROM `CL_TAT_Analysis` WHERE `days`!='' AND `days`> 0"),0); $coAverage = mysql_result(mysql_query("SELECT AVG(`days`) FROM `CL_TAT_Analysis` WHERE `days`!='' AND `days`> 0"),0); //$coAverage = number_format(($coAverageSUM / $coAverageCount),1,'.',','); $coSlow = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` DESC LIMIT 1"),0); echo number_format($coFast,1,'.','')." ".$pluralText; echo" | "; echo "". number_format($coAverage,1,'.','')." Days | "; echo "". number_format($coSlow,1,'.','')." Days | "; echo "
RECOMMENDING OFFICERS | "; echo ""; mysql_query("DROP TABLE IF EXISTS `CL_TAT_Analysis`"); $sql = "CREATE TABLE IF NOT EXISTS `CL_TAT_Analysis` (`id` int(11) NOT NULL AUTO_INCREMENT, `days` int(4) NOT NULL,PRIMARY KEY (`id`))"; $sqlResponse = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): ". mysql_error(). '.'); $getClearanceHead = mysql_query("SELECT * FROM`cl_clearance_header` WHERE `cl_h_hr_approval`!='DISAPPROVED' AND `signatory_completion_date`!='' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate' AND `cl_recommender_a_timestamp` !='' || `cl_h_hr_approval`!='DISAPPROVED' AND `signatory_completion_date`!='' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate' AND `cl_recommender_b_timestamp` !=''"); while($rowB=mysql_fetch_array($getClearanceHead)){ $rcStartDateTS = $rowB['signatory_completion_date']; $recoA = $rowB['cl_recommender_a_timestamp']; $recoB = $rowB['cl_recommender_b_timestamp']; if($recoB==''){ $endDate = $recoA; }else{ $endDate = $recoB; } $recoAeX=explode(" ",$endDate); $myEndDate = strtotime($recoAeX[0]); $clearanceCompletionDate = strtotime($rcStartDateTS); $datediff = $myEndDate - $clearanceCompletionDate; $mandays = round($datediff / (60 * 60 * 24)); $sql = "INSERT INTO CL_TAT_Analysis (id,days) VALUES('','$mandays')"; $sqlQuery = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): " . mysql_error() . '.'); } $coFastA = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` ASC LIMIT 1"),0); if($coFastA > 1){$pluralText =' Days';}else{$pluralText =' Day';} $coAverageCount = mysql_result(mysql_query("SELECT AVG(`days`) FROM `CL_TAT_Analysis` WHERE `days`!='' AND `days`> 0"),0); $coSlow = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` DESC LIMIT 1"),0); echo number_format($coFastA,1,'.',',').$pluralText; echo" | "; echo "". number_format($coAverageCount,1,'.','')." Days | "; echo "". number_format($coSlow,1,'.','')." Days | "; echo "
APPROVING OFFICERS | "; echo "";
mysql_query("DROP TABLE IF EXISTS `CL_TAT_Analysis`");
$sql = "CREATE TABLE IF NOT EXISTS `CL_TAT_Analysis` (`id` int(11) NOT NULL AUTO_INCREMENT, `days` int(4) NOT NULL,PRIMARY KEY (`id`))";
$sqlResponse = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): ". mysql_error(). '.');
$getClearanceHead = mysql_query("SELECT * FROM`cl_clearance_header` WHERE `cl_h_hr_approval`!='DISAPPROVED' AND `signatory_completion_date`!='' AND `cl_recommender_a_timestamp`!='' AND `cl_recommender_b_timestamp`!='' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate'");
while($rowB=mysql_fetch_array($getClearanceHead)){
//GetLastRecommending officer date
$startDateA =$rowB['cl_recommender_a_timestamp'];
$startDateB =$rowB['cl_recommender_b_timestamp'];
$exStartA=explode(" ",$startDateA);
$myStartDateA = $exStartA[0];
$exStartB=explode(" ",$startDateB);
$myStartDateB = $exStartB[0];
if($myStartDateA > $myStartDateB){
$myTrueStartDate = $myStartDateA;
}else{
$myTrueStartDate = $myStartDateB;
}
//echo $myTrueStartDate." "; //Get LastApproving officer date $startAprDateAdum =$rowB['cl_approver_id_timestamp']; if($startAprDateAdum==''){ $startAprDateA=$prfDate; } else{ $startAprDateA=$rowB['cl_approver_id_timestamp']; } $startAprDateBdum =$rowB['cl_approver_id_b_timestamp']; if($startAprDateBdum==''){ $startAprDateB=$prfDate; } else{ $startAprDateB=$rowB['cl_approver_id_b_timestamp']; } $exStartAprA=explode(" ",$startAprDateA); $myStartAprDateA = $exStartAprA[0]; $exStartAprB=explode(" ",$startAprDateB); $myStartAprDateB = $exStartAprB[0]; if($myStartAprDateA > $myStartAprDateB){ $myTrueAprStartDate = $myStartAprDateA; }else{ $myTrueAprStartDate = $myStartAprDateB; } //echo $myTrueAprStartDate." "; $approvalDate = strtotime($myTrueAprStartDate); $recommendedDate = strtotime($myTrueStartDate); $datediff = $approvalDate - $recommendedDate; $mandays = round($datediff / (60 * 60 * 24)); $sql = "INSERT INTO CL_TAT_Analysis (id,days) VALUES('','$mandays')"; $sqlQuery = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): " . mysql_error() . '.'); } $coFastA = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` ASC LIMIT 1"),0); if($coFast > 1){$pluralText =' Days';}else{$pluralText =' Day';} $coAverageCount = mysql_result(mysql_query("SELECT AVG(`days`) FROM `CL_TAT_Analysis` WHERE `days`!='' AND `days`> 0"),0); $coSlow = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` DESC LIMIT 1"),0); //echo $coEndDate . "-".$your_date;; echo number_format($coFastA,1,'.','').$pluralText; echo" | ";
echo "". number_format($coAverageCount,1,'.','')." Days | "; echo "". number_format($coSlow,1,'.','')." Days | "; echo "
LASTPAY COMPUTATION | "; echo ""; mysql_query("DROP TABLE IF EXISTS `CL_TAT_Analysis`"); $sql = "CREATE TABLE IF NOT EXISTS `CL_TAT_Analysis` (`id` int(11) NOT NULL AUTO_INCREMENT, `days` int(4) NOT NULL,PRIMARY KEY (`id`))"; $sqlResponse = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): ". mysql_error(). '.'); $getClearanceHead = mysql_query("SELECT * FROM`cl_clearance_header` WHERE `cl_h_hr_approval`!='DISAPPROVED' AND `signatory_completion_date`!='' AND `cl_recommender_a_timestamp`!='' AND `cl_recommender_b_timestamp`!='' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate'"); while($rowB=mysql_fetch_array($getClearanceHead)){ //Get LastApproving officer date $startAprDateAdum =$rowB['cl_approver_id_timestamp']; if($startAprDateAdum==''){ $startAprDateA=$prfDate; }else{ $startAprDateA=$rowB['cl_approver_id_timestamp']; } $startAprDateBdum =$rowB['cl_approver_id_b_timestamp']; if($startAprDateBdum==''){ $startAprDateB=$prfDate; } else{ $startAprDateB=$rowB['cl_approver_id_b_timestamp']; } $exStartAprA=explode(" ",$startAprDateA); $myStartAprDateA = $exStartAprA[0]; $exStartAprB=explode(" ",$startAprDateB); $myStartAprDateB = $exStartAprB[0]; if($myStartAprDateA > $myStartAprDateB){ $myTrueAprStartDate = $myStartAprDateA; }else{ $myTrueAprStartDate = $myStartAprDateB; } $coEndDateSX = $rowB['cl_computation_date']; if($coEndDateSX==''){ $coEndDateS=$prfDate; }else{ $coEndDateS=$rowB['cl_computation_date']; } $your_date = strtotime($myTrueAprStartDate); $coEndDate = strtotime($coEndDateS); $datediff = $coEndDate - $your_date; $mandays = round($datediff / (60 * 60 * 24)); $sql = "INSERT INTO CL_TAT_Analysis (id,days) VALUES('','$mandays')"; $sqlQuery = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): " . mysql_error() . '.'); } $coFastA = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` ASC LIMIT 1"),0); if($coFastA < 0){ $coFast ==0; }else{ $coFast = $coFastA; } if($coFast > 1){$pluralText =' Days';}else{$pluralText =' Day';} $coAverage = mysql_result(mysql_query("SELECT AVG(`days`) FROM `CL_TAT_Analysis` WHERE `days`!='' AND `days`> 0"),0); $coSlow = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` DESC LIMIT 1"),0); echo number_format($coFast,1,'.','').$pluralText; echo" | "; echo "". number_format($coAverage,1,'.','')." Days | "; echo "". number_format($coSlow,1,'.','')." Days | "; echo "
EMPLOYEE APPROVAL | "; echo ""; mysql_query("DROP TABLE IF EXISTS `CL_TAT_Analysis`"); $sql = "CREATE TABLE IF NOT EXISTS `CL_TAT_Analysis` (`id` int(11) NOT NULL AUTO_INCREMENT, `days` int(4) NOT NULL,PRIMARY KEY (`id`))"; $sqlResponse = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): ". mysql_error(). '.'); $getClearanceHead = mysql_query("SELECT * FROM`cl_clearance_header` WHERE `cl_h_hr_approval`!='DISAPPROVED' AND `cl_computation_date`!='' AND `cl_recommender_a_timestamp`!='' AND `cl_recommender_b_timestamp`!='' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate'"); while($rowB=mysql_fetch_array($getClearanceHead)){ $getRawStartDate =$rowB['cl_computation_date']; $getRawEndDate =$rowB['cl_lastpay_approved_date']; if($getRawEndDate==''){ $coEndDateS=$prfDate; } else{ $coEndDateS=$rowB['cl_lastpay_approved_date']; } // echo $getRawEndDate. "-".$getRawStartDate; $your_date = strtotime($getRawStartDate); $coEndDate = strtotime($coEndDateS); $datediff = $coEndDate - $your_date; $mandays = round($datediff / (60 * 60 * 24)); $sql = "INSERT INTO CL_TAT_Analysis (id,days) VALUES('','$mandays')"; $sqlQuery = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): " . mysql_error() . '.'); } $coFastA = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` ASC LIMIT 1"),0); if($coFastA < 0){ $coFast ==0; }else{ $coFast = $coFastA; } if($coFast > 1){$pluralText =' Days';}else{$pluralText =' Day';} $coAverage = mysql_result(mysql_query("SELECT AVG(`days`) FROM `CL_TAT_Analysis` WHERE `days`!='' AND `days`> 0"),0); $coSlow = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` DESC LIMIT 1"),0); echo number_format($coFast,1,'.','').$pluralText; echo" | "; echo "". number_format($coAverage,1,'.','')." Days | "; echo "". number_format($coSlow,1,'.','')." Days | "; echo "
CHECK REQUEST PREPARATION | "; echo ""; mysql_query("DROP TABLE IF EXISTS `CL_TAT_Analysis`"); $sql = "CREATE TABLE IF NOT EXISTS `CL_TAT_Analysis` (`id` int(11) NOT NULL AUTO_INCREMENT, `days` int(4) NOT NULL,PRIMARY KEY (`id`))"; $sqlResponse = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): ". mysql_error(). '.'); $getClearanceHead = mysql_query("SELECT * FROM`cl_clearance_header` WHERE `cl_h_hr_approval`!='DISAPPROVED' AND `cl_computation_date`!='' AND `cl_lastpay_approved_date`!='' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate'"); while($rowB=mysql_fetch_array($getClearanceHead)){ $getRawStartDate =$rowB['cl_lastpay_approved_date']; $getRawEndDate =$rowB['cl_lastpay_check_request_date']; if($getRawEndDate==''){ $coEndDateS=$prfDate; } else{ $coEndDateS=$rowB['cl_lastpay_check_request_date']; } // echo $getRawEndDate. "-".$getRawStartDate; $your_date = strtotime($getRawStartDate); $coEndDate = strtotime($coEndDateS); $datediff = $coEndDate - $your_date; $mandays = round($datediff / (60 * 60 * 24)); $sql = "INSERT INTO CL_TAT_Analysis (id,days) VALUES('','$mandays')"; $sqlQuery = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): " . mysql_error() . '.'); } $coFastA = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` ASC LIMIT 1"),0); if($coFastA < 0){ $coFast ==0; }else{ $coFast = $coFastA; } if($coFast > 1){$pluralText =' Days';}else{$pluralText =' Day';} $coAverage = mysql_result(mysql_query("SELECT AVG(`days`) FROM `CL_TAT_Analysis` WHERE `days`!='' AND `days`> 0"),0); $coSlow = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` DESC LIMIT 1"),0); echo number_format($coFast,1,'.',',')." ".$pluralText; echo" | "; echo "". number_format($coAverage,1,'.','')." Days | "; echo "". number_format($coSlow,1,'.','')." Days | "; echo "
CHECK RELEASING | "; echo "";
mysql_query("DROP TABLE IF EXISTS `CL_TAT_Analysis`");
$sql = "CREATE TABLE IF NOT EXISTS `CL_TAT_Analysis` (`id` int(11) NOT NULL AUTO_INCREMENT, `days` int(4) NOT NULL,PRIMARY KEY (`id`))";
$sqlResponse = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): ". mysql_error(). '.');
$getClearanceHead = mysql_query("SELECT * FROM`cl_clearance_header` WHERE `cl_h_hr_approval`!='DISAPPROVED' AND `cl_lastpay_check_request_date`!='' AND `cl_lastpay_check_created_date`!='' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate'");
while($rowB=mysql_fetch_array($getClearanceHead)){
$getRawStartDate =$rowB['cl_lastpay_check_request_date'];
$getRawEndDate =$rowB['cl_lastpay_check_created_date'];
if($getRawEndDate==''){
$coEndDateS=$prfDate;
} else{
$coEndDateS=$rowB['cl_lastpay_check_created_date'];
}
$your_date = strtotime($getRawStartDate);
$coEndDate = strtotime($coEndDateS);
$datediff = $coEndDate - $your_date;
$mandays = round($datediff / (60 * 60 * 24));
//echo $getRawStartDate. "-".$coEndDateS." - ".$mandays." "; $sql = "INSERT INTO CL_TAT_Analysis (id,days) VALUES('','$mandays')"; $sqlQuery = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): " . mysql_error() . '.'); } $coFastA = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` ASC LIMIT 1"),0); if($coFastA < 0){ $coFast ==0; }else{ $coFast = $coFastA; } if($coFast > 1){$pluralText =' Days';}else{$pluralText =' Day';} $coAverage = mysql_result(mysql_query("SELECT AVG(`days`) FROM `CL_TAT_Analysis` WHERE `days`!='' AND `days`> 0"),0); $coSlow = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` DESC LIMIT 1"),0); echo number_format($coFast,1,'.','')." ".$pluralText; echo" | ";
echo "". number_format($coAverage,1,'.','')." Days | "; echo "". number_format($coSlow,1,'.','')." Days | "; echo "
HR DOCUMENTATION AND RECORDING | "; echo "";
mysql_query("DROP TABLE IF EXISTS `CL_TAT_Analysis`");
$sql = "CREATE TABLE IF NOT EXISTS `CL_TAT_Analysis` (`id` int(11) NOT NULL AUTO_INCREMENT, `days` int(4) NOT NULL,PRIMARY KEY (`id`))";
$sqlResponse = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): ". mysql_error(). '.');
$getClearanceHead = mysql_query("SELECT * FROM`cl_clearance_header` WHERE `cl_h_hr_approval`!='DISAPPROVED' AND `cl_lastpay_check_created_date`!='' AND `cl_lastpay_documented_date`!='' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate'");
while($rowB=mysql_fetch_array($getClearanceHead)){
$getRawStartDate =$rowB['cl_lastpay_check_created_date'];
$getRawEndDate =$rowB['cl_lastpay_documented_date'];
if($getRawEndDate==''){
$coEndDateS=$prfDate;
} else{
$coEndDateS=$rowB['cl_lastpay_documented_date'];
}
$your_date = strtotime($getRawStartDate);
$coEndDate = strtotime($coEndDateS);
$datediff = $coEndDate - $your_date;
$mandays = round($datediff / (60 * 60 * 24));
//echo $getRawStartDate. "-".$coEndDateS." - ".$mandays." "; $sql = "INSERT INTO CL_TAT_Analysis (id,days) VALUES('','$mandays')"; $sqlQuery = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): " . mysql_error() . '.'); } //$coFast = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` ASC LIMIT 1"),0); $coFastA = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` ASC LIMIT 1"),0); if($coFastA < 0){ $coFast ==0; }else{ $coFast = $coFastA; } if($coFast > 1){$pluralText =' Days';}else{$pluralText =' Day';} $coAverage = mysql_result(mysql_query("SELECT AVG(`days`) FROM `CL_TAT_Analysis` WHERE `days`!='' AND `days`> 0"),0); $coSlow = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` DESC LIMIT 1"),0); echo number_format($coFast,1,'.','')." ".$pluralText; echo" | ";
echo "". number_format($coAverage,1,'.','')." Days | "; echo "". number_format($coSlow,1,'.','')." Days | "; echo "
SCHEDULED OF RELEASE TO EMPLOYEE | "; echo "";
mysql_query("DROP TABLE IF EXISTS `CL_TAT_Analysis`");
$sql = "CREATE TABLE IF NOT EXISTS `CL_TAT_Analysis` (`id` int(11) NOT NULL AUTO_INCREMENT, `days` int(4) NOT NULL,PRIMARY KEY (`id`))";
$sqlResponse = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): ". mysql_error(). '.');
$getClearanceHead = mysql_query("SELECT * FROM`cl_clearance_header` WHERE `cl_h_hr_approval`!='DISAPPROVED' AND `cl_lastpay_documented_date`!='' AND `cl_lastpay_schedule_date`!='' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate'");
while($rowB=mysql_fetch_array($getClearanceHead)){
$getRawStartDate =$rowB['cl_lastpay_documented_date'];
$getRawEndDate =$rowB['cl_lastpay_schedule_date'];
if($getRawEndDate==''){
$coEndDateS=$prfDate;
} else{
$coEndDateS=$rowB['cl_lastpay_schedule_date'];
}
$your_date = strtotime($getRawStartDate);
$coEndDate = strtotime($coEndDateS);
$datediff = $coEndDate - $your_date;
$mandays = round($datediff / (60 * 60 * 24));
//echo $getRawStartDate. "-".$coEndDateS." - ".$mandays." "; $sql = "INSERT INTO CL_TAT_Analysis (id,days) VALUES('','$mandays')"; $sqlQuery = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): " . mysql_error() . '.'); } $coFastA = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` ASC LIMIT 1"),0); if($coFastA < 0){ $coFast == 0; }else{ $coFast = $coFastA; } if($coFast > 1){$pluralText =' Days';}else{$pluralText =' Day';} $coAverage = mysql_result(mysql_query("SELECT AVG(`days`) FROM `CL_TAT_Analysis` WHERE `days`!='' AND `days` > 0"),0); $coSlow = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` DESC LIMIT 1"),0); echo number_format($coFast,1,'.','')." ".$pluralText; echo" | ";
echo "". number_format($coAverage,1,'.','')." Days | "; echo "". number_format($coSlow,1,'.','')." Days | "; echo "
DATE CLAIMED BY EMPLOYEE | "; echo "";
mysql_query("DROP TABLE IF EXISTS `CL_TAT_Analysis`");
$sql = "CREATE TABLE IF NOT EXISTS `CL_TAT_Analysis` (`id` int(11) NOT NULL AUTO_INCREMENT, `days` int(4) NOT NULL,PRIMARY KEY (`id`))";
$sqlResponse = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): ". mysql_error(). '.');
$getClearanceHead = mysql_query("SELECT * FROM`cl_clearance_header` WHERE `cl_h_hr_approval`!='DISAPPROVED' AND `cl_lastpay_schedule_date`!='' AND `cl_lastpay_schedule_date`!='' AND `cl_sla_start` BETWEEN '$sDate' AND '$eDate'");
while($rowB=mysql_fetch_array($getClearanceHead)){
$getRawStartDate =$rowB['cl_lastpay_schedule_date'];
$getRawEndDate =$rowB['cl_date_of_release'];
if($getRawEndDate==''){
$coEndDateS=$prfDate;
} else{
$coEndDateS=$rowB['cl_date_of_release'];
}
$your_date = strtotime($getRawStartDate);
$coEndDate = strtotime($coEndDateS);
$datediff = $coEndDate - $your_date;
$mandays = round($datediff / (60 * 60 * 24));
//echo $getRawStartDate. "-".$coEndDateS." - ".$mandays." "; $sql = "INSERT INTO CL_TAT_Analysis (id,days) VALUES('','$mandays')"; $sqlQuery = mysql_query($sql) or die("Couldn't perform query $sql (".__LINE__."): " . mysql_error() . '.'); } $coFastA = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` ASC LIMIT 1"),0); if($coFastA < 0){ $coFast ==0; }else{ $coFast = $coFastA; } if($coFast > 1){$pluralText =' Days';}else{$pluralText =' Day';} //$coAverageCount = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `CL_TAT_Analysis` WHERE `days`!='' AND `days`> 0"),0); $coAverage = mysql_result(mysql_query("SELECT AVG(`days`) FROM `CL_TAT_Analysis` WHERE `days`!='' AND `days`> 0"),0); //$coAverage = number_format(($coAverageSUM / $coAverageCount),1,'.',','); $coSlow = mysql_result(mysql_query("SELECT `days` FROM `CL_TAT_Analysis` WHERE `days`!='' ORDER BY `days` DESC LIMIT 1"),0); echo number_format($coFast,1,'.','')." ".$pluralText; echo" | ";
echo "". number_format($coAverage,1,'.','')." Days | "; echo "". number_format($coSlow,1,'.','')." Days | "; echo "
"; echo " |