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


PHP TTDate::getDayOfWeek方法代码示例

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


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

示例1: postInstall

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

示例2: TTnew

                             UserGenericStatusFactory::queueGenericStatus($user_generic_status_label, 20, NULL, NULL);
                         } else {
                             UserGenericStatusFactory::queueGenericStatus($user_generic_status_label, 30, NULL, NULL);
                         }
                     }
                 } else {
                     UserGenericStatusFactory::queueGenericStatus($user_generic_status_label, 10, $sf->Validator->getTextErrors(), NULL);
                     $fail_transaction = TRUE;
                 }
                 //Debug::Text('Setting Percent: '. Misc::calculatePercent( $x, $total_shifts ), __FILE__, __LINE__, __METHOD__,10);
                 $progress_bar->setValue(Misc::calculatePercent($x, $total_shifts));
                 $progress_bar->display();
                 $x++;
             }
         } else {
             Debug::Text(' Skipping Day Of Week: (' . TTDate::getDayOfWeek($time_stamp) . ') ' . TTDate::getDate('DATE+TIME', $time_stamp), __FILE__, __LINE__, __METHOD__, 10);
             $x++;
         }
         $time_stamp = $time_stamp + 86400;
     }
     //$sf->FailTransaction();
     $sf->CommitTransaction();
     $ugsf = TTnew('UserGenericStatusFactory');
     $ugsf->setUser($current_user->getId());
     $ugsf->setBatchID($ugsf->getNextBatchId());
     $ugsf->setQueue(UserGenericStatusFactory::getStaticQueue());
     $ugsf->saveQueue();
     $progress_bar->setValue(100);
     $progress_bar->display();
     $next_page = URLBuilder::getURL(array('batch_id' => $ugsf->getBatchID(), 'batch_title' => 'Mass Schedule', 'batch_next_page' => urlencode(URLBuilder::getURL(array('data' => $data, 'filter_user_id' => $filter_user_id), '../schedule/AddMassSchedule.php'))), '../users/UserGenericStatusList.php');
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:31,代码来源:ProgressBar.php

示例3: createPayPeriodSchedule

 function createPayPeriodSchedule($company_id, $user_ids)
 {
     $ppsf = new PayPeriodScheduleFactory();
     $ppsf->setCompany($company_id);
     $ppsf->setName('Bi-Weekly');
     $ppsf->setDescription('Pay every two weeks');
     $ppsf->setType(20);
     $ppsf->setStartWeekDay(0);
     //$anchor_date = TTDate::getBeginWeekEpoch( (time()-(86400*42)) ); //Start 6 weeks ago
     $anchor_date = TTDate::getBeginWeekEpoch(time() - 86400 * 14);
     //Start 6 weeks ago
     $ppsf->setAnchorDate($anchor_date);
     $ppsf->setStartDayOfWeek(TTDate::getDayOfWeek($anchor_date));
     $ppsf->setTransactionDate(7);
     $ppsf->setTransactionDateBusinessDay(TRUE);
     /*
     $ppsf->setPrimaryDate( ($anchor_date+(86400*14)) );
     $ppsf->setPrimaryDateLastDayOfMonth( FALSE );
     $ppsf->setPrimaryTransactionDate( ($anchor_date+(86400*21)) );
     $ppsf->setPrimaryTransactionDateLastDayOfMonth( FALSE );
     $ppsf->setPrimaryTransactionDateBusinessDay( TRUE );
     
     $ppsf->setSecondaryDate( ($anchor_date+(86400*28)) );
     $ppsf->setSecondaryDateLastDayOfMonth( FALSE );
     $ppsf->setSecondaryTransactionDate( ($anchor_date+(86400*35))  );
     $ppsf->setSecondaryTransactionDateLastDayOfMonth( FALSE );
     $ppsf->setSecondaryTransactionDateBusinessDay( TRUE );
     */
     $ppsf->setDayStartTime(0);
     $ppsf->setShiftAssignedDay(10);
     //Day the shift starts on.
     $ppsf->setNewDayTriggerTime(4 * 3600);
     $ppsf->setMaximumShiftTime(16 * 3600);
     if ($ppsf->isValid()) {
         $insert_id = $ppsf->Save(FALSE);
         Debug::Text('Pay Period Schedule ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         //Dont create pay periods twice.
         $ppsf->setEnableInitialPayPeriods(FALSE);
         $ppsf->setUser($user_ids);
         $ppsf->Save();
         return $insert_id;
     }
     Debug::Text('Failed Creating Pay Period Schedule!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:45,代码来源:DemoData.class.php

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

示例5: createPremiumPolicy

 function createPremiumPolicy($company_id, $type, $accrual_policy_id = NULL)
 {
     $ppf = new PremiumPolicyFactory();
     $ppf->setCompany($company_id);
     switch ($type) {
         case 90:
             //Basic Min/Max only.
             $ppf->setName('Min/Max Only');
             $ppf->setType(10);
             $ppf->setPayType(10);
             //Pay Multiplied by factor
             $ppf->setStartDate(NULL);
             $ppf->setEndDate(NULL);
             $ppf->setStartTime(NULL);
             $ppf->setEndTime(NULL);
             $ppf->setDailyTriggerTime(0);
             $ppf->setWeeklyTriggerTime(0);
             $ppf->setMon(TRUE);
             $ppf->setTue(TRUE);
             $ppf->setWed(TRUE);
             $ppf->setThu(TRUE);
             $ppf->setFri(TRUE);
             $ppf->setSat(TRUE);
             $ppf->setSun(TRUE);
             $ppf->setIncludePartialPunch(TRUE);
             //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] );
             //$ppf->setMinimumBreakTime( $data['minimum_break_time'] );
             $ppf->setMinimumTime(3600);
             $ppf->setMaximumTime(7200);
             $ppf->setIncludeMealPolicy(TRUE);
             $ppf->setRate(1.0);
             $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1'));
             //$ppf->setExcludeDefaultBranch( FALSE );
             //$ppf->setExcludeDefaultDepartment( FALSE );
             //$ppf->setJobGroupSelectionType( 10 );
             //$ppf->setJobSelectionType( 10 );
             //$ppf->setJobItemGroupSelectionType( 10 );
             //$ppf->setJobItemSelectionType( 10 );
             break;
         case 100:
             $ppf->setName('Start/End Date Only');
             $ppf->setType(10);
             $ppf->setPayType(10);
             //Pay Multiplied by factor
             $ppf->setStartDate($this->pay_period_objs[0]->getStartDate() + 86400);
             $ppf->setEndDate($this->pay_period_objs[0]->getStartDate() + 86400 * 3);
             //2nd & 3rd days.
             $ppf->setStartTime(TTDate::parseDateTime('12:00 AM'));
             $ppf->setEndTime(TTDate::parseDateTime('11:59 PM'));
             $ppf->setDailyTriggerTime(0);
             $ppf->setWeeklyTriggerTime(0);
             $ppf->setMon(TRUE);
             $ppf->setTue(TRUE);
             $ppf->setWed(TRUE);
             $ppf->setThu(TRUE);
             $ppf->setFri(TRUE);
             $ppf->setSat(TRUE);
             $ppf->setSun(TRUE);
             $ppf->setIncludePartialPunch(TRUE);
             //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] );
             //$ppf->setMinimumBreakTime( $data['minimum_break_time'] );
             $ppf->setMinimumTime(0);
             $ppf->setMaximumTime(0);
             $ppf->setIncludeMealPolicy(TRUE);
             $ppf->setRate(1.0);
             $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1'));
             //$ppf->setExcludeDefaultBranch( FALSE );
             //$ppf->setExcludeDefaultDepartment( FALSE );
             //$ppf->setJobGroupSelectionType( 10 );
             //$ppf->setJobSelectionType( 10 );
             //$ppf->setJobItemGroupSelectionType( 10 );
             //$ppf->setJobItemSelectionType( 10 );
             break;
         case 110:
             $ppf->setName('Start/End Date+Effective Days');
             $ppf->setType(10);
             $ppf->setPayType(10);
             //Pay Multiplied by factor
             $ppf->setStartDate($this->pay_period_objs[0]->getStartDate() + 86400);
             $ppf->setEndDate($this->pay_period_objs[0]->getStartDate() + 86400 * 3);
             //2nd & 3rd days.
             $ppf->setStartTime(TTDate::parseDateTime('12:00 AM'));
             $ppf->setEndTime(TTDate::parseDateTime('11:59 PM'));
             $ppf->setDailyTriggerTime(0);
             $ppf->setWeeklyTriggerTime(0);
             if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 1 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 1) {
                 $ppf->setMon(TRUE);
             } else {
                 $ppf->setMon(FALSE);
             }
             if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 2 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 2) {
                 $ppf->setTue(TRUE);
             } else {
                 $ppf->setTue(FALSE);
             }
             if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 3 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 3) {
                 $ppf->setWed(TRUE);
             } else {
                 $ppf->setWed(FALSE);
             }
//.........这里部分代码省略.........
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:101,代码来源:PremiumPolicyTest.php

示例6: createPayPeriodSchedule

 function createPayPeriodSchedule()
 {
     $ppsf = new PayPeriodScheduleFactory();
     $ppsf->setCompany($this->company_id);
     //$ppsf->setName( 'Bi-Weekly'.rand(1000,9999) );
     $ppsf->setName('Bi-Weekly');
     $ppsf->setDescription('Pay every two weeks');
     $ppsf->setType(20);
     $ppsf->setStartWeekDay(0);
     $anchor_date = TTDate::getBeginWeekEpoch(TTDate::getBeginYearEpoch());
     //Start 6 weeks ago
     $ppsf->setAnchorDate($anchor_date);
     $ppsf->setStartDayOfWeek(TTDate::getDayOfWeek($anchor_date));
     $ppsf->setTransactionDate(7);
     $ppsf->setTransactionDateBusinessDay(TRUE);
     $ppsf->setDayStartTime(0);
     $ppsf->setNewDayTriggerTime(4 * 3600);
     $ppsf->setMaximumShiftTime(16 * 3600);
     $ppsf->setShiftAssignedDay(10);
     $ppsf->setEnableInitialPayPeriods(FALSE);
     if ($ppsf->isValid()) {
         $insert_id = $ppsf->Save(FALSE);
         Debug::Text('Pay Period Schedule ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         $ppsf->setUser(array($this->user_id));
         $ppsf->Save();
         $this->pay_period_schedule_id = $insert_id;
         return $insert_id;
     }
     Debug::Text('Failed Creating Pay Period Schedule!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:OverTimePolicyTest.php

示例7: isEligible

 function isEligible($user_id, $ignore_after_eligibility = FALSE)
 {
     if ($user_id == '') {
         return FALSE;
     }
     $ulf = TTnew('UserListFactory');
     $user_obj = $ulf->getById($user_id)->getCurrent();
     $slf = TTnew('ScheduleListFactory');
     $udtlf = TTnew('UserDateTotalListFactory');
     //Make sure the employee has been employed long enough according to labor standards
     //Also make sure that the employee hasn't been terminated on or before the holiday.
     if ($user_obj->getHireDate() <= $this->getDateStamp() - $this->getHolidayPolicyObject()->getMinimumEmployedDays() * 86400 and ($user_obj->getTerminationDate() == '' or $user_obj->getTerminationDate() != '' and $user_obj->getTerminationDate() > $this->getDateStamp())) {
         Debug::text('Employee has been employed long enough!', __FILE__, __LINE__, __METHOD__, 10);
         if ($this->getHolidayPolicyObject()->getType() == 20 or $this->getHolidayPolicyObject()->getType() == 30) {
             if ($this->getHolidayPolicyObject()->getWorkedScheduledDays() == 1 and $this->getHolidayPolicyObject()->getMinimumWorkedDays() > 0 and $this->getHolidayPolicyObject()->getMinimumWorkedPeriodDays() > 0) {
                 Debug::text('aUsing scheduled days!', __FILE__, __LINE__, __METHOD__, 10);
                 $slf->getByUserIdAndTypeAndDirectionFromDate($user_obj->getId(), 10, 'before', $this->getDateStamp(), $this->getHolidayPolicyObject()->getMinimumWorkedPeriodDays());
                 if ($slf->getRecordCount() > 0) {
                     //Get user_date_ids
                     foreach ($slf as $s_obj) {
                         $scheduled_user_date_ids_before[] = $s_obj->getUserDateID();
                     }
                     //Debug::Arr($scheduled_user_date_ids_before, 'Scheduled UserDateIDs Before: ', __FILE__, __LINE__, __METHOD__,10);
                 }
             } else {
                 Debug::text('aUsing calendar days, NOT scheduled days!', __FILE__, __LINE__, __METHOD__, 10);
             }
             if ($this->getHolidayPolicyObject()->getWorkedAfterScheduledDays() == 1 and $this->getHolidayPolicyObject()->getMinimumWorkedAfterDays() > 0 and $this->getHolidayPolicyObject()->getMinimumWorkedAfterPeriodDays() > 0) {
                 $slf->getByUserIdAndTypeAndDirectionFromDate($user_obj->getId(), 10, 'after', $this->getDateStamp(), $this->getHolidayPolicyObject()->getMinimumWorkedAfterPeriodDays());
                 Debug::text('bUsing scheduled days!', __FILE__, __LINE__, __METHOD__, 10);
                 if ($slf->getRecordCount() > 0) {
                     //Get user_date_ids
                     foreach ($slf as $s_obj) {
                         $scheduled_user_date_ids_after[] = $s_obj->getUserDateID();
                     }
                     //Debug::Arr($scheduled_user_date_ids_after, 'Scheduled UserDateIDs After: ', __FILE__, __LINE__, __METHOD__,10);
                 }
             } else {
                 Debug::text('bUsing calendar days, NOT scheduled days!', __FILE__, __LINE__, __METHOD__, 10);
             }
             $worked_before_days_count = 0;
             if ($this->getHolidayPolicyObject()->getMinimumWorkedDays() > 0 and $this->getHolidayPolicyObject()->getMinimumWorkedPeriodDays() > 0) {
                 if (isset($scheduled_user_date_ids_before) and $this->getHolidayPolicyObject()->getWorkedScheduledDays() == 1) {
                     //Scheduled Days
                     $worked_before_days_count = $udtlf->getDaysWorkedByUserIDAndUserDateIDs($user_obj->getId(), $scheduled_user_date_ids_before);
                 } elseif ($this->getHolidayPolicyObject()->getWorkedScheduledDays() == 2) {
                     //Holiday Week Days
                     //Start/End date should reflect weeks, no days here.
                     $worked_before_days_count = $udtlf->getDaysWorkedByUserIDAndStartDateAndEndDateAndDayOfWeek($user_obj->getId(), $this->getDateStamp() - $this->getHolidayPolicyObject()->getMinimumWorkedPeriodDays() * 7 * 86400, $this->getDateStamp() - 86400, TTDate::getDayOfWeek($this->getDateStamp()));
                 } else {
                     //Calendar Days
                     $worked_before_days = (array) $udtlf->getDaysWorkedByUserIDAndStartDateAndEndDate($user_obj->getId(), $this->getDateStamp() - $this->getHolidayPolicyObject()->getMinimumWorkedPeriodDays() * 86400, $this->getDateStamp() - 86400);
                     $paid_absence_before_days = array();
                     if ($this->getHolidayPolicyObject()->getIncludePaidAbsenceTime() == TRUE) {
                         $paid_absence_before_days = (array) $udtlf->getDaysPaidAbsenceByUserIDAndStartDateAndEndDate($user_obj->getId(), $this->getDateStamp() - $this->getHolidayPolicyObject()->getMinimumWorkedPeriodDays() * 86400, $this->getDateStamp() - 86400);
                         Debug::text('Employee has paid absence days prior: ' . count($paid_absence_before_days) . ' days and worked days: ' . count($worked_before_days) . ' (Must be at least: ' . $this->getHolidayPolicyObject()->getMinimumWorkedDays() . ')', __FILE__, __LINE__, __METHOD__, 10);
                     }
                     $worked_before_days_count = count(array_unique(array_merge($worked_before_days, $paid_absence_before_days)));
                     unset($worked_before_days, $paid_absence_before_days);
                 }
             }
             Debug::text('Employee has worked the prior: ' . $worked_before_days_count . ' days (Must be at least: ' . $this->getHolidayPolicyObject()->getMinimumWorkedDays() . ')', __FILE__, __LINE__, __METHOD__, 10);
             $worked_after_days_count = 0;
             if ($ignore_after_eligibility == TRUE) {
                 $worked_after_days_count = $this->getHolidayPolicyObject()->getMinimumWorkedAfterDays();
                 Debug::text('Ignoring worked after criteria...', __FILE__, __LINE__, __METHOD__, 10);
             } else {
                 if ($this->getHolidayPolicyObject()->getMinimumWorkedAfterDays() > 0 and $this->getHolidayPolicyObject()->getMinimumWorkedAfterPeriodDays() > 0) {
                     if (isset($scheduled_user_date_ids_after) and $this->getHolidayPolicyObject()->getWorkedAfterScheduledDays() == 1) {
                         //Scheduled Days
                         $worked_after_days_count = $udtlf->getDaysWorkedByUserIDAndUserDateIDs($user_obj->getId(), $scheduled_user_date_ids_after);
                     } else {
                         //Calendar Days
                         $worked_after_days_count = count((array) $udtlf->getDaysWorkedByUserIDAndStartDateAndEndDate($user_obj->getId(), $this->getDateStamp() + 86400, $this->getDateStamp() + $this->getHolidayPolicyObject()->getMinimumWorkedAfterPeriodDays() * 86400));
                     }
                 }
                 Debug::text('Employee has worked the following: ' . $worked_after_days_count . ' days (Must be at least: ' . $this->getHolidayPolicyObject()->getMinimumWorkedAfterDays() . ')', __FILE__, __LINE__, __METHOD__, 10);
             }
             //Make sure employee has worked for a portion of those days.
             if ($worked_before_days_count >= $this->getHolidayPolicyObject()->getMinimumWorkedDays() and $worked_after_days_count >= $this->getHolidayPolicyObject()->getMinimumWorkedAfterDays()) {
                 Debug::text('Employee has worked enough prior and following days!', __FILE__, __LINE__, __METHOD__, 10);
                 return TRUE;
             } else {
                 Debug::text('Employee has NOT worked enough days prior or following the holiday!', __FILE__, __LINE__, __METHOD__, 10);
             }
         } else {
             Debug::text('Standard Holiday Policy type, returning TRUE', __FILE__, __LINE__, __METHOD__, 10);
             return TRUE;
         }
     } else {
         Debug::text('Employee has NOT been employed long enough!', __FILE__, __LINE__, __METHOD__, 10);
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:94,代码来源:HolidayFactory.class.php

示例8: detectPayPeriodScheduleSettings

 function detectPayPeriodScheduleSettings($type_id, $example_dates)
 {
     Debug::Arr($example_dates, 'Pay Period Type: ' . $type_id . ' Example Dates: ', __FILE__, __LINE__, __METHOD__, 10);
     if ($type_id == '') {
         $type_id = $this->getType();
     }
     if (!is_array($example_dates)) {
         $example_dates = array();
     }
     if (!isset($example_dates[0]['start_date']) or isset($example_dates[0]['start_date']) and $example_dates[0]['start_date'] == '') {
         Debug::Text('Example dates not specified properly, skipping...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     $this->setType($type_id);
     if (isset($example_dates[0]['start_date'])) {
         $this->setAnchorDate(TTDate::parseDateTime($example_dates[0]['start_date']) - 86400);
         //Anchor date one day before first start date.
     }
     $annual_pay_periods = $this->calcAnnualPayPeriods($type_id);
     switch ($type_id) {
         case 5:
             //Manual
             break;
         case 10:
             //Weekly
         //Weekly
         case 20:
             //BiWeekly
             //Need at least one example.
             foreach ($example_dates as $example_date) {
                 $start_dow[] = TTDate::getDayOfWeek(TTDate::parseDateTime($example_date['start_date']));
                 $transaction_days[] = (int) round(TTDate::getDays(TTDate::parseDateTime($example_date['transaction_date']) - TTDate::parseDateTime($example_date['end_date'])));
             }
             Debug::Arr($start_dow, 'Start DOW: ', __FILE__, __LINE__, __METHOD__, 10);
             Debug::Arr($transaction_days, 'Transaction Days: ', __FILE__, __LINE__, __METHOD__, 10);
             //Get the most common values from arrays.
             $start_day_of_week = Misc::arrayCommonValue($start_dow);
             Debug::Arr($start_dow, 'Start Day Of Week: ' . $start_day_of_week . ' Start DOW Count: ', __FILE__, __LINE__, __METHOD__, 10);
             $transaction_date = Misc::arrayCommonValue($transaction_days);
             Debug::Arr($transaction_days, 'Transaction Date: ' . $transaction_date . ' Transaction Days Count: ', __FILE__, __LINE__, __METHOD__, 10);
             $this->setStartDayOfWeek($start_day_of_week);
             $this->setTransactionDate($transaction_date);
             break;
         case 30:
             //Semi-monthly
             //Need at least three examples?
             $i = 0;
             foreach ($example_dates as $example_date) {
                 if ($i % 2 == 0) {
                     $primary_start_dom[] = TTDate::getDayOfMonth(TTDate::parseDateTime($example_date['start_date']));
                     $primary_transaction_dom[] = TTDate::getDayOfMonth(TTDate::parseDateTime($example_date['transaction_date']));
                 } else {
                     $secondary_start_dom[] = TTDate::getDayOfMonth(TTDate::parseDateTime($example_date['start_date']));
                     $secondary_transaction_dom[] = TTDate::getDayOfMonth(TTDate::parseDateTime($example_date['transaction_date']));
                 }
                 $i++;
             }
             Debug::Arr($primary_start_dom, 'Primary Start DOM: ', __FILE__, __LINE__, __METHOD__, 10);
             Debug::Arr($primary_transaction_dom, 'Primary Transaction DOM: ', __FILE__, __LINE__, __METHOD__, 10);
             Debug::Arr($secondary_start_dom, 'Secondary Start DOM: ', __FILE__, __LINE__, __METHOD__, 10);
             Debug::Arr($secondary_transaction_dom, 'Secondary Transaction DOM: ', __FILE__, __LINE__, __METHOD__, 10);
             $primary_dom = Misc::arrayCommonValue($primary_start_dom);
             $primary_transaction_dom = Misc::arrayCommonValue($primary_transaction_dom);
             $secondary_dom = Misc::arrayCommonValue($secondary_start_dom);
             $secondary_transaction_dom = Misc::arrayCommonValue($secondary_transaction_dom);
             Debug::Text('Primary: ' . $primary_dom . ' Trans: ' . $primary_transaction_dom . ' Secondary: ' . $secondary_dom . ' Trans: ' . $secondary_transaction_dom, __FILE__, __LINE__, __METHOD__, 10);
             $this->setPrimaryDayOfMonth($primary_dom);
             $this->setSecondaryDayOfMonth($secondary_dom);
             $this->setPrimaryTransactionDayOfMonth($primary_transaction_dom);
             $this->setSecondaryTransactionDayOfMonth($secondary_transaction_dom);
             break;
         case 50:
             //Monthly
             //Need at least one example.
             foreach ($example_dates as $example_date) {
                 $primary_start_dom[] = TTDate::getDayOfMonth(TTDate::parseDateTime($example_date['start_date']));
                 $primary_transaction_dom[] = TTDate::getDayOfMonth(TTDate::parseDateTime($example_date['transaction_date']));
             }
             Debug::Arr($primary_start_dom, 'Primary Start DOM: ', __FILE__, __LINE__, __METHOD__, 10);
             Debug::Arr($primary_transaction_dom, 'Primary Transaction DOM: ', __FILE__, __LINE__, __METHOD__, 10);
             $primary_dom = Misc::arrayCommonValue($primary_start_dom);
             $primary_transaction_dom = Misc::arrayCommonValue($primary_transaction_dom);
             $this->setPrimaryDayOfMonth($primary_dom);
             $this->setPrimaryTransactionDayOfMonth($primary_transaction_dom);
             break;
         default:
             return FALSE;
             break;
     }
     Debug::Arr($this->data, 'PP Schedule Data: ', __FILE__, __LINE__, __METHOD__, 10);
     return TRUE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:92,代码来源:PayPeriodScheduleFactory.class.php

示例9: inApplyFrequencyWindow

 function inApplyFrequencyWindow($current_epoch, $offset, $pay_period_end_date = NULL, $hire_date = NULL)
 {
     Debug::Text('Offset: ' . $offset, __FILE__, __LINE__, __METHOD__, 10);
     $retval = FALSE;
     switch ($this->getApplyFrequency()) {
         case 10:
             //Pay Period
             if ($pay_period_end_date == '') {
                 return FALSE;
             }
             if ($pay_period_end_date >= $current_epoch - $offset and $pay_period_end_date <= $current_epoch) {
                 $retval = TRUE;
             }
             break;
         case 20:
             //Year
             if ($this->getApplyFrequencyHireDate() == TRUE) {
                 Debug::Text('Hire Date: ' . TTDate::getDate('DATE', $hire_date), __FILE__, __LINE__, __METHOD__, 10);
                 $year_epoch = mktime(0, 0, 0, TTDate::getMonth($hire_date), TTDate::getDayOfMonth($hire_date), TTDate::getYear($current_epoch));
             } else {
                 Debug::Text('Static Date', __FILE__, __LINE__, __METHOD__, 10);
                 $year_epoch = mktime(0, 0, 0, $this->getApplyFrequencyMonth(), $this->getApplyFrequencyDayOfMonth(), TTDate::getYear($current_epoch));
             }
             Debug::Text('Year EPOCH: ' . TTDate::getDate('DATE+TIME', $year_epoch), __FILE__, __LINE__, __METHOD__, 10);
             if ($year_epoch >= $current_epoch - $offset and $year_epoch <= $current_epoch) {
                 $retval = TRUE;
             }
             break;
         case 30:
             //Month
             $apply_frequency_day_of_month = $this->getApplyFrequencyDayOfMonth();
             //Make sure if they specify the day of month to be 31, that is still works for months with 30, or 28-29 days, assuming 31 basically means the last day of the month
             if ($apply_frequency_day_of_month > TTDate::getDaysInMonth($current_epoch)) {
                 $apply_frequency_day_of_month = TTDate::getDaysInMonth($current_epoch);
                 Debug::Text('Apply frequency day of month exceeds days in this month, using last day of the month instead: ' . $apply_frequency_day_of_month, __FILE__, __LINE__, __METHOD__, 10);
             }
             $month_epoch = mktime(0, 0, 0, TTDate::getMonth($current_epoch), $apply_frequency_day_of_month, TTDate::getYear($current_epoch));
             Debug::Text('Day of Month: ' . $this->getApplyFrequencyDayOfMonth() . ' Month EPOCH: ' . TTDate::getDate('DATE+TIME', $month_epoch) . ' Current Month: ' . TTDate::getMonth($current_epoch), __FILE__, __LINE__, __METHOD__, 10);
             Debug::Text('Month EPOCH: ' . TTDate::getDate('DATE+TIME', $month_epoch) . '(' . $month_epoch . ') Greater Than: ' . TTDate::getDate('DATE+TIME', $current_epoch - $offset) . ' Less Than: ' . TTDate::getDate('DATE+TIME', $current_epoch) . '(' . $current_epoch . ')', __FILE__, __LINE__, __METHOD__, 10);
             if ($month_epoch >= $current_epoch - $offset and $month_epoch <= $current_epoch) {
                 $retval = TRUE;
             }
             break;
         case 40:
             //Week
             Debug::Text('Current Day Of Week: ' . TTDate::getDayOfWeek($current_epoch - $offset), __FILE__, __LINE__, __METHOD__, 10);
             if ($this->getApplyFrequencyDayOfWeek() == TTDate::getDayOfWeek($current_epoch - $offset)) {
                 $retval = TRUE;
             }
             break;
     }
     Debug::Text('RetVal: ' . (int) $retval, __FILE__, __LINE__, __METHOD__, 10);
     return $retval;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:54,代码来源:AccrualPolicyFactory.class.php

示例10: getWeek

 public static function getWeek($epoch = NULL, $start_day_of_week = 0)
 {
     //Default start_day_of_week to 1 (Monday) as that is what PHP defaults to.
     if ($epoch == NULL or $epoch == '') {
         $epoch = self::getTime();
     }
     if ($start_day_of_week == 1) {
         //PHP starts weeks on Monday.
         return date('W', $epoch);
     } else {
         if ($start_day_of_week == 0) {
             return date('W', strtotime('+1 day', $epoch));
         } else {
             $day_of_week = TTDate::getDayOfWeek($epoch, 1);
             //Monday
             $offset = $start_day_of_week - 1;
             //Debug::text(' Offset: '. $offset .' Day Of Week: '. $day_of_week .' Start Day Of Week: '. $start_day_of_week, __FILE__, __LINE__, __METHOD__,10);
             return date('W', strtotime('-' . $offset . ' day', $epoch));
         }
     }
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:21,代码来源:TTDate.class.php

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

示例12: timesheetDayRow


//.........这里部分代码省略.........
         $total_absence_rows = 1;
         if ($data['absence_time'] > 0 and isset($data['categorized_time']['absence_policy'])) {
             $total_absence_rows = count($data['categorized_time']['absence_policy']);
         }
         $total_rows_arr[] = $total_absence_rows;
         rsort($total_rows_arr);
         $max_rows = $total_rows_arr[0];
         $line_h = $format == 'pdf_timesheet_detail' ? $default_line_h * $max_rows : $default_line_h;
         $this->pdf->SetFont($this->config['other']['default_font'], '', $this->_pdf_fontSize(9));
         $this->pdf->Cell($column_widths['line'] + $buffer, $line_h, $this->counter_x, 1, 0, 'C', 1);
         $this->pdf->Cell($column_widths['date_stamp'] + $buffer, $line_h, TTDate::getDate('DATE', $data['time_stamp']), 1, 0, 'C', 1);
         $this->pdf->Cell($column_widths['dow'] + $buffer, $line_h, date('D', $data['time_stamp']), 1, 0, 'C', 1);
         $pre_punch_x = $this->pdf->getX();
         $pre_punch_y = $this->pdf->getY();
         //Print Punches
         if ($format == 'pdf_timesheet_detail' and isset($day_punch_data)) {
             $this->pdf->SetFont($this->config['other']['default_font'], '', $this->_pdf_fontSize(8));
             $n = 0;
             foreach ($day_punch_data as $punch_control_id => $punch_data) {
                 if (!isset($punch_data[10]['time_stamp'])) {
                     $punch_data[10]['time_stamp'] = NULL;
                     $punch_data[10]['type_code'] = NULL;
                 }
                 if (!isset($punch_data[20]['time_stamp'])) {
                     $punch_data[20]['time_stamp'] = NULL;
                     $punch_data[20]['type_code'] = NULL;
                 }
                 if ($n > 0) {
                     $this->pdf->setXY($pre_punch_x, $punch_y + $default_line_h);
                 }
                 $this->pdf->Cell($column_widths['in_punch_time_stamp'] + $buffer, $line_h / $total_punch_rows, TTDate::getDate('TIME', $punch_data[10]['time_stamp']) . ' ' . $punch_data[10]['type_code'], 1, 0, 'C', 1);
                 $this->pdf->Cell($column_widths['out_punch_time_stamp'] + $buffer, $line_h / $total_punch_rows, TTDate::getDate('TIME', $punch_data[20]['time_stamp']) . ' ' . $punch_data[20]['type_code'], 1, 0, 'C', 1);
                 $punch_x = $this->pdf->getX();
                 $punch_y = $this->pdf->getY();
                 $n++;
             }
             $this->pdf->setXY($punch_x, $pre_punch_y);
             $this->pdf->SetFont($this->config['other']['default_font'], '', $this->_pdf_fontSize(9));
         } else {
             $this->pdf->Cell($column_widths['in_punch_time_stamp'] + $buffer, $line_h, TTDate::getDate('TIME', $data['min_punch_time_stamp']), 1, 0, 'C', 1);
             $this->pdf->Cell($column_widths['out_punch_time_stamp'] + $buffer, $line_h, TTDate::getDate('TIME', $data['max_punch_time_stamp']), 1, 0, 'C', 1);
         }
         $this->pdf->Cell($column_widths['worked_time'] + $buffer, $line_h, TTDate::getTimeUnit($data['worked_time']), 1, 0, 'C', 1);
         $this->pdf->Cell($column_widths['regular_time'] + $buffer, $line_h, TTDate::getTimeUnit($data['regular_time']), 1, 0, 'C', 1);
         if ($format == 'pdf_timesheet_detail') {
             if ($data['over_time'] > 0 and isset($data['categorized_time']['over_time_policy'])) {
                 $pre_over_time_x = $this->pdf->getX();
                 $this->pdf->SetFont($this->config['other']['default_font'], '', $this->_pdf_fontSize(8));
                 //Count how many absence policy rows there are.
                 $over_time_policy_total_rows = count($data['categorized_time']['over_time_policy']);
                 foreach ($data['categorized_time']['over_time_policy'] as $policy_column => $value) {
                     $this->pdf->Cell($column_widths['over_time'] + $buffer, $line_h / $total_over_time_rows, $columns[$policy_column] . ': ' . TTDate::getTimeUnit($data[$policy_column]), 1, 0, 'C', 1);
                     $this->pdf->setXY($pre_over_time_x, $this->pdf->getY() + $line_h / $total_over_time_rows);
                     $over_time_x = $this->pdf->getX();
                 }
                 $this->pdf->setXY($over_time_x + $column_widths['over_time'] + $buffer, $pre_punch_y);
                 $this->pdf->SetFont($this->config['other']['default_font'], '', $this->_pdf_fontSize(9));
             } else {
                 $this->pdf->Cell($column_widths['over_time'] + $buffer, $line_h, TTDate::getTimeUnit($data['over_time']), 1, 0, 'C', 1);
             }
             if ($data['absence_time'] > 0 and isset($data['categorized_time']['absence_policy'])) {
                 $pre_absence_time_x = $this->pdf->getX();
                 $this->pdf->SetFont($this->config['other']['default_font'], '', $this->_pdf_fontSize(8));
                 //Count how many absence policy rows there are.
                 $absence_policy_total_rows = count($data['categorized_time']['absence_policy']);
                 foreach ($data['categorized_time']['absence_policy'] as $policy_column => $value) {
                     $this->pdf->Cell($column_widths['absence_time'] + $buffer, $line_h / $total_absence_rows, $columns[$policy_column] . ': ' . TTDate::getTimeUnit($data[$policy_column]), 1, 0, 'C', 1);
                     $this->pdf->setXY($pre_absence_time_x, $this->pdf->getY() + $line_h / $total_absence_rows);
                 }
                 $this->pdf->setY($this->pdf->getY() - $line_h / $total_absence_rows);
                 $this->pdf->SetFont($this->config['other']['default_font'], '', $this->_pdf_fontSize(9));
             } else {
                 $this->pdf->Cell($column_widths['absence_time'] + $buffer, $line_h, TTDate::getTimeUnit($data['absence_time']), 1, 0, 'C', 1);
             }
         } else {
             $this->pdf->Cell($column_widths['over_time'] + $buffer, $line_h, TTDate::getTimeUnit($data['over_time']), 1, 0, 'C', 1);
             $this->pdf->Cell($column_widths['absence_time'] + $buffer, $line_h, TTDate::getTimeUnit($data['absence_time']), 1, 0, 'C', 1);
         }
         $this->pdf->Ln($line_h);
         unset($day_punch_data);
     }
     $this->timesheet_totals['worked_time'] += $data['worked_time'];
     $this->timesheet_totals['absence_time'] += $data['absence_time'];
     $this->timesheet_totals['regular_time'] += $data['regular_time'];
     $this->timesheet_totals['over_time'] += $data['over_time'];
     $this->timesheet_week_totals['worked_time'] += $data['worked_time'];
     $this->timesheet_week_totals['absence_time'] += $data['absence_time'];
     $this->timesheet_week_totals['regular_time'] += $data['regular_time'];
     $this->timesheet_week_totals['over_time'] += $data['over_time'];
     //Debug::Text('Row: '. $this->counter_x .' I: '. $this->counter_i .' Max I: '. $this->max_i, __FILE__, __LINE__, __METHOD__,10);
     //if ( $this->counter_x % 7 == 0 OR $this->counter_i == $max_i ) { //This used to change the week every 7 days starting from the first date in the timesheet.
     if (TTDate::getDayOfWeek(TTDate::getMiddleDayEpoch($data['time_stamp']) + 86400) == $data['start_week_day'] or isset($prev_data['start_week_day']) and $data['start_week_day'] != $prev_data['start_week_day'] or $this->counter_i == $this->max_i) {
         $this->timesheetWeekTotal($column_widths, $this->timesheet_week_totals);
         unset($this->timesheet_week_totals);
         $this->timesheet_week_totals = Misc::preSetArrayValues(NULL, array('worked_time', 'absence_time', 'regular_time', 'over_time'), 0);
     }
     $this->counter_i++;
     $this->counter_x++;
     return TRUE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:101,代码来源:TimesheetDetailReport.class.php

示例13: createPremiumPolicy


//.........这里部分代码省略.........
             $ppf->setTue(TRUE);
             $ppf->setWed(TRUE);
             $ppf->setThu(TRUE);
             $ppf->setFri(TRUE);
             $ppf->setSat(TRUE);
             $ppf->setSun(TRUE);
             $ppf->setIncludePartialPunch(TRUE);
             //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] );
             //$ppf->setMinimumBreakTime( $data['minimum_break_time'] );
             $ppf->setMinimumTime(0);
             $ppf->setMaximumTime(0);
             $ppf->setIncludeMealPolicy(TRUE);
             $ppf->setRate(1.0);
             $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1'));
             //$ppf->setExcludeDefaultBranch( FALSE );
             //$ppf->setExcludeDefaultDepartment( FALSE );
             //$ppf->setJobGroupSelectionType( 10 );
             //$ppf->setJobSelectionType( 10 );
             //$ppf->setJobItemGroupSelectionType( 10 );
             //$ppf->setJobItemSelectionType( 10 );
             break;
         case 110:
             $ppf->setName('Start/End Date+Effective Days');
             $ppf->setType(10);
             $ppf->setPayType(10);
             //Pay Multiplied by factor
             $ppf->setStartDate($this->pay_period_objs[0]->getStartDate() + 86400);
             $ppf->setEndDate($this->pay_period_objs[0]->getStartDate() + 86400 * 3);
             //2nd & 3rd days.
             $ppf->setStartTime(TTDate::parseDateTime('12:00 AM'));
             $ppf->setEndTime(TTDate::parseDateTime('11:59 PM'));
             $ppf->setDailyTriggerTime(0);
             $ppf->setWeeklyTriggerTime(0);
             if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 1 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 1) {
                 $ppf->setMon(TRUE);
             } else {
                 $ppf->setMon(FALSE);
             }
             if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 2 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 2) {
                 $ppf->setTue(TRUE);
             } else {
                 $ppf->setTue(FALSE);
             }
             if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 3 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 3) {
                 $ppf->setWed(TRUE);
             } else {
                 $ppf->setWed(FALSE);
             }
             if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 4 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 4) {
                 $ppf->setThu(TRUE);
             } else {
                 $ppf->setThu(FALSE);
             }
             if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 5 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 5) {
                 $ppf->setFri(TRUE);
             } else {
                 $ppf->setFri(FALSE);
             }
             if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 6 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 6) {
                 $ppf->setSat(TRUE);
             } else {
                 $ppf->setSat(FALSE);
             }
             if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 0 or TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 3) == 0) {
                 $ppf->setSun(TRUE);
             } else {
开发者ID:alachaum,项目名称:timetrex,代码行数:67,代码来源:PremiumPolicyTest.php


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