Exemplo n.º 1
0
     $user_default_department = NULL;
     $pay_period_is_locked = FALSE;
     $time_stamp = $start_date_stamp = $end_date_stamp = TTDate::getBeginDayEpoch(TTDate::getTime()) + 3600 * 12;
     //Noon
     $data = array('start_date_stamp' => $start_date_stamp, 'end_date_stamp' => $end_date_stamp, 'start_time' => strtotime('08:00 AM'), 'parsed_start_time' => strtotime('08:00 AM'), 'end_time' => strtotime('05:00 PM'), 'parsed_end_time' => strtotime('05:00 PM'), 'total_time' => 3600 * 9, 'branch_id' => $user_default_branch, 'department_id' => $user_default_department, 'dow' => array(1 => TRUE, 2 => TRUE, 3 => TRUE, 4 => TRUE, 5 => TRUE));
 }
 //var_dump($data);
 $ulf = new UserListFactory();
 $ulf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data);
 $src_user_options = UserListFactory::getArrayByListFactory($ulf, FALSE, FALSE);
 $user_options = Misc::arrayDiffByKey((array) $filter_user_id, $src_user_options);
 $filter_user_options = Misc::arrayIntersectByKey((array) $filter_user_id, $src_user_options);
 $prepend_array_option = array(0 => '--', -1 => TTi18n::gettext('-- Default --'));
 $splf = new SchedulePolicyListFactory();
 $schedule_policy_options = $splf->getByCompanyIdArray($current_company->getId());
 $aplf = new AbsencePolicyListFactory();
 $absence_policy_options = $aplf->getByCompanyIdArray($current_company->getId());
 $blf = new BranchListFactory();
 $blf->getByCompanyId($current_company->getId());
 $branch_options = Misc::prependArray($prepend_array_option, $blf->getArrayByListFactory($blf, FALSE, TRUE));
 $dlf = new DepartmentListFactory();
 $dlf->getByCompanyId($current_company->getId());
 $department_options = Misc::prependArray($prepend_array_option, $dlf->getArrayByListFactory($dlf, FALSE, TRUE));
 if ($current_company->getProductEdition() == 20) {
     $jlf = new JobListFactory();
     $jlf->getByStatusIdAndCompanyId(array(10, 20, 30, 40), $current_company->getId());
     //$jlf->getByCompanyIdAndUserIdAndStatus( $current_company->getId(),  $data['user_id'], array(10,20,30,40) );
     $data['job_options'] = $jlf->getArrayByListFactory($jlf, TRUE, TRUE);
     $data['job_manual_id_options'] = $jlf->getManualIDArrayByListFactory($jlf, TRUE);
     $jilf = new JobItemListFactory();
     $jilf->getByCompanyId($current_company->getId());
 function setAbsencePolicyID($id)
 {
     $id = trim($id);
     if ($id == '' or empty($id)) {
         $id = 0;
     }
     $aplf = new AbsencePolicyListFactory();
     if ($id == 0 or $this->Validator->isResultSetWithRows('absence_policy_id', $aplf->getByID($id), TTi18n::gettext('Absence Policy is invalid'))) {
         $this->data['absence_policy_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
Exemplo n.º 3
0
     break;
 default:
     if ((!isset($user_date_id) or isset($user_date_id) and $user_date_id == '') and $user_id != '' and $filter_date != '') {
         Debug::Text('User Date ID not passed, inserting one.', __FILE__, __LINE__, __METHOD__, 10);
         $user_date_id = UserDateFactory::findOrInsertUserDate($user_id, $filter_date);
     }
     if ($user_date_id != '') {
         $udtlf = new UserDateTotalListFactory();
         $udtlf->getByUserDateIDAndStatusAndType($user_date_id, array(10, 20, 30), array(10, 20, 30, 40, 100), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);
         $pager = new Pager($udtlf);
         $blf = new BranchListFactory();
         $branch_options = $blf->getByCompanyIdArray($current_company->getId());
         $dlf = new DepartmentListFactory();
         $department_options = $dlf->getByCompanyIdArray($current_company->getId());
         //Absence policies
         $otplf = new AbsencePolicyListFactory();
         $absence_policy_options = $otplf->getByCompanyIDArray($current_company->getId(), TRUE);
         //Overtime policies
         $otplf = new OverTimePolicyListFactory();
         $over_time_policy_options = $otplf->getByCompanyIDArray($current_company->getId(), TRUE);
         //Premium policies
         $pplf = new PremiumPolicyListFactory();
         $premium_policy_options = $pplf->getByCompanyIDArray($current_company->getId(), TRUE);
         $job_options = array();
         $job_item_options = array();
         if ($current_company->getProductEdition() == 20) {
             $jlf = new JobListFactory();
             $job_options = $jlf->getByCompanyIdArray($current_company->getId(), FALSE);
             $jilf = new JobItemListFactory();
             $job_item_options = $jilf->getByCompanyIdArray($current_company->getId(), TRUE);
         }
Exemplo n.º 4
0
            $delete = TRUE;
        } else {
            $delete = FALSE;
        }
        $aplf = new AbsencePolicyListFactory();
        foreach ($ids as $id) {
            $aplf->getByIdAndCompanyId($id, $current_company->getId());
            foreach ($aplf as $ap_obj) {
                $ap_obj->setDeleted($delete);
                if ($ap_obj->isValid()) {
                    $ap_obj->Save();
                }
            }
        }
        Redirect::Page(URLBuilder::getURL(NULL, 'AbsencePolicyList.php'));
        break;
    default:
        $aplf = new AbsencePolicyListFactory();
        $aplf->getByCompanyId($current_company->getId());
        $pager = new Pager($aplf);
        $type_options = $aplf->getOptions('type');
        foreach ($aplf as $ap_obj) {
            $policies[] = array('id' => $ap_obj->getId(), 'name' => $ap_obj->getName(), 'type_id' => $ap_obj->getType(), 'type' => $type_options[$ap_obj->getType()], 'deleted' => $ap_obj->getDeleted());
        }
        $smarty->assign_by_ref('policies', $policies);
        $smarty->assign_by_ref('sort_column', $sort_column);
        $smarty->assign_by_ref('sort_order', $sort_order);
        $smarty->assign_by_ref('paging_data', $pager->getPageVariables());
        break;
}
$smarty->display('policy/AbsencePolicyList.tpl');
 function getByCompanyIdArray($company_id, $include_blank = TRUE)
 {
     $aplf = new AbsencePolicyListFactory();
     $aplf->getByCompanyId($company_id);
     if ($include_blank == TRUE) {
         $list[0] = '--';
     }
     foreach ($aplf as $ap_obj) {
         $list[$ap_obj->getID()] = $ap_obj->getName();
     }
     if (isset($list)) {
         return $list;
     }
     return FALSE;
 }
Exemplo n.º 6
0
    foreach ($otplf as $otp_obj) {
        $otp_columns['over_time_policy-' . $otp_obj->getId()] = $otp_obj->getName();
    }
    $columns = array_merge($columns, $otp_columns);
}
//Get all Premium policies.
$pplf = new PremiumPolicyListFactory();
$pplf->getByCompanyId($current_company->getId());
if ($pplf->getRecordCount() > 0) {
    foreach ($pplf as $pp_obj) {
        $pp_columns['premium_policy-' . $pp_obj->getId()] = $pp_obj->getName();
    }
    $columns = array_merge($columns, $pp_columns);
}
//Get all Absence Policies.
$aplf = new AbsencePolicyListFactory();
$aplf->getByCompanyId($current_company->getId());
if ($aplf->getRecordCount() > 0) {
    foreach ($aplf as $ap_obj) {
        $ap_columns['absence_policy-' . $ap_obj->getId()] = $ap_obj->getName();
    }
    $columns = array_merge($columns, $ap_columns);
}
$default_start_date = TTDate::getBeginMonthEpoch();
$default_end_date = TTDate::getEndMonthEpoch();
//Get all pay periods
$pplf = new PayPeriodListFactory();
$pplf->getByCompanyId($current_company->getId());
if ($pplf->getRecordCount() > 0) {
    $pp = 0;
    foreach ($pplf as $pay_period_obj) {
Exemplo n.º 7
0
     }
     $hpf->FailTransaction();
 default:
     if (isset($id)) {
         BreadCrumb::setCrumb($title);
         $hplf = new HolidayPolicyListFactory();
         $hplf->getByIdAndCompanyID($id, $current_company->getID());
         foreach ($hplf as $hp_obj) {
             //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
             $data = array('id' => $hp_obj->getId(), 'name' => $hp_obj->getName(), 'type_id' => $hp_obj->getType(), 'default_schedule_status_id' => $hp_obj->getDefaultScheduleStatus(), 'minimum_employed_days' => $hp_obj->getMinimumEmployedDays(), 'minimum_worked_period_days' => $hp_obj->getMinimumWorkedPeriodDays(), 'minimum_worked_days' => $hp_obj->getMinimumWorkedDays(), 'worked_scheduled_days' => $hp_obj->getWorkedScheduledDays(), 'minimum_worked_after_period_days' => $hp_obj->getMinimumWorkedAfterPeriodDays(), 'minimum_worked_after_days' => $hp_obj->getMinimumWorkedAfterDays(), 'worked_after_scheduled_days' => $hp_obj->getWorkedAfterScheduledDays(), 'average_time_days' => $hp_obj->getAverageTimeDays(), 'average_time_worked_days' => $hp_obj->getAverageTimeWorkedDays(), 'force_over_time_policy' => $hp_obj->getForceOverTimePolicy(), 'include_over_time' => $hp_obj->getIncludeOverTime(), 'include_paid_absence_time' => $hp_obj->getIncludePaidAbsenceTime(), 'minimum_time' => $hp_obj->getMinimumTime(), 'maximum_time' => $hp_obj->getMaximumTime(), 'round_interval_policy_id' => $hp_obj->getRoundIntervalPolicyID(), 'absence_policy_id' => $hp_obj->getAbsencePolicyID(), 'recurring_holiday_ids' => $hp_obj->getRecurringHoliday(), 'created_date' => $hp_obj->getCreatedDate(), 'created_by' => $hp_obj->getCreatedBy(), 'updated_date' => $hp_obj->getUpdatedDate(), 'updated_by' => $hp_obj->getUpdatedBy(), 'deleted_date' => $hp_obj->getDeletedDate(), 'deleted_by' => $hp_obj->getDeletedBy());
         }
     } elseif ($action != 'submit') {
         //Defaults
         $data = array('default_schedule_status_id' => 20, 'minimum_employed_days' => 30, 'minimum_worked_period_days' => 30, 'minimum_worked_days' => 15, 'minimum_worked_after_period_days' => 0, 'minimum_worked_after_days' => 0, 'average_time_days' => 30, 'force_over_time_policy' => FALSE, 'include_over_time' => FALSE, 'include_paid_absence_time' => TRUE, 'minimum_time' => 0, 'maximum_time' => 0);
     }
     $aplf = new AbsencePolicyListFactory();
     $absence_options = $aplf->getByCompanyIDArray($current_company->getId(), TRUE);
     $riplf = new RoundIntervalPolicyListFactory();
     $round_interval_options = $riplf->getByCompanyIDArray($current_company->getId(), TRUE);
     $rhlf = new RecurringHolidayListFactory();
     $recurring_holiday_options = $rhlf->getByCompanyIDArray($current_company->getId(), TRUE);
     $sf = new ScheduleFactory();
     //Select box options;
     $data['type_options'] = $hpf->getOptions('type');
     $data['schedule_status_options'] = $sf->getOptions('status');
     $data['scheduled_day_options'] = $hpf->getOptions('scheduled_day');
     $data['absence_options'] = $absence_options;
     $data['round_interval_options'] = $round_interval_options;
     $data['recurring_holiday_options'] = $recurring_holiday_options;
     $smarty->assign_by_ref('data', $data);
     break;
Exemplo n.º 8
0
 function getAbsencePolicyBalance($absence_policy_id, $user_id)
 {
     global $current_company;
     if (!is_object($current_company)) {
         return FALSE;
     }
     $aplf = new AbsencePolicyListFactory();
     $aplf->getByIdAndCompanyId($absence_policy_id, $current_company->getId());
     if ($aplf->getRecordCount() > 0) {
         $ap_obj = $aplf->getCurrent();
         if ($ap_obj->getAccrualPolicyID() != '') {
             return $this->getAccrualBalance($ap_obj->getAccrualPolicyID(), $user_id);
         }
     }
     return FALSE;
 }
Exemplo n.º 9
0
            Debug::Text(' ID was passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
            $udtlf = new UserDateTotalListFactory();
            $udtlf->getById($id);
            foreach ($udtlf as $udt_obj) {
                //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
                $udt_data = array('id' => $udt_obj->getId(), 'user_date_id' => $udt_obj->getUserDateId(), 'date_stamp' => $udt_obj->getUserDateObject()->getDateStamp(), 'user_id' => $udt_obj->getUserDateObject()->getUser(), 'user_full_name' => $udt_obj->getUserDateObject()->getUserObject()->getFullName(), 'status_id' => $udt_obj->getStatus(), 'type_id' => $udt_obj->getType(), 'total_time' => $udt_obj->getTotalTime(), 'absence_policy_id' => $udt_obj->getAbsencePolicyID(), 'branch_id' => $udt_obj->getBranch(), 'department_id' => $udt_obj->getDepartment(), 'override' => $udt_obj->getOverride(), 'created_date' => $udt_obj->getCreatedDate(), 'created_by' => $udt_obj->getCreatedBy(), 'updated_date' => $udt_obj->getUpdatedDate(), 'updated_by' => $udt_obj->getUpdatedBy(), 'deleted_date' => $udt_obj->getDeletedDate(), 'deleted_by' => $udt_obj->getDeletedBy());
            }
        } elseif ($action != 'submit') {
            Debug::Text(' ID was NOT passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
            //Get user full name
            $ulf = new UserListFactory();
            $user_obj = $ulf->getById($user_id)->getCurrent();
            $user_date_id = UserDateFactory::getUserDateID($user_id, $date_stamp);
            $udt_data = array('user_id' => $user_id, 'date_stamp' => $date_stamp, 'user_date_id' => $user_date_id, 'user_full_name' => $user_obj->getFullName(), 'branch_id' => $user_obj->getDefaultBranch(), 'department_id' => $user_obj->getDefaultDepartment(), 'total_time' => 0, 'override' => TRUE);
        }
        $aplf = new AbsencePolicyListFactory();
        $absence_policy_options = Misc::prependArray(array(0 => TTi18n::gettext('-- Please Choose --')), $aplf->getByCompanyIdArray($current_company->getId()));
        $blf = new BranchListFactory();
        $branch_options = $blf->getByCompanyIdArray($current_company->getId());
        $dlf = new DepartmentListFactory();
        $department_options = $dlf->getByCompanyIdArray($current_company->getId());
        //Select box options;
        //$udt_data['status_options'] = $udtf->getOptions('status');
        //$udt_data['type_options'] = $udtf->getOptions('type');
        $udt_data['absence_policy_options'] = $absence_policy_options;
        $udt_data['branch_options'] = $branch_options;
        $udt_data['department_options'] = $department_options;
        $smarty->assign_by_ref('udt_data', $udt_data);
        break;
}
$smarty->assign_by_ref('udtf', $udtf);
Exemplo n.º 10
0
     $uwlf = new UserWageListFactory();
     $uwlf->getByUserIdAndCompanyIdAndStartDateAndEndDate($filter_data['user_ids'], $current_company->getId(), $filter_data['start_date'], $filter_data['end_date']);
     if ($uwlf->getRecordCount() > 0) {
         foreach ($uwlf as $uw_obj) {
             $user_wage_rows[$uw_obj->getUser()][] = array('type_id' => $uw_obj->getType(), 'type' => Option::getByKey($uw_obj->getType(), $uw_obj->getOptions('type')), 'wage' => $uw_obj->getWage(), 'currency_symbol' => $uw_obj->getUserObject()->getCurrencyObject()->getSymbol(), 'effective_date' => $uw_obj->getEffectiveDate(), 'effective_date_since' => TTDate::getHumanTimeSince($uw_obj->getEffectiveDate()));
         }
     }
 }
 /*
 	Get Attendance History
 */
 if (isset($columns['attendance'])) {
     //Get policy names.
     $oplf = new OverTimePolicyListFactory();
     $over_time_policy_arr = $oplf->getByCompanyIdArray($current_company->getId(), FALSE);
     $aplf = new AbsencePolicyListFactory();
     $absence_policy_arr = $aplf->getByCompanyIdArray($current_company->getId(), FALSE);
     $pplf = new PremiumPolicyListFactory();
     $premium_policy_arr = $pplf->getByCompanyIdArray($current_company->getId(), FALSE);
     //Get stats on number of days worked per month/week
     $udlf = new UserDateListFactory();
     $udlf->getDaysWorkedByTimePeriodAndUserIdAndCompanyIdAndStartDateAndEndDate('month', $filter_data['user_ids'], $current_company->getId(), $filter_data['start_date'], $filter_data['end_date']);
     if ($udlf->getRecordCount() > 0) {
         foreach ($udlf as $ud_obj) {
             //$user_days_worked[$ud_obj->getUser()]['month']
             $user_attendance_rows[$ud_obj->getUser()]['days_worked']['month'] = array('avg' => round($ud_obj->getColumn('avg'), 2), 'min' => $ud_obj->getColumn('min'), 'max' => $ud_obj->getColumn('max'));
         }
     }
     $udlf->getDaysWorkedByTimePeriodAndUserIdAndCompanyIdAndStartDateAndEndDate('week', $filter_data['user_ids'], $current_company->getId(), $filter_data['start_date'], $filter_data['end_date']);
     if ($udlf->getRecordCount() > 0) {
         foreach ($udlf as $ud_obj) {
Exemplo n.º 11
0
     $apf->setName($data['name']);
     $apf->setType($data['type_id']);
     $apf->setRate($data['rate']);
     $apf->setWageGroup($data['wage_group_id']);
     $apf->setAccrualRate($data['accrual_rate']);
     $apf->setAccrualPolicyID($data['accrual_policy_id']);
     $apf->setPayStubEntryAccountID($data['pay_stub_entry_account_id']);
     if ($apf->isValid()) {
         $apf->Save();
         Redirect::Page(URLBuilder::getURL(NULL, 'AbsencePolicyList.php'));
         break;
     }
 default:
     if (isset($id)) {
         BreadCrumb::setCrumb($title);
         $aplf = new AbsencePolicyListFactory();
         $aplf->getByIdAndCompanyID($id, $current_company->getId());
         foreach ($aplf as $ap_obj) {
             //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
             $data = array('id' => $ap_obj->getId(), 'name' => $ap_obj->getName(), 'type_id' => $ap_obj->getType(), 'rate' => Misc::removeTrailingZeros($ap_obj->getRate()), 'wage_group_id' => $ap_obj->getWageGroup(), 'accrual_rate' => Misc::removeTrailingZeros($ap_obj->getAccrualRate()), 'pay_stub_entry_account_id' => $ap_obj->getPayStubEntryAccountID(), 'accrual_policy_id' => $ap_obj->getAccrualPolicyID(), 'created_date' => $ap_obj->getCreatedDate(), 'created_by' => $ap_obj->getCreatedBy(), 'updated_date' => $ap_obj->getUpdatedDate(), 'updated_by' => $ap_obj->getUpdatedBy(), 'deleted_date' => $ap_obj->getDeletedDate(), 'deleted_by' => $ap_obj->getDeletedBy());
         }
     } else {
         $data = array('rate' => '1.00');
     }
     $aplf = new AccrualPolicyListFactory();
     $accrual_options = $aplf->getByCompanyIDArray($current_company->getId(), TRUE);
     $psealf = new PayStubEntryAccountListFactory();
     $pay_stub_entry_options = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 20, 30, 50));
     $wglf = new WageGroupListFactory();
     $data['wage_group_options'] = $wglf->getArrayByListFactory($wglf->getByCompanyId($current_company->getId()), TRUE);
     //Select box options;