function createUserWage($user_id, $rate, $effective_date, $wage_group_id = 0)
 {
     $uwf = new UserWageFactory();
     $uwf->setUser($user_id);
     $uwf->setWageGroup($wage_group_id);
     $uwf->setType(10);
     $uwf->setWage($rate);
     //$uwf->setWeeklyTime( TTDate::parseTimeUnit( $wage_data['weekly_time'] ) );
     $uwf->setEffectiveDate($effective_date);
     if ($uwf->isValid()) {
         $insert_id = $uwf->Save();
         Debug::Text('User Wage ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         return $insert_id;
     }
     Debug::Text('Failed Creating User Wage!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
Example #2
0
     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']));
         }
     }
     if (isset($mapped_row['labor_burden_percent']) and $mapped_row['labor_burden_percent'] != '') {
         $uwf->setLaborBurdenPercent(Misc::importCallInputParseFunction('labor_burden_percent', $mapped_row['labor_burden_percent'], $filtered_import_map['labor_burden_percent']['default_value'], $filtered_import_map['labor_burden_percent']['parse_hint']));
     }
     $uwf->setEffectiveDate($wage_effective_date);
     echo "Effective: " . TTDate::getDate('DATE', $wage_effective_date);
     unset($wage_effective_date);
     if ($uwf->isValid()) {
         $uwf->Save();
         echo " \t\t\tSuccess!\n";
     } else {
         echo " \t\t\tFailed!\n";
         $commit_trans = FALSE;
         $e++;
         $errors = $uwf->Validator->getErrorsArray();
         if (is_array($errors)) {
             foreach ($errors as $error_arr) {
                 echo "      ERROR: " . $error_arr[0] . "\n";
             }
         }
     }
 }
 if (isset($mapped_row['bank_account']) and $mapped_row['bank_account'] != '') {
     echo "    Importing User Bank Information...";