Ejemplo n.º 1
0
 public static function parseSaveData($postArr)
 {
     $hspArr = array();
     for ($i = 0; $i < count($postArr['txtHspId']); $i++) {
         $tmpHsp = new Hsp();
         if (!empty($postArr['txtHspId'][$i])) {
             $tmpHsp->setId($postArr['txtHspId'][$i]);
         }
         $tmpHsp->setEmployeeId($postArr['txtEmployeeId'][$i]);
         $tmpHsp->setHspValue($postArr['txtHspValue'][$i]);
         $tmpHsp->setEditedStatus($postArr['editedStatus'][$i]);
         if (isset($postArr['txtAmountPerDay'][$i])) {
             if ($postArr['txtAmountPerDay'][$i] != $postArr['initialAmountPerDay'][$i]) {
                 $tmpHsp->setEditedStatus(1);
             }
             $tmpHsp->setAmountPerDay($postArr['txtAmountPerDay'][$i]);
         }
         $editedStatus = $tmpHsp->getEditedStatus();
         if (isset($postArr['payDays'][$i]) && $editedStatus == 0) {
             $amountPerDay = ($postArr['txtHspValue'][$i] - $postArr['txtTotalAcrued'][$i]) / $postArr['payDays'][$i];
             $tmpHsp->setAmountPerDay($amountPerDay);
         } else {
             if (isset($postArr['txtAmountPerDay'][$i])) {
                 $tmpHsp->setAmountPerDay($postArr['txtAmountPerDay'][$i]);
             }
         }
         $tmpHsp->setTotalAcrued($postArr['txtTotalAcrued'][$i]);
         $hspArr[] = $tmpHsp;
     }
     return $hspArr;
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
 * Boston, MA  02110-1301, USA
 *
 */
ob_start();
session_start();
if (!defined('ROOT_PATH')) {
    define('ROOT_PATH', $_SESSION['path']);
}
require_once ROOT_PATH . '/lib/models/benefits/Hsp.php';
require_once ROOT_PATH . '/lib/models/benefits/mail/HspMailNotification.php';
try {
    $hspSummaryId = $_GET['hspSummaryId'];
    $newHspStatus = $_GET['newHspStatus'];
    $empId = $_GET['empId'];
    $hsp = new Hsp();
    $hsp->setEmployeeId($empId);
    $hsp->setSummaryId($hspSummaryId);
    $hsp->setHspPlanStatus($newHspStatus);
    $hspMailNotification = new HspMailNotification();
    if (Hsp::updateStatus($hspSummaryId, $newHspStatus)) {
        switch ($newHspStatus) {
            case Hsp::HSP_STATUS_HALTED:
                $hspMailNotification->sendHspPlanHaltedByHRAdminNotification($hsp);
                break;
            case Hsp::HSP_STATUS_ACTIVE:
                break;
            case Hsp::HSP_STATUS_ESS_HALTED:
                $hspMailNotification->sendHspPlanHaltedByHRAdminOnRequestNotification($hsp);
                break;
            case Hsp::HSP_STATUS_PENDING_HALT:
                $hspMailNotification->sendHspPlanHaltRequestedByESSNotification($hsp);
Ejemplo n.º 4
0
 private function _getHsp()
 {
     if ($this->hspId != null) {
         return;
     }
     $hsp = new Hsp();
     $hsp->setEmployeeId($this->getEmployeeId());
     $hsp->setAllotmentId($this->getAllotmentId());
     $hspArr = $hsp->fetchHsps();
     if (is_array($hspArr) && isset($hspArr[0])) {
         $this->hspId = $hspArr[0]->getId();
     } else {
         throw new HspPaymentRequestException("No hsp", HspPaymentRequestException::NO_HSP);
     }
 }