format("Y-m-d"); $toTime =date('H:i:s'); $dateTime = $myDate . " ".$toTime; if(isset($_POST['done'])){ $clearanceIDc = mysql_escape_string($_POST['clearanceIDc']); $setNewDate = mysql_escape_string($_POST['dateOfRelease']); mysql_query("UPDATE `cl_clearance_header` SET `cl_h_hr_approval`='READY FOR RELEASE',`cl_date_of_release`='$setNewDate',`cl_lastpay_schedule_date`='$myDate',`cl_second_wave`='READY FOR RELEASE' WHERE `h_id`='$clearanceIDc'"); //########################################################################## // SEND SMS TO PAYROLL/ACCOUNTING OFFICER FOR PREPARATION OF CHECK========================================================= // SEND SMS TO PAYROLL/ACCOUNTING OFFICER FOR PREPARATION OF CHECK========================================================= //########################################################################## $templateID = mysql_result(mysql_query("SELECT `cl_h_template_id` FROM `cl_clearance_header` WHERE `h_id`='$clearanceIDc'"),0); $CLempID = mysql_result(mysql_query("SELECT `cl_h_emp_id` FROM `cl_clearance_header` WHERE `h_id`='$clearanceIDc'"),0); $HRempID = mysql_result(mysql_query("SELECT `cl_hr_approval_id` FROM `cl_template_name` WHERE `id`='$templateID'"),0); $MyAPIcode = mysql_result(mysql_query("SELECT `SMSAPICode` FROM `asa_versioning_db` WHERE `type`='Live'"),0); $MyPasswd = mysql_result(mysql_query("SELECT `SMSAPIPass` FROM `asa_versioning_db` WHERE `type`='Live'"),0); $empMobile = mysql_result(mysql_query("SELECT `usr_mobile` FROM `vts_users` WHERE `u_id`='$CLempID'"),0); $HRMobile = mysql_result(mysql_query("SELECT `usr_mobile` FROM `vts_users` WHERE `u_id`='$CLempID'"),0); $empUFname = mysql_result(mysql_query("SELECT `u_fname` FROM `vts_users` WHERE `u_id`='$CLempID'"),0); $empULname = mysql_result(mysql_query("SELECT `u_lname` FROM `vts_users` WHERE `u_id`='$CLempID'"),0); $SMSMessage = "Hi ".$empUFname."! Your last pay check will be released on ".$setNewDate.". Please call us to confirm the release time of your FINAL PAY. Thank you!"; $hrSMSMessage = "Release of ". $empUFname." ".$empULname."'s clearance form and last pay has been re-cheduled by Legal on ".$setNewDate.". Thank you!"; $result = itexmo($empMobile, $SMSMessage,$MyAPIcode, $MyPasswd); $result = itexmo($HRMobile, $hrSMSMessage,$MyAPIcode, $MyPasswd); if ($result == ""){ echo ''; }else if ($result == 0){ } else{ echo "Error Num ". $result . " was encountered!"; } //########################################################################## //########################################################################## //########################################################################## //########################################################################## $sendmailFname = mysql_result(mysql_query("SELECT `u_fname` FROM `vts_users` WHERE `u_id`='$CLempID'"),0); $sendmailuLname = mysql_result(mysql_query("SELECT `u_lname` FROM `vts_users` WHERE `u_id`='$CLempID'"),0); $uEmail = mysql_result(mysql_query("SELECT `email` FROM `vts_users` WHERE `u_id`='$CLempID'"),0); $getRegisteredName =$sendmailFname; $from = "support@autohubgroup.com"; $to = $uEmail; $subject = "AHG CLEARANCE FORM"; $msgBox = "Hi ".$getRegisteredName."! Your clearance Form together with your last paycheck will be released on ".$setNewDate.".. Support Group"; $headers = "From:" . $from; mail($to,$subject,$msgBox, $headers); //########################################################################## //########################################################################## echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $getActiveClearance = mysql_query("SELECT * FROM `cl_clearance_header` WHERE `cl_h_hr_approval`='READY FOR RELEASE' AND `cl_h_comp_id` = '$compID'ORDER BY `cl_h_date_created` DESC"); while($row=mysql_fetch_array($getActiveClearance)){ $hDI = $row['h_id']; $chkComments = mysql_result(mysql_query("SELECT COUNT(f_id) FROM `cl_final_pay_comments` WHERE `cl_id`='$hDI'"),0); $uID = $row['cl_h_emp_id']; $pID = $row['cl_emp_position']; //START OF SLA CODE $olddate = $row['cl_sla_start']; $endDate = $row['cl_sla_end']; if($endDate != ""){ $myEndDate = strtotime($endDate); }else{ $myEndDate = time(); } $your_date = strtotime($olddate); $datediff = $myEndDate - $your_date; $totalCount = round($datediff / (60 * 60 * 24)); if($totalCount == 1){ $MyDay="Day"; }else{ $MyDay="Days"; } if($totalCount < 15 ){ $color = '#06561c'; } if($totalCount > 14 && $totalCount < 25 ){ $color = '#cb5f04'; } if($totalCount > 24 ){ $color = '#f50732 '; } //END OF SLA CODE $uFName=mysql_result(mysql_query("SELECT `u_fname` FROM `vts_users` WHERE `u_id`='$uID'"),0); $uLName=mysql_result(mysql_query("SELECT `u_lname` FROM `vts_users` WHERE `u_id`='$uID'"),0); $uEMPID=mysql_result(mysql_query("SELECT `employee_id` FROM `vts_users` WHERE `u_id`='$uID'"),0); $uPosition=mysql_result(mysql_query("SELECT `position_title` FROM `db_positions` WHERE `pid`='$pID'"),0); $count = $count + 1; ?>".strtoupper($row['h_id']).""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $compRate=0; } echo "
TRANS ID.EMP. ID.EMPLOYEE NAMEPOSITIONCREATEDCLEAREDAPPROVEDSTATUSSLA RATINGFINAL PAY PROGRESSALERT
".strtoupper($uEMPID)."".strtoupper($uLName).", ".strtoupper($uFName)."".strtoupper($uPosition)."".strtoupper($row['cl_h_date_created'])."".strtoupper($row['signatory_completion_date']).""; $apprDate = $row['cl_approver_id_timestamp']; $exAprDate = explode(" ",$apprDate); echo $exAprDate[0]; echo"".strtoupper($row['cl_second_wave']).""; $chkSLA = 30 - $totalCount; if($chkSLA < 0 ){ $consumedSLA = number_format((($chkSLA / 30) * 100),2); if($consumedSLA < -100){ $mySLA = '0.00%'; }else{ $mySLA = (100 + $consumedSLA)."%"; } }else{ $mySLA = '100%'; } echo "".$totalCount ." ".$MyDay." | Rating:(" .$mySLA.")"; echo""; $snWave = $row['cl_second_wave']; switch($snWave){ case 'LAST PAY COMPUTATION': // echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; break; case 'LAST PAY APPROVAL': echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; break; case 'CHECK PREPARATION': echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; break; case 'CHECK RELEASING': echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; break; case 'DOCUMENTS PREPARATION': echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; break; case 'SCHEDULE OF RELEASE': echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; break; case 'READY FOR RELEASE': echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; break; } echo""; if($chkComments > 0){ echo ""; }else{ echo ""; } echo"
"; echo ""; exit(); } ?>