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


PHP TTDate::getEndMonthEpoch方法代码示例

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


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

示例1: foreach

    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++;
    }
    $pplf = TTnew('PayPeriodListFactory');
开发者ID:alachaum,项目名称:timetrex,代码行数:31,代码来源:TimesheetSummary.php

示例2: 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

示例3: array

     $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';
     }
 }
 $filter_data = Misc::preSetArrayValues($filter_data, array('include_user_ids', 'exclude_user_ids', 'user_status_ids', 'group_ids', 'branch_ids', 'department_ids', 'user_title_ids', 'pay_period_ids', 'log_action_ids', 'log_table_name_ids', 'column_ids'), NULL);
开发者ID:alachaum,项目名称:timetrex,代码行数:31,代码来源:SystemLog.php

示例4: sort

            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);
$smarty->assign_by_ref('apmf', $apmf);
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:EditAccrualPolicy.php

示例5: getNextPayPeriod


//.........这里部分代码省略.........
             $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())) {
                 $insert_pay_period = 2;
                 $primary = FALSE;
             } else {
                 Debug::text('Finding if Primary or Secondary is closest...', __FILE__, __LINE__, __METHOD__, 10);
                 $primary_date_offset = TTDate::getDateOfNextDayOfMonth($last_pay_period_end_date, NULL, $this->convertLastDayOfMonth($this->getPrimaryDayOfMonth())) - $last_pay_period_end_date;
                 $secondary_date_offset = TTDate::getDateOfNextDayOfMonth($last_pay_period_end_date, NULL, $this->convertLastDayOfMonth($this->getSecondaryDayOfMonth())) - $last_pay_period_end_date;
                 Debug::text('Primary Date Offset: ' . TTDate::getDays($primary_date_offset) . ' Secondary Date Offset: ' . TTDate::getDays($secondary_date_offset), __FILE__, __LINE__, __METHOD__, 10);
                 if ($primary_date_offset <= $secondary_date_offset) {
                     $insert_pay_period = 1;
                     $primary = TRUE;
                     $last_pay_period_end_date = TTDate::getDateOfNextDayOfMonth($last_pay_period_end_date, NULL, $this->convertLastDayOfMonth($this->getPrimaryDayOfMonth()));
                 } else {
                     $insert_pay_period = 2;
                     $primary = FALSE;
                     $last_pay_period_end_date = TTDate::getDateOfNextDayOfMonth($last_pay_period_end_date, NULL, $this->convertLastDayOfMonth($this->getSecondaryDayOfMonth()));
                 }
                 $last_pay_period_end_date = TTDate::getBeginDayEpoch($last_pay_period_end_date);
             }
             unset($tmp_last_pay_period_end_day_of_month);
             Debug::text('cLast Pay Period End Date: ' . TTDate::getDate('DATE+TIME', $last_pay_period_end_date) . ' (' . $last_pay_period_end_date . ') Primary: ' . (int) $primary, __FILE__, __LINE__, __METHOD__, 10);
             $start_date = $last_pay_period_end_date + 1;
             if ($primary == TRUE) {
                 $end_date = TTDate::getBeginDayEpoch(TTDate::getDateOfNextDayOfMonth($start_date, NULL, $this->convertLastDayOfMonth($this->getSecondaryDayOfMonth()))) - 1;
                 $transaction_date = TTDate::getMiddleDayEpoch(TTDate::getDateOfNextDayOfMonth(TTDate::getMiddleDayEpoch($end_date), NULL, $this->convertLastDayOfMonth($this->getPrimaryTransactionDayOfMonth())));
             } else {
                 $end_date = TTDate::getBeginDayEpoch(TTDate::getDateOfNextDayOfMonth($start_date, NULL, $this->convertLastDayOfMonth($this->getPrimaryDayOfMonth()))) - 1;
                 $transaction_date = TTDate::getMiddleDayEpoch(TTDate::getDateOfNextDayOfMonth(TTDate::getMiddleDayEpoch($end_date), NULL, $this->convertLastDayOfMonth($this->getSecondaryTransactionDayOfMonth())));
             }
             break;
         case 50:
             //Monthly
             $start_date = $last_pay_period_end_date + 1;
             $end_date = TTDate::getDateOfNextDayOfMonth($start_date + 86400, NULL, $this->convertLastDayOfMonth($this->getPrimaryDayOfMonth()));
             //Use Begin Day Epoch to nullify DST issues.
             $end_date = TTDate::getBeginDayEpoch(TTDate::getBeginMinuteEpoch($end_date)) - 1;
             $transaction_date = TTDate::getMiddleDayEpoch(TTDate::getDateOfNextDayOfMonth($end_date, NULL, $this->convertLastDayOfMonth($this->getPrimaryTransactionDayOfMonth())));
             break;
     }
     if ($this->getDayStartTime() != 0) {
         Debug::text('Daily Start Time is set, adjusting End Date by: ' . TTDate::getHours($this->getDayStartTime()) . ' Start Date: ' . TTDate::getDate('DATE+TIME', $start_date), __FILE__, __LINE__, __METHOD__, 10);
         //We already account for DayStartTime in weekly/bi-weekly start_date cases above, so skip applying it again here.
         if ($this->getType() != 10 and $this->getType() != 20) {
             $start_date = $start_date + $this->getDayStartTime();
         }
         $end_date = $end_date + $this->getDayStartTime();
         //Need to do this, otherwise transaction date could be earlier then end date.
         $transaction_date = $transaction_date + $this->getDayStartTime();
     }
     Debug::text('aStart Date(' . $start_date . '): ' . TTDate::getDate('DATE+TIME', $start_date), __FILE__, __LINE__, __METHOD__, 10);
     Debug::text('aEnd Date(' . $end_date . '): ' . TTDate::getDate('DATE+TIME', $end_date), __FILE__, __LINE__, __METHOD__, 10);
     Debug::text('aPay Date(' . $transaction_date . '): ' . TTDate::getDate('DATE+TIME', $transaction_date), __FILE__, __LINE__, __METHOD__, 10);
     //Handle last day of the month flag for primary and secondary dates here
     if ($this->getType() == 30 and ($insert_pay_period == 1 and ($this->getPrimaryDayOfMonth() == 31 or $this->getPrimaryDayOfMonth() == -1) or $insert_pay_period == 2 and ($this->getSecondaryDayOfMonth() == 31 or $this->getSecondaryDayOfMonth() == -1)) or $this->getType() == 50 and ($this->getPrimaryDayOfMonth() == 31 or $this->getPrimaryDayOfMonth() == -1)) {
         Debug::text('Last day of the month set for start date: ', __FILE__, __LINE__, __METHOD__, 10);
         if ($this->getDayStartTime() > 0) {
             //Minus one day, THEN add daily start time, otherwise it will go past the month boundary
             $end_date = TTDate::getEndMonthEpoch($end_date) - 86400 + $this->getDayStartTime();
             //End month epoch is 23:59:59, so don't minus one.
         } else {
             $end_date = TTDate::getEndMonthEpoch($end_date) + $this->getDayStartTime();
             //End month epoch is 23:59:59, so don't minus one.
         }
     }
     //Handle "last day of the month" for transaction dates.
     if ($this->getPrimaryDayOfMonth() == 31 or $this->getPrimaryDayOfMonth() == -1) {
         //Debug::text('LDOM set for Primary: ', __FILE__, __LINE__, __METHOD__, 10);
         $transaction_date = TTDate::getEndMonthEpoch($transaction_date);
     }
     //Handle "always business day" flag for transaction dates here.
     if ($this->getTransactionDateBusinessDay() == TRUE) {
         $transaction_date = $this->getTransactionBusinessDay($transaction_date);
     }
     if ($transaction_date < $end_date) {
         $transaction_date = $end_date;
     }
     Debug::text('Start Date: ' . TTDate::getDate('DATE+TIME', $start_date), __FILE__, __LINE__, __METHOD__, 10);
     Debug::text('End Date: ' . TTDate::getDate('DATE+TIME', $end_date), __FILE__, __LINE__, __METHOD__, 10);
     Debug::text('Pay Date: ' . TTDate::getDate('DATE+TIME', $transaction_date), __FILE__, __LINE__, __METHOD__, 10);
     Debug::text("<br><br>\n\n", __FILE__, __LINE__, __METHOD__, 10);
     $this->next_start_date = $start_date;
     $this->next_end_date = $end_date;
     $this->next_transaction_date = $transaction_date;
     //Its a primary pay period
     if ($insert_pay_period == 1) {
         $this->next_primary = TRUE;
     } else {
         $this->next_primary = FALSE;
     }
     return TRUE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:101,代码来源:PayPeriodScheduleFactory.class.php

示例6: detectPayPeriodScheduleDates

 function detectPayPeriodScheduleDates($type_id, $start_date)
 {
     $retarr = FALSE;
     $max = 4;
     $start_date = TTDate::parseDateTime($start_date);
     switch ($type_id) {
         case 5:
             //Manual
             break;
         case 10:
             //Weekly
             for ($i = 0; $i < $max; $i++) {
                 $end_date = $start_date + 86400 * 6;
                 $transaction_date = $end_date + 86400 * 5;
                 $retarr[] = array('start_date' => TTDate::getDate('DATE', $start_date), 'end_date' => TTDate::getDate('DATE', $end_date), 'transaction_date' => TTDate::getDate('DATE', $transaction_date));
                 $start_date = $end_date + 86400;
             }
             break;
         case 20:
             //BiWeekly
             for ($i = 0; $i < $max; $i++) {
                 $end_date = $start_date + 86400 * 13;
                 $transaction_date = $end_date + 86400 * 5;
                 $retarr[] = array('start_date' => TTDate::getDate('DATE', $start_date), 'end_date' => TTDate::getDate('DATE', $end_date), 'transaction_date' => TTDate::getDate('DATE', $transaction_date));
                 $start_date = $end_date + 86400;
             }
             break;
         case 30:
             //Semi-monthly
             for ($i = 0; $i < $max; $i++) {
                 $end_date = $start_date + 86400 * 14;
                 //If we're within 4 days of the last day of the month, use the last day.
                 if (abs($end_date - TTDate::getEndMonthEpoch($start_date)) < 86400 * 4) {
                     $end_date = TTDate::getEndMonthEpoch($start_date);
                 }
                 $transaction_date = $end_date;
                 $retarr[] = array('start_date' => TTDate::getDate('DATE', $start_date), 'end_date' => TTDate::getDate('DATE', $end_date), 'transaction_date' => TTDate::getDate('DATE', $transaction_date));
                 $start_date = $end_date + 86400;
             }
             break;
         case 50:
             //Monthly
             for ($i = 0; $i < $max; $i++) {
                 $end_date = TTDate::getEndMonthEpoch($start_date);
                 $transaction_date = $end_date + 86400 * 0;
                 $retarr[] = array('start_date' => TTDate::getDate('DATE', $start_date), 'end_date' => TTDate::getDate('DATE', $end_date), 'transaction_date' => TTDate::getDate('DATE', $transaction_date));
                 $start_date = $end_date + 86400;
             }
             break;
         default:
             return FALSE;
             break;
     }
     return $retarr;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:55,代码来源:PayPeriodScheduleFactory.class.php

示例7: createPayStubAmendments


//.........这里部分代码省略.........
                                     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());
                         //$monthly_date = TTDate::getDateOfNextDayOfMonth( TTDate::getBeginMonthEpoch($epoch), $this->getStartDate() );
                         $start_date = TTDate::getBeginMonthEpoch($epoch);
                         $end_date = TTDate::getEndMonthEpoch($epoch);
                         break;
                     case 70:
                         $trigger_date = TTDate::getDateOfNextYear($this->getStartDate(), $epoch);
                         //$start_date = TTDate::getBeginYearEpoch($epoch);
                         //$end_date = TTDate::getEndYearEpoch($epoch);
                         $start_date = TTDate::getBeginDayEpoch($epoch - 86400 * 365);
                         $end_date = TTDate::getEndDayEpoch($epoch);
                         break;
                 }
                 Debug::text('Trigger Date: ' . TTDate::getDate('DATE', $trigger_date), __FILE__, __LINE__, __METHOD__, 10);
                 if ($epoch >= $trigger_date and $this->checkTimeFrame($epoch)) {
                     Debug::text('Within timeframe... Start Date: ' . TTDate::getDate('DATE+TIME', $start_date) . ' End Date: ' . TTDate::getDate('DATE+TIME', $end_date), __FILE__, __LINE__, __METHOD__, 10);
                     foreach ($user_ids as $user_id) {
                         //Make sure schedule user is in the PS amendment user list and user is active.
                         if ($ulf->getById($user_id)->getCurrent()->getStatus() != 10 and !in_array($user_id, $user_ids)) {
                             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;
                         }
                         $psalf = TTnew('PayStubAmendmentListFactory');
                         if ($psalf->getByUserIdAndRecurringPayStubAmendmentIdAndStartDateAndEndDate($user_id, $this->getId(), $start_date, $end_date)->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->getDescription());
                             $psaf->setEffectiveDate(TTDate::getBeginDayEpoch($trigger_date));
                             if ($psaf->isValid()) {
                                 $psaf->Save();
                             }
                         } else {
                             //Amendment already inserted!
                             Debug::text('Recurring PS Amendment already inserted for User: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
                         }
                     }
                 }
                 break;
         }
     }
     //$this->FailTransaction();
     $this->CommitTransaction();
     return TRUE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:101,代码来源:RecurringPayStubAmendmentFactory.class.php

示例8: getDateOfNextDayOfMonth

 public static function getDateOfNextDayOfMonth($anchor_epoch, $day_of_month_epoch, $day_of_month = NULL)
 {
     //Anchor Epoch is the anchor date to start searching from.
     //Day of month epoch is the epoch we use to extract the day of the month from.
     Debug::text('-------- ', __FILE__, __LINE__, __METHOD__, 10);
     Debug::text('Anchor Epoch: ' . TTDate::getDate('DATE+TIME', $anchor_epoch) . ' Day Of Month Epoch: ' . TTDate::getDate('DATE+TIME', $day_of_month_epoch) . ' Day Of Month: ' . $day_of_month, __FILE__, __LINE__, __METHOD__, 10);
     if ($anchor_epoch == '') {
         return FALSE;
     }
     if ($day_of_month_epoch == '' and $day_of_month == '') {
         return FALSE;
     }
     if ($day_of_month_epoch == '' and $day_of_month != '' and $day_of_month <= 31) {
         $tmp_days_in_month = TTDate::getDaysInMonth($anchor_epoch);
         if ($day_of_month > $tmp_days_in_month) {
             $day_of_month = $tmp_days_in_month;
         }
         unset($tmp_days_in_month);
         $day_of_month_epoch = mktime(date('H', $anchor_epoch), date('i', $anchor_epoch), date('s', $anchor_epoch), date('m', $anchor_epoch), $day_of_month, date('Y', $anchor_epoch));
     }
     //If the anchor date is AFTER the day of the month, we want to get the same day
     //in the NEXT month.
     $src_dom = date('j', $anchor_epoch);
     $dst_dom = date('j', $day_of_month_epoch);
     //Debug::text('Anchor DOM: '. $src_dom .' DST DOM: '. $dst_dom, __FILE__, __LINE__, __METHOD__,10);
     if ($src_dom > $dst_dom) {
         //Debug::text('Anchor DOM is greater then Dest DOM', __FILE__, __LINE__, __METHOD__,10);
         //Get the epoch of the first day of the next month
         //Use getMiddleDayEpoch so daylight savings doesn't throw us off.
         $anchor_epoch = TTDate::getMiddleDayEpoch(TTDate::getEndMonthEpoch($anchor_epoch) + 1);
         //Find out how many days are in this month
         $days_in_month = TTDate::getDaysInMonth($anchor_epoch);
         if ($dst_dom > $days_in_month) {
             $dst_dom = $days_in_month;
         }
         $retval = $anchor_epoch + ($dst_dom - 1) * 86400;
     } else {
         //Debug::text('Anchor DOM is equal or LESS then Dest DOM', __FILE__, __LINE__, __METHOD__,10);
         $retval = mktime(date('H', $anchor_epoch), date('i', $anchor_epoch), date('s', $anchor_epoch), date('m', $anchor_epoch), date('j', $day_of_month_epoch), date('Y', $anchor_epoch));
     }
     return TTDate::getBeginDayEpoch($retval);
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:42,代码来源:TTDate.class.php

示例9: extract

    $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) {
                 $quarter = 4;
开发者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: strtotime

     }
     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) {
         if (!isset($system_settings['license'])) {
             $system_settings['license'] = NULL;
         }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:About.php

示例14: getAboutData

 /**
  * Get about data .
  *
  */
 function getAboutData($ytd = 0, $all_companies = FALSE)
 {
     global $config_vars;
     $clf = new CompanyListFactory();
     $sslf = new SystemSettingListFactory();
     $system_settings = $sslf->getAllArray();
     $clf->getByID(PRIMARY_COMPANY_ID);
     if ($clf->getRecordCount() == 1) {
         $primary_company = $clf->getCurrent();
     }
     $current_user = $this->getCurrentUserObject();
     if (isset($primary_company) and PRIMARY_COMPANY_ID == $current_user->getCompany()) {
         $current_company = $primary_company;
     } else {
         $current_company = $clf->getByID($current_user->getCompany())->getCurrent();
     }
     //$current_user_prefs = $current_user->getUserPreferenceObject();
     $data = $system_settings;
     if (isset($data['new_version']) and $data['new_version'] == TRUE) {
         $data['new_version'] = TRUE;
     } else {
         $data['new_version'] = FALSE;
     }
     $data['product_edition'] = Option::getByKey(DEPLOYMENT_ON_DEMAND == TRUE ? $current_company->getProductEdition() : getTTProductEdition(), $current_company->getOptions('product_edition'));
     $data['application_name'] = APPLICATION_NAME;
     $data['organization_url'] = ORGANIZATION_URL;
     //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 = TTnew('CompanyUserCountListFactory');
     if (isset($config_vars['other']['primary_company_id']) and $current_company->getId() == $config_vars['other']['primary_company_id'] and $all_companies == TRUE) {
         $cuclf->getTotalMonthlyMinAvgMaxByCompanyStatusAndStartDateAndEndDate(10, $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc'));
     } else {
         $cuclf->getMonthlyMinAvgMaxByCompanyIdAndStartDateAndEndDate($current_company->getId(), $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc'));
     }
     Debug::Text('Company User Count Rows: ' . $cuclf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
     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'));
         }
     }
     if (isset($data['user_counts']) == FALSE) {
         $data['user_counts'] = array();
     }
     $cjlf = TTnew('CronJobListFactory');
     $cjlf->getMostRecentlyRun();
     if ($cjlf->getRecordCount() > 0) {
         $cj_obj = $cjlf->getCurrent();
         $data['cron'] = array('last_run_date' => $cj_obj->getLastRunDate() == FALSE ? TTi18n::getText('Never') : TTDate::getDate('DATE+TIME', $cj_obj->getLastRunDate()));
     }
     $data['show_license_data'] = FALSE;
     if ((DEPLOYMENT_ON_DEMAND == FALSE and $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) {
         if (!isset($system_settings['license'])) {
             $system_settings['license'] = NULL;
         }
         $data['show_license_data'] = TRUE;
         //Set this so the license upload area at least shows up regardles of edition.
         $data['license_data'] = array();
         $license = new TTLicense();
         $retval = $license->validateLicense($system_settings['license']);
         if ($retval == TRUE) {
             $data['license_data'] = array('organization_name' => $license->getOrganizationName(), 'major_version' => $license->getMajorVersion(), 'minor_version' => $license->getMinorVersion(), 'product_name' => $license->getProductName(), 'active_employee_licenses' => $license->getActiveEmployeeLicenses(), 'issue_date' => TTDate::getDate('DATE', $license->getIssueDate()), 'expire_date' => $license->getExpireDate(), 'expire_date_display' => TTDate::getDate('DATE', $license->getExpireDate()), 'registration_key' => $license->getRegistrationKey(), 'message' => $license->getFullErrorMessage($retval), 'retval' => $retval);
         }
     }
     //Debug::Arr($data, 'Data: ', __FILE__, __LINE__, __METHOD__,10);
     return $this->returnHandler($data);
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:76,代码来源:APIAbout.class.php


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