echo "\$(document).ready(function(){"; echo "\$('#emp').dataTable({"; echo "\"pagingType\": \"full_numbers\""; echo "})"; echo "});"; echo "</script>"; echo "<link rel='stylesheet' type='text/css' href='css/jquery.dataTables.css'>"; echo "<table class='table table-bordered table-hover' id='emp'>"; echo "<thead>"; echo "<tr>"; echo "<th>Employee Number</th>"; echo "<th>Last Name</th>"; echo "<th>First Name</th>"; echo "<th>Middle Name</th>"; echo "</tr>"; echo "</thead>"; $query = "SELECT empNum, LastName, FirstName, MiddleName FROM employeemasterfile.employee" or die("Error. " . mysqli_error($link)); $result = conString($query); echo "<tbody>"; while ($rows = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td><a href='employeemanagement.php?view=true&empNum={$rows['0']}' title='Click for more info'>{$rows['0']}</a></td>"; echo "<td><a href='employeemanagement.php?view=true&empNum={$rows['0']}' title='Click for more info'>{$rows['1']}</a></td>"; echo "<td><a href='employeemanagement.php?view=true&empNum={$rows['0']}' title='Click for more info'>{$rows['2']}</a></td>"; echo "<td><a href='employeemanagement.php?view=true&empNum={$rows['0']}' title='Click for more info'>{$rows['3']}</a></td>"; echo "</tr>"; } echo "</tbody>"; echo "</table>"; } }
echo "</td>"; echo "</tr>"; } echo "</table>"; echo "<input type='hidden' value='" . $_GET['ot'] . "' name='num'>"; } else { if ($type == 4) { if ($_SESSION['posCode'] == '0003') { $query = "SELECT utNum, empNum, dateIssued, dateAb, timeout, status, reason, remarks, deptapproval FROM utrequest WHERE utNum ='" . $_GET['ut'] . "';" or die(mysqli_error($link)); } else { $query = "SELECT utNum, empNum, dateIssued, dateAb, timeout, status, reason, remarks, hrapproval FROM utrequest WHERE utNum ='" . $_GET['ut'] . "';" or die(mysqli_error($link)); } $result = conString($query); $rows = mysqli_fetch_array($result); $name = "SELECT LastName, FirstName FROM employee WHERE empNum ='" . $rows[1] . "';" or die(mysqli_error($link)); $res = conString($name); $name = mysqli_fetch_array($res); echo "<form action='func/processUT.php' method='POST'>"; echo "<table class='table table-bordered table-hover'>"; echo "<tr>"; echo "<td>Undertime Number</td>"; echo "<td>" . $rows[0] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>Name</td>"; echo "<td>" . $name[0] . ", " . $name[1] . "</td>"; echo "</tr>"; $rows[2] = dateFormat($rows[2]); echo "<tr>"; echo "<td>Date Issued</td>"; echo "<td>" . $rows[2] . "</td>";
$query = "UPDATE employeelogs SET ut='" . $compMin . "', timeout='" . $time . "' WHERE employeeNumber='" . $empNum . "' AND workDate='" . $date . "';" or die(mysqli_error($link)); conString($query); } else { echo "<br>"; echo "Please Apply for an Undertime Request first before going out of the company's premises."; } } else { if ($hour > 17) { $query = "SELECT status, numhours FROM otrequest WHERE status='approved' AND dateOT ='" . $date . "' AND empNum='" . $empNum . "';" or die(mysqli_error($link)); $result = conString($query); $rows = mysqli_num_rows($result); if ($rows[0] != 0) { $rows = mysqli_fetch_array($result); $compHour = ($hour - 17) * 60; $compMin = $min + $compHour; $numhours *= 60; if ($numhours <= $compMin) { $compMin = $numhours; } $query = "UPDATE employeelogs SET ot='" . $compMin . "', timeout='" . $time . "' WHERE employeeNumber='" . $empNum . "' AND workDate='" . $date . "';" or die(mysqli_error($link)); conString($query); } else { $query = "UPDATE employeelogs set timeout='" . $time . "' WHERE employeeNumber='" . $empNum . "' AND workDate='" . $date . "';" or die(mysqli_error($link)); } } } } } } } }
function getName() { $query = "SELECT LastName, FirstName FROM employee WHERE empNum='" . $_SESSION['empNum'] . "';" or die(mysqli_error($link)); $result = conString($query); $rows = mysqli_fetch_array($result); return $rows[0] . ", " . $rows[1]; }