Example #1
0
                        	<A class=rollmenu href="lib/controllers/CentralController.php?benefitcode=Benefits&action=Hsp_Expenditures&year=<?php 
            echo date('Y');
            ?>
&employeeId=<?php 
            echo $_SESSION['empID'];
            ?>
" target="rightMenu"><?php 
            echo $lang_Benefits_HspExpenditures;
            ?>
</A>
                        </TD>
					 </TR>
					 <?php 
        }
    }
    if (Config::getHspCurrentPlan() > 0) {
        // Show only when Admin has defined a HSP paln (HSP not defined)
        if ($authorizeObj->isESS()) {
            ?>
					 <TR>
                        <TD onMouseOver="ypSlideOutMenu.showMenu('menu19')" onMouseOut="ypSlideOutMenu.hideMenu('menu19')" onClick="ypSlideOutMenu.hideMenu('menu19')" vAlign=center align=left width=142 height=17>
                        	<A class=rollmenu href="lib/controllers/CentralController.php?benefitcode=Benefits&action=Hsp_Request_Add_View" target="rightMenu"><?php 
            echo $lang_Benefits_HspRequest;
            ?>
</A>
                        </TD>
					 </TR>
					 <?php 
        }
        if ($authorizeObj->isESS()) {
            ?>
Example #2
0
 /**
  * For a give year, this function updates 'total_used' for all employees
  * based on current HSP Scheme and 'hsp_used_last_updated'
  */
 public static function updateUsed($year)
 {
     if (Config::getHspUsedLastUpdated() < date('Y-m-d')) {
         $selectTable = "`" . self::DB_TABLE_HSP_SUMMARY . "`";
         $selectFields[0] = "`" . self::DB_FIELD_SUMMARY_ID . "`";
         $selectFields[1] = "`" . self::DB_FIELD_EMPLOYEE_ID . "`";
         $selectFields[2] = "`" . self::DB_FIELD_HSP_PLAN_ID . "`";
         $selectFields[3] = "`" . self::DB_FIELD_TOTAL_USED . "`";
         $selectConditions[0] = "`" . self::DB_FIELD_HSP_PLAN_YEAR . "` = '" . $year . "'";
         $selectConditions[1] = self::_twoHspPlansCondition(Config::getHspCurrentPlan());
         $sqlBuilder = new SQLQBuilder();
         $query = $sqlBuilder->simpleSelect($selectTable, $selectFields, $selectConditions);
         $dbConnection = new DMLFunctions();
         $result = $dbConnection->executeQuery($query);
         $rowCount = $dbConnection->dbObject->numberOfRows($result);
         $hspUsedLastUpdated = Config::getHspUsedLastUpdated();
         for ($i = 0; $i < $rowCount; $i++) {
             $row = $dbConnection->dbObject->getArray($result);
             $updatedArray[$i][0] = $row[0];
             $updatedArray[$i][1] = $row[3] + HspPaymentRequest::calculateNewHspUsed($row[1], $row[2], $hspUsedLastUpdated);
         }
         for ($i = 0; $i < count($updatedArray); $i++) {
             $updateTable = "`" . self::DB_TABLE_HSP_SUMMARY . "`";
             $updateFields[0] = "`" . self::DB_FIELD_TOTAL_USED . "`";
             $updateValues[0] = "'" . $updatedArray[$i][1] . "'";
             $updateConditions[0] = "`" . self::DB_FIELD_SUMMARY_ID . "` = '" . $updatedArray[$i][0] . "'";
             $query = $sqlBuilder->simpleUpdate($updateTable, $updateFields, $updateValues, $updateConditions);
             $dbConnection->executeQuery($query);
         }
         Config::setHspUsedLastUpdated(date('Y-m-d'));
     }
 }
Example #3
0
 public static function fetchHsp($hspType = null)
 {
     return Config::getHspCurrentPlan();
 }
Example #4
0
 /**
  * This function get a database resource as the input and creates a HSP objects array
  * containing the data of the resource.
  */
 private static function _buildSummaryObjects($result)
 {
     $dbConnection = new DMLFunctions();
     $hspObjArr = null;
     while ($row = $dbConnection->dbObject->getArray($result)) {
         $hspObj = new Hsp();
         $empName = EmpInfo::getFullName($row[1]);
         if (isset($empName)) {
             // For excluding deleted employees
             $hspObj->setSummaryId($row[0]);
             $hspObj->setEmployeeId($row[1]);
             $hspObj->setHspPlanId($row[2]);
             $hspObj->setHspPlanName(DefineHsp::getHspPlanName($row[2]));
             $hspObj->setEmployeeName($empName);
             $hspObj->setHspPlanYear($row[3]);
             $hspObj->setHspPlanStatus($row[4]);
             $hspObj->setAnnualLimit($row[5]);
             $hspObj->setEmployerAmount($row[6]);
             $hspObj->setEmployeeAmount($row[7]);
             $hspObj->setTotalAccrued($row[8]);
             $hspObj->setTotalUsed($row[9]);
             $currentHspPlan = Config::getHspCurrentPlan();
             if ($currentHspPlan == 3 || $currentHspPlan == 4 || $currentHspPlan == 5) {
                 // If FSA is avaialbe in current plan
                 if ($row[2] == 3) {
                     $hspObj->setFsaBalance(self::_fetchLastYearFsaBalance($row[1], $row[3] - 1));
                 } else {
                     $hspObj->setFsaBalance("NA");
                 }
             }
             $hspObjArr[] = $hspObj;
         }
     }
     return $hspObjArr;
 }
    $hspSummary = $records[1];
    $year = $records[2];
    if (isset($records[5])) {
        $saveSuccess = $records[5];
    }
    if ($records[0] == "searchHspSummary") {
        $oneEmployee = true;
    }
    if (isset($_SESSION['isAdmin']) && $_SESSION['isAdmin'] == "Yes") {
        $adminUser = true;
    } else {
        $adminUser = false;
    }
    // If FSA is avilabe and date is belwo March 15th
    $showFsaBalance = false;
    $currentHspPlan = Config::getHspCurrentPlan();
    if ($currentHspPlan == 3 || $currentHspPlan == 4 || $currentHspPlan == 5) {
        // If FSA is avaialbe in current plan
        $fsaEndDate = date('Y') . "-03-15";
        $currentDate = date('Y-m-d');
        if ($currentDate <= $fsaEndDate) {
            $showFsaBalance = true;
        }
    }
    ?>
<style>
#employeeSearchAC {
    width:15em; /* set width here */
    padding-bottom:2em;
    position:relative;
    top:-10px
Example #6
0
 *
 * OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA
 *
 */
?>

<?php 
$plans = array(null, $lang_Hsp_Key_Hsa, $lang_Hsp_Key_Hra, $lang_Hsp_Key_Fsa, $lang_Hsp_Key_Hsa_Fsa, $lang_Hsp_Key_Hra_Fsa, $lang_Hsp_Key_Hsa_Hra);
$checked = array(null, '', '', '', '', '', '');
$hspDefined = Config::getHspCurrentPlan();
$checked["{$hspDefined}"] = 'checked';
if (!isset($_REQUEST['message'])) {
    if ($hspDefined != '0') {
        echo "<font color='#006600'><b>{$plans[$hspDefined]}</b> {$lang_Defined_Hsp}.</font>";
    } else {
        echo "<font color='#FF0000'>{$lang_Hsp_No_HSP_defined}.</font>";
    }
} else {
    if ($_REQUEST['message'] == "SAVE_SUCCESS") {
        echo "<font color ='#006600'>{$lang_Hsp_Succesfully_Saved}. {$lang_Hsp_Current_HSP_is} <b>{$plans[$hspDefined]}</b></font>";
    }
    if ($_REQUEST['message'] == "SAVE_FAILIURE") {
        echo "<font color ='red'>{$lang_Hsp_Saving_Error}</font>";
        $checked[1] = 'checked';
    }
Example #7
0
 /**
  * For searching HSP Summary for an employee
  */
 public static function searchHspSummary($empId, $year, $saveSuccess = null)
 {
     $errorFlag = false;
     //Checking whether records exist for $year
     try {
         if (!HspSummary::recordsExist($year)) {
             switch (Config::getHspCurrentPlan()) {
                 case 1:
                     self::_saveInitialRecords($year, 1);
                     break;
                 case 2:
                     self::_saveInitialRecords($year, 2);
                     break;
                 case 3:
                     self::_saveInitialRecords($year, 3);
                     break;
                 case 4:
                     self::_saveInitialRecords($year, 1);
                     self::_saveInitialRecords($year, 3);
                     break;
                 case 5:
                     self::_saveInitialRecords($year, 2);
                     self::_saveInitialRecords($year, 3);
                     break;
                 case 6:
                     self::_saveInitialRecords($year, 1);
                     self::_saveInitialRecords($year, 2);
                     break;
             }
         }
     } catch (HspSummaryException $e) {
         if ($e->getCode() == HspSummaryException::HSP_PLAN_NOT_DEFINED) {
             $errorFlag = true;
         }
     }
     // Setting template path
     $path = "/templates/benefits/hspSummary.php";
     if ($errorFlag) {
         $error['hspNotDefinedESS'] = true;
         $template = new TemplateMerger($error, $path);
         $template->setError(true);
     } else {
         // Setting the Page No
         if (isset($_POST['pageNo'])) {
             $pageNo = $_POST['pageNo'];
         } else {
             $pageNo = 1;
         }
         // Setting records that are used in /templates/benefits/hspSummary.php
         $tmpOb[0] = "searchHspSummary";
         $tmpOb[1] = HspSummary::fetchHspSummary($year, 1, $empId);
         $tmpOb[2] = $year;
         $tmpOb[3] = $pageNo;
         $tmpOb[4] = HspSummary::recordsCount($year, Config::getHspCurrentPlan());
         if (isset($saveSuccess)) {
             $tmpOb[5] = $saveSuccess;
         } else {
             $tmpOb[5] = null;
         }
         $tmpOb[6] = EmpInfo::getEmployeeMainDetails();
         $tmpOb[7] = HspSummary::getYears();
         $template = new TemplateMerger($tmpOb, $path);
     }
     // Displaying
     $template->display();
 }