function getByCompanyId($company_id, $where = NULL, $order = NULL) { if ($company_id == '') { return FALSE; } $cdf = new CompanyDeductionFactory(); $ph = array('company_id' => $company_id); $query = ' select a.* from ' . $this->getTable() . ' as a LEFT JOIN ' . $cdf->getTable() . ' as cdf ON a.company_deduction_id = cdf.id where cdf.company_id = ? AND ( cdf.deleted = 0 ) '; $query .= $this->getWhereSQL($where); $query .= $this->getSortSQL($order); $this->ExecuteSQL($query, $ph); return $this; }
function createAbsencePolicy($company_id, $type, $accrual_policy_id = 0) { $apf = new AbsencePolicyFactory(); $apf->setCompany($company_id); switch ($type) { case 10: //Vacation $apf->setName('PTO/Vacation'); $apf->setType(10); //Paid $apf->setAccrualPolicyID($accrual_policy_id); $apf->setPayStubEntryAccountID(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 50, 'Vacation Accrual Release')); break; case 20: //Bank Time $apf->setName('Bank Time'); $apf->setType(20); //Not Paid $apf->setAccrualPolicyID($accrual_policy_id); $apf->setPayStubEntryAccountID(0); break; case 30: //Sick Time $apf->setName('Sick Time'); $apf->setType(20); //Not Paid $apf->setAccrualPolicyID($accrual_policy_id); $apf->setPayStubEntryAccountID(0); break; } if ($apf->isValid()) { $insert_id = $apf->Save(); Debug::Text('Absence Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10); return $insert_id; } Debug::Text('Failed Creating Absence Policy!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
function postSave() { $this->removeCache($this->getId()); $this->remoteSave(); if ($this->getDeleted() == FALSE) { //Add base currency for this new company. if ($this->getEnableAddCurrency() == TRUE) { $clf = new CurrencyListFactory(); $clf->getByCompanyId($this->getId()); if ($clf->getRecordCount() == 0) { Debug::text('Adding Default Currency', __FILE__, __LINE__, __METHOD__, 9); $cf = new CurrencyFactory(); $country_to_currency_map_arr = $cf->getOptions('country_currency'); if (isset($country_to_currency_map_arr[$this->getCountry()])) { $base_currency = $country_to_currency_map_arr[$this->getCountry()]; Debug::text('Found Base Currency For Country: ' . $this->getCountry() . ' Currency: ' . $base_currency, __FILE__, __LINE__, __METHOD__, 9); } else { Debug::text('DID NOT Find Base Currency For Country: ' . $this->getCountry() . ' Using default USD.', __FILE__, __LINE__, __METHOD__, 9); $base_currency = 'USD'; } $cf->setCompany($this->getId()); $cf->setStatus(10); $cf->setName($base_currency); $cf->setISOCode($base_currency); $cf->setConversionRate('1.000000000'); $cf->setAutoUpdate(FALSE); $cf->setBase(TRUE); $cf->setDefault(TRUE); if ($cf->isValid()) { $cf->Save(); } } } if ($this->getEnableAddPermissionGroupPreset() == TRUE) { Debug::text('Adding Preset Permission Groups', __FILE__, __LINE__, __METHOD__, 9); $pf = new PermissionFactory(); $pf->StartTransaction(); if ($this->getProductEdition() == 20) { $preset_flags = array('job' => 1, 'invoice' => 1, 'document' => 1); } else { $preset_flags = array(); } $preset_options = $pf->getOptions('preset'); foreach ($preset_options as $preset_id => $preset_name) { $pcf = new PermissionControlFactory(); $pcf->setCompany($this->getId()); $pcf->setName($preset_name); $pcf->setDescription(''); if ($pcf->isValid()) { $pcf_id = $pcf->Save(FALSE); $pf->applyPreset($pcf_id, $preset_id, $preset_flags); } } //$pf->FailTransaction(); $pf->CommitTransaction(); } if ($this->getEnableAddStation() == TRUE) { Debug::text('Adding Default Station', __FILE__, __LINE__, __METHOD__, 9); //Enable punching in from all stations $sf = new StationFactory(); $sf->setCompany($this->getId()); $sf->setStatus(20); $sf->setType(10); $sf->setSource('ANY'); $sf->setStation('ANY'); $sf->setDescription('All stations'); $sf->setGroupSelectionType(10); $sf->setBranchSelectionType(10); $sf->setDepartmentSelectionType(10); if ($sf->isValid()) { $sf->Save(); } } if ($this->getEnableAddPayStubEntryAccountPreset() == TRUE) { Debug::text('Adding Pay Stub Entry Account Presets', __FILE__, __LINE__, __METHOD__, 9); PayStubEntryAccountFactory::addPresets($this->getId()); } if ($this->getEnableAddCompanyDeductionPreset() == TRUE) { Debug::text('Adding Company Deduction Presets', __FILE__, __LINE__, __METHOD__, 9); CompanyDeductionFactory::addPresets($this->getId()); } if ($this->getEnableAddRecurringHolidayPreset() == TRUE) { Debug::text('Adding Recurring Holiday Presets', __FILE__, __LINE__, __METHOD__, 9); RecurringHolidayFactory::addPresets($this->getId(), $this->getCountry()); } } if ($this->getDeleted() == TRUE) { $ulf = new UserListFactory(); $ulf->getByCompanyId($this->getID()); if ($ulf->getRecordCount() > 0) { $ulf->StartTransaction(); foreach ($ulf as $u_obj) { Debug::text('Deleting User ID: ' . $u_obj->getId(), __FILE__, __LINE__, __METHOD__, 9); $u_obj->setDeleted(TRUE); if ($u_obj->isValid()) { $u_obj->Save(); } } $ulf->CommitTransaction(); } } return TRUE; }
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); } 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 { $ppf->setSun(FALSE); } $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 120: $ppf->setName('Time Based/Evening Shift w/Partial'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('7:00 PM')); $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 122: $ppf->setName('Time Based/Evening Shift w/Partial+Span Midnight'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('6:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('3:00 AM')); $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 123: $ppf->setName('Time Based/Weekend Day Shift w/Partial'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('7:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('7:00 PM')); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMon(FALSE); $ppf->setTue(FALSE); $ppf->setWed(FALSE); $ppf->setThu(FALSE); $ppf->setFri(FALSE); $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 130: $ppf->setName('Time Based/Evening Shift w/o Partial'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('7:00 PM')); $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(FALSE); //$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 132: $ppf->setName('Time Based/Evening Shift w/o Partial+Span Midnight'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('6:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('3:00 AM')); $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(FALSE); //$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 140: $ppf->setName('Daily Hour Based'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('12:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(3600 * 5); $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 150: $ppf->setName('Weekly Hour Based'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('12:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(3600 * 9); $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 160: $ppf->setName('Daily+Weekly Hour Based'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('12:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(3600 * 3); $ppf->setWeeklyTriggerTime(3600 * 9); $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 170: $ppf->setName('Time+Daily+Weekly Hour Based'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('7:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(3600 * 5); $ppf->setWeeklyTriggerTime(3600 * 9); $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 200: $ppf->setName('Branch Differential'); $ppf->setType(20); $ppf->setPayType(10); //Pay Multiplied by factor $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->setBranchSelectionType(20); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 210: $ppf->setName('Branch/Department Differential'); $ppf->setType(20); $ppf->setPayType(10); //Pay Multiplied by factor $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->setBranchSelectionType(20); $ppf->setDepartmentSelectionType(20); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 300: $ppf->setName('Meal Break'); $ppf->setType(30); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setIncludePartialPunch(TRUE); $ppf->setDailyTriggerTime(3600 * 5); $ppf->setMaximumNoBreakTime(3600 * 5); $ppf->setMinimumBreakTime(1800); $ppf->setMinimumTime(1800); $ppf->setMaximumTime(1800); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; } if ($ppf->isValid()) { $insert_id = $ppf->Save(FALSE); Debug::Text('Premium Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10); switch ($type) { case 200: Debug::Text('Post Save Data...', __FILE__, __LINE__, __METHOD__, 10); $ppf->setBranch(array($this->branch_ids[0])); break; case 210: Debug::Text('Post Save Data...', __FILE__, __LINE__, __METHOD__, 10); $ppf->setBranch(array($this->branch_ids[0])); $ppf->setDepartment(array($this->department_ids[0])); break; } Debug::Text('Post Save...', __FILE__, __LINE__, __METHOD__, 10); $ppf->Save(); return $insert_id; } Debug::Text('Failed Creating Premium Policy!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
function createOverTimePolicy($company_id, $type, $accrual_policy_id = NULL) { $otpf = new OverTimePolicyFactory(); $otpf->setCompany($company_id); switch ($type) { case 100: $otpf->setName('Daily (>8hrs)'); $otpf->setType(10); $otpf->setTriggerTime(3600 * 8); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 1')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 110: $otpf->setName('Daily (>9hrs)'); $otpf->setType(10); $otpf->setTriggerTime(3600 * 9); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 120: $otpf->setName('Daily (>10hrs)'); $otpf->setType(10); $otpf->setTriggerTime(3600 * 10); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 200: $otpf->setName('Weekly (>47hrs)'); $otpf->setType(20); $otpf->setTriggerTime(3600 * 47); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 210: $otpf->setName('Weekly (>59hrs)'); $otpf->setType(20); $otpf->setTriggerTime(3600 * 59); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 220: $otpf->setName('Weekly (>71hrs)'); $otpf->setType(20); $otpf->setTriggerTime(3600 * 71); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 230: $otpf->setName('Weekly (>31hrs)'); $otpf->setType(20); $otpf->setTriggerTime(3600 * 31); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 240: $otpf->setName('Weekly (>39hrs)'); $otpf->setType(20); $otpf->setTriggerTime(3600 * 39); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 250: $otpf->setName('Weekly (>47hrs)'); $otpf->setType(20); $otpf->setTriggerTime(3600 * 47); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 500: $otpf->setName('Holiday'); $otpf->setType(180); $otpf->setTriggerTime(0); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; } if ($otpf->isValid()) { $insert_id = $otpf->Save(); Debug::Text('Overtime Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10); return $insert_id; } Debug::Text('Failed Creating Overtime Policy!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
function testMultiplePayStubAccruals() { //Test all parts of multiple pay stubs that span a year boundary. //Start 6 pay periods from the last one. Should be beginning/end of December, //Its the TRANSACTION date that counts $start_pay_period_id = count($this->pay_period_objs) - 8; Debug::text('Starting Pay Period: ' . TTDate::getDate('DATE+TIME', $this->pay_period_objs[$start_pay_period_id]->getStartDate()), __FILE__, __LINE__, __METHOD__, 10); // // First Pay Stub // //Test UnUsed YTD entries... $pay_stub = new PayStubFactory(); $pay_stub->setUser($this->user_id); $pay_stub->setCurrency($pay_stub->getUserObject()->getCurrency()); $pay_stub->setPayPeriod($this->pay_period_objs[$start_pay_period_id]->getId()); $pay_stub->setStatus('NEW'); $pay_stub->setDefaultDates(); $pay_stub->loadPreviousPayStub(); $pse_accounts = array('regular_time' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Regular Time'), 'over_time_1' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Over Time 1'), 'vacation_accrual_release' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Vacation Accrual Release'), 'federal_income_tax' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Federal Income Tax'), 'state_income_tax' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'State Income Tax'), 'medicare' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 30, 'Medicare'), 'state_unemployment' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 30, 'State Unemployment Ins.'), 'vacation_accrual' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 50, 'Vacation Accrual')); $pay_stub->addEntry($pse_accounts['regular_time'], 100.01); $pay_stub->addEntry($pse_accounts['regular_time'], 10.01); $pay_stub->addEntry($pse_accounts['over_time_1'], 100.02); //Adjust YTD balance, emulating a YTD PS amendment $pay_stub->addEntry($pse_accounts['vacation_accrual'], -340.38, NULL, NULL, 'Vacation Accrual YTD adjustment', -1, 0, 0); $pay_stub->addEntry($pse_accounts['vacation_accrual_release'], 6.13); $pay_stub->addEntry($pse_accounts['federal_income_tax'], 50.01); $pay_stub->addEntry($pse_accounts['state_income_tax'], 25.04); $pay_stub->addEntry($pse_accounts['medicare'], 10.01); $pay_stub->addEntry($pse_accounts['state_unemployment'], 15.05); $pay_stub->addEntry($pse_accounts['vacation_accrual'], 60.03); $pay_stub->setEnableProcessEntries(TRUE); $pay_stub->processEntries(); if ($pay_stub->isValid() == TRUE) { Debug::text('Pay Stub is valid, final save.', __FILE__, __LINE__, __METHOD__, 10); $pay_stub_id = $pay_stub->Save(); } $pse_arr = $this->getPayStubEntryArray($pay_stub_id); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][0]['amount'], '100.01'); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][0]['ytd_amount'], '0.00'); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][1]['amount'], '10.01'); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][1]['ytd_amount'], '110.02'); $this->assertEquals($pse_arr[$pse_accounts['over_time_1']][0]['amount'], '100.02'); $this->assertEquals($pse_arr[$pse_accounts['over_time_1']][0]['ytd_amount'], '100.02'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual_release']][0]['amount'], '6.13'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual_release']][0]['ytd_amount'], '6.13'); $this->assertEquals($pse_arr[$pse_accounts['federal_income_tax']][0]['amount'], '50.01'); $this->assertEquals($pse_arr[$pse_accounts['federal_income_tax']][0]['ytd_amount'], '50.01'); $this->assertEquals($pse_arr[$pse_accounts['state_income_tax']][0]['amount'], '25.04'); $this->assertEquals($pse_arr[$pse_accounts['state_income_tax']][0]['ytd_amount'], '25.04'); $this->assertEquals($pse_arr[$pse_accounts['medicare']][0]['amount'], '10.01'); $this->assertEquals($pse_arr[$pse_accounts['medicare']][0]['ytd_amount'], '10.01'); $this->assertEquals($pse_arr[$pse_accounts['state_unemployment']][0]['amount'], '15.05'); $this->assertEquals($pse_arr[$pse_accounts['state_unemployment']][0]['ytd_amount'], '15.05'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual']][0]['amount'], '-340.38'); //YTD adjustment $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual']][0]['ytd_amount'], '0.00'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual']][1]['amount'], '-6.13'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual']][1]['ytd_amount'], '0.00'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual']][2]['amount'], '60.03'); //YTD adjustment $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual']][2]['ytd_amount'], '-286.48'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['total_gross']][0]['amount'], '216.17'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['total_gross']][0]['ytd_amount'], '216.17'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['total_deductions']][0]['amount'], '75.05'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['total_deductions']][0]['ytd_amount'], '75.05'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['net_pay']][0]['amount'], '141.12'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['net_pay']][0]['ytd_amount'], '141.12'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['employer_contribution']][0]['amount'], '25.06'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['employer_contribution']][0]['ytd_amount'], '25.06'); unset($pse_arr, $pay_stub_id, $pay_stub); // // // //Second Pay Stub // // // $pay_stub = new PayStubFactory(); $pay_stub->setUser($this->user_id); $pay_stub->setCurrency($pay_stub->getUserObject()->getCurrency()); $pay_stub->setPayPeriod($this->pay_period_objs[$start_pay_period_id + 1]->getId()); $pay_stub->setStatus('NEW'); $pay_stub->setDefaultDates(); $pay_stub->loadPreviousPayStub(); $pse_accounts = array('regular_time' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Regular Time'), 'over_time_1' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Over Time 1'), 'vacation_accrual_release' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Vacation Accrual Release'), 'federal_income_tax' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Federal Income Tax'), 'state_income_tax' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'State Income Tax'), 'medicare' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 30, 'Medicare'), 'state_unemployment' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 30, 'State Unemployment Ins.'), 'vacation_accrual' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 50, 'Vacation Accrual')); $pay_stub->addEntry($pse_accounts['regular_time'], 198.01); $pay_stub->addEntry($pse_accounts['regular_time'], 12.01); //$pay_stub->addEntry( $pse_accounts['over_time_1'], 111.02 ); //$pay_stub->addEntry( $pse_accounts['vacation_accrual_release'], 1.03 ); $pay_stub->addEntry($pse_accounts['federal_income_tax'], 53.01); $pay_stub->addEntry($pse_accounts['state_income_tax'], 27.04); $pay_stub->addEntry($pse_accounts['medicare'], 13.04); $pay_stub->addEntry($pse_accounts['state_unemployment'], 16.09); $pay_stub->addEntry($pse_accounts['vacation_accrual'], 240.01); $pay_stub->setEnableProcessEntries(TRUE); $pay_stub->processEntries(); if ($pay_stub->isValid() == TRUE) { Debug::text('Pay Stub is valid, final save.', __FILE__, __LINE__, __METHOD__, 10); $pay_stub_id = $pay_stub->Save(); } $pse_arr = $this->getPayStubEntryArray($pay_stub_id); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][0]['amount'], '198.01'); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][0]['ytd_amount'], '0.00'); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][1]['amount'], '12.01'); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][1]['ytd_amount'], '320.04'); $this->assertEquals($pse_arr[$pse_accounts['over_time_1']][0]['amount'], '0.00'); $this->assertEquals($pse_arr[$pse_accounts['over_time_1']][0]['ytd_amount'], '100.02'); //$this->assertEquals( $pse_arr[$pse_accounts['vacation_accrual_release']][0]['amount'], '1.03' ); //$this->assertEquals( $pse_arr[$pse_accounts['vacation_accrual_release']][0]['ytd_amount'], '2.03' ); $this->assertEquals($pse_arr[$pse_accounts['federal_income_tax']][0]['amount'], '53.01'); $this->assertEquals($pse_arr[$pse_accounts['federal_income_tax']][0]['ytd_amount'], '103.02'); $this->assertEquals($pse_arr[$pse_accounts['state_income_tax']][0]['amount'], '27.04'); $this->assertEquals($pse_arr[$pse_accounts['state_income_tax']][0]['ytd_amount'], '52.08'); $this->assertEquals($pse_arr[$pse_accounts['medicare']][0]['amount'], '13.04'); $this->assertEquals($pse_arr[$pse_accounts['medicare']][0]['ytd_amount'], '23.05'); $this->assertEquals($pse_arr[$pse_accounts['state_unemployment']][0]['amount'], '16.09'); $this->assertEquals($pse_arr[$pse_accounts['state_unemployment']][0]['ytd_amount'], '31.14'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual']][0]['amount'], '240.01'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual']][0]['ytd_amount'], '-46.47'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['total_gross']][0]['amount'], '210.02'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['total_gross']][0]['ytd_amount'], '426.19'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['total_deductions']][0]['amount'], '80.05'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['total_deductions']][0]['ytd_amount'], '155.10'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['net_pay']][0]['amount'], '129.97'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['net_pay']][0]['ytd_amount'], '271.09'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['employer_contribution']][0]['amount'], '29.13'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['employer_contribution']][0]['ytd_amount'], '54.19'); unset($pse_arr, $pay_stub_id, $pay_stub); // // Third Pay Stub // //Test UnUsed YTD entries... $pay_stub = new PayStubFactory(); $pay_stub->setUser($this->user_id); $pay_stub->setCurrency($pay_stub->getUserObject()->getCurrency()); $pay_stub->setPayPeriod($this->pay_period_objs[$start_pay_period_id + 2]->getId()); $pay_stub->setStatus('NEW'); $pay_stub->setDefaultDates(); $pay_stub->loadPreviousPayStub(); $pse_accounts = array('regular_time' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Regular Time'), 'over_time_1' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Over Time 1'), 'vacation_accrual_release' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Vacation Accrual Release'), 'federal_income_tax' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Federal Income Tax'), 'state_income_tax' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'State Income Tax'), 'medicare' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 30, 'Medicare'), 'state_unemployment' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 30, 'State Unemployment Ins.'), 'vacation_accrual' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 50, 'Vacation Accrual')); $pay_stub->addEntry($pse_accounts['regular_time'], 100.01); $pay_stub->addEntry($pse_accounts['regular_time'], 10.01); $pay_stub->addEntry($pse_accounts['over_time_1'], 100.02); $pay_stub->addEntry($pse_accounts['vacation_accrual_release'], 1.0); $pay_stub->addEntry($pse_accounts['federal_income_tax'], 50.01); $pay_stub->addEntry($pse_accounts['state_income_tax'], 25.04); $pay_stub->addEntry($pse_accounts['medicare'], 10.01); $pay_stub->addEntry($pse_accounts['state_unemployment'], 15.05); $pay_stub->addEntry($pse_accounts['vacation_accrual'], 65.01000000000001); $pay_stub->setEnableProcessEntries(TRUE); $pay_stub->processEntries(); if ($pay_stub->isValid() == TRUE) { $pay_stub_id = $pay_stub->Save(); Debug::text('Pay Stub is valid, final save, ID: ' . $pay_stub_id, __FILE__, __LINE__, __METHOD__, 10); } $pse_arr = $this->getPayStubEntryArray($pay_stub_id); // // IN NEW YEAR, YTD amounts are zero'd! // $this->assertEquals($pse_arr[$pse_accounts['regular_time']][0]['amount'], '100.01'); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][0]['ytd_amount'], '0.00'); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][1]['amount'], '10.01'); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][1]['ytd_amount'], '430.06'); $this->assertEquals($pse_arr[$pse_accounts['over_time_1']][0]['amount'], '100.02'); $this->assertEquals($pse_arr[$pse_accounts['over_time_1']][0]['ytd_amount'], '200.04'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual_release']][0]['amount'], '1.00'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual_release']][0]['ytd_amount'], '7.13'); $this->assertEquals($pse_arr[$pse_accounts['federal_income_tax']][0]['amount'], '50.01'); $this->assertEquals($pse_arr[$pse_accounts['federal_income_tax']][0]['ytd_amount'], '153.03'); $this->assertEquals($pse_arr[$pse_accounts['state_income_tax']][0]['amount'], '25.04'); $this->assertEquals($pse_arr[$pse_accounts['state_income_tax']][0]['ytd_amount'], '77.12'); $this->assertEquals($pse_arr[$pse_accounts['medicare']][0]['amount'], '10.01'); $this->assertEquals($pse_arr[$pse_accounts['medicare']][0]['ytd_amount'], '33.06'); $this->assertEquals($pse_arr[$pse_accounts['state_unemployment']][0]['amount'], '15.05'); $this->assertEquals($pse_arr[$pse_accounts['state_unemployment']][0]['ytd_amount'], '46.19'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual']][0]['amount'], '-1.00'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual']][0]['ytd_amount'], '0.00'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual']][1]['amount'], '65.01'); $this->assertEquals($pse_arr[$pse_accounts['vacation_accrual']][1]['ytd_amount'], '17.54'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['total_gross']][0]['amount'], '211.04'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['total_gross']][0]['ytd_amount'], '637.23'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['total_deductions']][0]['amount'], '75.05'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['total_deductions']][0]['ytd_amount'], '230.15'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['net_pay']][0]['amount'], '135.99'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['net_pay']][0]['ytd_amount'], '407.08'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['employer_contribution']][0]['amount'], '25.06'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['employer_contribution']][0]['ytd_amount'], '79.25'); unset($pse_arr, $pay_stub_id, $pay_stub); return TRUE; }
function getObjectAsArray($include_columns = NULL) { $variable_function_map = $this->getVariableToFunctionMap(); if (is_array($variable_function_map)) { $cdf = new CompanyDeductionFactory(); foreach ($variable_function_map as $variable => $function_stub) { if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) { $function = 'get' . $function_stub; switch ($variable) { //CompanyDeduction columns. case 'name': case 'status_id': case 'type_id': case 'calculation_id': //User columns. //User columns. case 'first_name': case 'last_name': $data[$variable] = $this->getColumn($variable); break; //CompanyDeduction columns. //CompanyDeduction columns. case 'type': case 'status': case 'calculation': $data[$variable] = Option::getByKey($this->getColumn($variable . '_id'), $cdf->getOptions($variable)); break; default: if (method_exists($this, $function)) { $data[$variable] = $this->{$function}(); } break; } } } $this->getCreatedAndUpdatedColumns($data, $include_columns); } return $data; }
// See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'page', 'sort_column', 'sort_order', 'ids'))); URLBuilder::setURL($_SERVER['SCRIPT_NAME'], array('sort_column' => $sort_column, 'sort_order' => $sort_order, 'page' => $page)); $sort_array = NULL; if ($sort_column != '') { $sort_array = array($sort_column => $sort_order); } Debug::Arr($ids, 'Selected Objects', __FILE__, __LINE__, __METHOD__, 10); $action = Misc::findSubmitButton(); switch ($action) { case 'add_presets': //Debug::setVerbosity(11); CompanyDeductionFactory::addPresets($current_company->getId()); Redirect::Page(URLBuilder::getURL(NULL, 'CompanyDeductionList.php')); case 'add': Redirect::Page(URLBuilder::getURL(NULL, 'EditCompanyDeduction.php', FALSE)); break; case 'delete': case 'undelete': if (strtolower($action) == 'delete') { $delete = TRUE; } else { $delete = FALSE; } $cdlf = TTnew('CompanyDeductionListFactory'); foreach ($ids as $id) { $cdlf->getByCompanyIdAndId($current_company->getId(), $id); foreach ($cdlf as $cd_obj) {
* $Date: 2008-01-09 15:47:31 -0800 (Wed, 09 Jan 2008) $ */ require_once '../../includes/global.inc.php'; require_once Environment::getBasePath() . 'includes/Interface.inc.php'; if (!$permission->Check('user_tax_deduction', 'enabled') or !($permission->Check('user_tax_deduction', 'edit') or $permission->Check('user_tax_deduction', 'edit_own') or $permission->Check('user_tax_deduction', 'add'))) { $permission->Redirect(FALSE); //Redirect } $smarty->assign('title', TTi18n::gettext($title = 'Edit Employee Tax / Deduction')); // See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'company_deduction_id', 'user_id', 'saved_search_id', 'id', 'data'))); $udf = new UserDeductionFactory(); $cdf = new CompanyDeductionFactory(); $ulf = new UserListFactory(); $action = Misc::findSubmitButton(); $action = strtolower($action); switch ($action) { case 'submit': Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); //Debug::setVerbosity(11); $udf->StartTransaction(); if ($company_deduction_id != '') { //Debug::setVerbosity(11); Debug::Text('Mass User Update', __FILE__, __LINE__, __METHOD__, 10); //Debug::Arr($data, 'All User Data', __FILE__, __LINE__, __METHOD__,10); $redirect = 0; if (isset($data['users']) and is_array($data['users']) and count($data['users']) > 0) { foreach ($data['users'] as $user_id => $user_data) {
} $smarty->assign('title', TTi18n::gettext($title = 'Edit Tax / Deduction')); // See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'id', 'data'))); if (isset($data)) { if ($data['start_date'] != '') { $data['start_date'] = TTDate::parseDateTime($data['start_date']); } if ($data['end_date'] != '') { $data['end_date'] = TTDate::parseDateTime($data['end_date']); } } $cdf = new CompanyDeductionFactory(); $action = Misc::findSubmitButton(); $action = strtolower($action); switch ($action) { case 'submit': Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); //Debug::setVerbosity(11); $cdf->StartTransaction(); $cdf->setId($data['id']); $cdf->setCompany($current_company->getId()); $cdf->setStatus($data['status_id']); $cdf->setType($data['type_id']); $cdf->setName($data['name']); $cdf->setCalculation($data['calculation_id']); $cdf->setCalculationOrder($data['calculation_order']); if (isset($data['country'])) {
function createOverTimePolicy($company_id, $type, $accrual_policy_id = NULL) { $otpf = new OverTimePolicyFactory(); $otpf->setCompany($company_id); switch ($type) { // //Changing the OT rates will make a big difference is how these tests are calculated. // case 100: $otpf->setName('Daily (>8hrs)'); $otpf->setType(10); $otpf->setTriggerTime(3600 * 8); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 1')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 110: $otpf->setName('Daily (>9hrs)'); $otpf->setType(10); $otpf->setTriggerTime(3600 * 9); $otpf->setRate('2.0'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 120: $otpf->setName('Daily (>10hrs)'); $otpf->setType(10); $otpf->setTriggerTime(3600 * 10); $otpf->setRate('2.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 200: $otpf->setName('Weekly (>47hrs)'); $otpf->setType(20); $otpf->setTriggerTime(3600 * 47); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 210: $otpf->setName('Weekly (>59hrs)'); $otpf->setType(20); $otpf->setTriggerTime(3600 * 59); $otpf->setRate('2.0'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 220: $otpf->setName('Weekly (>71hrs)'); $otpf->setType(20); $otpf->setTriggerTime(3600 * 71); $otpf->setRate('2.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 230: $otpf->setName('Weekly (>31hrs)'); $otpf->setType(20); $otpf->setTriggerTime(3600 * 31); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 240: $otpf->setName('Weekly (>39hrs)'); $otpf->setType(20); $otpf->setTriggerTime(3600 * 39); $otpf->setRate('2.0'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 250: $otpf->setName('Weekly (>47hrs)'); $otpf->setType(20); $otpf->setTriggerTime(3600 * 47); $otpf->setRate('2.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 300: $otpf->setName('BiWeekly (>80hrs)'); $otpf->setType(30); $otpf->setTriggerTime(3600 * 80); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 310: $otpf->setName('BiWeekly (>84hrs)'); $otpf->setType(30); $otpf->setTriggerTime(3600 * 84); $otpf->setRate('2.0'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 320: $otpf->setName('BiWeekly (>86hrs)'); $otpf->setType(30); $otpf->setTriggerTime(3600 * 86); $otpf->setRate('2.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 500: $otpf->setName('Holiday'); $otpf->setType(180); $otpf->setTriggerTime(0); $otpf->setRate('1.5'); $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; case 510: $otpf->setName('Holiday'); $otpf->setType(180); $otpf->setTriggerTime(0); $otpf->setRate('4.0'); //This should have the highest rate as it always takes precedance. $otpf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Over Time 2')); $otpf->setAccrualPolicyId((int) $accrual_policy_id); $otpf->setAccrualRate(1.0); break; } if ($otpf->isValid()) { $insert_id = $otpf->Save(); Debug::Text('Overtime Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10); return $insert_id; } Debug::Text('Failed Creating Overtime Policy!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
function testNoHoursPayStub() { $pse_accounts = array('regular_time' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Regular Time'), 'over_time_1' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Over Time 1'), 'premium_1' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Premium 1'), 'premium_2' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Premium 2'), 'bonus' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Bonus'), 'other' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Other'), 'vacation_accrual_release' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 10, 'Vacation Accrual Release'), 'federal_income_tax' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Federal Income Tax'), 'state_income_tax' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'State Income Tax'), 'state_disability' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'State Disability Ins.'), 'medicare' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Medicare'), 'union_dues' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Union Dues'), 'advanced_percent_1' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Advanced Percent 1'), 'advanced_percent_2' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Advanced Percent 2'), 'deduction_other' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Other'), 'ei' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'ei'), 'cpp' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'cpp'), 'employer_medicare' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 30, 'Medicare'), 'employer_fica' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 30, 'Social Security (FICA)'), 'vacation_accrual' => CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 50, 'Vacation Accrual')); $pay_stub_id = $this->getPayStub($this->pay_period_objs[1]->getId()); $pse_arr = $this->getPayStubEntryArray($pay_stub_id); //var_dump($pse_arr); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][0]['rate'], '33.33'); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][0]['units'], '3.00'); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][0]['amount'], '99.99'); $this->assertEquals($pse_arr[$pse_accounts['regular_time']][0]['ytd_amount'], '2507.99'); $this->assertEquals($pse_arr[$pse_accounts['bonus']][0]['rate'], '10.00'); $this->assertEquals($pse_arr[$pse_accounts['bonus']][0]['units'], '30.00'); $this->assertEquals($pse_arr[$pse_accounts['bonus']][0]['amount'], '300.00'); $this->assertEquals($pse_arr[$pse_accounts['bonus']][0]['ytd_amount'], '400.00'); $this->assertEquals($pse_arr[$pse_accounts['union_dues']][0]['amount'], '0.00'); $this->assertEquals($pse_arr[$pse_accounts['union_dues']][0]['ytd_amount'], '19.98'); $this->assertEquals($pse_arr[$this->pay_stub_account_link_arr['total_gross']][0]['amount'], '399.99'); //Check deductions. $this->assertEquals($pse_arr[$pse_accounts['advanced_percent_1']][0]['amount'], '0.00'); //Already Exceeded Wage Base, this should be 0!! $this->assertEquals($pse_arr[$pse_accounts['advanced_percent_1']][0]['ytd_amount'], '20.00'); $this->assertEquals($pse_arr[$pse_accounts['advanced_percent_2']][0]['amount'], '0.92'); //Nearing Wage Base, this should be less than 1!! $this->assertEquals($pse_arr[$pse_accounts['advanced_percent_2']][0]['ytd_amount'], '25.00'); if ($pse_arr[$this->pay_stub_account_link_arr['total_deductions']][0]['amount'] >= 45 and $pse_arr[$this->pay_stub_account_link_arr['total_deductions']][0]['amount'] <= 65 and bcadd($pse_arr[$this->pay_stub_account_link_arr['total_deductions']][0]['amount'], 3881.92) == $pse_arr[$this->pay_stub_account_link_arr['total_deductions']][0]['ytd_amount']) { $this->assertTrue(TRUE); } else { $this->assertTrue(FALSE, 'Total Deductions not within range! Total Deductions: ' . $pse_arr[$this->pay_stub_account_link_arr['total_deductions']][0]['amount'] . ' YTD Amount: ' . $pse_arr[$this->pay_stub_account_link_arr['total_deductions']][0]['ytd_amount']); } if ($pse_arr[$this->pay_stub_account_link_arr['net_pay']][0]['amount'] >= 335 and $pse_arr[$this->pay_stub_account_link_arr['net_pay']][0]['amount'] <= 355 and bcadd($pse_arr[$this->pay_stub_account_link_arr['net_pay']][0]['amount'], 492.92) == $pse_arr[$this->pay_stub_account_link_arr['net_pay']][0]['ytd_amount']) { $this->assertTrue(TRUE); } else { $this->assertTrue(FALSE, 'NET PAY not within range! Net Pay: ' . $pse_arr[$this->pay_stub_account_link_arr['net_pay']][0]['amount'] . ' YTD Amount: ' . $pse_arr[$this->pay_stub_account_link_arr['net_pay']][0]['ytd_amount']); } return TRUE; }
function getByCompanyIdAndUserId($company_id, $user_id, $where = NULL, $order = NULL) { if ($company_id == '') { return FALSE; } if ($user_id == '') { return FALSE; } if ($order == NULL) { $order = array('c.status_id' => 'asc', 'c.calculation_order' => 'asc'); $strict = FALSE; } else { $strict = TRUE; } $uf = new UserFactory(); $cdf = new CompanyDeductionFactory(); $ph = array('company_id' => $company_id); $query = ' select a.* from ' . $this->getTable() . ' as a, ' . $uf->getTable() . ' as b, ' . $cdf->getTable() . ' as c where a.user_id = b.id AND a.company_deduction_id = c.id AND b.company_id = ? AND a.user_id in (' . $this->getListSQL($user_id, $ph) . ') AND (a.deleted = 0 AND c.deleted = 0) '; $query .= $this->getWhereSQL($where); $query .= $this->getSortSQL($order, $strict); $this->rs = $this->db->Execute($query, $ph); return $this; }
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 91: //Basic Min/Max only. as Advanced Type $ppf->setName('Min/Max Only'); $ppf->setType(100); //Advanced Type. $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); } 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 { $ppf->setSun(FALSE); } $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 120: $ppf->setName('Time Based/Evening Shift w/Partial'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('7:00 PM')); $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 122: $ppf->setName('Time Based/Evening Shift w/Partial+Span Midnight'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('6:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('3:00 AM')); $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 123: $ppf->setName('Time Based/Weekend Day Shift w/Partial'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('7:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('7:00 PM')); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMon(FALSE); $ppf->setTue(FALSE); $ppf->setWed(FALSE); $ppf->setThu(FALSE); $ppf->setFri(FALSE); $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 124: //Same as above type: 122, only Advanced type. $ppf->setName('Time Based/Evening Shift w/Partial+Span Midnight'); $ppf->setType(100); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('6:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('3:00 AM')); $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 125: //Same as above type: 123, only Advanced type. $ppf->setName('Time Based/Weekend Day Shift w/Partial'); $ppf->setType(100); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('7:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('7:00 PM')); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMon(FALSE); $ppf->setTue(FALSE); $ppf->setWed(FALSE); $ppf->setThu(FALSE); $ppf->setFri(FALSE); $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 126: //Same as above type: 122, only Advanced type. $ppf->setName('Time Based/Evening Shift w/Partial+Span Midnight'); $ppf->setType(100); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('10:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('12:00 AM')); $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 127: $ppf->setName('Effective Days Only w/Partial'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(''); $ppf->setEndTime(''); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMon(FALSE); $ppf->setTue(FALSE); $ppf->setWed(FALSE); $ppf->setThu(FALSE); $ppf->setFri(FALSE); $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->setIncludeHolidayType(20); //Always on holidays. This is key to test for a specific bug. $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 130: $ppf->setName('Time Based/Evening Shift w/o Partial'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('7:00 PM')); $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(FALSE); //$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 132: $ppf->setName('Time Based/Evening Shift w/o Partial+Span Midnight'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('6:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('3:00 AM')); $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(FALSE); //$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 140: $ppf->setName('Daily Hour Based'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('12:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(3600 * 5); $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 150: $ppf->setName('Weekly Hour Based'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('12:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(3600 * 9); $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 160: $ppf->setName('Daily+Weekly Hour Based'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('12:00 AM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(3600 * 3); $ppf->setWeeklyTriggerTime(3600 * 9); $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 170: $ppf->setName('Time+Daily+Weekly Hour Based'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(TTDate::parseDateTime('7:00 PM')); $ppf->setEndTime(TTDate::parseDateTime('11:59 PM')); $ppf->setDailyTriggerTime(3600 * 5); $ppf->setWeeklyTriggerTime(3600 * 9); $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 200: $ppf->setName('Branch Differential'); $ppf->setType(20); $ppf->setPayType(10); //Pay Multiplied by factor $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->setBranchSelectionType(20); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 210: $ppf->setName('Branch/Department Differential'); $ppf->setType(20); $ppf->setPayType(10); //Pay Multiplied by factor $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->setBranchSelectionType(20); $ppf->setDepartmentSelectionType(20); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 212: $ppf->setName('Branch/Department Differential w/Minimum'); $ppf->setType(20); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setIncludePartialPunch(TRUE); //$ppf->setMaximumNoBreakTime( $data['maximum_no_break_time'] ); //$ppf->setMinimumBreakTime( $data['minimum_break_time'] ); $ppf->setMinimumTime(3600); $ppf->setMaximumTime(3600); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); $ppf->setExcludeDefaultBranch(FALSE); $ppf->setExcludeDefaultDepartment(FALSE); $ppf->setBranchSelectionType(20); $ppf->setDepartmentSelectionType(20); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 300: $ppf->setName('Meal Break'); $ppf->setType(30); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setIncludePartialPunch(TRUE); $ppf->setDailyTriggerTime(3600 * 5); $ppf->setMaximumNoBreakTime(3600 * 5); $ppf->setMinimumBreakTime(1800); $ppf->setMinimumTime(1800); $ppf->setMaximumTime(1800); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 350: $ppf->setName('Minimum Shift Time'); $ppf->setType(50); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setMinimumShiftTime(4 * 3600); $ppf->setMinimumTimeBetweenShift(8 * 3600); $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->setBranchSelectionType( 20 ); break; case 351: $ppf->setName('Minimum Shift Time+Differential'); $ppf->setType(50); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setMinimumShiftTime(4 * 3600); $ppf->setMinimumTimeBetweenShift(8 * 3600); $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->setBranchSelectionType(20); break; case 400: $ppf->setName('Holiday (Basic)'); $ppf->setType(90); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setIncludePartialPunch(TRUE); $ppf->setDailyTriggerTime(0); $ppf->setMaximumNoBreakTime(0); //$ppf->setMinimumBreakTime( 0 ); $ppf->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); //$ppf->setJobGroupSelectionType( 10 ); //$ppf->setJobSelectionType( 10 ); //$ppf->setJobItemGroupSelectionType( 10 ); //$ppf->setJobItemSelectionType( 10 ); break; case 410: $ppf->setName('Start/End Date+Effective Days+Always Holiday'); $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(FALSE); $ppf->setTue(FALSE); $ppf->setWed(FALSE); $ppf->setThu(FALSE); $ppf->setFri(FALSE); $ppf->setSat(FALSE); $ppf->setSun(FALSE); $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->setIncludeHolidayType(20); //Always on holidays $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 412: $ppf->setName('Start/End Date+Effective Days+Never Holiday'); $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->setIncludeHolidayType(30); //Never on holidays $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 414: $ppf->setName('Weekly+Never Holiday'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(''); $ppf->setEndTime(''); $ppf->setDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(3600 * 40); $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->setIncludeHolidayType(30); //Never on Holiday $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 500: $ppf->setName('Daily Before/After Time 8-10hrs'); $ppf->setType(10); $ppf->setPayType(10); $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(''); $ppf->setEndTime(''); $ppf->setDailyTriggerTime(8 * 3600); $ppf->setMaximumDailyTriggerTime(10 * 3600); $ppf->setWeeklyTriggerTime(0); $ppf->setMaximumWeeklyTriggerTime(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->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setIncludeHolidayType(10); //No effect. $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); break; case 501: $ppf->setName('Daily Before/After Time 10-11hrs'); $ppf->setType(10); $ppf->setPayType(10); $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(''); $ppf->setEndTime(''); $ppf->setDailyTriggerTime(10 * 3600); $ppf->setMaximumDailyTriggerTime(11 * 3600); $ppf->setWeeklyTriggerTime(0); $ppf->setMaximumWeeklyTriggerTime(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->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setIncludeHolidayType(10); //No effect. $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); break; case 510: $ppf->setName('Weekly Before/After Time 20-30hrs'); $ppf->setType(10); $ppf->setPayType(10); $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(''); $ppf->setEndTime(''); $ppf->setDailyTriggerTime(0); $ppf->setMaximumDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(20 * 3600); $ppf->setMaximumWeeklyTriggerTime(30 * 3600); $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->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setIncludeHolidayType(10); //No effect. $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); break; case 511: $ppf->setName('Weekly Before/After Time 30-40hrs'); $ppf->setType(10); $ppf->setPayType(10); $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(''); $ppf->setEndTime(''); $ppf->setDailyTriggerTime(0); $ppf->setMaximumDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(30 * 3600); $ppf->setMaximumWeeklyTriggerTime(40 * 3600); $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->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setIncludeHolidayType(10); //No effect. $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); break; case 520: $ppf->setName('Daily After 8/Weekly Before 40'); $ppf->setType(10); $ppf->setPayType(10); $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(''); $ppf->setEndTime(''); $ppf->setDailyTriggerTime(8 * 3600); $ppf->setMaximumDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMaximumWeeklyTriggerTime(40 * 3600); $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->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setIncludeHolidayType(10); //No effect. $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); break; case 521: $ppf->setName('Daily After 8/Weekly After 40'); $ppf->setType(10); $ppf->setPayType(10); $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(''); $ppf->setEndTime(''); $ppf->setDailyTriggerTime(8 * 3600); $ppf->setMaximumDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(40 * 3600); $ppf->setMaximumWeeklyTriggerTime(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->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setIncludeHolidayType(10); //No effect. $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); break; case 522: $ppf->setName('Daily Before 8/Weekly After 40'); $ppf->setType(10); $ppf->setPayType(10); $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(''); $ppf->setEndTime(''); $ppf->setDailyTriggerTime(0); $ppf->setMaximumDailyTriggerTime(8 * 3600); $ppf->setWeeklyTriggerTime(40 * 3600); $ppf->setMaximumWeeklyTriggerTime(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->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setIncludeHolidayType(10); //No effect. $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); break; case 523: $ppf->setName('Weekly Before 40'); $ppf->setType(10); $ppf->setPayType(10); $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(''); $ppf->setEndTime(''); $ppf->setDailyTriggerTime(0); $ppf->setMaximumDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMaximumWeeklyTriggerTime(40 * 3600); $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->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setIncludeHolidayType(10); //No effect. $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); break; case 524: $ppf->setName('Daily Before 8/Weekly Before 40'); $ppf->setType(10); $ppf->setPayType(10); $ppf->setStartDate(''); $ppf->setEndDate(''); $ppf->setStartTime(''); $ppf->setEndTime(''); $ppf->setDailyTriggerTime(0); $ppf->setMaximumDailyTriggerTime(8 * 3600); $ppf->setWeeklyTriggerTime(0); $ppf->setMaximumWeeklyTriggerTime(40 * 3600); $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->setMinimumTime(0); $ppf->setMaximumTime(0); $ppf->setIncludeMealPolicy(TRUE); $ppf->setIncludeHolidayType(10); //No effect. $ppf->setRate(1.0); $ppf->setPayStubEntryAccountId(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Premium 1')); break; case 600: $ppf->setName('Last second of day'); $ppf->setType(10); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setStartDate(''); $ppf->setEndDate(''); $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) { $ppf->setMon(TRUE); } else { $ppf->setMon(FALSE); } if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 2) { $ppf->setTue(TRUE); } else { $ppf->setTue(FALSE); } if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 3) { $ppf->setWed(TRUE); } else { $ppf->setWed(FALSE); } if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 4) { $ppf->setThu(TRUE); } else { $ppf->setThu(FALSE); } if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 5) { $ppf->setFri(TRUE); } else { $ppf->setFri(FALSE); } if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 6) { $ppf->setSat(TRUE); } else { $ppf->setSat(FALSE); } if (TTDate::getDayOfWeek($this->pay_period_objs[0]->getStartDate() + 86400 * 2) == 0) { $ppf->setSun(TRUE); } else { $ppf->setSun(FALSE); } $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 700: $ppf->setName('Advanced Active After + Differential'); $ppf->setType(100); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setDailyTriggerTime(3600 * 8); $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->setBranchSelectionType(20); $ppf->setDepartmentSelectionType(20); break; case 723: //Same as 724 $ppf->setName('Advanced Weekly Before 40A + Diff'); $ppf->setType(100); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setDailyTriggerTime(0); $ppf->setMaximumDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMaximumWeeklyTriggerTime(40 * 3600); $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->setBranchSelectionType(20); $ppf->setDepartmentSelectionType(20); break; case 724: //Same as 723 $ppf->setName('Advanced Weekly Before 40B + Diff'); $ppf->setType(100); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setDailyTriggerTime(0); $ppf->setMaximumDailyTriggerTime(0); $ppf->setWeeklyTriggerTime(0); $ppf->setMaximumWeeklyTriggerTime(40 * 3600); $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->setBranchSelectionType(20); $ppf->setDepartmentSelectionType(20); break; case 729: $ppf->setName('Advanced Daily Before 8/Weekly Before 40 + Diff'); $ppf->setType(100); $ppf->setPayType(10); //Pay Multiplied by factor $ppf->setDailyTriggerTime(0); $ppf->setMaximumDailyTriggerTime(8 * 3600); $ppf->setWeeklyTriggerTime(0); $ppf->setMaximumWeeklyTriggerTime(40 * 3600); $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->setBranchSelectionType(20); $ppf->setDepartmentSelectionType(20); break; } if ($ppf->isValid()) { $insert_id = $ppf->Save(FALSE); Debug::Text('Premium Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10); switch ($type) { case 200: Debug::Text('Post Save Data...', __FILE__, __LINE__, __METHOD__, 10); $ppf->setBranch(array($this->branch_ids[0])); break; case 210: case 351: Debug::Text('Post Save Data...', __FILE__, __LINE__, __METHOD__, 10); $ppf->setBranch(array($this->branch_ids[0])); $ppf->setDepartment(array($this->department_ids[0])); break; case 700: Debug::Text('Post Save Data...', __FILE__, __LINE__, __METHOD__, 10); $ppf->setBranch(array($this->branch_ids[0])); $ppf->setDepartment(array($this->department_ids[0])); break; case 723: Debug::Text('Post Save Data...', __FILE__, __LINE__, __METHOD__, 10); $ppf->setBranch(array($this->branch_ids[0])); $ppf->setDepartment(array($this->department_ids[0])); break; case 724: //Same as 729. //Same as 729. case 729: Debug::Text('Post Save Data...', __FILE__, __LINE__, __METHOD__, 10); $ppf->setBranch(array($this->branch_ids[1])); $ppf->setDepartment(array($this->department_ids[1])); break; } Debug::Text('Post Save...', __FILE__, __LINE__, __METHOD__, 10); $ppf->Save(); return $insert_id; } Debug::Text('Failed Creating Premium Policy!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
} $filter_data = Misc::preSetArrayValues($filter_data, array('company_deduction_ids', 'include_user_ids', 'exclude_user_ids', 'user_status_ids', 'group_ids', 'branch_ids', 'department_ids', 'user_title_ids', 'pay_period_ids', 'column_ids'), array()); $ugdlf = new UserGenericDataListFactory(); $ugdf = new UserGenericDataFactory(); $action = Misc::findSubmitButton(); switch ($action) { case 'export': case 'display_report': //Debug::setVerbosity(11); Debug::Text('Submit! Action: ' . $action, __FILE__, __LINE__, __METHOD__, 10); //Debug::Arr($filter_data, 'aFilter Data', __FILE__, __LINE__, __METHOD__,10); $ulf = new UserListFactory(); $ulf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data); if ($ulf->getRecordCount() > 0) { //Get total gross pay stub account IDs $cdf = new CompanyDeductionFactory(); $cdf->setCompany($current_company->getId()); $total_gross_psea_ids = $cdf->getExpandedPayStubEntryAccountIDs($cdf->getPayStubEntryAccountLinkObject()->getTotalGross()); //var_dump($total_gross_psea_ids); //Get include/exclude IDs for company deduction. $cdlf = new CompanyDeductionListFactory(); $cdlf->getByCompanyIdAndId($current_company->getId(), $filter_data['company_deduction_ids']); if ($cdlf->getRecordCount() > 0) { $taxable_wages_psea_ids = array(); $tax_withheld_psea_ids = array(); Debug::Text('Found Company Deductions...', __FILE__, __LINE__, __METHOD__, 10); foreach ($cdlf as $cd_obj) { $taxable_wages_psea_ids = array_merge($taxable_wages_psea_ids, (array) $cd_obj->getCombinedIncludeExcludePayStubEntryAccount($cd_obj->getIncludePayStubEntryAccount(), $cd_obj->getExcludePayStubEntryAccount())); $tax_withheld_psea_ids[] = $cd_obj->getPayStubEntryAccount(); } $taxable_wages_psea_ids = array_unique($taxable_wages_psea_ids);
static function addPresets($company_id) { if ($company_id == '') { Debug::text('Company ID: ' . $company_id, __FILE__, __LINE__, __METHOD__, 10); return FALSE; } $clf = new CompanyListFactory(); $clf->getById($company_id); if ($clf->getRecordCount() > 0) { $company_obj = $clf->getCurrent(); $country = $company_obj->getCountry(); $province = $company_obj->getProvince(); } else { Debug::text('bCompany ID: ' . $company_id, __FILE__, __LINE__, __METHOD__, 10); return FALSE; } //Get PayStub Link accounts $pseallf = new PayStubEntryAccountLinkListFactory(); $pseallf->getByCompanyId($company_id); if ($pseallf->getRecordCount() > 0) { $psea_obj = $pseallf->getCurrent(); } else { Debug::text('cCompany ID: ' . $company_id, __FILE__, __LINE__, __METHOD__, 10); return FALSE; } require_once Environment::getBasePath() . '/classes/payroll_deduction/PayrollDeduction.class.php'; $cdf = new CompanyDeductionFactory(); $cdf->StartTransaction(); /* 10 => 'Percent', 15 => 'Advanced Percent', 20 => 'Fixed Amount', //Federal 100 => 'Federal Income Tax Formula', //Province/State 200 => 'Province/State Income Tax Formula', 210 => 'Province/State UI Formula', */ Debug::text('Country: ' . $country, __FILE__, __LINE__, __METHOD__, 10); switch (strtolower($country)) { case 'ca': $pd_obj = new PayrollDeduction($country, 'BC'); //Pick default province for now. $pd_obj->setDate(time()); $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('Federal Income Tax'); $cdf->setCalculation(100); $cdf->setCalculationOrder(100); $cdf->setCountry('CA'); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, '%Federal Income%')); $cdf->setUserValue1($pd_obj->getBasicFederalClaimCodeAmount()); if ($cdf->isValid()) { $cdf->Save(FALSE); $exclude_ids = array(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'Union')); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); //var_dump($exclude_ids); $cdf->setExcludePayStubEntryAccount($exclude_ids); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('Additional Income Tax'); $cdf->setCalculation(20); $cdf->setCalculationOrder(105); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, '%Additional Income Tax%')); $cdf->setUserValue1(0); if ($cdf->isValid()) { $cdf->Save(FALSE); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('CPP - Employee'); $cdf->setCalculation(90); // CPP Formula $cdf->setCalculationOrder(80); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'CPP')); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('CPP - Employer'); $cdf->setCalculation(10); $cdf->setCalculationOrder(85); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, '%CPP - Employer%')); $cdf->setUserValue1(100); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'CPP'))); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('EI - Employee'); $cdf->setCalculation(91); //EI Formula $cdf->setCalculationOrder(90); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'EI')); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('EI - Employer'); $cdf->setCalculation(10); $cdf->setCalculationOrder(95); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, '%EI - Employer%')); $cdf->setUserValue1(140); //2006 if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'EI'))); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('WCB - Employer'); $cdf->setCalculation(15); $cdf->setCalculationOrder(95); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, '%WCB%')); $cdf->setUserValue1(0.0); //Default $cdf->setUserValue2(0); //Annual Wage Base: WCB has this, but can differ between rates/classifications. $cdf->setUserValue3(0); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(20); //Deduction $cdf->setName('Vacation Accrual'); $cdf->setCalculation(10); $cdf->setCalculationOrder(50); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 50, 'Vacation Accrual')); $cdf->setUserValue1(4); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); $exclude_ids = array(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Vacation Accrual Release'), self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Vacation Time')); $cdf->setExcludePayStubEntryAccount($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(20); //Deduction $cdf->setName('Vacation Release'); $cdf->setCalculation(10); $cdf->setCalculationOrder(51); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Vacation Accrual Release')); $cdf->setUserValue1(4); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); $exclude_ids = array(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Vacation Accrual Release'), self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 10, 'Vacation Time')); $cdf->setExcludePayStubEntryAccount($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'us': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('Federal Income Tax'); $cdf->setCalculation(100); $cdf->setCalculationOrder(100); $cdf->setCountry('US'); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, '%Federal Income%')); $cdf->setUserValue1(10); //Single $cdf->setUserValue2(1); //0 Allowances if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('Advance Earned Income Credit (EIC)'); $cdf->setCalculation(80); $cdf->setCalculationOrder(105); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, '%Advance EIC%')); $cdf->setUserValue1(10); //Single if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('Federal Unemployment Insurance - Employer'); $cdf->setCalculation(15); $cdf->setCalculationOrder(80); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'Fed. Unemployment Ins.')); $cdf->setUserValue1(0.8); //2009 $cdf->setUserValue2(7000); $cdf->setUserValue3(0); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('Social Security - Employee'); $cdf->setCalculation(15); $cdf->setCalculationOrder(80); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'Social Security (FICA)')); $cdf->setUserValue1(6.2); //2009 $cdf->setUserValue2(106800); $cdf->setUserValue3(0); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('Social Security - Employer'); $cdf->setCalculation(10); $cdf->setCalculationOrder(85); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'Social Security%')); $cdf->setUserValue1(100); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'Social Security (FICA)'))); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('Medicare - Employee'); $cdf->setCalculation(10); $cdf->setCalculationOrder(90); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'Medicare')); $cdf->setUserValue1(1.45); //2009 if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('Medicare - Employer'); $cdf->setCalculation(10); $cdf->setCalculationOrder(95); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'Medicare')); $cdf->setUserValue1(100); if ($cdf->isValid()) { $cdf->Save(FALSE); //$cdf->setIncludePayStubEntryAccount( array( $psea_obj->getTotalGross() )); $cdf->setIncludePayStubEntryAccount(array(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'Medicare'))); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'cr': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(TTi18n::gettext('Income Tax')); $cdf->setCalculation(100); $cdf->setCalculationOrder(100); $cdf->setCountry('CR'); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, '%Federal Income%')); $cdf->setUserValue1(10); //Single $cdf->setUserValue2(0); //0 Allowances if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; } $pd_obj = new PayrollDeduction($country, $province); $pd_obj->setDate(time()); Debug::text('Province/State: ' . $province, __FILE__, __LINE__, __METHOD__, 10); switch (strtolower($province)) { //Canada case 'ab': case 'bc': case 'sk': case 'mb': case 'qc': case 'on': case 'nl': case 'nb': case 'ns': case 'pe': case 'nt': case 'yt': case 'nu': $provincial_claim_amount = $pd_obj->getBasicProvinceClaimCodeAmount(); break; //US //US case 'al': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(8000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ak': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance - Employer'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(32700); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance - Employee'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(32700); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ar': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(10000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'az': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(7000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Job Training'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Employee Training')); $cdf->setUserValue1(0.1); //2009 $cdf->setUserValue2(7000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ca': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Disability Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(180); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'State Disability Ins.')); $cdf->setUserValue1(1.1); //2009 $cdf->setUserValue2(90669); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0); //2009 $cdf->setUserValue2(7000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Employee Training'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Employee Training')); $cdf->setUserValue1(0.1); //2009 $cdf->setUserValue2(7000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'co': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(10000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ct': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(15000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'dc': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(9000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'de': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(10500); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'fl': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(7000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ga': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(8500); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'hi': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(13000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ia': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(23700); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'id': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(33200); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'il': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins. - Employer')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(12300); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'in': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(7000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ks': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(8000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ky': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(8000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'la': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(7000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ma': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(14000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'md': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(8500); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'me': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(12000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'mi': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(9000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'mn': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(26000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'mo': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(12500); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ms': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(7000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'mt': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(25100); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'nc': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(19300); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'nd': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(23700); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'nh': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(8000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ne': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(9000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'nj': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(28900); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(28900); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'nm': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(20900); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'nv': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(26600); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ny': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0); //2009 $cdf->setUserValue2(8500); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Reemployment Service Fund'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Reemployment')); $cdf->setUserValue1(0.075); //2009 $cdf->setUserValue2(8500); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Disability Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(180); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'State Disability Ins.')); $cdf->setUserValue1(0.5); //2009 $cdf->setUserValue2(0); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'oh': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(9000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ok': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(14200); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'or': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Insurance')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(31300); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'pa': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(8000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ri': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Employment Security'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(18000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'sc': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(7000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'sd': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(9500); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'tn': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(7000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'tx': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0); //2009 $cdf->setUserValue2(9000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Employee Training'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Employee Training')); $cdf->setUserValue1(0.0); //2006 $cdf->setUserValue2(9000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'ut': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(27800); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'va': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(8000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'vt': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(8000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'wa': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(37500); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'wi': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(12000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'wv': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(8000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; case 'wy': $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Unemployment Insurance'); $cdf->setCalculation(15); $cdf->setCalculationOrder(185); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 30, 'State Unemployment Ins.')); $cdf->setUserValue1(0.0); //2009 $cdf->setUserValue2(21500); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } break; } if ($country == 'CA') { $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName(strtoupper($province) . ' - Provincial Income Tax'); $cdf->setCalculation(200); $cdf->setCalculationOrder(110); $cdf->setCountry('CA'); $cdf->setProvince(strtoupper($province)); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, '%Provincial Income%')); $cdf->setUserValue1($provincial_claim_amount); if ($cdf->isValid()) { $cdf->Save(FALSE); $exclude_ids = array(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, 'Union')); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); $cdf->setExcludePayStubEntryAccount($exclude_ids); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } } elseif ($country = 'US') { $cdf = new CompanyDeductionFactory(); $cdf->setCompany($company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('State Income Tax'); $cdf->setCalculation(200); $cdf->setCalculationOrder(200); $cdf->setCountry('US'); $cdf->setProvince(strtoupper($province)); $cdf->setPayStubEntryAccount(self::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($company_id, 20, '%State Income%')); $cdf->setUserValue1(10); //Single $cdf->setUserValue2(1); //0 Allowances if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($psea_obj->getTotalGross())); unset($exclude_ids); if ($cdf->isValid()) { $cdf->Save(); } } } $cdf->CommitTransaction(); //$cdf->FailTransaction(); return TRUE; }
function createPayStubAccounts() { Debug::text('Saving.... Employee Deduction - Other', __FILE__, __LINE__, __METHOD__, 10); $pseaf = new PayStubEntryAccountFactory(); $pseaf->setCompany($this->company_id); $pseaf->setStatus(10); $pseaf->setType(20); $pseaf->setName('Other'); $pseaf->setOrder(290); if ($pseaf->isValid()) { $pseaf->Save(); } Debug::text('Saving.... Employee Deduction - Other2', __FILE__, __LINE__, __METHOD__, 10); $pseaf = new PayStubEntryAccountFactory(); $pseaf->setCompany($this->company_id); $pseaf->setStatus(10); $pseaf->setType(20); $pseaf->setName('Other2'); $pseaf->setOrder(291); if ($pseaf->isValid()) { $pseaf->Save(); } Debug::text('Saving.... Employee Deduction - EI', __FILE__, __LINE__, __METHOD__, 10); $pseaf = new PayStubEntryAccountFactory(); $pseaf->setCompany($this->company_id); $pseaf->setStatus(10); $pseaf->setType(20); $pseaf->setName('EI'); $pseaf->setOrder(292); if ($pseaf->isValid()) { $pseaf->Save(); } Debug::text('Saving.... Employee Deduction - CPP', __FILE__, __LINE__, __METHOD__, 10); $pseaf = new PayStubEntryAccountFactory(); $pseaf->setCompany($this->company_id); $pseaf->setStatus(10); $pseaf->setType(20); $pseaf->setName('CPP'); $pseaf->setOrder(293); if ($pseaf->isValid()) { $pseaf->Save(); } //Link Account EI and CPP accounts $pseallf = new PayStubEntryAccountLinkListFactory(); $pseallf->getByCompanyId($this->company_id); if ($pseallf->getRecordCount() > 0) { $pseal_obj = $pseallf->getCurrent(); $pseal_obj->setEmployeeEI(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'EI')); $pseal_obj->setEmployeeCPP(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'CPP')); $pseal_obj->Save(); } return TRUE; }
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(); if ($order == NULL) { $order = array('uf.last_name' => 'asc', 'uf.first_name' => 'asc'); $strict = FALSE; } else { //Always sort by last name,first name after other columns if (!isset($order['uf.last_name'])) { $order['uf.last_name'] = 'asc'; } if (!isset($order['uf.first_name'])) { $order['uf.first_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(); $cdf = new CompanyDeductionFactory(); $ph = array('company_id' => $company_id); $query = ' select a.*, uf.first_name as first_name, uf.last_name as last_name, uf.country as country, uf.province as province, cdf.name as name, cdf.status_id as status_id, cdf.type_id as type_id, cdf.calculation_id as calculation_id, 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 from ' . $this->getTable() . ' as a LEFT JOIN ' . $uf->getTable() . ' as uf ON ( a.user_id = uf.id AND uf.deleted = 0 ) LEFT JOIN ' . $cdf->getTable() . ' as cdf ON ( a.company_deduction_id = cdf.id AND cdf.deleted = 0 ) 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 uf.company_id = ? '; $query .= isset($filter_data['permission_children_ids']) ? $this->getWhereClauseSQL('a.user_id', $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; $query .= isset($filter_data['user_id']) ? $this->getWhereClauseSQL('a.user_id', $filter_data['user_id'], 'numeric_list', $ph) : NULL; $query .= isset($filter_data['company_deduction_id']) ? $this->getWhereClauseSQL('a.company_deduction_id', $filter_data['company_deduction_id'], 'numeric_list', $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; /* if ( isset($filter_data['permission_children_ids']) AND isset($filter_data['permission_children_ids'][0]) AND !in_array(-1, (array)$filter_data['permission_children_ids']) ) { $query .= ' AND a.user_id in ('. $this->getListSQL($filter_data['permission_children_ids'], $ph) .') '; } if ( isset($filter_data['id']) AND isset($filter_data['id'][0]) AND !in_array(-1, (array)$filter_data['id']) ) { $query .= ' AND a.id in ('. $this->getListSQL($filter_data['id'], $ph) .') '; } if ( isset($filter_data['exclude_id']) AND isset($filter_data['exclude_id'][0]) AND !in_array(-1, (array)$filter_data['exclude_id']) ) { $query .= ' AND a.id not in ('. $this->getListSQL($filter_data['exclude_id'], $ph) .') '; } if ( isset($filter_data['user_id']) AND isset($filter_data['user_id'][0]) AND !in_array(-1, (array)$filter_data['user_id']) ) { $query .= ' AND a.user_id in ('. $this->getListSQL($filter_data['user_id'], $ph) .') '; } if ( isset($filter_data['company_deduction_id']) AND isset($filter_data['company_deduction_id'][0]) AND !in_array(-1, (array)$filter_data['company_deduction_id']) ) { $query .= ' AND a.company_deduction_id in ('. $this->getListSQL($filter_data['company_deduction_id'], $ph) .') '; } if ( isset($filter_data['created_by']) AND isset($filter_data['created_by'][0]) AND !in_array(-1, (array)$filter_data['created_by']) ) { $query .= ' AND a.created_by in ('. $this->getListSQL($filter_data['created_by'], $ph) .') '; } if ( isset($filter_data['updated_by']) AND isset($filter_data['updated_by'][0]) AND !in_array(-1, (array)$filter_data['updated_by']) ) { $query .= ' AND a.updated_by in ('. $this->getListSQL($filter_data['updated_by'], $ph) .') '; } */ $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; }