$cdf->setUserValue1($data['user_value1']); } if (isset($data['user_value2'])) { $cdf->setUserValue2($data['user_value2']); } if (isset($data['user_value3'])) { $cdf->setUserValue3($data['user_value3']); } if (isset($data['user_value4'])) { $cdf->setUserValue4($data['user_value4']); } if (isset($data['user_value5'])) { $cdf->setUserValue5($data['user_value5']); } if (isset($data['user_value6'])) { $cdf->setUserValue6($data['user_value6']); } if (isset($data['user_value7'])) { $cdf->setUserValue7($data['user_value7']); } if (isset($data['user_value8'])) { $cdf->setUserValue8($data['user_value8']); } if (isset($data['user_value9'])) { $cdf->setUserValue9($data['user_value9']); } if (isset($data['user_value10'])) { $cdf->setUserValue10($data['user_value10']); } if (isset($data['start_date'])) { $cdf->setStartDate($data['start_date']);
function createCompanyDeductions() { //Test Wage Base amount $cdf = new CompanyDeductionFactory(); $cdf->setCompany($this->company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('Union Dues'); $cdf->setCalculation(15); $cdf->setCalculationOrder(90); $cdf->setPayStubEntryAccount(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Union Dues')); $cdf->setUserValue1(1); //10% $cdf->setUserValue2(3000); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($this->pay_stub_account_link_arr['total_gross'])); if ($cdf->isValid()) { $cdf->Save(); } } //Test Wage Exempt Amount $cdf = new CompanyDeductionFactory(); $cdf->setCompany($this->company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('Union Dues2'); $cdf->setCalculation(15); $cdf->setCalculationOrder(90); $cdf->setPayStubEntryAccount(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Other')); $cdf->setUserValue1(10); //10% //$cdf->setUserValue2( 0 ); $cdf->setUserValue3(78000); //Annual if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($this->pay_stub_account_link_arr['total_gross'])); if ($cdf->isValid()) { $cdf->Save(); } } //Test Advanced Percent Calculation maximum amount. $cdf = new CompanyDeductionFactory(); $cdf->setCompany($this->company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('Test Advanced Percent 1'); $cdf->setCalculation(15); $cdf->setCalculationOrder(90); $cdf->setPayStubEntryAccount(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Advanced Percent 1')); $cdf->setUserValue1(1); //1% $cdf->setUserValue2(2000); //Wage Base if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($this->pay_stub_account_link_arr['regular_time'])); if ($cdf->isValid()) { $cdf->Save(); } } //Test Advanced Percent Calculation maximum amount. $cdf = new CompanyDeductionFactory(); $cdf->setCompany($this->company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('Test Advanced Percent 2'); $cdf->setCalculation(15); $cdf->setCalculationOrder(90); $cdf->setPayStubEntryAccount(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Advanced Percent 2')); $cdf->setUserValue1(1); //1% $cdf->setUserValue2(2500); //Wage Base if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($this->pay_stub_account_link_arr['regular_time'])); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($this->company_id); $cdf->setStatus(10); $cdf->setType(30); $cdf->setName('Test Custom Formula'); $cdf->setCalculation(69); $cdf->setCalculationOrder(80); $cdf->setPayStubEntryAccount(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Other2')); $cdf->setCompanyValue1("(#custom_value1#+#custom_value2#+#custom_value3#+#custom_value4#+#custom_value5#+#custom_value6#+#custom_value7#+#custom_value8#+#custom_value9#+#custom_value10#)/100"); $cdf->setUserValue1(10); $cdf->setUserValue2(20); $cdf->setUserValue3(30); $cdf->setUserValue4(40); $cdf->setUserValue5(50); $cdf->setUserValue6(60); $cdf->setUserValue7(70); $cdf->setUserValue8(80); $cdf->setUserValue9(90); $cdf->setUserValue10(100); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($this->pay_stub_account_link_arr['total_deductions'])); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($this->company_id); $cdf->setStatus(10); $cdf->setType(20); $cdf->setName('Test Custom Formula 1'); $cdf->setCalculation(69); $cdf->setCalculationOrder(80); $cdf->setPayStubEntryAccount(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Custom1')); $cdf->setCompanyValue1("(#custom_value1#*((#custom_value2#+#custom_value3#)*#custom_value4#/#custom_value5#)+#custom_value6#/(#custom_value7#+#custom_value8#)+#custom_value9#+#custom_value10#)/100"); $cdf->setUserValue1(45); $cdf->setUserValue2(20); $cdf->setUserValue3(30); $cdf->setUserValue4(40); $cdf->setUserValue5(78.12); $cdf->setUserValue6(60); $cdf->setUserValue7(44.34); $cdf->setUserValue8(33); $cdf->setUserValue9(90); $cdf->setUserValue10(8); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($this->pay_stub_account_link_arr['total_deductions'])); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($this->company_id); $cdf->setStatus(10); $cdf->setType(20); $cdf->setName('Test Custom Formula 2'); $cdf->setCalculation(69); $cdf->setCalculationOrder(80); $cdf->setPayStubEntryAccount(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'Custom2')); $cdf->setCompanyValue1("values(n) = (#custom_value1#+#custom_value2#+#custom_value3#+#custom_value4#+#custom_value5#+#custom_value6#+#custom_value7#+#custom_value8#+#custom_value9#+#custom_value10#)/n\n include_amounts(n)=(#include_pay_stub_amount#+#include_pay_stub_ytd_amount#)/n\n exclude_amounts(n)=(#exclude_pay_stub_amount#+#exclude_pay_stub_ytd_amount#)/n\n (values(2)+include_amounts(3)+exclude_amounts(4)+#employee_hourly_rate#)/100"); $cdf->setUserValue1(0.23); $cdf->setUserValue2(1114.65); $cdf->setUserValue3(30); $cdf->setUserValue4(40.55); $cdf->setUserValue5(55.55); $cdf->setUserValue6(32.33); $cdf->setUserValue7(44.34); $cdf->setUserValue8(21); $cdf->setUserValue9(47); $cdf->setUserValue10(8); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($this->pay_stub_account_link_arr['regular_time'], $this->pay_stub_account_link_arr['vacation_accrual'], $this->pay_stub_account_link_arr['advanced_percent_1'], $this->pay_stub_account_link_arr['cpp'], $this->pay_stub_account_link_arr['ei'])); $cdf->setExcludePayStubEntryAccount(array($this->pay_stub_account_link_arr['total_gross'])); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($this->company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('EI - Employee'); $cdf->setCalculation(91); //EI Formula $cdf->setCalculationOrder(90); $cdf->setPayStubEntryAccount(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'EI')); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($this->pay_stub_account_link_arr['total_gross'])); if ($cdf->isValid()) { $cdf->Save(); } } $cdf = new CompanyDeductionFactory(); $cdf->setCompany($this->company_id); $cdf->setStatus(10); //Enabled $cdf->setType(10); //Tax $cdf->setName('CPP - Employee'); $cdf->setCalculation(90); //CPP Formula $cdf->setCalculationOrder(91); $cdf->setPayStubEntryAccount(CompanyDeductionFactory::getPayStubEntryAccountByCompanyIDAndTypeAndFuzzyName($this->company_id, 20, 'CPP')); if ($cdf->isValid()) { $cdf->Save(FALSE); $cdf->setIncludePayStubEntryAccount(array($this->pay_stub_account_link_arr['total_gross'])); if ($cdf->isValid()) { $cdf->Save(); } } return TRUE; }