Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 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;
 }
 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;
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 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;
 }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
 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;
 }
Exemplo n.º 9
0
 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;
 }
 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;
 }
 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-punch_branch_id' => TTi18n::gettext('Punch Branch'), '-2090-punch_department_id' => TTi18n::gettext('Punch Department'), '-2000-currency_id' => TTi18n::gettext('Currency'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-4010-pay_period_time_sheet_verify_status_id' => TTi18n::gettext('TimeSheet Verification'), '-4020-include_no_data_rows' => TTi18n::gettext('Include Blank Records'), '-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 '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, 'TimesheetSummaryReport', '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, 'TimesheetSummaryReport', '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'), 'TimesheetSummaryReport', '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'), 'TimesheetSummaryReport', '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('Employee Group'), '-1090-default_branch' => TTi18n::gettext('Default Branch'), '-1100-default_department' => TTi18n::gettext('Default Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1111-current_currency' => TTi18n::gettext('Current Currency'), '-1400-permission_control' => TTi18n::gettext('Permission Group'), '-1410-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1420-policy_group' => TTi18n::gettext('Policy Group'), '-1430-branch_name' => TTi18n::gettext('Branch'), '-1440-department_name' => TTi18n::gettext('Department'), '-1490-note' => TTi18n::gettext('Note'), '-1495-tag' => TTi18n::gettext('Tags'), '-1510-verified_time_sheet' => TTi18n::gettext('Verified TimeSheet'), '-1515-verified_time_sheet_date' => TTi18n::gettext('Verified TimeSheet Date'));
             $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('-2070-schedule_working' => TTi18n::gettext('Scheduled Time'), '-2072-schedule_working_diff' => TTi18n::gettext('Scheduled Time Diff.'), '-2080-schedule_absence' => TTi18n::gettext('Scheduled Absence'), '-2085-worked_days' => TTi18n::gettext('Worked Days'), '-2090-worked_time' => TTi18n::gettext('Worked Time'), '-2290-regular_time' => TTi18n::gettext('Regular Time'), '-2500-gross_wage' => TTi18n::gettext('Gross Wage'), '-2501-gross_wage_with_burden' => TTi18n::gettext('Gross Wage w/Burden'), '-2530-regular_time_wage' => TTi18n::gettext('Regular Time - Wage'), '-2531-regular_time_wage_with_burden' => TTi18n::gettext('Regular Time - Wage w/Burden'), '-2690-regular_time_hourly_rate' => TTi18n::gettext('Regular Time - Hourly Rate'), '-2690-regular_time_hourly_rate_with_burden' => TTi18n::gettext('Regular Time - Hourly Rate w/Burden'));
             $retval = array_merge($retval, $this->getOptions('overtime_columns'), $this->getOptions('premium_columns'), $this->getOptions('absence_columns'));
             ksort($retval);
             break;
         case 'overtime_columns':
             //Get all Overtime policies.
             $retval = array();
             $otplf = TTnew('OverTimePolicyListFactory');
             $otplf->getByCompanyId($this->getUserObject()->getCompany());
             if ($otplf->getRecordCount() > 0) {
                 foreach ($otplf as $otp_obj) {
                     $retval['-2291-over_time_policy-' . $otp_obj->getId()] = $otp_obj->getName();
                     $retval['-2591-over_time_policy-' . $otp_obj->getId() . '_wage'] = $otp_obj->getName() . ' ' . TTi18n::getText('- Wage');
                     $retval['-2591-over_time_policy-' . $otp_obj->getId() . '_wage_with_burden'] = $otp_obj->getName() . ' ' . TTi18n::getText('- Wage w/Burden');
                     $retval['-2691-over_time_policy-' . $otp_obj->getId() . '_hourly_rate'] = $otp_obj->getName() . ' ' . TTi18n::getText('- Hourly Rate');
                     $retval['-2691-over_time_policy-' . $otp_obj->getId() . '_hourly_rate_with_burden'] = $otp_obj->getName() . ' ' . TTi18n::getText('- Hourly Rate w/Burden');
                 }
             }
             break;
         case 'premium_columns':
             $retval = array();
             //Get all Premium policies.
             $pplf = TTnew('PremiumPolicyListFactory');
             $pplf->getByCompanyId($this->getUserObject()->getCompany());
             if ($pplf->getRecordCount() > 0) {
                 foreach ($pplf as $pp_obj) {
                     $retval['-2291-premium_policy-' . $pp_obj->getId()] = $pp_obj->getName();
                     $retval['-2591-premium_policy-' . $pp_obj->getId() . '_wage'] = $pp_obj->getName() . ' ' . TTi18n::getText('- Wage');
                     $retval['-2591-premium_policy-' . $pp_obj->getId() . '_wage_with_burden'] = $pp_obj->getName() . ' ' . TTi18n::getText('- Wage w/Burden');
                     $retval['-2691-premium_policy-' . $pp_obj->getId() . '_hourly_rate'] = $pp_obj->getName() . ' ' . TTi18n::getText('- Hourly Rate');
                     $retval['-2691-premium_policy-' . $pp_obj->getId() . '_hourly_rate_with_burden'] = $pp_obj->getName() . ' ' . TTi18n::getText('- Hourly Rate w/Burden');
                 }
             }
             break;
         case 'absence_columns':
             $retval = array();
             //Get all Absence Policies.
             $aplf = TTnew('AbsencePolicyListFactory');
             $aplf->getByCompanyId($this->getUserObject()->getCompany());
             if ($aplf->getRecordCount() > 0) {
                 foreach ($aplf as $ap_obj) {
                     $retval['-2291-absence_policy-' . $ap_obj->getId()] = $ap_obj->getName();
                     if ($ap_obj->getType() == 10) {
                         $retval['-2591-absence_policy-' . $ap_obj->getId() . '_wage'] = $ap_obj->getName() . ' ' . TTi18n::getText('- Wage');
                         $retval['-2591-absence_policy-' . $ap_obj->getId() . '_wage_with_burden'] = $ap_obj->getName() . ' ' . TTi18n::getText('- Wage w/Burden');
                         $retval['-2691-absence_policy-' . $ap_obj->getId() . '_hourly_rate'] = $ap_obj->getName() . ' ' . TTi18n::getText('- Hourly Rate');
                         $retval['-2691-absence_policy-' . $ap_obj->getId() . '_hourly_rate_with_burden'] = $ap_obj->getName() . ' ' . TTi18n::getText('- Hourly Rate w/Burden');
                     }
                 }
             }
             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, '_time') or strpos($column, 'schedule_') 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) {
                                 $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+regular' => TTi18n::gettext('Regular Time by Employee'), '-1020-by_employee+overtime' => TTi18n::gettext('Overtime by Employee'), '-1030-by_employee+premium' => TTi18n::gettext('Premium Time by Employee'), '-1040-by_employee+absence' => TTi18n::gettext('Absence Time by Employee'), '-1050-by_employee+regular+overtime+premium+absence' => TTi18n::gettext('All Time by Employee'), '-1060-by_employee+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Employee'), '-1070-by_employee+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Employee'), '-1080-by_employee+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Employee'), '-1090-by_employee+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Employee'), '-1100-by_employee+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Employee'), '-1110-by_date_by_full_name+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Date/Employee'), '-1120-by_date_by_full_name+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Date/Employee'), '-1130-by_date_by_full_name+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Date/Employee'), '-1140-by_date_by_full_name+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Date/Employee'), '-1150-by_date_by_full_name+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Date/Employee'), '-1160-by_full_name_by_date+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Employee/Date'), '-1170-by_full_name_by_date+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Employee/Date'), '-1180-by_full_name_by_date+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Employee/Date'), '-1190-by_full_name_by_date+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Employee/Date'), '-1200-by_full_name_by_date+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Employee/Date'), '-1210-by_branch+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Branch'), '-1220-by_branch+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Branch'), '-1230-by_branch+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Branch'), '-1240-by_branch+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Branch'), '-1250-by_branch+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Branch'), '-1260-by_department+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Department'), '-1270-by_department+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Department'), '-1280-by_department+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Department'), '-1290-by_department+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Department'), '-1300-by_department+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Department'), '-1310-by_branch_by_department+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Branch/Department'), '-1320-by_branch_by_department+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Branch/Department'), '-1330-by_branch_by_department+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Branch/Department'), '-1340-by_branch_by_department+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Branch/Department'), '-1350-by_branch_by_department+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Branch/Department'), '-1360-by_pay_period+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Pay Period'), '-1370-by_pay_period+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Pay Period'), '-1380-by_pay_period+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Pay Period'), '-1390-by_pay_period+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Pay Period'), '-1400-by_pay_period+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Pay Period'), '-1410-by_pay_period_by_employee+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Pay Period/Employee'), '-1420-by_pay_period_by_employee+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Pay Period/Employee'), '-1430-by_pay_period_by_employee+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Pay Period/Employee'), '-1440-by_pay_period_by_employee+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Pay Period/Employee'), '-1450-by_pay_period_by_employee+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Pay Period/Employee'), '-1460-by_pay_period_by_branch+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Pay Period/Branch'), '-1470-by_pay_period_by_branch+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Pay Period/Branch'), '-1480-by_pay_period_by_branch+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Pay Period/Branch'), '-1490-by_pay_period_by_branch+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Pay Period/Branch'), '-1500-by_pay_period_by_branch+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Pay Period/Branch'), '-1510-by_pay_period_by_department+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Pay Period/Department'), '-1520-by_pay_period_by_department+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Pay Period/Department'), '-1530-by_pay_period_by_department+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Pay Period/Department'), '-1540-by_pay_period_by_department+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Pay Period/Department'), '-1550-by_pay_period_by_department+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Pay Period/Department'), '-1560-by_pay_period_by_branch_by_department+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Pay Period/Branch/Department'), '-1570-by_pay_period_by_branch_by_department+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Pay Period/Branch/Department'), '-1580-by_pay_period_by_branch_by_department+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Pay Period/Branch/Department'), '-1590-by_pay_period_by_branch_by_department+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Pay Period/Branch/Department'), '-1600-by_pay_period_by_branch_by_department+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Pay Period/Branch/Department'), '-1610-by_employee_by_pay_period+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Employee/Pay Period'), '-1620-by_employee_by_pay_period+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Employee/Pay Period'), '-1630-by_employee_by_pay_period+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Employee/Pay Period'), '-1640-by_employee_by_pay_period+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Employee/Pay Period'), '-1650-by_employee_by_pay_period+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Employee/Pay Period'), '-1660-by_branch_by_pay_period+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Branch/Pay Period'), '-1670-by_branch_by_pay_period+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Branch/Pay Period'), '-1680-by_branch_by_pay_period+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Branch/Pay Period'), '-1690-by_branch_by_pay_period+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Branch/Pay Period'), '-1700-by_branch_by_pay_period+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Pay Branch/Pay Period'), '-1810-by_department_by_pay_period+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Department/Pay Period'), '-1820-by_department_by_pay_period+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Pay Department/Pay Period'), '-1830-by_department_by_pay_period+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Pay Department/Pay Period'), '-1840-by_department_by_pay_period+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Pay Department/Pay Period'), '-1850-by_department_by_pay_period+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Pay Department/Pay Period'), '-1860-by_branch_by_department_by_pay_period+regular+regular_wage' => TTi18n::gettext('Regular Time+Wage by Branch/Department/Pay Period'), '-1870-by_branch_by_department_by_pay_period+overtime+overtime_wage' => TTi18n::gettext('Overtime+Wage by Pay Branch/Department/Pay Period'), '-1880-by_branch_by_department_by_pay_period+premium+premium_wage' => TTi18n::gettext('Premium Time+Wage by Pay Branch/Department/Pay Period'), '-1890-by_branch_by_department_by_pay_period+absence+absence_wage' => TTi18n::gettext('Absence Time+Wage by Pay Branch/Department/Pay Period'), '-1900-by_branch_by_department_by_pay_period+regular+regular_wage+overtime+overtime_wage+premium+premium_wage+absence+absence_wage' => TTi18n::gettext('All Time+Wage by Branch/Department/Pay Period'), '-3000-by_pay_period_by_employee+verified_time_sheet' => TTi18n::gettext('Timesheet Verification by Pay Period/Employee'), '-3010-by_verified_time_sheet_by_pay_period_by_employee+verified_time_sheet' => TTi18n::gettext('Timesheet Verification by Verification/Pay Period/Employee'));
             break;
         case 'template_config':
             $template = strtolower(Misc::trimSortPrefix($params['template']));
             if (isset($template) and $template != '') {
                 switch ($template) {
                     case 'by_pay_period_by_employee+verified_time_sheet':
                         $retval['-1010-time_period']['time_period'] = 'last_pay_period';
                         $retval['columns'][] = 'pay_period';
                         $retval['columns'][] = 'first_name';
                         $retval['columns'][] = 'last_name';
                         $retval['columns'][] = 'verified_time_sheet';
                         $retval['columns'][] = 'verified_time_sheet_date';
                         $retval['group'][] = 'pay_period';
                         $retval['group'][] = 'first_name';
                         $retval['group'][] = 'last_name';
                         $retval['sort'][] = array('pay_period' => 'asc');
                         $retval['sort'][] = array('verified_time_sheet' => 'desc');
                         $retval['sort'][] = array('verified_time_sheet_date' => 'asc');
                         break;
                     case 'by_verified_time_sheet_by_pay_period_by_employee+verified_time_sheet':
                         $retval['-1010-time_period']['time_period'] = 'last_pay_period';
                         $retval['columns'][] = 'verified_time_sheet';
                         $retval['columns'][] = 'pay_period';
                         $retval['columns'][] = 'first_name';
                         $retval['columns'][] = 'last_name';
                         $retval['columns'][] = 'verified_time_sheet_date';
                         $retval['group'][] = 'verified_time_sheet';
                         $retval['group'][] = 'pay_period';
                         $retval['group'][] = 'first_name';
                         $retval['group'][] = 'last_name';
                         $retval['sort'][] = array('verified_time_sheet' => 'desc');
                         $retval['sort'][] = array('pay_period' => 'asc');
                         $retval['sort'][] = array('verified_time_sheet_date' => 'asc');
                         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 'regular':
                                         $retval['columns'][] = 'worked_time';
                                         $retval['columns'][] = 'regular_time';
                                         break;
                                     case 'overtime':
                                     case 'premium':
                                     case 'absence':
                                         $columns = Misc::trimSortPrefix($this->getOptions($template_keyword . '_columns'));
                                         if (is_array($columns)) {
                                             foreach ($columns as $column => $column_name) {
                                                 if (strpos($column, '_wage') === FALSE and strpos($column, '_hourly_rate') === FALSE) {
                                                     $retval['columns'][] = $column;
                                                 }
                                             }
                                         }
                                         break;
                                     case 'regular_wage':
                                         $retval['columns'][] = 'regular_time_wage';
                                         break;
                                     case 'overtime_wage':
                                     case 'premium_wage':
                                     case 'absence_wage':
                                         $columns = Misc::trimSortPrefix($this->getOptions(str_replace('_wage', '', $template_keyword) . '_columns'));
                                         if (is_array($columns)) {
                                             foreach ($columns as $column => $column_name) {
                                                 if (strpos($column, '_wage') !== FALSE) {
                                                     $retval['columns'][] = $column;
                                                 }
                                             }
                                         }
                                         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_branch':
                                         $retval['columns'][] = 'branch_name';
                                         $retval['group'][] = 'branch_name';
                                         $retval['sort'][] = array('branch_name' => 'asc');
                                         break;
                                     case 'by_department':
                                         $retval['columns'][] = 'department_name';
                                         $retval['group'][] = 'department_name';
                                         $retval['sort'][] = array('department_name' => 'asc');
                                         break;
                                     case 'by_branch_by_department':
                                         $retval['columns'][] = 'branch_name';
                                         $retval['columns'][] = 'department_name';
                                         $retval['group'][] = 'branch_name';
                                         $retval['group'][] = 'department_name';
                                         $retval['sub_total'][] = 'branch_name';
                                         $retval['sort'][] = array('branch_name' => 'asc');
                                         $retval['sort'][] = array('department_name' => '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_name';
                                         $retval['group'][] = 'pay_period';
                                         $retval['group'][] = 'branch_name';
                                         $retval['sub_total'][] = 'pay_period';
                                         $retval['sort'][] = array('pay_period' => 'asc');
                                         $retval['sort'][] = array('branch_name' => 'asc');
                                         break;
                                     case 'by_pay_period_by_department':
                                         $retval['columns'][] = 'pay_period';
                                         $retval['columns'][] = 'department_name';
                                         $retval['group'][] = 'pay_period';
                                         $retval['group'][] = 'department_name';
                                         $retval['sub_total'][] = 'pay_period';
                                         $retval['sort'][] = array('pay_period' => 'asc');
                                         $retval['sort'][] = array('department_name' => 'asc');
                                         break;
                                     case 'by_pay_period_by_branch_by_department':
                                         $retval['columns'][] = 'pay_period';
                                         $retval['columns'][] = 'branch_name';
                                         $retval['columns'][] = 'department_name';
                                         $retval['group'][] = 'pay_period';
                                         $retval['group'][] = 'branch_name';
                                         $retval['group'][] = 'department_name';
                                         $retval['sub_total'][] = 'pay_period';
                                         $retval['sub_total'][] = 'branch_name';
                                         $retval['sort'][] = array('pay_period' => 'asc');
                                         $retval['sort'][] = array('branch_name' => 'asc');
                                         $retval['sort'][] = array('department_name' => '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_name';
                                         $retval['columns'][] = 'pay_period';
                                         $retval['group'][] = 'branch_name';
                                         $retval['group'][] = 'pay_period';
                                         $retval['sub_total'][] = 'branch_name';
                                         $retval['sort'][] = array('branch_name' => 'asc');
                                         $retval['sort'][] = array('pay_period' => 'asc');
                                         break;
                                     case 'by_department_by_pay_period':
                                         $retval['columns'][] = 'department_name';
                                         $retval['columns'][] = 'pay_period';
                                         $retval['group'][] = 'department_name';
                                         $retval['group'][] = 'pay_period';
                                         $retval['sub_total'][] = 'department_name';
                                         $retval['sort'][] = array('department_name' => 'asc');
                                         $retval['sort'][] = array('pay_period' => 'asc');
                                         break;
                                     case 'by_branch_by_department_by_pay_period':
                                         $retval['columns'][] = 'branch_name';
                                         $retval['columns'][] = 'department_name';
                                         $retval['columns'][] = 'pay_period';
                                         $retval['group'][] = 'branch_name';
                                         $retval['group'][] = 'department_name';
                                         $retval['group'][] = 'pay_period';
                                         $retval['sub_total'][] = 'branch_name';
                                         $retval['sub_total'][] = 'department_name';
                                         $retval['sort'][] = array('branch_name' => 'asc');
                                         $retval['sort'][] = array('department_name' => '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_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;
                                 }
                             }
                         }
                         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'), '-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('transaction', TTi18n::getText('Transaction 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, 'GeneralLedgerSummaryReport', '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, 'GeneralLedgerSummaryReport', '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'), 'GeneralLedgerSummaryReport', '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'), 'GeneralLedgerSummaryReport', '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'), '-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'), '-2010-account' => TTi18n::gettext('Account'));
             $retval = array_merge($retval, $this->getOptions('date_columns'), (array) $this->getOptions('report_static_custom_column'));
             ksort($retval);
             break;
         case 'dynamic_columns':
             $retval = array('-2100-debit_amount' => TTi18n::gettext('Debit'), '-2110-credit_amount' => TTi18n::gettext('Credit'));
             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, '_amount') !== FALSE) {
                         $retval[$column] = 'currency';
                     }
                 }
             }
             $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' => TTi18n::gettext('by Employee'), '-1110-by_title' => TTi18n::gettext('by Title'), '-1120-by_group' => TTi18n::gettext('by Group'), '-1130-by_branch' => TTi18n::gettext('by Branch'), '-1140-by_department' => TTi18n::gettext('by Department'), '-1150-by_branch_by_department' => TTi18n::gettext('by Branch/Department'), '-1160-by_pay_period' => TTi18n::gettext('By Pay Period'));
             break;
         case 'template_config':
             $template = strtolower(Misc::trimSortPrefix($params['template']));
             if (isset($template) and $template != '') {
                 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
                                     //Filter
                                     //Group By
                                     //SubTotal
                                     //Sort
                                     case 'by_employee':
                                         $retval['columns'][] = 'full_name';
                                         $retval['columns'][] = 'account';
                                         $retval['columns'][] = 'debit_amount';
                                         $retval['columns'][] = 'credit_amount';
                                         $retval['group'][] = 'full_name';
                                         $retval['group'][] = 'account';
                                         $retval['sub_total'][] = 'full_name';
                                         $retval['sort'][] = array('full_name' => 'asc');
                                         $retval['sort'][] = array('account' => 'asc');
                                         break;
                                     case 'by_title':
                                         $retval['columns'][] = 'title';
                                         $retval['columns'][] = 'account';
                                         $retval['columns'][] = 'debit_amount';
                                         $retval['columns'][] = 'credit_amount';
                                         $retval['group'][] = 'title';
                                         $retval['group'][] = 'account';
                                         $retval['sub_total'][] = 'title';
                                         $retval['sort'][] = array('title' => 'asc');
                                         $retval['sort'][] = array('account' => 'asc');
                                         break;
                                     case 'by_group':
                                         $retval['columns'][] = 'user_group';
                                         $retval['columns'][] = 'account';
                                         $retval['columns'][] = 'debit_amount';
                                         $retval['columns'][] = 'credit_amount';
                                         $retval['group'][] = 'user_group';
                                         $retval['group'][] = 'account';
                                         $retval['sub_total'][] = 'user_group';
                                         $retval['sort'][] = array('user_group' => 'asc');
                                         $retval['sort'][] = array('account' => 'asc');
                                         break;
                                     case 'by_branch':
                                         $retval['columns'][] = 'default_branch';
                                         $retval['columns'][] = 'account';
                                         $retval['columns'][] = 'debit_amount';
                                         $retval['columns'][] = 'credit_amount';
                                         $retval['group'][] = 'default_branch';
                                         $retval['group'][] = 'account';
                                         $retval['sub_total'][] = 'default_branch';
                                         $retval['sort'][] = array('default_branch' => 'asc');
                                         $retval['sort'][] = array('account' => 'asc');
                                         break;
                                     case 'by_department':
                                         $retval['columns'][] = 'default_department';
                                         $retval['columns'][] = 'account';
                                         $retval['columns'][] = 'debit_amount';
                                         $retval['columns'][] = 'credit_amount';
                                         $retval['group'][] = 'default_department';
                                         $retval['group'][] = 'account';
                                         $retval['sub_total'][] = 'default_department';
                                         $retval['sort'][] = array('default_department' => 'asc');
                                         $retval['sort'][] = array('account' => 'asc');
                                         break;
                                     case 'by_branch_by_department':
                                         $retval['columns'][] = 'default_branch';
                                         $retval['columns'][] = 'default_department';
                                         $retval['columns'][] = 'account';
                                         $retval['columns'][] = 'debit_amount';
                                         $retval['columns'][] = 'credit_amount';
                                         $retval['group'][] = 'default_branch';
                                         $retval['group'][] = 'default_department';
                                         $retval['group'][] = 'account';
                                         $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('account' => 'asc');
                                         break;
                                     case 'by_pay_period':
                                         $retval['columns'][] = 'transaction-pay_period';
                                         $retval['columns'][] = 'account';
                                         $retval['columns'][] = 'debit_amount';
                                         $retval['columns'][] = 'credit_amount';
                                         $retval['group'][] = 'transaction-pay_period';
                                         $retval['group'][] = 'account';
                                         $retval['sub_total'][] = 'transaction-pay_period';
                                         $retval['sort'][] = array('transaction-pay_period' => 'asc');
                                         $retval['sort'][] = array('account' => '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;
 }
 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'), '-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-qualification_group_id' => TTi18n::gettext('Qualification Group'), '-2085-qualification_type_id' => TTi18n::gettext('Qualification Type'), '-2090-qualification_id' => TTi18n::gettext('Qualifications'), '-2100-proficiency_id' => TTi18n::gettext('Skill Proficiency'), '-2140-fluency_id' => TTi18n::gettext('Language Fluency'), '-2150-competency_id' => TTi18n::gettext('Language Competency'), '-2170-ownership_id' => TTi18n::gettext('Membership Ownership'), '-2200-membership_renewal_date' => TTi18n::gettext('Membership Renewal Date'), '-2250-skill_expiry_date' => TTi18n::gettext('Skill Expiry Date'), '-2300-license_expiry_date' => TTi18n::gettext('License Expiry Date'), '-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':
         //case 'time_period':
         case 'membership_renewal_date':
         case 'skill_expiry_date':
         case 'license_expiry_date':
             $retval = TTDate::getTimePeriodOptions();
             break;
         case 'date_columns':
             $retval = array_merge(TTDate::getReportDateOptions('user.hire', TTi18n::getText('Hire Date'), 15, FALSE), TTDate::getReportDateOptions('user.termination', TTi18n::getText('Termination Date'), 16, FALSE), TTDate::getReportDateOptions('user.birth', TTi18n::getText('Birth 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, 'UserQualificationReport', '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, 'UserQualificationReport', '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'), 'UserQualificationReport', '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'), 'UserQualificationReport', '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-user.first_name' => TTi18n::gettext('First Name'), '-1001-user.middle_name' => TTi18n::gettext('Middle Name'), '-1002-user.last_name' => TTi18n::gettext('Last Name'), '-1005-user.full_name' => TTi18n::gettext('Full Name'), '-1010-user.user_name' => TTi18n::gettext('User Name'), '-1020-user.phone_id' => TTi18n::gettext('PIN/Phone ID'), '-1030-user.employee_number' => TTi18n::gettext('Employee #'), '-1040-user.status' => TTi18n::gettext('Employee Status'), '-1050-user.title' => TTi18n::gettext('Title'), '-1060-user.province' => TTi18n::gettext('Province/State'), '-1070-user.country' => TTi18n::gettext('Country'), '-1080-user.user_group' => TTi18n::gettext('Employee Group'), '-1090-user.default_branch' => TTi18n::gettext('Branch'), '-1100-user.default_department' => TTi18n::gettext('Department'), '-1200-user.permission_control' => TTi18n::gettext('Permission Group'), '-1210-user.pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1220-user.policy_group' => TTi18n::gettext('Policy Group'), '-1310-user.sex' => TTi18n::gettext('Gender'), '-1320-user.address1' => TTi18n::gettext('Address 1'), '-1330-user.address2' => TTi18n::gettext('Address 2'), '-1340-user.city' => TTi18n::gettext('City'), '-1370-user.postal_code' => TTi18n::gettext('Postal Code'), '-1380-user.work_phone' => TTi18n::gettext('Work Phone'), '-1391-user.work_phone_ext' => TTi18n::gettext('Work Phone Ext'), '-1400-user.home_phone' => TTi18n::gettext('Home Phone'), '-1410-user.mobile_phone' => TTi18n::gettext('Mobile Phone'), '-1420-user.fax_phone' => TTi18n::gettext('Fax Phone'), '-1430-user.home_email' => TTi18n::gettext('Home Email'), '-1440-user.work_email' => TTi18n::gettext('Work Email'), '-1480-user.sin' => TTi18n::gettext('SIN/SSN'), '-1490-user.note' => TTi18n::gettext('Employee Note'), '-1499-user.hierarchy_control_display' => TTi18n::gettext('Hierarchy'), '-1820-user_wage.type' => TTi18n::gettext('Wage Type'), '-1840-user_wage.effective_date' => TTi18n::gettext('Wage Effective Date'), '-1850-user_wage.note' => TTi18n::gettext('Wage Note'), '-1900-user_preference.language_display' => TTi18n::gettext('Language'), '-1910-user_preference.date_format_display' => TTi18n::gettext('Date Format'), '-1920-user_preference.time_format_display' => TTi18n::gettext('Time Format'), '-1930-user_preference.time_unit_format_display' => TTi18n::gettext('Time Units'), '-1940-user_preference.time_zone_display' => TTi18n::gettext('Time Zone'), '-1950-user_preference.items_per_page' => TTi18n::gettext('Rows Per page'), '-2060-user.password_updated_date' => TTi18n::gettext('Password Updated Date'), '-2080-qualification.type' => TTi18n::gettext('Qualification Type'), '-2010-qualification' => TTi18n::gettext('Qualification'), '-2020-qualification.group' => TTi18n::gettext('Qualification Group'), '-2030-user_skill.proficiency' => TTi18n::gettext('Skill Proficiency'), '-2040-user_skill.experience' => TTi18n::gettext('Skill Experience'), '-2050-user_skill.first_used_date' => TTi18n::gettext('Skill First Used Date'), '-2060-user_skill.last_used_date' => TTi18n::gettext('Skill Last Used Date'), '-2070-user_skill.expiry_date' => TTi18n::gettext('Skill Expiry Date'), '-2090-user_education.institute' => TTi18n::gettext('Institute'), '-2100-user_education.major' => TTi18n::gettext('Major/Specialization'), '-2110-user_education.minor' => TTi18n::gettext('Minor'), '-2120-user_education.graduate_date' => TTi18n::gettext('Graduation Date'), '-2130-user_education.grade_score' => TTi18n::gettext('Grade/Score'), '-2140-user_education.start_date' => TTi18n::gettext('Education Start Date'), '-2150-user_education.end_date' => TTi18n::gettext('Education End Date'), '-2160-user_license.license_number' => TTi18n::gettext('License Number'), '-2170-user_license.license_issued_date' => TTi18n::gettext('License Issued Date'), '-2180-user_license.license_expiry_date' => TTi18n::gettext('License Expiry Date'), '-2190-user_language.fluency' => TTi18n::gettext('Language Fluency'), '-2200-user_language.competency' => TTi18n::gettext('Language Competency'), '-2210-user_membership.ownership' => TTi18n::gettext('Membership Ownership'), '-2240-user_membership.start_date' => TTi18n::gettext('Membership Start Date'), '-2250-user_membership.renewal_date' => TTi18n::gettext('Membership Renewal Date'));
             $retval = array_merge($retval, $this->getOptions('date_columns'), (array) $this->getOptions('report_static_custom_column'));
             ksort($retval);
             break;
         case 'dynamic_columns':
             $retval = array('-1830-user_wage.wage' => TTi18n::gettext('Wage'), '-1835-user_wage.hourly_rate' => TTi18n::gettext('Hourly Rate'), '-2220-user_membership.amount' => TTi18n::gettext('Membership Amount'), '-2900-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, 'amount') !== FALSE or strpos($column, 'wage') !== FALSE or strpos($column, 'hourly_rate') !== FALSE) {
                         $retval[$column] = 'currency';
                     }
                 }
             }
             $retval['user.password_updated_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) {
                         case 'user_membership.amount':
                             $retval[$column] = 'sum';
                             break;
                         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_employee+language' => TTi18n::gettext('Language Information By Employee'), '-1252-by_qualification_by_employee+language' => TTi18n::gettext('Language Information By Language/Employee'), '-1260-by_employee+membership' => TTi18n::gettext('Membership Information By Employee'), '-1262-by_qualification_by_employee+membership' => TTi18n::gettext('Membership Information By Membership/Employee'), '-1264-by_employee+membership_renewal' => TTi18n::gettext('Membership Renewals By Employee'), '-1270-by_employee+license' => TTi18n::gettext('License Information By Employee'), '-1272-by_license_by_employee+license' => TTi18n::gettext('License Information By License/Employee'), '-1274-by_employee+license_renewal' => TTi18n::gettext('License Renewals By Employee'), '-1280-by_employee+education' => TTi18n::gettext('Education Information By Employee'), '-1282-by_course_by_employee+education' => TTi18n::gettext('Education Information By Course/Employee'), '-1290-by_employee+skill' => TTi18n::gettext('Skills Information By Employee'), '-1292-by_skill_by_employee+skill' => TTi18n::gettext('Skills Information By Skill/Employee'), '-1294-by_employee+skill_renewal' => TTi18n::gettext('Skill Renewals By Employee'));
             break;
         case 'template_config':
             $template = strtolower(Misc::trimSortPrefix($params['template']));
             if (isset($template) and $template != '') {
                 switch ($template) {
                     //language
                     case 'by_employee+language':
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'qualification';
                         $retval['columns'][] = 'user_language.fluency';
                         $retval['columns'][] = 'user_language.competency';
                         $retval['-2085-qualification_type_id'] = array(40);
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         $retval['sort'][] = array('qualification' => 'asc');
                         $retval['sort'][] = array('user_language.fluency' => 'asc');
                         $retval['sort'][] = array('user_language.competency' => 'asc');
                         break;
                     case 'by_qualification_by_employee+language':
                         $retval['columns'][] = 'qualification';
                         $retval['columns'][] = 'user_language.fluency';
                         $retval['columns'][] = 'user_language.competency';
                         $retval['columns'][] = 'user.full_name';
                         $retval['-2085-qualification_type_id'] = array(40);
                         $retval['sort'][] = array('qualification' => 'asc');
                         $retval['sort'][] = array('user_language.fluency' => 'asc');
                         $retval['sort'][] = array('user_language.competency' => 'asc');
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         break;
                         //membership
                     //membership
                     case 'by_employee+membership':
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'qualification';
                         $retval['columns'][] = 'user_membership.ownership';
                         $retval['columns'][] = 'user_membership.amount';
                         $retval['columns'][] = 'user_membership.start_date';
                         $retval['columns'][] = 'user_membership.renewal_date';
                         $retval['-2085-qualification_type_id'] = array(50);
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         $retval['sort'][] = array('qualification' => 'asc');
                         break;
                     case 'by_qualification_by_employee+membership':
                         $retval['columns'][] = 'qualification';
                         $retval['columns'][] = 'user_membership.ownership';
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'user_membership.amount';
                         $retval['columns'][] = 'user_membership.renewal_date';
                         $retval['columns'][] = 'user_membership.start_date';
                         $retval['-2085-qualification_type_id'] = array(50);
                         $retval['sort'][] = array('qualification' => 'asc');
                         $retval['sort'][] = array('user_membership.ownership' => 'asc');
                         $retval['sort'][] = array('user_membership.renewal_date' => 'asc');
                         break;
                     case 'by_employee+membership_renewal':
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'qualification';
                         $retval['columns'][] = 'user_membership.ownership';
                         $retval['columns'][] = 'user_membership.amount';
                         $retval['columns'][] = 'user_membership.renewal_date';
                         $retval['-2085-qualification_type_id'] = array(50);
                         $retval['sort'][] = array('user_membership.renewal_date' => 'asc');
                         $retval['sort'][] = array('qualification' => 'asc');
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         break;
                         //license
                     //license
                     case 'by_employee+license':
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'qualification';
                         $retval['columns'][] = 'user_license.license_number';
                         $retval['columns'][] = 'user_license.license_issued_date';
                         $retval['columns'][] = 'user_license.license_expiry_date';
                         $retval['-2085-qualification_type_id'] = array(30);
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         $retval['sort'][] = array('qualification' => 'asc');
                         break;
                     case 'by_license_by_employee+license':
                         $retval['columns'][] = 'qualification';
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'user_license.license_number';
                         $retval['columns'][] = 'user_license.license_issued_date';
                         $retval['columns'][] = 'user_license.license_expiry_date';
                         $retval['-2085-qualification_type_id'] = array(30);
                         $retval['sort'][] = array('qualification' => 'asc');
                         $retval['sort'][] = array('user_license.license_expiry_date' => 'asc');
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         break;
                     case 'by_employee+license_renewal':
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'qualification';
                         $retval['columns'][] = 'user_license.license_number';
                         $retval['columns'][] = 'user_license.license_issued_date';
                         $retval['columns'][] = 'user_license.license_expiry_date';
                         $retval['-2085-qualification_type_id'] = array(30);
                         $retval['sort'][] = array('user_license.license_expiry_date' => 'asc');
                         $retval['sort'][] = array('qualification' => 'asc');
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         break;
                         //education
                     //education
                     case 'by_employee+education':
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'qualification';
                         $retval['columns'][] = 'user_education.institute';
                         $retval['columns'][] = 'user_education.major';
                         $retval['columns'][] = 'user_education.minor';
                         $retval['columns'][] = 'user_education.start_date';
                         $retval['columns'][] = 'user_education.end_date';
                         $retval['columns'][] = 'user_education.graduate_date';
                         $retval['columns'][] = 'user_education.grade_score';
                         $retval['-2085-qualification_type_id'] = array(20);
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         $retval['sort'][] = array('qualification' => 'asc');
                         break;
                     case 'by_course_by_employee+education':
                         $retval['columns'][] = 'qualification';
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'user_education.grade_score';
                         $retval['columns'][] = 'user_education.institute';
                         $retval['columns'][] = 'user_education.major';
                         $retval['columns'][] = 'user_education.minor';
                         $retval['columns'][] = 'user_education.start_date';
                         $retval['columns'][] = 'user_education.end_date';
                         $retval['columns'][] = 'user_education.graduate_date';
                         $retval['-2085-qualification_type_id'] = array(20);
                         $retval['sort'][] = array('qualification' => 'asc');
                         $retval['sort'][] = array('user_education.grade_score' => 'desc');
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         break;
                         //skill
                     //skill
                     case 'by_employee+skill':
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'qualification';
                         $retval['columns'][] = 'user_skill.proficiency';
                         $retval['columns'][] = 'user_skill.experience';
                         $retval['columns'][] = 'user_skill.first_used_date';
                         $retval['columns'][] = 'user_skill.last_used_date';
                         $retval['columns'][] = 'user_skill.expiry_date';
                         $retval['-2085-qualification_type_id'] = array(10);
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         $retval['sort'][] = array('qualification' => 'asc');
                         break;
                     case 'by_skill_by_employee+skill':
                         $retval['columns'][] = 'qualification';
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'proficiency';
                         $retval['columns'][] = 'user_skill.experience';
                         $retval['columns'][] = 'user_skill.first_used_date';
                         $retval['columns'][] = 'user_skill.last_used_date';
                         $retval['columns'][] = 'user_skill.expiry_date';
                         $retval['-2085-qualification_type_id'] = array(10);
                         $retval['sort'][] = array('qualification' => 'asc');
                         $retval['sort'][] = array('user_skill.proficiency' => 'desc');
                         $retval['sort'][] = array('user_skill.experience' => 'desc');
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         break;
                     case 'by_employee+skill_renewal':
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'qualification';
                         $retval['columns'][] = 'user_skill.proficiency';
                         $retval['columns'][] = 'user_skill.experience';
                         $retval['columns'][] = 'user_skill.first_used_date';
                         $retval['columns'][] = 'user_skill.last_used_date';
                         $retval['columns'][] = 'user_skill.expiry_date';
                         $retval['-2085-qualification_type_id'] = array(10);
                         $retval['sort'][] = array('user_skill.expiry_date' => 'asc');
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         $retval['sort'][] = array('qualification' => 'asc');
                         $retval['sort'][] = array('user_skill.proficiency' => 'desc');
                         $retval['sort'][] = array('user_skill.experience' => '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;
 }
Exemplo n.º 14
0
 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-punch_branch_id' => TTi18n::gettext('Punch Branch'), '-2090-punch_department_id' => TTi18n::gettext('Punch 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) {
                 $corporate_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, $corporate_edition_setup_fields);
             }
             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(15, 20, 30), array(15 => '', 20 => 'job_', 30 => 'job_item_'));
             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, 'PunchSummaryReport', '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, 'PunchSummaryReport', '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'), 'PunchSummaryReport', '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'), 'PunchSummaryReport', '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'), '-1495-tag' => TTi18n::gettext('Tags'), '-1600-in_time_stamp' => TTi18n::gettext('In Punch'), '-1601-in_type' => TTi18n::gettext('In Type'), '-1610-out_time_stamp' => TTi18n::gettext('Out Punch'), '-1611-out_type' => TTi18n::gettext('Out Type'), '-1620-in_actual_time_stamp' => TTi18n::gettext('In (Actual)'), '-1630-out_actual_time_stamp' => TTi18n::gettext('Out (Actual)'), '-1660-branch' => TTi18n::gettext('Branch'), '-1670-department' => TTi18n::gettext('Department'), '-1671-in_station_type' => TTi18n::gettext('In Station Type'), '-1672-in_station_station_id' => TTi18n::gettext('In Station ID'), '-1673-in_station_source' => TTi18n::gettext('In Station Source'), '-1674-in_station_description' => TTi18n::gettext('In Station Description'), '-1675-out_station_type' => TTi18n::gettext('Out Station Type'), '-1676-out_station_station_id' => TTi18n::gettext('Out Station ID'), '-1677-out_station_source' => TTi18n::gettext('Out Station Source'), '-1678-out_station_description' => TTi18n::gettext('Out Station Description'), '-1720-note' => TTi18n::gettext('Note'), '-1900-in_created_date' => TTi18n::gettext('In Created Date'), '-1901-in_created_by' => TTi18n::gettext('In Created By'), '-1905-in_updated_date' => TTi18n::gettext('In Updated Date'), '-1906-in_updated_by' => TTi18n::gettext('In Updated By'), '-1910-out_created_date' => TTi18n::gettext('Out Created Date'), '-1911-out_created_by' => TTi18n::gettext('Out Created By'), '-1915-out_updated_date' => TTi18n::gettext('Out Updated Date'), '-1916-out_updated_by' => TTi18n::gettext('Out Updated By'), '-1920-verified_time_sheet' => TTi18n::gettext('Verified TimeSheet'), '-1925-verified_time_sheet_date' => TTi18n::gettext('Verified TimeSheet Date'), '-1930-verified_time_sheet_tainted' => TTi18n::gettext('TimeSheet Verification Tainted'), '-1950-tainted' => TTi18n::gettext('Tainted'), '-1951-tainted_status' => TTi18n::gettext('Tainted Status'));
             if ($this->getUserObject()->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE) {
                 $corporate_edition_static_columns = array('-1810-job' => TTi18n::gettext('Job'), '-1820-job_manual_id' => TTi18n::gettext('Job Code'), '-1830-job_description' => TTi18n::gettext('Job Description'), '-1840-job_status' => TTi18n::gettext('Job Status'), '-1850-job_branch' => TTi18n::gettext('Job Branch'), '-1860-job_department' => TTi18n::gettext('Job Department'), '-1870-job_group' => TTi18n::gettext('Job Group'), '-1910-job_item' => TTi18n::gettext('Task'), '-1920-job_item_manual_id' => TTi18n::gettext('Task Code'), '-1930-job_item_description' => TTi18n::gettext('Task Description'), '-1940-job_item_group' => TTi18n::gettext('Task Group'));
                 $retval = array_merge($retval, $corporate_edition_static_columns);
             }
             $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'), '-2120-actual_total_time' => TTi18n::gettext('Actual Time'), '-2120-actual_total_time_wage' => TTi18n::gettext('Actual Time Wage'), '-2125-actual_total_time_diff' => TTi18n::gettext('Actual Time Difference'), '-2127-actual_total_time_diff_wage' => TTi18n::gettext('Actual Time Difference Wage'), '-3000-total_punch' => TTi18n::gettext('Total Punches'), '-3001-total_tainted_punch' => TTi18n::gettext('Total Tainted Punches'));
             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 or strpos($column, 'hourly_rate') !== FALSE) {
                         $retval[$column] = 'currency';
                     } elseif (strpos($column, '_time') or strpos($column, '_policy')) {
                         $retval[$column] = 'time_unit';
                     }
                 }
             }
             $retval['in_time_stamp'] = $retval['out_time_stamp'] = $retval['in_actual_time_stamp'] = $retval['out_actual_time_stamp'] = $retval['in_created_date'] = $retval['in_updated_date'] = $retval['out_created_date'] = $retval['out_updated_date'] = $retval['verified_time_sheet_date'] = 'time_stamp';
             $retval['verified_time_sheet_tainted'] = $retval['tainted'] = 'boolean';
             $retval['verified_time_sheet_tainted'] = 'boolean';
             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';
                             }
                     }
                 }
             }
             $retval['verified_time_sheet'] = 'first';
             $retval['verified_time_sheet_date'] = 'first';
             break;
         case 'templates':
             $retval = array('-1010-by_employee+punch_summary+total_time' => TTi18n::gettext('Punch Summary By Employee'), '-1020-by_branch+punch_summary+total_time' => TTi18n::gettext('Punch Summary by Branch'), '-1030-by_department+punch_summary+total_time' => TTi18n::gettext('Punch Summary by Department'), '-1040-by_branch_by_department+punch_summary+total_time' => TTi18n::gettext('Punch Summary by Branch/Department'), '-1050-by_pay_period+punch_summary+total_time' => TTi18n::gettext('Punch Summary by Pay Period'), '-1060-by_date_stamp+punch_summary+total_time' => TTi18n::gettext('Punch Summary by Date'), '-1070-by_station+punch_summary+total_time' => TTi18n::gettext('Punch Summary by Station'), '-1080-by_employee+punch_summary+total_time+note' => TTi18n::gettext('Punch Summary+Notes by Employee'), '-1090-by_employee+punch_summary+total_time+actual_time' => TTi18n::gettext('Punch Summary+Actual Time by Employee'), '-1100-by_employee+punch_summary+station_summary+total_time' => TTi18n::gettext('Punch/Station Detail By Employee'), '-1110-by_employee+actual_time' => TTi18n::gettext('Actual Time by Employee'), '-1120-by_employee+tainted' => TTi18n::gettext('Tainted Punches By Employee'), '-1120-by_employee+verified_time_sheet' => TTi18n::gettext('TimeSheet Verification Tainted'));
             if ($this->getUserObject()->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE) {
                 $professional_edition_templates = array('-2010-by_job+punch_summary+total_time' => TTi18n::gettext('Punch Summary by Job'), '-2020-by_job_item+punch_summary+total_time' => TTi18n::gettext('Punch Summary by Task'), '-2030-by_job_by_job_item+punch_summary+total_time' => TTi18n::gettext('Punch Summary by Job/Task'), '-2040-by_job_branch+punch_summary+total_time' => TTi18n::gettext('Punch Summary by Job Branch'), '-2050-by_job_branch_by_job_department+punch_summary+total_time' => TTi18n::gettext('Punch Summary by Job Branch/Department'), '-2060-by_job_group+punch_summary+total_time' => TTi18n::gettext('Punch Summary by Job Group'));
                 $retval = array_merge($retval, $professional_edition_templates);
             }
             break;
         case 'template_config':
             $template = strtolower(Misc::trimSortPrefix($params['template']));
             if (isset($template) and $template != '') {
                 switch ($template) {
                     case 'by_employee+actual_time':
                         $retval['-1010-time_period']['time_period'] = 'last_pay_period';
                         $retval['columns'][] = 'first_name';
                         $retval['columns'][] = 'last_name';
                         $retval['columns'][] = 'total_time';
                         $retval['columns'][] = 'actual_total_time';
                         $retval['columns'][] = 'actual_total_time_diff';
                         $retval['columns'][] = 'actual_total_time_diff_wage';
                         $retval['group'][] = 'first_name';
                         $retval['group'][] = 'last_name';
                         $retval['sort'][] = array('actual_total_time_diff' => 'desc');
                         $retval['sort'][] = array('last_name' => 'asc');
                         $retval['sort'][] = array('first_name' => 'asc');
                         break;
                     case 'by_employee+verified_time_sheet':
                         $retval['-1010-time_period']['time_period'] = 'last_pay_period';
                         $retval['columns'][] = 'first_name';
                         $retval['columns'][] = 'last_name';
                         $retval['columns'][] = 'in_type';
                         $retval['columns'][] = 'in_time_stamp';
                         $retval['columns'][] = 'out_type';
                         $retval['columns'][] = 'out_time_stamp';
                         $retval['columns'][] = 'verified_time_sheet';
                         $retval['columns'][] = 'verified_time_sheet_date';
                         $retval['columns'][] = 'verified_time_sheet_tainted';
                         $retval['sort'][] = array('verified_time_sheet_tainted' => 'desc');
                         $retval['sort'][] = array('verified_time_sheet' => 'asc');
                         $retval['sort'][] = array('verified_time_sheet_date' => 'desc');
                         break;
                     case 'by_employee+tainted':
                         $retval['-1010-time_period']['time_period'] = 'last_pay_period';
                         $retval['columns'][] = 'tainted';
                         $retval['columns'][] = 'first_name';
                         $retval['columns'][] = 'last_name';
                         $retval['columns'][] = 'total_tainted_punch';
                         $retval['columns'][] = 'total_punch';
                         $retval['group'][] = 'tainted';
                         $retval['group'][] = 'first_name';
                         $retval['group'][] = 'last_name';
                         $retval['sub_total'][] = 'tainted';
                         $retval['sort'][] = array('tainted' => 'desc');
                         $retval['sort'][] = array('total_tainted_punch' => 'desc');
                         $retval['sort'][] = array('total_punch' => 'desc');
                         $retval['sort'][] = array('last_name' => 'asc');
                         $retval['sort'][] = array('first_name' => 'desc');
                         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 'actual_time':
                                         $retval['columns'][] = 'actual_total_time';
                                         $retval['columns'][] = 'actual_total_time_diff';
                                         break;
                                     case 'note':
                                         $retval['columns'][] = 'note';
                                         break;
                                     case 'punch_summary':
                                         $retval['columns'][] = 'in_type';
                                         $retval['columns'][] = 'in_time_stamp';
                                         $retval['columns'][] = 'out_type';
                                         $retval['columns'][] = 'out_time_stamp';
                                         break;
                                     case 'station_summary':
                                         $retval['columns'][] = 'in_station_type';
                                         $retval['columns'][] = 'out_station_type';
                                         break;
                                         //Filter
                                         //Group By
                                         //SubTotal
                                         //Sort
                                     //Filter
                                     //Group By
                                     //SubTotal
                                     //Sort
                                     case 'by_employee':
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = 'last_name';
                                         $retval['sub_total'][] = 'last_name';
                                         $retval['sub_total'][] = 'first_name';
                                         $retval['sort'][] = array('last_name' => 'asc');
                                         $retval['sort'][] = array('first_name' => 'asc');
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => 'asc');
                                         break;
                                     case 'by_branch':
                                         $retval['columns'][] = 'branch';
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = 'last_name';
                                         $retval['sub_total'][] = 'branch';
                                         $retval['sort'][] = array('branch' => 'asc');
                                         $retval['sort'][] = array('last_name' => 'asc');
                                         $retval['sort'][] = array('first_name' => 'asc');
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => 'asc');
                                         break;
                                     case 'by_department':
                                         $retval['columns'][] = 'department';
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = 'last_name';
                                         $retval['sub_total'][] = 'department';
                                         $retval['sort'][] = array('department' => 'asc');
                                         $retval['sort'][] = array('last_name' => 'asc');
                                         $retval['sort'][] = array('first_name' => 'asc');
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => 'asc');
                                         break;
                                     case 'by_branch_by_department':
                                         $retval['columns'][] = 'branch';
                                         $retval['columns'][] = 'department';
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = 'last_name';
                                         $retval['sub_total'][] = 'branch';
                                         $retval['sub_total'][] = 'department';
                                         $retval['sort'][] = array('branch' => 'asc');
                                         $retval['sort'][] = array('department' => 'asc');
                                         $retval['sort'][] = array('last_name' => 'asc');
                                         $retval['sort'][] = array('first_name' => 'asc');
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => 'asc');
                                         break;
                                     case 'by_pay_period':
                                         $retval['columns'][] = 'pay_period';
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = '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');
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => 'asc');
                                         break;
                                     case 'by_station':
                                         $retval['columns'][] = 'in_station_type';
                                         $retval['columns'][] = 'in_station_description';
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = 'last_name';
                                         $retval['sub_total'][] = 'in_station_type';
                                         $retval['sub_total'][] = 'in_station_description';
                                         $retval['sort'][] = array('in_station_type' => 'asc');
                                         $retval['sort'][] = array('in_station_description' => 'asc');
                                         $retval['sort'][] = array('last_name' => 'asc');
                                         $retval['sort'][] = array('first_name' => 'asc');
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => 'asc');
                                         break;
                                     case 'by_date_stamp':
                                         $retval['columns'][] = 'date_stamp';
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = 'last_name';
                                         $retval['sub_total'][] = 'date_stamp';
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('last_name' => 'asc');
                                         $retval['sort'][] = array('first_name' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => 'asc');
                                         break;
                                         //Professional Edition templates.
                                     //Professional Edition templates.
                                     case 'by_job':
                                         $retval['columns'][] = 'job';
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = 'last_name';
                                         $retval['sub_total'][] = 'job';
                                         $retval['sort'][] = array('job' => 'asc');
                                         $retval['sort'][] = array('last_name' => 'asc');
                                         $retval['sort'][] = array('first_name' => 'asc');
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => 'asc');
                                         break;
                                     case 'by_job_item':
                                         $retval['columns'][] = 'job_item';
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = 'last_name';
                                         $retval['sub_total'][] = 'job_item';
                                         $retval['sort'][] = array('job_item' => 'asc');
                                         $retval['sort'][] = array('last_name' => 'asc');
                                         $retval['sort'][] = array('first_name' => 'asc');
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => 'asc');
                                         break;
                                     case 'by_job_by_job_item':
                                         $retval['columns'][] = 'job';
                                         $retval['columns'][] = 'job_item';
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = 'last_name';
                                         $retval['sub_total'][] = 'job';
                                         $retval['sub_total'][] = 'job_item';
                                         $retval['sort'][] = array('job' => 'asc');
                                         $retval['sort'][] = array('job_item' => 'asc');
                                         $retval['sort'][] = array('last_name' => 'asc');
                                         $retval['sort'][] = array('first_name' => 'asc');
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => 'asc');
                                         break;
                                     case 'by_job_branch':
                                         $retval['columns'][] = 'job_branch';
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = 'last_name';
                                         $retval['sub_total'][] = 'job_branch';
                                         $retval['sort'][] = array('job_branch' => 'asc');
                                         $retval['sort'][] = array('last_name' => 'asc');
                                         $retval['sort'][] = array('first_name' => 'asc');
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => 'asc');
                                         break;
                                     case 'by_job_department':
                                         $retval['columns'][] = 'job_department';
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = 'last_name';
                                         $retval['sub_total'][] = 'job_department';
                                         $retval['sort'][] = array('job_department' => 'asc');
                                         $retval['sort'][] = array('last_name' => 'asc');
                                         $retval['sort'][] = array('first_name' => 'asc');
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => 'asc');
                                         break;
                                     case 'by_job_branch_by_job_department':
                                         $retval['columns'][] = 'job_branch';
                                         $retval['columns'][] = 'job_department';
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = 'last_name';
                                         $retval['sub_total'][] = 'job_branch';
                                         $retval['sub_total'][] = 'job_department';
                                         $retval['sort'][] = array('job_branch' => 'asc');
                                         $retval['sort'][] = array('job_department' => 'asc');
                                         $retval['sort'][] = array('last_name' => 'asc');
                                         $retval['sort'][] = array('first_name' => 'asc');
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => 'asc');
                                         break;
                                     case 'by_job_group':
                                         $retval['columns'][] = 'job_group';
                                         $retval['columns'][] = 'first_name';
                                         $retval['columns'][] = 'last_name';
                                         $retval['sub_total'][] = 'job_group';
                                         $retval['sort'][] = array('job_group' => 'asc');
                                         $retval['sort'][] = array('last_name' => 'asc');
                                         $retval['sort'][] = array('first_name' => 'asc');
                                         $retval['sort'][] = array('date_stamp' => 'asc');
                                         $retval['sort'][] = array('in_time_stamp' => '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;
 }
Exemplo n.º 15
0
 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-include_reviewer_user_id' => TTi18n::gettext('Reviewer Include'), '-2070-exclude_reviewer_user_id' => TTi18n::gettext('Reviewer Exclude'), '-2080-default_branch_id' => TTi18n::gettext('Default Branch'), '-2090-default_department_id' => TTi18n::gettext('Default Department'), '-2100-kpi_id' => TTi18n::gettext('Key Performance Indicators'), '-2120-kpi_group_id' => TTi18n::gettext('KPI Group'), '-2130-kpi_status_id' => TTi18n::gettext('KPI Status'), '-2140-kpi_type_id' => TTi18n::gettext('KPI Type'), '-2150-user_review_control_status_id' => TTi18n::gettext('Review Status'), '-2160-user_review_control_type_id' => TTi18n::gettext('Review Type'), '-2170-term_id' => TTi18n::gettext('Review Terms'), '-2180-severity_id' => TTi18n::gettext('Review Severity/Importance'), '-2188-review_tag' => TTi18n::gettext('Review Tags'), '-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('user_review_control.start', TTi18n::getText('Start Date'), 16, FALSE), TTDate::getReportDateOptions('user_review_control.end', TTi18n::getText('End Date'), 17, FALSE), TTDate::getReportDateOptions('user_review_control.due', TTi18n::getText('Due Date'), 18, 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, 'KPIReport', '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, 'KPIReport', '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'), 'KPIReport', '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'), 'KPIReport', '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-kpi.name' => TTi18n::gettext('Key Performance Indicators'), '-1005-kpi.type' => TTi18n::getText('KPI Type'), '-1000-kpi.status' => TTi18n::gettext('KPI Status'), '-1010-kpi.description' => TTi18n::gettext('Description'), '-1020-user.first_name' => TTi18n::gettext('First Name'), '-1030-user.middle_name' => TTi18n::gettext('Middle Name'), '-1040-user.last_name' => TTi18n::gettext('Last Name'), '-1050-user.full_name' => TTi18n::gettext('Full Name'), '-1060-user.status' => TTi18n::gettext('Employee Status'), '-1070-user.sex' => TTi18n::gettext('Gender'), '-1080-user.user_group' => TTi18n::gettext('Employee Group'), '-1090-user.title' => TTi18n::gettext('Employee Title'), '-1100-user.default_branch' => TTi18n::gettext('Branch'), '-1110-user.default_department' => TTi18n::gettext('Department'), '-1120-user.city' => TTi18n::gettext('City'), '-1130-user.province' => TTi18n::gettext('Province/State'), '-1140-user.country' => TTi18n::gettext('Country'), '-1150-user.postal_code' => TTi18n::gettext('Postal Code'), '-1160-user.work_phone' => TTi18n::gettext('Work Phone'), '-1170-user.work_phone_ext' => TTi18n::gettext('Work Phone Ext'), '-1180-user.home_phone' => TTi18n::gettext('Home Phone'), '-1190-user.mobile_phone' => TTi18n::gettext('Mobile Phone'), '-1200-user.fax_phone' => TTi18n::gettext('Fax Phone'), '-1210-user.home_email' => TTi18n::gettext('Home Email'), '-1220-user.work_email' => TTi18n::gettext('Work Email'), '-1230-user.address1' => TTi18n::gettext('Address 1'), '-1240-user.address2' => TTi18n::gettext('Address 2'), '-1244-user.tag' => TTi18n::getText('Employee Tags'), '-1250-user_review_control.reviewer_user' => TTi18n::gettext('Reviewer Name'), '-1260-user_review_control.status' => TTi18n::gettext('Review Status'), '-1270-user_review_control.type' => TTi18n::gettext('Review Type'), '-1280-user_review_control.term' => TTi18n::gettext('Review Terms'), '-1290-user_review_control.severity' => TTi18n::gettext('Review Severity/Importance'), '-1292-user_review_control.tag' => TTi18n::gettext('Review Tags'), '-1300-user_review.note' => TTi18n::gettext('KPI Notes'), '-1350-user.note' => TTi18n::gettext('Employee Notes'), '-1400-user_review_control.note' => TTi18n::gettext('Review Notes'));
             $retval = array_merge($retval, $this->getOptions('date_columns'), (array) $this->getOptions('report_static_custom_column'));
             ksort($retval);
             break;
         case 'dynamic_columns':
             $retval = array('-2000-kpi.minimum_rate' => TTi18n::gettext('Minimum Rating'), '-2010-kpi.maximum_rate' => TTi18n::gettext('Maximum Rating'), '-2020-user_review.rating' => TTi18n::gettext('Rating'), '-2000-total_review' => TTi18n::gettext('Total Reviews'));
             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, 'rate') !== FALSE) {
                         $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) {
                         case 'kpi.minimum_rate':
                             $retval[$column] = 'min';
                             break;
                         case 'kpi.maximum_rate':
                             $retval[$column] = 'max';
                             break;
                         case 'user_review.rating':
                         case 'total_review':
                             $retval[$column] = 'sum';
                             break;
                     }
                 }
             }
             break;
         case 'templates':
             $retval = array('-1010-by_employee_by_kpi+kpi+rating' => TTi18n::gettext('Review Information By Employee/KPI'), '-1020-by_kpi_by_employee+kpi+rating' => TTi18n::gettext('Review Information By KPI/Employee'), '-1040-by_type_by_terms_by_severity+kpi+rating' => TTi18n::gettext('Review Summary By Type/Terms/Severity'), '-1050-by_employee_by_type_by_terms_by_severity+kpi+rating' => TTi18n::gettext('Review Summary By Employee/Type/Terms/Severity'), '-1060-by_type_by_terms_by_severity_by_employee+kpi+rating' => TTi18n::gettext('Review Summary By Type/Terms/Severity/Employee'), '-1070-by_employee+due_date' => TTi18n::gettext('Pending Reviews By Employee'));
             break;
         case 'template_config':
             $template = strtolower(Misc::trimSortPrefix($params['template']));
             if (isset($template) and $template != '') {
                 switch ($template) {
                     case 'by_employee_by_kpi+kpi+rating':
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'user_review_control.type';
                         $retval['columns'][] = 'user_review_control.due-date_stamp';
                         $retval['columns'][] = 'kpi.name';
                         $retval['columns'][] = 'user_review.rating';
                         $retval['columns'][] = 'user_review.note';
                         $retval['-2150-user_review_control_status_id'] = array(30);
                         $retval['-2160-user_review_control_type_id'] = array();
                         //Allow use to easily filter based on review type
                         $retval['sub_total'][] = 'user.full_name';
                         $retval['sub_total'][] = 'user_review_control.type';
                         $retval['sub_total'][] = 'user_review_control.due-date_stamp';
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         $retval['sort'][] = array('user_review_control.type' => 'asc');
                         $retval['sort'][] = array('user_review_control.due-date_stamp' => 'desc');
                         $retval['sort'][] = array('user_review.rating' => 'desc');
                         $retval['sort'][] = array('kpi.name' => 'asc');
                         break;
                     case 'by_kpi_by_employee+kpi+rating':
                         $retval['columns'][] = 'user_review_control.type';
                         $retval['columns'][] = 'kpi.name';
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'user_review.rating';
                         $retval['columns'][] = 'user_review.note';
                         $retval['-2150-user_review_control_status_id'] = array(30);
                         $retval['-2160-user_review_control_type_id'] = array();
                         //Allow use to easily filter based on review type
                         $retval['sub_total'][] = 'user_review_control.type';
                         $retval['sub_total'][] = 'kpi.name';
                         $retval['sort'][] = array('user_review_control.type' => 'asc');
                         $retval['sort'][] = array('kpi.name' => 'asc');
                         $retval['sort'][] = array('user_review.rating' => 'desc');
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         break;
                     case 'by_type_by_terms_by_severity+kpi+rating':
                         $retval['columns'][] = 'user_review_control.type';
                         $retval['columns'][] = 'user_review_control.term';
                         $retval['columns'][] = 'user_review_control.severity';
                         $retval['columns'][] = 'total_review';
                         $retval['-2150-user_review_control_status_id'] = array(30);
                         $retval['group'][] = 'user_review_control.type';
                         $retval['group'][] = 'user_review_control.term';
                         $retval['group'][] = 'user_review_control.severity';
                         $retval['sub_total'][] = 'user_review_control.type';
                         $retval['sub_total'][] = 'user_review_control.term';
                         $retval['sub_total'][] = 'user_review_control.severity';
                         $retval['sort'][] = array('user_review_control.type' => 'asc');
                         $retval['sort'][] = array('user_review_control.term' => 'asc');
                         $retval['sort'][] = array('user_review_control.severity' => 'desc');
                         break;
                     case 'by_employee_by_type_by_terms_by_severity+kpi+rating':
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'user_review_control.type';
                         $retval['columns'][] = 'user_review_control.term';
                         $retval['columns'][] = 'user_review_control.severity';
                         $retval['columns'][] = 'total_review';
                         $retval['columns'][] = 'user_review.rating';
                         $retval['-2150-user_review_control_status_id'] = array(30);
                         $retval['group'][] = 'user.full_name';
                         $retval['group'][] = 'user_review_control.type';
                         $retval['group'][] = 'user_review_control.term';
                         $retval['group'][] = 'user_review_control.severity';
                         $retval['sub_total'][] = 'user.full_name';
                         $retval['sub_total'][] = 'user_review_control.type';
                         $retval['sub_total'][] = 'user_review_control.term';
                         $retval['sub_total'][] = 'user_review_control.severity';
                         $retval['sort'][] = array('user.full_name' => 'asc');
                         $retval['sort'][] = array('user_review_control.type' => 'asc');
                         $retval['sort'][] = array('user_review_control.term' => 'asc');
                         $retval['sort'][] = array('user_review_control.severity' => 'desc');
                         break;
                     case 'by_type_by_terms_by_severity_by_employee+kpi+rating':
                         $retval['columns'][] = 'user_review_control.type';
                         $retval['columns'][] = 'user_review_control.term';
                         $retval['columns'][] = 'user_review_control.severity';
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'total_review';
                         $retval['columns'][] = 'user_review.rating';
                         $retval['-2150-user_review_control_status_id'] = array(30);
                         $retval['group'][] = 'user_review_control.type';
                         $retval['group'][] = 'user_review_control.term';
                         $retval['group'][] = 'user_review_control.severity';
                         $retval['group'][] = 'user.full_name';
                         $retval['sub_total'][] = 'user_review_control.type';
                         $retval['sub_total'][] = 'user_review_control.term';
                         $retval['sub_total'][] = 'user_review_control.severity';
                         $retval['sort'][] = array('user_review_control.type' => 'asc');
                         $retval['sort'][] = array('user_review_control.term' => 'asc');
                         $retval['sort'][] = array('user_review_control.severity' => 'desc');
                         $retval['sort'][] = array('total_review' => 'desc');
                         $retval['sort'][] = array('user_review.rating' => 'desc');
                         break;
                     case 'by_employee+due_date':
                         $retval['columns'][] = 'user.full_name';
                         $retval['columns'][] = 'user_review_control.type';
                         $retval['columns'][] = 'user_review_control.reviewer_user';
                         $retval['columns'][] = 'user_review_control.due-date_stamp';
                         $retval['-1010-time_period']['time_period'] = 'this_month';
                         $retval['-2150-user_review_control_status_id'] = array(10);
                         $retval['-2160-user_review_control_type_id'] = array();
                         //Allow use to easily filter based on review type
                         $retval['group'][] = 'user.full_name';
                         $retval['group'][] = 'user_review_control.type';
                         $retval['group'][] = 'user_review_control.reviewer_user';
                         $retval['group'][] = 'user_review_control.due-date_stamp';
                         $retval['sort'][] = array('user_review_control.due-date_stamp' => 'asc');
                         $retval['sort'][] = array('user_review_control.type_id' => 'asc');
                         $retval['sort'][] = array('user.full_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;
 }