/**
  * Get user generic status data for one or more .
  * @param array $data filter data
  * @return array
  */
 function getUserGenericStatus($data = NULL, $disable_paging = FALSE)
 {
     $data = $this->initializeFilterAndPager($data, $disable_paging);
     $user_id = $this->getCurrentUserObject()->getId();
     if ($data['filter_data']['batch_id'] != '') {
         $batch_id = $data['filter_data']['batch_id'];
         $ugslf = TTnew('UserGenericStatusListFactory');
         $ugslf->getByUserIdAndBatchId($user_id, $batch_id, $data['filter_items_per_page'], $data['filter_page'], NULL, $data['filter_sort']);
         Debug::Text('Record Count: ' . $ugslf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
         if ($ugslf->getRecordCount() > 0) {
             //$status_count_arr = $ugslf->getStatusCountArrayByUserIdAndBatchId( $user_id, $batch_id );
             $this->getProgressBarObject()->start($this->getAMFMessageID(), $ugslf->getRecordCount());
             $this->setPagerObject($ugslf);
             foreach ($ugslf as $ugs_obj) {
                 $rows[] = array('id' => $ugs_obj->getId(), 'user_id' => $ugs_obj->getUser(), 'batch_id' => $ugs_obj->getBatchId(), 'status_id' => $ugs_obj->getStatus(), 'status' => Option::getByKey($ugs_obj->getStatus(), $ugs_obj->getOptions('status')), 'label' => $ugs_obj->getLabel(), 'description' => $ugs_obj->getDescription(), 'link' => $ugs_obj->getLink(), 'deleted' => $ugs_obj->getDeleted());
                 $this->getProgressBarObject()->set($this->getAMFMessageID(), $ugslf->getCurrentRow());
             }
             $this->getProgressBarObject()->stop($this->getAMFMessageID());
             return $this->returnHandler($rows);
         } else {
             return $this->returnHandler(TRUE);
             //No records returned.
         }
     } else {
         return $this->returnHandler(TRUE);
         //No records returned.
     }
 }
예제 #2
0
             $day_total_time['total_time'] += $udt_obj->getTotalTime();
         }
         if ($filter_system_time != 1 and $udt_obj->getStatus() == 10) {
             continue;
         }
         if ($udt_obj->getJob() != FALSE) {
             $job = $job_options[$udt_obj->getJob()];
         } else {
             $job = 'No Job';
         }
         if ($udt_obj->getJobItem() != FALSE) {
             $job_item = $job_item_options[$udt_obj->getJobItem()];
         } else {
             $job_item = TTi18n::gettext('No Task');
         }
         $rows[] = array('id' => $udt_obj->getId(), 'status_id' => $udt_obj->getStatus(), 'status' => Option::getByKey($udt_obj->getStatus(), $udt_obj->getOptions('status')), 'type_id' => $udt_obj->getType(), 'type' => Option::getByKey($udt_obj->getType(), $udt_obj->getOptions('type')), 'branch_id' => $udt_obj->getBranch(), 'branch' => $branch_options[$udt_obj->getBranch()], 'department_id' => $udt_obj->getDepartment(), 'department' => $department_options[$udt_obj->getDepartment()], 'job_id' => $udt_obj->getJob(), 'job' => $job, 'job_item_id' => $udt_obj->getJobItem(), 'job_item' => $job_item, 'quantity' => (int) $udt_obj->getQuantity(), 'bad_quantity' => (int) $udt_obj->getBadQuantity(), 'absence_policy_id' => $udt_obj->getAbsencePolicyID(), 'absence_policy' => $absence_policy_options[$udt_obj->getAbsencePolicyID()], 'over_time_policy_id' => $udt_obj->getOverTimePolicyID(), 'over_time_policy' => $over_time_policy_options[$udt_obj->getOverTimePolicyID()], 'premium_policy_id' => $udt_obj->getPremiumPolicyID(), 'premium_policy' => $premium_policy_options[$udt_obj->getPremiumPolicyID()], 'total_time' => $udt_obj->getTotalTime(), 'override' => $udt_obj->getOverride(), 'deleted' => $udt_obj->getDeleted());
     }
     $day_total_time['difference'] = $day_total_time['worked_time'] - $day_total_time['total_time'];
     //var_dump($day_total_time);
     $user_options = UserListFactory::getByCompanyIdArray($current_company->getId(), FALSE);
     $smarty->assign_by_ref('user_options', $user_options);
     $smarty->assign_by_ref('rows', $rows);
     $smarty->assign_by_ref('day_total_time', $day_total_time);
     $smarty->assign_by_ref('user_date_id', $user_date_id);
     $smarty->assign_by_ref('filter_user_id', $user_id);
     $smarty->assign_by_ref('filter_date', $filter_date);
     $smarty->assign_by_ref('filter_system_time', $filter_system_time);
     $smarty->assign_by_ref('sort_column', $sort_column);
     $smarty->assign_by_ref('sort_order', $sort_order);
     $smarty->assign_by_ref('paging_data', $pager->getPageVariables());
 }
예제 #3
0
 foreach ($data_a as $pay_period_id => $data_b) {
     $rows[$x]['user_id'] = $user_obj->getId();
     $rows[$x]['full_name'] = $user_obj->getFullName(TRUE);
     $rows[$x]['employee_number'] = $user_obj->getEmployeeNumber();
     $rows[$x]['status'] = Option::getByKey($user_obj->getStatus(), $user_obj->getOptions('status'));
     //$rows[$x]['province'] = Option::getByKey($user_obj->getProvince(), $user_obj->getCompanyObject()->getOptions('province', $user_obj->getCountry() ) );
     //$rows[$x]['country'] = Option::getByKey($user_obj->getCountry(), $user_obj->getCompanyObject()->getOptions('country') );
     $rows[$x]['province'] = $user_obj->getProvince();
     $rows[$x]['country'] = $user_obj->getCountry();
     $rows[$x]['pay_period_id'] = $pay_period_id;
     $rows[$x]['pay_period_order'] = Option::getByKey($pay_period_id, $pay_period_end_dates, NULL);
     $rows[$x]['pay_period'] = Option::getByKey($pay_period_id, $pay_period_options, NULL);
     $rows[$x]['title'] = Option::getByKey($user_obj->getTitle(), $title_options, NULL);
     $rows[$x]['group'] = Option::getByKey($user_obj->getGroup(), $group_options, NULL);
     $rows[$x]['default_branch'] = Option::getByKey($user_obj->getDefaultBranch(), $branch_options, NULL);
     $rows[$x]['default_department'] = Option::getByKey($user_obj->getDefaultDepartment(), $department_options, NULL);
     if ($verified_time_sheets !== NULL and isset($verified_time_sheets[$user_id][$pay_period_id])) {
         if ($verified_time_sheets[$user_id][$pay_period_id] == 50) {
             $rows[$x]['verified_time_sheet'] = TTi18n::gettext('Yes');
         } elseif ($verified_time_sheets[$user_id][$pay_period_id] == 30 or $verified_time_sheets[$user_id][$pay_period_id] == 45) {
             $rows[$x]['verified_time_sheet'] = TTi18n::gettext('Pending');
         } else {
             $rows[$x]['verified_time_sheet'] = TTi18n::gettext('Declined');
         }
     } else {
         $rows[$x]['verified_time_sheet'] = TTi18n::gettext('No');
     }
     if (isset($pending_requests[$pay_period_id])) {
         $rows[$x]['pending_request'] = $pending_requests[$pay_period_id];
     } else {
         $rows[$x]['pending_request'] = 0;
예제 #4
0
 function getObjectAsArray($include_columns = NULL, $permission_children_ids = FALSE)
 {
     $uf = TTnew('UserFactory');
     $variable_function_map = $this->getVariableToFunctionMap();
     if (is_array($variable_function_map)) {
         foreach ($variable_function_map as $variable => $function_stub) {
             if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                 $function = 'get' . $function_stub;
                 switch ($variable) {
                     case 'first_name':
                     case 'last_name':
                         if ($this->getColumn('user_id') > 0) {
                             $data[$variable] = $this->getColumn($variable);
                         } else {
                             $data[$variable] = TTi18n::getText('OPEN');
                         }
                         break;
                     case 'user_id':
                         //Make sure getUser() returns the proper user_id, otherwise mass edit will always assign shifts to OPEN employee.
                         //We have to make sure the 'user_id' function map is FALSE as well, so we don't get a SQL error when getting the empty record set.
                         $data[$variable] = $this->tmp_data['user_id'] = $this->getColumn($variable);
                         break;
                     case 'user_status_id':
                     case 'group_id':
                     case 'group':
                     case 'title_id':
                     case 'title':
                     case 'default_branch_id':
                     case 'default_branch':
                     case 'default_department_id':
                     case 'default_department':
                     case 'schedule_policy_id':
                     case 'schedule_policy':
                     case 'pay_period_id':
                     case 'branch':
                     case 'department':
                     case 'job':
                     case 'job_item':
                         $data[$variable] = $this->getColumn($variable);
                         break;
                     case 'status':
                         $function = 'get' . $variable;
                         if (method_exists($this, $function)) {
                             $data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
                         }
                         break;
                     case 'user_status':
                         $data[$variable] = Option::getByKey((int) $this->getColumn('user_status_id'), $uf->getOptions('status'));
                         break;
                     case 'date_stamp':
                         $data[$variable] = TTDate::getAPIDate('DATE', strtotime($this->getColumn('date_stamp')));
                         break;
                     case 'start_date_stamp':
                         $data[$variable] = TTDate::getAPIDate('DATE', $this->getStartTime());
                         //Include both date+time
                         break;
                     case 'start_date':
                         $data[$variable] = TTDate::getAPIDate('DATE+TIME', $this->getStartTime());
                         //Include both date+time
                         break;
                     case 'end_date':
                         $data[$variable] = TTDate::getAPIDate('DATE+TIME', $this->getEndTime());
                         //Include both date+time
                         break;
                     case 'start_time_stamp':
                         $data[$variable] = $this->getStartTime();
                         //Include start date/time in epoch format for sorting...
                         break;
                     case 'end_time_stamp':
                         $data[$variable] = $this->getEndTime();
                         //Include end date/time in epoch format for sorting...
                         break;
                     case 'start_time':
                     case 'end_time':
                         if (method_exists($this, $function)) {
                             $data[$variable] = TTDate::getAPIDate('TIME', $this->{$function}());
                             //Just include time, so Mass Edit sees similar times without dates
                         }
                         break;
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
         }
         $this->getPermissionColumns($data, $this->getColumn('user_id'), $this->getCreatedBy(), $permission_children_ids, $include_columns);
         $this->getCreatedAndUpdatedColumns($data, $include_columns);
     }
     return $data;
 }
예제 #5
0
 function getAllArray()
 {
     $hlf = new HelpListFactory();
     $hlf->getAll();
     $help_list[0] = '--';
     foreach ($hlf as $help) {
         $help_list[$help->getID()] = '(' . $help->getID() . ') [' . Option::getByKey($help->getType(), $help->getOptions('type')) . '] ' . $help->getHeading();
     }
     return $help_list;
 }
예제 #6
0
         $plf = new PunchListFactory();
         //$plf->getByPunchControlId( $pc_obj->getId() );
         $plf->getById($id);
         if ($plf->getRecordCount() > 0) {
             $p_obj = $plf->getCurrent();
         } else {
             $punch_data = NULL;
         }
         //Get Station data.
         $station_data = FALSE;
         $slf = new StationListFactory();
         if ($p_obj->getStation() != FALSE) {
             $slf->getById($p_obj->getStation());
             if ($slf->getRecordCount() > 0) {
                 $s_obj = $slf->getCurrent();
                 $station_data = array('id' => $s_obj->getId(), 'type_id' => $s_obj->getType(), 'type' => Option::getByKey($s_obj->getType(), $s_obj->getOptions('type')), 'station_id' => $s_obj->getStation(), 'source' => $s_obj->getSource(), 'description' => Misc::TruncateString($s_obj->getDescription(), 20));
             }
         }
         $pc_data = array('id' => $pc_obj->getId(), 'user_date_id' => $pc_obj->getUserDateId(), 'user_id' => $pc_obj->getUserDateObject()->getUser(), 'user_full_name' => $pc_obj->getUserDateObject()->getUserObject()->getFullName(), 'pay_period_id' => $pc_obj->getUserDateObject()->getPayPeriod(), 'branch_id' => $pc_obj->getBranch(), 'department_id' => $pc_obj->getDepartment(), 'job_id' => $pc_obj->getJob(), 'job_item_id' => $pc_obj->getJobItem(), 'quantity' => (double) $pc_obj->getQuantity(), 'bad_quantity' => (double) $pc_obj->getBadQuantity(), 'note' => $pc_obj->getNote(), 'other_id1' => $pc_obj->getOtherID1(), 'other_id2' => $pc_obj->getOtherID2(), 'other_id3' => $pc_obj->getOtherID3(), 'other_id4' => $pc_obj->getOtherID4(), 'other_id5' => $pc_obj->getOtherID5(), 'punch_id' => $p_obj->getId(), 'status_id' => $p_obj->getStatus(), 'type_id' => $p_obj->getType(), 'station_id' => $p_obj->getStation(), 'station_data' => $station_data, 'time_stamp' => $p_obj->getTimeStamp(), 'date_stamp' => $p_obj->getTimeStamp(), 'original_time_stamp' => $p_obj->getOriginalTimeStamp(), 'actual_time_stamp' => $p_obj->getActualTimeStamp(), 'longitude' => $p_obj->getLongitude(), 'latitude' => $p_obj->getLatitude(), 'created_date' => $p_obj->getCreatedDate(), 'created_by' => $p_obj->getCreatedBy(), 'created_by_name' => (string) $ulf->getFullNameById($p_obj->getCreatedBy()), 'updated_date' => $p_obj->getUpdatedDate(), 'updated_by' => $p_obj->getUpdatedBy(), 'updated_by_name' => (string) $ulf->getFullNameById($p_obj->getUpdatedBy()), 'deleted_date' => $p_obj->getDeletedDate(), 'deleted_by' => $p_obj->getDeletedBy());
     }
 } elseif ($action != 'submit') {
     Debug::Text(' ID was NOT passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
     //UserID has to be set at minimum
     if ($punch_control_id != '') {
         Debug::Text(' Punch Control ID was passed: ' . $punch_control_id, __FILE__, __LINE__, __METHOD__, 10);
         //Get previous punch, and default timestamp to that.
         $plf = new PunchListFactory();
         $plf->getPreviousPunchByPunchControlID($punch_control_id);
         if ($plf->getRecordCount() > 0) {
             $prev_punch_obj = $plf->getCurrent();
             $time_stamp = $prev_punch_obj->getTimeStamp() + 3600;
 function getObjectTypeDisplay()
 {
     $object_type_ids = $this->getObjectType();
     $object_types = $this->getOptions('short_object_type');
     $retval = array();
     foreach ($object_type_ids as $object_type_id) {
         $retval[] = Option::getByKey($object_type_id, $object_types);
     }
     sort($retval);
     //Maintain consistent order.
     return implode(',', $retval);
 }
 function getObjectAsArray($include_columns = NULL)
 {
     $variable_function_map = $this->getVariableToFunctionMap();
     if (is_array($variable_function_map)) {
         foreach ($variable_function_map as $variable => $function_stub) {
             if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                 $function = 'get' . $function_stub;
                 switch ($variable) {
                     case 'status':
                         $function = 'get' . $variable;
                         if (method_exists($this, $function)) {
                             $data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
                         }
                         break;
                     case 'start_time':
                     case 'end_time':
                         //$data[$variable] = ( defined('TIMETREX_API') ) ? TTDate::getAPIDate( 'TIME', TTDate::strtotime( $this->$function() ) ) : $this->$function();
                         $data[$variable] = defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', TTDate::strtotime($this->{$function}())) : $this->{$function}();
                         //Need to include the raw_start_time,raw_end_time columns that are in EPOCH format so getShiftsByStartDateAndEndDate() can convert them as needed.
                         $data['raw_' . $variable] = $this->{$function}();
                         break;
                     case 'sun':
                     case 'mon':
                     case 'tue':
                     case 'wed':
                     case 'thu':
                     case 'fri':
                     case 'sat':
                         //For backwards compatibility, put all days inside the "days" array, AS WELL as in their own column for the API to use.
                         if (method_exists($this, $function)) {
                             $data['days'][$variable] = $this->{$function}();
                         }
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
         }
         $this->getCreatedAndUpdatedColumns($data, $include_columns);
     }
     return $data;
 }
 function _getData($format = NULL)
 {
     $this->tmp_data = array('schedule' => array(), 'user' => array(), 'total_shift' => array());
     $columns = $this->getColumnDataConfig();
     $filter_data = $this->getFilterConfig();
     if ($this->getPermissionObject()->Check('schedule', 'view') == FALSE or $this->getPermissionObject()->Check('wage', 'view') == FALSE) {
         $hlf = TTnew('HierarchyListFactory');
         $permission_children_ids = $wage_permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($this->getUserObject()->getCompany(), $this->getUserObject()->getID());
         Debug::Arr($permission_children_ids, 'Permission Children Ids:', __FILE__, __LINE__, __METHOD__, 10);
     } else {
         //Get Permission Hierarchy Children first, as this can be used for viewing, or editing.
         $permission_children_ids = array();
         $wage_permission_children_ids = array();
     }
     if ($this->getPermissionObject()->Check('schedule', 'view') == FALSE) {
         if ($this->getPermissionObject()->Check('schedule', 'view_child') == FALSE) {
             $permission_children_ids = array();
         }
         if ($this->getPermissionObject()->Check('schedule', 'view_own')) {
             $permission_children_ids[] = $this->getUserObject()->getID();
         }
         $filter_data['permission_children_ids'] = $permission_children_ids;
     }
     //Get Wage Permission Hierarchy Children first, as this can be used for viewing, or editing.
     if ($this->getPermissionObject()->Check('wage', 'view') == TRUE) {
         $wage_permission_children_ids = TRUE;
     } elseif ($this->getPermissionObject()->Check('wage', 'view') == FALSE) {
         if ($this->getPermissionObject()->Check('wage', 'view_child') == FALSE) {
             $wage_permission_children_ids = array();
         }
         if ($this->getPermissionObject()->Check('wage', 'view_own')) {
             $wage_permission_children_ids[] = $this->getUserObject()->getID();
         }
     }
     //Debug::Text(' Permission Children: '. count($permission_children_ids) .' Wage Children: '. count($wage_permission_children_ids), __FILE__, __LINE__, __METHOD__,10);
     //Debug::Arr($permission_children_ids, 'Permission Children: '. count($permission_children_ids), __FILE__, __LINE__, __METHOD__,10);
     //Debug::Arr($wage_permission_children_ids, 'Wage Children: '. count($wage_permission_children_ids), __FILE__, __LINE__, __METHOD__,10);
     if ($this->getUserObject()->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE) {
         $jlf = TTnew('JobListFactory');
         $job_status_options = $jlf->getOptions('status');
     } else {
         $job_status_options = array();
     }
     $pay_period_ids = array();
     if (strpos($format, 'schedule') === FALSE) {
         //Avoid running these queries when printing out the schedule.
         $slf = TTnew('ScheduleListFactory');
         $slf->getScheduleSummaryReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data, NULL, NULL, NULL, array('last_name' => 'asc'));
         //Sort by last name mainly for the PDF schedule for printing.
         Debug::Text(' Total Rows: ' . $slf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
         $this->getProgressBarObject()->start($this->getAMFMessageID(), $slf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
         if ($slf->getRecordCount() > 0) {
             foreach ($slf as $key => $s_obj) {
                 $hourly_rate = 0;
                 if ($wage_permission_children_ids === TRUE or in_array($s_obj->getColumn('user_id'), $wage_permission_children_ids)) {
                     $hourly_rate = $s_obj->getColumn('user_wage_hourly_rate');
                 }
                 $date_stamp_epoch = TTDate::strtotime($s_obj->getColumn('date_stamp'));
                 $shift_arr = array('user_id' => $s_obj->getColumn('user_id'), 'status_id' => $s_obj->getColumn('status_id'), 'group' => $s_obj->getColumn('group'), 'default_branch' => $s_obj->getColumn('default_branch'), 'default_department' => $s_obj->getColumn('default_department'), 'branch' => $s_obj->getColumn('branch'), 'department' => $s_obj->getColumn('department'), 'job' => $s_obj->getColumn('job'), 'job_status_id' => Option::getByKey($s_obj->getColumn('job_status_id'), $job_status_options, NULL), 'job_manual_id' => $s_obj->getColumn('job_manual_id'), 'job_description' => $s_obj->getColumn('job_description'), 'job_branch' => $s_obj->getColumn('job_branch'), 'job_department' => $s_obj->getColumn('job_department'), 'job_group' => $s_obj->getColumn('job_group'), 'job_item' => $s_obj->getColumn('job_item'), 'quantity' => $s_obj->getColumn('quantity'), 'bad_quantity' => $s_obj->getColumn('bad_quantity'), 'total_time' => $s_obj->getColumn('total_time'), 'total_time_wage' => Misc::MoneyFormat(bcmul(TTDate::getHours($s_obj->getColumn('total_time')), $hourly_rate), FALSE), 'total_time_wage_burden' => Misc::MoneyFormat(bcmul(TTDate::getHours($s_obj->getColumn('total_time')), bcmul($hourly_rate, bcdiv($s_obj->getColumn('user_labor_burden_percent'), 100))), FALSE), 'total_time_wage_with_burden' => Misc::MoneyFormat(bcmul(TTDate::getHours($s_obj->getColumn('total_time')), bcmul($hourly_rate, bcadd(bcdiv($s_obj->getColumn('user_labor_burden_percent'), 100), 1))), FALSE), 'other_id1' => $s_obj->getColumn('other_id1'), 'other_id2' => $s_obj->getColumn('other_id2'), 'other_id3' => $s_obj->getColumn('other_id3'), 'other_id4' => $s_obj->getColumn('other_id4'), 'other_id5' => $s_obj->getColumn('other_id5'), 'date_stamp' => $date_stamp_epoch, 'schedule_policy' => $s_obj->getColumn('schedule_policy'), 'absence_policy' => $s_obj->getColumn('absence_policy'), 'schedule_status' => Option::getByKey($s_obj->getStatus(), $s_obj->getOptions('status'), NULL), 'start_time' => TTDate::strtotime($s_obj->getColumn('start_time')), 'end_time' => TTDate::strtotime($s_obj->getColumn('end_time')), 'user_wage_id' => $s_obj->getColumn('user_wage_id'), 'hourly_rate' => Misc::MoneyFormat($hourly_rate, FALSE), 'pay_period_start_date' => strtotime($s_obj->getColumn('pay_period_start_date')), 'pay_period_end_date' => strtotime($s_obj->getColumn('pay_period_end_date')), 'pay_period_transaction_date' => strtotime($s_obj->getColumn('pay_period_transaction_date')), 'pay_period' => strtotime($s_obj->getColumn('pay_period_transaction_date')), 'pay_period_id' => $s_obj->getColumn('pay_period_id'), 'schedule_note' => $s_obj->getColumn('note'), 'total_shift' => 1);
                 unset($hourly_rate);
                 $this->tmp_data['schedule'][$s_obj->getColumn('user_id')][] = $shift_arr;
                 $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
             }
         }
         //Debug::Arr($this->tmp_data['schedule'], 'Schedule Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
         //Debug::Arr($this->form_data, 'Schedule Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
     }
     unset($filter_data['status_id']);
     //This is for schedule status, not user status.
     //If we're printing the schedule, make sure we include the required columns.
     if (in_array($format, $this->special_output_format)) {
         $this->config['columns_data']['first_name'] = TRUE;
         $this->config['columns_data']['last_name'] = TRUE;
     }
     //Get user data for joining.
     $ulf = TTnew('UserListFactory');
     $ulf->getAPISearchByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
     Debug::Text(' User Total Rows: ' . $ulf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
     $this->getProgressBarObject()->start($this->getAMFMessageID(), $ulf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
     foreach ($ulf as $key => $u_obj) {
         $this->tmp_data['user'][$u_obj->getId()] = $this->form_data['user'][$u_obj->getId()] = (array) $u_obj->getObjectAsArray($this->getColumnDataConfig());
         $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
     }
     //Add OPEN user to the list so it can printed on schedules.
     $this->tmp_data['user'][0] = $this->form_data['user'][0] = array('first_name' => TTi18n::getText('OPEN'), 'last_name' => '');
     //Debug::Arr($this->tmp_data['user'], 'User Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
     return TRUE;
 }
예제 #10
0
         }
         $af->FailTransaction();
     }
     Redirect::Page(URLBuilder::getURL(array('refresh' => TRUE), '../CloseWindow.php'));
     break;
 default:
     if ((int) $id > 0) {
         Debug::Text(' ID was passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
         $rlf = TTnew('RequestListFactory');
         $rlf->getByIDAndCompanyID($id, $current_company->getId());
         if ($rlf->getRecordCount() == 1) {
             foreach ($rlf as $r_obj) {
                 //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
                 $hierarchy_type_id = $r_obj->getHierarchyTypeID();
                 $type_id = $r_obj->getType();
                 $data = array('id' => $r_obj->getId(), 'user_date_id' => $r_obj->getId(), 'user_id' => $r_obj->getUserDateObject()->getUser(), 'user_full_name' => $r_obj->getUserDateObject()->getUserObject()->getFullName(), 'date_stamp' => $r_obj->getUserDateObject()->getDateStamp(), 'type' => Option::getByKey($r_obj->getType(), $rlf->getOptions('type')), 'type_id' => $r_obj->getType(), 'hierarchy_type_id' => $r_obj->getHierarchyTypeID(), 'status_id' => $r_obj->getStatus(), 'authorized' => $r_obj->getAuthorized(), 'created_date' => $r_obj->getCreatedDate(), 'created_by' => $r_obj->getCreatedBy(), 'updated_date' => $r_obj->getUpdatedDate(), 'updated_by' => $r_obj->getUpdatedBy(), 'deleted_date' => $r_obj->getDeletedDate(), 'deleted_by' => $r_obj->getDeletedBy());
             }
             //Get Next Request to authorize:
             if ($permission->Check('request', 'authorize') and $selected_level != NULL and count($request_queue_ids) <= 1) {
                 Debug::Text('Get Request Queue: ', __FILE__, __LINE__, __METHOD__, 10);
                 $ulf = TTnew('UserListFactory');
                 $hlf = TTnew('HierarchyListFactory');
                 $hllf = TTnew('HierarchyLevelListFactory');
                 $request_levels = $hllf->getLevelsAndHierarchyControlIDsByUserIdAndObjectTypeID($current_user->getId(), $hierarchy_type_id);
                 //Debug::Arr( $request_levels, 'Request Levels', __FILE__, __LINE__, __METHOD__,10);
                 if (isset($selected_level) and isset($request_levels[$selected_level])) {
                     $request_selected_level = $request_levels[$selected_level];
                     Debug::Text(' Switching Levels to Level: ' . key($request_selected_level), __FILE__, __LINE__, __METHOD__, 10);
                 } elseif (isset($request_levels[1])) {
                     $request_selected_level = $request_levels[1];
                 } else {
예제 #11
0
 $utlf->getByCompanyId($current_company->getId());
 $title_options = $utlf->getArrayByListFactory($utlf, FALSE, TRUE);
 $blf = new BranchListFactory();
 $blf->getByCompanyId($current_company->getId());
 $branch_options = $blf->getArrayByListFactory($blf, FALSE, TRUE);
 $dlf = new DepartmentListFactory();
 $dlf->getByCompanyId($current_company->getId());
 $department_options = $dlf->getArrayByListFactory($dlf, FALSE, TRUE);
 $uglf = new UserGroupListFactory();
 $group_options = $uglf->getArrayByNodes(FastTree::FormatArray($uglf->getByCompanyIdArray($current_company->getId()), 'TEXT', TRUE));
 $ulf = new UserListFactory();
 $user_options = $ulf->getByCompanyIdArray($current_company->getID(), FALSE);
 foreach ($plf as $p_obj) {
     //Debug::Text('Status ID: '. $r_obj->getStatus() .' Status: '. $status_options[$r_obj->getStatus()], __FILE__, __LINE__, __METHOD__,10);
     $user_obj = $ulf->getById($p_obj->getColumn('user_id'))->getCurrent();
     $rows[] = array('id' => $p_obj->getColumn('punch_id'), 'punch_control_id' => $p_obj->getPunchControlId(), 'user_id' => $p_obj->getColumn('user_id'), 'first_name' => $user_obj->getFirstName(), 'last_name' => $user_obj->getLastName(), 'title' => Option::getByKey($user_obj->getTitle(), $title_options), 'group' => Option::getByKey($user_obj->getGroup(), $group_options), 'default_branch' => Option::getByKey($user_obj->getDefaultBranch(), $branch_options), 'default_department' => Option::getByKey($user_obj->getDefaultDepartment(), $department_options), 'branch_id' => $p_obj->getColumn('branch_id'), 'branch' => Option::getByKey($p_obj->getColumn('branch_id'), $branch_options), 'department_id' => $p_obj->getColumn('department_id'), 'department' => Option::getByKey($p_obj->getColumn('department_id'), $department_options), 'status_id' => Option::getByKey($p_obj->getStatus(), $punch_status_options), 'type_id' => Option::getByKey($p_obj->getType(), $punch_type_options), 'date_stamp' => TTDate::getDate('DATE', TTDate::strtotime($p_obj->getColumn('date_stamp'))), 'job_id' => $p_obj->getColumn('job_id'), 'job_name' => $p_obj->getColumn('job_name'), 'job_group_id' => $p_obj->getColumn('job_group_id'), 'job_item_id' => $p_obj->getColumn('job_item_id'), 'time_stamp' => TTDate::getDate('DATE+TIME', $p_obj->getTimeStamp()), 'is_owner' => $permission->isOwner($p_obj->getCreatedBy(), $current_user->getId()), 'is_child' => $permission->isChild($p_obj->getColumn('user_id'), $permission_children_ids));
 }
 $smarty->assign_by_ref('rows', $rows);
 $all_array_option = array('-1' => TTi18n::gettext('-- Any --'));
 $ulf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data);
 $filter_data['user_options'] = Misc::prependArray($all_array_option, UserListFactory::getArrayByListFactory($ulf, FALSE, TRUE));
 //Select box options;
 $filter_data['branch_options'] = Misc::prependArray($all_array_option, $branch_options);
 $filter_data['department_options'] = Misc::prependArray($all_array_option, $department_options);
 $filter_data['title_options'] = Misc::prependArray($all_array_option, $title_options);
 $filter_data['group_options'] = Misc::prependArray($all_array_option, $group_options);
 $filter_data['status_options'] = Misc::prependArray($all_array_option, $ulf->getOptions('status'));
 $filter_data['pay_period_options'] = Misc::prependArray($all_array_option, $pay_period_options);
 $filter_data['punch_status_options'] = Misc::prependArray($all_array_option, $punch_status_options);
 $filter_data['punch_type_options'] = Misc::prependArray($all_array_option, $punch_type_options);
 $filter_data['saved_search_options'] = $ugdlf->getArrayByListFactory($ugdlf->getByUserIdAndScript($current_user->getId(), $_SERVER['SCRIPT_NAME']), FALSE);
 function addLog($log_action)
 {
     $object_type = Option::getByKey($this->getObjectType(), Misc::TrimSortPrefix($this->getOptions('object_type')));
     return TTLog::addEntry($this->getHierarchyControl(), $log_action, TTi18n::getText('Object') . ': ' . $object_type, NULL, $this->getTable());
 }
예제 #13
0
 function _getData($format = NULL)
 {
     $this->tmp_data = array('user' => array(), 'log' => array());
     $columns = $this->getColumnDataConfig();
     $filter_data = $this->getFilterConfig();
     if ($this->getPermissionObject()->Check('user', 'view') == FALSE) {
         $hlf = TTnew('HierarchyListFactory');
         $permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($this->getUserObject()->getCompany(), $this->getUserObject()->getID());
         Debug::Arr($permission_children_ids, 'Permission Children Ids:', __FILE__, __LINE__, __METHOD__, 10);
     } else {
         //Get Permission Hierarchy Children first, as this can be used for viewing, or editing.
         $permission_children_ids = array();
     }
     if ($this->getPermissionObject()->Check('user', 'view') == FALSE) {
         if ($this->getPermissionObject()->Check('user', 'view_child') == FALSE) {
             $permission_children_ids = array();
         }
         if ($this->getPermissionObject()->Check('user', 'view_own')) {
             $permission_children_ids[] = $this->getUserObject()->getID();
         }
         $filter_data['permission_children_ids'] = $permission_children_ids;
     }
     //Get user data for joining.
     $ulf = TTnew('UserListFactory');
     $ulf->getAPISearchByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
     Debug::Text(' User Rows: ' . $ulf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
     $this->getProgressBarObject()->start($this->getAMFMessageID(), $ulf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
     foreach ($ulf as $key => $u_obj) {
         $this->tmp_data['user'][$u_obj->getId()] = (array) $u_obj->getObjectAsArray($columns);
         $this->tmp_data['user'][$u_obj->getId()]['user_status'] = Option::getByKey($u_obj->getStatus(), $u_obj->getOptions('status'));
         $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
     }
     //Debug::Arr($this->tmp_data['user'], 'TMP User Data: ', __FILE__, __LINE__, __METHOD__,10);
     //Get system log data for joining.
     if (count($this->tmp_data['user']) > 0) {
         $filter_data['user_id'] = array_keys($this->tmp_data['user']);
         //Filter only selected users, otherwise too many rows can be returned that wont be displayed.
         $llf = TTnew('LogListFactory');
         $llf->getSearchByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data, 5000);
         Debug::Text(' Log Rows: ' . $llf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
         $this->getProgressBarObject()->start($this->getAMFMessageID(), $llf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
         foreach ($llf as $key => $l_obj) {
             $this->tmp_data['log'][$l_obj->getUser()][] = array_merge((array) $l_obj->getObjectAsArray($columns), array('total_log' => 1));
             $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
         }
         //Debug::Arr($this->tmp_data['log'], 'TMP Log Data: ', __FILE__, __LINE__, __METHOD__,10);
     }
     return TRUE;
 }
 function getArrayByListFactory($lf, $include_blank = TRUE, $include_disabled = TRUE)
 {
     if (!is_object($lf)) {
         return FALSE;
     }
     if ($include_blank == TRUE) {
         $list[0] = '--';
     }
     foreach ($lf as $obj) {
         if ($obj->getStatus() != 10) {
             $status = '(' . Option::getByKey($obj->getStatus(), $obj->getOptions('status')) . ') ';
         } else {
             $status = NULL;
         }
         if ($include_disabled == TRUE or $include_disabled == FALSE and $obj->getStatus() == 10) {
             $list[$obj->getID()] = $status . $obj->getName();
         }
     }
     if (isset($list)) {
         return $list;
     }
     return FALSE;
 }
예제 #15
0
 static function getMapURL($address1, $address2, $city, $province, $postal_code, $country, $service = 'google', $service_params = array())
 {
     if ($address1 == '' and $address2 == '') {
         return FALSE;
     }
     $url = NULL;
     //Expand the country code to the full country name?
     if (strlen($country) == 2) {
         $cf = TTnew('CompanyFactory');
         $long_country = Option::getByKey($country, $cf->getOptions('country'));
         if ($long_country != '') {
             $country = $long_country;
         }
     }
     if ($service == 'google') {
         $base_url = 'maps.google.com/?z=16&q=';
         $url = $base_url . urlencode($address1 . ' ' . $city . ' ' . $province . ' ' . $postal_code . ' ' . $country);
     }
     if ($url != '') {
         return 'http://' . $url;
     }
     return FALSE;
 }
         } else {
             //Delete exceptions that aren't part of the product.
             Debug::Text('Deleting exception outside product edition: ' . $ep_obj->getID(), __FILE__, __LINE__, __METHOD__, 10);
             $ep_obj->setDeleted(TRUE);
             if ($ep_obj->isValid()) {
                 $ep_obj->Save();
             }
         }
     }
 }
 $exceptions = array();
 if (isset($type_options) and is_array($type_options) and count($type_options) > 0) {
     foreach ($type_options as $exception_type => $exception_name) {
         if (isset($ep_objs[$exception_type])) {
             $ep_obj = $ep_objs[$exception_type];
             $exceptions[$ep_obj->getType()] = array('id' => $ep_obj->getId(), 'active' => $ep_obj->getActive(), 'type_id' => $ep_obj->getType(), 'name' => Option::getByKey($ep_obj->getType(), $type_options), 'severity_id' => $ep_obj->getSeverity(), 'email_notification_id' => $ep_obj->getEmailNotification(), 'demerit' => $ep_obj->getDemerit(), 'grace' => (int) $ep_obj->getGrace(), 'is_enabled_grace' => $ep_obj->isEnabledGrace($ep_obj->getType()), 'watch_window' => (int) $ep_obj->getWatchWindow(), 'is_enabled_watch_window' => $ep_obj->isEnabledWatchWindow($ep_obj->getType()));
         }
     }
     unset($exception_name);
 }
 //var_dump($type_options, $ep_objs,$exceptions);
 /*
 				$eplf = new ExceptionPolicyListFactory();
 				$eplf->getByExceptionPolicyControlID( $id );
 				if ( $eplf->getRecordCount() > 0 ) {
 					foreach( $eplf as $ep_obj ) {
 						if ( isset($type_options[$ep_obj->getType()]) ) {
 							$exceptions[$ep_obj->getType()] = array(
 																	'id' => $ep_obj->getId(),
 																	'active' => $ep_obj->getActive(),
 																	'type_id' => $ep_obj->getType(),
예제 #17
0
 }
 $punch_type_options = $plf->getOptions('type');
 $plf->getLastPunchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data);
 if ($plf->getRecordCount() > 0) {
     foreach ($plf as $p_obj) {
         //Get user info
         $ulf->getById($p_obj->getColumn('user_id'));
         if ($ulf->getRecordCount() > 0) {
             $user_obj = $ulf->getCurrent();
             /*
             						                                                       {if $permission->Check('punch','view') OR ( $permission->Check('punch','view_child') AND $user.is_child === TRUE ) OR ( $permission->Check('punch','view_own') AND $user.is_owner === TRUE ) }
                                                                             {assign var="user_id" value=$user.id}
                                                                             [ <a href="{urlbuilder script="../timesheet/ViewUserTimeSheet.php" values="filter_data[user_id]=$user_id" merge="FALSE"}">{t}View{/t}</a> ]
                                                                     {/if}
             */
             $view_link = $rows[] = array('id' => $user_obj->GetId(), 'first_name' => $user_obj->getFirstName(), 'last_name' => $user_obj->getLastName(), 'employee_number' => $user_obj->getEmployeeNumber(), 'title' => Option::getByKey($user_obj->getTitle(), $title_options), 'province' => $user_obj->getProvince(), 'country' => $user_obj->getCountry(), 'group' => Option::getByKey($user_obj->getGroup(), $group_options), 'default_branch' => Option::getByKey($user_obj->getDefaultBranch(), $branch_options), 'default_department' => Option::getByKey($user_obj->getDefaultDepartment(), $department_options), 'is_owner' => $permission->isOwner($user_obj->getCreatedBy(), $user_obj->getId()), 'is_child' => $permission->isChild($user_obj->getId(), $permission_children_ids), 'punch_id' => $p_obj->getId(), 'time_stamp' => $p_obj->getTimeStamp(), 'actual_time_stamp' => $p_obj->getActualTimeStamp(), 'status_id' => $p_obj->getStatus(), 'status' => Option::getByKey($p_obj->getStatus(), $p_obj->getOptions('status')), 'type_id' => $p_obj->getType(), 'type' => Option::getByKey($p_obj->getType(), $p_obj->getOptions('type')), 'branch_id' => $p_obj->getColumn('branch_id'), 'branch' => Option::getByKey($p_obj->getColumn('branch_id'), $branch_options), 'department_id' => $p_obj->getColumn('department_id'), 'department' => Option::getByKey($p_obj->getColumn('department_id'), $department_options), 'job_id' => $p_obj->getColumn('job_id'), 'job' => Option::getByKey($p_obj->getColumn('job_id'), $job_options), 'job_item_id' => $p_obj->getColumn('job_id'), 'job_item' => Option::getByKey($p_obj->getColumn('job_item_id'), $job_item_options), 'note' => $p_obj->getColumn('note'), 'station_type' => Option::getByKey($p_obj->getColumn('station_type_id'), $station_type_options), 'station_station_id' => $p_obj->getColumn('station_station_id'), 'station_source' => $p_obj->getColumn('station_source'), 'station_description' => Misc::TruncateString($p_obj->getColumn('station_description'), 30));
         }
     }
 }
 //print_r($rows);
 if (isset($rows)) {
     foreach ($rows as $row) {
         $tmp_rows[] = $row;
     }
     //var_dump($tmp_rows);
     $rows = Sort::Multisort($tmp_rows, Misc::trimSortPrefix($filter_data['primary_sort']), Misc::trimSortPrefix($filter_data['secondary_sort']), $filter_data['primary_sort_dir'], $filter_data['secondary_sort_dir']);
     //Convert units
     $tmp_rows = $rows;
     unset($rows);
     $trimmed_static_columns = array_keys(Misc::trimSortPrefix($static_columns));
     foreach ($tmp_rows as $row) {
예제 #18
0
        $pager = new Pager($mclf);
        if ($mclf->getRecordCount() > 0) {
            $object_name_options = $mclf->getOptions('object_name');
            foreach ($mclf as $message) {
                //Get user info
                $user_id = NULL;
                $user_full_name = NULL;
                if ($filter_folder_id == 10) {
                    //Inbox
                    $user_id = $message->getColumn('from_user_id');
                    $user_full_name = Misc::getFullName($message->getColumn('from_first_name'), $message->getColumn('from_middle_name'), $message->getColumn('from_last_name'));
                } else {
                    //Sent
                    $user_id = $message->getColumn('to_user_id');
                    $user_full_name = Misc::getFullName($message->getColumn('to_first_name'), $message->getColumn('to_middle_name'), $message->getColumn('to_last_name'));
                }
                $messages[] = array('id' => $message->getId(), 'parent_id' => $message->getParent(), 'object_type_id' => $message->getObjectType(), 'object_type' => Option::getByKey($message->getObjectType(), $object_name_options), 'object_id' => $message->getObject(), 'status_id' => $message->getStatus(), 'subject' => $message->getSubject(), 'body' => $message->getBody(), 'user_id' => $user_id, 'user_full_name' => $user_full_name, 'created_date' => $message->getCreatedDate(), 'created_by' => $message->getCreatedBy(), 'updated_date' => $message->getUpdatedDate(), 'updated_by' => $message->getUpdatedBy(), 'deleted_date' => $message->getDeletedDate(), 'deleted_by' => $message->getDeletedBy());
            }
        }
        $smarty->assign_by_ref('messages', $messages);
        $smarty->assign_by_ref('require_ack', $require_ack);
        $smarty->assign_by_ref('show_ack_column', $show_ack_column);
        $smarty->assign_by_ref('sort_column', $sort_column);
        $smarty->assign_by_ref('sort_order', $sort_order);
        $smarty->assign_by_ref('paging_data', $pager->getPageVariables());
        break;
}
$smarty->assign_by_ref('mf', $mf);
$smarty->assign_by_ref('folder_options', $folder_options);
$smarty->assign_by_ref('filter_folder_id', $filter_folder_id);
$smarty->display('message/UserMessageList.tpl');
예제 #19
0
         				if ( $u_obj->getFingerPrint3() != '' ) {
         					$display_finger_print_3 = 'Yes';
         				}
         
         				$display_finger_print_4 = 'No';
         				if ( $u_obj->getFingerPrint4() != '' ) {
         					$display_finger_print_4 = 'Yes';
         				}
         */
         $sin_number = NULL;
         if ($permission->Check('user', 'view_sin') == TRUE) {
             $sin_number = $u_obj->getSIN();
         } else {
             $sin_number = $u_obj->getSecureSIN();
         }
         $row_arr = array('id' => $u_obj->getId(), 'employee_number' => $u_obj->getEmployeeNumber(), 'status' => Option::getByKey($u_obj->getStatus(), $u_obj->getOptions('status')), 'user_name' => $u_obj->getUserName(), 'phone_id' => $u_obj->getPhoneID(), 'ibutton_id' => $u_obj->getIButtonID(), 'first_name' => $u_obj->getFirstName(), 'middle_name' => $u_obj->getMiddleName(), 'last_name' => $u_obj->getLastName(), 'full_name' => $u_obj->getFullName(TRUE), 'title' => Option::getByKey($u_obj->getTitle(), $user_titles), 'group' => Option::getByKey($u_obj->getGroup(), $group_options), 'default_branch' => Option::getByKey($u_obj->getDefaultBranch(), $branch_options), 'default_department' => Option::getByKey($u_obj->getDefaultDepartment(), $department_options), 'permission_control' => Option::getByKey($permission_control_id, $permission_control_options), 'policy_group' => Option::getByKey($policy_group_id, $policy_group_options), 'pay_period_schedule' => Option::getByKey($pay_period_schedule_id, $pay_period_schedule_options), 'sex' => Option::getByKey($u_obj->getSex(), $u_obj->getOptions('sex')), 'address1' => $u_obj->getAddress1(), 'address2' => $u_obj->getAddress2(), 'city' => $u_obj->getCity(), 'province' => $u_obj->getProvince(), 'country' => $u_obj->getCountry(), 'postal_code' => $u_obj->getPostalCode(), 'work_phone' => $u_obj->getWorkPhone(), 'work_phone_ext' => $u_obj->getWorkPhoneExt(), 'home_phone' => $u_obj->getHomePhone(), 'mobile_phone' => $u_obj->getMobilePhone(), 'fax_phone' => $u_obj->getFaxPhone(), 'home_email' => $u_obj->getHomeEmail(), 'work_email' => $u_obj->getWorkEmail(), 'birth_date' => $u_obj->getBirthDate(), 'sin' => $sin_number, 'hire_date' => $u_obj->getHireDate(), 'termination_date' => $u_obj->getTerminationDate(), 'note' => $u_obj->getNote(), 'other_id1' => $u_obj->getColumn('other_id1'), 'other_id2' => $u_obj->getColumn('other_id2'), 'other_id3' => $u_obj->getColumn('other_id3'), 'other_id4' => $u_obj->getColumn('other_id4'), 'other_id5' => $u_obj->getColumn('other_id5'), 'institution' => $u_obj->getColumn('institution'), 'transit' => $u_obj->getColumn('transit'), 'account' => $bf->getSecureAccount($u_obj->getColumn('account')), 'currency' => Option::getByKey($u_obj->getCurrency(), $currency_options), 'wage_type' => $user_wage_data['type'], 'wage' => $user_wage_data['wage'], 'effective_date' => $user_wage_data['effective_date']);
         if (isset($user_deduction[$u_obj->getId()])) {
             $row_arr = Misc::prependArray($row_arr, $user_deduction[$u_obj->getId()]);
         }
         if (isset($user_pref_data)) {
             $row_arr = Misc::prependArray($row_arr, $user_pref_data);
         }
         $tmp_rows[] = $row_arr;
         unset($user_pref_data);
     }
     $tmp_rows = Sort::Multisort($tmp_rows, Misc::trimSortPrefix($filter_data['primary_sort']), Misc::trimSortPrefix($filter_data['secondary_sort']), $filter_data['primary_sort_dir'], $filter_data['secondary_sort_dir']);
 } else {
     //No Users!
 }
 if (isset($tmp_rows)) {
     foreach ($tmp_rows as $tmp_row) {
예제 #20
0
         $filter_data['pay_period_ids'][] = Misc::trimSortPrefix($filter_pay_period_id);
     }
     unset($key, $tmp_filter_pay_period_ids, $filter_pay_period_id);
 }
 $ulf = TTnew('UserListFactory');
 $llf = TTnew('LogListFactory');
 $log_action_options = $llf->getOptions('action');
 $log_table_name_options = $llf->getOptions('table_name');
 //5000 row limit.
 $llf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data, 5000);
 if ($llf->getRecordCount() > 0) {
     $x = 0;
     foreach ($llf as $l_obj) {
         $user_obj = $ulf->getById($l_obj->getUser())->getCurrent();
         $tmp_action = Option::getByKey($l_obj->getAction(), $log_action_options);
         $table_name = Option::getByKey($l_obj->getTableName(), $log_table_name_options);
         if ($tmp_action != '' and $table_name != '') {
             $link = $l_obj->getLink();
             if ($link !== FALSE) {
                 $function = '<a href="' . $link . '" target="_blank">View</a>';
             } else {
                 $function = NULL;
             }
             $rows[$x] = array('user_id' => $l_obj->getUser(), 'full_name' => $user_obj->getFullName(), 'action_id' => $l_obj->getAction(), 'action' => $tmp_action, 'table_name_id' => $l_obj->getTableName(), 'table_name' => $table_name, 'date' => TTDate::getDate('DATE+TIME', $l_obj->getDate()), 'description' => $l_obj->getDescription(), 'function' => $function);
         } else {
             Debug::Text('Skipping Action: ' . $l_obj->getAction() . ' or Table Name: ' . $l_obj->getTableName(), __FILE__, __LINE__, __METHOD__, 10);
         }
         unset($tmp_action);
         $x++;
     }
 }
 function getObjectAsArray($include_columns = NULL)
 {
     $variable_function_map = $this->getVariableToFunctionMap();
     if (is_array($variable_function_map)) {
         foreach ($variable_function_map as $variable => $function_stub) {
             if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                 $function = 'get' . $function_stub;
                 switch ($variable) {
                     case 'type':
                         $function = 'get' . str_replace('_', '', $variable);
                         if (method_exists($this, $function)) {
                             $data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
                         }
                         break;
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
         }
         $this->getCreatedAndUpdatedColumns(&$data, $include_columns);
     }
     return $data;
 }
예제 #22
0
                foreach ($clf as $c_obj) {
                    $c_obj->setDeleted($delete);
                    if ($c_obj->isValid()) {
                        $c_obj->Save();
                    }
                }
            }
        }
        Redirect::Page(URLBuilder::getURL(NULL, 'CurrencyList.php'));
        break;
    default:
        BreadCrumb::setCrumb($title);
        $clf = new CurrencyListFactory();
        $clf->getByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);
        $pager = new Pager($clf);
        $iso_code_options = $clf->getISOCodesArray();
        $base_currency = FALSE;
        foreach ($clf as $c_obj) {
            if ($c_obj->getBase() === TRUE) {
                $base_currency = TRUE;
            }
            $rows[] = array('id' => $c_obj->GetId(), 'status_id' => $c_obj->getStatus(), 'name' => $c_obj->getName(), 'iso_code' => $c_obj->getISOCode(), 'currency_name' => Option::getByKey($c_obj->getISOCode(), $iso_code_options), 'conversion_rate' => $c_obj->getConversionRate(), 'auto_update' => $c_obj->getAutoUpdate(), 'is_base' => $c_obj->getBase(), 'is_default' => $c_obj->getDefault(), 'deleted' => $c_obj->getDeleted());
        }
        $smarty->assign_by_ref('currencies', $rows);
        $smarty->assign_by_ref('base_currency', $base_currency);
        $smarty->assign_by_ref('sort_column', $sort_column);
        $smarty->assign_by_ref('sort_order', $sort_order);
        $smarty->assign_by_ref('paging_data', $pager->getPageVariables());
        break;
}
$smarty->display('currency/CurrencyList.tpl');
예제 #23
0
 $pdf->Cell(10, 6, $filter_data['year'], $border, 0, 'R');
 $pdf->setXY(122, 47);
 $pdf->Cell(45, 6, $current_company->getBusinessNumber(), $border, 0, 'R');
 $pdf->setXY(40, 56);
 $pdf->Cell(75, 6, $current_company->getAddress1() . ' ' . $current_company->getAddress2(), $border, 0, 'L');
 $pdf->setXY(122, 56);
 $pdf->Cell(45, 6, $current_company->getCity() . ', ' . $current_company->getProvince() . ' ' . $current_company->getPostalCode(), $border, 0, 'R');
 if (isset($lines_arr)) {
     //Line A
     $pdf->setXY(173, 69);
     $pdf->Cell(25, 6, Misc::getBeforeDecimal(Misc::MoneyFormat('0.00', FALSE)), $border, 0, 'R');
     $pdf->setXY(198, 69);
     $pdf->Cell(6, 6, Misc::getAfterDecimal(Misc::MoneyFormat('0.00', FALSE)), $border, 0, 'L');
     //State
     $pdf->setXY(174, 73);
     $pdf->Cell(30, 6, Option::getByKey($setup_data['state_id'], $state_options), $border, 0, 'R');
     //State Reporting Number
     $pdf->setXY(174, 77);
     $pdf->Cell(30, 6, $setup_data['state_report_number'], $border, 0, 'R');
     //Part1
     //Line1
     $pdf->setXY(173, 94);
     $pdf->Cell(25, 6, Misc::getBeforeDecimal(Misc::MoneyFormat($lines_arr['total']['p1_1'], FALSE)), $border, 0, 'R');
     $pdf->setXY(198, 94);
     $pdf->Cell(6, 6, Misc::getAfterDecimal(Misc::MoneyFormat($lines_arr['total']['p1_1'], FALSE)), $border, 0, 'L');
     //Line2
     $pdf->setXY(135, 106);
     $pdf->Cell(25, 6, Misc::getBeforeDecimal(Misc::MoneyFormat($lines_arr['total']['p1_2'], FALSE)), $border, 0, 'R');
     $pdf->setXY(160, 106);
     $pdf->Cell(6, 6, Misc::getAfterDecimal(Misc::MoneyFormat($lines_arr['total']['p1_2'], FALSE)), $border, 0, 'L');
     //Line3
예제 #24
0
 //Get Permission Hierarchy Children first, as this can be used for viewing, or editing.
 $hlf = new HierarchyListFactory();
 $permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId());
 $udlf = new UserDeductionListFactory();
 $udlf->getByCompanyIdAndUserId($current_company->getId(), $user_id);
 $pager = new Pager($udlf);
 $ulf->getByIdAndCompanyId($user_id, $current_company->getId());
 if ($ulf->getRecordCount() > 0) {
     $user_obj = $ulf->getCurrent();
     if (is_object($user_obj)) {
         $is_owner = $permission->isOwner($user_obj->getCreatedBy(), $user_obj->getID());
         $is_child = $permission->isChild($user_obj->getId(), $permission_children_ids);
         if ($permission->Check('user_tax_deduction', 'view') or $permission->Check('user_tax_deduction', 'view_own') and $is_owner === TRUE or $permission->Check('user_tax_deduction', 'view_child') and $is_child === TRUE) {
             foreach ($udlf as $ud_obj) {
                 $cd_obj = $ud_obj->getCompanyDeductionObject();
                 $rows[] = array('id' => $ud_obj->getId(), 'status_id' => $cd_obj->getStatus(), 'user_id' => $ud_obj->getUser(), 'name' => $cd_obj->getName(), 'type_id' => $cd_obj->getType(), 'type' => Option::getByKey($cd_obj->getType(), $cd_obj->getOptions('type')), 'calculation' => Option::getByKey($cd_obj->getCalculation(), $cd_obj->getOptions('calculation')), 'is_owner' => $is_owner, 'is_child' => $is_child, 'deleted' => $ud_obj->getDeleted());
             }
         }
     }
 }
 $smarty->assign_by_ref('rows', $rows);
 $smarty->assign_by_ref('user_id', $user_id);
 $ulf = new UserListFactory();
 $filter_data = NULL;
 extract(UserGenericDataFactory::getSearchFormData($saved_search_id, NULL));
 if ($permission->Check('user_tax_deduction', 'view') == FALSE) {
     if ($permission->Check('user_tax_deduction', 'view_child')) {
         $filter_data['permission_children_ids'] = $permission_children_ids;
     }
     if ($permission->Check('user_tax_deduction', 'view_own')) {
         $filter_data['permission_children_ids'][] = $current_user->getId();
예제 #25
0
$hf = new HelpFactory();
switch ($action) {
    case 'submit':
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
    default:
        //Trim path off script name
        $split_script = explode('/', $script);
        $script = $split_script[count($split_script) - 1];
        $hlf = new HelpListFactory();
        //$hlf->getByScriptNameAndGroupName($script, NULL);
        $hlf->getByScriptNameAndStatus($script, 'ACTIVE');
        //$hlf->getById($id);
        $i = 0;
        foreach ($hlf as $help_obj) {
            //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
            if ($i > 0 and $prev_type != $help_obj->getType()) {
                $type_change = TRUE;
            } else {
                $type_change = FALSE;
            }
            $help_entries[] = array('id' => $help_obj->GetId(), 'type_id' => $help_obj->getType(), 'type' => Option::getByKey($help_obj->getType(), $help_obj->getOptions('type')), 'type_change' => $type_change, 'status_id' => $help_obj->getStatus(), 'status' => Option::getByKey($help_obj->getStatus(), $help_obj->getOptions('status')), 'heading' => $help_obj->getHeading(), 'body' => $help_obj->getBody(), 'keywords' => $help_obj->getKeywords(), 'private' => $help_obj->getPrivate(), 'created_date' => $help_obj->getCreatedDate(), 'created_by' => $help_obj->getCreatedBy(), 'updated_date' => $help_obj->getUpdatedDate(), 'updated_by' => $help_obj->getUpdatedBy(), 'deleted_date' => $help_obj->getDeletedDate(), 'deleted_by' => $help_obj->getDeletedBy(), 'deleted' => $help_obj->getDeleted());
            $prev_type = $help_obj->getType();
            $i++;
        }
        $smarty->assign_by_ref('help_entries', $help_entries);
        $smarty->assign_by_ref('title', $title);
        $smarty->assign_by_ref('SCRIPT_BASE_NAME', $script);
        break;
}
$smarty->assign_by_ref('hf', $hf);
$smarty->display('help/WindowViewHelp.tpl');
예제 #26
0
 function _getData($format = NULL)
 {
     $this->tmp_data = array('user' => array(), 'exception' => array());
     $columns = $this->getColumnDataConfig();
     $filter_data = $this->getFilterConfig();
     if ($this->getPermissionObject()->Check('punch', 'view') == FALSE) {
         $hlf = TTnew('HierarchyListFactory');
         $permission_children_ids = $wage_permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($this->getUserObject()->getCompany(), $this->getUserObject()->getID());
         Debug::Arr($permission_children_ids, 'Permission Children Ids:', __FILE__, __LINE__, __METHOD__, 10);
     } else {
         //Get Permission Hierarchy Children first, as this can be used for viewing, or editing.
         $permission_children_ids = array();
         $wage_permission_children_ids = array();
     }
     if ($this->getPermissionObject()->Check('punch', 'view') == FALSE) {
         if ($this->getPermissionObject()->Check('user', 'view_child') == FALSE) {
             $permission_children_ids = array();
         }
         if ($this->getPermissionObject()->Check('punch', 'view_own')) {
             $permission_children_ids[] = $this->getUserObject()->getID();
         }
         $filter_data['permission_children_ids'] = $permission_children_ids;
     }
     //Get user data for joining.
     $ulf = TTnew('UserListFactory');
     $ulf->getAPISearchByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
     Debug::Text(' User Rows: ' . $ulf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
     $this->getProgressBarObject()->start($this->getAMFMessageID(), $ulf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
     foreach ($ulf as $key => $u_obj) {
         $this->tmp_data['user'][$u_obj->getId()] = (array) $u_obj->getObjectAsArray($columns);
         $this->tmp_data['user'][$u_obj->getId()]['user_status'] = Option::getByKey($u_obj->getStatus(), $u_obj->getOptions('status'));
         $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
     }
     //Debug::Arr($this->tmp_data['user'], 'TMP User Data: ', __FILE__, __LINE__, __METHOD__,10);
     $columns['pay_period_start_date'] = $columns['pay_period_end_date'] = $columns['pay_period_transaction_date'] = TRUE;
     //Get Exception data for joining .
     $elf = TTnew('ExceptionListFactory');
     $elf->getAPISearchByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
     Debug::Text(' Exception Rows: ' . $elf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
     $this->getProgressBarObject()->start($this->getAMFMessageID(), $elf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
     foreach ($elf as $key => $e_obj) {
         $user_id = $e_obj->getColumn('user_id');
         $this->tmp_data['exception'][$user_id][$e_obj->getID()] = (array) $e_obj->getObjectAsArray(array_merge(array('date_stamp' => TRUE), $columns));
         $this->tmp_data['exception'][$user_id][$e_obj->getID()]['total_exception'] = 1;
         $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
     }
     //Debug::Arr($this->tmp_data['exception'], 'TMP Exception Data: ', __FILE__, __LINE__, __METHOD__,10);
     return TRUE;
 }
예제 #27
0
 function getObjectAsArray($include_columns = NULL)
 {
     $variable_function_map = $this->getVariableToFunctionMap();
     if (is_array($variable_function_map)) {
         foreach ($variable_function_map as $variable => $function_stub) {
             if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
                 $function = 'get' . $function_stub;
                 switch ($variable) {
                     case 'first_name':
                     case 'last_name':
                         $data[$variable] = $this->getColumn($variable);
                         break;
                     case 'code':
                         $function = 'get' . $variable;
                         if (method_exists($this, $function)) {
                             $data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
                         }
                         break;
                     case 'pay_period_type':
                         $ppsf = TTnew('PayPeriodScheduleFactory');
                         $data[$variable] = Option::getByKey($this->getPayPeriodType(), $ppsf->getOptions('type'));
                         break;
                     case 'first_date':
                         $data[$variable] = TTDate::getAPIDate('DATE', $this->getFirstDate());
                         break;
                     case 'last_date':
                         $data[$variable] = TTDate::getAPIDate('DATE', $this->getLastDate());
                         break;
                     case 'pay_period_end_date':
                         $data[$variable] = TTDate::getAPIDate('DATE', $this->getPayPeriodEndDate());
                         break;
                     case 'recall_date':
                         $data[$variable] = TTDate::getAPIDate('DATE', $this->getRecallDate());
                         break;
                     case 'insurable_earnings':
                         $data[$variable] = $this->getInsurableEarnings();
                         break;
                     case 'vacation_pay':
                         $data[$variable] = $this->getVacationPay();
                         break;
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
         }
         $this->getCreatedAndUpdatedColumns($data, $include_columns);
     }
     return $data;
 }
예제 #28
0
                 }
                 $rows[$x]['job_manual_id'] = $data_c['job_manual_id'];
                 $rows[$x]['job_status'] = Option::getByKey($data_c['job_status_id'], $job_status_options, NULL);
                 $rows[$x]['job_branch'] = Option::getByKey($data_c['job_branch_id'], $branch_options, NULL);
                 $rows[$x]['job_department'] = Option::getByKey($data_c['job_department_id'], $department_options, NULL);
                 $rows[$x]['job_group'] = Option::getByKey($data_c['job_group_id'], $job_group_options, NULL);
                 if (isset($job_item_options[$data_c['job_item_id']])) {
                     $rows[$x]['job_item'] = $job_item_options[$data_c['job_item_id']];
                 } else {
                     $rows[$x]['job_item'] = TTi18n::gettext('- No Task -');
                 }
                 $rows[$x]['type'] = Option::getByKey($data_c['type_id'], $schedule_type_options, NULL);
                 $rows[$x]['status'] = Option::getByKey($data_c['status_id'], $schedule_status_options, NULL);
                 $rows[$x]['start_time'] = $data_c['start_time'];
                 $rows[$x]['end_time'] = $data_c['end_time'];
                 $rows[$x]['absence_policy'] = Option::getByKey($data_c['absence_policy_id'], $absence_policy_options, NULL);
                 $rows[$x]['hourly_rate'] = $data_c['hourly_rate'];
                 $rows[$x]['total_time'] = $data_c['total_time'];
                 $rows[$x]['total_time_wage'] = $data_c['total_time_wage'];
                 $x++;
             }
         }
     }
 }
 //var_dump($rows);
 unset($tmp_rows);
 if (isset($rows) and isset($filter_data['primary_group_by']) and $filter_data['primary_group_by'] != '0') {
     Debug::Text('Primary Grouping Data By: ' . $filter_data['primary_group_by'], __FILE__, __LINE__, __METHOD__, 10);
     $ignore_elements = array_keys($static_columns);
     $filter_data['column_ids'] = array_diff($filter_data['column_ids'], $ignore_elements);
     //Add the group by element back in
예제 #29
0
 function _getData($format = NULL)
 {
     $this->tmp_data = array('user' => array(), 'user_preference' => array(), 'user_wage' => array(), 'user_bank' => array(), 'user_deduction' => array(), 'total_user' => array());
     $columns = $this->getColumnDataConfig();
     $filter_data = $this->getFilterConfig();
     $currency_convert_to_base = $this->getCurrencyConvertToBase();
     $base_currency_obj = $this->getBaseCurrencyObject();
     $this->handleReportCurrency($currency_convert_to_base, $base_currency_obj, $filter_data);
     $currency_options = $this->getOptions('currency');
     if ($this->getPermissionObject()->Check('user', 'view') == FALSE or $this->getPermissionObject()->Check('wage', 'view') == FALSE) {
         $hlf = TTnew('HierarchyListFactory');
         $permission_children_ids = $wage_permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($this->getUserObject()->getCompany(), $this->getUserObject()->getID());
         Debug::Arr($permission_children_ids, 'Permission Children Ids:', __FILE__, __LINE__, __METHOD__, 10);
     } else {
         //Get Permission Hierarchy Children first, as this can be used for viewing, or editing.
         $permission_children_ids = array();
         $wage_permission_children_ids = array();
     }
     if ($this->getPermissionObject()->Check('user', 'view') == FALSE) {
         if ($this->getPermissionObject()->Check('user', 'view_child') == FALSE) {
             $permission_children_ids = array();
         }
         if ($this->getPermissionObject()->Check('user', 'view_own')) {
             $permission_children_ids[] = $this->getUserObject()->getID();
         }
         $filter_data['permission_children_ids'] = $permission_children_ids;
     }
     //Get Wage Permission Hierarchy Children first, as this can be used for viewing, or editing.
     if ($this->getPermissionObject()->Check('wage', 'view') == TRUE) {
         $wage_permission_children_ids = TRUE;
     } elseif ($this->getPermissionObject()->Check('wage', 'view') == FALSE) {
         if ($this->getPermissionObject()->Check('wage', 'view_child') == FALSE) {
             $wage_permission_children_ids = array();
         }
         if ($this->getPermissionObject()->Check('wage', 'view_own')) {
             $wage_permission_children_ids[] = $this->getUserObject()->getID();
         }
     }
     //Debug::Text(' Permission Children: '. count($permission_children_ids) .' Wage Children: '. count($wage_permission_children_ids), __FILE__, __LINE__, __METHOD__,10);
     //Debug::Arr($permission_children_ids, 'Permission Children: '. count($permission_children_ids), __FILE__, __LINE__, __METHOD__,10);
     //Debug::Arr($wage_permission_children_ids, 'Wage Children: '. count($wage_permission_children_ids), __FILE__, __LINE__, __METHOD__,10);
     //Always include date columns, because 'hire-date_stamp' is not recognized by the UserFactory. This greatly slows down the report though.
     $columns['effective_date'] = $columns['hire_date'] = $columns['termination_date'] = $columns['birth_date'] = $columns['created_date'] = $columns['updated_date'] = TRUE;
     //Get user data for joining.
     $ulf = TTnew('UserListFactory');
     $ulf->getAPISearchByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
     Debug::Text(' User Rows: ' . $ulf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
     $this->getProgressBarObject()->start($this->getAMFMessageID(), $ulf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
     foreach ($ulf as $key => $u_obj) {
         //We used to just get return the entire $u_obj->data array, but this wouldn't include tags and other columns that required some additional processing.
         //Not sure why this was done that way... I think because we had problems with the multiple date fields (Hire Date/Termination Date/Birth Date, etc...)
         $this->tmp_data['user'][$u_obj->getId()] = (array) $u_obj->getObjectAsArray($columns);
         if ($currency_convert_to_base == TRUE and is_object($base_currency_obj)) {
             $this->tmp_data['user'][$u_obj->getId()]['currency_rate'] = $u_obj->getColumn('currency_rate');
         }
         $this->tmp_data['user'][$u_obj->getId()]['employee_number'] = isset($columns['employee_number']) ? $this->tmp_data['user'][$u_obj->getId()]['employee_number'] : $u_obj->getEmployeeNumber();
         if (isset($columns['employee_number_barcode'])) {
             $this->tmp_data['user'][$u_obj->getId()]['employee_number_barcode'] = new ReportCellBarcode($this, 'U' . $this->tmp_data['user'][$u_obj->getId()]['employee_number']);
         }
         if (isset($columns['employee_number_qrcode'])) {
             $this->tmp_data['user'][$u_obj->getId()]['employee_number_qrcode'] = new ReportCellQRcode($this, 'U' . $this->tmp_data['user'][$u_obj->getId()]['employee_number']);
         }
         $this->tmp_data['user_preference'][$u_obj->getId()] = array();
         $this->tmp_data['user_wage'][$u_obj->getId()] = array();
         $this->tmp_data['user'][$u_obj->getId()]['total_user'] = 1;
         $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
     }
     //Debug::Arr($this->tmp_data['user'], 'TMP User Data: ', __FILE__, __LINE__, __METHOD__,10);
     //Get user preference data for joining.
     $uplf = TTnew('UserPreferenceListFactory');
     $uplf->getAPISearchByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
     Debug::Text(' User Preference Rows: ' . $ulf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
     $this->getProgressBarObject()->start($this->getAMFMessageID(), $uplf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
     foreach ($uplf as $key => $up_obj) {
         $this->tmp_data['user_preference'][$up_obj->getUser()] = (array) $up_obj->getObjectAsArray($columns);
         $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
     }
     //Get user wage data for joining.
     $filter_data['wage_group_id'] = 0;
     //Use default wage groups only.
     $uwlf = TTnew('UserWageListFactory');
     $uwlf->getAPILastWageSearchByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
     Debug::Text(' User Wage Rows: ' . $uwlf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
     $this->getProgressBarObject()->start($this->getAMFMessageID(), $ulf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
     foreach ($uwlf as $key => $uw_obj) {
         if ($wage_permission_children_ids === TRUE or in_array($uw_obj->getUser(), $wage_permission_children_ids)) {
             $this->tmp_data['user_wage'][$uw_obj->getUser()] = (array) $uw_obj->getObjectAsArray($columns);
             if ($currency_convert_to_base == TRUE and is_object($base_currency_obj)) {
                 $this->tmp_data['user_wage'][$uw_obj->getUser()]['current_currency'] = Option::getByKey($base_currency_obj->getId(), $currency_options);
                 if (isset($this->tmp_data['user'][$uw_obj->getUser()]['currency_rate'])) {
                     $this->tmp_data['user_wage'][$uw_obj->getUser()]['hourly_rate'] = $base_currency_obj->getBaseCurrencyAmount($uw_obj->getHourlyRate(), $this->tmp_data['user'][$uw_obj->getUser()]['currency_rate'], $currency_convert_to_base);
                     $this->tmp_data['user_wage'][$uw_obj->getUser()]['wage'] = $base_currency_obj->getBaseCurrencyAmount($uw_obj->getWage(), $this->tmp_data['user'][$uw_obj->getUser()]['currency_rate'], $currency_convert_to_base);
                 }
             }
             $this->tmp_data['user_wage'][$uw_obj->getUser()]['effective_date'] = isset($this->tmp_data['user_wage'][$uw_obj->getUser()]['effective_date']) ? TTDate::parseDateTime($this->tmp_data['user_wage'][$uw_obj->getUser()]['effective_date']) : NULL;
         }
         $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
     }
     //Get user bank data for joining.
     $balf = TTnew('BankAccountListFactory');
     $balf->getAPISearchByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
     Debug::Text(' User Bank Rows: ' . $balf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
     $this->getProgressBarObject()->start($this->getAMFMessageID(), $balf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
     foreach ($balf as $key => $ba_obj) {
         $this->tmp_data['user_bank'][$ba_obj->getUser()] = (array) $ba_obj->getObjectAsArray($columns);
         $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
     }
     //Debug::Arr($this->tmp_data['user_preference'], 'TMP Data: ', __FILE__, __LINE__, __METHOD__,10);
     return TRUE;
 }
예제 #30
0
            }
            AccrualBalanceFactory::calcBalance($user_id, $accrual_policy_id);
        }
        $alf->CommitTransaction();
        Redirect::Page(URLBuilder::getURL(NULL, 'ViewUserAccrualList.php'));
        break;
    default:
        $alf = TTnew('AccrualListFactory');
        $alf->getByCompanyIdAndUserIdAndAccrualPolicyID($current_company->getId(), $user_id, $accrual_policy_id, $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);
        $pager = new Pager($alf);
        foreach ($alf as $a_obj) {
            $date_stamp = $a_obj->getColumn('date_stamp');
            if ($date_stamp != '') {
                $date_stamp = TTDate::strtotime($date_stamp);
            }
            $accruals[] = array('id' => $a_obj->getId(), 'user_id' => $a_obj->getUser(), 'accrual_policy_id' => $a_obj->getAccrualPolicyId(), 'type_id' => $a_obj->getType(), 'type' => Option::getByKey($a_obj->getType(), $a_obj->getOptions('type')), 'user_date_total_id' => $a_obj->getUserDateTotalId(), 'user_date_total_date_stamp' => $date_stamp, 'time_stamp' => $a_obj->getTimeStamp(), 'amount' => $a_obj->getAmount(), 'system_type' => $a_obj->isSystemType(), 'deleted' => $a_obj->getDeleted());
        }
        $smarty->assign_by_ref('accruals', $accruals);
        $ulf = TTnew('UserListFactory');
        $user_obj = $ulf->getById($user_id)->getCurrent();
        $aplf = TTnew('AccrualPolicyListFactory');
        $accrual_policy_obj = $aplf->getById($accrual_policy_id)->getCurrent();
        $smarty->assign_by_ref('user_id', $user_id);
        $smarty->assign_by_ref('user_full_name', $user_obj->getFullName());
        $smarty->assign_by_ref('accrual_policy_id', $accrual_policy_id);
        $smarty->assign_by_ref('accrual_policy', $accrual_policy_obj->getName());
        $smarty->assign_by_ref('sort_column', $sort_column);
        $smarty->assign_by_ref('sort_order', $sort_order);
        $smarty->assign_by_ref('paging_data', $pager->getPageVariables());
        break;
}