Example #1
0
function showItemDetails($config, $itemID)
{
    //Inventory Information on item
    $myq = "SELECT I.IDNUM, I.TYPE, T.MANUFACTURER 'MAKE', T.MODEL 'MODEL',\r\n            I.OTHER_SN, I.DESCR, I.PRIORITY_TYPE , I.SERIAL_NUM 'CAR_NO', I.COLOR 'COLOR', I.YEAR 'YEAR',\r\n            I.VIN 'VIN', I.LICENSE 'LICENSE'\r\n            FROM WTS_INVENTORY I\r\n            LEFT JOIN WTS_INV_TYPE AS T ON T.IDNUM=I.TYPE\r\n            WHERE I.IDNUM = '" . $itemID . "'";
    $result = $config->mysqli->query($myq);
    SQLerrorCatch($config->mysqli, $result, $myq);
    //Millage information on Veh
    $vehMilq = "SELECT M.IDNUM, DATE, MILAGE, CONCAT(E.LNAME, ', ', E.FNAME) 'AddedBy'\r\n            FROM WTS_VEH_MILAGE M\r\n            LEFT JOIN EMPLOYEE AS E ON E.IDNUM = M.AUDIT_ID\r\n            WHERE INV_ID = '" . $itemID . "' ORDER BY AUDIT_TS DESC";
    $vehMilresult = $config->mysqli->query($vehMilq);
    SQLerrorCatch($config->mysqli, $vehMilresult, $vehMilq);
    //Veh Notes
    $vehNotesq = "SELECT N.IDNUM, DATE, NOTES, CONCAT(E.LNAME, ', ', E.FNAME) 'AddedBy'\r\n            FROM WTS_VEH_NOTES N\r\n            LEFT JOIN EMPLOYEE AS E ON E.IDNUM = N.AUDIT_ID\r\n            WHERE INV_ID = '" . $itemID . "' ORDER BY AUDIT_TS DESC";
    $vehNoteresult = $config->mysqli->query($vehNotesq);
    SQLerrorCatch($config->mysqli, $vehNoteresult, $vehNotesq);
    $itemDetails = '';
    $row = $result->fetch_assoc();
    $itemDetails .= 'Car Number: <font color="blue">' . $row['CAR_NO'] . '</font><br/>';
    $itemDetails .= 'Year: ' . $row['YEAR'] . '<br/>';
    $itemDetails .= 'Make: ' . $row['MAKE'] . '<br/>';
    $itemDetails .= 'Model: ' . $row['MODEL'] . '<br/>';
    $itemDetails .= 'Color: ' . $row['COLOR'] . '<br/>';
    $itemDetails .= 'Description: ' . $row['DESCR'] . '<br/><br/>';
    $itemDetails .= 'VIN: ' . $row['VIN'] . '<br/>';
    $itemDetails .= 'License: ' . $row['LICENSE'] . '<br/>';
    $itemDetails .= '<hr/>';
    $itemDetails .= '<h4>Milage Log</h4>';
    while ($vehMilage = $vehMilresult->fetch_assoc()) {
        $itemDetails .= 'Milage is <font color="blue">' . $vehMilage['MILAGE'] . '</font> - Reported by ' . $vehMilage['AddedBy'] . ' on <font color="dark">' . $vehMilage['DATE'] . '</font><br/>';
    }
    $itemDetails .= '<BR/>';
    $itemDetails .= '<hr/>';
    $itemDetails .= '<h4>Upcoming Maintenance</h4>';
    $itemDetails .= '<h6><font color="red">Oil Change PAST Due - demo system message</font></h6>';
    $itemDetails .= 'Transmission Flush due on 6/3/2013 - Reported by demo_system_message<br/>';
    $itemDetails .= '<BR/>';
    $itemDetails .= '<hr/>';
    $itemDetails .= '<h4>Notes</h4>';
    while ($vehNotes = $vehNoteresult->fetch_assoc()) {
        $itemDetails .= '<font color="blue">' . $vehNotes['NOTES'] . '</FONT> - Reported by ' . $vehNotes['AddedBy'] . ' on <font color="dark">' . $vehNotes['DATE'] . '</font><br/>';
    }
    $itemDetails .= '<BR/>';
    popupmessage($itemDetails, $title = 'Details for ' . $row['OTHER_SN'], $width = '600');
}
Example #2
0
 private function checkForInvalidRequests()
 {
     $noErrors = true;
     //prep work for any checks
     $this->getLastPayPeriodEnd();
     //popupmessage('cutoff '.$this->lastPayEnd.' '.date('Y-m-d', strtotime($this->lastPayEnd)));
     if (strtotime($this->useDate) <= strtotime($this->lastPayEnd)) {
         //Date requesting is older than last pay period
         //popupmessage('Date is older than last pay period');
         if (strtotime($this->lastPayStart) <= strtotime($this->useDate) && strtotime($this->useDate) <= strtotime($this->lastPayEnd)) {
             //Date requesting is part of last pay period
             //popupmessage('Date requesting is part of last pay period');
             $today = strtotime(date('Y-m-d'));
             $cutOff = date('Y-m-d', strtotime('+5 days', strtotime($this->lastPayEnd)));
             if ($today > strtotime($cutOff)) {
                 //Date is past cut off period
                 //popupmessage('Date is Not Allowed past cut off period');
                 if ($this->config->adminLvl >= 25) {
                     //supervisors allowed to submit
                     popupmessage('<font color="red">Requested Date is past the cut off period<Br/>
                         Please contact Laura after submitting request</font>');
                 } else {
                     popupmessage('<font color="red">Requested Date is past the cut off period<Br/>
                         Please see your supervisor to submit this request</font>');
                     $noErrors = false;
                 }
             }
         } else {
             //Date is much older than last payperiod
             if ($this->config->adminLvl >= 25) {
                 popupmessage('<div align="center"><font color="red">Requested Date is much older than last pay period<Br/>
                     Please contact Laura after submitting request</font></div>');
                 //supervisors allowed to submit
             } else {
                 popupmessage('<font color="red">Requested Date is much older than last pay period<Br/>
                     Please see your supervisor to submit this request</font>');
                 $noErrors = false;
             }
         }
     }
     if (!$noErrors) {
         //An error was found
         //Do not continue any more checks
     } elseif (empty($this->useDate)) {
         //use date required
         echo '<font color="red">Must have a Starting Date</font>';
         $noErrors = false;
     } elseif (empty($this->begTime1) || empty($this->begTime2)) {
         //start time required
         echo '<font color="red">Must have a start time</font>';
         $noErrors = false;
     } elseif (empty($this->endTime1) || empty($this->endTime2)) {
         //No end time
         if (!isset($_POST['shift8Hour']) && !isset($_POST['shift12Hour'])) {
             //No shift Length
             echo '<font color="red">Must have an end time</font>';
             $noErrors = false;
         }
     } elseif (($this->typeID == '5' || $this->typeID == '6') && $this->subTypeID != '13') {
         //Is Overtime Pay or AT Gain
         if (strtotime(date('Y-m-d', strtotime($this->useDate))) > strtotime(date('Y-m-d'))) {
             //Current Date must be less than the submitted date
             echo '<font color="red">Can not submit for Overtime Pay or AT Gain unless it is on or after the date of use</font>';
             $noErrors = false;
         }
     } elseif ($this->maxCalDays > 0) {
         //Check for Max Calendar Days for this type of request
         $yearBegin = date('Y-m-d', strtotime('01/01/' . date('Y')));
         $yearEnd = date('Y-m-d', strtotime('12/31/' . date('Y')));
         $this->db->filters = $this->db->getTimeRequestFiltersBetweenDates($yearBegin, $yearEnd);
         $this->db->filters .= $this->db->getTimeRequestFiltersByEmpID($this->empID);
         if ($this->subTypeID == '8' || $this->subTypeID == '19') {
             //Military and injured on duty max limit is on straight time only
             $this->db->filters .= $this->db->getTimeRequestFiltersBySubType($this->typeID);
         } else {
             $this->db->filters .= $this->db->getTimeRequestFiltersByType($this->subTypeID);
         }
         $results = $this->db->getTimeRequestByID();
         $this->db->filters = '';
         if ($results->num_rows > $this->maxCalDays) {
             $noErrors = false;
             $dupRefNo = '';
             while ($dupRef = $results->fetch_assoc()) {
                 $dupRefNo .= '<br/>' . $dupRef['RefNo'];
             }
             if (isset($_POST['noBtn'])) {
                 //Do Nothing, leave all left behind info
             } elseif (!isset($_POST['confirmBtn'])) {
                 $this->isShowAreYouSureMessage = true;
                 $this->reason .= '<font color="red"> You\'ve exceeded the ' . $this->maxCalDays . ' day limit
                     for this type of request this year with ' . $results->num_rows . ' request</font><br/>
                         Please see Reference Numbers: <br/>' . $dupRefNo;
             } elseif (isset($_POST['confirmBtn'])) {
                 $this->hrNotes = 'User exceeded the ' . $this->maxCalDays . ' day limit
                     for this type of request this year with ' . $results->num_rows . ' request';
                 $noErrors = true;
             }
         }
     }
     return $noErrors;
 }
Example #3
0
 public function sendRequestToPending($extraInputs = '')
 {
     $confirmBtn = isset($_POST['confirmBtn']) ? true : false;
     if ($confirmBtn && !empty($_POST['hrNotes']) && $_SESSION['admin']) {
         $this->hrNotes = $_POST['hrNotes'];
         if (!empty($this->hrNotes)) {
             $myq = getSendToPending($this->config, $this->refNo, $this->hrNotes);
             $result = getQueryResult($this->config, $myq, $debug = false);
             if ($result) {
                 addLog($this->config, 'Ref# ' . $this->refNo . ' status was changed to pending');
                 popUpMessage('Request ' . $this->refNo . ' is now Pending Status. 
                             <div align="center"><form method="POST" action="' . $_SERVER['REQUEST_URI'] . '">
                             ' . $extraInputs . '                     
                             <input type="submit" name="okBtn" value="OK" />
                             </form></div>');
             } else {
                 popupmessage('Failed to add');
             }
         } else {
             popupmessage('Notes Requested');
         }
     } else {
         if (!isset($_POST['okBtn'])) {
             $result = "";
             if (empty($this->hrNotes)) {
                 $result = '<font color="red">Requires a Reason</font><br/>';
             }
             $echo = '<div align="center"><form method="POST" name="confirmBackToPending">
             <input name="deleteBtn' . $this->toSendToPendingIndex . '" type="hidden" value="' . $this->refNo . '" />
             <input type="hidden" name="totalRows" value="' . $this->toSendToPendingIndex . '" />
             Request ' . $this->refNo . ' will be sent back to pending<br/>   ' . $result . '
             Reason:<textarea name="hrNotes">' . $this->hrNotes . '</textarea><br/>
             <input type="submit" name="confirmBtn" value="CONFIRM" />
             <input type="submit" name="okBtn" value="CANCEL" />
             ' . $extraInputs . ' 
             </form></div>';
             popUpMessage($echo, "Confirm Back To Pending");
         }
     }
 }