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


PHP TTDate::getBeginMonthEpoch方法代码示例

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


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

示例1: getPayPeriodScheduleDefaultData

 /**
  * Get default data for creating pay period schedules.
  * @return array
  */
 function getPayPeriodScheduleDefaultData()
 {
     $company_id = $this->getCurrentCompanyObject()->getId();
     Debug::Text('Getting user default data...', __FILE__, __LINE__, __METHOD__, 10);
     $data = array('company_id' => $this->getCurrentCompanyObject()->getId(), 'anchor_date' => TTDate::getAPIDate('DATE', TTDate::getBeginMonthEpoch(time())), 'shift_assigned_day_id' => 10, 'day_start_time' => 0, 'new_day_trigger_time' => 3600 * 4, 'maximum_shift_time' => 3600 * 16, 'time_zone' => $this->getCurrentUserPreferenceObject()->getTimeZone(), 'type_id' => 20, 'start_week_day_id' => 0, 'start_day_of_week' => 0, 'timesheet_verify_type_id' => 10, 'timesheet_verify_before_end_date' => 0, 'timesheet_verify_before_transaction_date' => 0);
     Debug::Arr($data, 'Data: ', __FILE__, __LINE__, __METHOD__, 10);
     return $this->returnHandler($data);
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:12,代码来源:APIPayPeriodSchedule.class.php

示例2: foreach

if ($pplf->getRecordCount() > 0) {
    foreach ($pplf as $pp_obj) {
        $pp_columns['premium_policy-' . $pp_obj->getId()] = $pp_obj->getName();
    }
    $columns = array_merge($columns, $pp_columns);
}
//Get all Absence Policies.
$aplf = TTnew('AbsencePolicyListFactory');
$aplf->getByCompanyId($current_company->getId());
if ($aplf->getRecordCount() > 0) {
    foreach ($aplf as $ap_obj) {
        $ap_columns['absence_policy-' . $ap_obj->getId()] = $ap_obj->getName();
    }
    $columns = array_merge($columns, $ap_columns);
}
$default_start_date = TTDate::getBeginMonthEpoch();
$default_end_date = TTDate::getEndMonthEpoch();
//Get all pay periods
$pplf = TTnew('PayPeriodListFactory');
$pplf->getByCompanyId($current_company->getId());
if ($pplf->getRecordCount() > 0) {
    $pp = 0;
    foreach ($pplf as $pay_period_obj) {
        $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++;
    }
开发者ID:alachaum,项目名称:timetrex,代码行数:31,代码来源:TimesheetSummary.php

示例3: TTnew

             Redirect::Page(URLBuilder::getURL(NULL, 'PayPeriodScheduleList.php'));
             break;
         }
     }
     $ppsf->FailTransaction();
 default:
     if (isset($id)) {
         BreadCrumb::setCrumb($title);
         $ppslf = TTnew('PayPeriodScheduleListFactory');
         $ppslf->GetByIdAndCompanyId($id, $current_company->getId());
         foreach ($ppslf as $pay_period_schedule) {
             //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
             $pay_period_schedule_data = array('id' => $pay_period_schedule->getId(), 'company_id' => $pay_period_schedule->getCompany(), 'name' => $pay_period_schedule->getName(), 'description' => $pay_period_schedule->getDescription(), 'type' => $pay_period_schedule->getType(), 'start_week_day_id' => $pay_period_schedule->getStartWeekDay(), 'start_day_of_week' => $pay_period_schedule->getStartDayOfWeek(), 'transaction_date' => $pay_period_schedule->getTransactionDate(), 'primary_day_of_month' => $pay_period_schedule->getPrimaryDayOfMonth(), 'secondary_day_of_month' => $pay_period_schedule->getSecondaryDayOfMonth(), 'primary_transaction_day_of_month' => $pay_period_schedule->getPrimaryTransactionDayOfMonth(), 'secondary_transaction_day_of_month' => $pay_period_schedule->getSecondaryTransactionDayOfMonth(), 'transaction_date_bd' => $pay_period_schedule->getTransactionDateBusinessDay(), 'anchor_date' => $pay_period_schedule->getAnchorDate(), 'annual_pay_periods' => $pay_period_schedule->getAnnualPayPeriods(), 'day_start_time' => $pay_period_schedule->getDayStartTime(), 'time_zone' => $pay_period_schedule->getTimeZone(), 'new_day_trigger_time' => $pay_period_schedule->getNewDayTriggerTime(), 'maximum_shift_time' => $pay_period_schedule->getMaximumShiftTime(), 'shift_assigned_day_id' => $pay_period_schedule->getShiftAssignedDay(), 'timesheet_verify_type_id' => $pay_period_schedule->getTimeSheetVerifyType(), 'timesheet_verify_before_end_date' => $pay_period_schedule->getTimeSheetVerifyBeforeEndDate(), 'timesheet_verify_before_transaction_date' => $pay_period_schedule->getTimeSheetVerifyBeforeTransactionDate(), 'timesheet_verify_notice_before_transaction_date' => $pay_period_schedule->getTimeSheetVerifyNoticeBeforeTransactionDate(), 'timesheet_verify_notice_email' => $pay_period_schedule->getTimeSheetVerifyNoticeEmail(), 'user_ids' => $pay_period_schedule->getUser(), 'deleted' => $pay_period_schedule->getDeleted(), 'created_date' => $pay_period_schedule->getCreatedDate(), 'created_by' => $pay_period_schedule->getCreatedBy(), 'updated_date' => $pay_period_schedule->getUpdatedDate(), 'updated_by' => $pay_period_schedule->getUpdatedBy(), 'deleted_date' => $pay_period_schedule->getDeletedDate(), 'deleted_by' => $pay_period_schedule->getDeletedBy());
         }
     } elseif ($action != 'submit') {
         $pay_period_schedule_data = array('anchor_date' => TTDate::getBeginMonthEpoch(time()), 'day_start_time' => 0, 'new_day_trigger_time' => 3600 * 4, 'maximum_shift_time' => 3600 * 16, 'time_zone' => $current_user_prefs->getTimeZone(), 'type' => 20, 'timesheet_verify_type_id' => 10, 'timesheet_verify_before_end_date' => 0, 'timesheet_verify_before_transaction_date' => 0, 'annual_pay_periods' => 0);
     }
     //Select box options;
     $pay_period_schedule_data['type_options'] = $ppsf->getOptions('type');
     $pay_period_schedule_data['start_week_day_options'] = $ppsf->getOptions('start_week_day');
     $pay_period_schedule_data['shift_assigned_day_options'] = $ppsf->getOptions('shift_assigned_day');
     $pay_period_schedule_data['timesheet_verify_type_options'] = $ppsf->getOptions('timesheet_verify_type');
     $pay_period_schedule_data['time_zone_options'] = $ppsf->getTimeZoneOptions();
     $pay_period_schedule_data['transaction_date_bd_options'] = $ppsf->getOptions('transaction_date_business_day');
     $pay_period_schedule_data['day_of_week_options'] = TTDate::getDayOfWeekArray();
     $pay_period_schedule_data['transaction_date_options'] = Misc::prependArray(array(0 => '0'), TTDate::getDayOfMonthArray());
     $pay_period_schedule_data['day_of_month_options'] = TTDate::getDayOfMonthArray();
     $pay_period_schedule_data['day_of_month_options'][-1] = TTi18n::gettext('- Last Day Of Month -');
     $pay_period_schedule_data['user_options'] = UserListFactory::getByCompanyIdArray($current_company->getId(), FALSE, TRUE);
     if (isset($pay_period_schedule_data['user_ids']) and is_array($pay_period_schedule_data['user_ids'])) {
         $tmp_user_options = UserListFactory::getByCompanyIdArray($current_company->getId(), FALSE, TRUE);
开发者ID:alachaum,项目名称:timetrex,代码行数:31,代码来源:EditPayPeriodSchedule.php

示例4: array

     //Check for default saved report first.
     $ugdlf->getByUserIdAndScriptAndDefault($current_user->getId(), $_SERVER['SCRIPT_NAME']);
     if ($ugdlf->getRecordCount() > 0) {
         Debug::Text('Found Default Report!', __FILE__, __LINE__, __METHOD__, 10);
         $ugd_obj = $ugdlf->getCurrent();
         $filter_data = $ugd_obj->getData();
         $generic_data['id'] = $ugd_obj->getId();
     } else {
         Debug::Text('Default Settings!', __FILE__, __LINE__, __METHOD__, 10);
         //Default selections
         $filter_data['user_status_ids'] = array(-1);
         $filter_data['branch_ids'] = array(-1);
         $filter_data['department_ids'] = array(-1);
         $filter_data['user_title_ids'] = array(-1);
         //$filter_data['pay_period_ids'] = array( '-0000-'.array_shift(array_keys($pay_period_options)) );
         $filter_data['start_date'] = TTDate::getBeginMonthEpoch(time());
         $filter_data['end_date'] = TTDate::getEndMonthEpoch(time());
         $filter_data['group_ids'] = array(-1);
         $filter_data['log_action_ids'] = array(-1);
         $filter_data['log_table_name_ids'] = array(-1);
         //$filter_data['user_ids'] = array_keys( UserListFactory::getByCompanyIdArray( $current_company->getId(), FALSE, FALSE ) );
         if (!isset($filter_data['column_ids'])) {
             $filter_data['column_ids'] = array();
         }
         $filter_data['column_ids'] = array_merge($filter_data['column_ids'], array('-1000-full_name', '-1010-date', '-1020-table_name', '-1030-action', '-1040-description', '-1050-function'));
         $filter_data['primary_sort'] = '-1010-date';
         $filter_data['primary_sort_dir'] = '-1';
         $filter_data['secondary_sort'] = '-1000-full_name';
         $filter_data['secondary_sort_dir'] = '-1';
     }
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:31,代码来源:SystemLog.php

示例5: getScheduleDates

 /**
  * Get all necessary dates for building the schedule in a single call, this is mainly as a performance optimization.
  * @param array $data filter data
  * @return array
  */
 function getScheduleDates($base_date, $type, $strict = TRUE)
 {
     $epoch = TTDate::parseDateTime($base_date);
     if ($epoch == '') {
         $epoch = TTDate::getTime();
     }
     if ($type == '') {
         $type = 'week';
     }
     switch (strtolower($type)) {
         case 'day':
             if ($strict == TRUE) {
                 $start_date = TTDate::getBeginDayEpoch($epoch);
                 $end_date = TTDate::getEndDayEpoch($epoch);
             } else {
                 $start_date = TTDate::getBeginDayEpoch($epoch);
                 $end_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) + 86400);
             }
             break;
         case 'week':
             if ($strict == TRUE) {
                 $start_date = TTDate::getBeginWeekEpoch($epoch, $this->getCurrentUserPreferenceObject()->getStartWeekDay());
                 $end_date = TTDate::getEndWeekEpoch($epoch, $this->getCurrentUserPreferenceObject()->getStartWeekDay());
             } else {
                 $start_date = TTDate::getBeginDayEpoch($epoch);
                 $end_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) + 7 * 86400);
             }
             break;
         case 'month':
             if ($strict == TRUE) {
                 $start_date = TTDate::getBeginWeekEpoch(TTDate::getBeginMonthEpoch($epoch), $this->getCurrentUserPreferenceObject()->getStartWeekDay());
                 $end_date = TTDate::getEndWeekEpoch(TTDate::getEndMonthEpoch($epoch), $this->getCurrentUserPreferenceObject()->getStartWeekDay());
             } else {
                 $start_date = TTDate::getBeginDayEpoch($epoch);
                 $end_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) + 30 * 86400);
             }
             break;
         case 'year':
             if ($strict == TRUE) {
                 $start_date = TTDate::getBeginWeekEpoch(TTDate::getBeginMonthEpoch($epoch), $this->getCurrentUserPreferenceObject()->getStartWeekDay());
                 $end_date = TTDate::getEndWeekEpoch(TTDate::getEndMonthEpoch(TTDate::getEndMonthEpoch($epoch) + 86400 * 2), $this->getCurrentUserPreferenceObject()->getStartWeekDay());
             } else {
                 $start_date = TTDate::getBeginDayEpoch($epoch);
                 $end_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) + 62 * 86400);
             }
             break;
     }
     $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));
     Debug::Arr($retarr, 'Schedule Dates: Base Date: ' . $base_date . ' Type: ' . $type . ' Strict: ' . (int) $strict, __FILE__, __LINE__, __METHOD__, 10);
     return $retarr;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:56,代码来源:APISchedule.class.php

示例6: getNextPayPeriod

 function getNextPayPeriod($end_date = NULL)
 {
     if (!$this->Validator->isValid()) {
         return FALSE;
     }
     //Manual Pay Period Schedule, skip repeating...
     if ($this->getType() == 5) {
         return FALSE;
     }
     $pplf = new PayPeriodListFactory();
     //Debug::text('PP Schedule ID: '. $this->getId(), __FILE__, __LINE__, __METHOD__, 10);
     //Debug::text('PP Schedule Name: '. $this->getName(), __FILE__, __LINE__, __METHOD__, 10);
     Debug::text('PP Schedule Type (' . $this->getType() . '): ' . Option::getByKey($this->getType(), $this->getOptions('type')), __FILE__, __LINE__, __METHOD__, 10);
     //Debug::text('Anchor Date: '. $this->getAnchorDate() ." - ". TTDate::getDate('DATE+TIME', $this->getAnchorDate() ), __FILE__, __LINE__, __METHOD__, 10);
     //Debug::text('Primary Date: '. $this->getPrimaryDate() ." - ". TTDate::getDate('DATE+TIME', $this->getPrimaryDate() ), __FILE__, __LINE__, __METHOD__, 10);
     //Debug::text('Secondary Date: '. $this->getSecondaryDate() ." - ". TTDate::getDate('DATE+TIME', $this->getPrimaryDate() ), __FILE__, __LINE__, __METHOD__, 10);
     $last_pay_period_is_new = FALSE;
     if ($end_date != '' and $end_date != 0) {
         Debug::text('End Date is set: ' . TTDate::getDate('DATE+TIME', $end_date), __FILE__, __LINE__, __METHOD__, 10);
         $last_pay_period_end_date = $end_date;
     } else {
         Debug::text('Checking for Previous pay periods...', __FILE__, __LINE__, __METHOD__, 10);
         //Get the last pay period schedule in the database.
         $pplf->getByPayPeriodScheduleId($this->getId(), NULL, NULL, NULL, array('start_date' => 'desc'));
         $last_pay_period = $pplf->getCurrent();
         if ($last_pay_period->isNew()) {
             $last_pay_period_is_new = TRUE;
             Debug::text('No Previous pay periods...', __FILE__, __LINE__, __METHOD__, 10);
             //Do this so a rollover doesn't happen while we're calculating.
             //$last_pay_period_end_date = TTDate::getTime();
             //This causes the pay period schedule to jump ahead one month. So set this to be beginning of the month.
             $last_pay_period_end_date = TTDate::getBeginMonthEpoch();
         } else {
             Debug::text('Previous pay periods found... ID: ' . $last_pay_period->getId(), __FILE__, __LINE__, __METHOD__, 10);
             $last_pay_period_end_date = $last_pay_period->getEndDate();
         }
         unset($last_pay_period, $pplf);
     }
     Debug::text('aLast Pay Period End Date: ' . TTDate::getDate('DATE+TIME', $last_pay_period_end_date) . ' (' . $last_pay_period_end_date . ')', __FILE__, __LINE__, __METHOD__, 10);
     //FIXME: This breaks having pay periods with different daily start times.
     //However, without it, I think DST breaks pay periods.
     //$last_pay_period_end_date = TTDate::getEndDayEpoch( $last_pay_period_end_date + 1 ) - 86400;
     $last_pay_period_end_date = TTDate::getEndDayEpoch($last_pay_period_end_date - 86400 / 2);
     Debug::text('bLast Pay Period End Date: ' . TTDate::getDate('DATE+TIME', $last_pay_period_end_date) . ' (' . $last_pay_period_end_date . ')', __FILE__, __LINE__, __METHOD__, 10);
     if ($this->getDayStartTime() != 0) {
         Debug::text('Daily Start Time is set, adjusting Last Pay Period End Date by: ' . TTDate::getHours($this->getDayStartTime()), __FILE__, __LINE__, __METHOD__, 10);
         //Next adjust last_pay_period_end_date (which becomes the start date) to DayStartTime because then there could be a gap if they
         //change this mid-schedule. The End Date will take care of it after the first pay period.
         $last_pay_period_end_date = TTDate::getTimeLockedDate(TTDate::getBeginDayEpoch($last_pay_period_end_date) + $this->getDayStartTime(), $last_pay_period_end_date);
         Debug::text('cLast Pay Period End Date: ' . TTDate::getDate('DATE+TIME', $last_pay_period_end_date) . ' (' . $last_pay_period_end_date . ')', __FILE__, __LINE__, __METHOD__, 10);
     }
     $insert_pay_period = 1;
     //deprecate primary pay periods.
     switch ($this->getType()) {
         case 10:
             //Weekly
         //Weekly
         case 20:
             //Bi-Weekly
             $last_pay_period_end_day_of_week = TTDate::getDayOfWeek($last_pay_period_end_date);
             Debug::text('Last Pay Period End Day Of Week: ' . $last_pay_period_end_day_of_week . ' Start Day Of Week: ' . $this->getStartDayOfWeek(), __LINE__, __METHOD__, 10);
             if ($last_pay_period_end_day_of_week != $this->getStartDayOfWeek()) {
                 Debug::text('zTmp Pay Period End Date: ' . 'next ' . TTDate::getDayOfWeekByInt($this->getStartDayOfWeek()), __FILE__, __LINE__, __METHOD__, 10);
                 //$tmp_pay_period_end_date = strtotime('next '. TTDate::getDayOfWeekByInt( $this->getStartDayOfWeek() ), $last_pay_period_end_date )-1;
                 $tmp_pay_period_end_date = strtotime('next ' . TTDate::getDayOfWeekByInt($this->getStartDayOfWeek(), FALSE), $last_pay_period_end_date);
                 //strtotime doesn't keep time when using "next", it resets it to midnight on the day, so we need to adjust for that.
                 $tmp_pay_period_end_date = TTDate::getTimeLockedDate(TTDate::getBeginDayEpoch($tmp_pay_period_end_date) + $this->getDayStartTime(), $tmp_pay_period_end_date) - 1;
             } else {
                 $tmp_pay_period_end_date = $last_pay_period_end_date;
                 //This should fix a bug where if they are creating a new pay period schedule
                 //starting on Monday with the anchor date of 01-Jul-08, it would start on 01-Jul-08 (Tue)
                 //rather moving back to the Monday.
                 if (TTDate::getDayOfMonth($tmp_pay_period_end_date) != TTDate::getDayOfMonth($tmp_pay_period_end_date + 1)) {
                     Debug::text('Right on day boundary, minus an additional second to account for difference...', __FILE__, __LINE__, __METHOD__, 10);
                     $tmp_pay_period_end_date--;
                 }
             }
             Debug::text('aTmp Pay Period End Date: ' . TTDate::getDate('DATE+TIME', $tmp_pay_period_end_date) . ' (' . $tmp_pay_period_end_date . ')', __FILE__, __LINE__, __METHOD__, 10);
             $start_date = $tmp_pay_period_end_date + 1;
             if ($this->getType() == 10) {
                 //Weekly
                 $tmp_pay_period_end_date = TTDate::getMiddleDayEpoch($start_date) + 86400 * 7;
                 //Add one week
             } elseif ($this->getType() == 20) {
                 //Bi-Weekly
                 $tmp_pay_period_end_date = TTDate::getMiddleDayEpoch($start_date) + 86400 * 14;
                 //Add two weeks
             }
             //Use Begin Day Epoch to nullify DST issues.
             $end_date = TTDate::getBeginDayEpoch($tmp_pay_period_end_date) - 1;
             $transaction_date = TTDate::getMiddleDayEpoch(TTDate::getMiddleDayEpoch($end_date) + $this->getTransactionDate() * 86400);
             break;
         case 30:
             //Semi-monthly
             $tmp_last_pay_period_end_day_of_month = TTDate::getDayOfMonth($last_pay_period_end_date + 1);
             Debug::text('bLast Pay Period End Day Of Month: ' . $tmp_last_pay_period_end_day_of_month, __FILE__, __LINE__, __METHOD__, 10);
             if ($tmp_last_pay_period_end_day_of_month == $this->convertLastDayOfMonth($this->getPrimaryDayOfMonth())) {
                 $insert_pay_period = 1;
                 $primary = TRUE;
             } elseif ($tmp_last_pay_period_end_day_of_month == $this->convertLastDayOfMonth($this->getSecondaryDayOfMonth())) {
//.........这里部分代码省略.........
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:101,代码来源:PayPeriodScheduleFactory.class.php

示例7: array_keys

            $row_keys = array_keys($data['milestone_rows']);
            sort($row_keys);
            Debug::Text('Lowest ID: ' . $row_keys[0], __FILE__, __LINE__, __METHOD__, 10);
            $lowest_id = $row_keys[0];
            if ($lowest_id < 0) {
                $next_blank_id = $lowest_id - 1;
            } else {
                $next_blank_id = -1;
            }
            Debug::Text('Next Blank ID: ' . $next_blank_id, __FILE__, __LINE__, __METHOD__, 10);
            $data['milestone_rows'][$next_blank_id] = array('id' => $next_blank_id, 'length_of_service' => 0, 'accrual_rate' => 0, 'minimum_time' => 0, 'maximum_time' => 0);
        } elseif ($action != 'submit' and $action != 'change_type') {
            $data = array('type_id' => 10, 'minimum_employed_days' => 0, 'recalculate_start_date' => TTDate::getBeginMonthEpoch(time()), 'recalculate_end_date' => TTDate::getEndMonthEpoch(time()), 'milestone_rows' => array(-1 => array('id' => -1, 'length_of_service' => 0, 'accrual_rate' => '0.0000', 'minimum_time' => 0, 'maximum_time' => 0)));
        } else {
            if ($data['type_id'] == 20) {
                $data['recalculate_start_date'] = TTDate::getBeginMonthEpoch(time());
                $data['recalculate_end_date'] = TTDate::getEndMonthEpoch(time());
            }
        }
        //print_r($data);
        //Select box options;
        $data['type_options'] = $apf->getOptions('type');
        $data['apply_frequency_options'] = $apf->getOptions('apply_frequency');
        $data['month_options'] = TTDate::getMonthOfYearArray();
        $data['day_of_month_options'] = TTDate::getDayOfMonthArray();
        $data['day_of_week_options'] = TTDate::getDayOfWeekArray();
        $data['length_of_service_unit_options'] = $apmf->getOptions('length_of_service_unit');
        $smarty->assign_by_ref('data', $data);
        break;
}
$smarty->assign_by_ref('apf', $apf);
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:EditAccrualPolicy.php

示例8: createPayStubAmendments

 function createPayStubAmendments($epoch = NULL)
 {
     //Get all recurring pay stub amendments and generate single pay stub amendments if appropriate.
     if ($epoch == '') {
         $epoch = TTDate::getTime();
     }
     $ulf = TTnew('UserListFactory');
     Debug::text('Recurring PS Amendment ID: ' . $this->getId() . ' Frequency: ' . $this->getFrequency(), __FILE__, __LINE__, __METHOD__, 10);
     $this->StartTransaction();
     $tmp_user_ids = $this->getUser();
     if ($tmp_user_ids[0] == -1) {
         $ulf->getByCompanyIdAndStatus($this->getCompany(), 10);
         foreach ($ulf as $user_obj) {
             $user_ids[] = $user_obj->getId();
         }
         unset($user_obj);
     } else {
         $user_ids = $this->getUser();
     }
     unset($tmp_user_ids);
     Debug::text('Total User IDs: ' . count($user_ids), __FILE__, __LINE__, __METHOD__, 10);
     if (is_array($user_ids) and count($user_ids) > 0) {
         //Make the PS amendment duplicate check start/end date separate
         //Make the PS amendment effective date separate.
         switch ($this->getFrequency()) {
             case 10:
                 //Get all open pay periods
                 $pplf = TTnew('PayPeriodListFactory');
                 //FIXME: Get all non-closed pay periods AFTER the start date.
                 $pplf->getByUserIdListAndNotStatusAndStartDateAndEndDate($user_ids, 20, $this->getStartDate(), $this->getEndDate());
                 //All non-closed pay periods
                 Debug::text('Found Open Pay Periods: ' . $pplf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
                 foreach ($pplf as $pay_period_obj) {
                     Debug::text('Working on Pay Period: ' . $pay_period_obj->getId(), __FILE__, __LINE__, __METHOD__, 10);
                     //If near the end of a pay period, or a pay period is already ended, add PS amendment if
                     //it does not already exist.
                     if ($epoch >= $pay_period_obj->getEndDate() and $this->checkTimeFrame($epoch)) {
                         Debug::text('After end of pay period. Start Date: ' . TTDate::getDate('DATE+TIME', $pay_period_obj->getStartDate()) . ' End Date: ' . TTDate::getDate('DATE+TIME', $pay_period_obj->getEndDate()), __FILE__, __LINE__, __METHOD__, 10);
                         $psalf = TTnew('PayStubAmendmentListFactory');
                         //Loop through each user of this Pay Period Schedule adding PS amendments if they don't already exist.
                         $pay_period_schedule_users = $pay_period_obj->getPayPeriodScheduleObject()->getUser();
                         Debug::text(' Pay Period Schedule Users: ' . count($pay_period_schedule_users), __FILE__, __LINE__, __METHOD__, 10);
                         foreach ($pay_period_schedule_users as $user_id) {
                             //Make sure schedule user is in the PS amendment user list and user is active.
                             Debug::text(' Pay Period Schedule User: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
                             //Debug::Arr($user_ids, ' Recurring PS Amendment Selected Users: ', __FILE__, __LINE__, __METHOD__,10);
                             if ($ulf->getById($user_id)->getCurrent()->getStatus() == 10 and in_array($user_id, $user_ids)) {
                                 //Check to see if the amendment was added already.
                                 if ($psalf->getByUserIdAndRecurringPayStubAmendmentIdAndStartDateAndEndDate($user_id, $this->getId(), $pay_period_obj->getStartDate(), $pay_period_obj->getEndDate())->getRecordCount() == 0) {
                                     //No amendment, good to insert one
                                     Debug::text('Inserting Recurring PS Amendment for User: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
                                     $psaf = TTnew('PayStubAmendmentFactory');
                                     $psaf->setUser($user_id);
                                     $psaf->setStatus(50);
                                     $psaf->setType($this->getType());
                                     $psaf->setRecurringPayStubAmendmentId($this->getId());
                                     $psaf->setPayStubEntryNameId($this->getPayStubEntryNameId());
                                     if ($this->getType() == 10) {
                                         $psaf->setRate($this->getRate());
                                         $psaf->setUnits($this->getUnits());
                                         $psaf->setAmount($this->getAmount());
                                     } else {
                                         $psaf->setPercentAmount($this->getPercentAmount());
                                         $psaf->setPercentAmountEntryNameID($this->getPercentAmountEntryNameId());
                                     }
                                     $psaf->setDescription($this->getPayStubAmendmentDescription());
                                     $psaf->setEffectiveDate(TTDate::getBeginDayEpoch($pay_period_obj->getEndDate()));
                                     if ($psaf->isValid()) {
                                         $psaf->Save();
                                     }
                                 } else {
                                     //Amendment already inserted!
                                     Debug::text('Recurring PS Amendment already inserted for User: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
                                 }
                             } else {
                                 Debug::text('Skipping User because they are INACTIVE or are not on the Recurring PS Amendment User List - ID: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
                                 //continue;
                             }
                         }
                     } else {
                         Debug::text('Not in TimeFrame, not inserting amendments: Epoch: ' . $epoch . ' Pay Period End Date: ' . $pay_period_obj->getEndDate(), __FILE__, __LINE__, __METHOD__, 10);
                     }
                 }
                 break;
             case 30:
                 //Weekly
             //Weekly
             case 40:
                 //Monthly
             //Monthly
             case 70:
                 //Annually
                 switch ($this->getFrequency()) {
                     case 30:
                         $trigger_date = TTDate::getDateOfNextDayOfWeek(TTDate::getBeginWeekEpoch($epoch), $this->getStartDate());
                         $start_date = TTDate::getBeginWeekEpoch($epoch);
                         $end_date = TTDate::getEndWeekEpoch($epoch);
                         break;
                     case 40:
                         $trigger_date = TTDate::getDateOfNextDayOfMonth(TTDate::getBeginMonthEpoch($epoch), $this->getStartDate());
//.........这里部分代码省略.........
开发者ID:alachaum,项目名称:timetrex,代码行数:101,代码来源:RecurringPayStubAmendmentFactory.class.php

示例9: extract

if (!$permission->Check('report', 'enabled') or !$permission->Check('report', 'view_pay_stub_summary')) {
    $permission->Redirect(FALSE);
    //Redirect
}
$smarty->assign('title', TTi18n::gettext($title = 'Pay Stub Summary Report'));
// See index.php
/*
 * Get FORM variables
 */
extract(FormVariables::GetVariables(array('action', 'generic_data', 'filter_data')));
URLBuilder::setURL($_SERVER['SCRIPT_NAME'], array('filter_data' => $filter_data));
$static_columns = array('-0900-first_name' => TTi18n::gettext('First Name'), '-0901-middle_name' => TTi18n::gettext('Middle Name'), '-0902-middle_initial' => TTi18n::gettext('Middle Initial'), '-0903-last_name' => TTi18n::gettext('Last Name'), '-1000-full_name' => TTi18n::gettext('Full Name'), '-1002-employee_number' => TTi18n::gettext('Employee #'), '-1010-title' => TTi18n::gettext('Title'), '-1020-province' => TTi18n::gettext('Province/State'), '-1030-country' => TTi18n::gettext('Country'), '-1039-group' => TTi18n::gettext('Group'), '-1040-default_branch' => TTi18n::gettext('Default Branch'), '-1050-default_department' => TTi18n::gettext('Default Department'), '-1060-sin' => TTi18n::gettext('SIN/SSN'), '-1065-birth_date' => TTi18n::gettext('Birth Date'), '-1070-hire_date' => TTi18n::gettext('Hire Date'), '-1080-since_hire_date' => TTi18n::gettext('Since Hired'), '-1085-termination_date' => TTi18n::gettext('Termination Date'), '-1086-institution' => TTi18n::gettext('Bank Institution'), '-1087-transit' => TTi18n::gettext('Bank Transit/Routing'), '-1089-account' => TTi18n::gettext('Bank Account'), '-1090-pay_period' => TTi18n::gettext('Pay Period'), '-1100-pay_stub_start_date' => TTi18n::gettext('Start Date'), '-1110-pay_stub_end_date' => TTi18n::gettext('End Date'), '-1120-pay_stub_transaction_date' => TTi18n::gettext('Transaction Date'), '-1130-currency' => TTi18n::gettext('Currency'), '-1131-current_currency' => TTi18n::gettext('Current Currency'));
$psealf = new PayStubEntryAccountListFactory();
$psen_columns = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 20, 30, 40, 50, 60, 65), FALSE);
$columns = Misc::prependArray($static_columns, $psen_columns);
$default_transaction_start_date = TTDate::getBeginMonthEpoch(time());
$default_transaction_end_date = TTDate::getEndMonthEpoch(time());
//Get all pay periods
$pplf = new PayPeriodListFactory();
$pplf->getPayPeriodsWithPayStubsByCompanyId($current_company->getId());
$pay_period_options = array();
if ($pplf->getRecordCount() > 0) {
    $pp = 0;
    foreach ($pplf as $pay_period_obj) {
        $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++;
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:PayStubSummary.php

示例10: getTimePeriodDates


//.........这里部分代码省略.........
             }
             if (!isset($params['pay_period_schedule_id'])) {
                 $params['pay_period_schedule_id'] = NULL;
             }
             $pay_period_ids = array();
             //Since we allow multiple pay_period schedules to be selected, we have to return pay_period_ids, not start/end dates.
             if ($time_period == 'this_pay_period') {
                 Debug::text('this_pay_period', __FILE__, __LINE__, __METHOD__, 10);
                 $pplf = TTnew('PayPeriodListFactory');
                 $pplf->getThisPayPeriodByCompanyIdAndPayPeriodScheduleIdAndDate($user_obj->getCompany(), $params['pay_period_schedule_id'], time());
                 if ($pplf->getRecordCount() > 0) {
                     foreach ($pplf as $pp_obj) {
                         $pay_period_ids[] = $pp_obj->getId();
                     }
                 }
             } elseif ($time_period == 'last_pay_period') {
                 Debug::text('last_pay_period', __FILE__, __LINE__, __METHOD__, 10);
                 $pplf = TTnew('PayPeriodListFactory');
                 $pplf->getLastPayPeriodByCompanyIdAndPayPeriodScheduleIdAndDate($user_obj->getCompany(), $params['pay_period_schedule_id'], time());
                 if ($pplf->getRecordCount() > 0) {
                     foreach ($pplf as $pp_obj) {
                         $pay_period_ids[] = $pp_obj->getId();
                     }
                 }
             } else {
                 Debug::text('no_pay_period', __FILE__, __LINE__, __METHOD__, 10);
             }
             Debug::Arr($pay_period_ids, 'Pay Period IDs: ', __FILE__, __LINE__, __METHOD__, 10);
             if (count($pay_period_ids) == 0) {
                 unset($pay_period_ids);
             }
             break;
         case 'this_month':
             $start_date = TTDate::getBeginMonthEpoch($epoch);
             $end_date = TTDate::getEndMonthEpoch($epoch);
             break;
         case 'last_month':
             $start_date = TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch($epoch) - 86400);
             $end_date = TTDate::getEndMonthEpoch(TTDate::getBeginMonthEpoch($epoch) - 86400);
             break;
         case 'last_2_months':
             $start_date = TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch($epoch) - 86400 * 32);
             $end_date = TTDate::getEndMonthEpoch(TTDate::getBeginMonthEpoch($epoch) - 86400);
             break;
         case 'last_30_days':
             $start_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400 * 30);
             $end_date = TTDate::getEndDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400);
             break;
         case 'last_45_days':
             $start_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400 * 45);
             $end_date = TTDate::getEndDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400);
             break;
         case 'last_60_days':
             $start_date = TTDate::getBeginDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400 * 60);
             $end_date = TTDate::getEndDayEpoch(TTDate::getMiddleDayEpoch($epoch) - 86400);
             break;
         case 'this_quarter':
             $quarter = TTDate::getYearQuarter($epoch);
             $quarter_dates = TTDate::getYearQuarters($epoch, $quarter);
             //Debug::Arr($quarter_dates, 'Quarter Dates: Quarter: '. $quarter, __FILE__, __LINE__, __METHOD__,10);
             $start_date = $quarter_dates['start'];
             $end_date = $quarter_dates['end'];
             break;
         case 'last_quarter':
             $quarter = TTDate::getYearQuarter($epoch) - 1;
             if ($quarter == 0) {
开发者ID:alachaum,项目名称:timetrex,代码行数:67,代码来源:TTDate.class.php

示例11: getAPISearchByCompanyIdAndArrayCriteria

    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('status_id', 'last_login_date', 'total_active_days', 'last_login_days', 'this_month_max_active_users', 'this_month_avg_active_users', 'this_month_min_active_users', 'last_month_max_active_users', 'last_month_avg_active_users', 'last_month_min_active_users');
        $sort_column_aliases = array('status' => 'status_id', 'product_edition' => 'product_edition_id');
        $order = $this->getColumnsFromAliases($order, $sort_column_aliases);
        if ($order == NULL) {
            $order = array('status_id' => 'asc', 'name' => 'asc');
            $strict = FALSE;
        } else {
            //Always try to order by status first so INACTIVE employees go to the bottom.
            if (!isset($order['status_id'])) {
                $order = Misc::prependArray(array('status_id' => 'asc'), $order);
            }
            //Always sort by last name,first name after other columns
            if (!isset($order['name'])) {
                $order['name'] = 'asc';
            }
            $strict = TRUE;
        }
        //Debug::Arr($order,'Order Data:', __FILE__, __LINE__, __METHOD__,10);
        //Debug::Arr($filter_data,'Filter Data:', __FILE__, __LINE__, __METHOD__,10);
        $uf = new UserFactory();
        $cuff = new CompanyUserCountFactory();
        $ph = array();
        $query = '
					select 	a.*,
							_ADODB_COUNT
							(select max(last_login_date) from ' . $uf->getTable() . ' as uf where uf.company_id = a.id ) as last_login_date,
							((select max(last_login_date) from ' . $uf->getTable() . ' as uf where uf.company_id = a.id )-a.created_date) as total_active_days,
							(' . time() . '-(select max(last_login_date) from ' . $uf->getTable() . ' as uf where uf.company_id = a.id )) as last_login_days,
							(select min(active_users) as min_active_users from ' . $cuff->getTable() . ' as cuff where cuff.company_id = a.id AND date_stamp >= ' . $this->db->qstr($this->db->BindDate(TTDate::getBeginMonthEpoch())) . ' AND date_stamp <= ' . $this->db->qstr($this->db->BindDate(time())) . ' ) as this_month_min_active_users,
							(select avg(active_users) as avg_active_users from ' . $cuff->getTable() . ' as cuff where cuff.company_id = a.id AND date_stamp >= ' . $this->db->qstr($this->db->BindDate(TTDate::getBeginMonthEpoch())) . ' AND date_stamp <= ' . $this->db->qstr($this->db->BindDate(time())) . ' ) as this_month_avg_active_users,
							(select max(active_users) as max_active_users from ' . $cuff->getTable() . ' as cuff where cuff.company_id = a.id AND date_stamp >= ' . $this->db->qstr($this->db->BindDate(TTDate::getBeginMonthEpoch())) . ' AND date_stamp <= ' . $this->db->qstr($this->db->BindDate(time())) . ' ) as this_month_max_active_users,
							(select min(active_users) as min_active_users from ' . $cuff->getTable() . ' as cuff where cuff.company_id = a.id AND date_stamp >= ' . $this->db->qstr($this->db->BindDate(TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch() - 86400))) . ' AND date_stamp <= ' . $this->db->qstr($this->db->BindDate(TTDate::getEndMonthEpoch(TTDate::getBeginMonthEpoch() - 86400))) . ' ) as last_month_min_active_users,
							(select avg(active_users) as avg_active_users from ' . $cuff->getTable() . ' as cuff where cuff.company_id = a.id AND date_stamp >= ' . $this->db->qstr($this->db->BindDate(TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch() - 86400))) . ' AND date_stamp <= ' . $this->db->qstr($this->db->BindDate(TTDate::getEndMonthEpoch(TTDate::getBeginMonthEpoch() - 86400))) . ' ) as last_month_avg_active_users,
							(select max(active_users) as max_active_users from ' . $cuff->getTable() . ' as cuff where cuff.company_id = a.id AND date_stamp >= ' . $this->db->qstr($this->db->BindDate(TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch() - 86400))) . ' AND date_stamp <= ' . $this->db->qstr($this->db->BindDate(TTDate::getEndMonthEpoch(TTDate::getBeginMonthEpoch() - 86400))) . ' ) as last_month_max_active_users,
							y.first_name as created_by_first_name,
							y.middle_name as created_by_middle_name,
							y.last_name as created_by_last_name,
							z.first_name as updated_by_first_name,
							z.middle_name as updated_by_middle_name,
							z.last_name as updated_by_last_name
							_ADODB_COUNT
					from 	' . $this->getTable() . ' as a
						LEFT JOIN ' . $uf->getTable() . ' as y ON ( a.created_by = y.id AND y.deleted = 0 )
						LEFT JOIN ' . $uf->getTable() . ' as z ON ( a.updated_by = z.id AND z.deleted = 0 )
					where	1=1
					';
        $query .= isset($filter_data['permission_children_ids']) ? $this->getWhereClauseSQL('a.created_by', $filter_data['permission_children_ids'], 'numeric_list', $ph) : NULL;
        $query .= isset($filter_data['id']) ? $this->getWhereClauseSQL('a.id', $filter_data['id'], 'numeric_list', $ph) : NULL;
        $query .= isset($filter_data['exclude_id']) ? $this->getWhereClauseSQL('a.id', $filter_data['exclude_id'], 'not_numeric_list', $ph) : NULL;
        if (isset($filter_data['status']) and trim($filter_data['status']) != '' and !isset($filter_data['status_id'])) {
            $filter_data['status_id'] = Option::getByFuzzyValue($filter_data['status'], $this->getOptions('status'));
        }
        $query .= isset($filter_data['status_id']) ? $this->getWhereClauseSQL('a.status_id', $filter_data['status_id'], 'numeric_list', $ph) : NULL;
        $query .= isset($filter_data['name']) ? $this->getWhereClauseSQL('a.name', $filter_data['name'], 'text_metaphone', $ph) : NULL;
        $query .= isset($filter_data['short_name']) ? $this->getWhereClauseSQL('a.short_name', $filter_data['short_name'], 'text', $ph) : NULL;
        $query .= isset($filter_data['product_edition_id']) ? $this->getWhereClauseSQL('a.product_edition_id', $filter_data['product_edition_id'], 'numeric_list', $ph) : NULL;
        $query .= isset($filter_data['country']) ? $this->getWhereClauseSQL('a.country', $filter_data['country'], 'upper_text_list', $ph) : NULL;
        $query .= isset($filter_data['province']) ? $this->getWhereClauseSQL('a.province', $filter_data['province'], 'upper_text_list', $ph) : NULL;
        $query .= isset($filter_data['city']) ? $this->getWhereClauseSQL('a.city', $filter_data['city'], 'text', $ph) : NULL;
        $query .= isset($filter_data['address1']) ? $this->getWhereClauseSQL('a.address1', $filter_data['address1'], 'text', $ph) : NULL;
        $query .= isset($filter_data['address2']) ? $this->getWhereClauseSQL('a.address2', $filter_data['address2'], 'text', $ph) : NULL;
        $query .= isset($filter_data['postal_code']) ? $this->getWhereClauseSQL('a.postal_code', $filter_data['postal_code'], 'text', $ph) : NULL;
        $query .= isset($filter_data['work_phone']) ? $this->getWhereClauseSQL('a.work_phone', $filter_data['work_phone'], 'phone', $ph) : NULL;
        $query .= isset($filter_data['fax_phone']) ? $this->getWhereClauseSQL('a.fax_phone', $filter_data['fax_phone'], 'phone', $ph) : NULL;
        $query .= isset($filter_data['business_number']) ? $this->getWhereClauseSQL('a.business_number', $filter_data['businessnumber'], 'text', $ph) : NULL;
        $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);
        $this->ExecuteSQL($query, $ph, $limit, $page);
        return $this;
    }
开发者ID:alachaum,项目名称:timetrex,代码行数:86,代码来源:CompanyListFactory.class.php

示例12: getCompanyPhonePunchData

 function getCompanyPhonePunchData($data = NULL, $disable_paging = FALSE)
 {
     if (!$this->getPermissionObject()->Check('company', 'enabled') or !($this->getPermissionObject()->Check('company', 'view') or $this->getPermissionObject()->Check('company', 'view_own') or $this->getPermissionObject()->Check('company', 'view_child'))) {
         return $this->getPermissionObject()->PermissionDenied();
     }
     $data = $this->initializeFilterAndPager($data, $disable_paging);
     if ($this->getPermissionObject()->Check('company', 'view') == FALSE) {
         if ($this->getPermissionObject()->Check('company', 'view_child')) {
             $data['filter_data']['company_id'] = $this->getCurrentCompanyObject()->getId();
         }
         if ($this->getPermissionObject()->Check('company', 'view_own')) {
             $data['filter_data']['company_id'] = $this->getCurrentCompanyObject()->getId();
         }
     }
     if (!isset($data['filter_data']['company_id'])) {
         $data['filter_data']['company_id'] = $this->getCurrentCompanyObject()->getId();
     }
     if (!isset($data['filter_data']['start_date'])) {
         $data['filter_data']['start_date'] = TTDate::getBeginMonthEpoch(time());
     }
     if (!isset($data['filter_data']['end_date'])) {
         $data['filter_data']['end_date'] = TTDate::getEndMonthEpoch(time());
     }
     $llf = TTnew('LogListFactory');
     $llf->getByPhonePunchDataByCompanyIdAndStartDateAndEndDate($data['filter_data']['company_id'], $data['filter_data']['start_date'], $data['filter_data']['end_date']);
     Debug::Text('Record Count: ' . $llf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
     if ($llf->getRecordCount() > 0) {
         $this->getProgressBarObject()->start($this->getAMFMessageID(), $llf->getRecordCount());
         $this->setPagerObject($llf);
         foreach ($llf as $l_obj) {
             $retarr[] = array('company_id' => $l_obj->getColumn('company_id'), 'product' => $l_obj->getColumn('product'), 'minutes' => $l_obj->getColumn('minutes'), 'billable_minutes' => $l_obj->getColumn('billable_units'), 'calls' => $l_obj->getColumn('calls'), 'unique_users' => $l_obj->getColumn('unique_users'));
             $this->getProgressBarObject()->set($this->getAMFMessageID(), $llf->getCurrentRow());
         }
         $this->getProgressBarObject()->stop($this->getAMFMessageID());
         return $this->returnHandler($retarr);
     }
     return $this->returnHandler(TRUE);
     //No records returned.
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:39,代码来源:APICompany.class.php

示例13: getNextDate

 function getNextDate($epoch = FALSE)
 {
     if ($epoch == '') {
         $epoch = TTDate::getTime();
     }
     if ($this->getSpecialDay() == 1 or $this->getSpecialDay() == 5) {
         Debug::text('Easter Sunday Date...', __FILE__, __LINE__, __METHOD__, 10);
         //Use easter_days() instead, as easter_date returns incorrect values for some timezones/years (2010 and US/Eastern on Windows)
         //$easter_epoch = easter_date(date('Y', $epoch));
         $easter_epoch = mktime(12, 0, 0, 3, 21 + easter_days(date('Y', $epoch)), date('Y', $epoch));
         //Fix "cross-year" bug.
         if ($easter_epoch < $epoch) {
             //$easter_epoch = easter_date(date('Y', $epoch)+1);
             $easter_epoch = mktime(12, 0, 0, 3, 21 + easter_days(date('Y', $epoch) + 1), date('Y', $epoch) + 1);
         }
         if ($this->getSpecialDay() == 1) {
             Debug::text('Good Friday Date...', __FILE__, __LINE__, __METHOD__, 10);
             //$holiday_epoch = mktime(12,0,0,date('n',$easter_epoch),date('j',$easter_epoch) - 2, date('Y', $easter_epoch));
             $holiday_epoch = $easter_epoch - 2 * 86400;
         } else {
             $holiday_epoch = $easter_epoch;
         }
     } else {
         if ($this->getType() == 10) {
             //Static
             Debug::text('Static Date...', __FILE__, __LINE__, __METHOD__, 10);
             //Static date
             $holiday_epoch = mktime(12, 0, 0, $this->getMonth(), $this->getDayOfMonth(), date('Y', $epoch));
             if ($holiday_epoch < $epoch) {
                 $holiday_epoch = mktime(12, 0, 0, $this->getMonth(), $this->getDayOfMonth(), date('Y', $epoch) + 1);
             }
         } elseif ($this->getType() == 20) {
             //Dynamic - Week Interval
             Debug::text('Dynamic - Week Interval... Current Month: ' . TTDate::getMonth($epoch) . ' Holiday Month: ' . $this->getMonth(), __FILE__, __LINE__, __METHOD__, 10);
             //Dynamic
             $start_month_epoch = TTDate::getBeginMonthEpoch($epoch);
             $end_month_epoch = mktime(12, 0, 0, $this->getMonth() + 1, 1, date('Y', $epoch) + 1);
             Debug::text('Start Epoch: ' . TTDate::getDate('DATE+TIME', $start_month_epoch) . ' End Epoch: ' . TTDate::getDate('DATE+TIME', $end_month_epoch), __FILE__, __LINE__, __METHOD__, 10);
             //Get all day of weeks in the month. Determine which is less or greater then day.
             $day_of_week_dates = array();
             $week_interval = 0;
             for ($i = $start_month_epoch; $i <= $end_month_epoch; $i += 86400) {
                 if (TTDate::getMonth($i) == $this->getMonth()) {
                     $day_of_week = TTDate::getDayOfWeek($i);
                     //Debug::text('I: '. $i .'('.TTDate::getDate('DATE+TIME', $i).') Current Day Of Week: '. $day_of_week .' Looking for Day Of Week: '. $this->getDayOfWeek(), __FILE__, __LINE__, __METHOD__, 10);
                     if ($day_of_week == abs($this->getDayOfWeek())) {
                         $day_of_week_dates[] = date('j', $i);
                         Debug::text('I: ' . $i . ' Day Of Month: ' . date('j', $i), __FILE__, __LINE__, __METHOD__, 10);
                         $week_interval++;
                     }
                     if ($week_interval >= $this->getWeekInterval()) {
                         $tmp_holiday_epoch = mktime(12, 0, 0, $this->getMonth(), $day_of_week_dates[$this->getWeekInterval() - 1], date('Y', $i));
                         //Make sure we keep processing until the holiday comes AFTER todays date.
                         if ($tmp_holiday_epoch > $epoch) {
                             break;
                         }
                     }
                 }
             }
             //Debug::Arr($day_of_week_dates, 'Week Dates Arr: ', __FILE__, __LINE__, __METHOD__, 10);
             //$holiday_epoch = mktime(12,0,0, $this->getMonth(), $day_of_week_dates[$this->getWeekInterval()-1], date('Y', $i));
             $holiday_epoch = $tmp_holiday_epoch;
         } elseif ($this->getType() == 30) {
             //Dynamic - Pivot Day
             Debug::text('Dynamic - Pivot Date...', __FILE__, __LINE__, __METHOD__, 10);
             //Dynamic
             if (TTDate::getMonth($epoch) > $this->getMonth()) {
                 $year_modifier = 1;
             } else {
                 $year_modifier = 0;
             }
             $start_epoch = mktime(12, 0, 0, $this->getMonth(), $this->getDayOfMonth(), date('Y', $epoch) + $year_modifier);
             $holiday_epoch = $start_epoch;
             $x = 0;
             $x_max = 100;
             if ($this->getPivotDayDirection() == 10 or $this->getPivotDayDirection() == 30) {
                 $direction_multiplier = -1;
             } else {
                 $direction_multiplier = 1;
             }
             $adjustment = 86400 * $direction_multiplier;
             // Adjust by 1 day before or after.
             if ($this->getPivotDayDirection() == 10 or $this->getPivotDayDirection() == 20) {
                 $holiday_epoch += $adjustment;
             }
             while ($this->getDayOfWeek() != TTDate::getDayOfWeek($holiday_epoch) and $x < $x_max) {
                 Debug::text('X: ' . $x . ' aTrying...' . TTDate::getDate('DATE+TIME', $holiday_epoch), __FILE__, __LINE__, __METHOD__, 10);
                 $holiday_epoch += $adjustment;
                 $x++;
             }
         }
     }
     Debug::text('Next Date for: ' . $this->getName() . ' is: ' . TTDate::getDate('DATE+TIME', $holiday_epoch), __FILE__, __LINE__, __METHOD__, 10);
     return $holiday_epoch;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:95,代码来源:RecurringHolidayFactory.class.php

示例14: getBeginMonthEpoch

 function getBeginMonthEpoch($epoch)
 {
     return TTDate::getBeginMonthEpoch($epoch);
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:4,代码来源:AJAX_Server.class.php

示例15: strtotime

     } else {
         $obj->setValue(0);
         $data['new_version'] = 0;
     }
     if ($obj->isValid()) {
         $obj->Save();
     }
 default:
     $data['product_edition'] = Option::getByKey(getTTProductEdition(), $current_company->getOptions('product_edition'));
     //Get Employee counts for this month, and last month
     $month_of_year_arr = TTDate::getMonthOfYearArray();
     //This month
     if (isset($ytd) and $ytd == 1) {
         $begin_month_epoch = strtotime('-2 years');
     } else {
         $begin_month_epoch = TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch(time()) - 86400);
     }
     $cuclf = new CompanyUserCountListFactory();
     $cuclf->getMonthlyMinAvgMaxByCompanyIdAndStartDateAndEndDate($current_company->getId(), $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc'));
     if ($cuclf->getRecordCount() > 0) {
         foreach ($cuclf as $cuc_obj) {
             $data['user_counts'][] = array('label' => $month_of_year_arr[TTDate::getMonth(TTDate::strtotime($cuc_obj->getColumn('date_stamp')))] . ' ' . TTDate::getYear(TTDate::strtotime($cuc_obj->getColumn('date_stamp'))), 'max_active_users' => $cuc_obj->getColumn('max_active_users'), 'max_inactive_users' => $cuc_obj->getColumn('max_inactive_users'), 'max_deleted_users' => $cuc_obj->getColumn('max_deleted_users'));
         }
     }
     $cjlf = new CronJobListFactory();
     $cjlf->getMostRecentlyRun();
     if ($cjlf->getRecordCount() > 0) {
         $cj_obj = $cjlf->getCurrent();
         $data['cron'] = array('last_run_date' => $cj_obj->getLastRunDate());
     }
     if (($current_company->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $current_company->getId() == $config_vars['other']['primary_company_id']) and getTTProductEdition() > 10) {
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:About.php


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