Update has been saved.

"; $message = "Hi ".$sendersFname."! New update sent. ".$notes." Please check your e-mail for updates or, you may login to our portal at http://www.autohub.ph/portal for real-time updates of your request. If you do not have an account yet, please visit the site and click Register. Thank you. Autohub Support Group"; mail($sendersEmail, 'NEW TICKET CREATED', $message, 'From: support@autohubgroup.com'); } } if(isset($_POST['CloseGrabTicket'])){ $ticketIDA=$_POST['ticketIDA']; $curStatus=$_POST['requestCategory']; $sendersID = mysql_result(mysql_query("SELECT `emp_id` FROM `pms_tickets` WHERE `ticket_id`='$ticketIDA'"),0); $sendersFname = mysql_result(mysql_query("SELECT `u_fname` FROM `c_users` WHERE `u_id`='$sendersID'"),0); $sendersEmail = mysql_result(mysql_query("SELECT `email` FROM `c_users` WHERE `emp_id`='$sendersID'"),0); $notes=$_POST['notes']; $promiseDate = mysql_result(mysql_query("SELECT `promise_date` FROM `pms_tickets` WHERE `id`='$ticketIDA'"),0); $promiseTime = mysql_result(mysql_query("SELECT `promise_time` FROM `pms_tickets` WHERE `id`='$ticketIDA'"),0); $closedDate = $toDate; $closedTime = $currentTime; $TotalPromiseDate = strtotime($promiseDate." ".$promiseTime); $closingTime = strtotime($closedDate." ".$closedTime); $sla = $TotalPromiseDate - $closingTime; $totalSLA = $sla / 60; $notes=mysql_real_escape_string($notes); $lastUpdate = "Ticket has been closed (".$notes.")"; mysql_query("UPDATE `pms_tickets` SET `ticket_sla`='$totalSLA',`current_status`='CLOSED', `last_update`='$toDate', `last_update_time`='$currentTime',`date_closed`='$toDate',`time_closed`='$currentTime', `closed_by`='$myEMPID' WHERE `id`='$ticketIDA'"); $sql="INSERT INTO `pms_ticket_updates` (`id`,`ticket_id`,`update_by`,`updates`,`date`,`time`,`kb`) VALUES('','$ticketIDA','$myEMPID','$lastUpdate','$toDate','$currentTime','true')"; if(!mysql_query($sql)){ die('Error: ' . mysql_error()); }else{ echo "

Ticket has been successfully closed. Thank you!

"; $message = "Hi ".$sendersFname."! This is to inform you that your request has been closed by ".$uFname." on ".$toDate." at ".$currentTime.". Please check if this issue has been resolved or not. You can always send your ratings through our portal on how the support group attended to your request. Please login to our portal at http://www.autohub.ph/portal to send your rating. If you do not have an account yet, please visit the site and click Register. Thank you. Autohub Support Group"; mail($sendersEmail, 'NEW TICKET CREATED', $message, 'From: support@autohubgroup.com'); } } if(isset($_GET['update'])){ $ticketID = $_GET['id']; echo "
"; echo ""; echo "
"; echo "

UPDATE TICKET

"; $ticketDesc = mysql_result(mysql_query("SELECT `concerns` FROM `pms_tickets` WHERE `id`='$ticketID'"),0); echo "

SUPPORT REQUEST DESCRIPTION

"; echo "
".$ticketDesc. "
"; echo "
"; echo " ACTION TAKEN: (Knowledge Based Data):

"; echo "
UPDATE STATUS:
"; echo "
"; echo "
"; echo ""; echo ""; echo " "; echo "
"; echo"
"; echo "
"; } if(isset($_GET['notes'])){ $ticketID = $_GET['id']; echo "
"; echo "

UPDATE HISTORY

"; echo "

"; $qq = mysql_query("SELECT * FROM `pms_ticket_updates` WHERE `ticket_id`='$ticketID'"); while($row = mysql_fetch_array($qq)){ $byUser = $row['update_by']; $byFname = mysql_result(mysql_query("SELECT `u_fname` FROM `c_users` WHERE `emp_id`='$byUser'"),0); echo "

Last Update:
"; echo $row['updates'] ."
By: ".$byFname." | Date/Time: " .$row['date'] . " ".$row['time']; echo "

"; } echo "
"; echo "
"; echo "
"; } //echo "MY ID". $myEMPID; echo "

OPEN TICKET - ASSIGNED

"; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $qq = mysql_query("SELECT * FROM `pms_tickets` WHERE `current_status`!='CLOSED' AND `routed_to`='$myEMPID' ORDER BY `id` DESC"); while ($row=mysql_fetch_array($qq)){ $count ++; //========= date_default_timezone_set('Asia/Singapore'); //GET CURRENT DATE TIME $currentDate = date("m/d/Y H:i:s"); $currentDate_timestamp = strtotime($currentDate); //DATE TIME TICKET WAS STARTED $startDateTime = $row['date_routed']. " " .$row['time_routed']; $startDateTimeStamp = strtotime($startDateTime); //GET PROMISE DATA TIME $SLA = $row['promise_date'] . " " . $row['promise_time']; $promise_timestamp = strtotime($SLA); //MAX SLA $maxSLA = ($promise_timestamp - $startDateTimeStamp) / 60; $slaRemaining = $promise_timestamp - $currentDate_timestamp; // IN SECOND $slaInMinutes = $slaRemaining / 60; $timeConsumed = $maxSLA - $slaInMinutes; //SET BAR VALUE $maxW = (($promise_timestamp - $startDateTimeStamp) / 60 ) / $maxSLA * 100; // MAX WIDTH $progress = $timeConsumed / $maxSLA * 100; if($progress > 100 AND $row['current_status']!='CLOSED'){ $currentGradient='orangeGradient'; $value='100'; }else { $currentGradient='titleBlue'; $value=$progress; } $value = number_format($value,2,'.',','); //$progress = number_format(($timeConsumed / $maxSLA * 100),2,'.',','); //========= echo ""; if($progress >100){ echo ""; $progress = number_format(($timeConsumed / $maxSLA * 100),2,'.',','); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
NO.TICKET NO.DATE SENT.DESCRIPTIONSUPPORT IDSTATUSSLA
"; echo "OVERDUE"; }else{ echo ""; echo $value." %"; } echo "".$row['ticket_id']."".$row['date_sent']."".substr($row['concerns'],0,110)."    Read More...".$row['routed_to']."".$row['current_status']."".$row['promise_time']." Comments | Update
"; //$endDateTime = strtotime("+".$addTime." Minutes", $currentDate_timestamp); echo "
".$value."
"; echo "
"; echo "
"; ?>