//Get departments $dlf = new DepartmentListFactory(); $dlf->getByCompanyId($current_company->getId()); $department_options = Misc::prependArray($all_array_option, $dlf->getArrayByListFactory($dlf, FALSE, TRUE)); $filter_data['src_department_options'] = Misc::arrayDiffByKey((array) $filter_data['department_ids'], $department_options); $filter_data['selected_department_options'] = Misc::arrayIntersectByKey((array) $filter_data['department_ids'], $department_options); //Get employee titles $utlf = new UserTitleListFactory(); $utlf->getByCompanyId($current_company->getId()); $user_title_options = Misc::prependArray($all_array_option, $utlf->getArrayByListFactory($utlf, FALSE, TRUE)); $filter_data['src_user_title_options'] = Misc::arrayDiffByKey((array) $filter_data['user_title_ids'], $user_title_options); $filter_data['selected_user_title_options'] = Misc::arrayIntersectByKey((array) $filter_data['user_title_ids'], $user_title_options); //Get pay periods $pplf = new PayPeriodListFactory(); $pplf->getByCompanyId($current_company->getId()); $pay_period_options = Misc::prependArray($all_array_option, $pplf->getArrayByListFactory($pplf, FALSE, TRUE)); $filter_data['src_pay_period_options'] = Misc::arrayDiffByKey((array) $filter_data['pay_period_ids'], $pay_period_options); $filter_data['selected_pay_period_options'] = Misc::arrayIntersectByKey((array) $filter_data['pay_period_ids'], $pay_period_options); //Get currencies $crlf = new CurrencyListFactory(); $crlf->getByCompanyId($current_company->getId()); $currency_options = Misc::prependArray($all_array_option, $crlf->getArrayByListFactory($crlf, FALSE, TRUE)); $filter_data['src_currency_options'] = Misc::arrayDiffByKey((array) $filter_data['currency_ids'], $currency_options); $filter_data['selected_currency_options'] = Misc::arrayIntersectByKey((array) $filter_data['currency_ids'], $currency_options); //Get column list $filter_data['src_column_options'] = Misc::arrayDiffByKey((array) $filter_data['column_ids'], $columns); $filter_data['selected_column_options'] = Misc::arrayIntersectByKey((array) $filter_data['column_ids'], $columns); //Get primary/secondary order list $filter_data['sort_options'] = $columns; //$filter_data['sort_options']['effective_date_order'] = 'Wage Effective Date'; unset($filter_data['sort_options']['effective_date']);
$ulf = new UserListFactory(); $plf = new PunchListFactory(); $hlf = new HierarchyListFactory(); $permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId()); //Debug::Arr($permission_children_ids,'Permission Children Ids:', __FILE__, __LINE__, __METHOD__,10); if ($permission->Check('punch', 'view') == FALSE) { if ($permission->Check('punch', 'view_child')) { $filter_data['permission_children_ids'] = $permission_children_ids; } if ($permission->Check('punch', 'view_own')) { $filter_data['permission_children_ids'][] = $current_user->getId(); } } $pplf = new PayPeriodListFactory(); $pplf->getByCompanyId($current_company->getId()); $pay_period_options = $pplf->getArrayByListFactory($pplf, FALSE, FALSE); $pay_period_ids = array_keys((array) $pay_period_options); if (isset($pay_period_ids[0]) and (!isset($filter_data['pay_period_ids']) or $filter_data['pay_period_ids'] == '')) { $filter_data['pay_period_ids'] = '-1'; } //Order In punches before Out punches. $sort_array = Misc::prependArray($sort_array, array('c.pay_period_id' => 'asc', 'c.user_id' => 'asc', 'a.time_stamp' => 'asc', 'a.punch_control_id' => 'asc', 'a.status_id' => 'desc')); $plf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data, $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array); $pager = new Pager($plf); $punch_status_options = $plf->getOptions('status'); $punch_type_options = $plf->getOptions('type'); $utlf = new UserTitleListFactory(); $utlf->getByCompanyId($current_company->getId()); $title_options = $utlf->getArrayByListFactory($utlf, FALSE, TRUE); $blf = new BranchListFactory(); $blf->getByCompanyId($current_company->getId());