当前位置: 首页>>代码示例>>PHP>>正文


PHP TTDate::strtotime方法代码示例

本文整理汇总了PHP中TTDate::strtotime方法的典型用法代码示例。如果您正苦于以下问题:PHP TTDate::strtotime方法的具体用法?PHP TTDate::strtotime怎么用?PHP TTDate::strtotime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TTDate的用法示例。


在下文中一共展示了TTDate::strtotime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDateStamp

 function getDateStamp($raw = FALSE)
 {
     if (isset($this->data['date_stamp'])) {
         if ($raw === TRUE) {
             return $this->data['date_stamp'];
         } else {
             return TTDate::strtotime($this->data['date_stamp']);
         }
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:11,代码来源:CompanyUserCountFactory.class.php

示例2: postInstall

 function postInstall()
 {
     Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
     //New Pay Period Schedule format, update any current schedules.
     $ppslf = new PayPeriodScheduleListFactory();
     $ppslf->getAll();
     Debug::text('Found Pay Period Schedules: ' . $ppslf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 9);
     if ($ppslf->getRecordCount() > 0) {
         foreach ($ppslf as $pps_obj) {
             if ($pps_obj->getType() == 10 or $pps_obj->getType() == 20) {
                 $pps_obj->setStartDayOfWeek(TTDate::getDayOfWeek(TTDate::strtotime($pps_obj->getColumn('anchor_date'))));
                 $pps_obj->setTransactionDate(floor((TTDate::strtotime($pps_obj->getColumn('primary_transaction_date')) - TTDate::strtotime($pps_obj->getColumn('primary_date'))) / 86400) + 1);
             } elseif ($pps_obj->getType() == 30) {
                 $pps_obj->setPrimaryDayOfMonth(TTDate::getDayOfMonth(TTDate::strtotime($pps_obj->getColumn('anchor_date'))) + 1);
                 if ($pps_obj->getColumn('primary_transaction_date_ldom') == 1) {
                     $pps_obj->setPrimaryTransactionDayOfMonth(-1);
                 } else {
                     $pps_obj->setPrimaryTransactionDayOfMonth(TTDate::getDayOfMonth(TTDate::strtotime($pps_obj->getColumn('primary_transaction_date'))));
                 }
                 $pps_obj->setSecondaryDayOfMonth(TTDate::getDayOfMonth(TTDate::strtotime($pps_obj->getColumn('primary_date'))));
                 if ($pps_obj->getColumn('secondary_transaction_date_ldom') == 1) {
                     $pps_obj->setSecondaryTransactionDayOfMonth(-1);
                 } else {
                     $pps_obj->setSecondaryTransactionDayOfMonth(TTDate::getDayOfMonth(TTDate::strtotime($pps_obj->getColumn('secondary_transaction_date'))));
                 }
             } elseif ($pps_obj->getType() == 50) {
                 $pps_obj->setPrimaryDayOfMonth(TTDate::getDayOfMonth(TTDate::strtotime($pps_obj->getColumn('anchor_date'))));
                 if ($pps_obj->getColumn('primary_transaction_date_ldom') == 1) {
                     $pps_obj->setPrimaryTransactionDayOfMonth(-1);
                 } else {
                     $pps_obj->setPrimaryTransactionDayOfMonth(TTDate::getDayOfMonth(TTDate::strtotime($pps_obj->getColumn('primary_transaction_date'))));
                 }
             }
             if ($pps_obj->getColumn('transaction_date_bd') == 1 or $pps_obj->getColumn('secondary_transaction_date_bd') == 1) {
                 $pps_obj->setTransactionDateBusinessDay(TRUE);
             }
             if ($pps_obj->isValid()) {
                 $pps_obj->Save();
             }
         }
     }
     return TRUE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:43,代码来源:InstallSchema_1007A.class.php

示例3: PunchListFactory

     }
     if (isset($schedule_rows[$pay_period_id][$user_id][$date_stamp]['absence'])) {
         $tmp_rows[$pay_period_id][$user_id][$date_stamp]['schedule_absence'] = $schedule_rows[$pay_period_id][$user_id][$date_stamp]['absence'];
     } else {
         $tmp_rows[$pay_period_id][$user_id][$date_stamp]['schedule_absence'] = NULL;
     }
     $tmp_rows[$pay_period_id][$user_id][$date_stamp]['min_punch_time_stamp'] = TTDate::strtotime($udt_obj->getColumn('min_punch_time_stamp'));
     $tmp_rows[$pay_period_id][$user_id][$date_stamp]['max_punch_time_stamp'] = TTDate::strtotime($udt_obj->getColumn('max_punch_time_stamp'));
 }
 //Get all punches
 if ($action == 'display_detailed_timesheet') {
     $plf = new PunchListFactory();
     $plf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data);
     if ($plf->getRecordCount() > 0) {
         foreach ($plf as $p_obj) {
             $punch_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][TTDate::strtotime($p_obj->getColumn('date_stamp'))][$p_obj->getPunchControlID()][$p_obj->getStatus()] = array('status_id' => $p_obj->getStatus(), 'type_id' => $p_obj->getType(), 'type_code' => $p_obj->getTypeCode(), 'time_stamp' => $p_obj->getTimeStamp());
         }
     }
     unset($plf, $p_obj);
 }
 $ulf = new UserListFactory();
 $utlf = new UserTitleListFactory();
 $title_options = $utlf->getByCompanyIdArray($current_company->getId());
 $blf = new BranchListFactory();
 $branch_options = $blf->getByCompanyIdArray($current_company->getId());
 $dlf = new DepartmentListFactory();
 $department_options = $dlf->getByCompanyIdArray($current_company->getId());
 $uglf = new UserGroupListFactory();
 $group_options = $uglf->getArrayByNodes(FastTree::FormatArray($uglf->getByCompanyIdArray($current_company->getId()), 'no_tree_text', TRUE));
 //Get verified timesheets
 //Ignore if more then one pay period is selected
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:TimesheetDetail.php

示例4: getEndTime

 function getEndTime($raw = FALSE)
 {
     if (isset($this->data['end_time'])) {
         return TTDate::strtotime($this->data['end_time']);
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:7,代码来源:ScheduleFactory.class.php

示例5: strtotime

if (isset($data)) {
    if ($data['start_date_stamp'] != '' and !is_numeric($data['start_date_stamp']) and $data['end_date_stamp'] != '' and !is_numeric($data['end_date_stamp']) and $data['start_time'] != '' and !is_numeric($data['end_time']) and $data['end_time'] != '' and !is_numeric($data['end_time'])) {
        $data['start_full_time_stamp'] = TTDate::parseDateTime($data['start_date_stamp'] . ' ' . $data['start_time']);
        $data['end_full_time_stamp'] = TTDate::parseDateTime($data['end_date_stamp'] . ' ' . $data['end_time']);
    } else {
        $data['start_full_time_stamp'] = NULL;
        $data['end_full_time_stamp'] = NULL;
    }
    if ($data['start_date_stamp'] != '') {
        $data['start_date_stamp'] = TTDate::parseDateTime($data['start_date_stamp']);
    }
    if ($data['end_date_stamp'] != '') {
        $data['end_date_stamp'] = TTDate::parseDateTime($data['end_date_stamp']);
    }
    if ($data['start_time'] != '') {
        $data['parsed_start_time'] = TTDate::strtotime($data['start_time'], $data['start_date_stamp']);
    }
    if ($data['end_time'] != '') {
        Debug::Text('End Time: ' . $data['end_time'] . ' Date Stamp: ' . $data['start_date_stamp'], __FILE__, __LINE__, __METHOD__, 10);
        $data['parsed_end_time'] = strtotime($data['end_time'], $data['start_date_stamp']);
        Debug::Text('bEnd Time: ' . $data['end_time'] . ' - ' . TTDate::getDate('DATE+TIME', $data['end_time']), __FILE__, __LINE__, __METHOD__, 10);
    }
}
//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());
//Debug::Arr($permission_children_ids,'Permission Children Ids:', __FILE__, __LINE__, __METHOD__,10);
$filter_data = array();
if ($permission->Check('schedule', 'edit') == FALSE) {
    if ($permission->Check('schedule', 'edit_child')) {
        $filter_data['permission_children_ids'] = $permission_children_ids;
开发者ID:alachaum,项目名称:timetrex,代码行数:31,代码来源:AddMassSchedule.php

示例6: getObjectAsArray

 function getObjectAsArray($include_columns = NULL, $permission_children_ids = FALSE)
 {
     //
     //When using the Recurring Schedule view, it returns the user list for every single row and runs out of memory at about 1000 rows.
     //Need to make the 'user' column explicitly defined instead perhaps?
     //
     $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) == '' ? TTi18n::getText('OPEN') : $this->getColumn($variable);
                         break;
                     case 'title':
                     case 'user_group':
                     case 'default_branch':
                     case 'default_department':
                     case 'recurring_schedule_template_control':
                     case 'recurring_schedule_template_control_description':
                     case 'user_id':
                         $data[$variable] = $this->getColumn($variable);
                         break;
                     case 'start_date':
                     case 'end_date':
                         $data[$variable] = TTDate::getAPIDate('DATE', TTDate::strtotime($this->{$function}()));
                         break;
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
         }
         //Handle expanded and non-expanded mode. In non-expanded mode we need to get all the users
         //so we can check is_owner/is_child permissions on them.
         if ($this->getColumn('user_id') !== FALSE) {
             $user_ids = $this->getColumn('user_id');
         } else {
             $user_ids = $this->getUser();
         }
         $this->getPermissionColumns($data, $user_ids, $this->getCreatedBy(), $permission_children_ids, $include_columns);
         //$this->getPermissionColumns( $data, $this->getColumn('user_id'), $this->getCreatedBy(), $permission_children_ids, $include_columns );
         $this->getCreatedAndUpdatedColumns($data, $include_columns);
     }
     return $data;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:50,代码来源:RecurringScheduleControlFactory.class.php

示例7: getObjectAsArray

 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;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:44,代码来源:RecurringScheduleTemplateFactory.class.php

示例8: _getData

 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;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:88,代码来源:ScheduleSummaryReport.class.php

示例9: calcAnnualPayPeriods

 function calcAnnualPayPeriods()
 {
     switch ($this->getType()) {
         case 5:
             //We need the annual number of pay periods calculated for manual pay period schedules if we
             //are to have any hope of calculating taxes correctly.
             //Get all the pay periods, take the first day, last day, and the total number to figure out an average
             //number of days per period.
             //Alternatively have them manually specify the number, but this required adding a field to the table.
             $retval = FALSE;
             if ($this->getId() > 0) {
                 $pplf = new PayPeriodListFactory();
                 $retarr = $pplf->getFirstStartDateAndLastEndDateByPayPeriodScheduleId($this->getId());
                 if (is_array($retarr) and isset($retarr['first_start_date']) and isset($retarr['last_end_date'])) {
                     $retarr['first_start_date'] = TTDate::strtotime($retarr['first_start_date']);
                     $retarr['last_end_date'] = TTDate::strtotime($retarr['last_end_date']);
                     $days_per_period = ($retarr['last_end_date'] - $retarr['first_start_date']) / $retarr['total'] / 86400;
                     $retval = floor(365 / round($days_per_period));
                     Debug::text('First Start Date: ' . TTDate::getDate('DATE+TIME', $retarr['first_start_date']) . ' Last End Date: ' . TTDate::getDate('DATE+TIME', $retarr['last_end_date']) . ' Total PP: ' . $retarr['total'] . ' Average Days/Period: ' . $days_per_period . '(' . round($days_per_period) . ') Annual Pay Periods: ' . $retval, __FILE__, __LINE__, __METHOD__, 10);
                 }
                 unset($pplf, $retarr);
             }
             break;
         case 10:
             $retval = 52;
             break;
         case 20:
             $retval = 26;
             break;
         case 30:
             $retval = 24;
             //Semi-monthly
             break;
         case 40:
             $retval = 12;
             //Monthly + advance, deductions only once per month
             break;
         case 50:
             $retval = 12;
             break;
         default:
             return FALSE;
             break;
     }
     return $retval;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:46,代码来源:PayPeriodScheduleFactory.class.php

示例10: getObjectAsArray

 function getObjectAsArray($include_columns = NULL)
 {
     $variable_function_map = $this->getVariableToFunctionMap();
     $epf = TTnew('ExceptionPolicyFactory');
     $exception_policy_type_options = $epf->getOptions('type');
     $exception_policy_severity_options = $epf->getOptions('severity');
     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 'pay_period_id':
                     case 'pay_period_schedule_id':
                     case 'pay_period_start_date':
                     case 'pay_period_end_date':
                     case 'pay_period_transaction_date':
                     case 'user_id':
                     case 'first_name':
                     case 'last_name':
                     case 'country':
                     case 'province':
                     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 'branch_id':
                     case 'branch':
                     case 'department_id':
                     case 'department':
                     case 'severity_id':
                     case 'exception_policy_type_id':
                     case 'policy_group':
                     case 'permission_group':
                     case 'pay_period_schedule':
                         $data[$variable] = $this->getColumn($variable);
                         break;
                     case 'severity':
                         $data[$variable] = Option::getByKey($this->getColumn('severity_id'), $exception_policy_severity_options);
                         break;
                     case 'exception_policy_type':
                         $data[$variable] = Option::getByKey($this->getColumn('exception_policy_type_id'), $exception_policy_type_options);
                         break;
                     case 'type':
                         $function = 'get' . $variable;
                         if (method_exists($this, $function)) {
                             $data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
                         }
                         break;
                     case 'date_stamp':
                         $data[$variable] = TTDate::getAPIDate('DATE', TTDate::strtotime($this->getColumn('date_stamp')));
                         break;
                     case 'pay_period_start_date':
                         $data[$variable] = TTDate::getAPIDate('DATE', TTDate::strtotime($this->getColumn('pay_period_start_date')));
                         break;
                     case 'pay_period_end_date':
                         $data[$variable] = TTDate::getAPIDate('DATE', TTDate::strtotime($this->getColumn('pay_period_end_date')));
                         break;
                     case 'pay_period':
                     case 'pay_period_transaction_date':
                         $data[$variable] = TTDate::getAPIDate('DATE', TTDate::strtotime($this->getColumn('pay_period_transaction_date')));
                         break;
                     default:
                         if (method_exists($this, $function)) {
                             $data[$variable] = $this->{$function}();
                         }
                         break;
                 }
             }
         }
         $this->getCreatedAndUpdatedColumns($data, $include_columns);
     }
     return $data;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:78,代码来源:ExceptionFactory.class.php

示例11: _getData

 function _getData($format = NULL)
 {
     $this->tmp_data = array('user' => array(), 'pay_stub_entry' => array(), 'pay_period' => array());
     $columns = $this->getColumnDataConfig();
     $filter_data = $this->getFilterConfig();
     $form_data = $this->formatFormConfig();
     $pseallf = TTnew('PayStubEntryAccountLinkListFactory');
     $pseallf->getByCompanyId($this->getUserObject()->getCompany());
     if ($pseallf->getRecordCount() > 0) {
         $pseal_obj = $pseallf->getCurrent();
     }
     $pself = TTnew('PayStubEntryListFactory');
     $pself->getAPIReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
     if ($pself->getRecordCount() > 0) {
         foreach ($pself as $pse_obj) {
             $user_id = $this->user_ids[] = $pse_obj->getColumn('user_id');
             $date_stamp = TTDate::strtotime($pse_obj->getColumn('pay_stub_transaction_date'));
             $branch = $pse_obj->getColumn('default_branch');
             $department = $pse_obj->getColumn('default_department');
             $pay_stub_entry_name_id = $pse_obj->getPayStubEntryNameId();
             if (!isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp])) {
                 $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp] = array('pay_period_start_date' => strtotime($pse_obj->getColumn('pay_stub_start_date')), 'pay_period_end_date' => strtotime($pse_obj->getColumn('pay_stub_end_date')), 'pay_period_transaction_date' => TTDate::getMiddleDayEpoch(strtotime($pse_obj->getColumn('pay_stub_transaction_date'))), 'pay_period' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')));
                 $this->form_data['pay_period'][] = strtotime($pse_obj->getColumn('pay_stub_transaction_date'));
             }
             if (isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id])) {
                 $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = bcadd($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id], $pse_obj->getColumn('amount'));
             } else {
                 $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount');
             }
         }
         if (isset($this->tmp_data['pay_stub_entry']) and is_array($this->tmp_data['pay_stub_entry'])) {
             foreach ($this->tmp_data['pay_stub_entry'] as $user_id => $data_a) {
                 foreach ($data_a as $date_stamp => $data_b) {
                     $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['ei_total'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['ei']['include_pay_stub_entry_account'], $form_data['ei']['exclude_pay_stub_entry_account']);
                     $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['cpp_total'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['cpp']['include_pay_stub_entry_account'], $form_data['cpp']['exclude_pay_stub_entry_account']);
                     $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['tax_total'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['tax']['include_pay_stub_entry_account'], $form_data['tax']['exclude_pay_stub_entry_account']);
                     $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['total'] = $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['ei_total'] + $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['cpp_total'] + $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['tax_total'];
                     $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['gross_payroll'] = Misc::calculateMultipleColumns($data_b['psen_ids'], (array) $pseal_obj->getTotalGross(), array());
                 }
             }
         }
     }
     $this->user_ids = array_unique($this->user_ids);
     //Used to get the total number of employees.
     //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()] = (array) $u_obj->getObjectAsArray($this->getColumnDataConfig());
         $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
     }
     //Debug::Arr($this->tmp_data['user'], 'User Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
     return TRUE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:56,代码来源:RemittanceSummaryReport.class.php

示例12: parse_wage_effective_date

function parse_wage_effective_date($input, $default_value = NULL, $parse_hint = NULL)
{
    if (isset($parse_hint) and $parse_hint != '') {
        TTDate::setDateFormat($parse_hint);
        return TTDate::parseDateTime($input);
    } else {
        return TTDate::strtotime($input);
    }
}
开发者ID:alachaum,项目名称:timetrex,代码行数:9,代码来源:import_users.php

示例13: foreach

 //Make sure employee is employed in this time frame.
 if ($user_obj->getHireDate() != '' and $start_date <= $user_obj->getHireDate() or $user_obj->getTerminationDate() != '' and $start_date > $user_obj->getTerminationDate()) {
     Debug::text('Skipping User due to hire/termination date...' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
     continue;
     //Skip user.
 }
 //Set the timezone before getting the recurring schedule shifts
 //so we prevent timezone issues and DST issues from arising.
 $recurring_schedule_days = $rsc_obj->getShiftsByStartDateAndEndDate($start_date, $end_date);
 //Debug::Arr($recurring_schedule_days, 'Recurring Schedule Shifts', __FILE__, __LINE__, __METHOD__, 10);
 if ($recurring_schedule_days !== FALSE) {
     foreach ($recurring_schedule_days as $date_stamp => $recurring_schedule_shifts) {
         Debug::text('Recurring Schedule Shift Date Stamp: ' . $date_stamp, __FILE__, __LINE__, __METHOD__, 10);
         foreach ($recurring_schedule_shifts as $recurring_schedule_shift) {
             $recurring_schedule_shift_start_time = TTDate::strtotime($recurring_schedule_shift['start_time']);
             $recurring_schedule_shift_end_time = TTDate::strtotime($recurring_schedule_shift['end_time']);
             Debug::text('(After User TimeZone)Recurring Schedule Shift Start Time: ' . TTDate::getDate('DATE+TIME', $recurring_schedule_shift_start_time) . ' End Time: ' . TTDate::getDate('DATE+TIME', $recurring_schedule_shift_end_time), __FILE__, __LINE__, __METHOD__, 10);
             //Make sure punch pairs fall within limits
             if ($recurring_schedule_shift_start_time < $current_epoch + $add_shift_offset) {
                 Debug::text('Recurring Schedule Shift Start Time falls within Limits: ' . TTDate::getDate('DATE+TIME', $recurring_schedule_shift_start_time), __FILE__, __LINE__, __METHOD__, 10);
                 $status_id = 10;
                 //Working
                 //Is this a holiday?
                 $hlf = new HolidayListFactory();
                 $hlf->getByPolicyGroupUserIdAndDate($user_id, TTDate::getBeginDayEpoch($recurring_schedule_shift_start_time));
                 if ($hlf->getRecordCount() > 0) {
                     $h_obj = $hlf->getCurrent();
                     Debug::text('Found Holiday! Name: ' . $h_obj->getName(), __FILE__, __LINE__, __METHOD__, 10);
                     if ($h_obj->isEligible($user_id)) {
                         Debug::text('User is Eligible...', __FILE__, __LINE__, __METHOD__, 10);
                         //Get Holiday Policy info
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:AddRecurringScheduleShift.php

示例14: _getData

 function _getData($format = NULL)
 {
     $this->tmp_data = array('user_date_total' => array(), 'schedule' => array(), 'worked_days' => array(), 'user' => array(), 'default_branch' => array(), 'default_department' => array(), 'branch' => array(), 'department' => array(), 'verified_timesheet' => array());
     $columns = $this->getColumnDataConfig();
     $filter_data = $this->getFilterConfig();
     $policy_hourly_rates = $this->getPolicyHourlyRates();
     $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('punch', '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('punch', 'view') == FALSE) {
         if ($this->getPermissionObject()->Check('punch', '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 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);
     $pay_period_ids = array();
     $udtlf = TTnew('UserDateTotalListFactory');
     $udtlf->getTimesheetSummaryReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
     Debug::Text(' Total Rows: ' . $udtlf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
     $this->getProgressBarObject()->start($this->getAMFMessageID(), $udtlf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
     if ($udtlf->getRecordCount() > 0) {
         foreach ($udtlf as $key => $udt_obj) {
             $pay_period_ids[$udt_obj->getColumn('pay_period_id')] = TRUE;
             $user_id = $udt_obj->getColumn('user_id');
             $date_stamp = TTDate::strtotime($udt_obj->getColumn('date_stamp'));
             $branch_id = $udt_obj->getColumn('branch_id');
             $department_id = $udt_obj->getColumn('department_id');
             $status_id = $udt_obj->getColumn('status_id');
             $type_id = $udt_obj->getColumn('type_id');
             //Can we get rid of Worked and Paid time to simplify things? People have a hard time figuring out what these are anyways for reports.
             //Paid time doesn't belong to a branch/department, so if we try to group by branch/department there will
             //always be a blank line showing just the paid time. So if they don't want to display paid time, just exclude it completely.
             $column = $udt_obj->getTimeCategory();
             //Worked_time includes paid lunch/break time as well.
             if ($column == 'paid_time') {
                 $column = NULL;
             }
             //Debug::Text('Column: '. $column .' Total Time: '. $udt_obj->getColumn('total_time') .' Status: '. $status_id .' Type: '. $type_id .' Rate: '. $udt_obj->getColumn( 'hourly_rate' ), __FILE__, __LINE__, __METHOD__,10);
             if (isset($filter_data['include_no_data_rows']) and $filter_data['include_no_data_rows'] == 1 or $date_stamp != '' and $column != '' and $udt_obj->getColumn('total_time') != 0) {
                 $hourly_rate = 0;
                 $hourly_rate_with_burden = 0;
                 if ($wage_permission_children_ids === TRUE or in_array($user_id, $wage_permission_children_ids)) {
                     $hourly_rate = $udt_obj->getColumn('hourly_rate');
                     $hourly_rate_with_burden = bcmul($hourly_rate, bcadd(bcdiv($udt_obj->getColumn('labor_burden_percent'), 100), 1));
                 }
                 //This ises the hourly rate defined above.
                 if (isset($policy_hourly_rates[$column]) and is_object($policy_hourly_rates[$column])) {
                     $hourly_rate = $policy_hourly_rates[$column]->getHourlyRate($hourly_rate);
                     $hourly_rate_with_burden = $policy_hourly_rates[$column]->getHourlyRate($hourly_rate_with_burden);
                 }
                 //Split time by user,date,branch,department as that is the lowest level we can split time.
                 //We always need to split time as much as possible as it can always be combined together by grouping.
                 //Unless we never add columns together that would ever span a single row is of course
                 if (!isset($this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id])) {
                     $this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id] = array('branch_id' => $udt_obj->getColumn('branch_id'), 'department_id' => $udt_obj->getColumn('department_id'), 'pay_period_start_date' => strtotime($udt_obj->getColumn('pay_period_start_date')), 'pay_period_end_date' => strtotime($udt_obj->getColumn('pay_period_end_date')), 'pay_period_transaction_date' => strtotime($udt_obj->getColumn('pay_period_transaction_date')), 'pay_period' => strtotime($udt_obj->getColumn('pay_period_transaction_date')), 'pay_period_id' => $udt_obj->getColumn('pay_period_id'));
                 }
                 //Add time/wage and calculate average hourly rate.
                 $udt_total_time_wage = bcmul(bcdiv($udt_obj->getColumn('total_time'), 3600), $hourly_rate);
                 $udt_total_time_wage_with_burden = bcmul(bcdiv($udt_obj->getColumn('total_time'), 3600), $hourly_rate_with_burden);
                 if (isset($this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id][$column])) {
                     $this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id][$column] += $udt_obj->getColumn('total_time');
                 } else {
                     $this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id][$column] = $udt_obj->getColumn('total_time');
                 }
                 if (isset($this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id][$column . '_wage'])) {
                     $this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id][$column . '_wage'] += $udt_total_time_wage;
                     $this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id][$column . '_wage_with_burden'] += $udt_total_time_wage_with_burden;
                 } else {
                     $this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id][$column . '_wage'] = $udt_total_time_wage;
                     $this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id][$column . '_wage_with_burden'] = $udt_total_time_wage_with_burden;
                 }
                 if ($this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id][$column] != 0) {
                     $this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id][$column . '_hourly_rate'] = bcdiv($this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id][$column . '_wage'], bcdiv($this->tmp_data['user_date_total'][$user_id][$date_stamp][$branch_id][$department_id][$column], 3600));
//.........这里部分代码省略.........
开发者ID:alachaum,项目名称:timetrex,代码行数:101,代码来源:TimesheetSummaryReport.class.php

示例15: getLastRunDate

 function getLastRunDate($raw = FALSE)
 {
     if (isset($this->data['last_run_date'])) {
         if ($raw === TRUE) {
             return $this->data['last_run_date'];
         } else {
             return TTDate::strtotime($this->data['last_run_date']);
         }
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:11,代码来源:CronJobFactory.class.php


注:本文中的TTDate::strtotime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。