function testCA_2006a_MAXEI_LowIncome()
 {
     Debug::text('CA - MAXEI - Beginning of 2006 01-Jan-06: ', __FILE__, __LINE__, __METHOD__, 10);
     $pd_obj = new PayrollDeduction('CA', 'BC');
     $pd_obj->setDate(strtotime('01-Jan-06'));
     $pd_obj->setEnableCPPAndEIDeduction(TRUE);
     //Deduct CPP/EI.
     $pd_obj->setAnnualPayPeriods(26);
     $pd_obj->setFederalTotalClaimAmount(9039);
     $pd_obj->setProvincialTotalClaimAmount(0);
     $pd_obj->setWCBRate(0.18);
     $pd_obj->setEIExempt(FALSE);
     $pd_obj->setCPPExempt(FALSE);
     $pd_obj->setFederalTaxExempt(FALSE);
     $pd_obj->setProvincialTaxExempt(FALSE);
     $pd_obj->setYearToDateCPPContribution(0);
     $pd_obj->setYearToDateEIContribution(728.3);
     //729.30 - 1.00
     $pd_obj->setGrossPayPeriodIncome(587.0);
     //var_dump($pd_obj->getArray());
     $this->assertEquals($this->mf($pd_obj->getGrossPayPeriodIncome()), '587.00');
     $this->assertEquals($this->mf($pd_obj->getEmployeeEI()), '1.00');
     $this->assertEquals($this->mf($pd_obj->getEmployerEI()), '1.40');
 }
             }
         }
         foreach ($test_data[$country][$province_code]['provincial_claim'] as $provincial_claim) {
             foreach ($test_data[$country][$province_code]['federal_claim'] as $federal_claim) {
                 foreach ($test_data[$country][$province_code]['income'] as $income) {
                     $pd_obj = new PayrollDeduction($country, $province_code);
                     $pd_obj->setDate($effective_date);
                     $pd_obj->setAnnualPayPeriods($pay_periods);
                     $pd_obj->setEnableCPPAndEIDeduction(TRUE);
                     //Deduct CPP/EI.
                     $pd_obj->setFederalTotalClaimAmount($federal_claim);
                     $pd_obj->setProvincialTotalClaimAmount($provincial_claim);
                     $pd_obj->setEIExempt(FALSE);
                     $pd_obj->setCPPExempt(FALSE);
                     $pd_obj->setFederalTaxExempt(FALSE);
                     $pd_obj->setProvincialTaxExempt(FALSE);
                     $pd_obj->setYearToDateCPPContribution(0);
                     $pd_obj->setYearToDateEIContribution(0);
                     $pd_obj->setGrossPayPeriodIncome($income);
                     $retarr[] = array('country' => $country, 'province' => $province_code, 'date' => date('m/d/y', $effective_date), 'pay_periods' => $pay_periods, 'federal_claim' => $pd_obj->getFederalTotalClaimAmount(), 'provincial_claim' => $pd_obj->getProvincialTotalClaimAmount(), 'gross_income' => $income, 'federal_deduction' => Misc::MoneyFormat($pd_obj->getFederalPayPeriodDeductions(), FALSE), 'provincial_deduction' => Misc::MoneyFormat($pd_obj->getProvincialPayPeriodDeductions(), FALSE));
                 }
             }
         }
     }
 }
 //generate column array.
 $column_keys = array_keys($retarr[0]);
 foreach ($column_keys as $column_key) {
     $columns[$column_key] = $column_key;
 }
 //var_dump($test_data);
 function testCA_2013a_Example4()
 {
     Debug::text('CA - Example1 - Beginning of 01-Jan-2013: ', __FILE__, __LINE__, __METHOD__, 10);
     $pd_obj = new PayrollDeduction('CA', 'BC');
     $pd_obj->setDate(strtotime('01-Jan-2013'));
     $pd_obj->setEnableCPPAndEIDeduction(TRUE);
     //Deduct CPP/EI.
     $pd_obj->setAnnualPayPeriods(26);
     $pd_obj->setFederalTotalClaimAmount(11038);
     $pd_obj->setProvincialTotalClaimAmount(10276);
     $pd_obj->setWCBRate(0);
     $pd_obj->setEIExempt(FALSE);
     $pd_obj->setCPPExempt(FALSE);
     $pd_obj->setFederalTaxExempt(FALSE);
     $pd_obj->setProvincialTaxExempt(FALSE);
     $pd_obj->setYearToDateCPPContribution(0);
     $pd_obj->setYearToDateEIContribution(0);
     $pd_obj->setGrossPayPeriodIncome(1560);
     $this->assertEquals($this->mf($pd_obj->getGrossPayPeriodIncome()), '1560');
     $this->assertEquals($this->mf($pd_obj->getFederalPayPeriodDeductions()), '148.89');
     $this->assertEquals($this->mf($pd_obj->getProvincialPayPeriodDeductions()), '56.91');
 }
 function testMD_2011b_BiWeekly_Married_HighIncome()
 {
     Debug::text('US - BiWeekly - Beginning of 2011 01-Jan-2011: ', __FILE__, __LINE__, __METHOD__, 10);
     $pd_obj = new PayrollDeduction('US', 'MD', 'ALL');
     $pd_obj->setDate(strtotime('01-Jan-2011'));
     $pd_obj->setAnnualPayPeriods(26);
     //Bi-Weekly
     $pd_obj->setFederalFilingStatus(20);
     //Single
     $pd_obj->setFederalAllowance(2);
     $pd_obj->setStateFilingStatus(20);
     //Single
     $pd_obj->setStateAllowance(2);
     $pd_obj->setUserValue3(3.2);
     //County Rate
     $pd_obj->setFederalTaxExempt(FALSE);
     $pd_obj->setProvincialTaxExempt(FALSE);
     $pd_obj->setGrossPayPeriodIncome(5000.0);
     $this->assertEquals($this->mf($pd_obj->getGrossPayPeriodIncome()), '5000.00');
     $this->assertEquals($this->mf($pd_obj->getFederalPayPeriodDeductions()), '804.81');
     $this->assertEquals($this->mf($pd_obj->getStatePayPeriodDeductions()), '371.82');
 }
 function testUS_2013a_FederalUI_State_Max()
 {
     Debug::text('US - SemiMonthly - Beginning of 2013 01-Jan-2013: ', __FILE__, __LINE__, __METHOD__, 10);
     $pd_obj = new PayrollDeduction('US', 'MO');
     $pd_obj->setDate(strtotime('01-Jan-2013'));
     $pd_obj->setAnnualPayPeriods(24);
     //Semi-Monthly
     $pd_obj->setFederalFilingStatus(10);
     //Single
     $pd_obj->setFederalAllowance(0);
     $pd_obj->setStateUIRate(3.51);
     $pd_obj->setStateUIWageBase(11000);
     $pd_obj->setYearToDateSocialSecurityContribution(0);
     $pd_obj->setYearToDateFederalUIContribution(173.3);
     //174.30
     $pd_obj->setYearToDateStateUIContribution(0);
     $pd_obj->setFederalTaxExempt(FALSE);
     $pd_obj->setProvincialTaxExempt(FALSE);
     $pd_obj->setGrossPayPeriodIncome(1000.0);
     //var_dump($pd_obj->getArray());
     $this->assertEquals($this->mf($pd_obj->getGrossPayPeriodIncome()), '1000.00');
     $this->assertEquals($this->mf($pd_obj->getFederalEmployerUI()), '1.00');
 }
 function testDC_2006a_SemiMonthly_Married_HighIncome_8Allowances()
 {
     Debug::text('US - SemiMonthly - Beginning of 2006 01-Jan-06: ', __FILE__, __LINE__, __METHOD__, 10);
     $pd_obj = new PayrollDeduction('US', 'DC');
     $pd_obj->setDate(strtotime('01-Jan-06'));
     $pd_obj->setAnnualPayPeriods(24);
     //Semi-Monthly
     $pd_obj->setFederalFilingStatus(10);
     //Single
     $pd_obj->setFederalAllowance(1);
     $pd_obj->setStateFilingStatus(30);
     //Married - Separately
     $pd_obj->setStateAllowance(8);
     $pd_obj->setFederalTaxExempt(FALSE);
     $pd_obj->setProvincialTaxExempt(FALSE);
     $pd_obj->setGrossPayPeriodIncome(4000.0);
     //var_dump($pd_obj->getArray());
     $this->assertEquals($this->mf($pd_obj->getGrossPayPeriodIncome()), '4000.00');
     $this->assertEquals($this->mf($pd_obj->getFederalPayPeriodDeductions()), '823.73');
     //823.73
     $this->assertEquals($this->mf($pd_obj->getStatePayPeriodDeductions()), '263.41');
     //263.41
 }
 function testON_2007a_SemiMonthly_Claim1_MedIncome()
 {
     Debug::text('ON - SemiMonthly - Beginning of 2007 01-Jan-07: ', __FILE__, __LINE__, __METHOD__, 10);
     $pd_obj = new PayrollDeduction('CA', 'ON');
     //$pd_obj = new PayrollDeduction();
     //$pd_obj->setCountry('CA');
     //$pd_obj->setProvince('BC');
     $pd_obj->setDate(strtotime('01-Jan-07'));
     $pd_obj->setEnableCPPAndEIDeduction(TRUE);
     //Deduct CPP/EI.
     $pd_obj->setAnnualPayPeriods(24);
     $pd_obj->setFederalTotalClaimAmount(8929);
     $pd_obj->setProvincialTotalClaimAmount(8553);
     $pd_obj->setWCBRate(0.18);
     $pd_obj->setEIExempt(FALSE);
     $pd_obj->setCPPExempt(FALSE);
     $pd_obj->setFederalTaxExempt(FALSE);
     $pd_obj->setProvincialTaxExempt(FALSE);
     $pd_obj->setYearToDateCPPContribution(0);
     $pd_obj->setYearToDateEIContribution(0);
     $pd_obj->setGrossPayPeriodIncome(2830.0);
     $this->assertEquals($this->mf($pd_obj->getGrossPayPeriodIncome()), '2830.00');
     Debug::text('Prov Ded: ' . $pd_obj->getProvincialPayPeriodDeductions(), __FILE__, __LINE__, __METHOD__, 10);
     $this->assertEquals($this->mf($pd_obj->getProvincialPayPeriodDeductions()), '212.50');
     //214.00
 }
 function testVT_2007a_SemiMonthly_Married_HighIncome_8Allowances()
 {
     Debug::text('US - SemiMonthly - Beginning of 2007 01-Jan-07: ', __FILE__, __LINE__, __METHOD__, 10);
     $pd_obj = new PayrollDeduction('US', 'VT');
     $pd_obj->setDate(strtotime('01-Jan-07'));
     $pd_obj->setAnnualPayPeriods(24);
     //Semi-Monthly
     $pd_obj->setFederalFilingStatus(10);
     //Single
     $pd_obj->setFederalAllowance(1);
     $pd_obj->setStateFilingStatus(20);
     //Married
     $pd_obj->setStateAllowance(8);
     $pd_obj->setFederalTaxExempt(FALSE);
     $pd_obj->setProvincialTaxExempt(FALSE);
     $pd_obj->setGrossPayPeriodIncome(4000.0);
     //var_dump($pd_obj->getArray());
     $this->assertEquals($this->mf($pd_obj->getGrossPayPeriodIncome()), '4000.00');
     $this->assertEquals($this->mf($pd_obj->getFederalPayPeriodDeductions()), '812.20');
     //812.20
     $this->assertEquals($this->mf($pd_obj->getStatePayPeriodDeductions()), '106.05');
     //106.05
 }
 function testAL_2007a_SemiMonthly_Married_HighIncome_2Allowances()
 {
     Debug::text('US - SemiMonthly - Beginning of 2007 01-Jan-07: ', __FILE__, __LINE__, __METHOD__, 10);
     $pd_obj = new PayrollDeduction('US', 'AL');
     $pd_obj->setDate(strtotime('01-Jan-07'));
     $pd_obj->setAnnualPayPeriods(52);
     //Weekly
     $pd_obj->setFederalFilingStatus(20);
     //Married
     $pd_obj->setFederalAllowance(2);
     $pd_obj->setStateFilingStatus(20);
     //Married
     $pd_obj->setUserValue2(2);
     $pd_obj->setFederalTaxExempt(FALSE);
     $pd_obj->setProvincialTaxExempt(FALSE);
     $pd_obj->setGrossPayPeriodIncome(435.0);
     $this->assertEquals($this->mf($pd_obj->getGrossPayPeriodIncome()), '435.00');
     $this->assertEquals($this->mf($pd_obj->getFederalPayPeriodDeductions()), '15.04');
     //15.04
     $this->assertEquals($this->mf($pd_obj->getStatePayPeriodDeductions()), '9.41');
     //9.41
 }
 function testPE_2008a_SemiMonthly_Claim1_MedIncome()
 {
     Debug::text('PE - SemiMonthly - Beginning of 2008 01-Jan-08: ', __FILE__, __LINE__, __METHOD__, 10);
     $pd_obj = new PayrollDeduction('CA', 'PE');
     $pd_obj->setDate(strtotime('01-Jan-08'));
     $pd_obj->setEnableCPPAndEIDeduction(TRUE);
     //Deduct CPP/EI.
     $pd_obj->setAnnualPayPeriods(24);
     $pd_obj->setFederalTotalClaimAmount(9600);
     $pd_obj->setProvincialTotalClaimAmount(7708);
     $pd_obj->setWCBRate(0.18);
     $pd_obj->setEIExempt(FALSE);
     $pd_obj->setCPPExempt(FALSE);
     $pd_obj->setFederalTaxExempt(FALSE);
     $pd_obj->setProvincialTaxExempt(FALSE);
     $pd_obj->setYearToDateCPPContribution(0);
     $pd_obj->setYearToDateEIContribution(0);
     $pd_obj->setGrossPayPeriodIncome(2763.0);
     $this->assertEquals($this->mf($pd_obj->getGrossPayPeriodIncome()), '2763.00');
     Debug::text('Prov Ded: ' . $pd_obj->getProvincialPayPeriodDeductions(), __FILE__, __LINE__, __METHOD__, 10);
     $this->assertEquals($this->mf($pd_obj->getProvincialPayPeriodDeductions()), '288.09');
     //285.90
 }