function parse_effective_date($input, $default_value = NULL, $parse_hint = NULL) { if (isset($parse_hint) and $parse_hint != '') { TTDate::setDateFormat($parse_hint); } return TTDate::parseDateTime($input); }
/** * Get all necessary dates for building the TimeSheet in a single call, this is mainly as a performance optimization. * @param array $data filter data * @return array */ function getTimeSheetDates($base_date) { $epoch = TTDate::parseDateTime($base_date); if ($epoch == '') { $epoch = TTDate::getTime(); } $start_date = TTDate::getBeginWeekEpoch($epoch, $this->getCurrentUserPreferenceObject()->getStartWeekDay()); $end_date = TTDate::getEndWeekEpoch($epoch, $this->getCurrentUserPreferenceObject()->getStartWeekDay()); $retarr = array('base_date' => $epoch, 'start_date' => $start_date, 'end_date' => $end_date, 'base_display_date' => TTDate::getAPIDate('DATE', $epoch), 'start_display_date' => TTDate::getAPIDate('DATE', $start_date), 'end_display_date' => TTDate::getAPIDate('DATE', $end_date)); return $retarr; }
*/ require_once '../../includes/global.inc.php'; require_once Environment::getBasePath() . 'includes/Interface.inc.php'; //Debug::setVerbosity(11); if (!$permission->Check('request', 'enabled') or !($permission->Check('request', 'edit') or $permission->Check('request', 'edit_own'))) { $permission->Redirect(FALSE); //Redirect } $smarty->assign('title', TTi18n::gettext($title = 'Edit Request')); // See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'id', 'data'))); if (isset($data)) { $data['date_stamp'] = TTDate::parseDateTime($data['date_stamp']); } $rf = new RequestFactory(); $action = Misc::findSubmitButton(); $action = strtolower($action); switch ($action) { case 'submit': //Debug::setVerbosity(11); Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); $rf->StartTransaction(); $rf->setId($data['id']); $rf->setUserDate($data['user_id'], $data['date_stamp']); $rf->setType($data['type_id']); $rf->setStatus(30); if ($rf->isNew()) { Debug::Text('Object is NEW!', __FILE__, __LINE__, __METHOD__, 10);
function setObjectFromArray($data) { if (is_array($data)) { $variable_function_map = $this->getVariableToFunctionMap(); foreach ($variable_function_map as $key => $function) { if (isset($data[$key])) { $function = 'set' . $function; switch ($key) { case 'first_date': $this->setFirstDate(TTDate::parseDateTime($data['first_date'])); break; case 'last_date': $this->setLastDate(TTDate::parseDateTime($data['last_date'])); break; case 'pay_period_end_date': $this->setPayPeriodEndDate(TTDate::parseDateTime($data['pay_period_end_date'])); break; case 'recall_date': $this->setRecallDate(TTDate::parseDateTime($data['recall_date'])); break; default: if (method_exists($this, $function)) { $this->{$function}($data[$key]); } break; } } } $this->setCreatedAndUpdatedColumns($data); return TRUE; } return FALSE; }
if ($permission->Check('schedule', 'view') == FALSE) { if ($permission->Check('schedule', 'view_child') == FALSE) { $permission_children_ids = array(); } if ($permission->Check('schedule', 'view_own')) { $permission_children_ids[] = $current_user->getId(); } $filter_data['permission_children_ids'] = $permission_children_ids; } $do = Misc::findSubmitButton('do'); switch ($do) { case 'view_schedule': default: $user_ids = array(); if ($filter_data['start_date'] != '' and $filter_data['show_days'] != '') { $start_date = $filter_data['start_date'] = TTDate::getBeginDayEpoch(TTDate::parseDateTime($filter_data['start_date'])); $end_date = $filter_data['end_date'] = $start_date + ($filter_data['show_days'] * 86400 - 3601); } else { $start_date = $filter_data['start_date'] = TTDate::getBeginWeekEpoch(TTDate::getTime(), $current_user_prefs->getStartWeekDay()); $end_date = $filter_data['end_date'] = $start_date + $filter_data['show_days'] * (86400 - 3601); } Debug::text(' Start Date: ' . TTDate::getDate('DATE+TIME', $start_date) . ' End Date: ' . TTDate::getDate('DATE+TIME', $end_date), __FILE__, __LINE__, __METHOD__, 10); $sf = TTnew('ScheduleFactory'); $raw_schedule_shifts = $sf->getScheduleArray($filter_data); if (is_array($raw_schedule_shifts)) { foreach ($raw_schedule_shifts as $day_epoch => $day_schedule_shifts) { foreach ($day_schedule_shifts as $day_schedule_shift) { $user_ids[] = $day_schedule_shift['user_id']; $day_schedule_shift['is_owner'] = $permission->isOwner($day_schedule_shift['user_created_by'], $day_schedule_shift['user_id']); $day_schedule_shift['is_child'] = $permission->isChild($day_schedule_shift['user_id'], $permission_children_ids); $tmp_schedule_shifts[$day_epoch][$day_schedule_shift['branch']][$day_schedule_shift['department']][] = $day_schedule_shift;
function setObjectFromArray($data) { if (is_array($data)) { $variable_function_map = $this->getVariableToFunctionMap(); foreach ($variable_function_map as $key => $function) { if (isset($data[$key])) { $function = 'set' . $function; switch ($key) { case 'start_date': case 'end_date': $this->{$function}(TTDate::parseDateTime($data[$key])); break; default: if (method_exists($this, $function)) { $this->{$function}($data[$key]); } break; } } } $this->setCreatedAndUpdatedColumns($data); return TRUE; } return FALSE; }
extract(FormVariables::GetVariables(array('action', 'id', 'pay_period_schedule_id', 'data'))); if (isset($data)) { if (isset($data['start_date'])) { $data['start_date'] = TTDate::parseDateTime($data['start_date']); } if (isset($data['end_date'])) { $data['end_date'] = TTDate::parseDateTime($data['end_date']); } if (isset($data['transaction_date'])) { $data['transaction_date'] = TTDate::parseDateTime($data['transaction_date']); } if (isset($data['advance_end_date'])) { $data['advance_end_date'] = TTDate::parseDateTime($data['advance_end_date']); } if (isset($data['advance_transaction_date'])) { $data['advance_transaction_date'] = TTDate::parseDateTime($data['advance_transaction_date']); } } $ppf = TTnew('PayPeriodFactory'); $action = Misc::findSubmitButton(); $action = strtolower($action); switch ($action) { case 'submit': //Debug::setVerbosity(11); Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); $ppf->StartTransaction(); if ($data['id'] == '') { $ppf->setCompany($current_company->getId()); $ppf->setStatus(10); //Open } else {
function createPremiumPolicy($company_id, $type) { $ppf = new PremiumPolicyFactory(); $ppf->setCompany($company_id); switch ($type) { case 10: //Simple weekend premium $ppf->setName('Weekend'); $ppf->setType(10); $ppf->setPayType(20); $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('12:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setMon(FALSE); $ppf->setTue(FALSE); $ppf->setWed(FALSE); $ppf->setThu(FALSE); $ppf->setFri(FALSE); $ppf->setSat(TRUE); $ppf->setSun(TRUE); $ppf->setRate('1.33'); //$1.33 per hour $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); break; case 20: //Simple evening premium $ppf->setName('Evening'); $ppf->setType(10); $ppf->setPayType(10); //Pay multiplied by factor $ppf->setIncludePartialPunch(TRUE); $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('5:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setMon(FALSE); $ppf->setTue(FALSE); $ppf->setWed(FALSE); $ppf->setThu(FALSE); $ppf->setFri(TRUE); $ppf->setSat(FALSE); $ppf->setSun(FALSE); $ppf->setWageGroup($this->user_wage_groups[0]); $ppf->setRate('1.50'); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 2')); break; } if ($ppf->isValid()) { $insert_id = $ppf->Save(); Debug::Text('Premium Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10); return $insert_id; } Debug::Text('Failed Creating Premium Policy!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
extract(FormVariables::GetVariables(array('action', 'id', 'pc_data', 'filter_user_id'))); $punch_full_time_stamp = NULL; if (isset($pc_data)) { if ($pc_data['start_date_stamp'] != '' and !is_numeric($pc_data['start_date_stamp']) and $pc_data['end_date_stamp'] != '' and !is_numeric($pc_data['end_date_stamp']) and $pc_data['time_stamp'] != '' and !is_numeric($pc_data['time_stamp'])) { $pc_data['start_punch_full_time_stamp'] = TTDate::parseDateTime($pc_data['start_date_stamp'] . ' ' . $pc_data['time_stamp']); $pc_data['end_punch_full_time_stamp'] = TTDate::parseDateTime($pc_data['end_date_stamp'] . ' ' . $pc_data['time_stamp']); $pc_data['time_stamp'] = TTDate::parseDateTime($pc_data['start_date_stamp'] . ' ' . $pc_data['time_stamp']); } else { $pc_data['start_punch_full_time_stamp'] = NULL; $pc_data['end_punch_full_time_stamp'] = NULL; } if ($pc_data['start_date_stamp'] != '') { $pc_data['start_date_stamp'] = TTDate::parseDateTime($pc_data['start_date_stamp']); } if ($pc_data['end_date_stamp'] != '') { $pc_data['end_date_stamp'] = TTDate::parseDateTime($pc_data['end_date_stamp']); } } //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()); $filter_data = array(); //Debug::Arr($permission_children_ids,'Permission Children Ids:', __FILE__, __LINE__, __METHOD__,10); if ($permission->Check('punch', 'edit') == FALSE) { if ($permission->Check('punch', 'edit_child')) { $filter_data['permission_children_ids'] = $permission_children_ids; } if ($permission->Check('punch', 'edit_own')) { $filter_data['permission_children_ids'][] = $current_user->getId(); } }
*/ require_once '../../includes/global.inc.php'; require_once Environment::getBasePath() . 'includes/Interface.inc.php'; if (!$permission->Check('pay_stub_amendment', 'enabled') or !($permission->Check('pay_stub_amendment', 'edit') or $permission->Check('pay_stub_amendment', 'edit_own'))) { $permission->Redirect(FALSE); //Redirect } $smarty->assign('title', TTi18n::gettext($title = 'Edit Pay Stub Amendment')); // See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'id', 'user_id', 'pay_stub_amendment_data'))); if (isset($pay_stub_amendment_data)) { if ($pay_stub_amendment_data['effective_date'] != '') { $pay_stub_amendment_data['effective_date'] = TTDate::parseDateTime($pay_stub_amendment_data['effective_date']); } } $psaf = TTnew('PayStubAmendmentFactory'); $action = Misc::findSubmitButton(); $action = strtolower($action); switch ($action) { case 'submit': //Debug::setVerbosity( 11 ); Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); $psaf->StartTransaction(); $fail_transaction = FALSE; if (isset($pay_stub_amendment_data['filter_user_id']) and is_array($pay_stub_amendment_data['filter_user_id']) and count($pay_stub_amendment_data['filter_user_id']) > 0) { foreach ($pay_stub_amendment_data['filter_user_id'] as $user_id) { $psaf->setId($pay_stub_amendment_data['id']); $psaf->setUser($user_id);
function getObjectAsArray($include_columns = NULL) { $uf = new 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 'user_id': case 'first_name': case 'last_name': 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': $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', TTDate::parseDateTime($this->getColumn('date_stamp'))); 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': 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->getCreatedAndUpdatedColumns(&$data, $include_columns); } return $data; }
function setObjectFromArray($data) { if (is_array($data)) { $variable_function_map = $this->getVariableToFunctionMap(); foreach ($variable_function_map as $key => $function) { if (isset($data[$key])) { $function = 'set' . $function; switch ($key) { /* case 'new_day_trigger_time': case 'maximum_shift_time': Debug::text('Raw Time Unit: '. $data[$key] .' Parsing To: '. TTDate::parseTimeUnit( $data[$key] ), __FILE__, __LINE__, __METHOD__, 10); if ( method_exists( $this, $function ) ) { $this->$function( TTDate::parseTimeUnit( $data[$key] ) ); } break; */ case 'anchor_date': if (method_exists($this, $function)) { $this->{$function}(TTDate::parseDateTime($data[$key])); } break; default: if (method_exists($this, $function)) { $this->{$function}($data[$key]); } break; } } } $this->setCreatedAndUpdatedColumns($data); return TRUE; } return FALSE; }
function setPunchData($data) { //Debug::Arr($data, 'punchDataArray', __FILE__, __LINE__, __METHOD__,10); /* <b>TimeTrexSoapServer::setPunchData()</b>: Data: <pre> array(10) { ["date_stamp"]=> string(9) "05-Nov-05" ["transfer"]=> int(0) ["branch_id"]=> string(1) "0" ["time_stamp"]=> string(7) "4:42 PM" ["user_date_id"]=> string(5) "14774" ["punch_control_id"]=> string(5) "26614" ["type_id"]=> string(2) "10" ["department_id"]=> string(1) "0" ["status_id"]=> string(2) "20" ["user_id"]=> string(1) "1" } </pre><br> */ //Debug::Arr($data, ' Data: ', __FILE__, __LINE__, __METHOD__,10); //User prefs should be set before we parse the date/time. $punch_full_time_stamp = TTDate::parseDateTime($data['date_stamp'] . ' ' . $data['time_stamp']); Debug::Text(' Punch Full TimeStamp: ' . date('r' . $punch_full_time_stamp) . ' (' . $punch_full_time_stamp . ') TimeZone: ' . $this->getUserObject()->getUserPreferenceObject()->getTimeZone(), __FILE__, __LINE__, __METHOD__, 10); $pf = new PunchFactory(); $pf->StartTransaction(); //Set User before setTimeStamp so rounding can be done properly. $pf->setUser($this->getUserObject()->getId()); if (isset($data['transfer']) and $data['transfer'] == 1) { Debug::Text(' Enabling Transfer!: ', __FILE__, __LINE__, __METHOD__, 10); $data['type_id'] = 10; $data['status_id'] = 10; $pf->setTransfer(TRUE); } $pf->setType($data['type_id']); $pf->setStatus($data['status_id']); $pf->setTimeStamp($punch_full_time_stamp); if (isset($data['status_id']) and $data['status_id'] == 20 and isset($data['punch_control_id']) and $data['punch_control_id'] != '') { $pf->setPunchControlID($data['punch_control_id']); } else { $pf->setPunchControlID($pf->findPunchControlID()); } $pf->setStation($this->getStationObject()->getId()); if ($pf->isNew()) { $pf->setActualTimeStamp($punch_full_time_stamp); $pf->setOriginalTimeStamp($pf->getTimeStamp()); } if ($pf->isValid() == TRUE) { $return_date = $pf->getTimeStamp(); if ($pf->getStatus() == 10) { $label = 'In'; } else { $label = 'Out'; } if ($pf->Save(FALSE) == TRUE) { $pcf = new PunchControlFactory(); $pcf->setId($pf->getPunchControlID()); $pcf->setPunchObject($pf); if (isset($data['branch_id']) and $data['branch_id'] != '') { $pcf->setBranch($data['branch_id']); } if (isset($data['department_id']) and $data['department_id'] != '') { $pcf->setDepartment($data['department_id']); } if (isset($data['job_id']) and $data['job_id'] != '') { $pcf->setJob($data['job_id']); } if (isset($data['job_item_id']) and $data['job_item_id'] != '') { $pcf->setJobItem($data['job_item_id']); } if (isset($data['quantity']) and $data['quantity'] != '') { $pcf->setQuantity($data['quantity']); } if (isset($data['bad_quantity']) and $data['bad_quantity'] != '') { $pcf->setBadQuantity($data['bad_quantity']); } //Don't overwrite note if a new one isn't set. This makes it more difficult to delete a note if they want to, //But thats better then accidently deleting it. if (isset($data['note']) and $data['note'] != '') { $pcf->setNote($data['note']); } if (isset($data['other_id1']) and $data['other_id1'] != '') { $pcf->setOtherID1($data['other_id1']); } if (isset($data['other_id2']) and $data['other_id2'] != '') { $pcf->setOtherID2($data['other_id2']); } if (isset($data['other_id3']) and $data['other_id3'] != '') { $pcf->setOtherID3($data['other_id3']); } if (isset($data['other_id4']) and $data['other_id4'] != '') { $pcf->setOtherID4($data['other_id4']); } if (isset($data['other_id5']) and $data['other_id5'] != '') { $pcf->setOtherID5($data['other_id5']); } //$pcf->setEnableStrictJobValidation( TRUE ); $pcf->setEnableCalcUserDateID(TRUE); $pcf->setEnableCalcTotalTime(TRUE); $pcf->setEnableCalcSystemTotalTime(TRUE); $pcf->setEnableCalcUserDateTotal(TRUE); $pcf->setEnableCalcException(TRUE); $pcf->setEnablePreMatureException(TRUE); //Enable pre-mature exceptions at this point. if ($pcf->isValid() == TRUE) { Debug::Text(' Punch Control is valid, saving...: ', __FILE__, __LINE__, __METHOD__, 10); if ($pcf->Save(TRUE, TRUE) == TRUE) { //Force isNew() lookup. Debug::text('Return Date: ' . $return_date, __FILE__, __LINE__, __METHOD__, 10); $retval = '<div style="font-size:28px; font-weight: bold"> <table> <tr> <td>' . $this->getUserObject()->getFullName() . '</td> </tr> <tr> <td> Punch ' . $label . ': ' . TTDate::getDate('TIME', $return_date) . ' </td> </tr> </table> </div>'; Debug::text('RetVal: ' . $retval, __FILE__, __LINE__, __METHOD__, 10); //Set stations last punch time stamp so we can filter out duplicates later on. //$pf->FailTransaction(); $pf->CommitTransaction(); return $retval; } else { Debug::text('Punch Control save failed!', __FILE__, __LINE__, __METHOD__, 10); } } else { Debug::text('Punch Control is NOT VALID!', __FILE__, __LINE__, __METHOD__, 10); } } else { Debug::text('Punch save failed!', __FILE__, __LINE__, __METHOD__, 10); } } else { Debug::text('Punch is NOT VALID: ', __FILE__, __LINE__, __METHOD__, 10); } $pf->FailTransaction(); Debug::text('Returning FALSE: Action Failed! ', __FILE__, __LINE__, __METHOD__, 10); //Get text errors to display to the user. $errors = NULL; if (isset($pf) and is_object($pf)) { $errors .= $pf->Validator->getErrors(); } if (isset($pcf) and is_object($pcf)) { $errors .= $pcf->Validator->getErrors(); } $errors = wordwrap($errors, 40, "<br>\n"); $retval = '<table bgcolor="red"> <tr> <td style="font-size:28px; font-weight: bold">Action Failed!</td> </tr> <tr> <td style="font-size:14px; font-weight: bold"> ' . $errors . ' </td> </tr> </table>'; return $retval; //return FALSE; }
function getAPISearchByCompanyIdAndArrayCriteria($company_id, $filter_data, $limit = NULL, $page = NULL, $where = NULL, $order = NULL) { if ($company_id == '') { return FALSE; } if (!is_array($order)) { //Use Filter Data ordering if its set. if (isset($filter_data['sort_column']) and $filter_data['sort_order']) { $order = array(Misc::trimSortPrefix($filter_data['sort_column']) => $filter_data['sort_order']); } } $additional_order_fields = array('date_stamp', 'user_status_id', 'last_name', 'first_name', 'default_branch', 'default_department', 'user_group', 'title'); $sort_column_aliases = array('status' => 'status_id', 'type' => 'type_id'); $order = $this->getColumnsFromAliases($order, $sort_column_aliases); if ($order == NULL) { $order = array('status_id' => 'asc', 'type_id' => 'asc', 'date_stamp' => 'desc'); $strict = FALSE; } else { //Always sort by last name,first name after other columns /* if ( !isset($order['effective_date']) ) { $order['effective_date'] = 'desc'; } */ $strict = TRUE; } //Debug::Arr($order,'Order Data:', __FILE__, __LINE__, __METHOD__,10); //Debug::Arr($filter_data,'Filter Data:', __FILE__, __LINE__, __METHOD__,10); $uf = new UserFactory(); $bf = new BranchFactory(); $df = new DepartmentFactory(); $ugf = new UserGroupFactory(); $utf = new UserTitleFactory(); $udf = new UserDateFactory(); $huf = new HierarchyUserFactory(); $ph = array('company_id' => $company_id); //Need to make this return DISTINCT records only, because if the same child is assigned to multiple hierarchies, //the join to table HUF will force it to return one row for each hierarchy they are a child of. This prevents that. $query = ' select DISTINCT a.*, b.first_name as first_name, b.last_name as last_name, b.country as country, b.province as province, udf.date_stamp as date_stamp, udf.user_id as user_id, c.id as default_branch_id, c.name as default_branch, d.id as default_department_id, d.name as default_department, e.id as user_group_id, e.name as user_group, f.id as title_id, f.name as title from ' . $this->getTable() . ' as a LEFT JOIN ' . $udf->getTable() . ' as udf ON ( a.user_date_id = udf.id AND udf.deleted = 0 ) LEFT JOIN ' . $uf->getTable() . ' as b ON ( udf.user_id = b.id AND b.deleted = 0 ) LEFT JOIN ' . $huf->getTable() . ' as huf ON ( udf.user_id = huf.user_id ) LEFT JOIN ' . $bf->getTable() . ' as c ON ( b.default_branch_id = c.id AND c.deleted = 0) LEFT JOIN ' . $df->getTable() . ' as d ON ( b.default_department_id = d.id AND d.deleted = 0) LEFT JOIN ' . $ugf->getTable() . ' as e ON ( b.group_id = e.id AND e.deleted = 0 ) LEFT JOIN ' . $utf->getTable() . ' as f ON ( b.title_id = f.id AND f.deleted = 0 ) where b.company_id = ? '; if (isset($filter_data['permission_children_ids']) and isset($filter_data['permission_children_ids'][0]) and !in_array(-1, (array) $filter_data['permission_children_ids'])) { $query .= ' AND udf.user_id in (' . $this->getListSQL($filter_data['permission_children_ids'], $ph) . ') '; } if (isset($filter_data['user_id']) and isset($filter_data['user_id'][0]) and !in_array(-1, (array) $filter_data['user_id'])) { $query .= ' AND udf.user_id in (' . $this->getListSQL($filter_data['user_id'], $ph) . ') '; } if (isset($filter_data['id']) and isset($filter_data['id'][0]) and !in_array(-1, (array) $filter_data['id'])) { $query .= ' AND a.id in (' . $this->getListSQL($filter_data['id'], $ph) . ') '; } if (isset($filter_data['exclude_id']) and isset($filter_data['exclude_id'][0]) and !in_array(-1, (array) $filter_data['exclude_id'])) { $query .= ' AND udf.user_id not in (' . $this->getListSQL($filter_data['exclude_id'], $ph) . ') '; } if (isset($filter_data['type_id']) and isset($filter_data['type_id'][0]) and !in_array(-1, (array) $filter_data['type_id'])) { $query .= ' AND a.type_id in (' . $this->getListSQL($filter_data['type_id'], $ph) . ') '; } if (isset($filter_data['status_id']) and isset($filter_data['status_id'][0]) and !in_array(-1, (array) $filter_data['status_id'])) { $query .= ' AND a.status_id in (' . $this->getListSQL($filter_data['status_id'], $ph) . ') '; } if (isset($filter_data['group_id']) and isset($filter_data['group_id'][0]) and !in_array(-1, (array) $filter_data['group_id'])) { if (isset($filter_data['include_subgroups']) and (bool) $filter_data['include_subgroups'] == TRUE) { $uglf = new UserGroupListFactory(); $filter_data['group_id'] = $uglf->getByCompanyIdAndGroupIdAndSubGroupsArray($company_id, $filter_data['group_id'], TRUE); } $query .= ' AND b.group_id in (' . $this->getListSQL($filter_data['group_id'], $ph) . ') '; } if (isset($filter_data['default_branch_id']) and isset($filter_data['default_branch_id'][0]) and !in_array(-1, (array) $filter_data['default_branch_id'])) { $query .= ' AND b.default_branch_id in (' . $this->getListSQL($filter_data['default_branch_id'], $ph) . ') '; } if (isset($filter_data['default_department_id']) and isset($filter_data['default_department_id'][0]) and !in_array(-1, (array) $filter_data['default_department_id'])) { $query .= ' AND b.default_department_id in (' . $this->getListSQL($filter_data['default_department_id'], $ph) . ') '; } if (isset($filter_data['title_id']) and isset($filter_data['title_id'][0]) and !in_array(-1, (array) $filter_data['title_id'])) { $query .= ' AND b.title_id in (' . $this->getListSQL($filter_data['title_id'], $ph) . ') '; } if (isset($filter_data['country']) and isset($filter_data['country'][0]) and !in_array(-1, (array) $filter_data['country'])) { $query .= ' AND b.country in (' . $this->getListSQL($filter_data['country'], $ph) . ') '; } if (isset($filter_data['province']) and isset($filter_data['province'][0]) and !in_array(-1, (array) $filter_data['province']) and !in_array('00', (array) $filter_data['province'])) { $query .= ' AND b.province in (' . $this->getListSQL($filter_data['province'], $ph) . ') '; } //Handle authorize list criteria here. if (isset($filter_data['authorized']) and isset($filter_data['authorized'][0]) and !in_array(-1, (array) $filter_data['authorized'])) { $query .= ' AND a.authorized in (' . $this->getListSQL($filter_data['authorized'], $ph) . ') '; } if (isset($filter_data['hierarchy_level_map']) and is_array($filter_data['hierarchy_level_map'])) { $query .= ' AND huf.id IS NOT NULL '; //Make sure the user maps to a hierarchy. $query .= ' AND ( ' . HierarchyLevelFactory::convertHierarchyLevelMapToSQL($filter_data['hierarchy_level_map'], 'a.', 'huf.', 'a.type_id') . ' )'; } elseif (isset($filter_data['hierarchy_level_map']) and $filter_data['hierarchy_level_map'] == FALSE) { //If hierarchy_level_map is not an array, don't return any requests. $query .= ' AND huf.id = -1 '; //Make sure the user maps to a hierarchy. } if (isset($filter_data['start_date']) and trim($filter_data['start_date']) != '') { $ph[] = $this->db->BindDate(TTDate::parseDateTime($filter_data['start_date'])); $query .= ' AND udf.date_stamp >= ?'; } if (isset($filter_data['end_date']) and trim($filter_data['end_date']) != '') { $ph[] = $this->db->BindDate(TTDate::parseDateTime($filter_data['end_date'])); $query .= ' AND udf.date_stamp <= ?'; } $query .= isset($filter_data['created_by']) ? $this->getWhereClauseSQL(array('a.created_by', 'y.first_name', 'y.last_name'), $filter_data['created_by'], 'user_id_or_name', $ph) : NULL; $query .= isset($filter_data['updated_by']) ? $this->getWhereClauseSQL(array('a.updated_by', 'z.first_name', 'z.last_name'), $filter_data['updated_by'], 'user_id_or_name', $ph) : NULL; $query .= ' AND a.deleted = 0 '; $query .= $this->getWhereSQL($where); $query .= $this->getSortSQL($order, $strict, $additional_order_fields); //Debug::Arr($ph,'Query: '. $query, __FILE__, __LINE__, __METHOD__,10); $this->ExecuteSQL($query, $ph, $limit, $page); return $this; }
$pay_period_ids[] = $pay_period_obj->getId(); $pay_period_end_dates[$pay_period_obj->getId()] = $pay_period_obj->getEndDate(); if ($pp == 0) { $default_transaction_start_date = $pay_period_obj->getEndDate(); $default_transaction_end_date = $pay_period_obj->getTransactionDate() + 86400; } $pp++; } $pplf = new PayPeriodListFactory(); $pay_period_options = $pplf->getByIdListArray($pay_period_ids, NULL, array('start_date' => 'desc')); } if (isset($filter_data['transaction_start_date'])) { $filter_data['transaction_start_date'] = TTDate::getBeginDayEpoch(TTDate::parseDateTime($filter_data['transaction_start_date'])); } if (isset($filter_data['transaction_end_date'])) { $filter_data['transaction_end_date'] = TTDate::getEndDayEpoch(TTDate::parseDateTime($filter_data['transaction_end_date'])); } $filter_data = Misc::preSetArrayValues($filter_data, array('include_user_ids', 'exclude_user_ids', 'user_status_ids', 'group_ids', 'branch_ids', 'department_ids', 'user_title_ids', 'currency_ids', 'pay_period_ids', 'column_ids'), array()); //Get Permission Hierarchy Children first, as this can be used for viewing, or editing. $permission_children_ids = array(); if ($permission->Check('pay_stub', 'view') == FALSE) { $hlf = new HierarchyListFactory(); $permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId()); Debug::Arr($permission_children_ids, 'Permission Children Ids:', __FILE__, __LINE__, __METHOD__, 10); if ($permission->Check('pay_stub', 'view_child') == FALSE) { $permission_children_ids = array(); } if ($permission->Check('pay_stub', 'view_own')) { $permission_children_ids[] = $current_user->getId(); } $filter_data['permission_children_ids'] = $permission_children_ids;
$pay_period_ids[] = $pay_period_obj->getId(); $pay_period_end_dates[$pay_period_obj->getId()] = $pay_period_obj->getEndDate(); if ($pp == 0) { $default_start_date = $pay_period_obj->getStartDate(); $default_end_date = $pay_period_obj->getEndDate(); } $pp++; } $pplf = TTnew('PayPeriodListFactory'); $pay_period_options = $pplf->getByIdListArray($pay_period_ids, NULL, array('start_date' => 'desc')); } if (isset($filter_data['start_date'])) { $filter_data['start_date'] = TTDate::getBeginDayEpoch(TTDate::parseDateTime($filter_data['start_date'])); } if (isset($filter_data['end_date'])) { $filter_data['end_date'] = TTDate::getEndDayEpoch(TTDate::parseDateTime($filter_data['end_date'])); } $filter_data = Misc::preSetArrayValues($filter_data, array('include_user_ids', 'exclude_user_ids', 'user_status_ids', 'group_ids', 'branch_ids', 'department_ids', 'schedule_branch_ids', 'schedule_department_ids', 'user_title_ids', 'pay_period_ids', 'include_job_ids', 'exclude_job_ids', 'job_branch_ids', 'job_department_ids', 'job_group_ids', 'client_ids', 'job_item_ids', 'job_item_group_ids', 'column_ids'), array()); //Get Permission Hierarchy Children first, as this can be used for viewing, or editing. $permission_children_ids = array(); $wage_permission_children_ids = array(); if ($permission->Check('user', 'view') == FALSE) { $hlf = TTnew('HierarchyListFactory'); $permission_children_ids = $wage_permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId()); Debug::Arr($permission_children_ids, 'Permission Children Ids:', __FILE__, __LINE__, __METHOD__, 10); if ($permission->Check('user', 'view_child') == FALSE) { $permission_children_ids = array(); } if ($permission->Check('user', 'view_own')) { $permission_children_ids[] = $current_user->getId(); }
require_once Environment::getBasePath() . 'includes/Interface.inc.php'; //Debug::setVerbosity(11); if (!$permission->Check('schedule', 'enabled') or !($permission->Check('schedule', 'view') or $permission->Check('schedule', 'view_own') or $permission->Check('schedule', 'view_child'))) { $permission->Redirect(FALSE); //Redirect } $smarty->assign('title', TTi18n::gettext($title = 'My Schedule')); // See index.php BreadCrumb::setCrumb($title, str_replace('ViewScheduleMonth.php', 'ViewSchedule.php', $_SERVER['REQUEST_URI'])); /* * Get FORM variables */ extract(FormVariables::GetVariables(array('do', 'page', 'sort_column', 'sort_order', 'filter_data'))); URLBuilder::setURL($_SERVER['SCRIPT_NAME'], array('sort_column' => $sort_column, 'sort_order' => $sort_order, 'page' => $page)); if (isset($filter_data['start_date']) and $filter_data['start_date'] != '') { $filter_data['start_date'] = TTDate::parseDateTime($filter_data['start_date']); } else { $filter_data['start_date'] = time(); } if (!isset($filter_data['show_days']) or isset($filter_data['show_days']) and $filter_data['show_days'] == '') { $filter_data['show_days'] = 1; } $filter_data['show_days'] = $filter_data['show_days'] * 7; //Get Permission Hierarchy Children first, as this can be used for viewing, or editing. $hlf = TTnew('HierarchyListFactory'); $permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId()); if ($permission->Check('schedule', 'view') == FALSE) { if ($permission->Check('schedule', 'view_child') == FALSE) { $permission_children_ids = array(); } if ($permission->Check('schedule', 'view_own')) {
require_once '../../includes/global.inc.php'; require_once Environment::getBasePath() . 'includes/Interface.inc.php'; //Debug::setVerbosity(11); if (!$permission->Check('user', 'enabled') or !$permission->Check('user', 'edit')) { $permission->Redirect(FALSE); //Redirect } $smarty->assign('title', TTi18n::gettext($title = 'New Hire Defaults')); // See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'id', 'user_data', 'data_saved'))); if (isset($user_data)) { if (isset($user_data['hire_date']) and $user_data['hire_date'] != '') { $user_data['hire_date'] = TTDate::parseDateTime($user_data['hire_date']); } } $uf = TTnew('UserFactory'); $upf = TTnew('UserPreferenceFactory'); $udlf = TTnew('UserDefaultListFactory'); $udf = TTnew('UserDefaultFactory'); $action = Misc::findSubmitButton(); switch ($action) { case 'submit': Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); //Debug::setVerbosity(11); if (isset($user_data['id']) and $user_data['id'] != '') { $udf->setId($user_data['id']); } $udf->setCompany($current_company->getId());
function parse_transaction_date($input, $default_value = NULL, $parse_hint = NULL, $raw_row = NULL) { if (isset($parse_hint) and $parse_hint != '') { TTDate::setDateFormat($parse_hint); return TTDate::parseDateTime($input); } else { return TTDate::strtotime($input); } }
//Redirect } $smarty->assign('title', TTi18n::gettext($title = 'Hour List')); // See index.php BreadCrumb::setCrumb($title); /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'page', 'sort_column', 'sort_order', 'filter_user_id', 'filter_date', 'filter_system_time', 'prev_day', 'next_day', 'prev_week', 'next_week', 'ids'))); if ($filter_user_id != '') { $user_id = $filter_user_id; } else { $user_id = $current_user->getId(); } if ($filter_date != '') { $filter_date = TTDate::getBeginDayEpoch(TTDate::parseDateTime($filter_date)); } if (isset($prev_day)) { $filter_date = TTDate::getBeginDayEpoch($filter_date - 86400); } elseif (isset($next_day)) { $filter_date = TTDate::getBeginDayEpoch($filter_date + 86400); } if (isset($prev_week)) { $filter_date = TTDate::getBeginDayEpoch($filter_date - 86400 * 7); } elseif (isset($next_week)) { $filter_date = TTDate::getBeginDayEpoch($filter_date + 86400 * 7); } //This must be below any filter_date modifications URLBuilder::setURL($_SERVER['SCRIPT_NAME'], array('filter_date' => $filter_date, 'filter_user_id' => $filter_user_id, 'filter_system_time' => $filter_system_time, 'sort_column' => $sort_column, 'sort_order' => $sort_order, 'page' => $page)); $sort_array = NULL; if ($sort_column != '') {
require_once '../../includes/global.inc.php'; require_once Environment::getBasePath() . 'includes/Interface.inc.php'; if (!$permission->Check('pay_period_schedule', 'enabled') or !($permission->Check('pay_period_schedule', 'edit') or $permission->Check('pay_period_schedule', 'edit_own'))) { $permission->Redirect(FALSE); //Redirect } $smarty->assign('title', TTi18n::gettext($title = 'Edit Pay Period Schedule')); // See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'id', 'user_id', 'pay_period_schedule_data'))); //var_dump($pay_period_schedule_data); if (isset($pay_period_schedule_data)) { if (isset($pay_period_schedule_data['anchor_date'])) { $pay_period_schedule_data['anchor_date'] = TTDate::parseDateTime($pay_period_schedule_data['anchor_date']); } if (isset($pay_period_schedule_data['day_start_time'])) { $pay_period_schedule_data['day_start_time'] = TTDate::parseTimeUnit($pay_period_schedule_data['day_start_time']); } if (isset($pay_period_schedule_data['new_day_trigger_time'])) { $pay_period_schedule_data['new_day_trigger_time'] = TTDate::parseTimeUnit($pay_period_schedule_data['new_day_trigger_time']); } if (isset($pay_period_schedule_data['maximum_shift_time'])) { $pay_period_schedule_data['maximum_shift_time'] = TTDate::parseTimeUnit($pay_period_schedule_data['maximum_shift_time']); } } //var_dump($pay_period_schedule_data); $ppsf = TTnew('PayPeriodScheduleFactory'); $action = Misc::findSubmitButton(); $action = strtolower($action);
function createPremiumPolicy($company_id, $type, $accrual_policy_id = NULL) { $ppf = new PremiumPolicyFactory(); $ppf->setCompany($company_id); switch ($type) { case 90: //Basic Min/Max only. $ppf->setName('Min/Max Only'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(NULL); $ppf->setEndDate(NULL); $ppf->setStartTime(NULL); $ppf->setEndTime(NULL); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMon(TRUE); $ppf->setTue(TRUE); $ppf->setWed(TRUE); $ppf->setThu(TRUE); $ppf->setFri(TRUE); $ppf->setSat(TRUE); $ppf->setSun(TRUE); $ppf->setIncludePartialPunch(TRUE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(3600); $ppf->setMaximumTime(7200); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setExcludeDefaultBranch( FALSE ); //$ppf->setExcludeDefaultDepartment( FALSE ); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 100: $ppf->setName('Start/End Date Only'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate($this->pay_period_objs[0]->getStartDate() + 86400); $ppf->setEndDate($this->pay_period_objs[0]->getStartDate() + 86400 * 3); //2nd & 3rd days. $ppf->setStartTime(TTDate::parseDateTime('12:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMon(TRUE); $ppf->setTue(TRUE); $ppf->setWed(TRUE); $ppf->setThu(TRUE); $ppf->setFri(TRUE); $ppf->setSat(TRUE); $ppf->setSun(TRUE); $ppf->setIncludePartialPunch(TRUE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setExcludeDefaultBranch( FALSE ); //$ppf->setExcludeDefaultDepartment( FALSE ); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 110: $ppf->setName('Start/End Date+Effective Days'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate($this->pay_period_objs[0]->getStartDate() + 86400); $ppf->setEndDate($this->pay_period_objs[0]->getStartDate() + 86400 * 3); //2nd & 3rd days. $ppf->setStartTime(TTDate::parseDateTime('12:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 1 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 1) { $ppf->setMon(TRUE); } else { $ppf->setMon(FALSE); } if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 2 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 2) { $ppf->setTue(TRUE); } else { $ppf->setTue(FALSE); } if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 3 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 3) { $ppf->setWed(TRUE); } else { $ppf->setWed(FALSE); } if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 4 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 4) { $ppf->setThu(TRUE); } else { $ppf->setThu(FALSE); } if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 5 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 5) { $ppf->setFri(TRUE); } else { $ppf->setFri(FALSE); } if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 6 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 6) { $ppf->setSat(TRUE); } else { $ppf->setSat(FALSE); } if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 0 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 0) { $ppf->setSun(TRUE); } else { $ppf->setSun(FALSE); } $ppf->setIncludePartialPunch(TRUE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setExcludeDefaultBranch( FALSE ); //$ppf->setExcludeDefaultDepartment( FALSE ); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 120: $ppf->setName('Time Based/Evening Shift w/Partial'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('7:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMon(TRUE); $ppf->setTue(TRUE); $ppf->setWed(TRUE); $ppf->setThu(TRUE); $ppf->setFri(TRUE); $ppf->setSat(TRUE); $ppf->setSun(TRUE); $ppf->setIncludePartialPunch(TRUE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setExcludeDefaultBranch( FALSE ); //$ppf->setExcludeDefaultDepartment( FALSE ); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 122: $ppf->setName('Time Based/Evening Shift w/Partial+Span Midnight'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('6:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('3:00 AM')); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMon(TRUE); $ppf->setTue(TRUE); $ppf->setWed(TRUE); $ppf->setThu(TRUE); $ppf->setFri(TRUE); $ppf->setSat(TRUE); $ppf->setSun(TRUE); $ppf->setIncludePartialPunch(TRUE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setExcludeDefaultBranch( FALSE ); //$ppf->setExcludeDefaultDepartment( FALSE ); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 123: $ppf->setName('Time Based/Weekend Day Shift w/Partial'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('7:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('7:00 PM')); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMon(FALSE); $ppf->setTue(FALSE); $ppf->setWed(FALSE); $ppf->setThu(FALSE); $ppf->setFri(FALSE); $ppf->setSat(TRUE); $ppf->setSun(TRUE); $ppf->setIncludePartialPunch(TRUE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setExcludeDefaultBranch( FALSE ); //$ppf->setExcludeDefaultDepartment( FALSE ); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 130: $ppf->setName('Time Based/Evening Shift w/o Partial'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('7:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMon(TRUE); $ppf->setTue(TRUE); $ppf->setWed(TRUE); $ppf->setThu(TRUE); $ppf->setFri(TRUE); $ppf->setSat(TRUE); $ppf->setSun(TRUE); $ppf->setIncludePartialPunch(FALSE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setExcludeDefaultBranch( FALSE ); //$ppf->setExcludeDefaultDepartment( FALSE ); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 132: $ppf->setName('Time Based/Evening Shift w/o Partial+Span Midnight'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('6:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('3:00 AM')); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMon(TRUE); $ppf->setTue(TRUE); $ppf->setWed(TRUE); $ppf->setThu(TRUE); $ppf->setFri(TRUE); $ppf->setSat(TRUE); $ppf->setSun(TRUE); $ppf->setIncludePartialPunch(FALSE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setExcludeDefaultBranch( FALSE ); //$ppf->setExcludeDefaultDepartment( FALSE ); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 140: $ppf->setName('Daily Hour Based'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('12:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(3600 * 5); $ppf->setWeeklyTriggerTime(0); $ppf->setMon(TRUE); $ppf->setTue(TRUE); $ppf->setWed(TRUE); $ppf->setThu(TRUE); $ppf->setFri(TRUE); $ppf->setSat(TRUE); $ppf->setSun(TRUE); $ppf->setIncludePartialPunch(TRUE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setExcludeDefaultBranch( FALSE ); //$ppf->setExcludeDefaultDepartment( FALSE ); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 150: $ppf->setName('Weekly Hour Based'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('12:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(3600 * 9); $ppf->setMon(TRUE); $ppf->setTue(TRUE); $ppf->setWed(TRUE); $ppf->setThu(TRUE); $ppf->setFri(TRUE); $ppf->setSat(TRUE); $ppf->setSun(TRUE); $ppf->setIncludePartialPunch(TRUE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setExcludeDefaultBranch( FALSE ); //$ppf->setExcludeDefaultDepartment( FALSE ); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 160: $ppf->setName('Daily+Weekly Hour Based'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('12:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(3600 * 3); $ppf->setWeeklyTriggerTime(3600 * 9); $ppf->setMon(TRUE); $ppf->setTue(TRUE); $ppf->setWed(TRUE); $ppf->setThu(TRUE); $ppf->setFri(TRUE); $ppf->setSat(TRUE); $ppf->setSun(TRUE); $ppf->setIncludePartialPunch(TRUE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setExcludeDefaultBranch( FALSE ); //$ppf->setExcludeDefaultDepartment( FALSE ); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 170: $ppf->setName('Time+Daily+Weekly Hour Based'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('7:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(3600 * 5); $ppf->setWeeklyTriggerTime(3600 * 9); $ppf->setMon(TRUE); $ppf->setTue(TRUE); $ppf->setWed(TRUE); $ppf->setThu(TRUE); $ppf->setFri(TRUE); $ppf->setSat(TRUE); $ppf->setSun(TRUE); $ppf->setIncludePartialPunch(TRUE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setExcludeDefaultBranch( FALSE ); //$ppf->setExcludeDefaultDepartment( FALSE ); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 200: $ppf->setName('Branch Differential'); $ppf->setType(20); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setIncludePartialPunch(TRUE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); $ppf->setExcludeDefaultBranch(FALSE); $ppf->setExcludeDefaultDepartment(FALSE); $ppf->setBranchSelectionType(20); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 210: $ppf->setName('Branch/Department Differential'); $ppf->setType(20); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setIncludePartialPunch(TRUE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); $ppf->setExcludeDefaultBranch(FALSE); $ppf->setExcludeDefaultDepartment(FALSE); $ppf->setBranchSelectionType(20); $ppf->setDepartmentSelectionType(20); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 300: $ppf->setName('Meal Break'); $ppf->setType(30); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setIncludePartialPunch(TRUE); $ppf->setDailyTriggerTime(3600 * 5); $ppf->setMaximumNoBreakTime(3600 * 5); $ppf->setMinimumBreakTime(1800); $ppf->setMinimumTime(1800); $ppf->setMaximumTime(1800); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; } if ($ppf->isValid()) { $insert_id = $ppf->Save(FALSE); Debug::Text('Premium Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10); switch ($type) { case 200: Debug::Text('Post Save Data...', __FILE__, __LINE__, __METHOD__, 10); $ppf->setBranch(array($this->branch_ids[0])); break; case 210: Debug::Text('Post Save Data...', __FILE__, __LINE__, __METHOD__, 10); $ppf->setBranch(array($this->branch_ids[0])); $ppf->setDepartment(array($this->department_ids[0])); break; } Debug::Text('Post Save...', __FILE__, __LINE__, __METHOD__, 10); $ppf->Save(); return $insert_id; } Debug::Text('Failed Creating Premium Policy!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
if (!$permission->Check('company_tax_deduction', 'enabled') or !($permission->Check('company_tax_deduction', 'edit') or $permission->Check('company_tax_deduction', 'edit_own'))) { $permission->Redirect(FALSE); //Redirect } $smarty->assign('title', TTi18n::gettext($title = 'Edit Tax / Deduction')); // See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'id', 'data'))); if (isset($data)) { if ($data['start_date'] != '') { $data['start_date'] = TTDate::parseDateTime($data['start_date']); } if ($data['end_date'] != '') { $data['end_date'] = TTDate::parseDateTime($data['end_date']); } } $cdf = TTnew('CompanyDeductionFactory'); $action = Misc::findSubmitButton(); $action = strtolower($action); switch ($action) { case 'submit': Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); //Debug::setVerbosity(11); $cdf->StartTransaction(); $cdf->setId($data['id']); $cdf->setCompany($current_company->getId()); $cdf->setStatus($data['status_id']); $cdf->setType($data['type_id']); $cdf->setName($data['name']);
require_once Environment::getBasePath() . 'includes/Interface.inc.php'; if (!$permission->Check('accrual_policy', 'enabled') or !($permission->Check('accrual_policy', 'edit') or $permission->Check('accrual_policy', 'edit_own'))) { $permission->Redirect(FALSE); //Redirect } $smarty->assign('title', TTi18n::gettext($title = 'Edit Accrual Policy')); // See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'id', 'ids', 'data', 'type_id'))); if (isset($data['recalculate_start_date'])) { $data['recalculate_start_date'] = TTDate::parseDateTime($data['recalculate_start_date']); } if (isset($data['recalculate_end_date'])) { $data['recalculate_end_date'] = TTDate::parseDateTime($data['recalculate_end_date']); } if (isset($data['milestone_rows'])) { foreach ($data['milestone_rows'] as $milestone_row_id => $milestone_row) { if ($data['type_id'] == 20 and isset($milestone_row['accrual_rate']) and $milestone_row['accrual_rate'] != '') { $data['milestone_rows'][$milestone_row_id]['accrual_rate'] = TTDate::parseTimeUnit($milestone_row['accrual_rate']); } if (isset($milestone_row['maximum_time']) and $milestone_row['maximum_time'] != '') { $data['milestone_rows'][$milestone_row_id]['maximum_time'] = TTDate::parseTimeUnit($milestone_row['maximum_time']); } /* if ( isset($milestone_row['minimum_time']) AND $milestone_row['minimum_time'] != '' ) { $data['milestone_rows'][$milestone_row_id]['minimum_time'] = TTDate::parseTimeUnit($milestone_row['minimum_time'] ); } */ }
function setObjectFromArray($data) { if (is_array($data)) { /* * //Use date_stamp is determined from StartTime and EndTime now automatically, due to schedules honoring the "assign shifts to" setting //We need to set the UserDate as soon as possible. //Consider mass editing shifts, where user_id is not sent but user_date_id is. We need to prevent the shifts from being assigned to the OPEN user. if ( isset($data['user_id']) AND ( $data['user_id'] !== '' AND $data['user_id'] !== FALSE ) AND isset($data['date_stamp']) AND $data['date_stamp'] != '' AND isset($data['start_time']) AND $data['start_time'] != '' ) { Debug::text('Setting User Date ID based on User ID:'. $data['user_id'] .' Date Stamp: '. $data['date_stamp'] .' Start Time: '. $data['start_time'] , __FILE__, __LINE__, __METHOD__, 10); $this->setUserDate( $data['user_id'], TTDate::parseDateTime( $data['date_stamp'].' '.$data['start_time'] ) ); } elseif ( isset( $data['user_date_id'] ) AND $data['user_date_id'] >= 0 ) { Debug::text(' Setting UserDateID: '. $data['user_date_id'], __FILE__, __LINE__, __METHOD__,10); $this->setUserDateID( $data['user_date_id'] ); } else { Debug::text(' NOT CALLING setUserDate or setUserDateID!', __FILE__, __LINE__, __METHOD__,10); } */ if (isset($data['overwrite'])) { $this->setEnableOverwrite(TRUE); } $variable_function_map = $this->getVariableToFunctionMap(); foreach ($variable_function_map as $key => $function) { if (isset($data[$key])) { $function = 'set' . $function; switch ($key) { 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. $this->setUser($data[$key]); break; case 'user_date_id': //Ignore explicitly set user_date_id here as its set above. //Ignore explicitly set user_date_id here as its set above. case 'total_time': //If they try to specify total time, just skip it, as it gets calculated later anyways. break; case 'start_time': if (method_exists($this, $function)) { Debug::text('..Setting start time from EPOCH: "' . $data[$key] . '"', __FILE__, __LINE__, __METHOD__, 10); if (isset($data['start_date_stamp']) and $data['start_date_stamp'] != '' and isset($data[$key]) and $data[$key] != '') { Debug::text(' aSetting start time... "' . $data['start_date_stamp'] . ' ' . $data[$key] . '"', __FILE__, __LINE__, __METHOD__, 10); $this->{$function}(TTDate::parseDateTime($data['start_date_stamp'] . ' ' . $data[$key])); //Prefix date_stamp onto start_time } elseif (isset($data[$key]) and $data[$key] != '') { //When start_time is provided as a full timestamp. Happens with audit log detail. Debug::text(' aaSetting start time...: ' . $data[$key], __FILE__, __LINE__, __METHOD__, 10); $this->{$function}(TTDate::parseDateTime($data[$key])); //} elseif ( is_object( $this->getUserDateObject() ) ) { // Debug::text(' aaaSetting start time...: '. $this->getUserDateObject()->getDateStamp(), __FILE__, __LINE__, __METHOD__,10); // $this->$function( TTDate::parseDateTime( TTDate::getDate('DATE', $this->getUserDateObject()->getDateStamp() ) .' '. $data[$key] ) ); } else { Debug::text(' Not setting start time...', __FILE__, __LINE__, __METHOD__, 10); } } break; case 'end_time': if (method_exists($this, $function)) { Debug::text('..xSetting end time from EPOCH: "' . $data[$key] . '"', __FILE__, __LINE__, __METHOD__, 10); if (isset($data['start_date_stamp']) and $data['start_date_stamp'] != '' and isset($data[$key]) and $data[$key] != '') { Debug::text(' aSetting end time... "' . $data['start_date_stamp'] . ' ' . $data[$key] . '"', __FILE__, __LINE__, __METHOD__, 10); $this->{$function}(TTDate::parseDateTime($data['start_date_stamp'] . ' ' . $data[$key])); //Prefix date_stamp onto end_time } elseif (isset($data[$key]) and $data[$key] != '') { Debug::text(' aaSetting end time...: ' . $data[$key], __FILE__, __LINE__, __METHOD__, 10); //When end_time is provided as a full timestamp. Happens with audit log detail. $this->{$function}(TTDate::parseDateTime($data[$key])); //} elseif ( is_object( $this->getUserDateObject() ) ) { // Debug::text(' bbbSetting end time... "'. TTDate::getDate('DATE', $this->getUserDateObject()->getDateStamp() ) .' '. $data[$key] .'"', __FILE__, __LINE__, __METHOD__,10); // $this->$function( TTDate::parseDateTime( TTDate::getDate('DATE', $this->getUserDateObject()->getDateStamp() ) .' '. $data[$key] ) ); } else { Debug::text(' Not setting end time...', __FILE__, __LINE__, __METHOD__, 10); } } break; default: if (method_exists($this, $function)) { $this->{$function}($data[$key]); } break; } } } $this->handleDayBoundary(); //Make sure we handle day boundary before calculating total time. $this->setTotalTime($this->calcTotalTime()); //Calculate total time immediately after. This is required for proper audit logging too. $this->setEnableReCalculateDay(TRUE); //This is needed for Absence schedules to carry over to the timesheet. $this->setCreatedAndUpdatedColumns($data); return TRUE; } return FALSE; }
/** * Get schedule total time * @param integer $start Start date epoch * @param integer $end End date epoch * @param integer $schedule_policy_id Schedule policy ID * @return array */ function getScheduleTotalTime($start, $end, $schedule_policy_id = NULL) { Debug::text('Calculating total time for scheduled shift... Start: ' . $start . ' End: ' . $end, __FILE__, __LINE__, __METHOD__, 10); if ($start == '') { return FALSE; } if ($end == '') { return FALSE; } $sf = TTnew('ScheduleFactory'); //Prefix the current date to the template, this avoids issues with parsing 24hr clock only, ie: 0600 $date_epoch = time(); $sf->setStartTime(TTDate::parseDateTime(TTDate::getDate('DATE', $date_epoch) . ' ' . $start)); $sf->setEndTime(TTDate::parseDateTime(TTDate::getDate('DATE', $date_epoch) . ' ' . $end)); $sf->setSchedulePolicyId($schedule_policy_id); $sf->preSave(); return $this->returnHandler($sf->getTotalTime()); }
if ($pp == 0) { $default_start_date = $pay_period_obj->getStartDate(); $default_end_date = $pay_period_obj->getEndDate(); } $pp++; } $pplf = TTnew('PayPeriodListFactory'); $pay_period_options = $pplf->getByIdListArray($pay_period_ids, NULL, array('start_date' => 'desc')); } else { $pay_period_options = array(); } if (isset($filter_data['start_date'])) { $filter_data['start_date'] = TTDate::parseDateTime($filter_data['start_date']); } if (isset($filter_data['end_date'])) { $filter_data['end_date'] = TTDate::parseDateTime($filter_data['end_date']); } $filter_data = Misc::preSetArrayValues($filter_data, array('include_user_ids', 'exclude_user_ids', 'user_status_ids', 'group_ids', 'branch_ids', 'department_ids', 'user_title_ids', 'pay_period_ids', 'column_ids'), array()); //Get Permission Hierarchy Children first, as this can be used for viewing, or editing. $permission_children_ids = array(); $wage_permission_children_ids = array(); if ($permission->Check('punch', 'view') == FALSE) { $hlf = TTnew('HierarchyListFactory'); $permission_children_ids = $wage_permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId()); Debug::Arr($permission_children_ids, 'Permission Children Ids:', __FILE__, __LINE__, __METHOD__, 10); if ($permission->Check('punch', 'view_child') == FALSE) { $permission_children_ids = array(); } if ($permission->Check('punch', 'view_own')) { $permission_children_ids[] = $current_user->getId(); }
function _outputPDFForm($format = NULL) { // Always display the background. $show_background = TRUE; Debug::Text('Generating Form... Format: ' . $format, __FILE__, __LINE__, __METHOD__, 10); $setup_data = $this->getFormConfig(); $filter_data = $this->getFilterConfig(); //Debug::Arr($setup_data, 'Setup Data: ', __FILE__, __LINE__, __METHOD__,10); //Debug::Arr($filter_data, 'Filter Data: ', __FILE__, __LINE__, __METHOD__,10); //Debug::Arr($this->data, 'Data: ', __FILE__, __LINE__, __METHOD__,10); //$last_row = count($this->form_data)-1; //$total_row = $last_row+1; $current_company = $this->getUserObject()->getCompanyObject(); if (!is_object($current_company)) { Debug::Text('Invalid company object...', __FILE__, __LINE__, __METHOD__, 10); return FALSE; } $roe = $this->getROEObject(); $roe->setShowBackground($show_background); //$roe->setDebug( TRUE ); //$roe->setType( $form_type ); $roe->business_number = $current_company->getBusinessNumber(); $roe->company_name = $current_company->getName(); $roe->company_address1 = $current_company->getAddress1(); $roe->company_address2 = $current_company->getAddress2(); $roe->company_city = $current_company->getCity(); $roe->company_province = $current_company->getProvince(); $roe->company_postal_code = $current_company->getPostalCode(); $roe->company_work_phone = $current_company->getWorkPhone(); $roe->english = TRUE; $i = 0; foreach ($this->form_data as $row) { if (!isset($row['user_id'])) { Debug::Text('User ID not set!', __FILE__, __LINE__, __METHOD__, 10); continue; } $ulf = TTnew('UserListFactory'); $ulf->getById((int) $row['user_id']); if ($ulf->getRecordCount() == 1) { $user_obj = $ulf->getCurrent(); $title_obj = $user_obj->getTitleObject(); $ee_data = array('first_name' => $user_obj->getFirstName(), 'middle_name' => $user_obj->getMiddleName(), 'last_name' => $user_obj->getLastName(), 'employee_full_name' => $user_obj->getFullName(FALSE), 'employee_address1' => $user_obj->getAddress1(), 'employee_address2' => $user_obj->getAddress2(), 'employee_city' => $user_obj->getCity(), 'employee_province' => $user_obj->getProvince(), 'employee_postal_code' => $user_obj->getPostalCode(), 'title' => is_object($title_obj) ? $title_obj->getName() : NULL, 'sin' => $user_obj->getSIN(), 'pay_period_type' => $row['pay_period_type'], 'pay_period_type_id' => $row['pay_period_type_id'], 'code_id' => $row['code_id'], 'first_date' => TTDate::parseDateTime($row['first_date']), 'last_date' => TTDate::parseDateTime($row['last_date']), 'pay_period_end_date' => TTDate::parseDateTime($row['pay_period_end_date']), 'recall_date' => TTDate::parseDateTime($row['recall_date']), 'insurable_hours' => $row['insurable_hours'], 'insurable_earnings' => $row['insurable_earnings'], 'vacation_pay' => $row['vacation_pay'], 'serial' => $row['serial'], 'comments' => $row['comments'], 'created_date' => TTDate::parseDateTime($row['created_date'])); } $ulf->getById((int) $row['created_by_id']); if ($ulf->getRecordCount() == 1) { $user_obj = $ulf->getCurrent(); $ee_data['created_user_first_name'] = $user_obj->getFirstName(); $ee_data['created_user_middle_name'] = $user_obj->getMiddleName(); $ee_data['created_user_last_name'] = $user_obj->getLastName(); $ee_data['created_user_full_name'] = $user_obj->getFullName(FALSE); $ee_data['created_user_work_phone'] = $user_obj->getWorkPhone(); } if (isset($row['pay_period_earnings']) and is_array($row['pay_period_earnings'])) { foreach ($row['pay_period_earnings'] as $pay_period_earning) { $ee_data['pay_period_earnings'][] = Misc::MoneyFormat($pay_period_earning['amount'], FALSE); } } $roe->addRecord($ee_data); unset($ee_data); $i++; } $this->getFormObject()->addForm($roe); if ($format == 'efile_xml') { $output_format = 'XML'; $file_name = 'roe_efile_' . date('Y_m_d') . '.blk'; //The filename should actually end in ".blk" instead of ".xml" $mime_type = 'applications/octet-stream'; //Force file to download. } else { $output_format = 'PDF'; $file_name = $this->file_name; $mime_type = $this->file_mime_type; } $output = $this->getFormObject()->output($output_format); return array('file_name' => $file_name, 'mime_type' => $mime_type, 'data' => $output); }
function _preProcess() { $this->getProgressBarObject()->start($this->getAMFMessageID(), count($this->tmp_data['user']), NULL, TTi18n::getText('Pre-Processing Data...')); $key = 0; if (isset($this->tmp_data['user'])) { foreach ($this->tmp_data['user'] as $user_id => $row) { if (isset($row['hire_date'])) { $hire_date_columns = TTDate::getReportDates('hire', TTDate::parseDateTime($row['hire_date']), FALSE, $this->getUserObject()); } else { $hire_date_columns = array(); } if (isset($row['termination_date'])) { $termination_date_columns = TTDate::getReportDates('termination', TTDate::parseDateTime($row['termination_date']), FALSE, $this->getUserObject()); } else { $termination_date_columns = array(); } if (isset($row['birth_date'])) { $birth_date_columns = TTDate::getReportDates('birth', TTDate::parseDateTime($row['birth_date']), FALSE, $this->getUserObject()); } else { $birth_date_columns = array(); } if (isset($row['created_date'])) { $created_date_columns = TTDate::getReportDates('created', TTDate::parseDateTime($row['created_date']), FALSE, $this->getUserObject()); } else { $created_date_columns = array(); } if (isset($row['updated_date'])) { $updated_date_columns = TTDate::getReportDates('updated', TTDate::parseDateTime($row['updated_date']), FALSE, $this->getUserObject()); } else { $updated_date_columns = array(); } $processed_data = array(); if (isset($this->tmp_data['user_preference'][$user_id])) { $processed_data = array_merge($processed_data, $this->tmp_data['user_preference'][$user_id]); } if (isset($this->tmp_data['user_bank'][$user_id])) { $processed_data = array_merge($processed_data, $this->tmp_data['user_bank'][$user_id]); } if (isset($this->tmp_data['user_wage'][$user_id])) { $processed_data = array_merge($processed_data, $this->tmp_data['user_wage'][$user_id]); } $this->data[] = array_merge($row, $hire_date_columns, $termination_date_columns, $birth_date_columns, $created_date_columns, $updated_date_columns, $processed_data); $this->getProgressBarObject()->set($this->getAMFMessageID(), $key); $key++; } unset($this->tmp_data, $row, $date_columns, $user_id, $hire_date_columns, $termination_date_columns, $birth_date_columns, $processed_data); } //Debug::Arr($this->data, 'preProcess Data: ', __FILE__, __LINE__, __METHOD__,10); return TRUE; }
function _preProcess() { $this->getProgressBarObject()->start($this->getAMFMessageID(), count($this->tmp_data['exception']), NULL, TTi18n::getText('Pre-Processing Data...')); if (isset($this->tmp_data['user'])) { $key = 0; if (isset($this->tmp_data['exception'])) { foreach ($this->tmp_data['exception'] as $user_id => $level_1) { foreach ($level_1 as $id => $level_2) { $date_columns = TTDate::getReportDates(NULL, TTDate::parseDateTime($level_2['date_stamp']), FALSE, $this->getUserObject(), array('pay_period_start_date' => strtotime($level_2['pay_period_start_date']), 'pay_period_end_date' => strtotime($level_2['pay_period_end_date']), 'pay_period_transaction_date' => strtotime($level_2['pay_period_transaction_date']))); if (isset($this->tmp_data['user'][$user_id])) { $this->data[] = array_merge($level_2, $this->tmp_data['user'][$user_id], $date_columns); } $this->getProgressBarObject()->set($this->getAMFMessageID(), $key); $key++; } } } unset($this->tmp_data, $level_1); } //Debug::Arr($this->data, 'preProcess Data: ', __FILE__, __LINE__, __METHOD__,10); return TRUE; }