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


PHP TTDate::getDayDifference方法代码示例

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


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

示例1: TTnew

        $filter_data['permission_children_ids'] = $permission_children_ids;
    }
    if ($permission->Check('schedule', 'edit_own')) {
        $filter_data['permission_children_ids'][] = $current_user->getId();
    }
}
$sf = TTnew('ScheduleFactory');
$ulf = TTnew('UserListFactory');
$action = Misc::findSubmitButton();
$action = strtolower($action);
switch ($action) {
    case 'submit':
        //Debug::setVerbosity(11);
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
        $fail_transaction = FALSE;
        if (TTDate::getDayDifference($data['start_date_stamp'], $data['end_date_stamp']) > 31) {
            Debug::Text('Date Range Exceeds 31 days, truncating', __FILE__, __LINE__, __METHOD__, 10);
            $sf->Validator->isTrue('date_stamp', FALSE, TTi18n::getText('Date range exceeds the maximum of 31 days'));
        }
        if (!(isset($filter_user_id) and is_array($filter_user_id) and count($filter_user_id) > 0)) {
            $sf->Validator->isTrue('user_id', FALSE, TTi18n::getText('Please select at least one employee'));
        }
        if (!($data['start_full_time_stamp'] != '' and $data['end_full_time_stamp'] != '' and $data['start_full_time_stamp'] >= time() - 86400 * 365 and $data['end_full_time_stamp'] <= time() + 86400 * 365)) {
            $sf->Validator->isTrue('date_stamp', FALSE, TTi18n::getText('Start or End dates are invalid'));
        }
        if ($sf->Validator->isValid()) {
            Redirect::Page(URLBuilder::getURL(array('action' => 'add_mass_schedule', 'filter_user_id' => $filter_user_id, 'data' => $data), '../progress_bar/ProgressBarControl.php'));
        }
    default:
        if ($action != 'submit' and !is_array($data)) {
            Debug::Text(' ID was NOT passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
开发者ID:alachaum,项目名称:timetrex,代码行数:31,代码来源:AddMassSchedule.php

示例2: proRateSalary

 static function proRateSalary($salary, $wage_effective_date, $prev_wage_effective_date, $pp_start_date, $pp_end_date, $termination_date)
 {
     $prev_wage_effective_date = (int) $prev_wage_effective_date;
     if ($wage_effective_date < $pp_start_date) {
         $wage_effective_date = $pp_start_date;
     }
     $total_pay_period_days = ceil(TTDate::getDayDifference($pp_start_date, $pp_end_date));
     if ($prev_wage_effective_date == 0) {
         //ProRate salary to termination date if its in the middle of a pay period.
         if ($termination_date != '' and $termination_date > 0 and $termination_date < $pp_end_date) {
             Debug::text(' Setting PP end date to Termination Date: ' . TTDate::GetDate('DATE', $termination_date), __FILE__, __LINE__, __METHOD__, 10);
             $pp_end_date = $termination_date;
         }
         Debug::text(' Using Pay Period End Date: ' . TTDate::GetDate('DATE', $pp_end_date), __FILE__, __LINE__, __METHOD__, 10);
         $total_wage_effective_days = ceil(TTDate::getDayDifference($wage_effective_date, $pp_end_date));
     } else {
         Debug::text(' Using Prev Effective Date: ' . TTDate::GetDate('DATE', $prev_wage_effective_date), __FILE__, __LINE__, __METHOD__, 10);
         $total_wage_effective_days = ceil(TTDate::getDayDifference($wage_effective_date, $prev_wage_effective_date));
     }
     Debug::text('Salary: ' . $salary . ' Total Pay Period Days: ' . $total_pay_period_days . ' Wage Effective Days: ' . $total_wage_effective_days, __FILE__, __LINE__, __METHOD__, 10);
     //$pro_rate_salary = $salary * ($total_wage_effective_days / $total_pay_period_days);
     $pro_rate_salary = bcmul($salary, bcdiv($total_wage_effective_days, $total_pay_period_days));
     Debug::text('Pro Rate Salary: ' . $pro_rate_salary, __FILE__, __LINE__, __METHOD__, 10);
     return $pro_rate_salary;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:25,代码来源:UserWageFactory.class.php


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