tax_table_file = dirname( __FILE__ ) . '/CAPayrollDeductionTest2016.csv'; $this->company_id = PRIMARY_COMPANY_ID; TTDate::setTimeZone( 'Etc/GMT+8' ); //Force to non-DST timezone. 'PST' isnt actually valid. } public function tearDown(): void { Debug::text( 'Running tearDown(): ', __FILE__, __LINE__, __METHOD__, 10 ); } public function mf( $amount ) { return Misc::MoneyRound( $amount ); } // // January 2016 // function testCSVFile() { $this->assertEquals( true, file_exists( $this->tax_table_file ) ); $test_rows = Misc::parseCSV( $this->tax_table_file, true ); $total_rows = ( count( $test_rows ) + 1 ); $i = 2; foreach ( $test_rows as $row ) { //Debug::text('Province: '. $row['province'] .' Income: '. $row['gross_income'], __FILE__, __LINE__, __METHOD__, 10); if ( isset( $row['gross_income'] ) && isset( $row['low_income'] ) && isset( $row['high_income'] ) && $row['gross_income'] == '' && $row['low_income'] != '' && $row['high_income'] != '' ) { $row['gross_income'] = ( $row['low_income'] + ( ( $row['high_income'] - $row['low_income'] ) / 2 ) ); } if ( $row['country'] != '' && $row['gross_income'] != '' ) { //echo $i.'/'.$total_rows.'. Testing Province: '. $row['province'] .' Income: '. $row['gross_income'] ."\n"; $pd_obj = new PayrollDeduction( $row['country'], $row['province'] ); $pd_obj->setDate( strtotime( $row['date'] ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( $row['pay_periods'] ); $pd_obj->setFederalTotalClaimAmount( $row['federal_claim'] ); //Amount from 2005, Should use amount from 2007 automatically. $pd_obj->setProvincialTotalClaimAmount( $row['provincial_claim'] ); //$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( $this->mf( $row['gross_income'] ) ); //var_dump($pd_obj->getArray()); $this->assertEquals( $this->mf( $pd_obj->getGrossPayPeriodIncome() ), $this->mf( $row['gross_income'] ) ); if ( $row['federal_deduction'] != '' ) { $this->assertEquals( $this->mf( $pd_obj->getFederalPayPeriodDeductions() ), $this->mf( $row['federal_deduction'] ) ); } if ( $row['provincial_deduction'] != '' ) { $this->assertEquals( $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ), $this->mf( $row['provincial_deduction'] ) ); } } $i++; } //Make sure all rows are tested. $this->assertEquals( $total_rows, ( $i - 1 ) ); } function testCA_2016a_Example() { Debug::text( 'CA - Example Beginning of 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'AB' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 52 ); $pd_obj->setFederalTotalClaimAmount( 29721.00 ); $pd_obj->setProvincialTotalClaimAmount( 17593 ); $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( 1100 ); $this->assertEquals( '1100.00', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '78.42', $this->mf( $pd_obj->getFederalPayPeriodDeductions() ) ); $this->assertEquals( '67.79', $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ) ); } function testCA_2016a_Example1() { Debug::text( 'CA - Example1 - Beginning of 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'AB' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 12 ); $pd_obj->setFederalTotalClaimAmount( 11327 ); $pd_obj->setProvincialTotalClaimAmount( 18214 ); $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( 1800 ); $this->assertEquals( '1800.00', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '95.79', $this->mf( $pd_obj->getFederalPayPeriodDeductions() ) ); $this->assertEquals( '15.39', $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ) ); } function testCA_2016a_Example2() { Debug::text( 'CA - Example2 - Beginning of 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'AB' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 26 ); $pd_obj->setFederalTotalClaimAmount( 11327 ); $pd_obj->setProvincialTotalClaimAmount( 18214 ); $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( 2300 ); $this->assertEquals( '2300.00', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '282.61', $this->mf( $pd_obj->getFederalPayPeriodDeductions() ) ); $this->assertEquals( '145.58', $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ) ); } function testCA_2016a_Example3() { Debug::text( 'CA - Example3 - Beginning of 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'AB' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 52 ); $pd_obj->setFederalTotalClaimAmount( 11327 ); $pd_obj->setProvincialTotalClaimAmount( 18214 ); $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( 2500 ); $this->assertEquals( '2500.00', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '459.79', $this->mf( $pd_obj->getFederalPayPeriodDeductions() ) ); $this->assertEquals( '209.71', $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ) ); } function testCA_2016a_Example4() { Debug::text( 'CA - Example1 - Beginning of 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'BC' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 26 ); $pd_obj->setFederalTotalClaimAmount( 11038 ); $pd_obj->setProvincialTotalClaimAmount( 9938 ); $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( '1560.00', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '146.12', $this->mf( $pd_obj->getFederalPayPeriodDeductions() ) ); $this->assertEquals( '56.74', $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ) ); } function testCA_2016a_GovExample1() { Debug::text( 'CA - Example1 - Beginning of 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'AB' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 52 ); $pd_obj->setFederalTotalClaimAmount( 11327 ); $pd_obj->setProvincialTotalClaimAmount( 18214 ); $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( 1030 ); //Take Gross income minus RPP and Union Dues. $this->assertEquals( '1030.00', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '116.90', $this->mf( $pd_obj->getFederalPayPeriodDeductions() ) ); $this->assertEquals( '60.92', $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ) ); } function testCA_2016a_GovExample2() { Debug::text( 'CA - Example1 - Beginning of 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'BC' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 52 ); $pd_obj->setFederalTotalClaimAmount( 11327 ); $pd_obj->setProvincialTotalClaimAmount( 9938 ); $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( 1030 ); //Take Gross income minus RPP and Union Dues. $this->assertEquals( '1030.00', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '116.90', $this->mf( $pd_obj->getFederalPayPeriodDeductions() ) ); $this->assertEquals( '46.81', $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ) ); } function testCA_2016a_GovExample3() { Debug::text( 'CA - Example1 - Beginning of 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'ON' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 52 ); $pd_obj->setFederalTotalClaimAmount( 11327 ); $pd_obj->setProvincialTotalClaimAmount( 9863 ); $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( 1030 ); //Take Gross income minus RPP and Union Dues. $this->assertEquals( '1030.00', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '116.90', $this->mf( $pd_obj->getFederalPayPeriodDeductions() ) ); $this->assertEquals( '59.98', $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ) ); } function testCA_2016a_GovExample4() { Debug::text( 'CA - Example1 - Beginning of 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'PE' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 52 ); $pd_obj->setFederalTotalClaimAmount( 11327 ); $pd_obj->setProvincialTotalClaimAmount( 7708 ); $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( 1030 ); //Take Gross income minus RPP and Union Dues. $this->assertEquals( '1030.00', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '116.90', $this->mf( $pd_obj->getFederalPayPeriodDeductions() ) ); $this->assertEquals( '96.55', $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ) ); } // // CPP/ EI // function testCA_2016a_BiWeekly_CPP_LowIncome() { Debug::text( 'CA - BiWeekly - CPP - Beginning of 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'BC' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 26 ); $pd_obj->setFederalTotalClaimAmount( 11038 ); $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( 0 ); $pd_obj->setGrossPayPeriodIncome( 585.32 ); $this->assertEquals( '585.32', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '22.31', $this->mf( $pd_obj->getEmployeeCPP() ) ); $this->assertEquals( '22.31', $this->mf( $pd_obj->getEmployerCPP() ) ); } function testCA_2016a_SemiMonthly_CPP_LowIncome() { Debug::text( 'CA - BiWeekly - CPP - Beginning of 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'BC' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 24 ); $pd_obj->setFederalTotalClaimAmount( 11038 ); $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( 0 ); $pd_obj->setGrossPayPeriodIncome( 585.23 ); $this->assertEquals( '585.23', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '21.75', $this->mf( $pd_obj->getEmployeeCPP() ) ); $this->assertEquals( '21.75', $this->mf( $pd_obj->getEmployerCPP() ) ); } function testCA_2016a_SemiMonthly_MAXCPP_LowIncome() { Debug::text( 'CA - BiWeekly - MAXCPP - Beginning of 2016 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'BC' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 24 ); $pd_obj->setFederalTotalClaimAmount( 11038 ); $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( 2543.30 ); //2544.30 - 1.00 $pd_obj->setYearToDateEIContribution( 0 ); $pd_obj->setGrossPayPeriodIncome( 587.00 ); //var_dump($pd_obj->getArray()); $this->assertEquals( '587.00', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '1.00', $this->mf( $pd_obj->getEmployeeCPP() ) ); $this->assertEquals( '1.00', $this->mf( $pd_obj->getEmployerCPP() ) ); } function testCA_2016a_EI_LowIncome() { Debug::text( 'CA - EI - Beginning of 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'BC' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 26 ); $pd_obj->setFederalTotalClaimAmount( 11038 ); $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( 0 ); $pd_obj->setGrossPayPeriodIncome( 587.76 ); //var_dump($pd_obj->getArray()); $this->assertEquals( '587.76', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '11.05', $this->mf( $pd_obj->getEmployeeEI() ) ); $this->assertEquals( '15.47', $this->mf( $pd_obj->getEmployerEI() ) ); } function testCA_2016a_MAXEI_LowIncome() { Debug::text( 'CA - MAXEI - Beginning of 2006 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'BC' ); $pd_obj->setDate( strtotime( '01-Jan-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 26 ); $pd_obj->setFederalTotalClaimAmount( 11038 ); $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( 954.04 ); //955.04 - 1.00 $pd_obj->setGrossPayPeriodIncome( 587.00 ); //var_dump($pd_obj->getArray()); $this->assertEquals( '587.00', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '1.00', $this->mf( $pd_obj->getEmployeeEI() ) ); $this->assertEquals( '1.40', $this->mf( $pd_obj->getEmployerEI() ) ); } function testCA_2016a_MAXEI_MAXCPPa() { Debug::text( 'CA - MAXEI/MAXCPP - Beginning of 2006 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'BC' ); $pd_obj->setDate( strtotime( '10-Nov-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 26 ); $pd_obj->setFederalTotalClaimAmount( 11474 ); $pd_obj->setProvincialTotalClaimAmount( 10027 ); $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 ); //2544.30 - 1.00 $pd_obj->setYearToDateEIContribution( 0 ); //955.04 - 1.00 $pd_obj->setGrossPayPeriodIncome( 2569.21 ); //var_dump($pd_obj->getArray()); $this->assertEquals( '2569.21', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '120.51', $this->mf( $pd_obj->getEmployeeCPP() ) ); $this->assertEquals( '120.51', $this->mf( $pd_obj->getEmployerCPP() ) ); $this->assertEquals( '48.30', $this->mf( $pd_obj->getEmployeeEI() ) ); $this->assertEquals( '67.62', $this->mf( $pd_obj->getEmployerEI() ) ); $this->assertEquals( '337.80', $this->mf( $pd_obj->getFederalPayPeriodDeductions() ) ); $this->assertEquals( '132.70', $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ) ); } function testCA_2016a_MAXEI_MAXCPPb() { Debug::text( 'CA - MAXEI/MAXCPP - Beginning of 2006 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'BC' ); $pd_obj->setDate( strtotime( '10-Nov-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 26 ); $pd_obj->setFederalTotalClaimAmount( 11474 ); $pd_obj->setProvincialTotalClaimAmount( 10027 ); $pd_obj->setWCBRate( 0.18 ); $pd_obj->setEIExempt( false ); $pd_obj->setCPPExempt( false ); $pd_obj->setFederalTaxExempt( false ); $pd_obj->setProvincialTaxExempt( false ); $pd_obj->setYearToDateCPPContribution( 2524.30 ); //2544.30 - 20.00 $pd_obj->setYearToDateEIContribution( 935.04 ); //955.04 - 20.00 $pd_obj->setGrossPayPeriodIncome( 2569.21 ); //var_dump($pd_obj->getArray()); $this->assertEquals( '2569.21', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '20.00', $this->mf( $pd_obj->getEmployeeCPP() ) ); $this->assertEquals( '20.00', $this->mf( $pd_obj->getEmployerCPP() ) ); $this->assertEquals( '20.00', $this->mf( $pd_obj->getEmployeeEI() ) ); $this->assertEquals( '28.00', $this->mf( $pd_obj->getEmployerEI() ) ); $this->assertEquals( '337.80', $this->mf( $pd_obj->getFederalPayPeriodDeductions() ) ); $this->assertEquals( '132.70', $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ) ); } function testCA_2016a_MAXEI_MAXCPPc() { Debug::text( 'CA - MAXEI/MAXCPP - Beginning of 2006 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'BC' ); $pd_obj->setDate( strtotime( '10-Nov-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 26 ); $pd_obj->setFederalTotalClaimAmount( 11474 ); $pd_obj->setProvincialTotalClaimAmount( 10027 ); $pd_obj->setWCBRate( 0.18 ); $pd_obj->setEIExempt( false ); $pd_obj->setCPPExempt( false ); $pd_obj->setFederalTaxExempt( false ); $pd_obj->setProvincialTaxExempt( false ); $pd_obj->setYearToDateCPPContribution( 2543.30 ); //2544.30 - 1.00 $pd_obj->setYearToDateEIContribution( 954.04 ); //955.04 - 1.00 $pd_obj->setGrossPayPeriodIncome( 2569.21 ); //var_dump($pd_obj->getArray()); $this->assertEquals( '2569.21', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '1.00', $this->mf( $pd_obj->getEmployeeCPP() ) ); $this->assertEquals( '1.00', $this->mf( $pd_obj->getEmployerCPP() ) ); $this->assertEquals( '1.00', $this->mf( $pd_obj->getEmployeeEI() ) ); $this->assertEquals( '1.40', $this->mf( $pd_obj->getEmployerEI() ) ); $this->assertEquals( '337.80', $this->mf( $pd_obj->getFederalPayPeriodDeductions() ) ); $this->assertEquals( '132.70', $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ) ); } function testCA_2016a_MAXEI_MAXCPPd() { Debug::text( 'CA - MAXEI/MAXCPP - Beginning of 2006 01-Jan-2016: ', __FILE__, __LINE__, __METHOD__, 10 ); $pd_obj = new PayrollDeduction( 'CA', 'BC' ); $pd_obj->setDate( strtotime( '10-Nov-2016' ) ); $pd_obj->setEnableCPPAndEIDeduction( true ); //Deduct CPP/EI. $pd_obj->setAnnualPayPeriods( 26 ); $pd_obj->setFederalTotalClaimAmount( 11474 ); $pd_obj->setProvincialTotalClaimAmount( 10027 ); $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( 1900.00 ); //Less than EI/CPP maximum earnings for the year. //var_dump($pd_obj->getArray()); $this->assertEquals( '1900.00', $this->mf( $pd_obj->getGrossPayPeriodIncome() ) ); $this->assertEquals( '87.39', $this->mf( $pd_obj->getEmployeeCPP() ) ); $this->assertEquals( '87.39', $this->mf( $pd_obj->getEmployerCPP() ) ); $this->assertEquals( '35.72', $this->mf( $pd_obj->getEmployeeEI() ) ); $this->assertEquals( '50.01', $this->mf( $pd_obj->getEmployerEI() ) ); $this->assertEquals( '202.33', $this->mf( $pd_obj->getFederalPayPeriodDeductions() ) ); $this->assertEquals( '81.75', $this->mf( $pd_obj->getProvincialPayPeriodDeductions() ) ); } } ?>