function getUserWageObject($user_wage_id)
{
    global $user_wage_obj;
    if (isset($user_wage_obj[$user_wage_id]) and is_object($user_wage_obj[$user_wage_id])) {
        return $user_wage_obj[$user_wage_id];
    } else {
        $uwlf = new UserWageListFactory();
        //This handles future wage changes properly.
        $uwlf->getByID($user_wage_id);
        if ($uwlf->getRecordCount() > 0) {
            $user_wage_obj[$user_wage_id] = $uwlf->getCurrent();
            return $user_wage_obj[$user_wage_id];
        }
        return FALSE;
    }
}
Beispiel #2
0
     $commit_trans = FALSE;
     $e++;
 } else {
     echo " \t\t\tSuccess!\n";
     if (isset($mapped_row['wage_type_id']) and $mapped_row['wage_type_id'] != '' and isset($mapped_row['wage']) and $mapped_row['wage'] != '') {
         echo "    Importing User Wage Information...";
         //Import Salary information
         if (isset($mapped_row['wage_effective_date'])) {
             $wage_effective_date = Misc::importCallInputParseFunction('wage_effective_date', $mapped_row['wage_effective_date'], $filtered_import_map['wage_effective_date']['default_value'], $filtered_import_map['wage_effective_date']['parse_hint']);
         } else {
             $wage_effective_date = $uf->getHireDate();
         }
         $uwlf = new UserWageListFactory();
         $uwlf->getByUserIdAndStartDateAndEndDate($user_id, $wage_effective_date, $wage_effective_date);
         if ($uwlf->getRecordCount() == 1) {
             $uwf = $uwlf->getCurrent();
             echo "(U) ";
         } else {
             $uwf = new UserWageFactory();
         }
         $uwf->setUser($user_id);
         if (isset($mapped_row['wage_type_id']) and $mapped_row['wage_type_id'] != '') {
             $uwf->setType(Misc::importCallInputParseFunction('wage_type_id', $mapped_row['wage_type_id'], $filtered_import_map['wage_type_id']['default_value'], $filtered_import_map['wage_type_id']['parse_hint']));
         }
         if (isset($mapped_row['wage']) and $mapped_row['wage'] != '') {
             $uwf->setWage(Misc::importCallInputParseFunction('wage', $mapped_row['wage'], $filtered_import_map['wage']['default_value'], $mapped_row['wage_type_id']));
         }
         if ($uwf->getType() == 20) {
             if (isset($mapped_row['wage_weekly_time']) and $mapped_row['wage_weekly_time'] != '') {
                 $uwf->setWeeklyTime(Misc::importCallInputParseFunction('wage_weekly_time', $mapped_row['wage_weekly_time'], $filtered_import_map['wage_weekly_time']['default_value'], $filtered_import_map['wage_weekly_time']['parse_hint']));
             }
Beispiel #3
0
 function getUserWageObject($user_wage_id)
 {
     if (isset($this->user_wage_obj[$user_wage_id]) and is_object($this->user_wage_obj[$user_wage_id])) {
         return $this->user_wage_obj[$user_wage_id];
     } else {
         $uwlf = new UserWageListFactory();
         $uwlf->getByID($user_wage_id);
         if ($uwlf->getRecordCount() > 0) {
             $this->user_wage_obj[$user_wage_id] = $uwlf->getCurrent();
             return $this->user_wage_obj[$user_wage_id];
         }
         return FALSE;
     }
 }
 function getUserHourlyRate($user_id, $date)
 {
     Debug::text('User ID: ' . $user_id . ' Date: ' . $date, __FILE__, __LINE__, __METHOD__, 10);
     if ($user_id == '') {
         return '0.00';
     }
     if ($date == '') {
         $date = TTDate::getTime();
     }
     $epoch = TTDate::parseDateTime($date);
     $uwlf = new UserWageListFactory();
     $uwlf->getByUserIdAndDate($user_id, $epoch);
     if ($uwlf->getRecordCount() > 0) {
         $hourly_rate = $uwlf->getCurrent()->getHourlyRate();
         return $hourly_rate;
     }
     return '0.00';
 }
 function isValidEffectiveDate($epoch)
 {
     //Check to see if this is the first default wage entry, or if we are editing the first record.
     if ($this->getWageGroup() != 0) {
         //If we aren't the default wage group, return valid always.
         return TRUE;
     }
     $must_validate = FALSE;
     $uwlf = new UserWageListFactory();
     $uwlf->getByUserIdAndGroupIDAndBeforeDate($this->getUser(), 0, $epoch);
     //Debug::text(' Total Rows: '. $uwlf->getRecordCount() .' User: '******' Epoch: '. $epoch , __FILE__, __LINE__, __METHOD__,10);
     if ($uwlf->getRecordCount() <= 1) {
         //If it returns one row, we need to check to see if the returned row is the current record.
         if ($uwlf->getRecordCount() == 0) {
             $must_validate = TRUE;
         } elseif ($uwlf->getRecordCount() == 1 and $this->isNew() == FALSE) {
             //Check to see if we are editing the current record.
             if (is_object($uwlf->getCurrent()) and $this->getId() == $uwlf->getCurrent()->getId()) {
                 $must_validate = TRUE;
             } else {
                 $must_validate = FALSE;
             }
         }
     }
     if ($must_validate == TRUE) {
         if (is_object($this->getUserObject()) and $this->getUserObject()->getHireDate() != '') {
             //User has hire date, make sure its before or equal to the first wage effective date.
             if ($epoch <= $this->getUserObject()->getHireDate()) {
                 return TRUE;
             } else {
                 return FALSE;
             }
         }
     }
     return TRUE;
 }