示例#1
0
function displayMySubmittedRequestsNEW($config)
{
    $requestReports = new request_reports();
    $requestReports->config = $config;
    $hiddenInputs = '';
    $requestReports->filters = getFilterEmpID($config, $_SESSION['userIDnum']);
    $requestReports->showTimeRequestsByDate($hiddenInputs, $showCustomDates = true, $showPayPeriods = true, $showDivisions = false);
}
示例#2
0
function viewClandar($config, $month, $year)
{
    $day = date('j');
    $short = date('y');
    if ($month > 12) {
        $month = $month - 12;
        $year = $year + 1;
    }
    if ($month < 1) {
        $month = $month + 12;
        $year = $year - 1;
    }
    $next_month = $month + 1;
    $prev_month = $month - 1;
    $days_in_month = cal_days_in_month(CAL_GREGORIAN, $month, $year);
    //Here we generate the first day of the month
    $first_day = mktime(0, 0, 0, $month, 1, $year);
    $dtFirstDay = date('F', mktime(0, 0, 0, $month - 1, 1, $year));
    $dtLastDay = date('F', mktime(0, 0, 0, $month + 1, 1, $year));
    //This gets us the month name
    $title = date('F', $first_day);
    //Here we find out what day of the week the first day of the month falls on
    $day_of_first_day = date('w', mktime(0, 0, 0, $month, 1, $year));
    $myDivID = "";
    if (isset($_POST['divisionID'])) {
        $myDivID = $_POST['divisionID'];
    }
    // Navigation for the monthly calender view
    $Prenavigation = "<input type=\"submit\" name=\"prevMonth\"  value=\"<< " . $dtFirstDay . "\" />";
    $Nextnavigation = "<input type=\"submit\" name=\"nextMonth\" value=\"" . $dtLastDay . " >>\" />";
    $mysqli = $config->mysqli;
    //Here we start building the table heads
    echo "</div><div class=\"cal\"><table width=720>";
    echo "<tr><th colspan=7> ";
    echo "<br/><h3>Approved Requests<br/></h3><br/>";
    echo '<form name="divisionForm" method="POST">';
    echo "<input type=\"hidden\" name=\"prevMon\" value=\"{$prev_month}\">\r\n            <input type=\"hidden\" name=\"curMon\" value=\"{$month}\">\r\n            <input type=\"hidden\" name=\"nextMon\" value=\"{$next_month}\">\r\n            <input type=\"hidden\" name=\"year\" value=\"{$year}\">\r\n            <table border=\"0\" width=\"700\" cellspacing=\"0\" cellpadding=\"0\">\r\n                    <tr>\r\n                    <td width=10>&nbsp;</td>\r\n                    <td width=\"8\" height=\"5\" align=\"center\" valign=\"middle\">" . $Prenavigation . "</td>\r\n                    <td height='8'  width=\"100\" align=\"center\" valign=\"middle\" style=\"padding:0px 0px 0px 0px;\"> " . $title . "&nbsp;" . $year . " </td>\r\n                    <td width=\"8\" height=\"5\" align=\"center\" valign=\"middle\">" . $Nextnavigation . "</td>\r\n                    <td align=\"right\" valign=\"middle\">";
    $requestReport = new request_reports($config);
    $requestReport->config = $config;
    $requestReport->showDivisionDropDown();
    $myDivID = $requestReport->divisionID;
    //echo 'Show for division:
    //<select name="divisionID" onchange="this.form.submit()">';
    //            if(isset($_POST['divisionID'])){
    //                $myDivID = $_POST['divisionID'];
    //            }
    //            else{
    //                if($admin >= 50){
    //                    $myDivID = "All";
    //                }
    //                else{
    //                    $mydivq = "SELECT DIVISIONID FROM EMPLOYEE E WHERE E.IDNUM='" . $_SESSION['userIDnum']."'";
    //                    $myDivResult = $mysqli->query($mydivq);
    //                    SQLerrorCatch($mysqli, $myDivResult);
    //                    $temp = $myDivResult->fetch_assoc();
    //                    $myDivID = $temp['DIVISIONID'];
    //                }
    //            }
    //
    //            $alldivq = "SELECT * FROM `DIVISION` WHERE 1";
    //            $allDivResult = $mysqli->query($alldivq);
    //            SQLerrorCatch($mysqli, $allDivResult);
    //            while($Divrow = $allDivResult->fetch_assoc()) {
    //                echo '<option value="'.$Divrow['DIVISIONID'].'"';
    //                if($Divrow['DIVISIONID']==$myDivID)
    //                    echo ' SELECTED ';
    //                echo '>'.$Divrow['DESCR'].'</option>';
    //            }
    //            if(isset($_POST['divisionID'])){
    //                if($myDivID == "All")
    //                    echo '<option value="All" SELECTED>All</option>';
    //                else
    //                    echo '<option value="All">All</option>';
    //            }
    //            else
    //                echo '<option value="All">All</option>';
    //            echo '</select></form></div>';
    echo "      </td>\r\n                </tr>\r\n            </form></table></td>";
    $myq = "SELECT COUNT(REQUEST.REFER) AS 'RequestNumbers',\r\n                IF(REQUEST.TIMETYPEID IS NULL, SUB.DESCR, OLDT.DESCR) 'Subtype',\r\n                DATE_FORMAT(USEDATE,'%d') 'Used'\r\n            FROM REQUEST  \r\n            LEFT JOIN EMPLOYEE AS REQ ON REQ.IDNUM=REQUEST.IDNUM\r\n            LEFT JOIN TIMETYPE AS OLDT ON OLDT.TIMETYPEID = REQUEST.TIMETYPEID\r\n            LEFT JOIN SUBTYPE AS OLDSUB ON OLDSUB.IDNUM=REQUEST.SUBTYPE\r\n            LEFT JOIN WTS_TIMETYPES AS T ON T.IDNUM=REQUEST.TIMETYPES_ID\r\n            LEFT JOIN WTS_SUBTIMETYPES AS SUB ON SUB.IDNUM=REQUEST.SUBTYPE_ID\r\n\r\n            WHERE 1 " . $requestReport->filters . "\r\n                AND DATE_FORMAT(USEDATE,'%m-%Y') = '" . date('m-Y', mktime(0, 0, 0, $month, 1, $year)) . "'\r\n                AND REQUEST.STATUS = 'APPROVED'\r\n            GROUP BY REQUEST.USEDATE, IF(REQUEST.TIMETYPEID IS NULL, SUB.IDNUM, NEWTYPE_ID)\r\n            ORDER BY REQUEST.USEDATE";
    //                }
    $result = $mysqli->query($myq);
    SQLerrorCatch($mysqli, $result, $myq, $debug = false);
    echo "</th></tr>";
    echo "<tr><td align=\"center\" width=102>Sunday</td>\r\n                <td align=\"center\" width=102>Monday</td>\r\n                <td align=\"center\" width=102>Tuesday</td>\r\n                <td align=\"center\" width=102>Wednesday</td>\r\n                <td align=\"center\" width=102>Thurday</td>\r\n                <td align=\"center\" width=102>Friday</td>\r\n                <td align=\"center\" width=102>Saturday</td>\r\n            </tr>";
    //This counts the days in the week, up to 7
    $day_count = 1;
    $blank = $day_of_first_day;
    echo "<tr height='25'>";
    //first we take care of those blank days
    while ($blank > 0) {
        echo "<td ></td>";
        $blank = $blank - 1;
        $day_count++;
    }
    //sets the first day of the month to 1
    $day_num = "01";
    //        $timetype[0] = "OT";
    //        $timetype[1] = "SK";
    //        $timetype[2] = "PR";
    //        $timetype[3] = "VA";
    //        $timetype[4] = "5";//overtime
    //        $timetype[5] = "6";//overtime
    //        $timetype[6] = "3";//sick
    //        $timetype[7] = "2";//personal
    //        $timetype[8] = "1";//vacation
    //count up the days, untill we've done all of them in the month
    while ($day_num <= $days_in_month) {
        //            for($i=0;$i<count($timetype);$i++){
        //                if($myDivID == "All"){
        //                    $myq = "SELECT `REFER` , `IDNUM` , `TIMETYPEID` , `USEDATE` , `STATUS`
        //                        FROM `REQUEST`
        //                        WHERE `TIMETYPEID` = '".$timetype[$i]."'
        //                        AND USEDATE = '".$year."-".$month."-".$day_num."'
        //                        AND `STATUS` = 'APPROVED'";
        //                }
        //                else{
        echo "<td height='100' valign = \"top\" align=\"center\"><div style=\"background-color:grey\">";
        echo '<form name="goToDetails" method="POST" action="?submittedRequestsNEW=true&cust=true">
                <input type="hidden" name="divisionID" value="' . $myDivID . '" />
                <input type="hidden" name="customDate" value="true" />
                <input name="start" type="hidden" value="' . $month . '/' . $day_num . '/' . $year . '" />
                <input name="end" type="hidden" value="' . $month . '/' . $day_num . '/' . $year . '" />
                <input type="submit" name="goToDetails" value="' . $day_num . '" /></form></div>';
        $overTime = 0;
        $sick = 0;
        $personal = 0;
        $vacation = 0;
        $result->data_seek(0);
        while ($row = $result->fetch_assoc()) {
            //popupmessage($row['Used'].' day '. $day_num);
            if ($row['Used'] == $day_num) {
                echo $row['Subtype'] . ': ' . $row['RequestNumbers'] . '<br/>';
            }
        }
        //                if($i == 0)
        //                    $overTime = $result->num_rows;
        //                if($i == 1)
        //                    $sick = $result->num_rows;
        //                if($i == 2)
        //                    $personal = $result->num_rows;
        //                if($i == 3)
        //                    $vacation = $result->num_rows;
        //            }
        if ($overTime > 0) {
            echo 'Overtime: ' . $overTime . '<br/>';
        }
        if ($sick > 0) {
            echo 'Sick: ' . $sick . '<br/>';
        }
        if ($personal > 0) {
            echo 'Personal: ' . $personal . '<br/>';
        }
        if ($vacation > 0) {
            echo 'Vacation: ' . $vacation . '<br/>';
        }
        echo "<div>";
        $day_count++;
        //Make sure we start a new row every week
        if ($day_count > 7) {
            echo "</tr><tr  height='25'>";
            $day_count = 1;
        }
        $day_num++;
        if (strlen((string) $day_num) == 1) {
            $day_num = "0" . (string) $day_num;
        }
    }
    //Finaly we finish out the table with some blank details if needed
    while ($day_count > 2 && $day_count <= 7) {
        echo "<td> </td>";
        $day_count++;
    }
    echo "</tr></table></div>";
}
示例#3
0
function hrPayrolReportByEmployee($config)
{
    //    Get Post Vars
    $viewBtn = false;
    $showAllStatus = isset($_POST['showAllStatus']) ? true : false;
    $hrReportTotalRows = isset($_POST['hrReportTotalRows']) ? $_POST['hrReportTotalRows'] : 0;
    if ($hrReportTotalRows > 0) {
        for ($i = 0; $i <= $hrReportTotalRows; $i++) {
            if (isset($_POST['viewDetailsBtn' . $i])) {
                $empID = $_POST['empID' . $i];
                $viewBtn = true;
                break;
            }
        }
    }
    if (isset($_POST['backBtn'])) {
        $viewBtn = false;
    }
    $requests = new request_class();
    $timeReport = new request_reports($config);
    $timeReport->showTimeRequestFilterOptions($showCustomDates = true, $showPayPeriods = true, $showDivisions = true);
    if ($viewBtn) {
        $hiddenInputs = '<input type="hidden" name="hrReportTotalRows" value="1" />
                <input type="hidden" name="viewDetailsBtn0" value="true" />
                <input type="hidden" name="empID0" value="' . $empID . '" />';
        echo $hiddenInputs;
        echo '<div align="center">';
        if ($showAllStatus) {
            echo '<input type="submit" name="showNormalStatus" value="Remove Pending Status" />';
        } else {
            $timeReport->filters .= " AND (STATUS = 'APPROVED' OR STATUS = 'DENIED')";
            echo '<input type="submit" name="showAllStatus" value="Include Pending Status" />';
        }
        //echo '<div align="center"><a href="'.$_SERVER['REQUEST_URI'].'">Back</a></div>';
        //            echo '<form method="POST">';
        echo ' <input type="submit" name="backBtn" value="Back To Employee Counts" /></div><Br/>';
        $hiddenInputs .= '<input type="hidden" name="viewDetailsBtn" value="true" />';
        $timeReport->filters .= $timeReport->db->getTimeRequestFiltersByEmpID($empID);
        $requests->showTimeRequestTable($config, $timeReport->filters, $orderBy = "ORDER BY REFER DESC", $hiddenInputs);
        //empTimeReportByPay($config, $startDate, $endDate, $empID);
    } else {
        $timeReport->filters .= " AND (STATUS = 'APPROVED' OR STATUS = 'DENIED')";
        $filters = $timeReport->filters;
        $filters .= $timeReport->db->getFilterHRStatus('0');
        $timeReport->db->filters = $filters;
        $result = $timeReport->db->getHRTimeRequestCountsByEmp();
        $theTable = array(array());
        $x = 0;
        $theTable[$x][0] = "View";
        $theTable[$x][1] = "Munis #";
        $theTable[$x][2] = "Employee";
        $theTable[$x][3] = "Number of Requests";
        $lastUser = '';
        $lastUserRow = 0;
        $rowCount = 0;
        while ($row = $result->fetch_assoc()) {
            $x++;
            $recordCounter = 1;
            $lastUser = $row['Name'];
            $theTable[$x][0] = '<input type="submit" name="viewDetailsBtn' . $rowCount . '" value="View" />
                        <input type="hidden" name="empID' . $rowCount . '" value="' . $row['EMP_ID'] . '" />
                        ';
            $theTable[$x][1] = $row['Munis'];
            $theTable[$x][2] = $lastUser;
            $theTable[$x][3] = $row['ReqNumbers'];
            $rowCount++;
        }
        //end While loop
        echo '<h3>Pending HR Approval</h3>';
        showSortableTable($theTable, 2, "hrPending");
        $filters = $timeReport->filters;
        $filters .= $timeReport->db->getFilterHRStatus('1');
        $timeReport->db->filters = $filters;
        $result = $timeReport->db->getHRTimeRequestCountsByEmp();
        $theTable = array(array());
        $x = 0;
        $theTable[$x][0] = "View";
        $theTable[$x][1] = "Munis #";
        $theTable[$x][2] = "Employee";
        $theTable[$x][3] = "Number of Requests";
        $lastUser = '';
        $lastUserRow = 0;
        $recordCounter = 0;
        while ($row = $result->fetch_assoc()) {
            $x++;
            $recordCounter = 1;
            $lastUser = $row['Name'];
            $theTable[$x][0] = '<input type="submit" name="viewDetailsBtn' . $rowCount . '" value="View" />
                        <input type="hidden" name="empID' . $rowCount . '" value="' . $row['EMP_ID'] . '" />
                        ';
            $theTable[$x][1] = $row['Munis'];
            $theTable[$x][2] = $lastUser;
            $theTable[$x][3] = $row['ReqNumbers'];
            $rowCount++;
        }
        //end While loop
        //echo 'number of rows: '.$x;
        echo '<h3>HR Approvals</h3>';
        showSortableTable($theTable, 2, "hrApprove");
        echo '<input type="hidden" name="hrReportTotalRows" value="' . $rowCount . '" />';
    }
    //show a print button. printed look defined by print.css
    //    echo '<a href="javascript:window.print()">Print</a>';
}