Exemplo n.º 1
0
function displayUpdateProfile($config)
{
    //Get pass search results
    //var_dump($_POST); //DEBUG
    $foundUserFNAME = '';
    $foundUserLNAME = '';
    $foundUserName = '';
    $foundUserID = $_SESSION['userIDnum'];
    $totalRows = isset($_POST['totalRows']) ? $_POST['totalRows'] : 0;
    if ($totalRows > 0) {
        //get post info providied from search results
        for ($i = 0; $i <= $totalRows; $i++) {
            if (isset($_POST['foundUser' . $i])) {
                $foundUserID = $_POST['foundUserID' . $i];
                break;
            }
            //end if
        }
        //end for
    }
    //end If Nothing passed
    $mysqli = $config->mysqli;
    if (isset($_POST['updateBtn'])) {
        $fname = isset($_POST['fname']) ? $mysqli->real_escape_string(strtoupper($_POST['fname'])) : false;
        $lname = isset($_POST['lname']) ? $mysqli->real_escape_string(strtoupper($_POST['lname'])) : false;
        $rankID = isset($_POST['rankID']) ? $mysqli->real_escape_string($_POST['rankID']) : '';
        $divisionID = isset($_POST['divisionID']) ? $mysqli->real_escape_string($_POST['divisionID']) : false;
        $assignID = isset($_POST['assignID']) ? $mysqli->real_escape_string($_POST['assignID']) : false;
        $supvID = isset($_POST['supvID']) ? $mysqli->real_escape_string($_POST['supvID']) : false;
        $hireDate = isset($_POST['hireDate']) ? $mysqli->real_escape_string($_POST['hireDate']) : false;
        $radioID = isset($_POST['radioID']) ? $mysqli->real_escape_string($_POST['radioID']) : false;
        $munisID = isset($_POST['munisID']) ? $mysqli->real_escape_string($_POST['munisID']) : false;
        $userID = isset($_POST['userID']) ? $mysqli->real_escape_string($_POST['userID']) : false;
        $address = isset($_POST['address']) ? $mysqli->real_escape_string($_POST['address']) : false;
        $hphone = isset($_POST['hphone']) ? $mysqli->real_escape_string($_POST['hphone']) : false;
        $cphone = isset($_POST['cphone']) ? $mysqli->real_escape_string($_POST['cphone']) : false;
        $wphone = isset($_POST['wphone']) ? $mysqli->real_escape_string($_POST['wphone']) : false;
        $dob = isset($_POST['dob']) ? $mysqli->real_escape_string($_POST['dob']) : false;
        $emergency = isset($_POST['emergency']) ? $mysqli->real_escape_string($_POST['emergency']) : false;
        $postAminLvl = isset($_POST['adminLvl']) ? $mysqli->real_escape_string($_POST['adminLvl']) : "0";
        $email = isset($_POST['empEmail']) ? $mysqli->real_escape_string($_POST['empEmail']) : false;
        if ($config->adminLvl >= 50) {
            $myq = "UPDATE `EMPLOYEE` SET \n                `MUNIS` = '" . $munisID . "',\n                `LNAME` = '" . $lname . "',\n                `FNAME` = '" . $fname . "',\n                `GRADE` = '" . $rankID . "',\n                `DIVISIONID` = '" . $divisionID . "',\n                `SUPV` = '" . $supvID . "',\n                `ASSIGN` = '" . $assignID . "',\n                `TIS` = '" . Date('Y-m-d', strtotime($hireDate)) . "',    \n                `RADIO` = '" . $radioID . "',\n                ADDRESS = '" . $address . "',\n                HOMEPH = '" . $hphone . "',\n                CELLPH = '" . $cphone . "',\n                WORKPH = '" . $wphone . "',\n                EMAIL = '" . $email . "',\n                DOB = '" . Date('Y-m-d', strtotime($dob)) . "',\n                EMERGCON = '" . $emergency . "',\n                ADMINLVL = '" . $postAminLvl . "',\n                IS_VERIFY = 1,\n                AUDITID = '" . $_SESSION['userIDnum'] . "',\n                AUDIT_TIME = NOW(),\n                AUDIT_IP = INET_ATON('" . $_SERVER['REMOTE_ADDR'] . "')\n                WHERE IDNUM = '" . $userID . "'";
        } else {
            $myq = "UPDATE `EMPLOYEE` SET \n                `MUNIS` = '" . $munisID . "',\n                `LNAME` = '" . $lname . "',\n                `FNAME` = '" . $fname . "',\n                `GRADE` = '" . $rankID . "',\n                `DIVISIONID` = '" . $divisionID . "',\n                `SUPV` = '" . $supvID . "',\n                `ASSIGN` = '" . $assignID . "',                                                           \n                AUDITID = '" . $_SESSION['userIDnum'] . "',\n                AUDIT_TIME = NOW(),\n                AUDIT_IP = INET_ATON('" . $_SERVER['REMOTE_ADDR'] . "')\n                WHERE IDNUM = '" . $userID . "'";
        }
        //popUpMessage($myq); //DEBUG
        //Perform SQL Query
        $result = $mysqli->query($myq);
        //show SQL error msg if query failed
        if (!SQLerrorCatch($mysqli, $result)) {
            echo "Successfully Updated Profile<br />";
        } else {
            echo "Did not Update<br />";
        }
        $fromVerify = strcmp(isset($_POST['formName']) ? $_POST['formName'] : false, "userVerify") == 0 ? true : false;
        if ($fromVerify) {
            echo '<form method="POST"><input type="button" name="backToVerify" value="Back To Users To Verify List" onClick="this.form.action=' . "'?userVerify=true'" . ';this.form.submit()" /></form>';
        }
    } else {
        //Get stored information (first view)
        $sql_user = strtoupper($mysqli->real_escape_string($foundUserID));
        $myq = "SELECT * FROM EMPLOYEE WHERE IDNUM=" . $foundUserID;
        $result = $mysqli->query($myq);
        //show SQL error msg if query failed
        if (!$result) {
            throw new Exception("Database Error [{$mysqli->errno}] {$mysqli->error}");
        }
        //no loop, should be exactly one result
        $resultAssoc = $result->fetch_assoc();
        $fname = $resultAssoc['FNAME'];
        $lname = $resultAssoc['LNAME'];
        $rankID = $resultAssoc['GRADE'];
        $divisionID = $resultAssoc['DIVISIONID'];
        $assignID = $resultAssoc['ASSIGN'];
        $supvID = $resultAssoc['SUPV'];
        $hireDate = $resultAssoc['TIS'];
        $radioID = $resultAssoc['RADIO'];
        $munisID = $resultAssoc['MUNIS'];
        $address = $resultAssoc['ADDRESS'];
        $hphone = $resultAssoc['HOMEPH'];
        $cphone = $resultAssoc['CELLPH'];
        $wphone = $resultAssoc['WORKPH'];
        $email = $resultAssoc['EMAIL'];
        $dob = $resultAssoc['DOB'];
        $emergency = $resultAssoc['EMERGCON'];
        $adminLvl = $resultAssoc['ADMINLVL'];
        $username = strtoupper($_SESSION['userName']);
        ?>
        <form name="update" method="post" action="<?php 
        echo $_SERVER['REQUEST_URI'];
        ?>
">
        <input type="hidden" name="formName" value="updateProfile" />
        <?php 
        //how does this double overloaded call work!!!!
        $fromVerify = strcmp(isset($_POST['formName']) ? $_POST['formName'] : false, "userVerify") == 0 ? true : false;
        if ($fromVerify) {
            echo '<input type="button" name="backToVerify" value="Back To Users To Verify List" onClick="this.form.action=' . "'?userVerify=true'" . ';this.form.submit()" />
                    <input type="hidden" name="formName" value="userVerify" />';
        }
        ?>
        </div><div align="center" class="login">
            <table>
        <?php 
        if ($_SESSION['admin'] >= 25) {
            echo "<tr><td>User: </td><td>";
            if ($totalRows > 0) {
                echo $lname . ', ' . $fname . ' ';
                echo '<input type="hidden" name="userID" value="' . $foundUserID . '" />';
                echo '<input type="hidden" name="totalRows" value="1" />';
                echo '<input type="hidden" name="foundUserName1" value="' . $foundUserID . '" />';
            } else {
                echo $_SESSION['userName'] . "  ";
                echo '<input type="hidden" name="userID" value="' . $_SESSION['userIDnum'] . '" />';
            }
            displayUserLookup($config);
            echo '<input type="hidden" name="searchReserves" value="false" />';
            echo '</td></tr>';
        } else {
            ?>
                         
            <h3>Username: <?php 
            echo $username;
            ?>
</h3>
            <input type="hidden" name="userID" value="<?php 
            echo $foundUserID;
            ?>
" />
            <?php 
        }
        ?>
                
                    <tr><td>First Name: </td><td><input name="fname" type="text" <?php 
        if (!$fname) {
            showInputBoxError();
        } else {
            echo 'value="' . $fname . '"';
        }
        ?>
 /></td></tr>
                    <tr><td>Last Name: </td><td><input name="lname" type="text" <?php 
        if (!$lname) {
            showInputBoxError();
        } else {
            echo 'value="' . $lname . '"';
        }
        ?>
 /></td></tr>
                    <?php 
        echo "<tr><td>Division:</td><td>";
        displayDivisionID("divisionID", $divisionID);
        echo "</td></tr>";
        echo "<tr><td>Supervisor:</td><td>";
        displaySUPVDropDown("supvID", $supvID);
        echo "</td></tr>";
        //Payrate dependent
        if ($config->adminLvl >= 50) {
            echo "<tr><td>Rank:</td><td>";
            displayRanks("rankID", $rankID);
            echo "</td></tr>";
            echo "<tr><td>Assigned Shift:</td><td>";
            displayAssign("assignID", $assignID);
            echo "</td></tr>";
            ?>
                        <tr><td>MUNIS ID: </td><td><input name="munisID" type="text" <?php 
            if (!$munisID) {
                showInputBoxError();
            } else {
                echo 'value="' . $munisID . '"';
            }
            ?>
 /></td></tr>
                        <?php 
        } else {
            ?>
                        <input type="hidden" name="rankID" value="<?php 
            echo $rankID;
            ?>
" />
                        <input type="hidden" name="assignID" value="<?php 
            echo $assignID;
            ?>
" />
                        <input type="hidden" name="munisID" value="<?php 
            echo $munisID;
            ?>
" />
                        <?php 
        }
        if ($config->adminLvl >= 50) {
            ?>
                        <tr><td>Hire Date: </td><td><?php 
            displayDateSelect("hireDate", "date_1", $hireDate, $required = true);
            ?>
</td></tr>
                        <tr><td>Radio Number: </td><td><input name="radioID" type="text" <?php 
            if (!$radioID) {
                showInputBoxError();
            } else {
                echo 'value="' . $radioID . '"';
            }
            ?>
 /></td></tr>
                        <tr><td >Address: </td><td><textarea rows="3" cols="40" name="address" <?php 
            if (!$address) {
                showInputBoxError();
            }
            ?>
 ><?php 
            echo $address;
            ?>
</textarea></td></tr>
                        <tr><td>Home Phone: </td><td><input name="hphone" type="text" <?php 
            if (!$hphone && !$cphone && !$wphone) {
                showInputBoxError();
            } else {
                echo 'value="' . $hphone . '"';
            }
            ?>
 /></td></tr>
                        <tr><td>Cell Phone: </td><td><input name="cphone" type="text" <?php 
            if (!$hphone && !$cphone && !$wphone) {
                showInputBoxError();
            } else {
                echo 'value="' . $cphone . '"';
            }
            ?>
 /></td></tr>
                        <tr><td>Work Phone: </td><td><input name="wphone" type="text" <?php 
            if (!$hphone && !$cphone && !$wphone) {
                showInputBoxError();
            } else {
                echo 'value="' . $wphone . '"';
            }
            ?>
 /></td></tr>
                        <tr><td>Email: </td><td><input size="40" name="empEmail" type="text" <?php 
            if (!$email) {
                showInputBoxError();
            } else {
                echo 'value="' . $email . '"';
            }
            ?>
 /></td></tr>
                        <tr><td>Date of Birth: </td><td><?php 
            displayDateSelect("dob", "date_2", $dob, $required = true);
            ?>
</td></tr>

                        <tr><td>Emergency Contact: </td><td><textarea rows="2" cols="40" name="emergency" <?php 
            if (!$emergency) {
                showInputBoxError();
            }
            ?>
 ><?php 
            echo $emergency;
            ?>
</textarea></td></tr>
                        <tr><td>Admin Level:</td><td><?php 
            selectAdminLevel($config, $adminLvl);
            ?>
</td></tr>
                        <tr><td></td><td><input type="submit" name="updateBtn" value="Update Profile" /></td></tr>
                        <?php 
        } else {
            ?>
<tr><td>Hire Date: </td><td><?php 
            echo $hireDate;
            ?>
</td></tr>
                        <tr><td>Radio Number: </td><td> <?php 
            echo $radioID;
            ?>
 </td></tr>
                        <tr><td>Address: </td><td> <?php 
            echo $address;
            ?>
 </td></tr>
                        <tr><td>Home Phone: </td><td> <?php 
            echo $hphone;
            ?>
 </td></tr>
                        <tr><td>Cell Phone: </td><td> <?php 
            echo $cphone;
            ?>
 </td></tr>
                        <tr><td>Work Phone: </td><td> <?php 
            echo $wphone;
            ?>
 </td></tr>
                         <tr><td>Email: </td><td><?php 
            echo $email;
            ?>
</td></tr>
                        <tr><td>Date of Birth: </td><td><?php 
            echo $dob;
            ?>
</td></tr>

                        <tr><td>Emergency Contact: </td><td> <?php 
            echo $emergency;
            ?>
 </td></tr> 

                        <tr><td></td><td><?php 
            if ($_SESSION['userIDnum'] == $foundUserID || $config->adminLvl >= 25) {
                echo '<input type="submit" name="updateBtn" value="Update Profile" />';
            }
            ?>
</td></tr>
                        <?php 
        }
        ?>
                </table>
            </div><div class="clear"></div>
        </form>
        <div class="divider"></div>
        
    <?php 
    }
}
Exemplo n.º 2
0
function displayRadioLog($config, $isApprovePage = false)
{
    if ($config->adminLvl >= 0) {
        $mysqli = $config->mysqli;
        if ($isApprovePage) {
            echo '<h2>Daily Inventory Checkout Log Approval</h2>';
        } else {
            echo '<h2>Daily Inventory Checkout Log</h2>
                ';
        }
        echo '<form name="radioLog" method="POST">
            <input type="hidden" name="formName" value="radioLog" />';
        //Get variables
        $dateSelect = isset($_POST['dateSelect']) ? $_POST['dateSelect'] : false;
        $changeDateBtn = isset($_POST['changeDate']) ? True : false;
        $editSelect = isset($_POST['editRows']) ? $_POST['editRows'] : false;
        $addBtn = isset($_POST['addBtn']) ? True : false;
        $checkoutKeyBtn = isset($_POST['checkoutKeyBtn']) ? True : false;
        $editBtn = isset($_POST['editBtn']) ? True : false;
        $radioLogID = isset($_POST['radioLogID']) ? $_POST['radioLogID'] : false;
        $keyLogID = isset($_POST['keyLogID']) ? $_POST['keyLogID'] : false;
        $finalRows = isset($_POST['finalRows']) ? $_POST['finalRows'] : false;
        $checkInKey = isset($_POST['checkInKey']) ? true : false;
        $updateRadioLog = isset($_POST['updateRadioLog']) ? true : false;
        $updateKeyLog = isset($_POST['updateKeyLog']) ? true : false;
        $showAll = isset($_POST['showAllPerm']) ? true : false;
        $showAll = isset($_POST['showAllLoaner']) ? true : $showAll;
        $showAll = isset($_POST['showAllShift']) ? true : $showAll;
        $showNormal = isset($_POST['showNormal']) ? true : false;
        $goBtn = isset($_POST['goBtn']) ? true : false;
        $isApprovePage = isset($_GET['secApprove']) ? true : $isApprovePage;
        $totalRows = isset($_POST['totalRows']) ? $_POST['totalRows'] : 0;
        $radioLogID = isset($_POST['backToApprove']) ? false : $radioLogID;
        $exchangeLogID = isset($_POST['exchangeLogID']) ? $_POST['exchangeLogID'] : false;
        $itemLogType = '';
        $filters = '';
        $cancelBtn = isset($_POST['cancelBtn']) ? true : false;
        $divID = isset($_POST['divisionID']) ? $_POST['divisionID'] : false;
        $counter = 0;
        if ($checkoutKeyBtn) {
            $addBtn = false;
        }
        if ($checkoutKeyBtn && $goBtn) {
            $checkoutKeyBtn = FALSE;
        }
        if ($showAll || $showNormal) {
            $goBtn = true;
        }
        if ($changeDateBtn) {
            $dateSelect = false;
            $editSelect = false;
            $goBtn = false;
            $addBtn = false;
        }
        if ($cancelBtn) {
            $goBtn = true;
            $exchangeLogID = '';
        }
        $exchangeBtnINV = false;
        for ($i = 1; $i <= $totalRows; $i++) {
            if (isset($_POST['exchangeBtnINV' . $i])) {
                $exchangeLogID = $_POST['refNum' . $i];
                $finalRows = 0;
                $checkoutKeyBtn = false;
                $exchangeBtnINV = true;
                $_POST['num_deputies'] = 0;
                break;
            }
            if (isset($_POST['carDetails' . $i])) {
                showItemDetails($config, $_POST['itemID' . $i]);
                if (isset($keyLogID) && !empty($keyLogID)) {
                    $editBtn = true;
                    $radioLogID = $keyLogID;
                }
                break;
            }
        }
        if (!$isApprovePage && (!isset($_POST['exchangeLogID']) || !$exchangeBtnINV)) {
            if (!$changeDateBtn && !$dateSelect) {
                //default to today's date
                $dateSelect = date('m/d/Y');
                $goBtn = true;
            }
            if (!$dateSelect) {
                echo 'Select Date: ';
                displayDateSelect("dateSelect", "dateSel", false, false, true, true);
                echo '<input id="goBtn" type=submit name="goBtn" value="Go" /><br />';
            } else {
                echo '<h3>Date: ' . $dateSelect . '';
                echo '<input type="hidden" name="dateSelect" value="' . $dateSelect . '" />
                        <input type="submit" name="changeDate" value="Change Date" /> 
                        <input type="submit" name="checkoutKeyBtn" value="Checkout Items" /></h3>';
                if (!$checkoutKeyBtn) {
                    $goBtn = true;
                }
            }
        } else {
            echo '<input type="hidden" name="dateSelect" value="' . $dateSelect . '" />';
        }
        if (isset($_POST['exchangeLogID'])) {
            $addBtn = false;
        }
        if ($addBtn) {
            //showRadioLogDetails($config, $radioLogID);
        }
        if ($checkoutKeyBtn || $addBtn) {
            showKeyLogDetails($config, $keyLogID, false, false, $divID);
            $goBtn = false;
        }
        if ($exchangeLogID) {
            showItemExchange($config, $exchangeLogID);
            $editBtn = false;
            $goBtn = false;
        }
        //get group update or logout
        if ($finalRows > 0) {
            $approveBtn = array();
            $foundEditBtn = false;
            for ($i = 1; $i <= $finalRows; $i++) {
                if (isset($_POST['radioLogEditBtn' . $i])) {
                    $radioLogID = $_POST['radioLogID' . $i];
                    $itemLogType = $_POST['itemLogType' . $i];
                    $foundEditBtn = true;
                    $goBtn = false;
                }
                if (isset($_POST['logoutRadioLog' . $i]) || isset($_POST['logoutRadioLogAll']) || isset($_POST['checkInRadio' . $i])) {
                    $radioLogID = $_POST['radioLogID' . $i];
                    $hiddenInputs = '<input type="hidden" name="checkInRadio' . $i . '" value="' . $_POST['checkInRadio' . $i] . '" />
                           <input type="hidden" name="radioLogID' . $i . '" value="' . $_POST['radioLogID' . $i] . '" />
                           <input type="hidden" name="finalRows" value="' . $finalRows . '" />
                           <input type="hidden" name="divisionID" value="' . $_POST['divisionID'] . '" />';
                    checkInRadioLog($config, $radioLogID, $noLog = false, $hiddenInputs);
                    $filters = showSelectDivision($config, $divID);
                    showQuickSearch();
                    $counter += showRadioLog($config, $dateSelect, $counter, "LOANER", false, $filters);
                    $counter += showRadioLog($config, $dateSelect, $counter, "SHIFT", false, $filters);
                    $counter += showRadioLog($config, $dateSelect, $counter, "PERM", false, $filters);
                    $goBtn = false;
                } else {
                    if (isset($_POST['updateRadioLog' . $i]) || isset($_POST['updateRadioLogAll'])) {
                        //get posted values
                        $radioLogID = $_POST['radioLogID' . $i];
                        $radioCallNum = isset($_POST['radioCallNum' . $i]) ? $mysqli->real_escape_string($_POST['radioCallNum' . $i]) : '';
                        $checkOutType = isset($_POST['checkOutType']) ? $mysqli->real_escape_string($_POST['checkOutType']) : '';
                        updateRadioLog($config, $radioLogID, $radioCallNum, $checkOutType);
                        $editBtn = true;
                        $goBtn = false;
                    } else {
                        if (isset($_POST['exchangeBtn' . $i])) {
                            //checkin equipment and start checking back out
                            $radioLogID = $_POST['radioLogID' . $i];
                            showItemExchange($config, $radioLogID);
                            $goBtn = false;
                        }
                    }
                }
                if (isset($_POST['viewDeputyInv' . $i])) {
                    $radioLogID = $_POST['radioLogID' . $i];
                    showInventoryGroups($config, $radioLogID);
                    $goBtn = false;
                }
                $approveBtn[$i] = isset($_POST['radioLogApproved' . $i]) ? true : false;
                if ($approveBtn[$i]) {
                    $radioLogID = $_POST['radioLogID' . $i];
                    //get group ID from selected approval
                    $groupIDQ = "SELECT GPNUM FROM WTS_RADIOLOG WHERE REFNUM = " . $radioLogID;
                    $result = $mysqli->query($groupIDQ);
                    SQLerrorCatch($mysqli, $result);
                    $row = $result->fetch_assoc();
                    if ($row['GPNUM'] != "0") {
                        //Group Approval required
                        //get all group memebers references
                        $myq = "SELECT REFNUM \r\n                                FROM WTS_RADIOLOG\r\n                                WHERE GPNUM = " . $row['GPNUM'] . ";";
                        $result = $mysqli->query($myq);
                        SQLerrorCatch($mysqli, $result);
                        while ($row = $result->fetch_assoc()) {
                            //approve each member of group
                            $updateQ = "UPDATE WTS_RADIOLOG\r\n                                        SET SUP_ID = '" . $_SESSION['userIDnum'] . "',\r\n                                            SUP_TS = NOW(),\r\n                                            SUP_IP = INET_ATON('" . $_SERVER['REMOTE_ADDR'] . "') \r\n                                        WHERE WTS_RADIOLOG.REFNUM = " . $row['REFNUM'];
                            $resultUpdate = $mysqli->query($updateQ);
                            SQLerrorCatch($mysqli, $resultUpdate);
                            addLog($config, 'Radio Checkout Log #' . $row['REFNUM'] . ' approved');
                            echo 'Radio Checkout Log #' . $radioLogID . ' approved.<br />';
                        }
                    } else {
                        //approve non group secLog
                        $updateQ = "UPDATE WTS_RADIOLOG \r\n                                    SET SUP_ID = '" . $_SESSION['userIDnum'] . "',\r\n                                        SUP_TS = NOW(),\r\n                                        SUP_IP = INET_ATON('" . $_SERVER['REMOTE_ADDR'] . "') \r\n                                    WHERE WTS_RADIOLOG.REFNUM = " . $radioLogID;
                        $resultUpdate = $mysqli->query($updateQ);
                        SQLerrorCatch($mysqli, $resultUpdate);
                        addLog($config, 'Radio Checkout Log #' . $radioLogID . ' approved');
                        echo 'Radio Checkout Log #' . $radioLogID . ' approved.<br />';
                    }
                    $filters = showSelectDivision($config, $divID);
                    showQuickSearch();
                    $counter += showRadioLog($config, $dateSelect, $counter, "LOANER", false, $filters, $isApprovePage = true);
                    $counter += showRadioLog($config, $dateSelect, $counter, "SHIFT", false, $filters);
                    $counter += showRadioLog($config, $dateSelect, $counter, "PERM", false, $filters);
                    $goBtn = false;
                }
            }
            if ($foundEditBtn) {
                //                    if($itemLogType == "RADIO")
                //                        showRadioLogDetails($config, $radioLogID, true, $isApprovePage);
                //                    if($itemLogType == "KEY")
                showKeyLogDetails($config, $radioLogID, true, $isApprovePage, $divID);
                $goBtn = false;
            } else {
                if (!$addBtn && !$showAll && !$showNormal && !$changeDateBtn && !$isApprovePage && $totalRows < 0) {
                    echo 'Error getting Reference Number!<br />';
                    echo '<input type="submit" name="goBtn" value="Back To Logs" />';
                    $goBtn = false;
                }
            }
        }
        if ($isApprovePage && empty($radioLogID)) {
            showQuickSearch();
            $counter += showRadioLog($config, $dateSelect, $counter, "LOANER", false, $filters, $isApprovePage);
            $counter += showRadioLog($config, $dateSelect, $counter, "SHIFT", false, $filters);
            $counter += showRadioLog($config, $dateSelect, $counter, "PERM", false, $filters);
        }
        if ($editBtn || $updateRadioLog || $checkInKey || $updateKeyLog) {
            if ($config->adminLvl <= 25) {
                //Non supervisor Log details
                //$filters = showSelectDivision($config, $divID);
                showKeyLogDetails($config, $radioLogID, true, $isApprovePage, $divID);
                $goBtn = false;
            } else {
                //Supervisor Log Details
                //$filters = showSelectDivision($config, $divID);
                showKeyLogDetails($config, $radioLogID, true, false, $divID);
                $goBtn = false;
            }
        }
        if ($goBtn) {
            $filters = showSelectDivision($config, $divID);
            showQuickSearch();
            if ($config->adminLvl < 25) {
                //non supervisor logs
                $counter += showRadioLog($config, $dateSelect, $counter, "LOANER", false, $filters);
            } else {
                //supervisor logs
                $counter += showRadioLog($config, $dateSelect, $counter, "LOANER", true, $filters);
            }
            $counter += showRadioLog($config, $dateSelect, $counter, "SHIFT", false, $filters);
            $counter += showRadioLog($config, $dateSelect, $counter, "PERM", false, $filters);
        }
        echo '<input type="hidden" name="finalRows" value="' . $counter . '" />';
        echo '
        
        <br />
        <br />';
    } else {
        echo '<h2>Daily Radio Checkout Log</h2>Access Denied';
    }
}
function displayMySubmittedRequests($config)
{
    /*
     * A report of recent leave requests with
     * different views according to admin level
     */
    $mysqli = $config->mysqli;
    $admin = $config->adminLvl;
    //what pay period are we currently in?
    $payPeriodQuery = "SELECT * FROM PAYPERIOD WHERE NOW() BETWEEN PPBEG AND PPEND";
    $ppResult = $mysqli->query($payPeriodQuery);
    $ppArray = $ppResult->fetch_assoc();
    /* $ppOffset stands for the number of pay periods to adjust the query by 
     * relative to the current period
     */
    $ppOffset = isset($_GET['ppOffset']) ? $_GET['ppOffset'] : '0';
    //set the right URI for link
    if (isset($ppOffset)) {
        //strip off the old GET variable and its value
        $uri = preg_replace("/&ppOffset=.*/", "", $_SERVER['REQUEST_URI']) . "&ppOffset=";
    } else {
        $uri = $_SERVER['REQUEST_URI'] . "&ppOffset=";
    }
    //1st time set
    $startDate = new DateTime("{$ppArray['PPBEG']}");
    if ($ppOffset < 0) {
        //backward in time by $ppOffset number of periods
        $startDate->sub(new DateInterval("P" . abs($ppOffset) * 14 . "D"));
    } else {
        //forward in time by $ppOffset number of periods
        $startDate->add(new DateInterval("P" . $ppOffset * 14 . "D"));
    }
    $endDate = new DateTime("{$ppArray['PPEND']}");
    if ($ppOffset < 0) {
        //backward in time by $ppOffset number of periods
        $endDate->sub(new DateInterval("P" . abs($ppOffset) * 14 . "D"));
    } else {
        //forward in time by $ppOffset number of periods
        $endDate->add(new DateInterval("P" . $ppOffset * 14 . "D"));
    }
    ?>
<p><a href="<?php 
    echo $_SERVER['REQUEST_URI'] . '&cust=true';
    ?>
">Use Custom Date Range</a></br>
<?php 
    if (isset($_GET['cust'])) {
        echo "<form name='custRange' action='" . $_SERVER['REQUEST_URI'] . "' method='post'>";
        echo "<p> Start";
        if (isset($_POST['start']) && isset($_POST['end'])) {
            displayDateSelect('start', 'date_1', $_POST['start'], false, false);
            echo "End";
            displayDateSelect('end', 'date_2', $_POST['end'], false, false);
        } else {
            displayDateSelect('start', 'date_1', false, false, true);
            echo "End";
            displayDateSelect('end', 'date_2', false, false, true);
        }
        echo "<input type='submit' value='Go' /></p></form>";
        //overwrite current period date variables with
        //those provided by user
        if (isset($_POST['start']) && isset($_POST['end'])) {
            $startDate = new DateTime($_POST['start']);
            $endDate = new DateTime($_POST['end']);
            ?>
 <h3><center>Gain/Use Requests for <?php 
            echo $startDate->format('j M Y');
            ?>
 through <?php 
            echo $endDate->format('j M Y');
            ?>
.</center></h3> <?php 
        }
    } else {
        ?>
<p><div style="float:left"><a href="<?php 
        echo $uri . ($ppOffset - 1);
        ?>
">Previous</a></div>  
   <div style="float:right"><a href="<?php 
        echo $uri . ($ppOffset + 1);
        ?>
">Next</a></div></p>
<h3><center>Gain/Use Requests for pay period <?php 
        echo $startDate->format('j M Y');
        ?>
 through <?php 
        echo $endDate->format('j M Y');
        ?>
.</center></h3>
<?php 
    }
    ?>

<?php 
    $myq = "SELECT REFER 'RefNo', DATE_FORMAT(REQDATE,'%b %d %Y %H%i') 'Requested', \r\n                        DATE_FORMAT(USEDATE,'%a %b %d %Y') 'Used', DATE_FORMAT(BEGTIME,'%H%i') 'Start',\r\n                        DATE_FORMAT(ENDTIME,'%H%i') 'End', HOURS 'Hrs',\r\n                        T.DESCR 'Type', SUBTYPE 'Subtype', CALLOFF 'Calloff', NOTE 'Comment', STATUS 'Status', \r\n                        APR.LNAME 'ApprovedBy', REASON 'Reason', HRAPP_IS 'HRApproved' \r\n                    FROM REQUEST\r\n                    LEFT JOIN EMPLOYEE AS APR ON APR.IDNUM=REQUEST.APPROVEDBY\r\n                    INNER JOIN TIMETYPE AS T ON T.TIMETYPEID=REQUEST.TIMETYPEID\r\n                    WHERE REQUEST.IDNUM=" . $config->mysqli->real_escape_string($_SESSION['userIDnum']) . " AND USEDATE BETWEEN '" . $config->mysqli->real_escape_string($startDate->format('Y-m-d')) . "' \r\n                    AND '" . $config->mysqli->real_escape_string($endDate->format('Y-m-d')) . "' \r\n                    ORDER BY REFER";
    $result = $mysqli->query($myq);
    SQLerrorCatch($mysqli, $result);
    $fieldCount = $result->field_count;
    //load array for table
    //$theTable = array(array());
    //open form
    ?>
 <form name="submittedRequests" method="POST"> <input type="hidden" name="formName" value="submittedRequests"/> 
    <?php 
    echo '<link rel="stylesheet" href="templetes/DarkTemp/styles/tableSort.css" />
            <script type="text/javascript" src="bin/jQuery/js/tableSort.js"></script>
                <div id="wrapper">';
    echo '<table class="sortable" id="sorter"><tr>';
    //get field info
    $echo = '';
    for ($y = 0; $finfo = $result->fetch_field(); $y++) {
        //assign field names as table header (row 0)
        $echo .= '<th>' . $finfo->name . '</th>';
    }
    $echo .= '</tr>';
    if ($admin < 25) {
        $echo = '<th>Edit</th>' . $echo;
    } else {
        $echo = '<th>Edit</th><th>Delete</th>' . $echo;
    }
    for ($x = 1; $resultArray = $result->fetch_array(MYSQLI_BOTH); $x++) {
        //record loop
        $leaveStatus = isset($resultArray['Status']) ? $resultArray['Status'] : '';
        $leaveSTATUS = isset($resultArray['STATUS']) ? $resultArray['STATUS'] : '';
        if ($leaveStatus == 'EXPUNGED' || $leaveSTATUS == 'EXPUNGED') {
            $echo .= '<tr style="text-decoration:line-through" >';
        } else {
            $echo .= '<tr >';
        }
        if ($admin > 0) {
            for ($y = 0; $y < $fieldCount + 2; $y++) {
                //field loop
                //edit button that redirects to request page
                if ($y == 0) {
                    if (!$resultArray['HRApproved'] && !($leaveStatus == 'EXPUNGED' || $leaveSTATUS == 'EXPUNGED')) {
                        $echo .= '<td><input type="submit"  name="editBtn' . $x . '" value="Edit" onClick="this.form.action=' . "'?leave=true'" . '" />
                            <input type="hidden" name="requestID' . $x . '" value="' . $resultArray[0] . '" /></td>';
                    } else {
                        $echo .= '<td></td>';
                    }
                } else {
                    if ($y == 1) {
                        if (!$resultArray['HRApproved'] && !($leaveStatus == 'EXPUNGED' || $leaveSTATUS == 'EXPUNGED')) {
                            $echo .= '<td><button type="submit"  name="deleteBtn' . $x . '" value="' . $resultArray[0] . '" onClick="this.form.action=' . $_SERVER['REQUEST_URI'] . ';this.form.submit()" >Delete</button></td>';
                        } else {
                            $echo .= '<td></td>';
                        }
                    } else {
                        //load results
                        $echo .= '<td>' . $resultArray[$y - 2] . '</td>';
                    }
                }
            }
        } else {
            //no edit capabilities
            if ($leaveStatus == 'PENDING' || $leaveSTATUS == 'PENDING' && !($leaveStatus == 'EXPUNGED' || $leaveSTATUS == 'EXPUNGED')) {
                $echo .= '<td><input type="submit"  name="editBtn' . $x . '" value="Edit" onClick="this.form.action=' . "'?leave=true'" . '" />
                        <input type="hidden" name="requestID' . $x . '" value="' . $resultArray[0] . '" /></td>';
            } else {
                $echo .= '<td></td>';
            }
            for ($y = 0; $y < $fieldCount; $y++) {
                //field loop
                //load results
                $echo .= '<td>' . $resultArray[$y] . '</td>';
            }
        }
    }
    //end array loading
    $echo .= '<input type="hidden" name="totalRows" value="' . $x . '" />';
    $echo .= '</tr>';
    $echo .= '</table></form></div>
                <script type="text/javascript">
                    var sorter=new table.sorter("sorter");
                    sorter.init("sorter",2);
                </script>';
    echo $echo;
    //check if we're deleting a record
    for ($i = 0; $i < $x; $i++) {
        if (isset($_POST['deleteBtn' . $i])) {
            $refToDelete = $_POST['deleteBtn' . $i];
            //procede w delete
            expungeRequest($mysqli, $refToDelete, false, $deleteIndex = $i, $totalRows = $x);
        }
    }
    //end of deleteBtn checking loop
    //showSortableTable($theTable, 0);
    //build table
    //resultTable($mysqli, $result);
    //show a print button. printed look defined by print.css
    echo '<a href="javascript:window.print()">Print</a>';
}
Exemplo n.º 4
0
function displaySecLogReport($config)
{
    echo '<h2>Secondary Employement Logs Reports By Date</h2>';
    if ($config->adminLvl >= 25) {
        $dateFrom = isset($_POST['dateFrom']) ? $_POST['dateFrom'] : false;
        $dateTo = isset($_POST['dateTo']) ? $_POST['dateTo'] : false;
        echo '<form method="POST" name="secLog">';
        if (!$dateFrom) {
            $dateFrom = Date('m/d/Y', time());
            $dateTo = Date('m/d/Y', time());
            echo 'Date From ';
            //echo '<input name="dateSelect" type="text" value="'.$dateSelect.'" />';
            displayDateSelect("dateFrom", "dateSel", false, false, true, false);
            echo ' To ';
            displayDateSelect("dateTo", "dateSel2", false, false, true, false);
            echo ' <input id="goBtn" type=submit name="goBtn" value="Go" /><br />';
        } else {
            if ($dateTo < $dateFrom) {
                echo '<font color="red">Invalid Entry! "To" Date must be greater than or equal to "From" Date</font></br></br>';
            }
            echo '<h3>Date: ';
            displayDateSelect("dateFrom", "dateSel", $dateFrom, false, false, false);
            echo ' To ';
            if ($dateTo < $dateFrom) {
                $dateTo = $dateFrom;
                displayDateSelect("dateTo", "dateSel2", $dateTo, true, false, false);
            } else {
                displayDateSelect("dateTo", "dateSel2", $dateTo, false, false, false);
            }
            echo ' <input id="goBtn" type=submit name="goBtn" value="Go" /><br />';
        }
        $mysqli = $config->mysqli;
        /*query unions the results of joins on two different tables (EMPLOYEE and RESERVE)
          depending on the value of SECLOG.IS_RESERVE */
        $myq = "SELECT S.GPNUM 'gpID', CONCAT_WS(', ',SEC.LNAME,SEC.FNAME) 'DEPUTYID', S.RADIO, \r\n                    TIME_FORMAT(TIMEIN,'%H%i') 'TIMEIN',\r\n                    CONCAT_WS(', ',LOGIN.LNAME,LOGIN.FNAME) 'AUDIT_IN_ID', LOCATION, S.CITY,\r\n                    TIME_FORMAT(SHIFTSTART,'%H%i') 'SHIFTSTART', TIME_FORMAT(SHIFTEND,'%H%i') 'SHIFTEND',\r\n                    DRESS, TIME_FORMAT(TIMEOUT,'%H%i') 'TIMEOUT', \r\n                    CONCAT_WS(', ',LOGOUT.LNAME,LOGOUT.FNAME) 'AUDIT_OUT_ID', \r\n                    CONCAT_WS(', ',SUP.LNAME,SUP.FNAME) 'SUP_ID', DATE_FORMAT(SUP_TIME,'%m/%d/%y %H%i') 'SUP_TIME',\r\n                    PHONE, S.IDNUM\r\n                FROM SECLOG S\r\n                INNER JOIN EMPLOYEE AS SEC ON S.DEPUTYID=SEC.IDNUM\r\n                LEFT JOIN EMPLOYEE AS LOGIN ON S.AUDIT_IN_ID=LOGIN.IDNUM\r\n                LEFT JOIN EMPLOYEE AS LOGOUT ON S.AUDIT_OUT_ID=LOGOUT.IDNUM\r\n                LEFT JOIN EMPLOYEE AS SUP ON S.SUP_ID=SUP.IDNUM\r\n                WHERE `SHIFTDATE` BETWEEN '" . Date('Y-m-d', strtotime($dateFrom)) . "'\r\n                    AND '" . Date('Y-m-d', strtotime($dateTo)) . "'\r\n                AND S.IS_RESERVE=0\r\n\r\n                UNION\r\n\r\n                SELECT S.GPNUM 'gpID', CONCAT_WS(', ',SEC.LNAME,SEC.FNAME) 'DEPUTYID', S.RADIO,\r\n                    TIME_FORMAT(TIMEIN,'%H%i') 'TIMEIN',\r\n                    CONCAT_WS(', ',LOGIN.LNAME,LOGIN.FNAME) 'AUDIT_IN_ID', LOCATION, S.CITY,\r\n                    TIME_FORMAT(SHIFTSTART,'%H%i') 'SHIFTSTART', TIME_FORMAT(SHIFTEND,'%H%i') 'SHIFTEND',\r\n                    DRESS, TIME_FORMAT(TIMEOUT,'%H%i') 'TIMEOUT', \r\n                    CONCAT_WS(', ',LOGOUT.LNAME,LOGOUT.FNAME) 'AUDIT_OUT_ID', \r\n                    CONCAT_WS(', ',SUP.LNAME,SUP.FNAME) 'SUP_ID', DATE_FORMAT(SUP_TIME,'%m/%d/%y %H%i') 'SUP_TIME',\r\n                    PHONE, S.IDNUM\r\n                FROM SECLOG S\r\n                INNER JOIN RESERVE AS SEC ON S.DEPUTYID=SEC.IDNUM\r\n                LEFT JOIN EMPLOYEE AS LOGIN ON S.AUDIT_IN_ID=LOGIN.IDNUM\r\n                LEFT JOIN EMPLOYEE AS LOGOUT ON S.AUDIT_OUT_ID=LOGOUT.IDNUM\r\n                LEFT JOIN EMPLOYEE AS SUP ON S.SUP_ID=SUP.IDNUM\r\n                WHERE `SHIFTDATE` BETWEEN '" . Date('Y-m-d', strtotime($dateFrom)) . "'\r\n                    AND '" . Date('Y-m-d', strtotime($dateTo)) . "'\r\n                AND S.IS_RESERVE=1\r\n                ORDER BY 'gpID'";
        $result = $mysqli->query($myq);
        SQLerrorCatch($mysqli, $result, $myq, $debug = false);
        $echo = '';
        $x = 0;
        $y = 0;
        //resultTable($mysqli, $result, 'false');
        $showAll = true;
        $theTable = array(array());
        $theTable[$x][$y] = "Action";
        $y++;
        $theTable[$x][$y] = "# in Group";
        $y++;
        $theTable[$x][$y] = "Deputy";
        $y++;
        $theTable[$x][$y] = "Radio#";
        $y++;
        $theTable[$x][$y] = "Log In";
        $y++;
        $theTable[$x][$y] = "C/Deputy";
        $y++;
        $theTable[$x][$y] = "Site Name/Address";
        $y++;
        $theTable[$x][$y] = "City/Twp";
        $y++;
        $theTable[$x][$y] = "Contact#";
        $y++;
        $theTable[$x][$y] = "Shift Start";
        $y++;
        $theTable[$x][$y] = "Shift End";
        $y++;
        $theTable[$x][$y] = "Dress";
        $y++;
        $theTable[$x][$y] = "Log Off";
        $y++;
        $theTable[$x][$y] = "C/Deputy";
        $y++;
        $theTable[$x][$y] = "Supervisor";
        $y++;
        $theTable[$x][$y] = "Sign Off";
        $y++;
        $lastGroupID = '';
        $groupCounter = 0;
        while ($row = $result->fetch_assoc()) {
            if ($row['gpID'] == $lastGroupID && $lastGroupID != 0) {
                $gpCountSQL = $config->mysqli;
                $gpCountq = "SELECT GPNUM FROM SECLOG WHERE GPNUM='" . $row['gpID'] . "'";
                $gpCountresult = $mysqli->query($gpCountq);
                SQLerrorCatch($gpCountSQL, $gpCountresult);
                $theTable[$x][0] .= ', ' . $row['IDNUM'];
                $theTable[$x][2] = $gpCountresult->num_rows;
            } else {
                $groupCounter = 1;
                if (strcmp($row['TIMEOUT'], "0000") == 0 || $showAll || strcmp($row['SUP_TIME'], "00/00/00 0000") == 0) {
                    $x++;
                    if (strcmp($row['SUP_TIME'], "00/00/00 0000") == 0) {
                        //                        $theTable[$x][0] = '<input type="submit" name="secLogApproved'.$x.'" value="Approve" />
                        //                            <input type="hidden" name="secLogID'.$x.'" value="'.$row['IDNUM'].'" />
                        //                                <input type="submit" value="Edit/View" name="secLogRadio'.$x.'" />';
                        $theTable[$x][0] = 'Ref# ' . $row['IDNUM'];
                    } else {
                        $theTable[$x][0] = 'Ref# ' . $row['IDNUM'];
                        //$theTable[$x][0] .= '<input type="submit" value="Edit/View" name="secLogRadio'.$x.'" />
                        //<input type="hidden" name="secLogID'.$x.'" value="'.$row['IDNUM'].'" />';
                    }
                    $y = 1;
                    $theTable[$x][$y] = $groupCounter;
                    $y++;
                    $theTable[$x][$y] = $row['DEPUTYID'];
                    $y++;
                    $theTable[$x][$y] = $row['RADIO'];
                    $y++;
                    $theTable[$x][$y] = $row['TIMEIN'];
                    $y++;
                    $theTable[$x][$y] = $row['AUDIT_IN_ID'];
                    $y++;
                    $theTable[$x][$y] = $row['LOCATION'];
                    $y++;
                    $theTable[$x][$y] = $row['CITY'];
                    $y++;
                    $theTable[$x][$y] = $row['PHONE'];
                    $y++;
                    $theTable[$x][$y] = $row['SHIFTSTART'];
                    $y++;
                    $theTable[$x][$y] = $row['SHIFTEND'];
                    $y++;
                    $theTable[$x][$y] = $row['DRESS'];
                    $y++;
                    $theTable[$x][$y] = $row['TIMEOUT'];
                    $y++;
                    $theTable[$x][$y] = $row['AUDIT_OUT_ID'];
                    $y++;
                    $theTable[$x][$y] = $row['SUP_ID'];
                    $y++;
                    $theTable[$x][$y] = $row['SUP_TIME'];
                    $y++;
                    $lastGroupID = $row['gpID'];
                }
            }
        }
        //end while loop
        showSortableTable($theTable, 3);
        $echo .= '<input type="hidden" name="editRows" value="' . $x . '" />';
        echo $echo;
    } else {
        echo 'Access Denied';
    }
}
 public function showCustomDateRange()
 {
     if ((isset($_POST['customDate']) || isset($_POST['GoBtn'])) && !isset($_POST['usePayPeriodBtn'])) {
         echo '<h3><center><input type="submit" name="usePayPeriodBtn" value="Remove Custom Dates" /></center></h3><br/>';
         echo '<div align="center">Start';
         if (isset($_POST['start']) && isset($_POST['end'])) {
             $this->startDate = $_POST['start'];
             displayDateSelect('start', 'date_1', $this->startDate, false, false);
             echo " End";
             $this->endDate = $_POST['end'];
             displayDateSelect('end', 'date_2', $this->endDate, false, false);
         } else {
             displayDateSelect('start', 'date_1', false, false, true);
             echo " End";
             displayDateSelect('end', 'date_2', false, false, true);
         }
         echo '<input type="hidden" name="customDate" value="true" />';
         echo "<input type='submit' name='GoBtn' value='Go' /></div><br/>";
     } else {
         echo '<h2><center><input type="submit" name="customDate" value="Use Custom Date Range" /></center></h2>';
     }
 }
Exemplo n.º 6
0
function reserveDetails($config, $reserveID)
{
    $mysqli = connectToSQL($reserveDB = TRUE);
    echo 'Details for: ' . $reserveID . '<input type="hidden" name="reserveID" value="' . $reserveID . '" />';
    if ($config->adminLvl >= 75) {
        $updateBtn = isset($_POST['updateBtn']) ? true : false;
        if ($updateBtn) {
            $group = isset($_POST['resGroup']) ? $mysqli->real_escape_string($_POST['resGroup']) : "";
            $fName = isset($_POST['foundUserFNAME']) ? $mysqli->real_escape_string($_POST['foundUserFNAME']) : "";
            $lName = isset($_POST['foundUserLNAME']) ? $mysqli->real_escape_string($_POST['foundUserLNAME']) : "";
            $radio = isset($_POST['radioNum']) ? $mysqli->real_escape_string($_POST['radioNum']) : "";
            $address = isset($_POST['address']) ? $mysqli->real_escape_string($_POST['address']) : "";
            $city = isset($_POST['city']) ? $mysqli->real_escape_string($_POST['city']) : "";
            $state = isset($_POST['state']) ? $mysqli->real_escape_string($_POST['state']) : "";
            $zip = isset($_POST['zip']) ? $mysqli->real_escape_string($_POST['zip']) : "";
            $hPhone = isset($_POST['hPhone']) ? $mysqli->real_escape_string($_POST['hPhone']) : "";
            $cPhone = isset($_POST['cPhone']) ? $mysqli->real_escape_string($_POST['cPhone']) : "";
            $wPhone = isset($_POST['wPhone']) ? $mysqli->real_escape_string($_POST['wPhone']) : "";
            $tis = isset($_POST['tis']) ? $mysqli->real_escape_string($_POST['tis']) : "";
            $agency = isset($_POST['agency']) ? $mysqli->real_escape_string($_POST['agency']) : "";
            $notes = isset($_POST['notes']) ? $mysqli->real_escape_string($_POST['notes']) : "";
            if (empty($fName) || empty($lName) || empty($group)) {
                echo '<br />Must provide all the highlighted items<br /> Did not Save<br />';
            } else {
                //Update Fields
                $myq = "UPDATE `RESERVE`.`RESERVE` SET\r\n                    `GRP` = " . $group . ",\r\n                    `LNAME` = '" . $lName . "',\r\n                    `FNAME` = '" . $fName . "',\r\n                    `RADIO` = '" . $radio . "',\r\n                    `ADDRESS` = '" . $address . "',\r\n                    `CITY` = '" . $city . "',\r\n                    `ST` = '" . $state . "',\r\n                    `ZIP` = '" . $zip . "',\r\n                    `HOMEPH` = '" . $hPhone . "',\r\n                    `CELLPH` = '" . $cPhone . "',\r\n                    `WORKPH` = '" . $wPhone . "',\r\n                    `TIS` = '" . $tis . "',\r\n                    `AGENCY` = '" . $agency . "',\r\n                    `NOTES` = '" . $notes . "' \r\n                    WHERE `IDNUM` = " . $reserveID;
                $result = $mysqli->query($myq);
                SQLerrorCatch($mysqli, $result);
                addLog($config, 'Reserve with ID ' . $reserveID . ' Updated');
                echo 'Reserve Successfully Updated.<br/>';
            }
        } else {
            $myq = "SELECT * FROM `RESERVE` WHERE `IDNUM` = " . $reserveID;
            $result = $mysqli->query($myq);
            SQLerrorCatch($mysqli, $result);
            $row = $result->fetch_assoc();
            $group = $row['GRP'];
            $fName = $row['FNAME'];
            $lName = $row['LNAME'];
            $radio = $row['RADIO'];
            $address = $row['ADDRESS'];
            $city = $row['CITY'];
            $state = $row['ST'];
            $zip = $row['ZIP'];
            $hPhone = $row['HOMEPH'];
            $cPhone = $row['CELLPH'];
            $wPhone = $row['WORKPH'];
            $tis = $row['TIS'];
            $agency = $row['AGENCY'];
            $notes = $row['NOTES'];
        }
        echo '</div><div align="left" class="login"><table>';
        echo '<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td>First Name: </td><td><input type="text" name="foundUserFNAME" value="' . $fName . '" /></td></tr>';
        echo '<tr><td></td><td>Last Name: </td><td><input type="text" name="foundUserLNAME" value="' . $lName . '" /></td></tr>';
        echo '<tr><td></td><td>Group: </td><td><select name="resGroup">
            <option value="">Select Group</option>            
            <option value="1"';
        if ($group == "1") {
            echo " SELECTED";
        }
        echo '>Group 1</option>
            <option value="2"';
        if ($group == "2") {
            echo " SELECTED";
        }
        echo '>Group 2</option>
            <option value="3"';
        if ($group == "3") {
            echo " SELECTED";
        }
        echo '>Group 3</option>
            <option value="4"';
        if ($group == "4") {
            echo " SELECTED";
        }
        echo '>Group 4</option>
            <option value="5"';
        if ($group == "5") {
            echo " SELECTED";
        }
        echo '>Group 5</option>
            </select></td></tr>';
        echo '<tr><td></td><td>Radio#: </td><td><input type="text" name="radioNum" value="' . $radio . '" /></td></tr>';
        echo '<tr><td></td><td>Address: </td><td><input type="text" name="address" value="' . $address . '" /></td></tr>';
        echo '<tr><td></td><td>City: </td><td><input type="text" name="city" value="' . $city . '" /></td></tr>';
        echo '<tr><td></td><td>State: </td><td><input type="text" name="state" value="' . $state . '" /></td></tr>';
        echo '<tr><td></td><td>ZIP: </td><td><input type="text" name="zip" value="' . $zip . '" /></td></tr>';
        echo '<tr><td></td><td>Home Phone: </td><td><input type="text" name="hPhone" value="' . $hPhone . '" /></td></tr>';
        echo '<tr><td></td><td>Cell Phone: </td><td><input type="text" name="cPhone" value="' . $cPhone . '" /></td></tr>';
        echo '<tr><td></td><td>Work Phone: </td><td><input type="text" name="wPhone" value="' . $wPhone . '" /></td></tr>';
        echo '<tr><td></td><td>Time in Service: </td><td>';
        displayDateSelect("tis", "tis", $tis, false, false);
        echo '</td></tr>';
        echo '<tr><td></td><td>Agency: </td><td><input type="text" name="agency" value="' . $agency . '" /></td></tr>';
        echo '<tr><td></td><td>Additional Notes: </td><td><input type="text" name="notes" value="' . $notes . '" /></td></tr><tr><td></td></tr>';
        echo '<tr><td></td><td><input type="submit" name="updateBtn" value="Update and Save" /></td><td>';
        echo '<input type="submit" name="delBtn" value="Delete Reserve" /> <input type="submit" name="goBackBtn" value="Back To Reserves" /></td></tr>';
        echo '</table></div>';
    }
}
Exemplo n.º 7
0
 public function showMainRequestForm()
 {
     //Show all available remaining options
     $this->config->showPrinterFriendly = true;
     echo '<h2>Complete additional fields</h2>';
     echo 'Starting Date: ';
     displayDateSelect('useDate', 'date_1', $this->useDate, true, true);
     if (!$this->isEditing) {
         echo ' Through date (optional): ';
         displayDateSelect('endDate', 'date_2', $this->endDate);
     } else {
         echo '<input type="hidden" name="endDate" value="" />';
     }
     echo '<br/><br/>';
     echo 'Start time: ';
     showTimeSelector("begTime", $this->begTime1, $this->begTime2);
     if ($this->subTypeInfo['LIMIT_8_12'] == '1' || $this->typeID == '2') {
         //Limit is enabled or Type is Personal
         if (!empty($this->shiftHours)) {
             if ($this->shiftHourRadio == "8" || $this->shiftHours == "8") {
                 echo " How long is your shift? <input type='radio' name='shiftHour' value='8' CHECKED>8 Hours";
                 echo "<input type='radio' name='shiftHour' value='12'>12 Hours<br/>";
             } elseif ($this->shiftHourRadio == "12" || $this->shiftHours == "12") {
                 echo " How long is your shift? <input type='radio' name='shiftHour' value='8'>8 Hours";
                 echo "<input type='radio' name='shiftHour' value='12' CHECKED>12 Hours<br/>";
             } else {
                 echo " How long is your shift? <input type='radio' name='shiftHour' value='8'>8 Hours";
                 echo "<input type='radio' name='shiftHour' value='12'>12 Hours";
                 echo ' <font color="red">Error in shift selection! </font><br/>';
             }
         } else {
             echo " How long is your shift? <input type='radio' name='shiftHour' value='8'>8 Hours";
             echo "<input type='radio' name='shiftHour' value='12'>12 Hours<br/>";
         }
     } else {
         echo ' End time: ';
         showTimeSelector("endTime", $this->endTime1, $this->endTime2);
     }
     if (!empty($this->shiftHours)) {
         echo ' Total Hours: ' . $this->shiftHours;
     }
     echo '<br/><br/>';
     echo 'Comment: <textarea rows="3" cols="40" name="empComment" >' . $this->empComment . '</textarea>';
     echo '<br/><br/>';
     if (!empty($this->submitDate)) {
         echo '<font color="darkred">Submitted on ' . $this->submitDate . ' by ' . $this->auditName . '</font>';
         echo '<br/><br/>';
     }
     if (!$this->isEditing) {
         echo '<input type="submit" name="submitBtn" value="Submit for Approval">';
     } else {
         if ($this->status != "APPROVED") {
             echo '<input type="hidden" name="reqID" value="' . $this->reqID . '" />';
             echo '<input type="submit" name="updateReqBtn" value="Update Request ' . $this->reqID . '">';
         }
         echo '<input type="submit" name="duplicateReqBtn" value="Duplicate Request" />';
     }
 }
Exemplo n.º 8
0
function displayLogs($config)
{
    if ($config->adminLvl > 75) {
        echo "<form name='custRange' action='" . $_SERVER['REQUEST_URI'] . "' method='post'>";
        echo 'Date Range to Display (Blank will use today\'s Date)';
        echo "<p> Start";
        if (isset($_POST['start']) && isset($_POST['end'])) {
            displayDateSelect('start', 'date_1', $_POST['start'], false, false);
            echo "End";
            displayDateSelect('end', 'date_2', $_POST['end'], false, false);
        } else {
            displayDateSelect('start', 'date_1', false, false, true);
            echo "End";
            displayDateSelect('end', 'date_2', false, false, true);
        }
        echo "<input type='submit' value='Go' /></p>";
        //overwrite current period date variables with
        //those provided by user
        if (isset($_POST['start']) && isset($_POST['end'])) {
            $startDate = new DateTime($_POST['start']);
            $startDate = $startDate->format('Y-m-d');
            $endDate = new DateTime($_POST['end']);
            $endDate = $endDate->format('Y-m-d');
        } else {
            $startDate = date("Y-m-d");
            $endDate = date("Y-m-d");
        }
        if ($startDate == $endDate) {
            $dateQ = "WHERE DATE = '" . $startDate . "'";
        } else {
            $dateQ = "WHERE DATE BETWEEN '" . $startDate . "' AND '" . $endDate . "'";
        }
        $x = 0;
        $y = 0;
        $theTable = array(array());
        $theTable[$x][$y] = "Event#";
        $y++;
        $theTable[$x][$y] = "User";
        $y++;
        $theTable[$x][$y] = "User IP";
        $y++;
        $theTable[$x][$y] = "Time of Event";
        $y++;
        $theTable[$x][$y] = "Description of Event";
        $y++;
        $mysqli = $config->mysqli;
        $myq = "SELECT EMP.LNAME 'LName', EMP.FNAME 'FName', WTS_EVENTS.IDNUM 'refNo', \r\n                DATE_FORMAT(DATE,'%a %d %b %Y') 'Date',\r\n                DATE_FORMAT(TIME,'%H%i') 'Time', \r\n                DESCR 'Descr', INET_NTOA(USERIP) 'UserIP'\r\n            FROM WTS_EVENTS\r\n            LEFT JOIN EMPLOYEE AS EMP ON EMP.IDNUM=WTS_EVENTS.USERID\r\n            " . $dateQ;
        $result = $mysqli->query($myq);
        SQLerrorCatch($mysqli, $result);
        while ($row = $result->fetch_assoc()) {
            $x++;
            $y = 0;
            $theTable[$x][$y] = $row['refNo'];
            $y++;
            $theTable[$x][$y] = $row['LName'] . ', ' . $row['FName'];
            $y++;
            $theTable[$x][$y] = $row['UserIP'];
            $y++;
            $theTable[$x][$y] = $row['Date'] . ' ' . $row['Time'];
            $y++;
            $theTable[$x][$y] = $row['Descr'];
            $y++;
        }
        echo '<h3>User Event Logs</h3>';
        echo 'Showing events between ' . $startDate . ' and ' . $endDate;
        showSortableTable($theTable, 1);
    } else {
        echo '<h3>User Event Logs</h3>Access Denied!';
    }
}