Пример #1
0
 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;
 }
Пример #2
0
 function createPayPeriodSchedule()
 {
     $ppsf = new PayPeriodScheduleFactory();
     $ppsf->setCompany($this->company_id);
     $ppsf->setName('Semi-Monthly');
     $ppsf->setDescription('');
     $ppsf->setType(30);
     $ppsf->setStartWeekDay(0);
     $anchor_date = TTDate::getBeginWeekEpoch(TTDate::getBeginYearEpoch(time()) - 86400 * (7 * 6));
     //Start 6 weeks ago
     $ppsf->setAnchorDate($anchor_date);
     $ppsf->setPrimaryDayOfMonth(1);
     $ppsf->setSecondaryDayOfMonth(16);
     $ppsf->setPrimaryTransactionDayOfMonth(20);
     $ppsf->setSecondaryTransactionDayOfMonth(5);
     $ppsf->setTransactionDateBusinessDay(TRUE);
     $ppsf->setTimeZone('PST8PDT');
     $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;
 }
Пример #3
0
 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->setContinuousTime( (4*3600) );
     $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;
 }
     $ppsf->setAnnualPayPeriods($pay_period_schedule_data['annual_pay_periods']);
 }
 if ($pay_period_schedule_data['type'] == 10 or $pay_period_schedule_data['type'] == 20) {
     $ppsf->setStartDayOfWeek($pay_period_schedule_data['start_day_of_week']);
     $ppsf->setTransactionDate($pay_period_schedule_data['transaction_date']);
 } elseif ($pay_period_schedule_data['type'] == 30) {
     $ppsf->setPrimaryDayOfMonth($pay_period_schedule_data['primary_day_of_month']);
     $ppsf->setSecondaryDayOfMonth($pay_period_schedule_data['secondary_day_of_month']);
     $ppsf->setPrimaryTransactionDayOfMonth($pay_period_schedule_data['primary_transaction_day_of_month']);
     $ppsf->setSecondaryTransactionDayOfMonth($pay_period_schedule_data['secondary_transaction_day_of_month']);
 } elseif ($pay_period_schedule_data['type'] == 50) {
     $ppsf->setPrimaryDayOfMonth($pay_period_schedule_data['primary_day_of_month']);
     $ppsf->setPrimaryTransactionDayOfMonth($pay_period_schedule_data['primary_transaction_day_of_month']);
 }
 if (isset($pay_period_schedule_data['anchor_date'])) {
     $ppsf->setAnchorDate($pay_period_schedule_data['anchor_date']);
 }
 $ppsf->setTransactionDateBusinessDay($pay_period_schedule_data['transaction_date_bd']);
 if (isset($pay_period_schedule_data['day_start_time'])) {
     $ppsf->setDayStartTime($pay_period_schedule_data['day_start_time']);
 } else {
     $ppsf->setDayStartTime(0);
 }
 $ppsf->setTimeZone($pay_period_schedule_data['time_zone']);
 $ppsf->setNewDayTriggerTime($pay_period_schedule_data['new_day_trigger_time']);
 $ppsf->setMaximumShiftTime($pay_period_schedule_data['maximum_shift_time']);
 $ppsf->setShiftAssignedDay($pay_period_schedule_data['shift_assigned_day_id']);
 $ppsf->setTimeSheetVerifyBeforeEndDate($pay_period_schedule_data['timesheet_verify_before_end_date']);
 $ppsf->setTimeSheetVerifyBeforeTransactionDate($pay_period_schedule_data['timesheet_verify_before_transaction_date']);
 if (isset($pay_period_schedule_data['user_ids'])) {
     $ppsf->setUser($pay_period_schedule_data['user_ids']);