function _getFactoryOptions($name, $parent = NULL) { $retval = NULL; switch ($name) { case 'columns': $retval = array('-1100-type' => TTi18n::gettext('Type'), '-1110-status' => TTi18n::gettext('Status'), '-1210-time_stamp' => TTi18n::gettext('Date/Time'), '-1220-date' => TTi18n::gettext('Date'), '-1230-time' => TTi18n::gettext('Time'), '-1239-in_type' => TTi18n::gettext('In Type'), '-1240-in_time_stamp' => TTi18n::gettext('In Date/Time'), '-1250-in_punch_date' => TTi18n::gettext('In Date'), '-1260-in_punch_time' => TTi18n::gettext('In Time'), '-1269-out_type' => TTi18n::gettext('Out Type'), '-1270-out_time_stamp' => TTi18n::gettext('Out Date/Time'), '-1280-out_punch_date' => TTi18n::gettext('Out Date'), '-1290-out_punch_time' => TTi18n::gettext('Out Time'), '-1310-branch' => TTi18n::gettext('Branch'), '-1320-department' => TTi18n::gettext('Department'), '-1410-station_id' => TTi18n::gettext('Station ID'), '-1420-longitude' => TTi18n::gettext('Longitude'), '-1430-latitude' => TTi18n::gettext('Latitude'), '-1500-note' => TTi18n::gettext('Note')); //Since getOptions() can be called without first setting a company, we don't always know the product edition for the currently //logged in employee. if (is_object($this->getCompanyObject()) and $this->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE or !is_object($this->getCompanyObject()) and getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $retval += array('-1330-job' => TTi18n::gettext('Job'), '-1340-job_item' => TTi18n::gettext('Task'), '-1350-quantity' => TTi18n::gettext('Quantity'), '-1360-bad_quantity' => TTi18n::gettext('Bad Quantity')); } $retval = Misc::addSortPrefix(Misc::prependArray($this->getUserIdentificationColumns(), Misc::trimSortPrefix($retval))); ksort($retval); break; case 'column_aliases': //Used for converting column names after they have been parsed. $retval = array('type' => 'type_id', 'status' => 'status_id', 'branch' => 'branch_id', 'department' => 'department_id', 'job' => 'job_id', 'job_item' => 'job_item_id'); break; case 'import_options': $retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'), '-1020-disable_rounding' => TTi18n::getText('Disable rounding.')); break; case 'parse_hint': $upf = TTnew('UserPreferenceFactory'); $retval = array('branch' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'department' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'job' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'job_item' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'time_stamp' => $upf->getOptions('date_time_format'), 'in_time_stamp' => $upf->getOptions('date_time_format'), 'out_time_stamp' => $upf->getOptions('date_time_format'), 'date' => $upf->getOptions('date_format'), 'in_punch_date' => $upf->getOptions('date_format'), 'out_punch_date' => $upf->getOptions('date_format'), 'time' => $upf->getOptions('time_format'), 'in_punch_time' => $upf->getOptions('time_format'), 'out_punch_time' => $upf->getOptions('time_format')); break; } return $retval; }
function _getFactoryOptions($name, $parent = NULL) { $retval = NULL; switch ($name) { case 'columns': global $current_company; $uf = TTNew('UserFactory'); $retval = Misc::trimSortPrefix($uf->getOptions('columns')); $retval['-1025-password'] = TTi18n::getText('Password'); $retval['-1026-phone_password'] = TTi18n::getText('Quick Punch Password'); $retval['-1099-group'] = isset($retval['-1099-user_group']) ? $retval['-1099-user_group'] : NULL; unset($retval['-1099-user_group']); ksort($retval); //Since getOptions() can be called without first setting a company, we don't always know the product edition for the currently //logged in employee. if (is_object($this->getCompanyObject()) and $this->getCompanyObject()->getProductEdition() < TT_PRODUCT_CORPORATE or !is_object($this->getCompanyObject()) and getTTProductEdition() < TT_PRODUCT_CORPORATE) { unset($retval['-1104-default_job'], $retval['-1105-default_job_item']); } if (is_object($current_company)) { //Get custom fields for import data. $oflf = TTnew('OtherFieldListFactory'); $other_field_names = $oflf->getByCompanyIdAndTypeIdArray($current_company->getID(), array(10), array(10 => '')); if (is_array($other_field_names)) { $retval = array_merge((array) $retval, (array) $other_field_names); } } Debug::Arr($retval, 'ImportUserColumns: ', __FILE__, __LINE__, __METHOD__, 10); break; case 'column_aliases': //Used for converting column names after they have been parsed. $retval = array('status' => 'status_id', 'default_branch' => 'default_branch_id', 'default_department' => 'default_department_id', 'default_job' => 'default_job_id', 'default_job_item' => 'default_job_item_id', 'title' => 'title_id', 'user_group' => 'group_id', 'group' => 'group_id', 'sex' => 'sex_id', 'permission_control' => 'permission_control_id', 'pay_period_schedule' => 'pay_period_schedule_id', 'policy_group' => 'policy_group_id', 'hierarchy_control_display' => 'hierarchy_control'); break; case 'import_options': $retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'), '-1015-update' => TTi18n::getText('Update existing records based on UserName, Employee Number, or SIN/SSN.'), '-1040-create_group' => TTi18n::getText('Create groups that don\'t already exist.'), '-1050-create_title' => TTi18n::getText('Create titles that don\'t already exist.')); break; case 'parse_hint': $upf = TTnew('UserPreferenceFactory'); $retval = array('default_branch' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'default_department' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'default_job' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'default_job_item' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'first_name' => array('-1010-first_name' => TTi18n::gettext('First Name'), '-1020-first_last_name' => TTi18n::gettext('FirstName LastName'), '-1030-last_first_name' => TTi18n::gettext('LastName, FirstName'), '-1040-last_first_middle_name' => TTi18n::gettext('LastName, FirstName MiddleInitial')), 'last_name' => array('-1010-last_name' => TTi18n::gettext('Last Name'), '-1020-first_last_name' => TTi18n::gettext('FirstName LastName'), '-1030-last_first_name' => TTi18n::gettext('LastName, FirstName'), '-1040-last_first_middle_name' => TTi18n::gettext('LastName, FirstName MiddleInitial')), 'middle_name' => array('-1010-middle_name' => TTi18n::gettext('Middle Name'), '-1040-last_first_middle_name' => TTi18n::gettext('LastName, FirstName MiddleInitial')), 'hire_date' => $upf->getOptions('date_format'), 'termination_date' => $upf->getOptions('date_format'), 'birth_date' => $upf->getOptions('date_format')); break; } return $retval; }
protected function _getOptions($name, $params = NULL) { $retval = NULL; switch ($name) { case 'output_format': $retval = parent::getOptions('default_output_format'); break; case 'default_setup_fields': $retval = array('template', 'time_period', 'columns'); break; case 'setup_fields': $retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2035-user_tag' => TTi18n::gettext('Employee Tags'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2080-schedule_branch_id' => TTi18n::gettext('Schedule Branch'), '-2090-schedule_department_id' => TTi18n::gettext('Schedule Department'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-3000-status_id' => TTi18n::gettext('Schedule Status'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By')); break; case 'time_period': $retval = TTDate::getTimePeriodOptions(); break; case 'date_columns': $retval = TTDate::getReportDateOptions(NULL, TTi18n::getText('Date'), 15, TRUE); break; case 'custom_columns': //Get custom fields for report data. $oflf = TTnew('OtherFieldListFactory'); //User and Punch fields conflict as they are merged together in a secondary process. $other_field_names = $oflf->getByCompanyIdAndTypeIdArray($this->getUserObject()->getCompany(), array(10), array(10 => '')); if (is_array($other_field_names)) { $retval = Misc::addSortPrefix($other_field_names, 9000); } break; case 'report_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); // Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns. // So just get custom columns with Selection and Formula. $custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'ScheduleSummaryReport', 'custom_column'); if (is_array($custom_column_labels)) { $retval = Misc::addSortPrefix($custom_column_labels, 9500); } } break; case 'report_custom_filters': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'ScheduleSummaryReport', 'custom_column'); } break; case 'report_dynamic_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'ScheduleSummaryReport', 'custom_column'); if (is_array($report_dynamic_custom_column_labels)) { $retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700); } } break; case 'report_static_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'ScheduleSummaryReport', 'custom_column'); if (is_array($report_static_custom_column_labels)) { $retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700); } } break; case 'formula_columns': $retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns'))); break; case 'filter_columns': $retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))); break; case 'static_columns': $retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1040-status' => TTi18n::gettext('Status'), '-1050-title' => TTi18n::gettext('Title'), '-1055-city' => TTi18n::gettext('City'), '-1060-province' => TTi18n::gettext('Province/State'), '-1070-country' => TTi18n::gettext('Country'), '-1080-user_group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Default Branch'), '-1100-default_department' => TTi18n::gettext('Default Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1200-permission_control' => TTi18n::gettext('Permission Group'), '-1210-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1220-policy_group' => TTi18n::gettext('Policy Group'), '-1290-note' => TTi18n::gettext('Employee Note'), '-1295-tag' => TTi18n::gettext('Tags'), '-1600-branch' => TTi18n::gettext('Branch'), '-1610-department' => TTi18n::gettext('Department'), '-1620-schedule_policy' => TTi18n::gettext('Schedule Policy'), '-1640-schedule_status' => TTi18n::gettext('Schedule Status'), '-1650-absence_policy' => TTi18n::gettext('Absence Policy'), '-1670-start_time' => TTi18n::gettext('Start Time'), '-1680-end_time' => TTi18n::gettext('End Time'), '-5000-schedule_note' => TTi18n::gettext('Note')); $retval = array_merge($retval, (array) $this->getOptions('date_columns'), (array) $this->getOptions('custom_columns'), (array) $this->getOptions('report_static_custom_column')); ksort($retval); break; case 'dynamic_columns': $retval = array('-2010-hourly_rate' => TTi18n::gettext('Hourly Rate'), '-2100-total_time' => TTi18n::gettext('Total Time'), '-2110-total_time_wage' => TTi18n::gettext('Total Time Wage'), '-2112-total_time_wage_burden' => TTi18n::gettext('Total Time Wage Burden'), '-2114-total_time_wage_with_burden' => TTi18n::gettext('Total Time Wage w/Burden'), '-4000-total_shift' => TTi18n::gettext('Total Shifts')); break; case 'columns': $retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')); break; case 'column_format': //Define formatting function for each column. $columns = $this->getOptions('columns'); if (is_array($columns)) { foreach ($columns as $column => $name) { if (strpos($column, 'absence_policy')) { //Ignore } elseif (strpos($column, 'start_time') !== FALSE or strpos($column, 'end_time') !== FALSE) { $retval[$column] = 'time'; } elseif (strpos($column, '_wage') !== FALSE or strpos($column, '_hourly_rate') !== FALSE or strpos($column, 'hourly_rate') !== FALSE) { $retval[$column] = 'currency'; } elseif (strpos($column, '_time') or strpos($column, '_policy')) { $retval[$column] = 'time_unit'; } } } break; case 'aggregates': $retval = array(); $dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')))); if (is_array($dynamic_columns)) { foreach ($dynamic_columns as $column) { switch ($column) { default: if (strpos($column, '_hourly_rate') !== FALSE or strpos($column, 'hourly_rate') !== FALSE) { $retval[$column] = 'avg'; } else { $retval[$column] = 'sum'; } } } } break; case 'templates': $retval = array('-1010-by_employee+work+total_time' => TTi18n::gettext('Work Time by Employee'), '-1020-by_employee+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Employee'), '-1030-by_title+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Title'), '-1110-by_date_by_full_name+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Date/Employee'), '-1120-by_full_name_by_date+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Employee/Date'), '-1210-by_branch+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Branch'), '-1220-by_department+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Department'), '-1230-by_branch_by_department+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Branch/Department'), '-1310-by_pay_period+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Pay Period'), '-1320-by_pay_period_by_employee+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Pay Period/Employee'), '-1330-by_pay_period_by_branch+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Pay Period/Branch'), '-1340-by_pay_period_by_department+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Pay Period/Department'), '-1350-by_pay_period_by_branch_by_department+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Pay Period/Branch/Department'), '-1410-by_employee_by_pay_period+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Employee/Pay Period'), '-1420-by_branch_by_pay_period+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Branch/Pay Period'), '-1430-by_department_by_pay_period+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Department/Pay Period'), '-1440-by_branch_by_department_by_pay_period+work+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Branch/Department/Pay Period'), '-1510-by_title_by_start_time+work+total_time+total_time_wage+total_shift' => TTi18n::gettext('Work Time+Wage+Total Shifts by Title/Start Time'), '-1520-by_date_by_title+work+total_time+total_time_wage+total_shift' => TTi18n::gettext('Work Time+Wage+Total Shifts by Date/Title'), '-2010-by_employee+absence+total_time' => TTi18n::gettext('Absence Time by Employee'), '-2020-by_employee+absence+total_time+total_time_wage' => TTi18n::gettext('Absence Time+Wage by Employee'), '-2030-by_title+absence+total_time+total_time_wage' => TTi18n::gettext('Absence Time+Wage by Title'), '-2110-by_date_by_full_name+absence+total_time+total_time_wage' => TTi18n::gettext('Absence Time+Wage by Date/Employee'), '-2120-by_full_name_by_date+absence+total_time+total_time_wage' => TTi18n::gettext('Absence Time+Wage by Employee/Date'), '-2210-by_branch+absence+total_time+total_time_wage' => TTi18n::gettext('Absence Time+Wage by Branch'), '-2220-by_department+absence+total_time+total_time_wage' => TTi18n::gettext('Absence Time+Wage by Department'), '-2230-by_branch_by_department+absence+total_time+total_time_wage' => TTi18n::gettext('Absence Time+Wage by Branch/Department'), '-2310-by_pay_period+absence+total_time+total_time_wage' => TTi18n::gettext('Absence Time+Wage by Pay Period'), '-2320-by_pay_period_by_employee+absence+total_time+total_time_wage' => TTi18n::gettext('Absence Time+Wage by Pay Period/Employee'), '-2330-by_pay_period_by_branch+absence+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Pay Period/Branch'), '-2340-by_pay_period_by_department+absence+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Pay Period/Department'), '-2350-by_pay_period_by_branch_by_department+absence+total_time+total_time_wage' => TTi18n::gettext('Work Time+Wage by Pay Period/Branch/Department'), '-2410-by_employee_by_pay_period+absence+total_time+total_time_wage' => TTi18n::gettext('Absence Time+Wage by Employee/Pay Period'), '-2420-by_branch_by_pay_period+absence+total_time+total_time_wage' => TTi18n::gettext('Absence Time+Wage by Branch/Pay Period'), '-2430-by_department_by_pay_period+absence+total_time+total_time_wage' => TTi18n::gettext('Absence Time+Wage by Department/Pay Period'), '-2440-by_branch_by_department_by_pay_period+absence+total_time+total_time_wage' => TTi18n::gettext('Absence Time+Wage by Branch/Department/Pay Period')); break; case 'template_config': $template = strtolower(Misc::trimSortPrefix($params['template'])); if (isset($template) and $template != '') { switch ($template) { //case 'by_employee+actual_time': // break; default: Debug::Text(' Parsing template name: ' . $template, __FILE__, __LINE__, __METHOD__, 10); $retval['-1010-time_period']['time_period'] = 'last_pay_period'; //Parse template name, and use the keywords separated by '+' to determine settings. $template_keywords = explode('+', $template); if (is_array($template_keywords)) { foreach ($template_keywords as $template_keyword) { Debug::Text(' Keyword: ' . $template_keyword, __FILE__, __LINE__, __METHOD__, 10); switch ($template_keyword) { //Columns case 'total_time': $retval['columns'][] = 'total_time'; break; case 'total_time_wage': $retval['columns'][] = 'total_time_wage'; break; case 'absence_policy': $retval['columns'][] = 'absence_policy'; break; //Filter //Filter case 'work': $retval['filter']['status_id'] = array(10); break; case 'absence': $retval['filter']['status_id'] = array(20); break; case 'total_shift': $retval['columns'][] = 'total_shift'; break; //Group By //SubTotal //Sort //Group By //SubTotal //Sort case 'by_employee': $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['group'][] = 'last_name'; $retval['group'][] = 'first_name'; $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_title': $retval['columns'][] = 'title'; $retval['group'][] = 'title'; $retval['sort'][] = array('title' => 'asc'); break; case 'by_branch': $retval['columns'][] = 'branch'; $retval['group'][] = 'branch'; $retval['sort'][] = array('branch' => 'asc'); break; case 'by_department': $retval['columns'][] = 'department'; $retval['group'][] = 'department'; $retval['sort'][] = array('department' => 'asc'); break; case 'by_branch_by_department': $retval['columns'][] = 'branch'; $retval['columns'][] = 'department'; $retval['group'][] = 'branch'; $retval['group'][] = 'department'; $retval['sub_total'][] = 'branch'; $retval['sort'][] = array('branch' => 'asc'); $retval['sort'][] = array('department' => 'asc'); break; case 'by_pay_period': $retval['columns'][] = 'pay_period'; $retval['group'][] = 'pay_period'; $retval['sort'][] = array('pay_period' => 'asc'); break; case 'by_pay_period_by_employee': $retval['columns'][] = 'pay_period'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['group'][] = 'pay_period'; $retval['group'][] = 'first_name'; $retval['group'][] = 'last_name'; $retval['sub_total'][] = 'pay_period'; $retval['sort'][] = array('pay_period' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_pay_period_by_branch': $retval['columns'][] = 'pay_period'; $retval['columns'][] = 'branch'; $retval['group'][] = 'pay_period'; $retval['group'][] = 'branch'; $retval['sub_total'][] = 'pay_period'; $retval['sort'][] = array('pay_period' => 'asc'); $retval['sort'][] = array('branch' => 'asc'); break; case 'by_pay_period_by_department': $retval['columns'][] = 'pay_period'; $retval['columns'][] = 'department'; $retval['group'][] = 'pay_period'; $retval['group'][] = 'department'; $retval['sub_total'][] = 'pay_period'; $retval['sort'][] = array('pay_period' => 'asc'); $retval['sort'][] = array('department' => 'asc'); break; case 'by_pay_period_by_branch_by_department': $retval['columns'][] = 'pay_period'; $retval['columns'][] = 'branch'; $retval['columns'][] = 'department'; $retval['group'][] = 'pay_period'; $retval['group'][] = 'branch'; $retval['group'][] = 'department'; $retval['sub_total'][] = 'pay_period'; $retval['sub_total'][] = 'branch'; $retval['sort'][] = array('pay_period' => 'asc'); $retval['sort'][] = array('branch' => 'asc'); $retval['sort'][] = array('department' => 'asc'); break; case 'by_employee_by_pay_period': $retval['columns'][] = 'full_name'; $retval['columns'][] = 'pay_period'; $retval['group'][] = 'full_name'; $retval['group'][] = 'pay_period'; $retval['sub_total'][] = 'full_name'; $retval['sort'][] = array('full_name' => 'asc'); $retval['sort'][] = array('pay_period' => 'asc'); break; case 'by_branch_by_pay_period': $retval['columns'][] = 'branch'; $retval['columns'][] = 'pay_period'; $retval['group'][] = 'branch'; $retval['group'][] = 'pay_period'; $retval['sub_total'][] = 'branch'; $retval['sort'][] = array('branch' => 'asc'); $retval['sort'][] = array('pay_period' => 'asc'); break; case 'by_department_by_pay_period': $retval['columns'][] = 'department'; $retval['columns'][] = 'pay_period'; $retval['group'][] = 'department'; $retval['group'][] = 'pay_period'; $retval['sub_total'][] = 'department'; $retval['sort'][] = array('department' => 'asc'); $retval['sort'][] = array('pay_period' => 'asc'); break; case 'by_branch_by_department_by_pay_period': $retval['columns'][] = 'branch'; $retval['columns'][] = 'department'; $retval['columns'][] = 'pay_period'; $retval['group'][] = 'branch'; $retval['group'][] = 'department'; $retval['group'][] = 'pay_period'; $retval['sub_total'][] = 'branch'; $retval['sub_total'][] = 'department'; $retval['sort'][] = array('branch' => 'asc'); $retval['sort'][] = array('department' => 'asc'); $retval['sort'][] = array('pay_period' => 'asc'); break; case 'by_date_by_full_name': $retval['columns'][] = 'date_stamp'; $retval['columns'][] = 'full_name'; $retval['group'][] = 'date_stamp'; $retval['group'][] = 'full_name'; $retval['sub_total'][] = 'date_stamp'; $retval['sort'][] = array('date_stamp' => 'asc'); $retval['sort'][] = array('full_name' => 'asc'); break; case 'by_date_by_title': $retval['columns'][] = 'date_stamp'; $retval['columns'][] = 'title'; $retval['group'][] = 'date_stamp'; $retval['group'][] = 'title'; $retval['sub_total'][] = 'date_stamp'; $retval['sort'][] = array('date_stamp' => 'asc'); $retval['sort'][] = array('title' => 'asc'); break; case 'by_full_name_by_date': $retval['columns'][] = 'full_name'; $retval['columns'][] = 'date_stamp'; $retval['group'][] = 'full_name'; $retval['group'][] = 'date_stamp'; $retval['sub_total'][] = 'full_name'; $retval['sort'][] = array('full_name' => 'asc'); $retval['sort'][] = array('date_stamp' => 'asc'); break; case 'by_title_by_start_time': $retval['columns'][] = 'title'; $retval['columns'][] = 'start_time'; $retval['columns'][] = 'total_shift'; $retval['group'][] = 'title'; $retval['group'][] = 'start_time'; $retval['sub_total'][] = 'title'; $retval['sort'][] = array('title' => 'asc'); $retval['sort'][] = array('start_time' => 'asc'); break; } } } break; } } //Set the template dropdown as well. $retval['-1000-template'] = $template; //Add sort prefixes so Flex can maintain order. if (isset($retval['filter'])) { $retval['-5000-filter'] = $retval['filter']; unset($retval['filter']); } if (isset($retval['columns'])) { $retval['-5010-columns'] = $retval['columns']; unset($retval['columns']); } if (isset($retval['group'])) { $retval['-5020-group'] = $retval['group']; unset($retval['group']); } if (isset($retval['sub_total'])) { $retval['-5030-sub_total'] = $retval['sub_total']; unset($retval['sub_total']); } if (isset($retval['sort'])) { $retval['-5040-sort'] = $retval['sort']; unset($retval['sort']); } Debug::Arr($retval, ' Template Config for: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; default: //Call report parent class options function for options valid for all reports. $retval = $this->__getOptions($name); break; } return $retval; }
function addLogDetail($action_id, $system_log_id, $object) { $start_time = microtime(TRUE); //Only log detail records on add,edit,delete,undelete //Logging data on Add/Delete/UnDelete, or anything but Edit will greatly bloat the database, on the order of tens of thousands of entries //per day. The issue though is its nice to know exactly what data was originally added, then what was edited, and what was finally deleted. //We may need to remove logging for added data, but leave it for edit/delete, so we know exactly what data was deleted. if (!in_array($action_id, array(10, 20, 30, 31, 40))) { Debug::text('Invalid Action ID: ' . $action_id, __FILE__, __LINE__, __METHOD__, 10); return FALSE; } if ($system_log_id > 0 and is_object($object)) { //Remove "Plugin" from the end of the class name incase plugins are enabled. $class = str_replace('Plugin', '', get_class($object)); Debug::text('System Log ID: ' . $system_log_id . ' Class: ' . $class, __FILE__, __LINE__, __METHOD__, 10); //Debug::Arr($object->data, 'Object Data: ', __FILE__, __LINE__, __METHOD__, 10); //Debug::Arr($object->old_data, 'Object Old Data: ', __FILE__, __LINE__, __METHOD__, 10); //Only store raw data changes, don't convert *_ID fields to full text names, it bloats the storage and slows down the logging process too much. //We can do the conversion when someone actually looks at the audit logs, which will obviously be quite rare in comparison. Even though this will //require quite a bit more code to handle. //There are also translation issues if we convert IDs to text at this point. However there could be continuity problems if ID values change in the future. $new_data = $object->data; //Debug::Arr($new_data, 'New Data Arr: ', __FILE__, __LINE__, __METHOD__, 10); if ($action_id == 20) { //Edit if (method_exists($object, 'setObjectFromArray')) { //Run the old data back through the objects own setObjectFromArray(), so any necessary values can be parsed. $tmp_class = new $class(); $tmp_class->setObjectFromArray($object->old_data); $old_data = $tmp_class->data; //If user_date_id changed, we need to display the differences for it. (user/date) //For example: if a schedule shift is assigned to a new user, just the user_date_id is modified if (isset($new_data['user_date_id']) and isset($old_data['user_date_id']) and $new_data['user_date_id'] != $old_data['user_date_id'] or isset($new_data['user_date_id']) and !isset($old_data['user_date_id']) or !isset($new_data['user_date_id']) and isset($old_data['user_date_id'])) { Debug::Text('User Date ID changed...', __FILE__, __LINE__, __METHOD__, 10); if (method_exists($object, 'getUserDateObject') and is_object($object->getUserDateObject())) { $new_data['user_id'] = $object->getUserDateObject()->getUser(); $new_data['pay_period_id'] = $object->getUserDateObject()->getPayPeriod(); $new_data['date_stamp'] = $object->getUserDateObject()->getDateStamp(); } if (method_exists($tmp_class, 'getUserDateObject') and is_object($tmp_class->getUserDateObject())) { $old_data['user_id'] = $tmp_class->getUserDateObject()->getUser(); $old_data['pay_period_id'] = $tmp_class->getUserDateObject()->getPayPeriod(); $old_data['date_stamp'] = $tmp_class->getUserDateObject()->getDateStamp(); } } unset($tmp_class); } else { $old_data = $object->old_data; } //We don't want to include any sub-arrays, as those classes should take care of their own logging, even though it may be slower in some cases. $diff_arr = array_diff_assoc((array) $new_data, (array) $old_data); } elseif ($action_id == 30) { //Delete $old_data = array(); if (method_exists($object, 'setObjectFromArray')) { //Run the old data back through the objects own setObjectFromArray(), so any necessary values can be parsed. $tmp_class = new $class(); $tmp_class->setObjectFromArray($object->data); $diff_arr = $tmp_class->data; unset($tmp_class); } else { $diff_arr = $object->data; } } else { //Add //Debug::text('Not editing, skipping the diff process...', __FILE__, __LINE__, __METHOD__, 10); //No need to store data that is added, as its already in the database, and if it gets changed or deleted we store it then. $old_data = array(); $diff_arr = $object->data; } //Debug::Arr($old_data, 'Old Data Arr: ', __FILE__, __LINE__, __METHOD__, 10); //Handle class specific fields. switch ($class) { case 'UserFactory': case 'UserListFactory': unset($diff_arr['labor_standard_industry'], $diff_arr['password'], $diff_arr['phone_password'], $diff_arr['password_reset_key'], $diff_arr['password_updated_date'], $diff_arr['last_login_date'], $diff_arr['full_name'], $diff_arr['first_name_metaphone'], $diff_arr['last_name_metaphone'], $diff_arr['ibutton_id'], $diff_arr['finger_print_1'], $diff_arr['finger_print_2'], $diff_arr['finger_print_3'], $diff_arr['finger_print_4'], $diff_arr['finger_print_1_updated_date'], $diff_arr['finger_print_2_updated_date'], $diff_arr['finger_print_3_updated_date'], $diff_arr['finger_print_4_updated_date']); break; case 'PayPeriodScheduleFactory': case 'PayPeriodScheduleListFactory': unset($diff_arr['primary_date_ldom'], $diff_arr['primary_transaction_date_ldom'], $diff_arr['primary_transaction_date_bd'], $diff_arr['secondary_date_ldom'], $diff_arr['secondary_transaction_date_ldom'], $diff_arr['secondary_transaction_date_bd']); break; case 'PayPeriodFactory': case 'PayPeriodListFactory': unset($diff_arr['is_primary']); break; case 'StationFactory': case 'StationListFactory': unset($diff_arr['last_poll_date'], $diff_arr['last_push_date'], $diff_arr['last_punch_time_stamp'], $diff_arr['last_partial_push_date'], $diff_arr['mode_flag'], $diff_arr['work_code_definition'], $diff_arr['allowed_date']); break; case 'ScheduleFactory': case 'ScheduleListFactory': unset($diff_arr['recurring_schedule_template_control_id'], $diff_arr['replaced_id']); break; case 'PunchFactory': case 'PunchListFactory': unset($diff_arr['actual_time_stamp'], $diff_arr['original_time_stamp'], $diff_arr['punch_control_id'], $diff_arr['station_id'], $diff_arr['latitude'], $diff_arr['longitude']); break; case 'PunchControlFactory': case 'PunchControlListFactory': unset($diff_arr['actual_total_time']); break; case 'PunchControlFactory': case 'PunchControlListFactory': unset($diff_arr['overlap']); break; case 'AccrualFactory': case 'AccrualListFactory': unset($diff_arr['user_date_total_id']); break; case 'JobItemFactory': case 'JobItemListFactory': unset($diff_arr['type_id'], $diff_arr['department_id']); break; case 'ClientContactFactory': case 'ClientContactListFactory': unset($diff_arr['password'], $diff_arr['password_reset_key'], $diff_arr['password_reset_date']); break; case 'UserReviewFactory': case 'UserReviewListFactory': unset($diff_arr['user_review_control_id']); break; case 'ClientPaymentFactory': case 'ClientPaymentListFactory': if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { //Only log secure values. if (isset($diff_arr['cc_number'])) { $old_data['cc_number'] = isset($old_data['cc_number']) ? $object->getSecureCreditCardNumber(Misc::decrypt($old_data['cc_number'])) : ''; $new_data['cc_number'] = isset($new_data['cc_number']) ? $object->getSecureCreditCardNumber(Misc::decrypt($new_data['cc_number'])) : ''; } if (isset($diff_arr['bank_account'])) { $old_data['bank_account'] = isset($old_data['bank_account']) ? $object->getSecureAccount($old_data['bank_account']) : ''; $new_data['bank_account'] = isset($old_data['bank_account']) ? $object->getSecureAccount($new_data['bank_account']) : ''; } if (isset($diff_arr['cc_check'])) { $old_data['cc_check'] = isset($old_data['cc_check']) ? $object->getSecureCreditCardCheck($old_data['cc_check']) : ''; $new_data['cc_check'] = isset($old_data['cc_check']) ? $object->getSecureCreditCardCheck($new_data['cc_check']) : ''; } } break; case 'JobApplicantFactory': case 'JobApplicantListFactory': unset($diff_arr['password'], $diff_arr['password_reset_key'], $diff_arr['password_reset_date'], $diff_arr['first_name_metaphone'], $diff_arr['last_name_metaphone']); break; } //Ignore specific columns here, like updated_date, updated_by, etc... unset($diff_arr['id'], $diff_arr['company_id'], $diff_arr['user_date_id'], $diff_arr['name_metaphone'], $diff_arr['created_date'], $diff_arr['created_by'], $diff_arr['created_by_id'], $diff_arr['updated_date'], $diff_arr['updated_by'], $diff_arr['updated_by_id'], $diff_arr['deleted_date'], $diff_arr['deleted_by'], $diff_arr['deleted_by_id'], $diff_arr['deleted']); //Debug::Arr($diff_arr, 'Array Diff: ', __FILE__, __LINE__, __METHOD__, 10); if (is_array($diff_arr) and count($diff_arr) > 0) { foreach ($diff_arr as $field => $value) { $old_value = NULL; if (isset($old_data[$field])) { $old_value = $old_data[$field]; if (is_bool($old_value) and $old_value === FALSE) { $old_value = NULL; } elseif (is_array($old_value)) { //$old_value = serialize($old_value); //If the old value is an array, replace it with NULL because it will always match the NEW value too. $old_value = NULL; } } $new_value = $new_data[$field]; if (is_bool($new_value) and $new_value === FALSE) { $new_value = NULL; } elseif (is_array($new_value)) { $new_value = serialize($new_value); } //Debug::Text('Old Value: '. $old_value .' New Value: '. $new_value, __FILE__, __LINE__, __METHOD__, 10); if (!($old_value == '' and $new_value == '')) { $ph[] = (int) $system_log_id; $ph[] = $field; $ph[] = $new_value; $ph[] = $old_value; $data[] = '(?,?,?,?)'; } } if (isset($data)) { //Save data in a single SQL query. $query = 'INSERT INTO ' . $this->getTable() . '(SYSTEM_LOG_ID,FIELD,NEW_VALUE,OLD_VALUE) VALUES' . implode(',', $data); //Debug::Text('Query: '. $query, __FILE__, __LINE__, __METHOD__, 10); $this->db->Execute($query, $ph); Debug::Text('Logged detail records in: ' . (microtime(TRUE) - $start_time), __FILE__, __LINE__, __METHOD__, 10); return TRUE; } } } Debug::Text('Not logging detail records, likely no data changed in: ' . (microtime(TRUE) - $start_time) . 's', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
protected function _getOptions($name, $params = NULL) { $retval = NULL; switch ($name) { case 'output_format': $retval = array_merge(parent::getOptions('default_output_format'), array('-1100-pdf_form' => TTi18n::gettext('Form'), '-1120-efile_xml' => TTi18n::gettext('eFile'))); break; case 'default_setup_fields': $retval = array('template', 'time_period', 'columns'); break; case 'setup_fields': $retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2080-code_id' => TTi18n::gettext('Reason'), '-2090-pay_period_type_id' => TTi18n::gettext('Pay Period Type'), '-3000-custom_filter' => TTi18n::gettext('Custom Filter'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By')); break; case 'time_period': $retval = TTDate::getTimePeriodOptions(); break; case 'date_columns': $retval = array_merge(TTDate::getReportDateOptions('first', TTi18n::gettext('First Day Worked(Or first day since last ROE)'), 16, FALSE), TTDate::getReportDateOptions('last', TTi18n::gettext('Last Day For Which Paid'), 16, FALSE), TTDate::getReportDateOptions('pay_period_end', TTi18n::gettext('Final Pay Period Ending Date'), 17, FALSE), TTDate::getReportDateOptions('recall', TTi18n::gettext('Expected Date of Recall'), 17, FALSE)); $retval = array(); break; case 'report_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); // Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns. // So just get custom columns with Selection and Formula. $custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'ROEReport', 'custom_column'); if (is_array($custom_column_labels)) { $retval = Misc::addSortPrefix($custom_column_labels, 9500); } } break; case 'report_custom_filters': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'ROEReport', 'custom_column'); } break; case 'report_dynamic_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'ROEReport', 'custom_column'); if (is_array($report_dynamic_custom_column_labels)) { $retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700); } } break; case 'report_static_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'ROEReport', 'custom_column'); if (is_array($report_static_custom_column_labels)) { $retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700); } } break; case 'formula_columns': $retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns'))); break; case 'filter_columns': $retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))); break; case 'static_columns': $retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1035-sin' => TTi18n::gettext('SIN/SSN'), '-1040-status' => TTi18n::gettext('Status'), '-1050-title' => TTi18n::gettext('Title'), '-1060-province' => TTi18n::gettext('Province/State'), '-1070-country' => TTi18n::gettext('Country'), '-1080-group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Default Branch'), '-1100-default_department' => TTi18n::gettext('Default Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1120-code' => TTi18n::gettext('Reason'), '-1130-pay_period_type' => TTi18n::gettext('Pay Period Type'), '-1180-serial' => TTi18n::gettext('Serial No'), '-1190-comments' => TTi18n::gettext('Comments'), '-1400-permission_control' => TTi18n::gettext('Permission Group'), '-1410-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1420-policy_group' => TTi18n::gettext('Policy Group')); $retval = array_merge($retval, $this->getOptions('date_columns'), (array) $this->getOptions('report_static_custom_column')); ksort($retval); break; case 'dynamic_columns': $retval = array('-2100-insurable_earnings' => TTi18n::gettext('Insurable Earnings (Box 15B)'), '-2110-vacation_pay' => TTi18n::gettext('Vacation Pay (Box 17A)')); break; case 'columns': $retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')); break; case 'column_format': //Define formatting function for each column. $columns = array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_custom_column')); if (is_array($columns)) { foreach ($columns as $column => $name) { $retval[$column] = 'numeric'; } } break; case 'aggregates': $retval = array(); $dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')))); if (is_array($dynamic_columns)) { foreach ($dynamic_columns as $column) { switch ($column) { default: $retval[$column] = 'sum'; } } } break; case 'type': $retval = array('-1010-O' => TTi18n::getText('Original'), '-1020-A' => TTi18n::getText('Amended'), '-1030-C' => TTi18n::getText('Cancel')); break; case 'templates': $retval = array('-1020-by_employee' => TTi18n::gettext('by Employee'), '-1030-by_branch' => TTi18n::gettext('by Branch'), '-1040-by_department' => TTi18n::gettext('by Department'), '-1050-by_branch_by_department' => TTi18n::gettext('by Branch/Department')); break; case 'template_config': $template = strtolower(Misc::trimSortPrefix($params['template'])); if (isset($template) and $template != '') { switch ($template) { case 'default': //Proper settings to generate the form. //$retval['-1010-time_period']['time_period'] = 'last_quarter'; $retval['columns'] = $this->getOptions('columns'); $retval['group'][] = 'date_quarter_month'; $retval['sort'][] = array('date_quarter_month' => 'asc'); $retval['other']['grand_total'] = TRUE; break; default: Debug::Text(' Parsing template name: ' . $template, __FILE__, __LINE__, __METHOD__, 10); $retval['-1010-time_period']['time_period'] = 'last_year'; //Parse template name, and use the keywords separated by '+' to determine settings. $template_keywords = explode('+', $template); if (is_array($template_keywords)) { foreach ($template_keywords as $template_keyword) { Debug::Text(' Keyword: ' . $template_keyword, __FILE__, __LINE__, __METHOD__, 10); switch ($template_keyword) { //Columns //Filter //Group By //SubTotal //Sort case 'by_employee': $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['group'][] = 'first_name'; $retval['group'][] = 'last_name'; $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_branch': $retval['columns'][] = 'default_branch'; $retval['group'][] = 'default_branch'; $retval['sort'][] = array('default_branch' => 'asc'); break; case 'by_department': $retval['columns'][] = 'default_department'; $retval['group'][] = 'default_department'; $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_branch_by_department': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['group'][] = 'default_branch'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'default_branch'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); break; } } } $retval['columns'] = array_merge($retval['columns'], array_keys(Misc::trimSortPrefix($this->getOptions('dynamic_columns')))); break; } } //Set the template dropdown as well. $retval['-1000-template'] = $template; //Add sort prefixes so Flex can maintain order. if (isset($retval['filter'])) { $retval['-5000-filter'] = $retval['filter']; unset($retval['filter']); } if (isset($retval['columns'])) { $retval['-5010-columns'] = $retval['columns']; unset($retval['columns']); } if (isset($retval['group'])) { $retval['-5020-group'] = $retval['group']; unset($retval['group']); } if (isset($retval['sub_total'])) { $retval['-5030-sub_total'] = $retval['sub_total']; unset($retval['sub_total']); } if (isset($retval['sort'])) { $retval['-5040-sort'] = $retval['sort']; unset($retval['sort']); } Debug::Arr($retval, ' Template Config for: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; default: //Call report parent class options function for options valid for all reports. $retval = $this->__getOptions($name); break; } return $retval; }
function getTTProductEditionName() { switch (getTTProductEdition()) { case 15: $retval = 'Business'; break; case 20: $retval = 'Professional'; break; default: $retval = 'Standard'; break; } return $retval; }
function _getFactoryOptions($name) { $retval = NULL; switch ($name) { case 'preset': $retval = array(10 => TTi18n::gettext('Regular Employee (Punch In/Out)'), 12 => TTi18n::gettext('Regular Employee (Manual Entry)'), 18 => TTi18n::gettext('Supervisor (Subordinates Only)'), 20 => TTi18n::gettext('Supervisor (All Employees)'), 25 => TTi18n::gettext('HR Manager'), 30 => TTi18n::gettext('Payroll Administrator'), 40 => TTi18n::gettext('Administrator')); break; case 'common_permissions': $retval = array('add' => TTi18n::gettext('Add'), 'view' => TTi18n::gettext('View'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'delete' => TTi18n::gettext('Delete'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'other' => TTi18n::gettext('Other')); if (defined('TIMETREX_API') == TRUE and TIMETREX_API == TRUE) { $retval = Misc::addSortPrefix($retval, 1000); } break; case 'preset_flags': if (getTTProductEdition() >= TT_PRODUCT_COMMUNITY) { $retval[10] = TTi18n::gettext('Scheduling'); $retval[20] = TTi18n::gettext('Time & Attendance'); $retval[30] = TTi18n::gettext('Payroll'); $retval[70] = TTi18n::gettext('Human Resources'); } if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $retval[40] = TTi18n::gettext('Job Costing'); $retval[50] = TTi18n::gettext('Document Management'); $retval[60] = TTi18n::gettext('Invoicing'); } if (getTTProductEdition() >= TT_PRODUCT_ENTERPRISE) { $retval[75] = TTi18n::gettext('Recruitment'); $retval[80] = TTi18n::gettext('Expense Tracking'); } ksort($retval); break; case 'preset_level': $retval = array(10 => 1, 12 => 2, 18 => 10, 20 => 15, 25 => 18, 30 => 20, 40 => 25); break; case 'section_group': $retval = array(0 => TTi18n::gettext('-- Please Choose --'), 'all' => TTi18n::gettext('-- All --'), 'company' => TTi18n::gettext('Company'), 'user' => TTi18n::gettext('Employee'), 'schedule' => TTi18n::gettext('Schedule'), 'attendance' => TTi18n::gettext('Attendance'), 'job' => TTi18n::gettext('Job Tracking'), 'invoice' => TTi18n::gettext('Invoicing'), 'payroll' => TTi18n::gettext('Payroll'), 'policy' => TTi18n::gettext('Policies'), 'report' => TTi18n::gettext('Reports'), 'hr' => TTi18n::gettext('Human Resources (HR)'), 'recruitment' => TTi18n::gettext('Recruitment')); //Remove sections that don't apply to the current product edition. global $current_company; if (is_object($current_company)) { $product_edition = $current_company->getProductEdition(); } else { $product_edition = getTTProductEdition(); } if ($product_edition == TT_PRODUCT_ENTERPRISE) { //Enterprise } elseif ($product_edition == TT_PRODUCT_CORPORATE) { //Corporate unset($retval['recruitment']); } elseif ($product_edition == TT_PRODUCT_COMMUNITY or $product_edition == TT_PRODUCT_PROFESSIONAL) { //Community or Professional unset($retval['job'], $retval['invoice'], $retval['recruitment']); } if (defined('TIMETREX_API') == TRUE and TIMETREX_API == TRUE) { unset($retval[0]); $retval = Misc::addSortPrefix($retval, 1000); ksort($retval); } break; case 'section_group_map': $retval = array('company' => array('system', 'company', 'currency', 'branch', 'department', 'station', 'hierarchy', 'authorization', 'message', 'other_field', 'document', 'help', 'permission', 'pay_period_schedule'), 'user' => array('user', 'user_preference', 'user_tax_deduction', 'user_contact'), 'schedule' => array('schedule', 'recurring_schedule', 'recurring_schedule_template'), 'attendance' => array('punch', 'absence', 'accrual', 'request'), 'job' => array('job', 'job_item', 'job_report'), 'invoice' => array('invoice_config', 'client', 'client_payment', 'product', 'tax_policy', 'area_policy', 'shipping_policy', 'payment_gateway', 'transaction', 'invoice', 'invoice_report'), 'policy' => array('policy_group', 'schedule_policy', 'meal_policy', 'break_policy', 'over_time_policy', 'premium_policy', 'accrual_policy', 'absence_policy', 'round_policy', 'exception_policy', 'holiday_policy', 'expense_policy'), 'payroll' => array('pay_stub_account', 'pay_stub', 'pay_stub_amendment', 'wage', 'roe', 'company_tax_deduction', 'user_expense'), 'report' => array('report', 'report_custom_column'), 'hr' => array('qualification', 'user_education', 'user_license', 'user_skill', 'user_membership', 'user_language', 'kpi', 'user_review', 'job_vacancy', 'job_applicant', 'job_application', 'hr_report'), 'recruitment' => array('job_vacancy', 'job_applicant', 'job_application', 'recruitment_report')); //Remove sections that don't apply to the current product edition. global $current_company; if (is_object($current_company)) { $product_edition = $current_company->getProductEdition(); } else { $product_edition = getTTProductEdition(); } if ($product_edition == TT_PRODUCT_ENTERPRISE) { //Enterprise } elseif ($product_edition == TT_PRODUCT_CORPORATE) { //Corporate unset($retval['recruitment']); unset($retval['payroll'][array_search('user_expense', $retval['payroll'])], $retval['policy'][array_search('expense_policy', $retval['policy'])]); } elseif ($product_edition == TT_PRODUCT_COMMUNITY or $product_edition == TT_PRODUCT_PROFESSIONAL) { //Community or Professional unset($retval['recruitment'], $retval['invoice'], $retval['job']); unset($retval['payroll'][array_search('user_expense', $retval['payroll'])], $retval['policy'][array_search('expense_policy', $retval['policy'])]); } break; case 'section': $retval = array('system' => TTi18n::gettext('System'), 'company' => TTi18n::gettext('Company'), 'currency' => TTi18n::gettext('Currency'), 'branch' => TTi18n::gettext('Branch'), 'department' => TTi18n::gettext('Department'), 'station' => TTi18n::gettext('Station'), 'hierarchy' => TTi18n::gettext('Hierarchy'), 'authorization' => TTi18n::gettext('Authorization'), 'other_field' => TTi18n::gettext('Other Fields'), 'document' => TTi18n::gettext('Documents'), 'message' => TTi18n::gettext('Message'), 'help' => TTi18n::gettext('Help'), 'permission' => TTi18n::gettext('Permissions'), 'user' => TTi18n::gettext('Employees'), 'user_preference' => TTi18n::gettext('Employee Preferences'), 'user_tax_deduction' => TTi18n::gettext('Employee Tax / Deductions'), 'user_contact' => TTi18n::gettext('Employee Contact'), 'schedule' => TTi18n::gettext('Schedule'), 'recurring_schedule' => TTi18n::gettext('Recurring Schedule'), 'recurring_schedule_template' => TTi18n::gettext('Recurring Schedule Template'), 'request' => TTi18n::gettext('Requests'), 'accrual' => TTi18n::gettext('Accruals'), 'punch' => TTi18n::gettext('Punch'), 'absence' => TTi18n::gettext('Absence'), 'job' => TTi18n::gettext('Jobs'), 'job_item' => TTi18n::gettext('Job Tasks'), 'job_report' => TTi18n::gettext('Job Reports'), 'invoice_config' => TTi18n::gettext('Invoice Settings'), 'client' => TTi18n::gettext('Invoice Clients'), 'client_payment' => TTi18n::gettext('Client Payment Methods'), 'product' => TTi18n::gettext('Products'), 'tax_policy' => TTi18n::gettext('Tax Policies'), 'shipping_policy' => TTi18n::gettext('Shipping Policies'), 'area_policy' => TTi18n::gettext('Area Policies'), 'payment_gateway' => TTi18n::gettext('Payment Gateway'), 'transaction' => TTi18n::gettext('Invoice Transactions'), 'invoice' => TTi18n::gettext('Invoices'), 'invoice_report' => TTi18n::gettext('Invoice Reports'), 'policy_group' => TTi18n::gettext('Policy Group'), 'schedule_policy' => TTi18n::gettext('Schedule Policies'), 'meal_policy' => TTi18n::gettext('Meal Policies'), 'break_policy' => TTi18n::gettext('Break Policies'), 'over_time_policy' => TTi18n::gettext('Overtime Policies'), 'premium_policy' => TTi18n::gettext('Premium Policies'), 'accrual_policy' => TTi18n::gettext('Accrual Policies'), 'absence_policy' => TTi18n::gettext('Absence Policies'), 'round_policy' => TTi18n::gettext('Rounding Policies'), 'exception_policy' => TTi18n::gettext('Exception Policies'), 'holiday_policy' => TTi18n::gettext('Holiday Policies'), 'expense_policy' => TTi18n::gettext('Expense Policies'), 'pay_stub_account' => TTi18n::gettext('Pay Stub Accounts'), 'pay_stub' => TTi18n::gettext('Employee Pay Stubs'), 'pay_stub_amendment' => TTi18n::gettext('Employee Pay Stub Amendments'), 'wage' => TTi18n::gettext('Wages'), 'pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), 'roe' => TTi18n::gettext('Record of Employment'), 'company_tax_deduction' => TTi18n::gettext('Company Tax / Deductions'), 'user_expense' => TTi18n::gettext('Employee Expenses'), 'report' => TTi18n::gettext('Reports'), 'report_custom_column' => TTi18n::gettext('Report Custom Column'), 'qualification' => TTi18n::gettext('Qualifications'), 'user_education' => TTi18n::gettext('Employee Education'), 'user_license' => TTi18n::gettext('Employee Licenses'), 'user_skill' => TTi18n::gettext('Employee Skills'), 'user_membership' => TTi18n::gettext('Employee Memberships'), 'user_language' => TTi18n::gettext('Employee Language'), 'kpi' => TTi18n::gettext('Key Performance Indicators'), 'user_review' => TTi18n::gettext('Employee Review'), 'job_vacancy' => TTi18n::gettext('Job Vacancy'), 'job_applicant' => TTi18n::gettext('Job Applicant'), 'job_application' => TTi18n::gettext('Job Application'), 'hr_report' => TTi18n::gettext('HR Reports'), 'recruitment_report' => TTi18n::gettext('Recruitment Reports')); break; case 'name': $retval = array('system' => array('login' => TTi18n::gettext('Login Enabled')), 'company' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete'), 'edit_own_bank' => TTi18n::gettext('Edit Own Banking Information'), 'login_other_user' => TTi18n::gettext('Login as Other Employee')), 'user' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'edit_advanced' => TTi18n::gettext('Edit Advanced'), 'edit_own_bank' => TTi18n::gettext('Edit Own Bank Info'), 'edit_child_bank' => TTi18n::gettext('Edit Subordinate Bank Info'), 'edit_bank' => TTi18n::gettext('Edit Bank Info'), 'edit_permission_group' => TTi18n::gettext('Edit Permission Group'), 'edit_pay_period_schedule' => TTi18n::gettext('Edit Pay Period Schedule'), 'edit_policy_group' => TTi18n::gettext('Edit Policy Group'), 'edit_hierarchy' => TTi18n::gettext('Edit Hierarchy'), 'edit_own_password' => TTi18n::gettext('Edit Own Password'), 'edit_own_phone_password' => TTi18n::gettext('Edit Own Quick Punch Password'), 'enroll' => TTi18n::gettext('Enroll Employees'), 'enroll_child' => TTi18n::gettext('Enroll Subordinate'), 'timeclock_admin' => TTi18n::gettext('TimeClock Administrator'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete'), 'view_sin' => TTi18n::gettext('View SIN/SSN')), 'user_contact' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'user_preference' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'user_tax_deduction' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'roe' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'company_tax_deduction' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'user_expense' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'authorize' => TTi18n::gettext('Authorize Expense')), 'pay_stub_account' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'pay_stub' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'pay_stub_amendment' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'wage' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'currency' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'branch' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'department' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete'), 'assign' => TTi18n::gettext('Assign Employees')), 'station' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete'), 'assign' => TTi18n::gettext('Assign Employees')), 'pay_period_schedule' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete'), 'assign' => TTi18n::gettext('Assign Employees')), 'schedule' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete'), 'edit_branch' => TTi18n::gettext('Edit Branch Field'), 'edit_department' => TTi18n::gettext('Edit Department Field'), 'edit_job' => TTi18n::gettext('Edit Job Field'), 'edit_job_item' => TTi18n::gettext('Edit Task Field')), 'other_field' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'document' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'view_private' => TTi18n::gettext('View Private'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'edit_private' => TTi18n::gettext('Edit Private'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete'), 'delete_private' => TTi18n::gettext('Delete Private')), 'accrual' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'policy_group' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'schedule_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'meal_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'break_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'absence_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'accrual_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'over_time_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'premium_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'round_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view' => TTi18n::gettext('View'), 'view_own' => TTi18n::gettext('View Own'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'exception_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'holiday_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'expense_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'recurring_schedule_template' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'recurring_schedule' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'request' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete'), 'authorize' => TTi18n::gettext('Authorize')), 'punch' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete'), 'verify_time_sheet' => TTi18n::gettext('Verify TimeSheet'), 'authorize' => TTi18n::gettext('Authorize TimeSheet'), 'punch_in_out' => TTi18n::gettext('Punch In/Out'), 'edit_transfer' => TTi18n::gettext('Edit Transfer Field'), 'default_transfer' => TTi18n::gettext('Default Transfer On'), 'edit_branch' => TTi18n::gettext('Edit Branch Field'), 'edit_department' => TTi18n::gettext('Edit Department Field'), 'edit_job' => TTi18n::gettext('Edit Job Field'), 'edit_job_item' => TTi18n::gettext('Edit Task Field'), 'edit_quantity' => TTi18n::gettext('Edit Quantity Field'), 'edit_bad_quantity' => TTi18n::gettext('Edit Bad Quantity Field'), 'edit_note' => TTi18n::gettext('Edit Note Field'), 'edit_other_id1' => TTi18n::gettext('Edit Other ID1 Field'), 'edit_other_id2' => TTi18n::gettext('Edit Other ID2 Field'), 'edit_other_id3' => TTi18n::gettext('Edit Other ID3 Field'), 'edit_other_id4' => TTi18n::gettext('Edit Other ID4 Field'), 'edit_other_id5' => TTi18n::gettext('Edit Other ID5 Field')), 'absence' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete'), 'edit_branch' => TTi18n::gettext('Edit Branch Field'), 'edit_department' => TTi18n::gettext('Edit Department Field'), 'edit_job' => TTi18n::gettext('Edit Job Field'), 'edit_job_item' => TTi18n::gettext('Edit Task Field')), 'hierarchy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'authorization' => array('enabled' => TTi18n::gettext('Enabled'), 'view' => TTi18n::gettext('View')), 'message' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'add_advanced' => TTi18n::gettext('Add Advanced'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete'), 'send_to_any' => TTi18n::gettext('Send to Any Employee'), 'send_to_child' => TTi18n::gettext('Send to Subordinate')), 'help' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'report' => array('enabled' => TTi18n::gettext('Enabled'), 'view_active_shift' => TTi18n::gettext('Whos In Summary'), 'view_user_information' => TTi18n::gettext('Employee Information'), 'view_user_detail' => TTi18n::gettext('Employee Detail'), 'view_pay_stub_summary' => TTi18n::gettext('Pay Stub Summary'), 'view_payroll_export' => TTi18n::gettext('Payroll Export'), 'view_wages_payable_summary' => TTi18n::gettext('Wages Payable Summary'), 'view_system_log' => TTi18n::gettext('Audit Trail'), 'view_timesheet_summary' => TTi18n::gettext('Timesheet Summary'), 'view_exception_summary' => TTi18n::gettext('Exception Summary'), 'view_accrual_balance_summary' => TTi18n::gettext('Accrual Balance Summary'), 'view_schedule_summary' => TTi18n::gettext('Schedule Summary'), 'view_punch_summary' => TTi18n::gettext('Punch Summary'), 'view_remittance_summary' => TTi18n::gettext('Remittance Summary'), 'view_employee_summary' => TTi18n::gettext('Employee Summary'), 'view_t4_summary' => TTi18n::gettext('T4 Summary'), 'view_generic_tax_summary' => TTi18n::gettext('Generic Tax Summary'), 'view_form941' => TTi18n::gettext('Form 941'), 'view_form940' => TTi18n::gettext('Form 940'), 'view_form940ez' => TTi18n::gettext('Form 940-EZ'), 'view_form1099misc' => TTi18n::gettext('Form 1099-Misc'), 'view_formW2' => TTi18n::gettext('Form W2 / W3'), 'view_affordable_care' => TTi18n::gettext('Affordable Care'), 'view_user_barcode' => TTi18n::gettext('Employee Barcodes'), 'view_general_ledger_summary' => TTi18n::gettext('General Ledger Summary'), 'view_exception_summary' => TTi18n::gettext('Exception Summary'), 'view_expense' => TTi18n::gettext('Expense Summary')), 'report_custom_column' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'job' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'job_item' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'job_report' => array('enabled' => TTi18n::gettext('Enabled'), 'view_job_summary' => TTi18n::gettext('Job Summary'), 'view_job_analysis' => TTi18n::gettext('Job Analysis'), 'view_job_payroll_analysis' => TTi18n::gettext('Job Payroll Analysis'), 'view_job_barcode' => TTi18n::gettext('Job Barcode')), 'invoice_config' => array('enabled' => TTi18n::gettext('Enabled'), 'add' => TTi18n::gettext('Add'), 'edit' => TTi18n::gettext('Edit'), 'delete' => TTi18n::gettext('Delete')), 'client' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'client_payment' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete'), 'view_credit_card' => TTi18n::gettext('View Credit Card #')), 'product' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'tax_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'shipping_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'area_policy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'payment_gateway' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'transaction' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'invoice' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete' => TTi18n::gettext('Delete')), 'invoice_report' => array('enabled' => TTi18n::gettext('Enabled'), 'view_transaction_summary' => TTi18n::gettext('View Transaction Summary')), 'permission' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'qualification' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'user_education' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'user_license' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'user_skill' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'user_membership' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'user_language' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'kpi' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'user_review' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'job_vacancy' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'job_applicant' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'job_application' => array('enabled' => TTi18n::gettext('Enabled'), 'view_own' => TTi18n::gettext('View Own'), 'view_child' => TTi18n::gettext('View Subordinate'), 'view' => TTi18n::gettext('View'), 'add' => TTi18n::gettext('Add'), 'edit_own' => TTi18n::gettext('Edit Own'), 'edit_child' => TTi18n::gettext('Edit Subordinate'), 'edit' => TTi18n::gettext('Edit'), 'delete_own' => TTi18n::gettext('Delete Own'), 'delete_child' => TTi18n::gettext('Delete Subordinate'), 'delete' => TTi18n::gettext('Delete')), 'hr_report' => array('enabled' => TTi18n::gettext('Enabled'), 'user_qualification' => TTi18n::gettext('Employee Qualifications'), 'user_review' => TTi18n::getText('Employee Review'), 'user_recruitment' => TTi18n::gettext('Employee Recruitment')), 'recruitment_report' => array('enabled' => TTi18n::gettext('Enabled'), 'user_recruitment' => TTi18n::gettext('Employee Recruitment'))); break; } return $retval; }
function getGeoCodeByAddress($address1, $address2, $city, $province, $country, $postal_code) { global $config_vars; if (!isset($config_vars['other']['primary_company_id'])) { $config_vars['other']['primary_company_id'] = 1; } try { $clf = TTnew('CompanyListFactory'); $clf->getById($config_vars['other']['primary_company_id']); if ($clf->getRecordCount() > 0) { foreach ($clf as $c_obj) { $company_data = array('system_version' => APPLICATION_VERSION, 'registration_key' => $this->getLocalRegistrationKey(), 'product_edition_id' => $c_obj->getProductEdition(), 'product_edition_available' => getTTProductEdition(), 'name' => $c_obj->getName(), 'short_name' => $c_obj->getShortName(), 'work_phone' => $c_obj->getWorkPhone(), 'city' => $c_obj->getCity(), 'country' => $c_obj->getCountry(), 'province' => $c_obj->getProvince(), 'postal_code' => $c_obj->getPostalCode()); } } } catch (Exception $e) { Debug::Text('ERROR: Cant get company data for geocoding, database is likely down...', __FILE__, __LINE__, __METHOD__, 10); $company_data = NULL; } if (isset($company_data) and $city != '' and $country != '') { return $this->getSoapObject()->getGeoCodeByAddress($address1, $address2, $city, $province, $country, $postal_code, $company_data); } return NULL; //Return NULL when no data available, and FALSE to try again later. }
/** * Returns array of notifications message to be displayed to the user. * @param string $action Action that is being performed, possible values: 'login', 'preference', 'notification', 'pay_period' * @return array */ function getNotifications($action = FALSE) { global $config_vars, $disable_database_connection; $retarr = FALSE; //Skip this step if disable_database_connection is enabled or the user is going through the installer still switch (strtolower($action)) { case 'login': if ((!isset($disable_database_connection) or isset($disable_database_connection) and $disable_database_connection != TRUE) and (!isset($config_vars['other']['installer_enabled']) or isset($config_vars['other']['installer_enabled']) and $config_vars['other']['installer_enabled'] != TRUE)) { //Get all system settings, so they can be used even if the user isn't logged in, such as the login page. $sslf = new SystemSettingListFactory(); $system_settings = $sslf->getAllArray(); } unset($sslf); //Check license validity if ((DEPLOYMENT_ON_DEMAND == FALSE and $this->getCurrentCompanyObject()->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $this->getCurrentCompanyObject()->getId() == $config_vars['other']['primary_company_id']) and getTTProductEdition() > 10) { if (!isset($system_settings['license'])) { $system_settings['license'] = NULL; } $license = new TTLicense(); $license_validate = $license->validateLicense($system_settings['license']); $license_message = $license->getFullErrorMessage($license_validate, TRUE); if ($license_message != '') { $destination_url = 'http://www.timetrex.com/r.php?id=899'; if ($license_validate === TRUE) { //License likely expires soon. $retarr[] = array('delay' => 0, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('WARNING: %1', $license_message), 'destination' => $destination_url); } else { //License error. $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1', $license_message), 'destination' => $destination_url); } } unset($license, $license_validate, $license_message, $destination); } //System Requirements not being met. if (isset($system_settings['valid_install_requirements']) and DEPLOYMENT_ON_DEMAND == FALSE and (int) $system_settings['valid_install_requirements'] == 0) { $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1 system requirement check has failed! Please contact your %1 administrator immediately to re-run the %1 installer to correct the issue.', APPLICATION_NAME), 'destination' => NULL); } //Check version mismatch if (isset($system_settings['system_version']) and DEPLOYMENT_ON_DEMAND == FALSE and APPLICATION_VERSION != $system_settings['system_version']) { $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1 application version does not match database version. Please re-run the %1 installer to complete the upgrade process.', APPLICATION_NAME), 'destination' => NULL); } //Only display message to the primary company. if (time() - (int) APPLICATION_VERSION_DATE > 86400 * 475 and ($this->getCurrentCompanyObject()->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $this->getCurrentCompanyObject()->getId() == $config_vars['other']['primary_company_id'])) { //~1yr and 3mths $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: This %1 version (v%2) is severely out of date and may no longer be supported. Please upgrade to the latest version as soon as possible as invalid calculations may already be occurring.', array(APPLICATION_NAME, APPLICATION_VERSION)), 'destination' => NULL); } //New version available notification. if (DEMO_MODE == FALSE and (isset($system_settings['new_version']) and $system_settings['new_version'] == 1) and ($this->getCurrentCompanyObject()->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $this->getCurrentCompanyObject()->getId() == $config_vars['other']['primary_company_id'])) { //Only display this every two weeks. $new_version_available_notification_arr = UserSettingFactory::getUserSetting($this->getCurrentUserObject()->getID(), 'new_version_available_notification'); if (!isset($new_version_available_notification_arr['value']) or isset($new_version_available_notification_arr['value']) and $new_version_available_notification_arr['value'] <= time() - 86400 * 14) { UserSettingFactory::setUserSetting($this->getCurrentUserObject()->getID(), 'new_version_available_notification', time()); $retarr[] = array('delay' => -1, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('NOTICE: A new version of %1 available, it is highly recommended that you upgrade as soon as possible. Click here to download the latest version.', array(APPLICATION_NAME)), 'destination' => getTTProductEdition() == TT_PRODUCT_COMMUNITY ? 'http://www.timetrex.com/r.php?id=19' : 'http://www.timetrex.com/r.php?id=9'); } unset($new_version_available_notification); } //Check for major new version. $new_version_notification_arr = UserSettingFactory::getUserSetting($this->getCurrentUserObject()->getID(), 'new_version_notification'); if (DEMO_MODE == FALSE and (!isset($config_vars['branding']['application_name']) or ($this->getCurrentCompanyObject()->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $this->getCurrentCompanyObject()->getId() == $config_vars['other']['primary_company_id'])) and $this->getPermissionObject()->getLevel() >= 20 and $this->getCurrentUserObject()->getCreatedDate() <= APPLICATION_VERSION_DATE and (!isset($new_version_notification_arr['value']) or isset($new_version_notification_arr['value']) and Misc::MajorVersionCompare(APPLICATION_VERSION, $new_version_notification_arr['value'], '>'))) { UserSettingFactory::setUserSetting($this->getCurrentUserObject()->getID(), 'new_version_notification', APPLICATION_VERSION); $retarr[] = array('delay' => -1, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('NOTICE: Your instance of %1 has been upgraded to v%2, click here to see whats new.', array(APPLICATION_NAME, APPLICATION_VERSION)), 'destination' => 'http://www.timetrex.com/r.php?id=300'); } unset($new_version_notification); //Check installer enabled. if (isset($config_vars['other']['installer_enabled']) and $config_vars['other']['installer_enabled'] == 1) { $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1 is currently in INSTALL MODE. Please go to your timetrex.ini.php file and set "installer_enabled" to "FALSE".', APPLICATION_NAME), 'destination' => NULL); } //Make sure CronJobs are running correctly. $cjlf = new CronJobListFactory(); $cjlf->getMostRecentlyRun(); if ($cjlf->getRecordCount() > 0) { //Is last run job more then 48hrs old? $cj_obj = $cjlf->getCurrent(); if (PRODUCTION == TRUE and DEMO_MODE == FALSE and $cj_obj->getLastRunDate() < time() - 172800 and $cj_obj->getCreatedDate() < time() - 172800) { $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: Critical maintenance jobs have not run in the last 48hours. Please contact your %1 administrator immediately.', APPLICATION_NAME), 'destination' => NULL); } } unset($cjlf, $cj_obj); //Check if any pay periods are past their transaction date and not closed. if (DEMO_MODE == FALSE and $this->getPermissionObject()->Check('pay_period_schedule', 'enabled') and $this->getPermissionObject()->Check('pay_period_schedule', 'view')) { $pplf = TTnew('PayPeriodListFactory'); $pplf->getByCompanyIdAndStatusAndTransactionDate($this->getCurrentCompanyObject()->getId(), array(10, 30), TTDate::getBeginDayEpoch(time())); //Open or Post Adjustment pay periods. if ($pplf->getRecordCount() > 0) { foreach ($pplf as $pp_obj) { if ($pp_obj->getCreatedDate() < time() - 86400 * 40) { //Ignore pay period schedules newer than 40 days. They are automatically closed after 45 days. $retarr[] = array('delay' => 0, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: Pay periods past their transaction date have not been closed yet. It\'s critical that these pay periods are closed to prevent data loss, click here to close them now.'), 'destination' => array('menu_name' => 'Pay Periods')); break; } } } unset($pplf, $pp_obj); } //CHeck for unread messages $mclf = new MessageControlListFactory(); $unread_messages = $mclf->getNewMessagesByCompanyIdAndUserId($this->getCurrentCompanyObject()->getId(), $this->getCurrentUserObject()->getId()); Debug::text('UnRead Messages: ' . $unread_messages, __FILE__, __LINE__, __METHOD__, 10); if ($unread_messages > 0) { $retarr[] = array('delay' => 25, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('NOTICE: You have %1 new message(s) waiting, click here to read them now.', $unread_messages), 'destination' => array('menu_name' => 'Messages')); } unset($mclf, $unread_messages); if (DEMO_MODE == FALSE) { $elf = new ExceptionListFactory(); $elf->getFlaggedExceptionsByUserIdAndPayPeriodStatus($this->getCurrentUserObject()->getId(), 10); $display_exception_flag = FALSE; if ($elf->getRecordCount() > 0) { foreach ($elf as $e_obj) { if ($e_obj->getColumn('severity_id') == 30) { $display_exception_flag = 'red'; } break; } } if (isset($display_exception_flag) and $display_exception_flag !== FALSE) { Debug::Text('Exception Flag to Display: ' . $display_exception_flag, __FILE__, __LINE__, __METHOD__, 10); $retarr[] = array('delay' => 30, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('NOTICE: You have critical severity exceptions pending, click here to view them now.'), 'destination' => array('menu_name' => 'Exceptions')); } unset($elf, $e_obj, $display_exception_flag); } if (DEMO_MODE == FALSE and $this->getPermissionObject()->getLevel() >= 20 and ($this->getCurrentUserObject()->getWorkEmail() == '' and $this->getCurrentUserObject()->getHomeEmail() == '')) { $retarr[] = array('delay' => 30, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: Please click here and enter an email address for your account, this is required to receive important notices and prevent your account from being locked out.'), 'destination' => array('menu_name' => 'Contact Information')); } break; default: break; } //Check timezone is proper. $current_user_prefs = $this->getCurrentUserObject()->getUserPreferenceObject(); if ($current_user_prefs->setDateTimePreferences() == FALSE) { //Setting timezone failed, alert user to this fact. //WARNING: %1 was unable to set your time zone. Please contact your %1 administrator immediately.{/t} {if $permission->Check('company','enabled') AND $permission->Check('company','edit_own')}<a href="http://forums.timetrex.com/viewtopic.php?t=40">{t}For more information please click here.{/t}</a>{/if} if ($this->getPermissionObject()->Check('company', 'enabled') and $this->getPermissionObject()->Check('company', 'edit_own')) { $destination_url = 'http://www.timetrex.com/r.php?id=1010'; $sub_message = TTi18n::getText('For more information please click here.'); } else { $destination_url = NULL; $sub_message = NULL; } $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1 was unable to set your time zone. Please contact your %1 administrator immediately.', APPLICATION_NAME) . ' ' . $sub_message, 'destination' => $destination_url); unset($destination_url, $sub_message); } return $retarr; }
protected function _getOptions($name, $params = NULL) { $retval = NULL; switch ($name) { case 'output_format': $retval = parent::getOptions('default_output_format'); break; case 'default_setup_fields': $retval = array('template', 'columns'); break; case 'setup_fields': $retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2035-user_tag' => TTi18n::gettext('Employee Tags'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By')); if ($this->getUserObject()->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE) { $professional_edition_setup_fields = array('-2510-job_status_id' => TTi18n::gettext('Job Status'), '-2520-job_group_id' => TTi18n::gettext('Job Group'), '-2530-include_job_id' => TTi18n::gettext('Include Job'), '-2540-exclude_job_id' => TTi18n::gettext('Exclude Job'), '-2610-job_item_group_id' => TTi18n::gettext('Task Group'), '-2620-include_job_item_id' => TTi18n::gettext('Include Task'), '-2630-exclude_job_item_id' => TTi18n::gettext('Exclude Task')); $retval = array_merge($retval, $professional_edition_setup_fields); } break; case 'time_period': $retval = TTDate::getTimePeriodOptions(); break; case 'date_columns': /* $retval = array_merge( TTDate::getReportDateOptions( 'time_stamp', TTi18n::getText('Punch Time'), 19, FALSE ), array() ); */ break; case 'custom_columns': //Get custom fields for report data. $oflf = TTnew('OtherFieldListFactory'); //User and Punch fields conflict as they are merged together in a secondary process. $other_field_names = $oflf->getByCompanyIdAndTypeIdArray($this->getUserObject()->getCompany(), array(10), array(10 => '')); if (is_array($other_field_names)) { $retval = Misc::addSortPrefix($other_field_names, 9000); } break; case 'report_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); // Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns. // So just get custom columns with Selection and Formula. $custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'ActiveShiftReport', 'custom_column'); if (is_array($custom_column_labels)) { $retval = Misc::addSortPrefix($custom_column_labels, 9500); } } break; case 'report_custom_filters': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'ActiveShiftReport', 'custom_column'); } break; case 'report_dynamic_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'ActiveShiftReport', 'custom_column'); if (is_array($report_dynamic_custom_column_labels)) { $retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700); } } break; case 'report_static_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'ActiveShiftReport', 'custom_column'); if (is_array($report_static_custom_column_labels)) { $retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700); } } break; case 'formula_columns': $retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns'))); break; case 'filter_columns': $retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))); break; case 'static_columns': $retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1010-user_name' => TTi18n::gettext('User Name'), '-1020-phone_id' => TTi18n::gettext('Quick Punch ID'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1050-title' => TTi18n::gettext('Title'), '-1080-user_group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Branch'), '-1100-default_department' => TTi18n::gettext('Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1200-permission_control' => TTi18n::gettext('Permission Group'), '-1210-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1220-policy_group' => TTi18n::gettext('Policy Group'), '-1310-sex' => TTi18n::gettext('Gender'), '-1320-address1' => TTi18n::gettext('Address 1'), '-1330-address2' => TTi18n::gettext('Address 2'), '-1340-city' => TTi18n::gettext('City'), '-1350-province' => TTi18n::gettext('Province/State'), '-1360-country' => TTi18n::gettext('Country'), '-1370-postal_code' => TTi18n::gettext('Postal Code'), '-1380-work_phone' => TTi18n::gettext('Work Phone'), '-1391-work_phone_ext' => TTi18n::gettext('Work Phone Ext'), '-1400-home_phone' => TTi18n::gettext('Home Phone'), '-1410-mobile_phone' => TTi18n::gettext('Mobile Phone'), '-1420-fax_phone' => TTi18n::gettext('Fax Phone'), '-1430-home_email' => TTi18n::gettext('Home Email'), '-1440-work_email' => TTi18n::gettext('Work Email'), '-1495-tag' => TTi18n::gettext('Tags'), '-1740-time_zone_display' => TTi18n::gettext('Time Zone'), '-1801-type' => TTi18n::gettext('Type'), '-1802-status' => TTi18n::gettext('Status'), '-1810-branch' => TTi18n::gettext('Branch'), '-1820-department' => TTi18n::gettext('Department'), '-1830-station_type' => TTi18n::gettext('Station Type'), '-1840-station_station_id' => TTi18n::gettext('Station ID'), '-1850-station_source' => TTi18n::gettext('Station Source'), '-1860-station_description' => TTi18n::gettext('Station Description'), '-1900-time_stamp' => TTi18n::gettext('Punch Time'), '-1910-actual_time_stamp' => TTi18n::gettext('Actual Punch Time'), '-2010-note' => TTi18n::gettext('Note')); if ($this->getUserObject()->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE) { $professional_edition_static_columns = array('-1825-job' => TTi18n::gettext('Job'), '-1826-job_item' => TTi18n::gettext('Task')); $retval = array_merge($retval, $professional_edition_static_columns, (array) $this->getOptions('report_static_custom_column')); } break; case 'dynamic_columns': $retval = array('-2000-total_user' => TTi18n::gettext('Total Employees')); break; case 'columns': $retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('custom_columns'), (array) $this->getOptions('report_dynamic_custom_column')); break; case 'column_format': //Define formatting function for each column. $columns = array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_custom_column')); if (is_array($columns)) { foreach ($columns as $column => $name) { if (strpos($column, 'wage') !== FALSE or strpos($column, 'hourly_rate') !== FALSE) { $retval[$column] = 'currency'; } } } break; case 'aggregates': $retval = array(); $dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')))); if (is_array($dynamic_columns)) { foreach ($dynamic_columns as $column) { switch ($column) { default: if (strpos($column, 'hourly_rate') !== FALSE or strpos($column, 'wage') !== FALSE) { $retval[$column] = 'avg'; } else { $retval[$column] = 'sum'; } } } } break; case 'templates': $retval = array('-1010-by_status_by_employee' => TTi18n::gettext('Punches By Status'), '-1020-by_type_by_employee' => TTi18n::gettext('Punches By Type'), '-1030-by_status_by_type_by_employee' => TTi18n::gettext('Punches By Status/Type'), '-1040-by_type_by_status_by_employee' => TTi18n::gettext('Punches By Type/Status'), '-1050-by_employee' => TTi18n::gettext('Punches By Employee'), '-1060-by_default_branch_by_employee' => TTi18n::gettext('Punches By Default Branch'), '-1070-by_default_department_by_employee' => TTi18n::gettext('Punches By Default Department'), '-1080-by_default_branch_by_default_department_by_employee' => TTi18n::gettext('Punches By Default Branch/Department'), '-1090-by_branch_by_employee' => TTi18n::gettext('Punches By Branch'), '-1100-by_department_by_employee' => TTi18n::gettext('Punches By Department'), '-1110-by_branch_by_department_by_employee' => TTi18n::gettext('Punches By Branch/Department'), '-1120-by_station_by_employee' => TTi18n::gettext('Punches By Station'), '-1130-by_station_type_by_employee' => TTi18n::gettext('Punches By Station Type')); if ($this->getUserObject()->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE) { $professional_edition_setup_fields = array('-1112-by_job_by_job_item_by_employee' => TTi18n::gettext('Punches By Job/Task')); $retval = array_merge($retval, $professional_edition_setup_fields); } break; case 'template_config': //Last 7 days does not include today. //$retval['-1010-time_period']['time_period'] = 'last_7_days'; //Default to just the last 7 days to speed up the query. $retval['-1010-time_period']['time_period'] = 'today'; //Default to just the last 7 days to speed up the query. $template = strtolower(Misc::trimSortPrefix($params['template'])); if (isset($template) and $template != '') { switch ($template) { case 'by_employee': $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'status'; $retval['columns'][] = 'type'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_default_branch_by_employee': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'status'; $retval['columns'][] = 'type'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('status' => 'asc'); $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_default_department_by_employee': $retval['columns'][] = 'default_department'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'status'; $retval['columns'][] = 'type'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('default_department' => 'asc'); $retval['sort'][] = array('status' => 'asc'); $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_default_branch_by_default_department_by_employee': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'status'; $retval['columns'][] = 'type'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); $retval['sort'][] = array('status' => 'asc'); $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_branch_by_employee': $retval['columns'][] = 'branch'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'status'; $retval['columns'][] = 'type'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('branch' => 'asc'); $retval['sort'][] = array('status' => 'asc'); $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_department_by_employee': $retval['columns'][] = 'department'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'status'; $retval['columns'][] = 'type'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('department' => 'asc'); $retval['sort'][] = array('status' => 'asc'); $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_branch_by_department_by_employee': $retval['columns'][] = 'branch'; $retval['columns'][] = 'department'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'status'; $retval['columns'][] = 'type'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('branch' => 'asc'); $retval['sort'][] = array('department' => 'asc'); $retval['sort'][] = array('status' => 'asc'); $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_job_by_job_item_by_employee': $retval['columns'][] = 'job'; $retval['columns'][] = 'job_item'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'status'; $retval['columns'][] = 'type'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('job' => 'asc'); $retval['sort'][] = array('job_item' => 'asc'); $retval['sort'][] = array('status' => 'asc'); $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_status_by_employee': $retval['columns'][] = 'status'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('status' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_type_by_employee': $retval['columns'][] = 'type'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_status_by_type_by_employee': $retval['columns'][] = 'status'; $retval['columns'][] = 'type'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('status' => 'asc'); $retval['sort'][] = array('type' => 'desc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_type_by_status_by_employee': $retval['columns'][] = 'type'; $retval['columns'][] = 'status'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('type' => 'desc'); $retval['sort'][] = array('status' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_station_by_employee': $retval['columns'][] = 'station_description'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'type'; $retval['columns'][] = 'status'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('station_description' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_station_type_by_employee': $retval['columns'][] = 'station_type'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'type'; $retval['columns'][] = 'status'; $retval['columns'][] = 'time_stamp'; $retval['sort'][] = array('station_type' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; default: Debug::Text(' Parsing template name: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; } } //Set the template dropdown as well. $retval['-1000-template'] = $template; //Add sort prefixes so Flex can maintain order. if (isset($retval['filter'])) { $retval['-5000-filter'] = $retval['filter']; unset($retval['filter']); } if (isset($retval['columns'])) { $retval['-5010-columns'] = $retval['columns']; unset($retval['columns']); } if (isset($retval['group'])) { $retval['-5020-group'] = $retval['group']; unset($retval['group']); } if (isset($retval['sub_total'])) { $retval['-5030-sub_total'] = $retval['sub_total']; unset($retval['sub_total']); } if (isset($retval['sort'])) { $retval['-5040-sort'] = $retval['sort']; unset($retval['sort']); } Debug::Arr($retval, ' Template Config for: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; default: //Call report parent class options function for options valid for all reports. $retval = $this->__getOptions($name); break; } return $retval; }
protected function _getOptions($name, $params = NULL) { $retval = NULL; switch ($name) { case 'output_format': $retval = array_merge(parent::getOptions('default_output_format'), array('-1100-pdf_form' => TTi18n::gettext('Employee (One Employee/Page)'), '-1110-pdf_form_government' => TTi18n::gettext('Government (Multiple Employees/Page)'), '-1120-efile' => TTi18n::gettext('eFile'))); break; case 'default_setup_fields': $retval = array('template', 'time_period', 'columns'); break; case 'setup_fields': $retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-4020-exclude_ytd_adjustment' => TTi18n::gettext('Exclude YTD Adjustments'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By')); break; case 'time_period': $retval = TTDate::getTimePeriodOptions(); break; case 'date_columns': //$retval = TTDate::getReportDateOptions( NULL, TTi18n::getText('Date'), 13, TRUE ); $retval = array(); break; case 'report_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); // Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns. // So just get custom columns with Selection and Formula. $custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'FormW2Report', 'custom_column'); if (is_array($custom_column_labels)) { $retval = Misc::addSortPrefix($custom_column_labels, 9500); } } break; case 'report_custom_filters': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'FormW2Report', 'custom_column'); } break; case 'report_dynamic_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'FormW2Report', 'custom_column'); if (is_array($report_dynamic_custom_column_labels)) { $retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700); } } break; case 'report_static_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'FormW2Report', 'custom_column'); if (is_array($report_static_custom_column_labels)) { $retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700); } } break; case 'formula_columns': $retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns'))); break; case 'filter_columns': $retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))); break; case 'static_columns': $retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1035-sin' => TTi18n::gettext('SIN/SSN'), '-1040-status' => TTi18n::gettext('Status'), '-1050-title' => TTi18n::gettext('Title'), '-1080-group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Default Branch'), '-1100-default_department' => TTi18n::gettext('Default Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1400-permission_control' => TTi18n::gettext('Permission Group'), '-1410-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1420-policy_group' => TTi18n::gettext('Policy Group'), '-1510-address1' => TTi18n::gettext('Address 1'), '-1512-address2' => TTi18n::gettext('Address 2'), '-1520-city' => TTi18n::gettext('City'), '-1522-province' => TTi18n::gettext('Province/State'), '-1524-country' => TTi18n::gettext('Country'), '-1526-postal_code' => TTi18n::gettext('Postal Code'), '-1530-work_phone' => TTi18n::gettext('Work Phone'), '-1540-work_phone_ext' => TTi18n::gettext('Work Phone Ext'), '-1550-home_phone' => TTi18n::gettext('Home Phone'), '-1560-home_email' => TTi18n::gettext('Home Email'), '-1590-note' => TTi18n::gettext('Note'), '-1595-tag' => TTi18n::gettext('Tags')); $retval = array_merge($retval, $this->getOptions('date_columns'), (array) $this->getOptions('report_static_custom_column')); ksort($retval); break; case 'dynamic_columns': $retval = array('-2010-l1' => TTi18n::gettext('Wages (1)'), '-2020-l2' => TTi18n::gettext('Federal Income Tax (2)'), '-2030-l3' => TTi18n::gettext('Social Security Wages (3)'), '-2040-l4' => TTi18n::gettext('Social Security Tax (4)'), '-2040-l7' => TTi18n::gettext('Social Security Tips (7)'), '-2050-l5' => TTi18n::gettext('Medicare Wages (5)'), '-2060-l6' => TTi18n::gettext('Medicare Tax (6)'), '-2070-l8' => TTi18n::gettext('Allocated Tips (8)'), '-2080-l10' => TTi18n::gettext('Dependent Care Benefits (10)'), '-2090-l11' => TTi18n::gettext('Nonqualified Plans (11)'), '-2100-l12a' => TTi18n::gettext('Box 12a'), '-2110-l12b' => TTi18n::gettext('Box 12b'), '-2120-l12c' => TTi18n::gettext('Box 12c'), '-2130-l12d' => TTi18n::gettext('Box 12d'), '-2200-l14a' => TTi18n::gettext('Box 14a'), '-2210-l14b' => TTi18n::gettext('Box 14b'), '-2220-l14c' => TTi18n::gettext('Box 14c'), '-2230-l14d' => TTi18n::gettext('Box 14d')); break; case 'columns': $retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')); break; case 'column_format': //Define formatting function for each column. $columns = array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_custom_column')); if (is_array($columns)) { foreach ($columns as $column => $name) { $retval[$column] = 'currency'; } } break; case 'aggregates': $retval = array(); $dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')))); if (is_array($dynamic_columns)) { foreach ($dynamic_columns as $column) { switch ($column) { default: $retval[$column] = 'sum'; } } } break; case 'templates': $retval = array('-1020-by_employee' => TTi18n::gettext('by Employee'), '-1030-by_branch' => TTi18n::gettext('by Branch'), '-1040-by_department' => TTi18n::gettext('by Department'), '-1050-by_branch_by_department' => TTi18n::gettext('by Branch/Department')); break; case 'template_config': $template = strtolower(Misc::trimSortPrefix($params['template'])); if (isset($template) and $template != '') { switch ($template) { case 'default': //Proper settings to generate the form. //$retval['-1010-time_period']['time_period'] = 'last_quarter'; $retval['columns'] = $this->getOptions('columns'); $retval['group'][] = 'date_quarter_month'; $retval['sort'][] = array('date_quarter_month' => 'asc'); $retval['other']['grand_total'] = TRUE; break; default: Debug::Text(' Parsing template name: ' . $template, __FILE__, __LINE__, __METHOD__, 10); $retval['-1010-time_period']['time_period'] = 'last_year'; //Parse template name, and use the keywords separated by '+' to determine settings. $template_keywords = explode('+', $template); if (is_array($template_keywords)) { foreach ($template_keywords as $template_keyword) { Debug::Text(' Keyword: ' . $template_keyword, __FILE__, __LINE__, __METHOD__, 10); switch ($template_keyword) { //Columns //Filter //Group By //SubTotal //Sort case 'by_month': $retval['columns'][] = 'date_month'; $retval['group'][] = 'date_month'; $retval['sort'][] = array('date_month' => 'asc'); break; case 'by_employee': $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['group'][] = 'first_name'; $retval['group'][] = 'last_name'; $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_branch': $retval['columns'][] = 'default_branch'; $retval['group'][] = 'default_branch'; $retval['sort'][] = array('default_branch' => 'asc'); break; case 'by_department': $retval['columns'][] = 'default_department'; $retval['group'][] = 'default_department'; $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_branch_by_department': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['group'][] = 'default_branch'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'default_branch'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_month_by_employee': $retval['columns'][] = 'date_month'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['group'][] = 'date_month'; $retval['group'][] = 'first_name'; $retval['group'][] = 'last_name'; $retval['sub_total'][] = 'date_month'; $retval['sort'][] = array('date_month' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_month_by_branch': $retval['columns'][] = 'date_month'; $retval['columns'][] = 'default_branch'; $retval['group'][] = 'date_month'; $retval['group'][] = 'default_branch'; $retval['sub_total'][] = 'date_month'; $retval['sort'][] = array('date_month' => 'asc'); $retval['sort'][] = array('default_branch' => 'asc'); break; case 'by_month_by_department': $retval['columns'][] = 'date_month'; $retval['columns'][] = 'default_department'; $retval['group'][] = 'date_month'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'date_month'; $retval['sort'][] = array('date_month' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_month_by_branch_by_department': $retval['columns'][] = 'date_month'; $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['group'][] = 'date_month'; $retval['group'][] = 'default_branch'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'date_month'; $retval['sub_total'][] = 'default_branch'; $retval['sort'][] = array('date_month' => 'asc'); $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); break; } } } $retval['columns'] = array_merge($retval['columns'], array_keys(Misc::trimSortPrefix($this->getOptions('dynamic_columns')))); break; } } //Set the template dropdown as well. $retval['-1000-template'] = $template; //Add sort prefixes so Flex can maintain order. if (isset($retval['filter'])) { $retval['-5000-filter'] = $retval['filter']; unset($retval['filter']); } if (isset($retval['columns'])) { $retval['-5010-columns'] = $retval['columns']; unset($retval['columns']); } if (isset($retval['group'])) { $retval['-5020-group'] = $retval['group']; unset($retval['group']); } if (isset($retval['sub_total'])) { $retval['-5030-sub_total'] = $retval['sub_total']; unset($retval['sub_total']); } if (isset($retval['sort'])) { $retval['-5040-sort'] = $retval['sort']; unset($retval['sort']); } Debug::Arr($retval, ' Template Config for: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; default: //Call report parent class options function for options valid for all reports. $retval = $this->__getOptions($name); break; } return $retval; }
protected function _getOptions($name, $params = NULL) { $retval = NULL; switch ($name) { case 'output_format': $psf = TTnew('PayStubFactory'); $retval = array_merge(parent::getOptions('default_output_format'), array('-1100-pdf_employee_pay_stub' => TTi18n::gettext('Employee Pay Stub'), '-1110-pdf_employer_pay_stub' => TTi18n::gettext('Employer Pay Stub')), Misc::addSortPrefix(Misc::trimSortPrefix($psf->getOptions('export_type')), 1200)); break; case 'default_setup_fields': $retval = array('template', 'time_period', 'columns'); break; case 'setup_fields': $retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2035-user_tag' => TTi18n::gettext('Employee Tags'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2080-currency_id' => TTi18n::gettext('Currency'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-4020-exclude_ytd_adjustment' => TTi18n::gettext('Exclude YTD Adjustments'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By')); break; case 'time_period': $retval = TTDate::getTimePeriodOptions(); break; case 'date_columns': $retval = TTDate::getReportDateOptions('transaction', TTi18n::getText('Transaction Date'), 13, TRUE); break; case 'custom_columns': //Get custom fields for report data. $oflf = TTnew('OtherFieldListFactory'); //User and Punch fields conflict as they are merged together in a secondary process. $other_field_names = $oflf->getByCompanyIdAndTypeIdArray($this->getUserObject()->getCompany(), array(10), array(10 => '')); if (is_array($other_field_names)) { $retval = Misc::addSortPrefix($other_field_names, 9000); } break; case 'report_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); // Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns. // So just get custom columns with Selection and Formula. $custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'PayStubSummaryReport', 'custom_column'); if (is_array($custom_column_labels)) { $retval = Misc::addSortPrefix($custom_column_labels, 9500); } } break; case 'report_custom_filters': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'PayStubSummaryReport', 'custom_column'); } break; case 'report_dynamic_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'PayStubSummaryReport', 'custom_column'); if (is_array($report_dynamic_custom_column_labels)) { $retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700); } } break; case 'report_static_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'PayStubSummaryReport', 'custom_column'); if (is_array($report_static_custom_column_labels)) { $retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700); } } break; case 'formula_columns': $retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns'))); break; case 'filter_columns': $retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))); break; case 'static_columns': $retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1040-status' => TTi18n::gettext('Status'), '-1050-title' => TTi18n::gettext('Title'), '-1055-city' => TTi18n::gettext('City'), '-1060-province' => TTi18n::gettext('Province/State'), '-1070-country' => TTi18n::gettext('Country'), '-1080-user_group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Default Branch'), '-1100-default_department' => TTi18n::gettext('Default Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1131-current_currency' => TTi18n::gettext('Current Currency'), '-1200-permission_control' => TTi18n::gettext('Permission Group'), '-1210-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1220-policy_group' => TTi18n::gettext('Policy Group'), '-1280-sin' => TTi18n::gettext('SIN/SSN'), '-1290-note' => TTi18n::gettext('Note'), '-1295-tag' => TTi18n::gettext('Tags')); $retval = array_merge($retval, (array) $this->getOptions('date_columns'), (array) $this->getOptions('custom_columns'), (array) $this->getOptions('report_static_custom_column')); ksort($retval); break; case 'dynamic_columns': $retval = array('-2900-total_pay_stub' => TTi18n::gettext('Total Pay Stubs')); $retval = array_merge($retval, $this->getOptions('pay_stub_account_amount_columns')); ksort($retval); break; case 'pay_stub_account_amount_columns': //Get all pay stub accounts $retval = array(); $psealf = TTnew('PayStubEntryAccountListFactory'); $psealf->getByCompanyIdAndStatusIdAndTypeId($this->getUserObject()->getCompany(), 10, array(10, 20, 30, 40, 50, 60, 65)); if ($psealf->getRecordCount() > 0) { $type_options = $psealf->getOptions('type'); foreach ($type_options as $key => $val) { $type_options[$key] = str_replace(array('Employee', 'Employer', 'Deduction', 'Total'), array('EE', 'ER', 'Ded', ''), $val); } $i = 0; foreach ($psealf as $psea_obj) { //Need to make the PSEA_ID a string so we can array_merge it properly later. if ($psea_obj->getType() == 40) { //Total accounts. $prefix = NULL; } else { $prefix = $type_options[$psea_obj->getType()] . ' - '; } $retval['-3' . str_pad($i, 3, 0, STR_PAD_LEFT) . '-PA' . $psea_obj->getID()] = $prefix . $psea_obj->getName(); if ($psea_obj->getType() == 10) { //Earnings only can see units. $retval['-4' . str_pad($i, 3, 0, STR_PAD_LEFT) . '-PR' . $psea_obj->getID()] = $prefix . $psea_obj->getName() . ' [' . TTi18n::getText('Rate') . ']'; $retval['-5' . str_pad($i, 3, 0, STR_PAD_LEFT) . '-PU' . $psea_obj->getID()] = $prefix . $psea_obj->getName() . ' [' . TTi18n::getText('Units') . ']'; } if ($psea_obj->getType() == 50) { //Accruals, display balance/YTD amount. $retval['-6' . str_pad($i, 3, 0, STR_PAD_LEFT) . '-PY' . $psea_obj->getID()] = $prefix . $psea_obj->getName() . ' [' . TTi18n::getText('Balance') . ']'; } $i++; } } break; case 'pay_stub_account_unit_columns': //Units are only good for earnings? break; case 'pay_stub_account_ytd_columns': break; case 'columns': $retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')); break; case 'column_format': //Define formatting function for each column. $columns = Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_custom_column'))); if (is_array($columns)) { foreach ($columns as $column => $name) { if (substr($column, 0, 2) == 'PU') { $retval[$column] = 'numeric'; } elseif (strpos($column, '_wage') !== FALSE or strpos($column, '_hourly_rate') !== FALSE or substr($column, 0, 2) == 'PA' or substr($column, 0, 2) == 'PY' or substr($column, 0, 2) == 'PR') { $retval[$column] = 'currency'; } elseif (strpos($column, '_time') or strpos($column, '_policy')) { $retval[$column] = 'time_unit'; } } } $retval['verified_time_sheet_date'] = 'time_stamp'; break; case 'aggregates': $retval = array(); $dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')))); if (is_array($dynamic_columns)) { foreach ($dynamic_columns as $column) { switch ($column) { default: if (strpos($column, '_hourly_rate') !== FALSE or substr($column, 0, 2) == 'PR') { $retval[$column] = 'avg'; } else { $retval[$column] = 'sum'; } } } } $retval['verified_time_sheet'] = 'first'; $retval['verified_time_sheet_date'] = 'first'; break; case 'templates': $retval = array('-1010-by_employee+totals' => TTi18n::gettext('Totals by Employee'), '-1020-by_employee+earnings' => TTi18n::gettext('Earnings by Employee'), '-1030-by_employee+employee_deductions' => TTi18n::gettext('Deductions by Employee'), '-1040-by_employee+employer_deductions' => TTi18n::gettext('Employer Contributions by Employee'), '-1050-by_employee+accruals' => TTi18n::gettext('Accruals by Employee'), '-1060-by_employee+totals+earnings+employee_deductions+employer_deductions+accruals' => TTi18n::gettext('All Accounts by Employee'), '-1110-by_title+totals' => TTi18n::gettext('Totals by Title'), '-1120-by_group+totals' => TTi18n::gettext('Totals by Group'), '-1130-by_branch+totals' => TTi18n::gettext('Totals by Branch'), '-1140-by_department+totals' => TTi18n::gettext('Totals by Department'), '-1150-by_branch_by_department+totals' => TTi18n::gettext('Totals by Branch/Department'), '-1160-by_pay_period+totals' => TTi18n::gettext('Totals by Pay Period'), '-1210-by_pay_period_by_employee+totals' => TTi18n::gettext('Totals by Pay Period/Employee'), '-1220-by_employee_by_pay_period+totals' => TTi18n::gettext('Totals by Employee/Pay Period'), '-1230-by_branch_by_pay_period+totals' => TTi18n::gettext('Totals by Branch/Pay Period'), '-1240-by_department_by_pay_period+totals' => TTi18n::gettext('Totals by Department/Pay Period'), '-1250-by_branch_by_department_by_pay_period+totals' => TTi18n::gettext('Totals by Branch/Department/Pay Period')); break; case 'template_config': $template = strtolower(Misc::trimSortPrefix($params['template'])); if (isset($template) and $template != '') { $pseallf = TTnew('PayStubEntryAccountLinkListFactory'); $pseallf->getByCompanyId($this->getUserObject()->getCompany()); if ($pseallf->getRecordCount() > 0) { $pseal_obj = $pseallf->getCurrent(); $default_linked_columns = array($pseal_obj->getTotalGross(), $pseal_obj->getTotalNetPay(), $pseal_obj->getTotalEmployeeDeduction(), $pseal_obj->getTotalEmployerDeduction()); } else { $default_linked_columns = array(); } unset($pseallf, $pseal_obj); switch ($template) { default: Debug::Text(' Parsing template name: ' . $template, __FILE__, __LINE__, __METHOD__, 10); $retval['-1010-time_period']['time_period'] = 'last_pay_period'; //Parse template name, and use the keywords separated by '+' to determine settings. $template_keywords = explode('+', $template); if (is_array($template_keywords)) { foreach ($template_keywords as $template_keyword) { Debug::Text(' Keyword: ' . $template_keyword, __FILE__, __LINE__, __METHOD__, 10); switch ($template_keyword) { //Columns case 'earnings': $retval['columns'][] = 'PA' . $default_linked_columns[0]; //Total Gross $retval['columns'][] = 'PA' . $default_linked_columns[1]; //Net Pay $psealf = TTnew('PayStubEntryAccountListFactory'); $psealf->getByCompanyIdAndStatusIdAndTypeId($this->getUserObject()->getCompany(), 10, array(10)); if ($psealf->getRecordCount() > 0) { foreach ($psealf as $psea_obj) { $retval['columns'][] = 'PA' . $psea_obj->getID(); } } break; case 'employee_deductions': $retval['columns'][] = 'PA' . $default_linked_columns[2]; //Employee Deductions $psealf = TTnew('PayStubEntryAccountListFactory'); $psealf->getByCompanyIdAndStatusIdAndTypeId($this->getUserObject()->getCompany(), 10, array(20)); if ($psealf->getRecordCount() > 0) { foreach ($psealf as $psea_obj) { $retval['columns'][] = 'PA' . $psea_obj->getID(); } } break; case 'employer_deductions': $retval['columns'][] = 'PA' . $default_linked_columns[3]; //Employor Deductions $psealf = TTnew('PayStubEntryAccountListFactory'); $psealf->getByCompanyIdAndStatusIdAndTypeId($this->getUserObject()->getCompany(), 10, array(30)); if ($psealf->getRecordCount() > 0) { foreach ($psealf as $psea_obj) { $retval['columns'][] = 'PA' . $psea_obj->getID(); } } break; case 'totals': $psealf = TTnew('PayStubEntryAccountListFactory'); $psealf->getByCompanyIdAndStatusIdAndTypeId($this->getUserObject()->getCompany(), 10, array(40)); if ($psealf->getRecordCount() > 0) { foreach ($psealf as $psea_obj) { $retval['columns'][] = 'PA' . $psea_obj->getID(); } } break; case 'accruals': $psealf = TTnew('PayStubEntryAccountListFactory'); $psealf->getByCompanyIdAndStatusIdAndTypeId($this->getUserObject()->getCompany(), 10, array(50)); if ($psealf->getRecordCount() > 0) { foreach ($psealf as $psea_obj) { $retval['columns'][] = 'PA' . $psea_obj->getID(); } } break; //Filter //Group By //SubTotal //Sort //Filter //Group By //SubTotal //Sort case 'by_employee': $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['group'][] = 'first_name'; $retval['group'][] = 'last_name'; $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_title': $retval['columns'][] = 'title'; $retval['group'][] = 'title'; $retval['sort'][] = array('title' => 'asc'); break; case 'by_group': $retval['columns'][] = 'user_group'; $retval['group'][] = 'user_group'; $retval['sort'][] = array('user_group' => 'asc'); break; case 'by_branch': $retval['columns'][] = 'default_branch'; $retval['group'][] = 'default_branch'; $retval['sort'][] = array('default_branch' => 'asc'); break; case 'by_department': $retval['columns'][] = 'default_department'; $retval['group'][] = 'default_department'; $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_branch_by_department': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['group'][] = 'default_branch'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'default_branch'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_pay_period': $retval['columns'][] = 'transaction-pay_period'; $retval['group'][] = 'transaction-pay_period'; $retval['sort'][] = array('transaction-pay_period' => 'asc'); break; case 'by_pay_period_by_employee': $retval['columns'][] = 'transaction-pay_period'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['group'][] = 'transaction-pay_period'; $retval['group'][] = 'first_name'; $retval['group'][] = 'last_name'; $retval['sub_total'][] = 'transaction-pay_period'; $retval['sort'][] = array('transaction-pay_period' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_pay_period_by_branch': $retval['columns'][] = 'transaction-pay_period'; $retval['columns'][] = 'default_branch'; $retval['group'][] = 'transaction-pay_period'; $retval['group'][] = 'default_branch'; $retval['sub_total'][] = 'transaction-pay_period'; $retval['sort'][] = array('transaction-pay_period' => 'asc'); $retval['sort'][] = array('default_branch' => 'asc'); break; case 'by_pay_period_by_department': $retval['columns'][] = 'transaction-pay_period'; $retval['columns'][] = 'default_department'; $retval['group'][] = 'transaction-pay_period'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'transaction-pay_period'; $retval['sort'][] = array('transaction-pay_period' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_pay_period_by_branch_by_department': $retval['columns'][] = 'transaction-pay_period'; $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['group'][] = 'transaction-pay_period'; $retval['group'][] = 'default_branch'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'transaction-pay_period'; $retval['sub_total'][] = 'default_branch'; $retval['sort'][] = array('transaction-pay_period' => 'asc'); $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_employee_by_pay_period': $retval['columns'][] = 'full_name'; $retval['columns'][] = 'transaction-pay_period'; $retval['group'][] = 'full_name'; $retval['group'][] = 'transaction-pay_period'; $retval['sub_total'][] = 'full_name'; $retval['sort'][] = array('full_name' => 'asc'); $retval['sort'][] = array('transaction-pay_period' => 'asc'); break; case 'by_branch_by_pay_period': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'transaction-pay_period'; $retval['group'][] = 'default_branch'; $retval['group'][] = 'transaction-pay_period'; $retval['sub_total'][] = 'default_branch'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('transaction-pay_period' => 'asc'); break; case 'by_department_by_pay_period': $retval['columns'][] = 'default_department'; $retval['columns'][] = 'transaction-pay_period'; $retval['group'][] = 'default_department'; $retval['group'][] = 'transaction-pay_period'; $retval['sub_total'][] = 'default_department'; $retval['sort'][] = array('default_department' => 'asc'); $retval['sort'][] = array('transaction-pay_period' => 'asc'); break; case 'by_branch_by_department_by_pay_period': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['columns'][] = 'transaction-pay_period'; $retval['group'][] = 'default_branch'; $retval['group'][] = 'default_department'; $retval['group'][] = 'transaction-pay_period'; $retval['sub_total'][] = 'default_branch'; $retval['sub_total'][] = 'default_department'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); $retval['sort'][] = array('transaction-pay_period' => 'asc'); break; } } } break; } } //Set the template dropdown as well. $retval['-1000-template'] = $template; //Add sort prefixes so Flex can maintain order. if (isset($retval['filter'])) { $retval['-5000-filter'] = $retval['filter']; unset($retval['filter']); } if (isset($retval['columns'])) { $retval['-5010-columns'] = $retval['columns']; unset($retval['columns']); } if (isset($retval['group'])) { $retval['-5020-group'] = $retval['group']; unset($retval['group']); } if (isset($retval['sub_total'])) { $retval['-5030-sub_total'] = $retval['sub_total']; unset($retval['sub_total']); } if (isset($retval['sort'])) { $retval['-5040-sort'] = $retval['sort']; unset($retval['sort']); } Debug::Arr($retval, ' Template Config for: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; default: //Call report parent class options function for options valid for all reports. $retval = $this->__getOptions($name); break; } return $retval; }
function getLastPunchByCompanyIdAndArrayCriteria($company_id, $filter_data, $limit = NULL, $page = NULL, $where = NULL, $order = NULL) { if ($company_id == '') { return FALSE; } if (!is_array($order)) { //Use Filter Data ordering if its set. if (isset($filter_data['sort_column']) and $filter_data['sort_order']) { $order = array(Misc::trimSortPrefix($filter_data['sort_column']) => $filter_data['sort_order']); } } //$additional_order_fields = array('b.name', 'c.name', 'd.name', 'e.name'); $additional_order_fields = array('b.branch_id', 'c.date_stamp', 'd.last_name', 'a.time_stamp', 'a.status_id', 'b.branch_id', 'b.department_id', 'e.type_id'); if ($order == NULL) { $order = array('b.branch_id' => 'asc', 'd.last_name' => 'asc', 'a.time_stamp' => 'desc', 'a.punch_control_id' => 'asc', 'a.status_id' => 'asc'); $strict = FALSE; } else { $strict = TRUE; } //Debug::Arr($order,'Order Data:', __FILE__, __LINE__, __METHOD__,10); //Debug::Arr($filter_data,'Filter Data:', __FILE__, __LINE__, __METHOD__,10); if (isset($filter_data['exclude_user_ids'])) { $filter_data['exclude_id'] = $filter_data['exclude_user_ids']; } if (isset($filter_data['include_user_ids'])) { $filter_data['id'] = $filter_data['include_user_ids']; } if (isset($filter_data['user_status_ids'])) { $filter_data['status_id'] = $filter_data['user_status_ids']; } if (isset($filter_data['user_title_ids'])) { $filter_data['title_id'] = $filter_data['user_title_ids']; } if (isset($filter_data['group_ids'])) { $filter_data['group_id'] = $filter_data['group_ids']; } if (isset($filter_data['branch_ids'])) { $filter_data['default_branch_id'] = $filter_data['branch_ids']; } if (isset($filter_data['department_ids'])) { $filter_data['default_department_id'] = $filter_data['department_ids']; } if (isset($filter_data['punch_branch_ids'])) { $filter_data['punch_branch_id'] = $filter_data['punch_branch_ids']; } if (isset($filter_data['punch_department_ids'])) { $filter_data['punch_department_id'] = $filter_data['punch_department_ids']; } if (isset($filter_data['exclude_job_ids'])) { $filter_data['exclude_id'] = $filter_data['exclude_job_ids']; } if (isset($filter_data['include_job_ids'])) { $filter_data['include_job_id'] = $filter_data['include_job_ids']; } if (isset($filter_data['job_group_ids'])) { $filter_data['job_group_id'] = $filter_data['job_group_ids']; } if (isset($filter_data['job_item_ids'])) { $filter_data['job_item_id'] = $filter_data['job_item_ids']; } $uf = new UserFactory(); $udf = new UserDateFactory(); $pcf = new PunchControlFactory(); $sf = new StationFactory(); if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $jf = new JobFactory(); $jif = new JobItemFactory(); } $ph = array('company_id' => $company_id); $query = ' select a.id as punch_id, a.punch_control_id as punch_control_id, a.type_id as type_id, a.status_id as status_id, a.time_stamp as time_stamp, a.actual_time_stamp as actual_time_stamp, b.user_date_id as user_date_id, c.date_stamp as date_stamp, b.branch_id as branch_id, b.department_id as department_id, b.job_id as job_id, b.job_item_id as job_item_id, b.note as note, c.user_id as user_id, e.type_id as station_type_id, e.station_id as station_station_id, e.source as station_source, e.description as station_description from ' . $this->getTable() . ' as a LEFT JOIN ' . $pcf->getTable() . ' as b ON a.punch_control_id = b.id LEFT JOIN ' . $udf->getTable() . ' as c ON b.user_date_id = c.id LEFT JOIN ' . $uf->getTable() . ' as d ON c.user_id = d.id LEFT JOIN ' . $sf->getTable() . ' as e ON a.station_id = e.id LEFT JOIN ( select tmp2_d.id, max(tmp2_a.time_stamp) as max_punch_time_stamp from ' . $this->getTable() . ' as tmp2_a LEFT JOIN ' . $pcf->getTable() . ' as tmp2_b ON tmp2_a.punch_control_id = tmp2_b.id LEFT JOIN ' . $udf->getTable() . ' as tmp2_c ON tmp2_b.user_date_id = tmp2_c.id LEFT JOIN ' . $uf->getTable() . ' as tmp2_d ON tmp2_c.user_id = tmp2_d.id WHERE tmp2_d.company_id = ?'; if (isset($filter_data['start_date']) and trim($filter_data['start_date']) != '') { $ph[] = $this->db->BindDate($filter_data['start_date']); $query .= ' AND tmp2_c.date_stamp >= ?'; } if (isset($filter_data['end_date']) and trim($filter_data['end_date']) != '') { $ph[] = $this->db->BindDate($filter_data['end_date']); $query .= ' AND tmp2_c.date_stamp <= ?'; } $query .= ' AND tmp2_a.time_stamp is not null AND ( tmp2_a.deleted = 0 AND tmp2_b.deleted = 0 AND tmp2_c.deleted = 0 ) group by tmp2_d.id ) as tmp2 ON c.user_id = tmp2.id AND a.time_stamp = tmp2.max_punch_time_stamp '; if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $query .= ' LEFT JOIN ' . $jf->getTable() . ' as x ON b.job_id = x.id'; $query .= ' LEFT JOIN ' . $jif->getTable() . ' as y ON b.job_item_id = y.id'; } $ph[] = $company_id; $query .= ' WHERE tmp2.id IS NOT NULL AND d.company_id = ?'; if (isset($filter_data['permission_children_ids']) and isset($filter_data['permission_children_ids'][0]) and !in_array(-1, (array) $filter_data['permission_children_ids'])) { $query .= ' AND d.id in (' . $this->getListSQL($filter_data['permission_children_ids'], $ph) . ') '; } if (isset($filter_data['id']) and isset($filter_data['id'][0]) and !in_array(-1, (array) $filter_data['id'])) { $query .= ' AND d.id in (' . $this->getListSQL($filter_data['id'], $ph) . ') '; } if (isset($filter_data['exclude_id']) and isset($filter_data['exclude_id'][0]) and !in_array(-1, (array) $filter_data['exclude_id'])) { $query .= ' AND d.id not in (' . $this->getListSQL($filter_data['exclude_id'], $ph) . ') '; } if (isset($filter_data['status_id']) and isset($filter_data['status_id'][0]) and !in_array(-1, (array) $filter_data['status_id'])) { $query .= ' AND d.status_id in (' . $this->getListSQL($filter_data['status_id'], $ph) . ') '; } if (isset($filter_data['group_id']) and isset($filter_data['group_id'][0]) and !in_array(-1, (array) $filter_data['group_id'])) { if (isset($filter_data['include_subgroups']) and (bool) $filter_data['include_subgroups'] == TRUE) { $uglf = new UserGroupListFactory(); $filter_data['group_id'] = $uglf->getByCompanyIdAndGroupIdAndSubGroupsArray($company_id, $filter_data['group_id'], TRUE); } $query .= ' AND d.group_id in (' . $this->getListSQL($filter_data['group_id'], $ph) . ') '; } if (isset($filter_data['default_branch_id']) and isset($filter_data['default_branch_id'][0]) and !in_array(-1, (array) $filter_data['default_branch_id'])) { $query .= ' AND d.default_branch_id in (' . $this->getListSQL($filter_data['default_branch_id'], $ph) . ') '; } if (isset($filter_data['default_department_id']) and isset($filter_data['default_department_id'][0]) and !in_array(-1, (array) $filter_data['default_department_id'])) { $query .= ' AND d.default_department_id in (' . $this->getListSQL($filter_data['default_department_id'], $ph) . ') '; } if (isset($filter_data['title_id']) and isset($filter_data['title_id'][0]) and !in_array(-1, (array) $filter_data['title_id'])) { $query .= ' AND d.title_id in (' . $this->getListSQL($filter_data['title_id'], $ph) . ') '; } if (isset($filter_data['punch_branch_id']) and isset($filter_data['punch_branch_id'][0]) and !in_array(-1, (array) $filter_data['punch_branch_id'])) { $query .= ' AND b.branch_id in (' . $this->getListSQL($filter_data['punch_branch_id'], $ph) . ') '; } if (isset($filter_data['punch_department_id']) and isset($filter_data['punch_department_id'][0]) and !in_array(-1, (array) $filter_data['punch_department_id'])) { $query .= ' AND b.department_id in (' . $this->getListSQL($filter_data['punch_department_id'], $ph) . ') '; } //Use the job_id in the punch_control table so we can filter by '0' or No Job if (isset($filter_data['include_job_id']) and isset($filter_data['include_job_id'][0]) and !in_array(-1, (array) $filter_data['include_job_id'])) { $query .= ' AND b.job_id in (' . $this->getListSQL($filter_data['include_job_id'], $ph) . ') '; } if (isset($filter_data['exclude_job_id']) and isset($filter_data['exclude_job_id'][0]) and !in_array(-1, (array) $filter_data['exclude_job_id'])) { $query .= ' AND b.job_id not in (' . $this->getListSQL($filter_data['exclude_job_id'], $ph) . ') '; } if (isset($filter_data['job_group_id']) and isset($filter_data['job_group_id'][0]) and !in_array(-1, (array) $filter_data['job_group_id'])) { if (isset($filter_data['include_job_subgroups']) and (bool) $filter_data['include_job_subgroups'] == TRUE) { $uglf = new UserGroupListFactory(); $filter_data['job_group_id'] = $uglf->getByCompanyIdAndGroupIdAndjob_subgroupsArray($company_id, $filter_data['job_group_id'], TRUE); } $query .= ' AND x.group_id in (' . $this->getListSQL($filter_data['job_group_id'], $ph) . ') '; } if (isset($filter_data['job_item_id']) and isset($filter_data['job_item_id'][0]) and !in_array(-1, (array) $filter_data['job_item_id'])) { $query .= ' AND b.job_item_id in (' . $this->getListSQL($filter_data['job_item_id'], $ph) . ') '; } if (isset($filter_data['start_date']) and trim($filter_data['start_date']) != '') { /* $ph[] = $this->db->BindDate($filter_data['start_date']); $query .= ' AND c.date_stamp >= ?'; */ $ph[] = $this->db->BindTimeStamp($filter_data['start_date']); $query .= ' AND a.time_stamp >= ?'; } if (isset($filter_data['end_date']) and trim($filter_data['end_date']) != '') { $ph[] = $this->db->BindTimeStamp($filter_data['end_date']); $query .= ' AND a.time_stamp <= ?'; } //The Transfer where clause is an attempt to keep transferred punches from appearing twice. $query .= ' AND ( a.transfer = 0 OR ( a.transfer = 1 AND a.status_id = 10) ) AND ( a.deleted = 0 AND b.deleted =0 AND c.deleted = 0 AND d.deleted = 0 ) '; $query .= $this->getWhereSQL($where); $query .= $this->getSortSQL($order, $strict, $additional_order_fields); $this->ExecuteSQL($query, $ph, $limit, $page); return $this; }
protected function _getOptions($name, $params = NULL) { $retval = NULL; switch ($name) { case 'output_format': $retval = array_merge(parent::getOptions('default_output_format'), array('-1100-pdf_form' => TTi18n::gettext('Form'))); break; case 'default_setup_fields': $retval = array('template', 'time_period', 'columns'); break; case 'setup_fields': $retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-4020-exclude_ytd_adjustment' => TTi18n::gettext('Exclude YTD Adjustments'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By')); break; case 'time_period': $retval = TTDate::getTimePeriodOptions(); break; case 'date_columns': $retval = TTDate::getReportDateOptions(NULL, TTi18n::getText('Date'), 13, TRUE); break; case 'report_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); // Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns. // So just get custom columns with Selection and Formula. $custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'Form940Report', 'custom_column'); if (is_array($custom_column_labels)) { $retval = Misc::addSortPrefix($custom_column_labels, 9500); } } break; case 'report_custom_filters': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'Form940Report', 'custom_column'); } break; case 'report_dynamic_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'Form940Report', 'custom_column'); if (is_array($report_dynamic_custom_column_labels)) { $retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700); } } break; case 'report_static_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'Form940Report', 'custom_column'); if (is_array($report_static_custom_column_labels)) { $retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700); } } break; case 'formula_columns': $retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns'))); break; case 'filter_columns': $retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))); break; case 'static_columns': $retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1035-sin' => TTi18n::gettext('SIN/SSN'), '-1040-status' => TTi18n::gettext('Status'), '-1050-title' => TTi18n::gettext('Title'), '-1060-province' => TTi18n::gettext('Province/State'), '-1070-country' => TTi18n::gettext('Country'), '-1080-group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Default Branch'), '-1100-default_department' => TTi18n::gettext('Default Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1400-permission_control' => TTi18n::gettext('Permission Group'), '-1410-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1420-policy_group' => TTi18n::gettext('Policy Group')); $retval = array_merge($retval, $this->getOptions('date_columns'), (array) $this->getOptions('report_static_custom_column')); ksort($retval); break; case 'dynamic_columns': $retval = array('-2010-total_payments' => TTi18n::gettext('Total Payments'), '-2020-exempt_payments' => TTi18n::gettext('Exempt Payments'), '-2030-excess_payments' => TTi18n::gettext('Excess Payments'), '-2040-taxable_wages' => TTi18n::gettext('Taxable Wages'), '-2050-before_adjustment_tax' => TTi18n::gettext('Tax Before Adjustments'), '-2052-adjustment_tax' => TTi18n::gettext('Tax Adjustments'), '-2054-after_adjustment_tax' => TTi18n::gettext('Tax After Adjustments')); break; case 'columns': $retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')); break; case 'column_format': //Define formatting function for each column. $columns = array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_custom_column')); if (is_array($columns)) { foreach ($columns as $column => $name) { $retval[$column] = 'currency'; } } break; case 'aggregates': $retval = array(); $dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')))); if (is_array($dynamic_columns)) { foreach ($dynamic_columns as $column) { switch ($column) { default: $retval[$column] = 'sum'; } } } break; case 'state': $retval = Misc::prependArray(array(0 => TTi18n::getText('- Multi-state Employer -')), $this->getUserObject()->getCompanyObject()->getOptions('province', 'US')); break; case 'return_type': $retval = array(10 => TTi18n::getText('Amended'), 20 => TTi18n::getText('Successor Employer'), 30 => TTi18n::getText('No Payments to Employees'), 40 => TTi18n::getText('Final: Business closed or stopped paying wages')); break; case 'exempt_payment': $retval = array(10 => TTi18n::getText('4a. Fringe benefits'), 20 => TTi18n::getText('4b. Group term life insurance'), 30 => TTi18n::getText('4c. Retirement/Pension'), 40 => TTi18n::getText('4d. Dependant care'), 50 => TTi18n::getText('4e. Other')); break; case 'templates': $retval = array('-1010-by_quarter' => TTi18n::gettext('by Quarter'), '-1010-by_month' => TTi18n::gettext('by Month'), '-1020-by_employee' => TTi18n::gettext('by Employee'), '-1030-by_branch' => TTi18n::gettext('by Branch'), '-1040-by_department' => TTi18n::gettext('by Department'), '-1050-by_branch_by_department' => TTi18n::gettext('by Branch/Department'), '-1060-by_month_by_employee' => TTi18n::gettext('by Month/Employee'), '-1070-by_month_by_branch' => TTi18n::gettext('by Month/Branch'), '-1080-by_month_by_department' => TTi18n::gettext('by Month/Department'), '-1090-by_month_by_branch_by_department' => TTi18n::gettext('by Month/Branch/Department')); break; case 'template_config': $template = strtolower(Misc::trimSortPrefix($params['template'])); if (isset($template) and $template != '') { switch ($template) { case 'default': //Proper settings to generate the form. //$retval['-1010-time_period']['time_period'] = 'last_quarter'; $retval['columns'] = $this->getOptions('columns'); $retval['group'][] = 'date_quarter_month'; $retval['sort'][] = array('date_quarter_month' => 'asc'); $retval['other']['grand_total'] = TRUE; break; default: Debug::Text(' Parsing template name: ' . $template, __FILE__, __LINE__, __METHOD__, 10); $retval['-1010-time_period']['time_period'] = 'last_year'; //Parse template name, and use the keywords separated by '+' to determine settings. $template_keywords = explode('+', $template); if (is_array($template_keywords)) { foreach ($template_keywords as $template_keyword) { Debug::Text(' Keyword: ' . $template_keyword, __FILE__, __LINE__, __METHOD__, 10); switch ($template_keyword) { //Columns //Filter //Group By //SubTotal //Sort case 'by_quarter': $retval['columns'][] = 'date_quarter'; $retval['group'][] = 'date_quarter'; $retval['sort'][] = array('date_quarter' => 'asc'); break; case 'by_month': $retval['columns'][] = 'date_month'; $retval['group'][] = 'date_month'; $retval['sort'][] = array('date_month' => 'asc'); break; case 'by_employee': $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['group'][] = 'first_name'; $retval['group'][] = 'last_name'; $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_branch': $retval['columns'][] = 'default_branch'; $retval['group'][] = 'default_branch'; $retval['sort'][] = array('default_branch' => 'asc'); break; case 'by_department': $retval['columns'][] = 'default_department'; $retval['group'][] = 'default_department'; $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_branch_by_department': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['group'][] = 'default_branch'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'default_branch'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_month_by_employee': $retval['columns'][] = 'date_month'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['group'][] = 'date_month'; $retval['group'][] = 'first_name'; $retval['group'][] = 'last_name'; $retval['sub_total'][] = 'date_month'; $retval['sort'][] = array('date_month' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_month_by_branch': $retval['columns'][] = 'date_month'; $retval['columns'][] = 'default_branch'; $retval['group'][] = 'date_month'; $retval['group'][] = 'default_branch'; $retval['sub_total'][] = 'date_month'; $retval['sort'][] = array('date_month' => 'asc'); $retval['sort'][] = array('default_branch' => 'asc'); break; case 'by_month_by_department': $retval['columns'][] = 'date_month'; $retval['columns'][] = 'default_department'; $retval['group'][] = 'date_month'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'date_month'; $retval['sort'][] = array('date_month' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_month_by_branch_by_department': $retval['columns'][] = 'date_month'; $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['group'][] = 'date_month'; $retval['group'][] = 'default_branch'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'date_month'; $retval['sub_total'][] = 'default_branch'; $retval['sort'][] = array('date_month' => 'asc'); $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); break; } } } $retval['columns'] = array_merge($retval['columns'], array_keys(Misc::trimSortPrefix($this->getOptions('dynamic_columns')))); break; } } //Set the template dropdown as well. $retval['-1000-template'] = $template; //Add sort prefixes so Flex can maintain order. if (isset($retval['filter'])) { $retval['-5000-filter'] = $retval['filter']; unset($retval['filter']); } if (isset($retval['columns'])) { $retval['-5010-columns'] = $retval['columns']; unset($retval['columns']); } if (isset($retval['group'])) { $retval['-5020-group'] = $retval['group']; unset($retval['group']); } if (isset($retval['sub_total'])) { $retval['-5030-sub_total'] = $retval['sub_total']; unset($retval['sub_total']); } if (isset($retval['sort'])) { $retval['-5040-sort'] = $retval['sort']; unset($retval['sort']); } Debug::Arr($retval, ' Template Config for: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; default: //Call report parent class options function for options valid for all reports. $retval = $this->__getOptions($name); break; } return $retval; }
function Validate() { Debug::text('Validating...', __FILE__, __LINE__, __METHOD__, 10); //Call this here so getShiftData can get the correct total time, before we call findUserDate. if ($this->getEnableCalcTotalTime() == TRUE) { $this->calcTotalTime(); } if (is_object($this->getPunchObject())) { $this->findUserDate(); } Debug::text('User Date Id: ' . $this->getUserDateID(), __FILE__, __LINE__, __METHOD__, 10); if ($this->getUserDateObject() == FALSE or $this->getUserDateObject()->getPayPeriodObject() == FALSE) { $this->Validator->isTRUE('pay_period', FALSE, TTi18n::gettext('Date/Time is incorrect, or pay period does not exist for this date. Please create a pay period schedule if you have not done so already')); } elseif ($this->getUserDateObject() == FALSE or $this->getUserDateObject()->getPayPeriodObject()->getIsLocked() == TRUE) { $this->Validator->isTRUE('pay_period', FALSE, TTi18n::gettext('Pay Period is Currently Locked')); } $plf = $this->getPLFByPunchControlID(); if ($plf !== NULL and ($this->isNew() and $plf->getRecordCount() == 2 or $plf->getRecordCount() > 2)) { //TTi18n::gettext('Punch Control can not have more than two punches. Please use the Add Punch button instead') //They might be trying to insert a punch inbetween two others? $this->Validator->isTRUE('punch_control', FALSE, TTi18n::gettext('Time conflicts with another punch on this day (c)')); } //Skip these checks if they are deleting a punch. if (is_object($this->getPunchObject()) and $this->getPunchObject()->getDeleted() == FALSE) { $shift_data = $this->getShiftData(); if (is_array($shift_data)) { foreach ($shift_data['punches'] as $punch_data) { //Make sure there aren't two In punches, or two Out punches in the same pair. //This fixes the bug where if you have an In punch, then click the blank cell below it //to add a new punch, but change the status from Out to In instead. if (isset($punches[$punch_data['punch_control_id']][$punch_data['status_id']])) { if ($punch_data['status_id'] == 10) { $this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('In punches cannot occur twice in the same punch pair, you may want to make this an out punch instead')); } else { $this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Out punches cannot occur twice in the same punch pair, you may want to make this an in punch instead')); } } Debug::text(' Current Punch Object: ID: ' . $this->getPunchObject()->getId() . ' TimeStamp: ' . $this->getPunchObject()->getTimeStamp() . ' Status: ' . $this->getPunchObject()->getStatus(), __FILE__, __LINE__, __METHOD__, 10); Debug::text(' Looping Punch Object: ID: ' . $punch_data['id'] . ' TimeStamp: ' . $punch_data['time_stamp'] . ' Status: ' . $punch_data['status_id'], __FILE__, __LINE__, __METHOD__, 10); //Check for another punch that matches the timestamp and status. if ($this->getPunchObject()->getID() != $punch_data['id']) { if ($this->getPunchObject()->getTimeStamp() == $punch_data['time_stamp'] and $this->getPunchObject()->getStatus() == $punch_data['status_id']) { $this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Time and status match that of another punch, this could be due to rounding (a)')); } } //Check for another punch that matches the timestamp and NOT status in the SAME punch pair. if ($this->getPunchObject()->getID() != $punch_data['id'] and $this->getID() == $punch_data['punch_control_id']) { if ($this->getPunchObject()->getTimeStamp() == $punch_data['time_stamp'] and $this->getPunchObject()->getStatus() != $punch_data['status_id']) { $this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Time matches another punch in the same punch pair, this could be due to rounding (b)')); } } $punches[$punch_data['punch_control_id']][$punch_data['status_id']] = $punch_data; } unset($punch_data); if (isset($punches[$this->getID()])) { Debug::text('Current Punch ID Id: ' . $this->getPunchObject()->getId() . ' Punch Control ID: ' . $this->getID() . ' Status: ' . $this->getPunchObject()->getStatus(), __FILE__, __LINE__, __METHOD__, 10); //Debug::Arr($punches, 'Punches Arr: ', __FILE__, __LINE__, __METHOD__,10); if ($this->getPunchObject()->getStatus() == 10 and isset($punches[$this->getID()][20]) and $this->getPunchObject()->getTimeStamp() > $punches[$this->getID()][20]['time_stamp']) { $this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('In punches cannot occur after an out punch, in the same punch pair')); } elseif ($this->getPunchObject()->getStatus() == 20 and isset($punches[$this->getID()][10]) and $this->getPunchObject()->getTimeStamp() < $punches[$this->getID()][10]['time_stamp']) { $this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Out punches cannot occur before an in punch, in the same punch pair')); } else { Debug::text('bPunch does not match any other punch pair.', __FILE__, __LINE__, __METHOD__, 10); $punch_neighbors = Misc::getArrayNeighbors($punches, $this->getID(), 'both'); //Debug::Arr($punch_neighbors, ' Punch Neighbors: ', __FILE__, __LINE__, __METHOD__,10); if (isset($punch_neighbors['next']) and isset($punches[$punch_neighbors['next']])) { Debug::text('Found Next Punch...', __FILE__, __LINE__, __METHOD__, 10); if (isset($punches[$punch_neighbors['next']][10]) and $this->getPunchObject()->getTimeStamp() > $punches[$punch_neighbors['next']][10]['time_stamp'] or isset($punches[$punch_neighbors['next']][20]) and $this->getPunchObject()->getTimeStamp() > $punches[$punch_neighbors['next']][20]['time_stamp']) { $this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Time conflicts with another punch on this day') . ' (a)'); } } if (isset($punch_neighbors['prev']) and isset($punches[$punch_neighbors['prev']])) { Debug::text('Found prev Punch...', __FILE__, __LINE__, __METHOD__, 10); if (isset($punches[$punch_neighbors['prev']][10]) and $this->getPunchObject()->getTimeStamp() < $punches[$punch_neighbors['prev']][10]['time_stamp'] or isset($punches[$punch_neighbors['prev']][20]) and $this->getPunchObject()->getTimeStamp() < $punches[$punch_neighbors['prev']][20]['time_stamp']) { $this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Time conflicts with another punch on this day') . ' (b)'); } } } //Check to make sure punches don't exceed maximum shift time. $maximum_shift_time = $plf->getPayPeriodMaximumShiftTime($this->getPunchObject()->getUser()); Debug::text('aaaMaximum shift time: ' . $maximum_shift_time, __FILE__, __LINE__, __METHOD__, 10); if ($shift_data['total_time'] > $maximum_shift_time) { $this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Punch exceeds maximum shift time of') . ' ' . TTDate::getTimeUnit($maximum_shift_time) . ' ' . TTi18n::getText('hrs set for this pay period schedule')); } } unset($punches); } } if (getTTProductEdition() == TT_PRODUCT_PROFESSIONAL and $this->getEnableStrictJobValidation() == TRUE) { if ($this->getJob() > 0) { $jlf = new JobListFactory(); $jlf->getById($this->getJob()); if ($jlf->getRecordCount() > 0) { $j_obj = $jlf->getCurrent(); if (is_object($this->getUserDateObject()) and $j_obj->isAllowedUser($this->getUserDateObject()->getUser()) == FALSE) { $this->Validator->isTRUE('job', FALSE, TTi18n::gettext('Employee is not assigned to this job')); } if ($j_obj->isAllowedItem($this->getJobItem()) == FALSE) { $this->Validator->isTRUE('job_item', FALSE, TTi18n::gettext('Task is not assigned to this job')); } } } } return TRUE; }
/** * Return user records based on advanced filter criteria. * * @param int $company_id Company ID * @param array $filter_data Filter criteria in array('id' => array(1,2), 'last_name' => 'smith' ) format, with possible top level array keys as follows: id, exclude_id, status_id, user_group_id, default_branch_id, default_department_id, title_id, currency_id, permission_control_id, pay_period_schedule_id, policy_group_id, sex_id, first_name, last_name, home_phone, work_phone, country, province, city, address1, address2, postal_code, employee_number, user_name, sin, work_email, home_email, tag, last_login_date, created_by, created_date, updated_by, updated_date * @param int $limit Optional. Restrict the number of records returned * @param int $page Optional. Specify the page of records to return * @param array $where Optional. Additional WHERE clauses in array( 'column' => 'value', 'column' => 'value' ) format. * @param array $order Optional. Sort order in array( 'column' => ASC, 'column2' => DESC ) format. * * @return object $this */ function getAPISearchByCompanyIdAndArrayCriteria($company_id, $filter_data, $limit = NULL, $page = NULL, $where = NULL, $order = NULL) { if ($company_id == '') { return FALSE; } if (!is_array($order)) { //Use Filter Data ordering if its set. if (isset($filter_data['sort_column']) and $filter_data['sort_order']) { $order = array(Misc::trimSortPrefix($filter_data['sort_column']) => $filter_data['sort_order']); } } if (isset($filter_data['user_status_id'])) { $filter_data['status_id'] = $filter_data['user_status_id']; } if (isset($filter_data['include_user_id'])) { $filter_data['id'] = $filter_data['include_user_id']; } if (isset($filter_data['exclude_user_id'])) { $filter_data['exclude_id'] = $filter_data['exclude_user_id']; } //Some of these are passed from Flex Schedule view. if (isset($filter_data['default_branch_ids'])) { $filter_data['default_branch_id'] = $filter_data['default_branch_ids']; } if (isset($filter_data['default_department_ids'])) { $filter_data['default_department_id'] = $filter_data['default_department_ids']; } if (isset($filter_data['group_id'])) { $filter_data['user_group_id'] = $filter_data['group_id']; } if (isset($filter_data['user_title_id'])) { $filter_data['title_id'] = $filter_data['user_title_id']; } if (isset($filter_data['user_tag'])) { $filter_data['tag'] = $filter_data['user_tag']; } //$additional_order_fields = array('b.name', 'c.name', 'd.name', 'e.name'); $additional_order_fields = array('default_branch', 'default_department', 'default_job', 'default_job_item', 'sex', 'user_group', 'title', 'currency', 'permission_control', 'pay_period_schedule', 'policy_group'); $sort_column_aliases = array('type' => 'type_id', 'status' => 'status_id', 'sex' => 'sex_id', 'full_name' => 'last_name'); $order = $this->getColumnsFromAliases($order, $sort_column_aliases); if ($order == NULL) { $order = array('status_id' => 'asc', 'last_name' => 'asc', 'first_name' => 'asc', 'middle_name' => 'asc'); $strict = FALSE; } else { //Do order by column conversions, because if we include these columns in the SQL //query, they contaminate the data array. //Always try to order by status first so INACTIVE employees go to the bottom. if (!isset($order['status_id'])) { $order = Misc::prependArray(array('status_id' => 'asc'), $order); } //Always sort by last name,first name after other columns if (!isset($order['last_name'])) { $order['last_name'] = 'asc'; } if (!isset($order['first_name'])) { $order['first_name'] = 'asc'; } $strict = TRUE; } //Debug::Arr($order,'Order Data:', __FILE__, __LINE__, __METHOD__,10); //Debug::Arr($filter_data,'Filter Data:', __FILE__, __LINE__, __METHOD__,10); $compf = new CompanyFactory(); $bf = new BranchFactory(); $df = new DepartmentFactory(); $ugf = new UserGroupFactory(); $utf = new UserTitleFactory(); $cf = new CurrencyFactory(); $pcf = new PermissionControlFactory(); $puf = new PermissionUserFactory(); $ppsuf = new PayPeriodScheduleUserFactory(); $ppsf = new PayPeriodScheduleFactory(); $pguf = new PolicyGroupUserFactory(); $pgf = new PolicyGroupFactory(); $egf = new EthnicGroupFactory(); if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $jf = new JobFactory(); $jif = new JobItemFactory(); } $ph = array('company_id' => $company_id); $query = ' select a.*, compf.name as company, b.name as default_branch, c.name as default_department, d.name as user_group, e.name as title, f.name as currency, f.conversion_rate as currency_rate, g.id as permission_control_id, g.name as permission_control, h.id as pay_period_schedule_id, h.name as pay_period_schedule, i.id as policy_group_id, i.name as policy_group, egf.name as ethnic_group, '; $query .= Permission::getPermissionIsChildIsOwnerSQL(isset($filter_data['permission_current_user_id']) ? $filter_data['permission_current_user_id'] : 0, 'a.id'); if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $query .= ' jf.name as default_job, jif.name as default_job_item, '; } $query .= ' y.first_name as created_by_first_name, y.middle_name as created_by_middle_name, y.last_name as created_by_last_name, z.first_name as updated_by_first_name, z.middle_name as updated_by_middle_name, z.last_name as updated_by_last_name from ' . $this->getTable() . ' as a LEFT JOIN ' . $compf->getTable() . ' as compf ON ( a.company_id = compf.id AND compf.deleted = 0) LEFT JOIN ' . $bf->getTable() . ' as b ON ( a.default_branch_id = b.id AND b.deleted = 0) LEFT JOIN ' . $df->getTable() . ' as c ON ( a.default_department_id = c.id AND c.deleted = 0) LEFT JOIN ' . $ugf->getTable() . ' as d ON ( a.group_id = d.id AND d.deleted = 0 ) LEFT JOIN ' . $utf->getTable() . ' as e ON ( a.title_id = e.id AND e.deleted = 0 ) LEFT JOIN ' . $cf->getTable() . ' as f ON ( a.currency_id = f.id AND f.deleted = 0 ) LEFT JOIN ' . $egf->getTable() . ' as egf ON ( a.ethnic_group_id = egf.id AND egf.deleted = 0 ) '; if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $query .= ' LEFT JOIN ' . $jf->getTable() . ' as jf ON a.default_job_id = jf.id'; $query .= ' LEFT JOIN ' . $jif->getTable() . ' as jif ON a.default_job_item_id = jif.id'; } $query .= ' LEFT JOIN ( SELECT g2.*,g1.user_id FROM ' . $puf->getTable() . ' as g1, ' . $pcf->getTable() . ' as g2 WHERE ( g1.permission_control_id = g2.id AND g2.deleted = 0) ) as g ON ( a.id = g.user_id ) LEFT JOIN ( SELECT h2.*, h1.user_id FROM ' . $ppsuf->getTable() . ' as h1, ' . $ppsf->getTable() . ' as h2 WHERE ( h1.pay_period_schedule_id = h2.id AND h2.deleted = 0) ) as h ON ( a.id = h.user_id ) LEFT JOIN ( SELECT i2.*, i1.user_id FROM ' . $pguf->getTable() . ' as i1, ' . $pgf->getTable() . ' as i2 WHERE ( i1.policy_group_id = i2.id AND i2.deleted = 0) ) as i ON ( a.id = i.user_id ) '; $query .= Permission::getPermissionHierarchySQL($company_id, isset($filter_data['permission_current_user_id']) ? $filter_data['permission_current_user_id'] : 0, 'a.id'); $query .= ' LEFT JOIN ' . $this->getTable() . ' as y ON ( a.created_by = y.id AND y.deleted = 0 ) LEFT JOIN ' . $this->getTable() . ' as z ON ( a.updated_by = z.id AND z.deleted = 0 ) where a.company_id = ? '; $query .= Permission::getPermissionIsChildIsOwnerFilterSQL($filter_data, 'a.id'); $query .= isset($filter_data['permission_children_ids']) ? $this->getWhereClauseSQL('a.id', $filter_data['permission_children_ids'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['id']) ? $this->getWhereClauseSQL('a.id', $filter_data['id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['exclude_id']) ? $this->getWhereClauseSQL('a.id', $filter_data['exclude_id'], 'not_numeric_list', $ph) : NULL; if (isset($filter_data['status']) and trim($filter_data['status']) != '' and !isset($filter_data['status_id'])) { $filter_data['status_id'] = Option::getByFuzzyValue($filter_data['status'], $this->getOptions('status')); } $query .= isset($filter_data['status_id']) ? $this->getWhereClauseSQL('a.status_id', $filter_data['status_id'], 'numeric_list', $ph) : NULL; if (isset($filter_data['include_subgroups']) and (bool) $filter_data['include_subgroups'] == TRUE) { $uglf = new UserGroupListFactory(); $filter_data['user_group_id'] = $uglf->getByCompanyIdAndGroupIdAndSubGroupsArray($company_id, $filter_data['user_group_id'], TRUE); } $query .= isset($filter_data['user_group_id']) ? $this->getWhereClauseSQL('a.group_id', $filter_data['user_group_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['user_group']) ? $this->getWhereClauseSQL('d.name', $filter_data['user_group'], 'text', $ph) : NULL; $query .= isset($filter_data['default_branch_id']) ? $this->getWhereClauseSQL('a.default_branch_id', $filter_data['default_branch_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['default_branch']) ? $this->getWhereClauseSQL('b.name', $filter_data['default_branch'], 'text', $ph) : NULL; $query .= isset($filter_data['default_department_id']) ? $this->getWhereClauseSQL('a.default_department_id', $filter_data['default_department_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['default_department']) ? $this->getWhereClauseSQL('c.name', $filter_data['default_department'], 'text', $ph) : NULL; $query .= isset($filter_data['title_id']) ? $this->getWhereClauseSQL('a.title_id', $filter_data['title_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['title']) ? $this->getWhereClauseSQL('e.name', $filter_data['title'], 'text', $ph) : NULL; $query .= isset($filter_data['ethnic_group_id']) ? $this->getWhereClauseSQL('a.ethnic_group_id', $filter_data['ethnic_group_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['ethnic_group']) ? $this->getWhereClauseSQL('egf.name', $filter_data['ethnic_group'], 'text', $ph) : NULL; $query .= isset($filter_data['currency_id']) ? $this->getWhereClauseSQL('a.currency_id', $filter_data['currency_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['currency']) ? $this->getWhereClauseSQL('f.name', $filter_data['currency'], 'text', $ph) : NULL; $query .= isset($filter_data['permission_control_id']) ? $this->getWhereClauseSQL('g.id', $filter_data['permission_control_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['permission_control']) ? $this->getWhereClauseSQL('g.name', $filter_data['permission_control'], 'text', $ph) : NULL; $query .= isset($filter_data['pay_period_schedule_id']) ? $this->getWhereClauseSQL('i.pay_period_schedule_id', $filter_data['pay_period_schedule_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['pay_period_schedule']) ? $this->getWhereClauseSQL('h.name', $filter_data['pay_period_schedule'], 'text', $ph) : NULL; $query .= isset($filter_data['policy_group_id']) ? $this->getWhereClauseSQL('k.policy_group_id', $filter_data['policy_group_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['policy_group']) ? $this->getWhereClauseSQL('i.name', $filter_data['policy_group'], 'text', $ph) : NULL; if (isset($filter_data['sex']) and trim($filter_data['sex']) != '' and !isset($filter_data['sex_id'])) { $filter_data['sex_id'] = Option::getByFuzzyValue($filter_data['sex'], $this->getOptions('sex')); } $query .= isset($filter_data['sex_id']) ? $this->getWhereClauseSQL('a.sex_id', $filter_data['sex_id'], 'text_list', $ph) : NULL; $query .= isset($filter_data['first_name']) ? $this->getWhereClauseSQL('a.first_name', $filter_data['first_name'], 'text_metaphone', $ph) : NULL; $query .= isset($filter_data['last_name']) ? $this->getWhereClauseSQL('a.last_name', $filter_data['last_name'], 'text_metaphone', $ph) : NULL; $query .= isset($filter_data['home_phone']) ? $this->getWhereClauseSQL('a.home_phone', $filter_data['home_phone'], 'phone', $ph) : NULL; $query .= isset($filter_data['work_phone']) ? $this->getWhereClauseSQL('a.work_phone', $filter_data['work_phone'], 'phone', $ph) : NULL; $query .= isset($filter_data['country']) ? $this->getWhereClauseSQL('a.country', $filter_data['country'], 'upper_text_list', $ph) : NULL; $query .= isset($filter_data['province']) ? $this->getWhereClauseSQL('a.province', $filter_data['province'], 'upper_text_list', $ph) : NULL; $query .= isset($filter_data['city']) ? $this->getWhereClauseSQL('a.city', $filter_data['city'], 'text', $ph) : NULL; $query .= isset($filter_data['address1']) ? $this->getWhereClauseSQL('a.address1', $filter_data['address1'], 'text', $ph) : NULL; $query .= isset($filter_data['address2']) ? $this->getWhereClauseSQL('a.address2', $filter_data['address2'], 'text', $ph) : NULL; $query .= isset($filter_data['postal_code']) ? $this->getWhereClauseSQL('a.postal_code', $filter_data['postal_code'], 'text', $ph) : NULL; $query .= isset($filter_data['employee_number']) ? $this->getWhereClauseSQL('a.employee_number', $filter_data['employee_number'], 'numeric', $ph) : NULL; $query .= isset($filter_data['user_name']) ? $this->getWhereClauseSQL('a.user_name', $filter_data['user_name'], 'text', $ph) : NULL; $query .= isset($filter_data['sin']) ? $this->getWhereClauseSQL('a.sin', $filter_data['sin'], 'numeric', $ph) : NULL; $query .= isset($filter_data['email']) ? 'AND (' . $this->getWhereClauseSQL('a.work_email', $filter_data['email'], 'text', $ph, NULL, FALSE) . ' OR ' . $this->getWhereClauseSQL('a.home_email', $filter_data['email'], 'text', $ph, NULL, FALSE) . ')' : NULL; $query .= isset($filter_data['work_email']) ? $this->getWhereClauseSQL('a.work_email', $filter_data['work_email'], 'text', $ph) : NULL; $query .= isset($filter_data['home_email']) ? $this->getWhereClauseSQL('a.home_email', $filter_data['home_email'], 'text', $ph) : NULL; $query .= isset($filter_data['tag']) ? $this->getWhereClauseSQL('a.id', array('company_id' => $company_id, 'object_type_id' => 200, 'tag' => $filter_data['tag']), 'tag', $ph) : NULL; //$query .= ( isset($filter_data['longitude']) ) ? $this->getWhereClauseSQL( 'a.longitude', $filter_data['longitude'], 'numeric', $ph ) : NULL; if (isset($filter_data['last_login_date']) and trim($filter_data['last_login_date']) != '') { $date_filter = $this->getDateRangeSQL($filter_data['last_login_date'], 'a.last_login_date'); if ($date_filter != FALSE) { $query .= ' AND ' . $date_filter; } unset($date_filter); } if (isset($filter_data['created_date']) and trim($filter_data['created_date']) != '') { $date_filter = $this->getDateRangeSQL($filter_data['created_date'], 'a.created_date'); if ($date_filter != FALSE) { $query .= ' AND ' . $date_filter; } unset($date_filter); } if (isset($filter_data['updated_date']) and trim($filter_data['updated_date']) != '') { $date_filter = $this->getDateRangeSQL($filter_data['updated_date'], 'a.updated_date'); if ($date_filter != FALSE) { $query .= ' AND ' . $date_filter; } unset($date_filter); } $query .= isset($filter_data['created_by']) ? $this->getWhereClauseSQL(array('a.created_by', 'y.first_name', 'y.last_name'), $filter_data['created_by'], 'user_id_or_name', $ph) : NULL; $query .= isset($filter_data['updated_by']) ? $this->getWhereClauseSQL(array('a.updated_by', 'z.first_name', 'z.last_name'), $filter_data['updated_by'], 'user_id_or_name', $ph) : NULL; $query .= ' AND ( a.deleted = 0 ) '; $query .= $this->getWhereSQL($where); $query .= $this->getSortSQL($order, $strict, $additional_order_fields); //Debug::Arr($ph, 'Query: '. $query, __FILE__, __LINE__, __METHOD__,10); $this->ExecuteSQL($query, $ph, $limit, $page); return $this; }
function getAPISearchByCompanyIdAndArrayCriteria($company_id, $filter_data, $limit = NULL, $page = NULL, $where = NULL, $order = NULL) { if ($company_id == '') { return FALSE; } if (!is_array($order)) { //Use Filter Data ordering if its set. if (isset($filter_data['sort_column']) and $filter_data['sort_order']) { $order = array(Misc::trimSortPrefix($filter_data['sort_column']) => $filter_data['sort_order']); } } if (isset($filter_data['user_date_total_type_id'])) { $filter_data['type_id'] = $filter_data['user_date_total_type_id']; } $additional_order_fields = array('first_name', 'last_name', 'date_stamp', 'time_stamp', 'type_id', 'status_id', 'branch', 'department', 'default_branch', 'default_department', 'group', 'title'); if ($order == NULL) { $order = array('c.date_stamp' => 'asc', 'a.status_id' => 'asc', 'a.type_id' => 'asc', 'a.total_time' => 'asc', 'a.status_id' => 'asc'); $strict = FALSE; } else { $strict = FALSE; } //Debug::Arr($order,'Order Data:', __FILE__, __LINE__, __METHOD__,10); //Debug::Arr($filter_data,'Filter Data:', __FILE__, __LINE__, __METHOD__,10); if (isset($filter_data['exclude_user_ids'])) { $filter_data['exclude_id'] = $filter_data['exclude_user_ids']; } if (isset($filter_data['include_user_ids'])) { $filter_data['user_id'] = $filter_data['include_user_ids']; } if (isset($filter_data['user_title_ids'])) { $filter_data['title_id'] = $filter_data['user_title_ids']; } if (isset($filter_data['group_ids'])) { $filter_data['group_id'] = $filter_data['group_ids']; } if (isset($filter_data['branch_ids'])) { $filter_data['default_branch_id'] = $filter_data['branch_ids']; } if (isset($filter_data['department_ids'])) { $filter_data['default_department_id'] = $filter_data['department_ids']; } if (isset($filter_data['pay_period_ids'])) { $filter_data['pay_period_id'] = $filter_data['pay_period_ids']; } if (isset($filter_data['exclude_job_ids'])) { $filter_data['exclude_id'] = $filter_data['exclude_job_ids']; } if (isset($filter_data['include_job_ids'])) { $filter_data['include_job_id'] = $filter_data['include_job_ids']; } if (isset($filter_data['job_group_ids'])) { $filter_data['job_group_id'] = $filter_data['job_group_ids']; } if (isset($filter_data['job_item_ids'])) { $filter_data['job_item_id'] = $filter_data['job_item_ids']; } $uf = new UserFactory(); $udf = new UserDateFactory(); $uwf = new UserWageFactory(); $bf = new BranchFactory(); $df = new DepartmentFactory(); $ugf = new UserGroupFactory(); $utf = new UserTitleFactory(); $otpf = new OverTimePolicyFactory(); $apf = new AbsencePolicyFactory(); $ppf = new PremiumPolicyFactory(); $mpf = new MealPolicyFactory(); $bpf = new BreakPolicyFactory(); if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $jf = new JobFactory(); $jif = new JobItemFactory(); } $ph = array('company_id' => $company_id); $query = ' select a.id as id, a.user_date_id as user_date_id, a.type_id as type_id, a.status_id as status_id, a.punch_control_id as punch_control_id, a.over_time_policy_id as over_time_policy_id, otpf.name as over_time_policy, a.absence_policy_id as absence_policy_id, apf.name as absence_policy, apf.type_id as absence_policy_type_id, a.premium_policy_id as premium_policy_id, ppf.name as premium_policy, a.meal_policy_id as meal_policy_id, mpf.name as meal_policy, a.break_policy_id as break_policy_id, bpf.name as break_policy, a.start_time_stamp as start_time_stamp, a.end_time_stamp as end_time_stamp, a.override as override, a.branch_id as branch_id, j.name as branch, a.department_id as department_id, k.name as department, a.job_id as job_id, a.job_item_id as job_item_id, a.quantity as quantity, a.bad_quantity as bad_quantity, a.total_time as total_time, a.actual_total_time as actual_total_time, c.user_id as user_id, c.date_stamp as date_stamp, c.pay_period_id as pay_period_id, d.first_name as first_name, d.last_name as last_name, d.status_id as user_status_id, d.group_id as group_id, g.name as "group", d.title_id as title_id, h.name as title, d.default_branch_id as default_branch_id, e.name as default_branch, d.default_department_id as default_department_id, f.name as default_department, d.created_by as user_created_by, z.id as user_wage_id, z.effective_date as user_wage_effective_date '; if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $query .= ', x.name as job, x.name as job_name, x.status_id as job_status_id, x.manual_id as job_manual_id, x.branch_id as job_branch_id, x.department_id as job_department_id, x.group_id as job_group_id, y.name as job_item'; } $query .= ' from ' . $this->getTable() . ' as a LEFT JOIN ' . $udf->getTable() . ' as c ON a.user_date_id = c.id LEFT JOIN ' . $uf->getTable() . ' as d ON c.user_id = d.id LEFT JOIN ' . $bf->getTable() . ' as e ON ( d.default_branch_id = e.id AND e.deleted = 0) LEFT JOIN ' . $df->getTable() . ' as f ON ( d.default_department_id = f.id AND f.deleted = 0) LEFT JOIN ' . $ugf->getTable() . ' as g ON ( d.group_id = g.id AND g.deleted = 0 ) LEFT JOIN ' . $utf->getTable() . ' as h ON ( d.title_id = h.id AND h.deleted = 0 ) LEFT JOIN ' . $bf->getTable() . ' as j ON ( a.branch_id = j.id AND j.deleted = 0) LEFT JOIN ' . $df->getTable() . ' as k ON ( a.department_id = k.id AND k.deleted = 0) LEFT JOIN ' . $otpf->getTable() . ' as otpf ON ( a.over_time_policy_id > 0 AND a.over_time_policy_id = otpf.id AND otpf.deleted = 0 ) LEFT JOIN ' . $apf->getTable() . ' as apf ON ( a.absence_policy_id > 0 AND a.absence_policy_id = apf.id AND apf.deleted = 0 ) LEFT JOIN ' . $ppf->getTable() . ' as ppf ON ( a.premium_policy_id > 0 AND a.premium_policy_id = ppf.id AND ppf.deleted = 0 ) LEFT JOIN ' . $mpf->getTable() . ' as mpf ON ( a.meal_policy_id > 0 AND a.meal_policy_id = mpf.id AND mpf.deleted = 0 ) LEFT JOIN ' . $bpf->getTable() . ' as bpf ON ( a.break_policy_id > 0 AND a.break_policy_id = bpf.id AND bpf.deleted = 0 ) LEFT JOIN ' . $uwf->getTable() . ' as z ON z.id = (select z.id from ' . $uwf->getTable() . ' as z where z.user_id = c.user_id and z.effective_date <= c.date_stamp and z.wage_group_id = 0 and z.deleted = 0 order by z.effective_date desc LiMiT 1) '; if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $query .= ' LEFT JOIN ' . $jf->getTable() . ' as x ON a.job_id = x.id'; $query .= ' LEFT JOIN ' . $jif->getTable() . ' as y ON a.job_item_id = y.id'; } $query .= ' WHERE d.company_id = ?'; $query .= isset($filter_data['permission_children_ids']) ? $this->getWhereClauseSQL('d.id', $filter_data['permission_children_ids'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['id']) ? $this->getWhereClauseSQL('a.id', $filter_data['id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['exclude_id']) ? $this->getWhereClauseSQL('d.id', $filter_data['exclude_id'], 'not_numeric_list', $ph) : NULL; $query .= isset($filter_data['user_id']) ? $this->getWhereClauseSQL('c.user_id', $filter_data['user_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['user_status_id']) ? $this->getWhereClauseSQL('d.status_id', $filter_data['user_status_id'], 'numeric_list', $ph) : NULL; if (isset($filter_data['include_subgroups']) and (bool) $filter_data['include_subgroups'] == TRUE) { $uglf = new UserGroupListFactory(); $filter_data['user_group_id'] = $uglf->getByCompanyIdAndGroupIdAndSubGroupsArray($company_id, $filter_data['user_group_id'], TRUE); } $query .= isset($filter_data['user_group_id']) ? $this->getWhereClauseSQL('d.group_id', $filter_data['user_group_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['user_group']) ? $this->getWhereClauseSQL('g.name', $filter_data['user_group'], 'text', $ph) : NULL; $query .= isset($filter_data['group_id']) ? $this->getWhereClauseSQL('d.group_id', $filter_data['group_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['default_branch_id']) ? $this->getWhereClauseSQL('d.default_branch_id', $filter_data['default_branch_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['default_department_id']) ? $this->getWhereClauseSQL('d.default_department_id', $filter_data['default_department_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['title_id']) ? $this->getWhereClauseSQL('d.title_id', $filter_data['title_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['status_id']) ? $this->getWhereClauseSQL('a.status_id', $filter_data['status_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['type_id']) ? $this->getWhereClauseSQL('a.type_id', $filter_data['type_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['pay_period_id']) ? $this->getWhereClauseSQL('c.pay_period_id', $filter_data['pay_period_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['branch_id']) ? $this->getWhereClauseSQL('a.branch_id', $filter_data['branch_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['department_id']) ? $this->getWhereClauseSQL('a.department_id', $filter_data['department_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['job_id']) ? $this->getWhereClauseSQL('a.job_id', $filter_data['job_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['include_job_id']) ? $this->getWhereClauseSQL('a.job_id', $filter_data['include_job_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['exclude_job_id']) ? $this->getWhereClauseSQL('a.job_id', $filter_data['exclude_job_id'], 'not_numeric_list', $ph) : NULL; $query .= isset($filter_data['job_group_id']) ? $this->getWhereClauseSQL('x.group_id', $filter_data['job_group_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['job_item_id']) ? $this->getWhereClauseSQL('a.job_item_id', $filter_data['job_item_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['include_job_item_id']) ? $this->getWhereClauseSQL('a.job_item_id', $filter_data['include_job_item_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['exclude_job_item_id']) ? $this->getWhereClauseSQL('a.job_item_id', $filter_data['exclude_job_item_id'], 'not_numeric_list', $ph) : NULL; /* if ( isset($filter_data['permission_children_ids']) AND isset($filter_data['permission_children_ids'][0]) AND !in_array(-1, (array)$filter_data['permission_children_ids']) ) { $query .= ' AND d.id in ('. $this->getListSQL($filter_data['permission_children_ids'], $ph) .') '; } if ( isset($filter_data['id']) AND isset($filter_data['id'][0]) AND !in_array(-1, (array)$filter_data['id']) ) { $query .= ' AND a.id in ('. $this->getListSQL($filter_data['id'], $ph) .') '; } if ( isset($filter_data['exclude_id']) AND isset($filter_data['exclude_id'][0]) AND !in_array(-1, (array)$filter_data['exclude_id']) ) { $query .= ' AND d.id not in ('. $this->getListSQL($filter_data['exclude_id'], $ph) .') '; } if ( isset($filter_data['user_id']) AND isset($filter_data['user_id'][0]) AND !in_array(-1, (array)$filter_data['user_id']) ) { $query .= ' AND c.user_id in ('. $this->getListSQL($filter_data['user_id'], $ph) .') '; } if ( isset($filter_data['user_status_id']) AND isset($filter_data['user_status_id'][0]) AND !in_array(-1, (array)$filter_data['user_status_id']) ) { $query .= ' AND d.status_id in ('. $this->getListSQL($filter_data['user_status_id'], $ph) .') '; } if ( isset($filter_data['group_id']) AND isset($filter_data['group_id'][0]) AND !in_array(-1, (array)$filter_data['group_id']) ) { if ( isset($filter_data['include_subgroups']) AND (bool)$filter_data['include_subgroups'] == TRUE ) { $uglf = new UserGroupListFactory(); $filter_data['group_id'] = $uglf->getByCompanyIdAndGroupIdAndSubGroupsArray( $company_id, $filter_data['group_id'], TRUE); } $query .= ' AND d.group_id in ('. $this->getListSQL($filter_data['group_id'], $ph) .') '; } if ( isset($filter_data['default_branch_id']) AND isset($filter_data['default_branch_id'][0]) AND !in_array(-1, (array)$filter_data['default_branch_id']) ) { $query .= ' AND d.default_branch_id in ('. $this->getListSQL($filter_data['default_branch_id'], $ph) .') '; } if ( isset($filter_data['default_department_id']) AND isset($filter_data['default_department_id'][0]) AND !in_array(-1, (array)$filter_data['default_department_id']) ) { $query .= ' AND d.default_department_id in ('. $this->getListSQL($filter_data['default_department_id'], $ph) .') '; } if ( isset($filter_data['title_id']) AND isset($filter_data['title_id'][0]) AND !in_array(-1, (array)$filter_data['title_id']) ) { $query .= ' AND d.title_id in ('. $this->getListSQL($filter_data['title_id'], $ph) .') '; } if ( isset($filter_data['branch_id']) AND isset($filter_data['branch_id'][0]) AND !in_array(-1, (array)$filter_data['branch_id']) ) { $query .= ' AND a.branch_id in ('. $this->getListSQL($filter_data['branch_id'], $ph) .') '; } if ( isset($filter_data['department_id']) AND isset($filter_data['department_id'][0]) AND !in_array(-1, (array)$filter_data['department_id']) ) { $query .= ' AND a.department_id in ('. $this->getListSQL($filter_data['department_id'], $ph) .') '; } if ( isset($filter_data['status_id']) AND isset($filter_data['status_id'][0]) AND !in_array(-1, (array)$filter_data['status_id']) ) { $query .= ' AND a.status_id in ('. $this->getListSQL($filter_data['status_id'], $ph) .') '; } if ( isset($filter_data['type_id']) AND isset($filter_data['type_id'][0]) AND !in_array(-1, (array)$filter_data['type_id']) ) { $query .= ' AND a.type_id in ('. $this->getListSQL($filter_data['type_id'], $ph) .') '; } if ( isset($filter_data['pay_period_id']) AND isset($filter_data['pay_period_id'][0]) AND !in_array(-1, (array)$filter_data['pay_period_id']) ) { $query .= ' AND c.pay_period_id in ('. $this->getListSQL($filter_data['pay_period_id'], $ph) .') '; } //Use the job_id in the punch_control table so we can filter by '0' or No Job if ( isset($filter_data['include_job_id']) AND isset($filter_data['include_job_id'][0]) AND !in_array(-1, (array)$filter_data['include_job_id']) ) { $query .= ' AND a.job_id in ('. $this->getListSQL($filter_data['include_job_id'], $ph) .') '; } if ( isset($filter_data['exclude_job_id']) AND isset($filter_data['exclude_job_id'][0]) AND !in_array(-1, (array)$filter_data['exclude_job_id']) ) { $query .= ' AND a.job_id not in ('. $this->getListSQL($filter_data['exclude_job_id'], $ph) .') '; } if ( isset($filter_data['job_group_id']) AND isset($filter_data['job_group_id'][0]) AND !in_array(-1, (array)$filter_data['job_group_id']) ) { if ( isset($filter_data['include_job_subgroups']) AND (bool)$filter_data['include_job_subgroups'] == TRUE ) { $uglf = new UserGroupListFactory(); $filter_data['job_group_id'] = $uglf->getByCompanyIdAndGroupIdAndjob_subgroupsArray( $company_id, $filter_data['job_group_id'], TRUE); } $query .= ' AND x.group_id in ('. $this->getListSQL($filter_data['job_group_id'], $ph) .') '; } if ( isset($filter_data['job_item_id']) AND isset($filter_data['job_item_id'][0]) AND !in_array(-1, (array)$filter_data['job_item_id']) ) { $query .= ' AND a.job_item_id in ('. $this->getListSQL($filter_data['job_item_id'], $ph) .') '; } */ if (isset($filter_data['date']) and trim($filter_data['date']) != '') { $ph[] = $this->db->BindDate($filter_data['date']); $query .= ' AND c.date_stamp = ?'; } if (isset($filter_data['start_date']) and trim($filter_data['start_date']) != '') { $ph[] = $this->db->BindDate($filter_data['start_date']); $query .= ' AND c.date_stamp >= ?'; } if (isset($filter_data['end_date']) and trim($filter_data['end_date']) != '') { $ph[] = $this->db->BindDate($filter_data['end_date']); $query .= ' AND c.date_stamp <= ?'; } $query .= ' AND (a.deleted = 0 AND c.deleted = 0 AND d.deleted = 0) '; $query .= $this->getWhereSQL($where); $query .= $this->getSortSQL($order, $strict, $additional_order_fields); $this->ExecuteSQL($query, $ph, $limit, $page); //Debug::Arr($ph, 'Query: '. $query, __FILE__, __LINE__, __METHOD__,10); return $this; }
static function redirectMobileBrowser() { //FIXME: Add GET parameter override to prevent any redirection from happening. //Set mobile=1 extract(FormVariables::GetVariables(array('desktop'))); if (getTTProductEdition() != TT_PRODUCT_COMMUNITY and $desktop != 1) { $browser = self::detectMobileBrowser(); if ($browser == 'ios') { Redirect::Page(URLBuilder::getURL(NULL, Environment::getBaseURL() . '/iphone/punch/punch.php')); } elseif ($browser == 'html5' or $browser == 'android') { Redirect::Page(URLBuilder::getURL(NULL, Environment::getBaseURL() . '/quick_punch/QuickPunchLogin.php')); } elseif ($browser == 'wap') { Redirect::Page(URLBuilder::getURL(NULL, Environment::getBaseURL() . '/wap/WAPPunch.php')); } } else { Debug::Text('Desktop browser override: ' . (int) $desktop, __FILE__, __LINE__, __METHOD__, 10); } return FALSE; }
protected function _getOptions($name, $params = NULL) { $retval = NULL; switch ($name) { case 'output_format': $retval = parent::getOptions('default_output_format'); break; case 'default_setup_fields': $retval = array('template', 'time_period', 'columns'); break; case 'setup_fields': $retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2035-user_tag' => TTi18n::gettext('Employee Tags'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-3000-exception_policy_type_id' => TTi18n::gettext('Exception'), '-3050-exception_policy_severity_id' => TTi18n::gettext('Severity'), '-4000-pay_period_id' => TTi18n::gettext('Pay Period'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By')); break; case 'time_period': $retval = TTDate::getTimePeriodOptions(); break; case 'date_columns': $retval = array_merge(TTDate::getReportDateOptions(NULL, TTi18n::gettext('Date'), 16, TRUE)); break; case 'custom_columns': //Get custom fields for report data. $oflf = TTnew('OtherFieldListFactory'); //User and Punch fields conflict as they are merged together in a secondary process. $other_field_names = $oflf->getByCompanyIdAndTypeIdArray($this->getUserObject()->getCompany(), array(10), array(10 => '')); if (is_array($other_field_names)) { $retval = Misc::addSortPrefix($other_field_names, 9000); } break; case 'report_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); // Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns. // So just get custom columns with Selection and Formula. $custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'ExceptionReport', 'custom_column'); if (is_array($custom_column_labels)) { $retval = Misc::addSortPrefix($custom_column_labels, 9500); } } break; case 'report_custom_filters': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'ExceptionReport', 'custom_column'); } break; case 'report_dynamic_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'ExceptionReport', 'custom_column'); if (is_array($report_dynamic_custom_column_labels)) { $retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700); } } break; case 'report_static_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'ExceptionReport', 'custom_column'); if (is_array($report_static_custom_column_labels)) { $retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700); } } break; case 'formula_columns': $retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns'))); break; case 'filter_columns': $retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))); break; case 'static_columns': $retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1010-user_name' => TTi18n::gettext('User Name'), '-1020-phone_id' => TTi18n::gettext('PIN/Phone ID'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1040-user_status' => TTi18n::gettext('Employee Status'), '-1050-title' => TTi18n::gettext('Employee Title'), '-1060-province' => TTi18n::gettext('Province/State'), '-1070-country' => TTi18n::gettext('Country'), '-1080-user_group' => TTi18n::gettext('Employee Group'), '-1090-default_branch' => TTi18n::gettext('Branch'), '-1100-default_department' => TTi18n::gettext('Department'), '-1130-permission_group' => TTi18n::gettext('Permission Group'), '-1150-severity' => TTi18n::gettext('Severity'), '-1160-exception_policy_type' => TTi18n::gettext('Exception'), '-1180-policy_group' => TTi18n::gettext('Policy Group'), '-1190-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1170-exception_policy_type_id' => TTi18n::gettext('Code')); $retval = array_merge($retval, (array) $this->getOptions('date_columns'), (array) $this->getOptions('custom_columns'), (array) $this->getOptions('report_static_custom_column')); ksort($retval); break; case 'dynamic_columns': $retval = array('-2050-total_exception' => TTi18n::gettext('Total Exceptions')); break; case 'columns': $retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')); break; case 'column_format': //Define formatting function for each column. $columns = array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_custom_column')); if (is_array($columns)) { foreach ($columns as $column => $name) { if (strpos($column, 'wage') !== FALSE or strpos($column, 'hourly_rate') !== FALSE) { $retval[$column] = 'currency'; } if (strpos($column, 'amount') !== FALSE) { $retval[$column] = 'time_unit'; } } } break; case 'aggregates': $retval = array(); $dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')))); if (is_array($dynamic_columns)) { foreach ($dynamic_columns as $column) { switch ($column) { default: if (strpos($column, 'hourly_rate') !== FALSE or strpos($column, 'wage') !== FALSE) { $retval[$column] = 'avg'; } else { $retval[$column] = 'sum'; } } } } break; case 'templates': $retval = array('-1250-by_severity' => TTi18n::gettext('Exceptions by Severity'), '-1260-by_exception' => TTi18n::gettext('Exceptions by Name'), '-1270-by_pay_period' => TTi18n::gettext('Exceptions by Pay Period'), '-1280-by_employee_by_severity_by_name' => TTi18n::gettext('Exceptions by Employee/Severity/Name'), '-1282-by_severity_by_name_by_employee' => TTi18n::gettext('Exceptions by Severity/Name/Employee'), '-1300-by_severity_by_name_by_dow' => TTi18n::gettext('Exceptions by Severity/Name/Day of Week')); break; case 'template_config': $template = strtolower(Misc::trimSortPrefix($params['template'])); if (isset($template) and $template != '') { $retval['-1010-time_period']['time_period'] = 'last_pay_period'; switch ($template) { case 'by_severity': $retval['columns'][] = 'severity'; $retval['columns'][] = 'exception_policy_type_id'; $retval['columns'][] = 'exception_policy_type'; $retval['columns'][] = 'total_exception'; $retval['group'][] = 'severity'; $retval['group'][] = 'exception_policy_type_id'; $retval['group'][] = 'exception_policy_type'; $retval['sub_total'][] = 'severity'; $retval['sort'][] = array('severity' => 'asc', 'total_exception' => 'desc'); break; case 'by_exception': $retval['columns'][] = 'severity'; $retval['columns'][] = 'exception_policy_type_id'; $retval['columns'][] = 'exception_policy_type'; $retval['columns'][] = 'total_exception'; $retval['group'][] = 'severity'; $retval['group'][] = 'exception_policy_type_id'; $retval['group'][] = 'exception_policy_type'; $retval['sort'][] = array('total_exception' => 'desc', 'severity' => 'asc'); break; case 'by_pay_period': $retval['columns'][] = 'pay_period'; $retval['columns'][] = 'severity'; $retval['columns'][] = 'exception_policy_type_id'; $retval['columns'][] = 'exception_policy_type'; $retval['columns'][] = 'total_exception'; $retval['group'][] = 'pay_period'; $retval['group'][] = 'severity'; $retval['group'][] = 'exception_policy_type_id'; $retval['group'][] = 'exception_policy_type'; $retval['sub_total'][] = 'pay_period'; $retval['sub_total'][] = 'severity'; $retval['sort'][] = array('pay_period' => 'desc', 'severity' => 'asc', 'total_exception' => 'desc'); break; case 'by_employee_by_severity_by_name': $retval['columns'][] = 'full_name'; $retval['columns'][] = 'severity'; $retval['columns'][] = 'exception_policy_type_id'; $retval['columns'][] = 'exception_policy_type'; $retval['columns'][] = 'total_exception'; $retval['group'][] = 'full_name'; $retval['group'][] = 'severity'; $retval['group'][] = 'exception_policy_type_id'; $retval['group'][] = 'exception_policy_type'; $retval['sub_total'][] = 'full_name'; $retval['sub_total'][] = 'severity'; $retval['sort'][] = array('full_name' => 'asc', 'severity' => 'asc', 'total_exception' => 'desc'); break; case 'by_severity_by_name_by_employee': $retval['columns'][] = 'severity'; $retval['columns'][] = 'exception_policy_type_id'; $retval['columns'][] = 'exception_policy_type'; $retval['columns'][] = 'full_name'; $retval['columns'][] = 'total_exception'; $retval['group'][] = 'severity'; $retval['group'][] = 'exception_policy_type_id'; $retval['group'][] = 'exception_policy_type'; $retval['group'][] = 'full_name'; $retval['sub_total'][] = 'severity'; $retval['sub_total'][] = 'exception_policy_type'; $retval['sub_total'][] = 'full_name'; $retval['sort'][] = array('severity' => 'asc', 'total_exception' => 'desc'); break; case 'by_severity_by_name_by_dow': $retval['columns'][] = 'severity'; $retval['columns'][] = 'exception_policy_type_id'; $retval['columns'][] = 'exception_policy_type'; $retval['columns'][] = 'date_dow'; $retval['columns'][] = 'total_exception'; $retval['group'][] = 'severity'; $retval['group'][] = 'exception_policy_type_id'; $retval['group'][] = 'exception_policy_type'; $retval['group'][] = 'date_dow'; $retval['sub_total'][] = 'severity'; $retval['sub_total'][] = 'exception_policy_type'; $retval['sort'][] = array('severity' => 'asc', 'exception_policy_type_id' => 'asc', 'exception_policy_type' => 'asc', 'total_exception' => 'desc'); break; default: Debug::Text(' Parsing template name: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; } } //Set the template dropdown as well. $retval['-1000-template'] = $template; //Add sort prefixes so Flex can maintain order. if (isset($retval['filter'])) { $retval['-5000-filter'] = $retval['filter']; unset($retval['filter']); } if (isset($retval['columns'])) { $retval['-5010-columns'] = $retval['columns']; unset($retval['columns']); } if (isset($retval['group'])) { $retval['-5020-group'] = $retval['group']; unset($retval['group']); } if (isset($retval['sub_total'])) { $retval['-5030-sub_total'] = $retval['sub_total']; unset($retval['sub_total']); } if (isset($retval['sort'])) { $retval['-5040-sort'] = $retval['sort']; unset($retval['sort']); } Debug::Arr($retval, ' Template Config for: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; default: //Call report parent class options function for options valid for all reports. $retval = $this->__getOptions($name); break; } return $retval; }
protected function _getOptions($name, $params = NULL) { $retval = NULL; switch ($name) { case 'output_format': $retval = parent::getOptions('default_output_format'); break; case 'default_setup_fields': $retval = array('template', 'time_period', 'columns'); break; case 'setup_fields': $retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2035-user_tag' => TTi18n::gettext('Employee Tags'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-3600-log_action_id' => TTi18n::gettext('Action'), '-3700-log_table_name_id' => TTi18n::gettext('Object'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By')); break; case 'time_period': $retval = TTDate::getTimePeriodOptions(); break; case 'date_columns': /*$retval = array_merge( TTDate::getReportDateOptions( 'start', TTi18n::getText('Start Date'), 16, FALSE ), TTDate::getReportDateOptions( 'end', TTi18n::getText('End Date'), 17, FALSE ) );*/ break; case 'report_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); // Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns. // So just get custom columns with Selection and Formula. $custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'AuditTrailReport', 'custom_column'); if (is_array($custom_column_labels)) { $retval = Misc::addSortPrefix($custom_column_labels, 9500); } } break; case 'report_custom_filters': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'AuditTrailReport', 'custom_column'); } break; case 'report_dynamic_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'AuditTrailReport', 'custom_column'); if (is_array($report_dynamic_custom_column_labels)) { $retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700); } } break; case 'report_static_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'AuditTrailReport', 'custom_column'); if (is_array($report_static_custom_column_labels)) { $retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700); } } break; case 'formula_columns': $retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns'))); break; case 'filter_columns': $retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))); break; case 'static_columns': $retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1010-user_name' => TTi18n::gettext('User Name'), '-1020-phone_id' => TTi18n::gettext('Quick Punch ID'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1040-user_status' => TTi18n::gettext('Employee Status'), '-1050-title' => TTi18n::gettext('Employee Title'), '-1060-province' => TTi18n::gettext('Province/State'), '-1070-country' => TTi18n::gettext('Country'), '-1080-user_group' => TTi18n::gettext('Employee Group'), '-1090-default_branch' => TTi18n::gettext('Branch'), '-1100-default_department' => TTi18n::gettext('Department'), '-2000-date' => TTi18n::gettext('Date'), '-2100-object' => TTi18n::gettext('Object'), '-2150-action' => TTi18n::gettext('Action'), '-2200-description' => TTi18n::gettext('Description')); //$retval = array_merge( $retval, $this->getOptions('date_columns') ); $retval = array_merge($retval, (array) $this->getOptions('report_static_custom_column')); ksort($retval); break; case 'dynamic_columns': $retval = array('-2500-total_log' => TTi18n::gettext('Total')); break; case 'columns': //$retval = array_merge( $this->getOptions('static_columns'), $this->getOptions('dynamic_columns') ); $retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')); break; case 'column_format': //Define formatting function for each column. $columns = array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_custom_column')); if (is_array($columns)) { foreach ($columns as $column => $name) { if (strpos($column, 'wage') !== FALSE or strpos($column, 'hourly_rate') !== FALSE) { $retval[$column] = 'currency'; } if (strpos($column, 'amount') !== FALSE) { $retval[$column] = 'time_unit'; } } } break; case 'aggregates': $retval = array(); $dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')))); if (is_array($dynamic_columns)) { foreach ($dynamic_columns as $column) { switch ($column) { default: $retval[$column] = 'sum'; } } } break; case 'templates': $retval = array('-1200-by_date+audit' => TTi18n::gettext('Audit By Date'), '-1210-by_employee+audit' => TTi18n::gettext('Audit By Employee'), '-1220-by_object+audit' => TTi18n::gettext('Audit By Object'), '-1230-by_action+audit' => TTi18n::gettext('Audit By Action'), '-1240-by_object_by_action_by_employee+audit_total' => TTi18n::gettext('Audit Records By Object/Action/Employee')); break; case 'template_config': $template = strtolower(Misc::trimSortPrefix($params['template'])); if (isset($template) and $template != '') { $retval['-1010-time_period']['time_period'] = 'last_7_days'; //Always default to the last 7 days to keep the report small and fast. switch ($template) { case 'by_date+audit': $retval['columns'][] = 'date'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'object'; $retval['columns'][] = 'action'; $retval['columns'][] = 'description'; $retval['sort'][] = array('date' => 'desc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); $retval['sort'][] = array('object' => 'asc'); $retval['sort'][] = array('action' => 'asc'); break; case 'by_employee+audit': $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'date'; $retval['columns'][] = 'object'; $retval['columns'][] = 'action'; $retval['columns'][] = 'description'; $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); $retval['sort'][] = array('date' => 'desc'); $retval['sort'][] = array('object' => 'asc'); $retval['sort'][] = array('action' => 'asc'); break; case 'by_object+audit': $retval['columns'][] = 'object'; $retval['columns'][] = 'date'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'action'; $retval['columns'][] = 'description'; $retval['sort'][] = array('object' => 'asc'); $retval['sort'][] = array('date' => 'desc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); $retval['sort'][] = array('action' => 'asc'); break; case 'by_action+audit': $retval['columns'][] = 'action'; $retval['columns'][] = 'date'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'object'; $retval['columns'][] = 'description'; $retval['sort'][] = array('action' => 'asc'); $retval['sort'][] = array('date' => 'desc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); $retval['sort'][] = array('object' => 'asc'); //$retval['filter']['-1050-log_action_id'] = array(); break; case 'by_object_by_action_by_employee+audit_total': $retval['columns'][] = 'object'; $retval['columns'][] = 'action'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'total_log'; $retval['group'][] = 'object'; $retval['group'][] = 'action'; $retval['group'][] = 'first_name'; $retval['group'][] = 'last_name'; $retval['sub_total'][] = 'object'; $retval['sub_total'][] = 'action'; $retval['sort'][] = array('object' => 'asc'); $retval['sort'][] = array('action' => 'asc'); $retval['sort'][] = array('total_log' => 'desc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; default: Debug::Text(' Parsing template name: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; } } //Set the template dropdown as well. $retval['-1000-template'] = $template; //Add sort prefixes so Flex can maintain order. if (isset($retval['filter'])) { $retval['-5000-filter'] = $retval['filter']; unset($retval['filter']); } if (isset($retval['columns'])) { $retval['-5010-columns'] = $retval['columns']; unset($retval['columns']); } if (isset($retval['group'])) { $retval['-5020-group'] = $retval['group']; unset($retval['group']); } if (isset($retval['sub_total'])) { $retval['-5030-sub_total'] = $retval['sub_total']; unset($retval['sub_total']); } if (isset($retval['sort'])) { $retval['-5040-sort'] = $retval['sort']; unset($retval['sort']); } Debug::Arr($retval, ' Template Config for: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; default: //Call report parent class options function for options valid for all reports. $retval = $this->__getOptions($name); break; } return $retval; }
function generateData() { global $current_company, $current_user; TTDate::setTimeZone('PST8PDT'); $current_epoch = time(); $cf = new CompanyFactory(); $cf->StartTransaction(); $company_id = $this->createCompany(); $clf = new CompanyListFactory(); $clf->getById($company_id); $current_company = $clf->getCurrent(); if ($company_id !== FALSE) { Debug::Text('Company Created Successfully!', __FILE__, __LINE__, __METHOD__, 10); $this->createPermissionGroups($company_id); //Create currency $currency_ids[] = $this->createCurrency($company_id, 10); //USD $currency_ids[] = $this->createCurrency($company_id, 20); //CAD //Create branch $branch_ids[] = $this->createBranch($company_id, 10); //NY $branch_ids[] = $this->createBranch($company_id, 20); //WA //Create departments $department_ids[] = $this->createDepartment($company_id, 10); $department_ids[] = $this->createDepartment($company_id, 20); //Create stations $station_id = $this->createStation($company_id); //Create pay stub accounts. $this->createPayStubAccount($company_id); //Link pay stub accounts. $this->createPayStubAccountLink($company_id); //Company Deductions $this->createCompanyDeduction($company_id); //Wage Groups $wage_group_ids[] = $this->createUserWageGroups($company_id); //User Groups $user_group_ids[] = $this->createUserGroup($company_id, 10, 0); $user_group_ids[] = $this->createUserGroup($company_id, 20, $user_group_ids[0]); $user_group_ids[] = $this->createUserGroup($company_id, 30, $user_group_ids[0]); $user_group_ids[] = $this->createUserGroup($company_id, 40, 0); $user_group_ids[] = $this->createUserGroup($company_id, 50, $user_group_ids[3]); //Users $user_ids[] = $this->createUser($company_id, 10, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[0]); $user_ids[] = $this->createUser($company_id, 11, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[0]); $user_ids[] = $this->createUser($company_id, 12, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[0]); $user_ids[] = $this->createUser($company_id, 13, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[0]); $user_ids[] = $this->createUser($company_id, 14, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[1]); $user_ids[] = $this->createUser($company_id, 15, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[1]); $user_ids[] = $this->createUser($company_id, 16, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[1]); $user_ids[] = $this->createUser($company_id, 17, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[1]); $user_ids[] = $this->createUser($company_id, 18, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[2]); $user_ids[] = $this->createUser($company_id, 19, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[2]); $user_ids[] = $this->createUser($company_id, 20, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[2]); $user_ids[] = $this->createUser($company_id, 21, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3]); $user_ids[] = $this->createUser($company_id, 22, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3]); $user_ids[] = $this->createUser($company_id, 23, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3]); $user_ids[] = $this->createUser($company_id, 24, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3]); $user_ids[] = $this->createUser($company_id, 25, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]); $user_ids[] = $this->createUser($company_id, 26, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]); $user_ids[] = $this->createUser($company_id, 27, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]); $user_ids[] = $this->createUser($company_id, 28, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]); $user_ids[] = $this->createUser($company_id, 29, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]); $user_ids[] = $this->createUser($company_id, 30, 0, $branch_ids[1], $department_ids[0], $currency_ids[0], $user_group_ids[4]); $user_ids[] = $this->createUser($company_id, 40, 0, $branch_ids[1], $department_ids[0], $currency_ids[0], $user_group_ids[4]); $current_user_id = $user_ids[] = $this->createUser($company_id, 100, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[1]); //Create random users. for ($i = 0; $i <= $this->getMaxRandomUsers(); $i++) { $tmp_user_id = $this->createUser($company_id, 999, 0, $branch_ids[$i % 2], $department_ids[$i % 2], $currency_ids[0], $user_group_ids[$i % 5]); if ($tmp_user_id != FALSE) { $user_ids[] = $tmp_user_id; } } Debug::Arr($user_ids, 'All User IDs:', __FILE__, __LINE__, __METHOD__, 10); $ulf = new UserListFactory(); $ulf->getById($current_user_id); $current_user = $ulf->getCurrent(); unset($current_user_id); //Create policies $policy_ids['round'][] = $this->createRoundingPolicy($company_id, 10); //In $policy_ids['round'][] = $this->createRoundingPolicy($company_id, 20); //Out $policy_ids['accrual'][] = $this->createAccrualPolicy($company_id, 10); //Bank Time $policy_ids['accrual'][] = $this->createAccrualPolicy($company_id, 20); //Vacaction $policy_ids['accrual'][] = $this->createAccrualPolicy($company_id, 30); //Sick $policy_ids['overtime'][] = $this->createOverTimePolicy($company_id, 10); $policy_ids['overtime'][] = $this->createOverTimePolicy($company_id, 20, $policy_ids['accrual'][0]); $policy_ids['premium'][] = $this->createPremiumPolicy($company_id, 10); $policy_ids['absence'][] = $this->createAbsencePolicy($company_id, 10, $policy_ids['accrual'][1]); $policy_ids['absence'][] = $this->createAbsencePolicy($company_id, 20, $policy_ids['accrual'][0]); $policy_ids['absence'][] = $this->createAbsencePolicy($company_id, 30, $policy_ids['accrual'][2]); $policy_ids['meal_1'] = $this->createMealPolicy($company_id); $policy_ids['schedule_1'] = $this->createSchedulePolicy($company_id, $policy_ids['meal_1']); $policy_ids['exception_1'] = $this->createExceptionPolicy($company_id); $hierarchy_user_ids = $user_ids; $root_user_id = array_pop($hierarchy_user_ids); unset($hierarchy_user_ids[0], $hierarchy_user_ids[1]); //Create authorization hierarchy $hierarchy_control_id = $this->createAuthorizationHierarchyControl($company_id, $hierarchy_user_ids); if ($root_user_id == FALSE) { Debug::Text('Administrator wasn\'t created! Duplicate username perhaps? Are we appending a random number?', __FILE__, __LINE__, __METHOD__, 10); } //Admin user at the top $this->createAuthorizationHierarchyLevel($company_id, $hierarchy_control_id, $root_user_id, 1); $this->createAuthorizationHierarchyLevel($company_id, $hierarchy_control_id, $user_ids[0], 2); $this->createAuthorizationHierarchyLevel($company_id, $hierarchy_control_id, $user_ids[1], 3); unset($hierarchy_user_ids, $root_user_id); //Pay Period Schedule $this->createPayPeriodSchedule($company_id, $user_ids); //Create Policy Group $this->createPolicyGroup($company_id, $policy_ids['meal_1'], $policy_ids['exception_1'], NULL, $policy_ids['overtime'], $policy_ids['premium'], $policy_ids['round'], $user_ids); if (getTTProductEdition() == TT_PRODUCT_PROFESSIONAL) { //Task Groups $task_group_ids[] = $this->createTaskGroup($company_id, 10, 0); $task_group_ids[] = $this->createTaskGroup($company_id, 20, $task_group_ids[0]); $task_group_ids[] = $this->createTaskGroup($company_id, 30, $task_group_ids[0]); $task_group_ids[] = $this->createTaskGroup($company_id, 40, 0); $task_group_ids[] = $this->createTaskGroup($company_id, 50, $task_group_ids[3]); $task_group_ids[] = $this->createTaskGroup($company_id, 60, $task_group_ids[3]); //Job Tasks $default_task_id = $this->createTask($company_id, 10, $task_group_ids[2]); $task_ids[] = $this->createTask($company_id, 20, $task_group_ids[1]); $task_ids[] = $this->createTask($company_id, 30, $task_group_ids[1]); $task_ids[] = $this->createTask($company_id, 40, $task_group_ids[2]); $task_ids[] = $this->createTask($company_id, 50, $task_group_ids[4]); $task_ids[] = $this->createTask($company_id, 60, $task_group_ids[4]); $task_ids[] = $this->createTask($company_id, 70, $task_group_ids[5]); //Job Groups $job_group_ids[] = $this->createJobGroup($company_id, 10, 0); $job_group_ids[] = $this->createJobGroup($company_id, 20, $job_group_ids[0]); $job_group_ids[] = $this->createJobGroup($company_id, 30, $job_group_ids[0]); $job_group_ids[] = $this->createJobGroup($company_id, 40, 0); $job_group_ids[] = $this->createJobGroup($company_id, 50, $job_group_ids[3]); $job_group_ids[] = $this->createJobGroup($company_id, 60, $job_group_ids[3]); //Jobs $job_ids[] = $this->createJob($company_id, 10, $default_task_id, $job_group_ids[1], $branch_ids[0], $department_ids[0]); $job_ids[] = $this->createJob($company_id, 11, $default_task_id, $job_group_ids[1], $branch_ids[0], $department_ids[0]); $job_ids[] = $this->createJob($company_id, 12, $default_task_id, $job_group_ids[1], $branch_ids[0], $department_ids[0]); $job_ids[] = $this->createJob($company_id, 13, $default_task_id, $job_group_ids[1], $branch_ids[0], $department_ids[0]); $job_ids[] = $this->createJob($company_id, 14, $default_task_id, $job_group_ids[1], $branch_ids[0], $department_ids[0]); $job_ids[] = $this->createJob($company_id, 15, $default_task_id, $job_group_ids[2], $branch_ids[1], $department_ids[1]); $job_ids[] = $this->createJob($company_id, 16, $default_task_id, $job_group_ids[2], $branch_ids[1], $department_ids[1]); $job_ids[] = $this->createJob($company_id, 17, $default_task_id, $job_group_ids[2], $branch_ids[1], $department_ids[1]); $job_ids[] = $this->createJob($company_id, 18, $default_task_id, $job_group_ids[2], $branch_ids[1], $department_ids[1]); $job_ids[] = $this->createJob($company_id, 19, $default_task_id, $job_group_ids[2], $branch_ids[1], $department_ids[1]); $job_ids[] = $this->createJob($company_id, 20, $default_task_id, $job_group_ids[4], $branch_ids[0], $department_ids[0]); $job_ids[] = $this->createJob($company_id, 21, $default_task_id, $job_group_ids[4], $branch_ids[0], $department_ids[0]); $job_ids[] = $this->createJob($company_id, 22, $default_task_id, $job_group_ids[4], $branch_ids[0], $department_ids[0]); $job_ids[] = $this->createJob($company_id, 23, $default_task_id, $job_group_ids[5], $branch_ids[1], $department_ids[1]); $job_ids[] = $this->createJob($company_id, 24, $default_task_id, $job_group_ids[5], $branch_ids[1], $department_ids[1]); $job_ids[] = $this->createJob($company_id, 25, $default_task_id, $job_group_ids[5], $branch_ids[1], $department_ids[1]); } else { $task_ids[] = 0; $job_ids[] = 0; } //Create Accrual balances foreach ($user_ids as $user_id) { foreach ($policy_ids['accrual'] as $accrual_policy_id) { $this->createAccrualBalance($user_id, $accrual_policy_id); } unset($accrual_policy_id); } //Create recurring schedule templates $recurring_schedule_ids[] = $this->createRecurringScheduleTemplate($company_id, 10, $policy_ids['schedule_1']); //Morning shift $recurring_schedule_ids[] = $this->createRecurringScheduleTemplate($company_id, 20, $policy_ids['schedule_1']); //Afternoon shift $recurring_schedule_ids[] = $this->createRecurringScheduleTemplate($company_id, 30, $policy_ids['schedule_1']); //Evening shift $recurring_schedule_ids[] = $this->createRecurringScheduleTemplate($company_id, 40); //Split Shift $recurring_schedule_ids[] = $this->createRecurringScheduleTemplate($company_id, 50, $policy_ids['schedule_1']); //Full rotation $recurring_schedule_start_date = TTDate::getBeginWeekEpoch($current_epoch + 86400 * 7.5); $this->createRecurringSchedule($company_id, $recurring_schedule_ids[0], $recurring_schedule_start_date, '', array($user_ids[0], $user_ids[1], $user_ids[2], $user_ids[3], $user_ids[4])); $this->createRecurringSchedule($company_id, $recurring_schedule_ids[1], $recurring_schedule_start_date, '', array($user_ids[5], $user_ids[6], $user_ids[7], $user_ids[8], $user_ids[9])); $this->createRecurringSchedule($company_id, $recurring_schedule_ids[2], $recurring_schedule_start_date, '', array($user_ids[10], $user_ids[11], $user_ids[12], $user_ids[13], $user_ids[14])); //Create schedule for each employee. foreach ($user_ids as $user_id) { //Create schedule starting 6 weeks ago, up to the end of the week. $schedule_options_arr = array('status_id' => 10, 'start_time' => '08:00AM', 'end_time' => '05:00PM', 'schedule_policy_id' => $policy_ids['schedule_1']); //$schedule_date = ($current_epoch-(86400*42)); $schedule_date = $current_epoch - 86400 * 14; $schedule_end_date = TTDate::getEndWeekEpoch($current_epoch); //$schedule_date = ($current_epoch-(86400*14)); //$schedule_end_date = ($current_epoch+(86400*28)); while ($schedule_date <= $schedule_end_date) { //Random departments/branches $schedule_options_arr['branch_id'] = $branch_ids[rand(0, count($branch_ids) - 1)]; $schedule_options_arr['department_id'] = $department_ids[rand(0, count($department_ids) - 1)]; //Skip weekends. if (date('w', $schedule_date) != 0 and date('w', $schedule_date) != 6) { $this->createSchedule($user_id, $schedule_date, $schedule_options_arr); } $schedule_date += 86400; } //break; unset($schedule_options_arr, $schedule_date, $schedule_end_date, $user_id); } //Punch users in/out randomly. foreach ($user_ids as $user_id) { //Pick random jobs/tasks that are used for the entire date range. //So one employee isn't punching into 15 jobs. $user_random_job_ids = array_rand($job_ids, 2); $user_random_task_ids = array_rand($job_ids, 3); //Create punches starting 6 weeks ago, up to the end of the week. //$start_date = $punch_date = ($current_epoch-(86400*42)); $start_date = $punch_date = $current_epoch - 86400 * 14; $end_date = TTDate::getEndWeekEpoch($current_epoch); //$start_date = $punch_date = ($current_epoch-(86400*14)); //$end_date = ($current_epoch+(86400*28)); $i = 0; while ($punch_date <= $end_date) { $date_stamp = TTDate::getDate('DATE', $punch_date); //$punch_full_time_stamp = strtotime($pc_data['date_stamp'].' '.$pc_data['time_stamp']); $exception_cutoff_date = $current_epoch - 86400 * 14; if (date('w', $punch_date) != 0 and date('w', $punch_date) != 6) { if ($punch_date >= $exception_cutoff_date and $i % 4 == 0) { $first_punch_in = rand(7, 8) . ':' . str_pad(rand(0, 30), 2, '0', STR_PAD_LEFT) . 'AM'; $last_punch_out = strtotime($date_stamp . ' ' . rand(4, 5) . ':' . str_pad(rand(0, 30), 2, '0', STR_PAD_LEFT) . 'PM'); if ($punch_date >= $exception_cutoff_date and rand(0, 20) == 0) { //Create request $this->createRequest(20, $user_id, $date_stamp); } if ($punch_date >= $exception_cutoff_date and rand(0, 16) == 0) { //Create request $this->createRequest(20, $user_id, $date_stamp); } } else { $first_punch_in = '08:00AM'; if ($punch_date >= $exception_cutoff_date and $i % 10 == 0) { //Don't punch out to generate exception. $last_punch_out = NULL; //Forgot to punch out request $this->createRequest(30, $user_id, $date_stamp); } else { $last_punch_out = strtotime($date_stamp . ' 5:00PM'); } } //Weekdays $this->createPunchPair($user_id, strtotime($date_stamp . ' ' . $first_punch_in), strtotime($date_stamp . ' 11:00AM'), array('in_type_id' => 10, 'out_type_id' => 10, 'branch_id' => $branch_ids[rand(0, count($branch_ids) - 1)], 'department_id' => $department_ids[rand(0, count($department_ids) - 1)], 'job_id' => $job_ids[array_rand($user_random_job_ids)], 'job_item_id' => $task_ids[array_rand($user_random_task_ids)]), TRUE); $this->createPunchPair($user_id, strtotime($date_stamp . ' 11:00AM'), strtotime($date_stamp . ' 1:00PM'), array('in_type_id' => 10, 'out_type_id' => 20, 'branch_id' => $branch_ids[rand(0, count($branch_ids) - 1)], 'department_id' => $department_ids[rand(0, count($department_ids) - 1)], 'job_id' => $job_ids[array_rand($user_random_job_ids)], 'job_item_id' => $task_ids[array_rand($user_random_task_ids)]), TRUE); //Calc total time on last punch pair only. $this->createPunchPair($user_id, strtotime($date_stamp . ' 2:00PM'), $last_punch_out, array('in_type_id' => 20, 'out_type_id' => 10, 'branch_id' => $branch_ids[rand(0, count($branch_ids) - 1)], 'department_id' => $department_ids[rand(0, count($department_ids) - 1)], 'job_id' => $job_ids[array_rand($user_random_job_ids)], 'job_item_id' => $task_ids[array_rand($user_random_task_ids)]), TRUE); } elseif ($punch_date > $exception_cutoff_date and date('w', $punch_date) == 6 and $i % 10 == 0) { //Sat. $this->createPunchPair($user_id, strtotime($date_stamp . ' 10:00AM'), strtotime($date_stamp . ' 2:30PM'), array('in_type_id' => 10, 'out_type_id' => 10, 'branch_id' => $branch_ids[rand(0, count($branch_ids) - 1)], 'department_id' => $department_ids[rand(0, count($department_ids) - 1)], 'job_id' => $job_ids[array_rand($user_random_job_ids)], 'job_item_id' => $task_ids[array_rand($user_random_task_ids)]), TRUE); } //Recalculate entire day. Performance optimization. //UserDateTotalFactory::reCalculateRange( $user_id, $start_date, $end_date ); $punch_date += 86400; $i++; } unset($punch_options_arr, $punch_date, $user_id); } //Generate pay stubs for each pay period $pplf = new PayPeriodListFactory(); $pplf->getByCompanyId($company_id); if ($pplf->getRecordCount() > 0) { foreach ($pplf as $pp_obj) { foreach ($user_ids as $user_id) { $cps = new CalculatePayStub(); $cps->setUser($user_id); $cps->setPayPeriod($pp_obj->getId()); $cps->calculate(); } } } unset($pplf, $pp_obj, $user_id); } //$cf->FailTransaction(); $cf->CommitTransaction(); return FALSE; }
function setJobItem($id) { $id = trim($id); if ($id == FALSE or $id == 0 or $id == '') { $id = 0; } if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $jilf = TTnew('JobItemListFactory'); } if ($id == 0 or $this->Validator->isResultSetWithRows('job_item', $jilf->getByID($id), TTi18n::gettext('Job Item does not exist'))) { $this->data['job_item_id'] = $id; return TRUE; } return FALSE; }
if (isset($config_vars['other']['installer_enabled']) and $config_vars['other']['installer_enabled'] == 1 or stristr($_SERVER['HTTP_REFERER'], 'quick_punch')) { //FIXME: Remove the authenticate flag from sm_header and installer. $authenticate = FALSE; } require_once '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'Interface.inc.php'; //Use session created date or login date. //So this file is updated each time they login. forceCacheHeaders(NULL, $authentication->getCreatedDate()); $pplf = new PayPeriodListFactory(); $js_calendar_pay_period_dates = $pplf->getJSCalendarPayPeriodArray(); ?> var TTProductEdition = <?php if (isset($current_company) and is_object($current_company) and getTTProductEdition() >= $current_company->getProductEdition()) { echo (int) $current_company->getProductEdition(); } else { echo (int) getTTProductEdition(); } ?> ; var JSCalendarPayPeriodEndDates = <?php echo Misc::getJSArray($js_calendar_pay_period_dates['end_date']) . "\n"; ?> var JSCalendarPayPeriodTransactionDates = <?php echo Misc::getJSArray($js_calendar_pay_period_dates['transaction_date']) . "\n"; ?> function JSCalendarDateStatus(date, y, m, d) { year = date.getFullYear(); month = date.getMonth()+1; day = date.getDate();
function getJobtoJobItemMap($station_id) { //If the job is not in the list, that means all items are allowed Debug::Text('Getting JobToUser Map for Station ID: ' . $station_id, __FILE__, __LINE__, __METHOD__, 10); if ($station_id == '') { return FALSE; } if (getTTProductEdition() != TT_PRODUCT_PROFESSIONAL) { return FALSE; } $slf = new StationListFactory(); $slf->getByStationID($station_id); if ($slf->getRecordCount() > 0) { $s_obj = $slf->getCurrent(); $company_id = $s_obj->getCompany(); Debug::Text('Company ID: ' . $company_id, __FILE__, __LINE__, __METHOD__, 10); if ($company_id != FALSE) { //Gets all users allowed to punch in/out from this station $jilf = new JobItemListFactory(); $job_to_job_item_map = $jilf->getJobToJobItemMapByCompanyIdAndStatus($company_id, 10); if (is_array($job_to_job_item_map)) { foreach ($job_to_job_item_map as $key => $arr) { $list["'{$key}'"] = array('job_id' => (int) $arr['job_id'], 'job_item_id' => (int) $arr['job_item_id']); } if (isset($list)) { return $list; } } /* $jialf = new JobItemAllowListFactory(); $jialf->getByCompanyIdAndStatus( $company_id, 10); if ( $jialf->getRecordCount() > 0 ) { $x=0; foreach( $jialf as $jia_obj) { $list["'$x'"] = array( 'job_id' => (int)$jia_obj->getJob(), 'job_item_id' => (int)$jia_obj->getItem(), ); $x++; } if ( isset($list) ) { return $list; } } */ } } Debug::Text('Returning FALSE!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
} if ($obj->isValid()) { $obj->Save(); } //Write anonymous_auto_update feature to system settings. $sslf = new SystemSettingListFactory(); $sslf->getByName('anonymous_update_notify'); if ($sslf->getRecordCount() == 1) { $obj = $sslf->getCurrent(); } else { $obj = new SystemSettingListFactory(); } $obj->setName('anonymous_update_notify'); if (isset($data['anonymous_update_notify']) and $data['anonymous_update_notify'] == 1) { $obj->setValue(1); } elseif (getTTProductEdition() == TT_PRODUCT_PROFESSIONAL) { $obj->setValue(0); } else { $obj->setValue(0); } if ($obj->isValid()) { $obj->Save(); } $ttsc = new TimeTrexSoapClient(); $ttsc->saveRegistrationKey(); $handle = fopen('http://www.timetrex.com/' . URLBuilder::getURL(array('v' => $install_obj->getFullApplicationVersion(), 'page' => 'system_setting', 'update_notify' => (int) $data['update_notify'], 'anonymous_update_notify' => (int) $data['anonymous_update_notify']), 'pre_install.php'), "r"); fclose($handle); Redirect::Page(URLBuilder::getURL(array('external_installer' => $external_installer), 'Company.php')); break; default: Debug::Text('Request URI: ' . $_SERVER['REQUEST_URI'], __FILE__, __LINE__, __METHOD__, 10);
function sendEmail($to, $headers, $body) { global $config_vars; if (!isset($config_vars['other']['primary_company_id'])) { $config_vars['other']['primary_company_id'] = 1; } $clf = new CompanyListFactory(); $clf->getById($config_vars['other']['primary_company_id']); if ($clf->getRecordCount() > 0) { foreach ($clf as $c_obj) { $company_data = array('system_version' => APPLICATION_VERSION, 'registration_key' => $this->getLocalRegistrationKey(), 'product_edition_id' => $c_obj->getProductEdition(), 'product_edition_available' => getTTProductEdition(), 'name' => $c_obj->getName(), 'short_name' => $c_obj->getShortName(), 'work_phone' => $c_obj->getWorkPhone(), 'city' => $c_obj->getCity(), 'country' => $c_obj->getCountry(), 'province' => $c_obj->getProvince(), 'postal_code' => $c_obj->getPostalCode()); } } if (isset($company_data) and $to != '' and $body != '') { return $this->getSoapObject()->sendEmail($to, $headers, $body, $company_data); } return FALSE; }
protected function _getOptions($name, $params = NULL) { $retval = NULL; switch ($name) { case 'output_format': $retval = array_merge(parent::getOptions('default_output_format'), array('-1100-pdf_form' => TTi18n::gettext('Employee (One Employee/Page)'), '-1110-pdf_form_government' => TTi18n::gettext('Government (Multiple Employees/Page)'), '-1120-efile_xml' => TTi18n::gettext('eFile'))); break; case 'default_setup_fields': $retval = array('template', 'time_period', 'columns'); break; case 'setup_fields': $retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By')); break; case 'time_period': $retval = TTDate::getTimePeriodOptions(); break; case 'date_columns': //$retval = TTDate::getReportDateOptions( NULL, TTi18n::getText('Date'), 13, TRUE ); $retval = array(); break; case 'report_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); // Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns. // So just get custom columns with Selection and Formula. $custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'T4SummaryReport', 'custom_column'); if (is_array($custom_column_labels)) { $retval = Misc::addSortPrefix($custom_column_labels, 9500); } } break; case 'report_custom_filters': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'T4SummaryReport', 'custom_column'); } break; case 'report_dynamic_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'T4SummaryReport', 'custom_column'); if (is_array($report_dynamic_custom_column_labels)) { $retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700); } } break; case 'report_static_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'T4SummaryReport', 'custom_column'); if (is_array($report_static_custom_column_labels)) { $retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700); } } break; case 'formula_columns': $retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns'))); break; case 'filter_columns': $retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))); break; case 'static_columns': $retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1035-sin' => TTi18n::gettext('SIN/SSN'), '-1040-status' => TTi18n::gettext('Status'), '-1050-title' => TTi18n::gettext('Title'), '-1060-province' => TTi18n::gettext('Province/State'), '-1070-country' => TTi18n::gettext('Country'), '-1080-group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Default Branch'), '-1100-default_department' => TTi18n::gettext('Default Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1400-permission_control' => TTi18n::gettext('Permission Group'), '-1410-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1420-policy_group' => TTi18n::gettext('Policy Group')); $retval = array_merge($retval, $this->getOptions('date_columns'), (array) $this->getOptions('report_static_custom_column')); ksort($retval); break; case 'dynamic_columns': $retval = array('-2100-income' => TTi18n::gettext('Income (14)'), '-2110-tax' => TTi18n::gettext('Income Tax (22)'), '-2120-employee_cpp' => TTi18n::gettext('Employee CPP (16)'), '-2125-ei_earnings' => TTi18n::gettext('EI Insurable Earnings (24)'), '-2126-cpp_earnings' => TTi18n::gettext('CPP Pensionable Earnings (26)'), '-2130-employee_ei' => TTi18n::gettext('Employee EI (18)'), '-2140-union_dues' => TTi18n::gettext('Union Dues (44)'), '-2150-employer_cpp' => TTi18n::gettext('Employer CPP'), '-2160-employer_ei' => TTi18n::gettext('Employer EI'), '-2170-rpp' => TTi18n::gettext('RPP Contributions (20)'), '-2180-charity' => TTi18n::gettext('Charity Donations (46)'), '-2190-pension_adjustment' => TTi18n::gettext('Pension Adjustment (52)'), '-2200-other_box_0' => TTi18n::gettext('Other Box 1'), '-2210-other_box_1' => TTi18n::gettext('Other Box 2'), '-2220-other_box_2' => TTi18n::gettext('Other Box 3'), '-2220-other_box_3' => TTi18n::gettext('Other Box 4'), '-2220-other_box_4' => TTi18n::gettext('Other Box 5'), '-2220-other_box_5' => TTi18n::gettext('Other Box 6')); break; case 'columns': $retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')); break; case 'column_format': //Define formatting function for each column. $columns = array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_custom_column')); if (is_array($columns)) { foreach ($columns as $column => $name) { $retval[$column] = 'currency'; } } break; case 'aggregates': $retval = array(); $dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')))); if (is_array($dynamic_columns)) { foreach ($dynamic_columns as $column) { switch ($column) { default: $retval[$column] = 'sum'; } } } break; case 'type': $retval = array('-1010-O' => TTi18n::getText('Original'), '-1020-A' => TTi18n::getText('Amended'), '-1030-C' => TTi18n::getText('Cancel')); break; case 'templates': $retval = array('-1020-by_employee' => TTi18n::gettext('by Employee'), '-1030-by_branch' => TTi18n::gettext('by Branch'), '-1040-by_department' => TTi18n::gettext('by Department'), '-1050-by_branch_by_department' => TTi18n::gettext('by Branch/Department')); break; case 'template_config': $template = strtolower(Misc::trimSortPrefix($params['template'])); if (isset($template) and $template != '') { switch ($template) { case 'default': //Proper settings to generate the form. //$retval['-1010-time_period']['time_period'] = 'last_quarter'; $retval['columns'] = $this->getOptions('columns'); $retval['group'][] = 'date_quarter_month'; $retval['sort'][] = array('date_quarter_month' => 'asc'); $retval['other']['grand_total'] = TRUE; break; default: Debug::Text(' Parsing template name: ' . $template, __FILE__, __LINE__, __METHOD__, 10); $retval['-1010-time_period']['time_period'] = 'last_year'; //Parse template name, and use the keywords separated by '+' to determine settings. $template_keywords = explode('+', $template); if (is_array($template_keywords)) { foreach ($template_keywords as $template_keyword) { Debug::Text(' Keyword: ' . $template_keyword, __FILE__, __LINE__, __METHOD__, 10); switch ($template_keyword) { //Columns //Filter //Group By //SubTotal //Sort case 'by_month': $retval['columns'][] = 'date_month'; $retval['group'][] = 'date_month'; $retval['sort'][] = array('date_month' => 'asc'); break; case 'by_employee': $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['group'][] = 'first_name'; $retval['group'][] = 'last_name'; $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_branch': $retval['columns'][] = 'default_branch'; $retval['group'][] = 'default_branch'; $retval['sort'][] = array('default_branch' => 'asc'); break; case 'by_department': $retval['columns'][] = 'default_department'; $retval['group'][] = 'default_department'; $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_branch_by_department': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['group'][] = 'default_branch'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'default_branch'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_month_by_employee': $retval['columns'][] = 'date_month'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['group'][] = 'date_month'; $retval['group'][] = 'first_name'; $retval['group'][] = 'last_name'; $retval['sub_total'][] = 'date_month'; $retval['sort'][] = array('date_month' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_month_by_branch': $retval['columns'][] = 'date_month'; $retval['columns'][] = 'default_branch'; $retval['group'][] = 'date_month'; $retval['group'][] = 'default_branch'; $retval['sub_total'][] = 'date_month'; $retval['sort'][] = array('date_month' => 'asc'); $retval['sort'][] = array('default_branch' => 'asc'); break; case 'by_month_by_department': $retval['columns'][] = 'date_month'; $retval['columns'][] = 'default_department'; $retval['group'][] = 'date_month'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'date_month'; $retval['sort'][] = array('date_month' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); break; case 'by_month_by_branch_by_department': $retval['columns'][] = 'date_month'; $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['group'][] = 'date_month'; $retval['group'][] = 'default_branch'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'date_month'; $retval['sub_total'][] = 'default_branch'; $retval['sort'][] = array('date_month' => 'asc'); $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); break; } } } $retval['columns'] = array_merge($retval['columns'], array_keys(Misc::trimSortPrefix($this->getOptions('dynamic_columns')))); break; } } //Set the template dropdown as well. $retval['-1000-template'] = $template; //Add sort prefixes so Flex can maintain order. if (isset($retval['filter'])) { $retval['-5000-filter'] = $retval['filter']; unset($retval['filter']); } if (isset($retval['columns'])) { $retval['-5010-columns'] = $retval['columns']; unset($retval['columns']); } if (isset($retval['group'])) { $retval['-5020-group'] = $retval['group']; unset($retval['group']); } if (isset($retval['sub_total'])) { $retval['-5030-sub_total'] = $retval['sub_total']; unset($retval['sub_total']); } if (isset($retval['sort'])) { $retval['-5040-sort'] = $retval['sort']; unset($retval['sort']); } Debug::Arr($retval, ' Template Config for: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; default: //Call report parent class options function for options valid for all reports. $retval = $this->__getOptions($name); break; } return $retval; }
function remoteSave() { $ttsc = new TimeTrexSoapClient(); if ((getTTProductEdition() == TT_PRODUCT_PROFESSIONAL or $ttsc->isUpdateNotifyEnabled() == TRUE) and PRODUCTION == TRUE and DEMO_MODE == FALSE) { $ttsc->sendCompanyData($this->getId()); $ttsc->sendCompanyVersionData($this->getId()); return TRUE; } return FALSE; }
protected function _getOptions($name, $params = NULL) { $retval = NULL; switch ($name) { case 'output_format': $retval = parent::getOptions('default_output_format'); break; case 'default_setup_fields': $retval = array('template', 'columns'); break; case 'setup_fields': $retval = array('-1000-template' => TTi18n::gettext('Template'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2035-user_tag' => TTi18n::gettext('Employee Tags'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2000-currency_id' => TTi18n::gettext('Currency'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By')); break; case 'date_columns': $retval = array_merge(TTDate::getReportDateOptions('hire', TTi18n::getText('Hire Date'), 17, FALSE), TTDate::getReportDateOptions('termination', TTi18n::getText('Termination Date'), 18, FALSE), TTDate::getReportDateOptions('birth', TTi18n::getText('Birth Date'), 19, FALSE), TTDate::getReportDateOptions('created', TTi18n::getText('Created Date'), 20, FALSE), TTDate::getReportDateOptions('updated', TTi18n::getText('Updated Date'), 21, FALSE)); break; case 'custom_columns': //Get custom fields for report data. $oflf = TTnew('OtherFieldListFactory'); //User and Punch fields conflict as they are merged together in a secondary process. $other_field_names = $oflf->getByCompanyIdAndTypeIdArray($this->getUserObject()->getCompany(), array(10), array(10 => '')); if (is_array($other_field_names)) { $retval = Misc::addSortPrefix($other_field_names, 9000); } break; case 'report_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); // Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns. // So just get custom columns with Selection and Formula. $custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'UserSummaryReport', 'custom_column'); if (is_array($custom_column_labels)) { $retval = Misc::addSortPrefix($custom_column_labels, 9500); } } break; case 'report_custom_filters': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'UserSummaryReport', 'custom_column'); } break; case 'report_dynamic_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'UserSummaryReport', 'custom_column'); if (is_array($report_dynamic_custom_column_labels)) { $retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700); } } break; case 'report_static_custom_column': if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) { $rcclf = TTnew('ReportCustomColumnListFactory'); $report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'UserSummaryReport', 'custom_column'); if (is_array($report_static_custom_column_labels)) { $retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700); } } break; case 'formula_columns': $retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns'))); break; case 'filter_columns': $retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))); break; case 'static_columns': $retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1010-user_name' => TTi18n::gettext('User Name'), '-1020-phone_id' => TTi18n::gettext('Quick Punch ID'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1032-employee_number_barcode' => TTi18n::gettext('Barcode'), '-1034-employee_number_qrcode' => TTi18n::gettext('QRcode'), '-1040-status' => TTi18n::gettext('Status'), '-1050-title' => TTi18n::gettext('Title'), '-1080-user_group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Branch'), '-1100-default_department' => TTi18n::gettext('Department'), '-1120-default_job' => TTi18n::gettext('Job'), '-1150-default_job_item' => TTi18n::gettext('Task'), '-1190-ethnic_group' => TTi18n::gettext('Ethnicity'), '-1200-permission_control' => TTi18n::gettext('Permission Group'), '-1210-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1220-policy_group' => TTi18n::gettext('Policy Group'), '-1310-sex' => TTi18n::gettext('Gender'), '-1320-address1' => TTi18n::gettext('Address 1'), '-1330-address2' => TTi18n::gettext('Address 2'), '-1340-city' => TTi18n::gettext('City'), '-1350-province' => TTi18n::gettext('Province/State'), '-1360-country' => TTi18n::gettext('Country'), '-1370-postal_code' => TTi18n::gettext('Postal Code'), '-1380-work_phone' => TTi18n::gettext('Work Phone'), '-1391-work_phone_ext' => TTi18n::gettext('Work Phone Ext'), '-1400-home_phone' => TTi18n::gettext('Home Phone'), '-1410-mobile_phone' => TTi18n::gettext('Mobile Phone'), '-1420-fax_phone' => TTi18n::gettext('Fax Phone'), '-1430-home_email' => TTi18n::gettext('Home Email'), '-1440-work_email' => TTi18n::gettext('Work Email'), '-1480-sin' => TTi18n::gettext('SIN/SSN'), '-1490-note' => TTi18n::gettext('Note'), '-1495-tag' => TTi18n::gettext('Tags'), '-1499-hierarchy_control_display' => TTi18n::gettext('Hierarchy'), '-1499-hierarchy_level_display' => TTi18n::gettext('Hierarchy Superiors'), '-1500-institution' => TTi18n::gettext('Bank Institution'), '-1510-transit' => TTi18n::gettext('Bank Transit/Routing'), '-1520-account' => TTi18n::gettext('Bank Account'), '-1619-currency' => TTi18n::gettext('Currency'), '-1620-current_currency' => TTi18n::gettext('Current Currency'), '-1625-type' => TTi18n::gettext('Wage Type'), '-1640-effective_date' => TTi18n::gettext('Wage Effective Date'), '-1650-language_display' => TTi18n::gettext('Language'), '-1660-date_format_display' => TTi18n::gettext('Date Format'), '-1665-time_format_display' => TTi18n::gettext('Time Format'), '-1670-time_unit_format_display' => TTi18n::gettext('Time Units'), '-1680-time_zone_display' => TTi18n::gettext('Time Zone'), '-1690-items_per_page' => TTi18n::gettext('Rows Per page'), '-1695-password_updated_date' => TTi18n::gettext('Password Updated Date'), '-1699-hire_date_age' => TTi18n::gettext('Length of Service'), '-1899-birth_date_age' => TTi18n::gettext('Age'), '-2205-created_by' => TTi18n::gettext('Created By'), '-2215-updated_by' => TTi18n::gettext('Updated By')); $retval = array_merge($retval, (array) $this->getOptions('date_columns'), (array) $this->getOptions('custom_columns'), (array) $this->getOptions('report_static_custom_column')); ksort($retval); break; case 'dynamic_columns': $retval = array('-1630-wage' => TTi18n::gettext('Wage'), '-1635-hourly_rate' => TTi18n::gettext('Hourly Rate'), '-1636-labor_burden_hourly_rate' => TTi18n::gettext('Hourly Rate w/Burden'), '-1637-labor_burden_percent' => TTi18n::gettext('Labor Burden Percent'), '-2000-total_user' => TTi18n::gettext('Total Employees')); break; case 'columns': $retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')); break; case 'column_format': //Define formatting function for each column. $columns = array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_custom_column')); if (is_array($columns)) { foreach ($columns as $column => $name) { if (strpos($column, 'wage') !== FALSE or strpos($column, 'hourly_rate') !== FALSE) { $retval[$column] = 'currency'; } elseif (strpos($column, 'labor_burden_percent') !== FALSE) { $retval[$column] = 'percent'; } } } $retval['password_updated_date'] = 'time_stamp'; $retval['effective_date'] = 'date_stamp'; break; case 'aggregates': $retval = array(); $dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')))); if (is_array($dynamic_columns)) { foreach ($dynamic_columns as $column) { switch ($column) { default: if (strpos($column, 'hourly_rate') !== FALSE or strpos($column, 'wage') !== FALSE or strpos($column, 'labor_burden_percent') !== FALSE) { $retval[$column] = 'avg'; } else { $retval[$column] = 'sum'; } } } } break; case 'templates': $retval = array('-1010-by_employee+contact' => TTi18n::gettext('Contact Information By Employee'), '-1020-by_employee+employment' => TTi18n::gettext('Employment Information By Employee'), '-1030-by_employee+address' => TTi18n::gettext('Addresses By Employee'), '-1040-by_employee+wage' => TTi18n::gettext('Wages By Employee'), '-1050-by_employee+bank' => TTi18n::gettext('Bank Information By Employee'), '-1060-by_employee+preference' => TTi18n::gettext('Preferences By Employee'), '-1070-by_employee+birth_date' => TTi18n::gettext('Birthdays By Employee'), '-1080-by_branch_by_employee+contact' => TTi18n::gettext('Contact Information By Branch/Employee'), '-1090-by_branch_by_employee+address' => TTi18n::gettext('Addresses By Branch/Employee'), '-1110-by_branch_by_employee+wage' => TTi18n::gettext('Wages by Branch/Employee'), '-1120-by_branch+total_user' => TTi18n::gettext('Total Employees by Branch'), '-1130-by_department_by_employee+contact' => TTi18n::gettext('Contact Information By Department/Employee'), '-1140-by_department_by_employee+address' => TTi18n::gettext('Addresses By Department/Employee'), '-1150-by_department_by_employee+wage' => TTi18n::gettext('Wages by Department/Employee'), '-1160-by_department+total_user' => TTi18n::gettext('Total Employees by Department'), '-1170-by_branch_by_department_by_employee+contact' => TTi18n::gettext('Contact Information By Branch/Department/Employee'), '-1180-by_branch_by_department_by_employee+address' => TTi18n::gettext('Addresses By Branch/Department/Employee'), '-1190-by_branch_by_department+wage' => TTi18n::gettext('Wages by Branch/Department/Employee'), '-1200-by_branch_by_department+total_user' => TTi18n::gettext('Total Employees by Branch/Department'), '-1205-by_hierarchy_by_branch_by_department_by_employee+contact' => TTi18n::gettext('Contact Information By Hierarchy/Branch/Department/Employee'), '-1210-by_type_by_employee+wage' => TTi18n::gettext('Wages By Type/Employee'), '-1220-by_type+total_user' => TTi18n::gettext('Total Employees by Wage Type'), '-1230-by_hired_month+total_user' => TTi18n::gettext('Total Employees Hired By Month'), '-1240-by_termination_month+total_user' => TTi18n::gettext('Total Employees Terminated By Month')); break; case 'template_config': $template = strtolower(Misc::trimSortPrefix($params['template'])); if (isset($template) and $template != '') { switch ($template) { //Contact case 'by_employee+contact': $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'work_phone'; $retval['columns'][] = 'work_phone_ext'; $retval['columns'][] = 'work_email'; $retval['columns'][] = 'mobile_phone'; $retval['columns'][] = 'home_phone'; $retval['columns'][] = 'home_email'; $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_branch_by_employee+contact': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'work_phone'; $retval['columns'][] = 'work_phone_ext'; $retval['columns'][] = 'work_email'; $retval['columns'][] = 'mobile_phone'; $retval['columns'][] = 'home_phone'; $retval['columns'][] = 'home_email'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_department_by_employee+contact': $retval['columns'][] = 'default_department'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'work_phone'; $retval['columns'][] = 'work_phone_ext'; $retval['columns'][] = 'work_email'; $retval['columns'][] = 'mobile_phone'; $retval['columns'][] = 'home_phone'; $retval['columns'][] = 'home_email'; $retval['sort'][] = array('default_department' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_branch_by_department_by_employee+contact': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'work_phone'; $retval['columns'][] = 'work_phone_ext'; $retval['columns'][] = 'work_email'; $retval['columns'][] = 'mobile_phone'; $retval['columns'][] = 'home_phone'; $retval['columns'][] = 'home_email'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_hierarchy_by_branch_by_department_by_employee+contact': $retval['columns'][] = 'hierarchy_control_display'; $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'work_phone'; $retval['columns'][] = 'work_phone_ext'; $retval['columns'][] = 'work_email'; $retval['columns'][] = 'mobile_phone'; $retval['columns'][] = 'home_phone'; $retval['columns'][] = 'home_email'; $retval['sort'][] = array('hierarchy_control_display' => 'asc'); $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; //Birth Dates //Birth Dates case 'by_employee+birth_date': $retval['columns'][] = 'birth-date_month'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'birth-date_stamp'; $retval['columns'][] = 'birth_date_age'; $retval['sub_total'][] = 'birth-date_month'; $retval['sort'][] = array('birth-date_month' => 'asc'); $retval['sort'][] = array('birth-date_dom' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; //Employment //Employment case 'by_employee+employment': $retval['columns'][] = 'status'; $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['columns'][] = 'title'; $retval['columns'][] = 'user_group'; $retval['columns'][] = 'ethnic_group'; $retval['columns'][] = 'sex'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'birth_date_age'; $retval['columns'][] = 'hire-date_stamp'; $retval['columns'][] = 'termination-date_stamp'; $retval['columns'][] = 'hire_date_age'; $retval['sort'][] = array('status' => 'asc'); $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); $retval['sort'][] = array('title' => 'asc'); $retval['sort'][] = array('user_group' => 'asc'); $retval['sort'][] = array('ethnic_group' => 'asc'); $retval['sort'][] = array('sex' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); //$retval['sort'][] = array('hire-date_month' => 'asc'); break; case 'by_hired_month+total_user': $retval['columns'][] = 'hire-date_year'; $retval['columns'][] = 'hire-date_month_year'; $retval['columns'][] = 'total_user'; $retval['group'][] = 'hire-date_year'; $retval['group'][] = 'hire-date_month_year'; $retval['sub_total'][] = 'hire-date_year'; $retval['sort'][] = array('hire-date_year' => 'desc'); $retval['sort'][] = array('hire-date_month_year' => 'desc'); $retval['sort'][] = array('total_user' => 'desc'); break; case 'by_termination_month+total_user': $retval['columns'][] = 'termination-date_year'; $retval['columns'][] = 'termination-date_month_year'; $retval['columns'][] = 'total_user'; $retval['group'][] = 'termination-date_year'; $retval['group'][] = 'termination-date_month_year'; $retval['sub_total'][] = 'termination-date_year'; $retval['sort'][] = array('termination-date_year' => 'desc'); $retval['sort'][] = array('termination-date_month_year' => 'desc'); $retval['sort'][] = array('total_user' => 'desc'); break; //Address //Address case 'by_employee+address': $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'address1'; $retval['columns'][] = 'address2'; $retval['columns'][] = 'city'; $retval['columns'][] = 'country'; $retval['columns'][] = 'province'; $retval['columns'][] = 'postal_code'; $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_branch_by_employee+address': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'address1'; $retval['columns'][] = 'address2'; $retval['columns'][] = 'city'; $retval['columns'][] = 'country'; $retval['columns'][] = 'province'; $retval['columns'][] = 'postal_code'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_department_by_employee+address': $retval['columns'][] = 'default_department'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'address1'; $retval['columns'][] = 'address2'; $retval['columns'][] = 'city'; $retval['columns'][] = 'country'; $retval['columns'][] = 'province'; $retval['columns'][] = 'postal_code'; $retval['sort'][] = array('default_department' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_branch_by_department_by_employee+address': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'address1'; $retval['columns'][] = 'address2'; $retval['columns'][] = 'city'; $retval['columns'][] = 'country'; $retval['columns'][] = 'province'; $retval['columns'][] = 'postal_code'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; //Wage //Wage case 'by_employee+wage': $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'type'; $retval['columns'][] = 'wage'; $retval['columns'][] = 'hourly_rate'; $retval['columns'][] = 'effective_date'; $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('wage' => 'desc'); break; case 'by_branch_by_employee+wage': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'type'; $retval['columns'][] = 'wage'; $retval['columns'][] = 'hourly_rate'; $retval['columns'][] = 'effective_date'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('wage' => 'desc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_department_by_employee+wage': $retval['columns'][] = 'default_department'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'type'; $retval['columns'][] = 'wage'; $retval['columns'][] = 'hourly_rate'; $retval['columns'][] = 'effective_date'; $retval['sort'][] = array('default_department' => 'asc'); $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('wage' => 'desc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_branch_by_department_by_employee+wage': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'type'; $retval['columns'][] = 'wage'; $retval['columns'][] = 'hourly_rate'; $retval['columns'][] = 'effective_date'; $retval['sort'][] = array('default_branch' => 'asc'); $retval['sort'][] = array('default_department' => 'asc'); $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('wage' => 'desc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; case 'by_type_by_employee+wage': $retval['columns'][] = 'type'; $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'wage'; $retval['columns'][] = 'hourly_rate'; $retval['columns'][] = 'effective_date'; $retval['sub_total'][] = 'type'; $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('wage' => 'desc'); $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; //Bank Account //Bank Account case 'by_employee+bank': $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'transit'; $retval['columns'][] = 'account'; $retval['columns'][] = 'institution'; $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; //Preferences //Preferences case 'by_employee+preference': $retval['columns'][] = 'first_name'; $retval['columns'][] = 'last_name'; $retval['columns'][] = 'date_format_display'; $retval['columns'][] = 'time_format_display'; $retval['columns'][] = 'time_unit_format_display'; $retval['columns'][] = 'time_zone_display'; $retval['columns'][] = 'language_display'; $retval['columns'][] = 'items_per_page'; $retval['sort'][] = array('last_name' => 'asc'); $retval['sort'][] = array('first_name' => 'asc'); break; //Other //Other case 'by_branch+total_user': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'total_user'; $retval['group'][] = 'default_branch'; $retval['sort'][] = array('total_user' => 'desc'); break; case 'by_department+total_user': $retval['columns'][] = 'default_department'; $retval['columns'][] = 'total_user'; $retval['group'][] = 'default_department'; $retval['sort'][] = array('total_user' => 'desc'); break; case 'by_branch_by_department+total_user': $retval['columns'][] = 'default_branch'; $retval['columns'][] = 'default_department'; $retval['columns'][] = 'total_user'; $retval['group'][] = 'default_branch'; $retval['group'][] = 'default_department'; $retval['sub_total'][] = 'default_branch'; $retval['sort'][] = array('default_branch' => 'asc'); //$retval['sort'][] = array('' => 'asc'); $retval['sort'][] = array('total_user' => 'desc'); break; case 'by_type+total_user': $retval['columns'][] = 'type'; $retval['columns'][] = 'total_user'; $retval['group'][] = 'type'; $retval['sub_total'][] = 'type'; $retval['sort'][] = array('type' => 'asc'); $retval['sort'][] = array('total_user' => 'desc'); break; default: Debug::Text(' Parsing template name: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; } } //Set the template dropdown as well. $retval['-1000-template'] = $template; //Add sort prefixes so Flex can maintain order. if (isset($retval['filter'])) { $retval['-5000-filter'] = $retval['filter']; unset($retval['filter']); } if (isset($retval['columns'])) { $retval['-5010-columns'] = $retval['columns']; unset($retval['columns']); } if (isset($retval['group'])) { $retval['-5020-group'] = $retval['group']; unset($retval['group']); } if (isset($retval['sub_total'])) { $retval['-5030-sub_total'] = $retval['sub_total']; unset($retval['sub_total']); } if (isset($retval['sort'])) { $retval['-5040-sort'] = $retval['sort']; unset($retval['sort']); } Debug::Arr($retval, ' Template Config for: ' . $template, __FILE__, __LINE__, __METHOD__, 10); break; default: //Call report parent class options function for options valid for all reports. $retval = $this->__getOptions($name); break; } return $retval; }
function getSearchByCompanyIdAndArrayCriteria($company_id, $filter_data, $limit = NULL, $page = NULL, $where = NULL, $order = NULL) { if ($company_id == '') { return FALSE; } if (!is_array($order)) { //Use Filter Data ordering if its set. if (isset($filter_data['sort_column']) and $filter_data['sort_order']) { $order = array(Misc::trimSortPrefix($filter_data['sort_column']) => $filter_data['sort_order']); } } //Debug::Arr($order,'aOrder Data:', __FILE__, __LINE__, __METHOD__,10); $additional_order_fields = array('name', 'description', 'last_name', 'start_date', 'user_id'); if ($order == NULL) { $order = array('c.start_date' => 'asc', 'cb.user_id' => 'desc', 'a.week' => 'asc'); $strict = FALSE; } else { $strict = TRUE; } if (isset($filter_data['exclude_user_ids'])) { $filter_data['exclude_id'] = $filter_data['exclude_user_ids']; } //This is used by Flex Schedule Summary report. if (isset($filter_data['include_user_id'])) { $filter_data['id'] = $filter_data['include_user_id']; } if (isset($filter_data['include_user_ids'])) { $filter_data['id'] = $filter_data['include_user_ids']; } /* if ( isset($filter_data['user_status_ids']) ) { $filter_data['status_id'] = $filter_data['user_status_ids']; } */ if (isset($filter_data['user_title_ids'])) { $filter_data['title_id'] = $filter_data['user_title_ids']; } if (isset($filter_data['group_ids'])) { $filter_data['group_id'] = $filter_data['group_ids']; } if (isset($filter_data['default_branch_ids'])) { $filter_data['default_branch_id'] = $filter_data['default_branch_ids']; } if (isset($filter_data['default_department_ids'])) { $filter_data['default_department_id'] = $filter_data['default_department_ids']; } if (isset($filter_data['branch_ids'])) { $filter_data['schedule_branch_id'] = $filter_data['branch_ids']; } if (isset($filter_data['department_ids'])) { $filter_data['schedule_department_id'] = $filter_data['department_ids']; } if (isset($filter_data['schedule_branch_ids'])) { $filter_data['schedule_branch_id'] = $filter_data['schedule_branch_ids']; } if (isset($filter_data['schedule_department_ids'])) { $filter_data['schedule_department_id'] = $filter_data['schedule_department_ids']; } if (isset($filter_data['exclude_job_ids'])) { $filter_data['exclude_id'] = $filter_data['exclude_job_ids']; } if (isset($filter_data['include_job_ids'])) { $filter_data['include_job_id'] = $filter_data['include_job_ids']; } if (isset($filter_data['job_group_ids'])) { $filter_data['job_group_id'] = $filter_data['job_group_ids']; } if (isset($filter_data['job_item_ids'])) { $filter_data['job_item_id'] = $filter_data['job_item_ids']; } //Debug::Arr($order,'bOrder Data:', __FILE__, __LINE__, __METHOD__,10); //Debug::Arr($filter_data,'Filter Data:', __FILE__, __LINE__, __METHOD__,10); $uf = new UserFactory(); $uwf = new UserWageFactory(); $rscf = new RecurringScheduleControlFactory(); $rsuf = new RecurringScheduleUserFactory(); $rstcf = new RecurringScheduleTemplateControlFactory(); $bf = new BranchFactory(); $df = new DepartmentFactory(); $ugf = new UserGroupFactory(); $utf = new UserTitleFactory(); $apf = new AbsencePolicyFactory(); $ppsuf = new PayPeriodScheduleUserFactory(); $ppsf = new PayPeriodScheduleFactory(); if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $jf = new JobFactory(); $jif = new JobItemFactory(); } $ph = array('filter_end_date' => $this->db->BindDate($filter_data['end_date']), 'company_id' => $company_id); $query = ' select a.*, apf.type_id as absence_policy_type_id, apf.name as absence_policy, cb.user_id as user_id, CASE WHEN a.branch_id = -1 THEN d.default_branch_id ELSE a.branch_id END as schedule_branch_id, CASE WHEN a.branch_id = -1 THEN bf.name ELSE bfb.name END as schedule_branch, CASE WHEN a.department_id = -1 THEN d.default_department_id ELSE a.department_id END as schedule_department_id, CASE WHEN a.department_id = -1 THEN df.name ELSE dfb.name END as schedule_department, c.start_date as recurring_schedule_control_start_date, c.end_date as recurring_schedule_control_end_date, c.start_week as recurring_schedule_control_start_week, zz.max_week as max_week, ( (((a.week-1)+zz.max_week-(c.start_week-1))%zz.max_week) + 1) as remapped_week, d.first_name as first_name, d.last_name as last_name, d.default_branch_id as default_branch_id, bf.name as default_branch, d.default_department_id as default_department_id, df.name as default_department, d.title_id as title_id, utf.name as title, d.group_id as group_id, ugf.name as "group", d.created_by as user_created_by, d.hire_date as hire_date, d.termination_date as termination_date, uw.id as user_wage_id, uw.hourly_rate as user_wage_hourly_rate, uw.effective_date as user_wage_effective_date, ppsf.shift_assigned_day_id as shift_assigned_day_id, c.created_by as recurring_schedule_control_created_by '; if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $query .= ', x.name as job, x.status_id as job_status_id, x.manual_id as job_manual_id, x.branch_id as job_branch_id, x.department_id as job_department_id, x.group_id as job_group_id, y.name as job_item, y.manual_id as job_item_manual_id, y.group_id as job_item_group_id'; } //Since when dealing with recurring schedules, we don't have a row for each specific date, so when determining wages //we can only use the last wage entered that is earlier than the filter end date. //Since in theory committed schedules will occur before todays date anyways, the accuracy won't be off too much unless //the end date they specify is really far in the future, and post dated wage entry is also made. $query .= ' from ' . $this->getTable() . ' as a LEFT JOIN ( select z.recurring_schedule_template_control_id, max(z.week) as max_week from recurring_schedule_template as z where deleted = 0 group by z.recurring_schedule_template_control_id ) as zz ON a.recurring_schedule_template_control_id = zz.recurring_schedule_template_control_id LEFT JOIN ' . $rstcf->getTable() . ' as b ON a.recurring_schedule_template_control_id = b.id LEFT JOIN ' . $rscf->getTable() . ' as c ON a.recurring_schedule_template_control_id = c.recurring_schedule_template_control_id LEFT JOIN ' . $rsuf->getTable() . ' as cb ON c.id = cb.recurring_schedule_control_id LEFT JOIN ' . $uf->getTable() . ' as d ON cb.user_id = d.id LEFT JOIN ' . $ppsuf->getTable() . ' as ppsuf ON d.id = ppsuf.user_id LEFT JOIN ' . $ppsf->getTable() . ' as ppsf ON ( ppsuf.pay_period_schedule_id = ppsf.id AND ppsf.deleted = 0 ) LEFT JOIN ' . $bf->getTable() . ' as bf ON ( d.default_branch_id = bf.id AND bf.deleted = 0) LEFT JOIN ' . $bf->getTable() . ' as bfb ON ( a.branch_id = bfb.id AND bfb.deleted = 0) LEFT JOIN ' . $df->getTable() . ' as df ON ( d.default_department_id = df.id AND df.deleted = 0) LEFT JOIN ' . $df->getTable() . ' as dfb ON ( a.department_id = dfb.id AND dfb.deleted = 0) LEFT JOIN ' . $ugf->getTable() . ' as ugf ON ( d.group_id = ugf.id AND ugf.deleted = 0 ) LEFT JOIN ' . $utf->getTable() . ' as utf ON ( d.title_id = utf.id AND utf.deleted = 0 ) LEFT JOIN ' . $apf->getTable() . ' as apf ON ( a.absence_policy_id = apf.id AND apf.deleted = 0 ) LEFT JOIN ' . $uwf->getTable() . ' as uw ON uw.id = (select uwb.id from ' . $uwf->getTable() . ' as uwb where uwb.user_id = cb.user_id and uwb.effective_date <= ? and uwb.deleted = 0 order by uwb.effective_date desc limit 1) '; if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) { $query .= ' LEFT JOIN ' . $jf->getTable() . ' as x ON a.job_id = x.id'; $query .= ' LEFT JOIN ' . $jif->getTable() . ' as y ON a.job_item_id = y.id'; } $query .= ' where b.company_id = ? '; if (isset($filter_data['permission_children_ids']) and isset($filter_data['permission_children_ids'][0]) and !in_array(-1, (array) $filter_data['permission_children_ids'])) { $query .= ' AND d.id in (' . $this->getListSQL($filter_data['permission_children_ids'], $ph) . ') '; } if (isset($filter_data['id']) and isset($filter_data['id'][0]) and !in_array(-1, (array) $filter_data['id'])) { $query .= ' AND d.id in (' . $this->getListSQL($filter_data['id'], $ph) . ') '; } if (isset($filter_data['exclude_id']) and isset($filter_data['exclude_id'][0]) and !in_array(-1, (array) $filter_data['exclude_id'])) { $query .= ' AND d.id not in (' . $this->getListSQL($filter_data['exclude_id'], $ph) . ') '; } if (isset($filter_data['user_status_id']) and isset($filter_data['user_status_id'][0]) and !in_array(-1, (array) $filter_data['user_status_id'])) { $query .= ' AND d.status_id in (' . $this->getListSQL($filter_data['user_status_id'], $ph) . ') '; } if (isset($filter_data['status_id']) and isset($filter_data['status_id'][0]) and !in_array(-1, (array) $filter_data['status_id'])) { $query .= ' AND a.status_id in (' . $this->getListSQL($filter_data['status_id'], $ph) . ') '; } if (isset($filter_data['group_id']) and isset($filter_data['group_id'][0]) and !in_array(-1, (array) $filter_data['group_id'])) { if (isset($filter_data['include_subgroups']) and (bool) $filter_data['include_subgroups'] == TRUE) { $uglf = new UserGroupListFactory(); $filter_data['group_id'] = $uglf->getByCompanyIdAndGroupIdAndSubGroupsArray($company_id, $filter_data['group_id'], TRUE); } $query .= ' AND d.group_id in (' . $this->getListSQL($filter_data['group_id'], $ph) . ') '; } if (isset($filter_data['default_branch_id']) and isset($filter_data['default_branch_id'][0]) and !in_array(-1, (array) $filter_data['default_branch_id'])) { $query .= ' AND d.default_branch_id in (' . $this->getListSQL($filter_data['default_branch_id'], $ph) . ') '; } if (isset($filter_data['default_department_id']) and isset($filter_data['default_department_id'][0]) and !in_array(-1, (array) $filter_data['default_department_id'])) { $query .= ' AND d.default_department_id in (' . $this->getListSQL($filter_data['default_department_id'], $ph) . ') '; } if (isset($filter_data['schedule_branch_id']) and isset($filter_data['schedule_branch_id'][0]) and !in_array(-1, (array) $filter_data['schedule_branch_id'])) { $query .= ' AND ( a.branch_id in (' . $this->getListSQL($filter_data['schedule_branch_id'], $ph) . ') OR ( a.branch_id = -1 AND d.default_branch_id in (' . $this->getListSQL($filter_data['schedule_branch_id'], $ph) . ') ) )'; } if (isset($filter_data['schedule_department_id']) and isset($filter_data['schedule_department_id'][0]) and !in_array(-1, (array) $filter_data['schedule_department_id'])) { $query .= ' AND ( a.department_id in (' . $this->getListSQL($filter_data['schedule_department_id'], $ph) . ') OR ( a.department_id = -1 AND d.default_department_id in (' . $this->getListSQL($filter_data['schedule_department_id'], $ph) . ') ) )'; } if (isset($filter_data['title_id']) and isset($filter_data['title_id'][0]) and !in_array(-1, (array) $filter_data['title_id'])) { $query .= ' AND d.title_id in (' . $this->getListSQL($filter_data['title_id'], $ph) . ') '; } //Use the job_id in the schedule table so we can filter by '0' or No Job if (isset($filter_data['job_id']) and isset($filter_data['job_id'][0]) and !in_array(-1, (array) $filter_data['job_id'])) { $query .= ' AND a.job_id in (' . $this->getListSQL($filter_data['job_id'], $ph) . ') '; } if (isset($filter_data['job_group_id']) and isset($filter_data['job_group_id'][0]) and !in_array(-1, (array) $filter_data['job_group_id'])) { if (isset($filter_data['include_job_subgroups']) and (bool) $filter_data['include_job_subgroups'] == TRUE) { $uglf = new UserGroupListFactory(); $filter_data['job_group_id'] = $uglf->getByCompanyIdAndGroupIdAndjob_subgroupsArray($company_id, $filter_data['job_group_id'], TRUE); } $query .= ' AND x.group_id in (' . $this->getListSQL($filter_data['job_group_id'], $ph) . ') '; } if (isset($filter_data['job_item_id']) and isset($filter_data['job_item_id'][0]) and !in_array(-1, (array) $filter_data['job_item_id'])) { $query .= ' AND a.job_item_id in (' . $this->getListSQL($filter_data['job_item_id'], $ph) . ') '; } if (isset($filter_data['start_date']) and trim($filter_data['start_date']) != '' and isset($filter_data['end_date']) and trim($filter_data['end_date']) != '') { $start_date_stamp = $this->db->BindDate($filter_data['start_date']); $end_date_stamp = $this->db->BindDate($filter_data['end_date']); $ph[] = $start_date_stamp; $ph[] = $end_date_stamp; $ph[] = $start_date_stamp; $ph[] = $start_date_stamp; $ph[] = $end_date_stamp; $ph[] = $start_date_stamp; $ph[] = $end_date_stamp; $ph[] = $start_date_stamp; $ph[] = $end_date_stamp; $ph[] = $start_date_stamp; $ph[] = $end_date_stamp; $ph[] = $start_date_stamp; $ph[] = $end_date_stamp; $ph[] = $filter_data['end_date']; $ph[] = $filter_data['start_date']; $query .= ' AND ( (c.start_date >= ? AND c.start_date <= ? AND c.end_date IS NULL ) OR (c.start_date <= ? AND c.end_date IS NULL ) OR (c.start_date <= ? AND c.end_date >= ? ) OR (c.start_date >= ? AND c.end_date <= ? ) OR (c.start_date >= ? AND c.start_date <= ? ) OR (c.end_date >= ? AND c.end_date <= ? ) OR (c.start_date <= ? AND c.end_date >= ? ) ) AND ( ( d.hire_date is NULL OR d.hire_date <= ? ) AND ( d.termination_date is NULL OR d.termination_date >= ? ) ) '; } $query .= ' AND ( a.deleted = 0 AND b.deleted = 0 AND c.deleted = 0 AND (d.deleted is NULL OR d.deleted = 0 ) ) '; $query .= $this->getWhereSQL($where); $query .= $this->getSortSQL($order, $strict, $additional_order_fields); //Debug::Arr($ph,' Query: '. $query, __FILE__, __LINE__, __METHOD__,10); $this->ExecuteSQL($query, $ph, $limit, $page); return $this; }