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; }
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'])) { $cdf->setCountry($data['country']); } if (isset($data['province'])) { $cdf->setProvince($data['province']); } else { $cdf->setProvince(NULL); }