::if {$::qw::control(has_tk)} { itcl::class ::QW::NV2::PAYROLL::PROCESS::CANADA { inherit ::QW::NV2::PAYROLL::PROCESS; protected variable _annualBasicFederalTax ""; protected variable _cpp_pensionable_earnings 0.0; protected variable _cppExm 0; ;#// CPP yearly exemption amount protected variable _cppMax 0; ;#// CPP maximum deduction protected variable _cppBase 0; ;#// CPP enhancement maximum credit (about 83% of CPP deduction) protected variable _cppMaxPE 0; ;#// CPP maximum pensionable earnings protected variable _cppRate 0; ;#// CPP rate protected variable _employee_cpp_deduction ""; protected variable _employee_cpp_deduction_period ""; protected variable _employer_cpp_contribution 0.0; protected variable _employerCppRate 0; protected variable _cpp2_pensionable_earnings 0.0; protected variable _cpp2Max 0; ;#// CPP2 maximum deduction protected variable _cpp2MaxPE 0; ;#// CPP2 maximum pensionable earnings protected variable _cpp2Rate 0; ;#// CPP2 rate protected variable _employee_cpp2_deduction ""; protected variable _employee_cpp2_deduction_period ""; protected variable _employer_cpp2_contribution 0.0; protected variable _employerCpp2Rate 0; protected variable _eEiRate 0; ;#// Employer EI Contribution Rate protected variable _ei_insurable_earnings 0.0; protected variable _ei_insurable_hours 0.0; protected variable _eiMax 0; ;#// EI maximum deduction protected variable _eiMaxIE 0; ;#// EI maximum earnings protected variable _eiRate 0; ;#// EI rate protected variable _employee_ei_deduction ""; protected variable _employee_ei_deduction_period ""; protected variable _employer_ei_contribution 0.0; protected variable _employerEiRate 0; protected variable _ppip_insurable_earnings 0.0; protected variable _ppipMax 0; ;#// PPIP maximum deduction protected variable _ppipMaxIE 0; ;#// PPIP maximum earnings protected variable _ppipRate 0; ;#// PPIP rate protected variable _quebec_bonus_threshold 11650; ;#// Threshold to determine tax calc for bonuses protected variable _employee_ppip_deduction ""; protected variable _employee_ppip_deduction_period ""; protected variable _employer_ppip_contribution 0.0; protected variable _employerPpipRate 0; protected variable _employer_hsf_contribution 0.0; protected variable _employer_hsf_rate 0; ::if {$::qw::control(payroll_wcb)} {} protected variable _employer_wcb_contribution 0.0; protected variable _employer_wcb_rate 0.0; protected variable _hsf_earnings 0.0; protected variable _hsf_earnings_payrun 0.0; protected variable _wcb_earnings 0.0; protected variable _fedTax 0; ;#// Annual Federal tax deduction protected variable _fedTaxPP 0; ;#// Pay-Period Federal tax deduction protected variable _incTax ""; ;#// Earnings read from notes of TAX acct protected variable _minimum_wage 0.0; protected variable _pClaim ""; ;#// Prov Claim amount protected variable _province_of_employment; protected variable _provTax 0; ;#// Annual Provincial tax deduction protected variable _provTaxPP 0; ;#// Pay-Period Provincial tax deduction protected variable _rppMax 0; ;#// Maximum RPP deduction protected variable _rrspMax 0; ;#// Maximum RRSP deduction protected variable _federalTableVersion ""; ;#// Suffix appended to federal tax table method name. e.g. 20040101 protected variable _provincialTableVersion ""; ;#// Suffix appended to provincial tax table method name. e.g. 20040101 protected variable _tax 0; ;#// Tax amount protected variable _td1_fed_basic_claim ""; protected variable _td1_federal_claim_amount ""; protected variable _td1_prov_basic_claim ""; protected variable _WCBMaxAE 0; ;#// WCB Maximum Assessable Earnings constructor {args} { ::set _toplevel_title "Canadian Payroll Preview"; ::eval ::QW::NV2::PAYROLL::PROCESS::constructor $args; } { ::set _payrollCountry "CANADA"; ::set _chequeWord "check"; ::set _tablesStartDate "20130101"; ::set _tablesEndDate "20231231"; ::set _version_country "20230101"; ::set _tablesStartDate "20130101"; ::set _tablesEndDate "20241231"; ::set _version_country "20240101"; ::set _tablesStartDate "20130101"; ::set _tablesEndDate "20250630"; ::set _version_country "20250101"; ::set _tablesStartDate "20130101"; ::set _tablesEndDate "20251231"; ::set _version_country "20250701"; ::set _patch_level_country "0"; ::return $this; } public method destructor {} { ::return ""; } public method version_information_other {} { ::set List "" ::lappend List { .name "Name" .revision "Revision" .description "Description" .effective_date "Effective" } ::lappend List { .name "T4127(E)" .revision "13" .description "Payroll Deductions Formulas for Computer Programs - 96th Edition" .effective_date "01 Jan 2013" } ::lappend List { .name "T4127JUL(E)" .revision "13" .description "Payroll Deductions Formulas for Computer Programs - 97th Edition" .effective_date "01 Jul 2013" } ::lappend List { .name "T4127(E)" .revision "14" .description "Payroll Deductions Formulas for Computer Programs - 98th Edition" .effective_date "01 Jan 2014" } ::lappend List { .name "T4127SEP(E)" .revision "14" .description "Payroll Deductions Formulas for Computer Programs - 99th Edition" .effective_date "01 Sep 2014" } ::lappend List { .name "T4127(E)" .revision "15" .description "Payroll Deductions Formulas for Computer Programs - 100th Edition" .effective_date "01 Jan 2015" } ::lappend List { .name "T4127JUL(E)" .revision "15" .description "Payroll Deductions Formulas for Computer Programs - 100th Edition" .effective_date "01 Jul 2015" } ::lappend List { .name "T4127OCT(E)" .revision "15" .description "Payroll Deductions Formulas for Computer Programs - 100th Edition" .effective_date "01 Oct 2015" } ::lappend List { .name "T4127(E)" .revision "16" .description "Payroll Deductions Formulas for Computer Programs - 103rd Edition" .effective_date "01 Jan 2016" } ::lappend List { .name "T4127JUL(E)" .revision "16" .description "Payroll Deductions Formulas for Computer Programs - 104th Edition" .effective_date "01 Jul 2016" } ::lappend List { .name "T4127(E)" .revision "17" .description "Payroll Deductions Formulas for Computer Programs - 105th Edition" .effective_date "01 Jan 2017" } ::lappend List { .name "T4127JUL(E)" .revision "17" .description "Payroll Deductions Formulas for Computer Programs - 106th Edition" .effective_date "01 Jul 2017" } ::lappend List { .name "T4127(E)" .revision "18" .description "Payroll Deductions Formulas - 107th Edition" .effective_date "01 Jan 2018" } ::lappend List { .name "T4127JUL(E)" .revision "18" .description "Payroll Deductions Formulas - 108th Edition" .effective_date "01 Jul 2018" } ::lappend List { .name "T4127(E)" .revision "19" .description "Payroll Deductions Formulas - 109th Edition" .effective_date "01 Jan 2019" } ::lappend List { .name "T4127(E)" .revision "20/01" .description "Payroll Deductions Formulas - 110th Edition" .effective_date "01 Jan 2020" } ::lappend List { .name "T4127(E)" .revision "20/01" .description "Payroll Deductions Formulas - 111th Edition" .effective_date "01 Jan 2020" } ::lappend List { .name "T4127(E)" .revision "20/07" .description "Payroll Deductions Formulas - 112th Edition" .effective_date "01 Jul 2020" } ::lappend List { .name "T4127(E)" .revision "21/01" .description "Payroll Deductions Formulas - 113th Edition" .effective_date "01 Jan 2021" } ::lappend List { .name "T4127(E)" .revision "21/07" .description "Payroll Deductions Formulas - 114th Edition" .effective_date "01 Jul 2021" } ::lappend List { .name "T4127(E)" .revision "22/01" .description "Payroll Deductions Formulas - 115th Edition" .effective_date "01 Jan 2022" } ::lappend List { .name "T4127(E)" .revision "22/07" .description "Payroll Deductions Formulas - 116th Edition" .effective_date "01 Jul 2022" } ::lappend List { .name "T4127(E)" .revision "23/01" .description "Payroll Deductions Formulas - 117th Edition" .effective_date "01 Jan 2023" } ::lappend List { .name "T4127JUL(E)" .revision "23/05" .description "Payroll Deductions Formulas - 118th Edition" .effective_date "01 Jul 2023" } ::lappend List { .name "T4127(E)" .revision "24 (23/11)" .description "Payroll Deductions Formulas - 119th Edition" .effective_date "01 Jan 2024" } ::lappend List { .name "T4127(E)" .revision "25 (24/11)" .description "Payroll Deductions Formulas - 120th Edition" .effective_date "01 Jan 2025" } ::lappend List { .name "T4127(E)" .revision "25 (25/05)" .description "Payroll Deductions Formulas - 121st Edition" .effective_date "01 Jul 2025" } ::lappend List { .name "TP-1015.G-V" .revision "2013-01" .description "(Quebec) Guide For Employers, Source deductions and contributions, 2013" .effective_date "01 Jan 2013" } ::lappend List { .name "TP-1015.G-V" .revision "2014-01" .description "(Quebec) Guide For Employers, Source deductions and contributions, 2014" .effective_date "01 Jan 2014" } ::lappend List { .name "TP-1015.G-V" .revision "2015-01" .description "(Quebec) Guide For Employers, Source deductions and contributions, 2015" .effective_date "01 Jan 2015" } ::lappend List { .name "TP-1015.F-V" .revision "2016-01" .description "(Quebec) Guide For Employers, Source deductions and contributions, 2016" .effective_date "01 Jan 2016" } ::lappend List { .name "TP-1015.F-V" .revision "2017-01" .description "(Quebec) Guide For Employers, Source deductions and contributions, 2017" .effective_date "01 Jan 2017" } ::lappend List { .name "TP-1015.F-V" .revision "2018-01" .description "(Quebec) Guide For Employers, Source deductions and contributions, 2018" .effective_date "01 Jan 2018" } ::lappend List { .name "TP-1015.F-V" .revision "2019-01" .description "(Quebec) Guide For Employers, Source deductions and contributions, 2019" .effective_date "01 Jan 2019" } ::lappend List { .name "TP-1015.F-V" .revision "2020-01" .description "(Quebec) Guide For Employers, Source deductions and contributions, 2020" .effective_date "01 Jan 2020" } ::lappend List { .name "TP-1015.F-V" .revision "2021-01" .description "(Quebec) Guide For Employers, Source deductions and contributions, 2021" .effective_date "01 Jan 2021" } ::lappend List { .name "TP-1015.F-V" .revision "2022-01" .description "(Quebec) Guide For Employers, Source deductions and contributions, 2022" .effective_date "01 Jan 2022" } ::lappend List { .name "TP-1015.F-V" .revision "2023-01" .description "(Quebec) Guide For Employers, Source deductions and contributions, 2023" .effective_date "01 Jan 2023" } ::lappend List { .name "TP-1015.F-V" .revision "2024-01" .description "(Quebec) Guide For Employers, Source deductions and contributions, 2024" .effective_date "01 Jan 2024" } ::lappend List { .name "TP-1015.G-V" .revision "2025-01" .description "(Quebec) Guide For Employers, Source deductions and contributions, 2025" .effective_date "01 Jan 2025" } ::return $List; } public method init_payroll_country {} { chain; ::set _employerCppRate [[$_payrollObject ".cpp_contribution_rate"] odb_get]; ::set _employerCpp2Rate [[$_payrollObject ".cpp2_contribution_rate"] odb_get]; ::set _employerEiRate [[$_payrollObject ".ei_contribution_rate"] odb_get]; ::if {$_employerCppRate eq ""} {::set _employerCppRate 0.0;} ::if {$_employerEiRate eq ""} {::set _employerEiRate 0.0;} ::set _employer_hsf_rate [[$_payrollObject ".hsf_contribution_rate"] odb_get]; ::set _employer_wcb_rate [[$_payrollObject ".wcb_contribution_rate"] odb_get]; ::if {$_employer_hsf_rate eq ""} {::set _employer_hsf_rate 0.0;} ::if {$_employer_wcb_rate eq ""} {::set _employer_wcb_rate 0.0;} ::return $this; } public method init_employee_country {} { chain; ::set _annualBasicFederalTax 0; ::set _cpp_pensionable_earnings 0; ::set _ei_insurable_earnings 0; ::set _ei_insurable_hours 0; ::set _ppip_insurable_earnings 0.0; ::set _employee_ppip_deduction 0.0; ::set _employee_ppip_deduction_period 0.0; ::set _employee_cpp_deduction 0.0; ::set _employee_ei_deduction 0.0; ::set _employee_cpp_deduction_period 0.0; ::set _employee_ei_deduction_period 0.0; ::set _employer_cpp_contribution 0.0; ::set _employer_ei_contribution 0.0; ::set _employer_ppip_contribution 0.0; ::set _cpp2_pensionable_earnings 0; ::set _employee_cpp2_deduction 0.0; ::set _employee_cpp2_deduction_period 0.0; ::set _employer_cpp2_contribution 0.0; ::set _employer_hsf_contribution 0.0; ::if {$::qw::control(payroll_wcb)} {} ::set _employer_wcb_contribution 0.0; ::set _wcb_earnings 0.0; ::set _fedTax 0; # Annual Federal tax deduction ::set _fedTaxPP 0; # Pay-Period Federal tax deduction ::set _hsf_earnings 0.0; ::set _incTax 0; # Earnings read from notes of TAX acct ::set _pClaim 0; # Prov Claim amount ::set _province_of_employment [employeeInfoGet ".province_of_employment"]; ::set _provTax 0; # Annual Provincial tax deduction ::set _provTaxPP 0; # Pay-Period Provincial tax deduction ::set _tax 0; # Tax deduction amount ::set _td1_federal_claim_amount 0.0; ::if {$_province_of_employment eq ""} { ::qw::throw [::sargs \ .text "The province of employement has not been set for employee [employeeInfoGet .employee_id]" \ .help_id 907020050401081129 \ ]; } set_tax_variables_federal; set_tax_variables_provincial; # Set Provincial Constants recWrite "0" "PROCN" "~AYRUN.2" "20"; # Initialize YTD CPP2 recWrite "0" "PROCN" "~AYRUN.2" "10"; # Initialize YTD CPP recWrite "0" "PROCN" "~AYRUN.2" "11"; # Initialize YTD EI recWrite "0" "PROCN" "~AYRUN.2" "12"; # Initialize YTD PPIP recWrite "-1" "PROCN" "~AYRUN.2" "13"; # Initialize CPP counter recWrite "0" "PROCN" "~AYRUN.2" "30"; # CPP\QPP (Calculated by FEDERAL) recWrite "0" "PROCN" "~AYRUN.2" "31"; # EI (Calculated by FEDERAL) recWrite "0" "PROCN" "~QT.TBL" "1"; # Initialize Quebec tax recWrite "0" "PROCN" "~QT.TBL" "2"; # Clobber QTax ded acct ::return $this; } public method employee_fields_country {} { ::set Result [chain]; ::set Result [::concat $Result { .province_of_employment .social_insurance_number .federal.td1_claim_amount .federal.td1_additional_tax .federal.td1_prescribed_zone_deduction .federal.manual_tax_calculation .federal.tax_exempt .federal.other_tax_credits .federal.lsf_purchase_amount .federal.additional_exemption .federal.cpp_exempt .federal.ei_exempt .federal.td1x_estimated_income .provincial.td1_claim_amount .provincial.manual_tax_calculation .provincial.tax_exempt .provincial.wcb_exempt .provincial.ppip_exempt .provincial.other_tax_credits .provincial.td1_y_factor .provincial.lsf_purchase_amount .quebec.claim_amount .quebec.additional_tax .quebec.additional_deduction .quebec.manual_tax_calculation .quebec.tax_exempt }]; ::foreach Benefit {1 2 3 4} { ::set Result [::concat $Result [::string map "%_sub $Benefit" { .non_cash_taxable_benefits/%_sub.description .non_cash_taxable_benefits/%_sub.amount .non_cash_taxable_benefits/%_sub.amount_period .non_cash_taxable_benefits/%_sub.percent .non_cash_taxable_benefits/%_sub.percentage_base .non_cash_taxable_benefits/%_sub.t4_box .non_cash_taxable_benefits/%_sub.releve1_box .non_cash_taxable_benefits/%_sub.taxable .non_cash_taxable_benefits/%_sub.quebec_taxable .non_cash_taxable_benefits/%_sub.pensionable .non_cash_taxable_benefits/%_sub.insurable .non_cash_taxable_benefits/%_sub.ppip_insurable .non_cash_taxable_benefits/%_sub.hsfable .non_cash_taxable_benefits/%_sub.wcbable }]]; } ::set Result [::concat $Result .normal_pay]; ::return $Result; } public method build_employee_structure_country {} { chain; employeeInfoSet ".union_dues" 0.0; employeeInfoSet ".cpp_exemption" 0.0; employeeInfoSet ".ei_insurable_earnings" 0.0; employeeInfoSet ".ei_insurable_hours" 0.0; employeeInfoSet ".ppip_insurable_earnings" 0.0; employeeInfoSet ".cpp_pensionable_earnings" 0.0; employeeInfoSet ".cpp2_pensionable_earnings" 0.0; employeeInfoSet ".hsf_earnings" 0.0; employeeInfoSet ".wcb_earnings" 0.0; employeeInfoSet ".taxable_benefit/1.amount" 0.0; employeeInfoSet ".taxable_benefit/2.amount" 0.0; employeeInfoSet ".taxable_benefit/3.amount" 0.0; employeeInfoSet ".taxable_benefit/4.amount" 0.0; employeeInfoSet ".taxable_benefit/1.description" ""; employeeInfoSet ".taxable_benefit/2.description" ""; employeeInfoSet ".taxable_benefit/3.description" ""; employeeInfoSet ".taxable_benefit/4.description" ""; ::return $this; } public method normalize_employee_structure_country {} { chain; ::foreach Field { .federal.td1_additional_tax .federal.td1_prescribed_zone_deduction .federal.other_tax_credits .federal.lsf_purchase_amount .federal.additional_exemption .federal.td1x_estimated_income .provincial.other_tax_credits .provincial.td1_y_factor .provincial.lsf_purchase_amount .quebec.additional_tax .quebec.additional_deduction .normal_pay } { employeeInfoSet $Field [employeeInfoGetNumber $Field]; } ::foreach Field { .federal.manual_tax_calculation .federal.tax_exempt .federal.cpp_exempt .federal.ei_exempt .provincial.manual_tax_calculation .provincial.tax_exempt .provincial.wcb_exempt .provincial.ppip_exempt .quebec.manual_tax_calculation .quebec.tax_exempt } { employeeInfoSet $Field [employeeInfoGetBoolean $Field]; } } public method taxable_income {{s_args ""}} { ::set TaxableIncome [earningsSubjectTo ".tax"]; ::set NonCashTaxableBenefits [non_cash_taxable_benefits [::sargs::var::set s_args .type "taxable"]]; ::return [::expr $TaxableIncome+$NonCashTaxableBenefits]; } public method tables_test {} { ::return; } public method DETAILS {} { ::if {[::string toupper [payCodeValueGet ".quantity"]] eq "H"} { payCodeValueSet ".quantity" $_ei_insurable_hours; } chain; } public method calculate_pay {} { ::set Type [payCodeValueGet ".type"]; ::if {[accountInfoGet ".account.normal_balance"] eq "debit"} { ::switch $Type { "BONUS" {::return [BONUS];} "COMMISSION" {::return [COMMISSION];} "RETRO" {::return [RETROACTIVEPAYINCREASE];} "STATUTORYHOLIDAY" {::return [STATUTORYHOLIDAY];} } } else { ::switch $Type { "EI" { ::set Result [EI]; ::set _employee_ei_deduction $Result; recWrite [::expr $_employee_ei_deduction+[accountInfoGet ".amount/year_to_date"]] "PROCN" "~AYRUN.2" "11"; #// Store for tax calc ::return $Result; } "CPP" { ::set Result [CPP]; ::set _employee_cpp_deduction $Result; recWrite [::expr $Result+[accountInfoGet ".amount/year_to_date"]] "PROCN" "~AYRUN.2" "10"; #// Store for tax calc ::return $Result; } "QPP" { ::set Result [CPP]; ::set _employee_cpp_deduction $Result; ::return $Result; } "CPP2" { ::set Result [CPP2 .deduction_name "CPP2" .earnings_maximum $_cpp2MaxPE .deduction_maximum $_cpp2Max .earnings_exempt $_cppMaxPE .deduction_rate $_cpp2Rate]; ::set _employee_cpp2_deduction $Result; recWrite [::expr $Result+[accountInfoGet ".amount/year_to_date"]] "PROCN" "~AYRUN.2" "20"; #// Store for tax calc ::return $Result; } "QPP2" { ::set Result [CPP2 .deduction_name "QPP2" .earnings_maximum $_cpp2MaxPE .deduction_maximum $_cpp2Max .earnings_exempt $_cppMaxPE .deduction_rate $_cpp2Rate]; ::set _employee_cpp2_deduction $Result; ::return $Result; } "PPIP" { ::set Result [PPIP]; ::set _employee_ppip_deduction $Result; recWrite [::expr $_employee_ppip_deduction+[accountInfoGet ".amount/year_to_date"]] "PROCN" "~AYRUN.2" "12"; #// Store for tax calc ::return $Result; } "RPP" {::return [RPP];} "RRSP" {::return [RRSP];} "TAX" { ::set Result [TAXCALC]; ::if {[employeeInfoGet ".province_of_employment"] eq "PQ"} {~AYRUN.12;} ::return $Result; } "UNION" {::return [UNION];} "QTAX" { ::set Result [QTAXCALC]; ::return $Result; } "DONATION" {::return [DONATION];} } } ::return [chain]; } public method DOLINE {} { chain; ::set InsurableHours [INSHOURS]; accountInfoSet ".result.insurable_hours" $InsurableHours; employeeInfoSet ".ei_insurable_hours" [::expr [employeeInfoGet ".ei_insurable_hours"]+$InsurableHours]; } public method employee_end {} { preview_employer_contributions; chain; } public method preview_employer_contributions {} { ::lappend _employee_detail_list ""; ::foreach {Name Description} { ".cpp_exemption" "CPP/QPP Exemption" ".ei_insurable_earnings" "EI Insurable Earnings" ".ppip_insurable_earnings" "PPIP Insurable Earnings" ".ei_insurable_hours" "EI Insurable Hours" ".cpp_pensionable_earnings" "CPP/QPP Pensionable Earnings" .cpp2_pensionable_earnings "CPP2/QPP2 Pensionable Earnings" .hsf_earnings "EHT/HAPSET/HSF Earnings" .wcb_earnings "WCB/CSST Earnings" } { ::set Amount [employeeInfoGet $Name]; ::lappend _employee_detail_list "[padRight $Description 35 { }][::format %10.2f $Amount]"; }; ::set Flag 0; ::set Total 0.0; ::foreach Benefit {1 2 3 4} { ::set Amount [employeeInfoGet ".taxable_benefit/$Benefit.amount"]; ::if {$Amount==0.0} {::continue;} ::set Description [employeeInfoGet ".taxable_benefit/$Benefit.description"]; ::if {$Description eq ""} {::set Description "#$Benefit";} ::if {!$Flag} { ::lappend _employee_detail_list ""; ::lappend _employee_detail_list "Taxable Benefits:"; ::set Flag 1; } ::lappend _employee_detail_list " [padRight $Description 33 { }][::format %10.2f $Amount]"; ::set Total [::qw::number::add $Total $Amount]; } ::if {$Flag} { ::lappend _employee_detail_list "[padRight Total 35 { }][::format %10.2f $Total]"; } ::lappend _employee_detail_list "[padRight {Employer EI contribution} 35 { }][::format %10.2f $_employer_ei_contribution]"; ::if {[payrunAccount "/employer_contribution/ei_expense"] eq ""} { preview_employer_contributions_pie $_employer_ei_contribution "EI"; } ::switch [employeeInfoGet ".province_of_employment"] { PQ { ::lappend _employee_detail_list "[padRight {Employer QPP contribution} 35 { }][::format %10.2f $_employer_cpp_contribution]"; ::if {[payrunAccount "/employer_contribution/cpp_expense"] eq ""} { preview_employer_contributions_pie $_employer_cpp_contribution "QPP"; } ::lappend _employee_detail_list "[padRight {Employer QPP2 contribution} 35 { }][::format %10.2f $_employer_cpp2_contribution]"; ::if {[payrunAccount "/employer_contribution/cpp2_expense"] eq ""} { preview_employer_contributions_pie $_employer_cpp2_contribution "QPP2"; } ::lappend _employee_detail_list "[padRight {Employer PPIP contribution} 35 { }][::format %10.2f $_employer_ppip_contribution]"; ::if {[payrunAccount "/employer_contribution/ppip_expense"] eq ""} { preview_employer_contributions_pie $_employer_ppip_contribution "PPIP"; } } default { ::lappend _employee_detail_list "[padRight {Employer CPP contribution} 35 { }][::format %10.2f $_employer_cpp_contribution]"; ::if {[payrunAccount "/employer_contribution/cpp_expense"] eq ""} { preview_employer_contributions_pie $_employer_cpp_contribution "CPP"; } ::lappend _employee_detail_list "[padRight {Employer CPP2 contribution} 35 { }][::format %10.2f $_employer_cpp2_contribution]"; ::if {[payrunAccount "/employer_contribution/cpp2_expense"] eq ""} { preview_employer_contributions_pie $_employer_cpp2_contribution "CPP2"; } } } ::lappend _employee_detail_list "[padRight {Employer EHT/HAPSET/HSF contribution} 35 { }][::format %10.2f $_employer_hsf_contribution]"; ::if {[payrunAccount "/employer_contribution/hsf_expense"] eq ""} { preview_employer_contributions_pie $_employer_hsf_contribution "EHT/HAPSET/HSF"; } ::if {$::qw::control(payroll_wcb)} {} ::lappend _employee_detail_list "[padRight {Employer WCB/CSST contribution} 35 { }][::format %10.2f $_employer_wcb_contribution]"; ::if {[payrunAccount "/employer_contribution/wcb_expense"] eq ""} { preview_employer_contributions_pie $_employer_wcb_contribution "WCB/CSST"; } } public method preview_employer_contributions_pie {Contribution DebugLog} { ::set Count 0; ::set FinalAllocation [::expr {[::llength $_allocation_partitions]-1}]; ::set AllocationSum 0.0; ::foreach Partition $_allocation_partitions { ::set PName [[[::lindex $Partition 0] ".name"] odb_get]; ::set PDescription [[[::lindex $Partition 0] ".description"] odb_get]; ::append PName " $PDescription"; ::if {$Count==$FinalAllocation} { ::set PNumber [::qw::number::subtract $Contribution $AllocationSum]; } else { ::set Allocation [::expr {$_TAmount==0.0?0.0:[::qw::number::divide [::lindex $Partition 2] $_TAmount]}]; ::set PNumber [round2 [::qw::number::multiply $Contribution $Allocation]] ::qw::number::var::add AllocationSum $PNumber; } ::lappend _employee_detail_list "..[padRight $PName 25 { }][::format %10.2f $PNumber]"; indentIncrement; debugLog "$DebugLog Cont. $PName ==$PNumber"; indentDecrement; ::incr Count; } } public method record_employer_contributions {} { chain; record_employer_contributions_ei; record_employer_contributions_ppip; record_employer_contributions_cpp_qpp; record_employer_contributions_cpp2_qpp2; record_employer_contributions_hsf; record_employer_contributions_wcb; ::return; } public method record_employer_contributions_ei {} { ::set _employer_ei_contribution [round2 [::expr $_employee_ei_deduction*$_employerEiRate]]; ::if {$_employer_ei_contribution==0.0} { ::return; } ::if {[payrunAccount "/employer_contribution/ei_accrued"] eq ""} { ::return; } ::while {1} { ::if {[payrunAccount "/employer_contribution/ei_expense"] ne ""} { ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer EI" $Sub; accountInfoSet ".account.address" [payrunAccount "/employer_contribution/ei_expense"] $Sub; accountInfoSet ".result.amount" $_employer_ei_contribution $Sub; ::break; } ::if {[::llength $_allocation_partitions]==0} { ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer EI" $Sub; accountInfoSet ".account.address" [payrunAccount "/unallocated_wage_expense"] $Sub; accountInfoSet ".result.amount" $_employer_ei_contribution $Sub; ::break; } record_employer_contributions_pie $_employer_ei_contribution "EI"; ::break; } ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer EI" $Sub; accountInfoSet ".account.address" [payrunAccount "/employer_contribution/ei_accrued"] $Sub; accountInfoSet ".result.amount" [::qw::number::negative $_employer_ei_contribution] $Sub; ::return; } public method record_employer_contributions_ppip {} { ::set PPIPrate [::expr {$_employerPpipRate/$_ppipRate}]; ;#// force it into the EI and CPP model ::set _employer_ppip_contribution [round2 [::expr $_employee_ppip_deduction*$PPIPrate]]; ::if {$_employer_ppip_contribution==0.0} { ::return; } ::if {[payrunAccount "/employer_contribution/ppip_accrued"] eq ""} { ::return; } ::while {1} { ::if {[payrunAccount "/employer_contribution/ppip_expense"] ne ""} { ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer PPIP" $Sub; accountInfoSet ".account.address" [payrunAccount "/employer_contribution/ppip_expense"] $Sub; accountInfoSet ".result.amount" $_employer_ppip_contribution $Sub; ::break; } ::if {[::llength $_allocation_partitions]==0} { ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer PPIP" $Sub; accountInfoSet ".account.address" [payrunAccount "/unallocated_wage_expense"] $Sub; accountInfoSet ".result.amount" $_employer_ppip_contribution $Sub; ::break; } record_employer_contributions_pie $_employer_ppip_contribution "PPIP"; ::break; } ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer PPIP" $Sub; accountInfoSet ".account.address" [payrunAccount "/employer_contribution/ppip_accrued"] $Sub; accountInfoSet ".result.amount" [::qw::number::negative $_employer_ppip_contribution] $Sub; ::return; } public method record_employer_contributions_cpp_qpp {} { ::set _employer_cpp_contribution [round2 [::expr $_employee_cpp_deduction*$_employerCppRate]]; ::if {$_employer_cpp_contribution==0.0} { ::return; } ::if {[payrunAccount "/employer_contribution/cpp_accrued"] eq ""} { ::return; } ::switch [employeeInfoGet ".province_of_employment"] { "PQ" {::set Text "QPP";} default {::set Text "CPP";} } ::while {1} { ::if {[payrunAccount "/employer_contribution/cpp_expense"] ne ""} { ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer $Text" $Sub; accountInfoSet ".account.address" [payrunAccount "/employer_contribution/cpp_expense"] $Sub; accountInfoSet ".result.amount" $_employer_cpp_contribution $Sub; ::break; } ::if {[::llength $_allocation_partitions]==0} { ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer $Text" $Sub; accountInfoSet ".account.address" [payrunAccount "/unallocated_wage_expense"] $Sub; accountInfoSet ".result.amount" $_employer_cpp_contribution $Sub; ::break; } record_employer_contributions_pie $_employer_cpp_contribution $Text; ::break; } ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer $Text" $Sub; accountInfoSet ".account.address" [payrunAccount "/employer_contribution/cpp_accrued"] $Sub; accountInfoSet ".result.amount" [::qw::number::negative $_employer_cpp_contribution] $Sub; ::return; } public method record_employer_contributions_cpp2_qpp2 {} { ::set _employer_cpp2_contribution [round2 [::expr $_employee_cpp2_deduction*$_employerCpp2Rate]]; ::if {$_employer_cpp2_contribution==0.0} { ::return; } ::if {[payrunAccount "/employer_contribution/cpp2_accrued"] eq ""} { ::return; } ::switch [employeeInfoGet ".province_of_employment"] { "PQ" {::set Text "QPP2";} default {::set Text "CPP2";} } ::while {1} { ::if {[payrunAccount "/employer_contribution/cpp2_expense"] ne ""} { ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer $Text" $Sub; accountInfoSet ".account.address" [payrunAccount "/employer_contribution/cpp2_expense"] $Sub; accountInfoSet ".result.amount" $_employer_cpp2_contribution $Sub; ::break; } ::if {[::llength $_allocation_partitions]==0} { ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer $Text" $Sub; accountInfoSet ".account.address" [payrunAccount "/unallocated_wage_expense"] $Sub; accountInfoSet ".result.amount" $_employer_cpp2_contribution $Sub; ::break; } record_employer_contributions_pie $_employer_cpp2_contribution $Text; ::break; } ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer $Text" $Sub; accountInfoSet ".account.address" [payrunAccount "/employer_contribution/cpp2_accrued"] $Sub; accountInfoSet ".result.amount" [::qw::number::negative $_employer_cpp2_contribution] $Sub; ::return; } public method record_employer_contributions_hsf {} { ::set _hsf_earnings 0.0; ::if {$_employer_hsf_rate==0.0} { employeeInfoSet ".hsf_earnings" $_hsf_earnings; ;#// NOT just only the HSFable (i.e. employer contributionable) portion ::return; } ::switch -- [employeeInfoGet ".province_of_employment"] { PQ_OLD { ::qw::number::var::add _hsf_earnings [earningsSubjectTo ".quebec_tax"]; ::qw::number::var::add _hsf_earnings [employeeInfoGet ".union_dues"]; } default { ::set _hsf_earnings [::expr $_hsf_earnings+[earningsSubjectTo ".hsf"]]; debugLog "EHT/HAPSET/HSF earnings $_hsf_earnings"; ::set Benefits [non_cash_taxable_benefits [::sargs ".type" "hsfable"]]; debugLog "EHT/HAPSET/HSF benefits $Benefits"; ::set _hsf_earnings [::qw::number::add $_hsf_earnings $Benefits]; debugLog "EHT/HAPSET/HSF Total $_hsf_earnings"; } } employeeInfoSet ".hsf_earnings" $_hsf_earnings; ;#// NOT just only the HSFable (i.e. employer contributionable) portion ::set HSFable $_hsf_earnings; ::set Min [[$_payrollObject .hsf_annual_exemption] odb_get]; debugLog "EHT/HAPSET/HSF Exemption $Min"; ::if {$Min>0.0} { ::set Range [::qw::odb::factory range]; $Range cpp_configure \ -index [$_payrollObject ".paychecks.index/date"] \ -begin ".tag financial .date $_yearBeginDate" \ -end ".tag financial .date $_yearEndDate" \ ; ::set YearToDate [$Range odb_total ".path .hsf_earnings .priority foreground"]; $Range cpp_destroy; debugLog "EHT/HAPSET/HSF YTD [::expr {$YearToDate+$_hsf_earnings_payrun+$_hsf_earnings}] ($YearToDate+$_hsf_earnings_payrun+$_hsf_earnings)"; ::if {[::expr {$YearToDate+$_hsf_earnings_payrun}]>$Min} { } else { ::if {[::expr {$YearToDate+$_hsf_earnings_payrun+$_hsf_earnings}]>$Min} { ::set HSFable [::expr {$YearToDate+$_hsf_earnings_payrun+$_hsf_earnings-$Min}]; } else { ::set HSFable 0.0; } } } ::qw::number::var::add _hsf_earnings_payrun $_hsf_earnings; ::set _employer_hsf_contribution [round2 [::expr $HSFable*$_employer_hsf_rate*0.01]]; debugLog "EHT/HAPSET/HSF employer cont [::format %.2f $_employer_hsf_contribution] ($HSFable*[::expr {$_employer_hsf_rate*0.01}])"; ::if {$_employer_hsf_contribution==0.0} { ::return; } ::if {[payrunAccount "/employer_contribution/hsf_accrued"] eq ""} { ::return; } ::set Text "EHT/HAPSET/HSF"; ::while {1} { ::if {[payrunAccount "/employer_contribution/hsf_expense"] ne ""} { ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer $Text" $Sub; accountInfoSet ".account.address" [payrunAccount "/employer_contribution/hsf_expense"] $Sub; accountInfoSet ".result.amount" $_employer_hsf_contribution $Sub; ::break; } ::if {[::llength $_allocation_partitions]==0} { ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer $Text" $Sub; accountInfoSet ".account.address" [payrunAccount "/unallocated_wage_expense"] $Sub; accountInfoSet ".result.amount" $_employer_hsf_contribution $Sub; ::break; } record_employer_contributions_pie $_employer_hsf_contribution $Text; ::break; } ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer $Text" $Sub; accountInfoSet ".account.address" [payrunAccount "/employer_contribution/hsf_accrued"] $Sub; accountInfoSet ".result.amount" [::qw::number::negative $_employer_hsf_contribution] $Sub; ::return; } public method record_employer_contributions_wcb {} { ::set _wcb_earnings 0.0; ::set Max [[$_payrollObject .wcb_annual_maximum] odb_get]; ::if {$Max<=0.0} { employeeInfoSet ".wcb_earnings" 0.0; ::return; } ::if {[[$_employee .provincial.wcb_exempt] odb_get] eq "yes"} { employeeInfoSet ".wcb_earnings" 0.0; debugLog "WCB/CSST exempt"; ::return; } ::set Range [::qw::odb::factory range]; $Range cpp_configure \ -index [$_employee ".paychecks.index/date"] \ -begin ".tag financial .date $_yearBeginDate" \ -end ".tag financial .date $_yearEndDate" \ ; ::set YearToDate [$Range odb_total ".path .wcb_earnings .priority foreground"]; $Range cpp_destroy; debugLog "WCB/CSST YTD=$YearToDate Maximum=$Max"; ::if {$YearToDate>=$Max} { employeeInfoSet ".wcb_earnings" 0.0; ::return; } ::set HeadRoom [::expr {$Max-($YearToDate+$_wcb_earnings)}]; ::switch -- [employeeInfoGet ".province_of_employment"] { "PQ" { ::set PeriodMax [truncate2 [::expr $Max/[::expr double($_pay_frequency)]]]; ::if {$HeadRoom>$PeriodMax} { ::set HeadRoom $PeriodMax; } } } ::switch -- [employeeInfoGet ".province_of_employment"] { default { ::set Benefits [non_cash_taxable_benefits [::sargs .type "wcbable"]]; ::if {$Benefits>0.0} { debugLog "WCB/CSST benefits=$Benefits"; ::if {$Benefits>$HeadRoom} { ::set Benefits $HeadRoom; } ::qw::number::var::add _wcb_earnings $Benefits; ::qw::number::var::subtract HeadRoom $Benefits; ::set Rate $_employer_wcb_rate; ::set Benefits [::qw::number::multiply $Benefits [::qw::number::divide $Rate 100.0]]; ::set Benefits [::qw::number::multiply $Benefits [[$_payrollObject .wcb_experience_rating] odb_get]]; ::qw::number::var::add _employer_wcb_contribution $Benefits; debugLog "WCB/CSST benefits contribution=$Benefits"; } } } ::set Xrate [[$_payrollObject .wcb_experience_rating] odb_get]; ::for {::set Sub 1} {$Sub<=[employeeInfoGet ".number_of_accounts"]} {::incr Sub;} { ::set AccountInfo [employeeInfoGet ".accounts/$Sub"]; ::if {[::sargs::get $AccountInfo .account.pay_codes] eq ""} { ::continue; } ::if {[payCodeValueGet .wcb $Sub] eq "yes"} { ::set Amount [accountInfoGet ".result.amount" $Sub]; ::if {[accountInfoGet ".account.normal_balance" $Sub] eq "credit"} { ::qw::number::var::negative Amount; } ::if {$Amount>$HeadRoom} { ::set Amount $HeadRoom; } ::set DebugLogAmount $Amount; ::qw::number::var::add _wcb_earnings $Amount; ::qw::number::var::subtract HeadRoom $Amount; ::set Rate [payCodeValueNumber ".wcb_per_hundred" $Sub]; ::if {$Rate eq ""||$Rate<=0.0} { ;#// in tcl {""<0.0} is true NO IT ISN'T ::set Rate $_employer_wcb_rate; } ::set Amount [::qw::number::multiply $Amount [::qw::number::divide $Rate 100.0]]; ::set Amount [::qw::number::multiply $Amount $Xrate]; ::qw::number::var::add _employer_wcb_contribution $Amount; debugLog "WCB/CSST [::sargs::get $AccountInfo .account.name] employer contribution=$Amount ($DebugLogAmount*[::qw::number::divide $Rate 100.0]*$Xrate)"; } } ::set _employer_wcb_contribution [round2 $_employer_wcb_contribution]; debugLog "WCB/CSST employer contribution=[::format %.2f $_employer_wcb_contribution]"; ::if {$_employer_wcb_contribution==0.0} { employeeInfoSet ".wcb_earnings" 0.0; ::return; } employeeInfoSet ".wcb_earnings" $_wcb_earnings; ::if {[payrunAccount "/employer_contribution/wcb_accrued"] eq ""} { ::return; } ::set Text "WCB/CSST"; ::while {1} { ::if {[payrunAccount "/employer_contribution/wcb_expense"] ne ""} { ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer $Text" $Sub; accountInfoSet ".account.address" [payrunAccount "/employer_contribution/wcb_expense"] $Sub; accountInfoSet ".result.amount" $_employer_wcb_contribution $Sub; ::break; } ::if {[::llength $_allocation_partitions]==0} { ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer $Text" $Sub; accountInfoSet ".account.address" [payrunAccount "/unallocated_wage_expense"] $Sub; accountInfoSet ".result.amount" $_employer_wcb_contribution $Sub; ::break; } record_employer_contributions_pie $_employer_wcb_contribution $Text; ::break; } ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer $Text" $Sub; accountInfoSet ".account.address" [payrunAccount "/employer_contribution/wcb_accrued"] $Sub; accountInfoSet ".result.amount" [::qw::number::negative $_employer_wcb_contribution] $Sub; ::return; } public method record_employer_contributions_pie {Contribution Text} { ::set Count 0; ::set FinalAllocation [::expr {[::llength $_allocation_partitions]-1}]; ::set AllocationSum 0.0; ::foreach Partition $_allocation_partitions { ::set Sub [append_account_structure]; accountInfoSet ".result.description" "[employeeInfoGet .employee_id] Employer $Text" $Sub; accountInfoSet ".account.address" [::lindex $Partition 0] $Sub; accountInfoSet ".result.quantity" 0; ::if {$Count==$FinalAllocation} { ::set PNumber [::qw::number::subtract $Contribution $AllocationSum]; } else { ::set Allocation [::expr {$_TAmount==0.0?0.0:[::qw::number::divide [::lindex $Partition 2] $_TAmount]}]; ::set PNumber [round2 [::qw::number::multiply $Contribution $Allocation]] ::qw::number::var::add AllocationSum $PNumber; } accountInfoSet ".result.amount" $PNumber $Sub; ::incr Count; } } public method BONUS {} { accountInfoSet ".result.description" "Bonus YTD = @Y" ::set Result [percent_or_time_amount_get]; ::return $Result; } public method COMMISSION {} { accountInfoSet ".result.description" "Commission YTD = @Y" ::set Result [percent_or_time_amount_get]; ::return $Result; } public method RETROACTIVEPAYINCREASE {} { accountInfoSet ".result.description" "Retroactive Pay Increase YTD = @Y" ::set Result [percent_or_time_amount_get]; ::return $Result; } public method STATUTORYHOLIDAY {} { accountInfoSet ".result.description" "Statutory Holiday Pay YTD = @Y" ::set Result [percent_or_time_amount_get]; ::return $Result; } public method non_cash_taxable_benefits_period_subject_to {s_args} { ::set Type [::sargs::get $s_args .type]; ::if {[::lsearch -exact "taxable quebec_taxable insurable pensionable" $Type]<0} { ::qw::bug "907020050401053730" "non_cash_taxable_benefits_period_subject_to called with invalid Type arg \"$Type\"."; } ::set Result 0.0; ::foreach Benefit {1 2 3 4} { ::if {![employeeInfoGet ".non_cash_taxable_benefits/$Benefit.$Type"]} { ::continue; } ::sargs::var::set s_args .type ".non_cash_taxable_benefits/$Benefit.amount"; ::set Amount [employeeDeductionEarningsPayPeriod $s_args]; ::set Result [::qw::number::add $Result $Amount]; } ::return $Result; } public method non_cash_taxable_benefits {s_args} { ::set Type [::sargs::get $s_args .type]; ::if {[::lsearch -exact "taxable quebec_taxable insurable pensionable ppip_insurable hsfable wcbable" $Type]<0} { ::qw::bug "907020050401053749" "non_cash_taxable_benefits called with invalid Type arg \"$Type\"."; } ::set Result 0.0; ::foreach Benefit {1 2 3 4} { ::set Amount [non_cash_taxable_benefit [::sargs::set $s_args .benefit $Benefit .type $Type]]; ::set Result [::qw::number::add $Result $Amount]; } ::return $Result; } public method non_cash_taxable_benefit {s_args} { ::set Benefit [::sargs::get $s_args .benefit]; ::if {[::sargs::get $s_args .purpose] eq "non_cash_taxable_benefits"} { ::return 0.0; } ::if {$Benefit ne "1"&&$Benefit ne "2"&&$Benefit ne "3"&&$Benefit ne "4"} { ::qw::bug "907020050401053804" "non_cash_taxable_benefit called with invalid .benefit \"$Benefit\"."; } ::set Type [::sargs::get $s_args .type]; ::if {[::lsearch -exact "taxable quebec_taxable insurable pensionable ppip_insurable hsfable wcbable" $Type]<0} { ::qw::bug "907020050401053819" "non_cash_taxable_benefit called with invalid .type \"$Type\"."; } ::if {![employeeInfoGetBoolean ".non_cash_taxable_benefits/$Benefit.$Type"]} { ::return 0.0; } ::set Result [employeeInfoGet ".non_cash_taxable_benefits/$Benefit.amount"]; ::if {![::string is double $Result]} { ::set Result 0.0; } ::if {$Result!=0.0} { ::set AmountPeriod [employeeInfoGet ".non_cash_taxable_benefits/$Benefit.amount_period"]; ::switch -- $AmountPeriod { "weekly" {::set Result [::qw::number::multiply $Result 52]} "monthly" {::set Result [::qw::number::multiply $Result 12]} "pay-period" {::set Result [::qw::number::multiply $Result $_pay_frequency]} "annual" {} } ::set Result [round2 [::qw::number::divide $Result $_pay_frequency]]; ::set PeriodYear [[$_payrunObject ".pay_period_year"] odb_get]; ::set PeriodNumber [[$_payrunObject ".pay_period_number"] odb_get]; ::set Checks [employeePayChecksByPayPeriod [::sargs ".year" $PeriodYear ".period" $PeriodNumber]]; ::set PriorAmountTotal 0.0; ::foreach Check $Checks { ::set PriorAmount [[$Check ".non_cash_taxable_benefits/$Benefit.amount"] odb_get]; ::set PriorAmountTotal [::qw::number::add $PriorAmountTotal $PriorAmount]; } ::if {$Result>=0.0} { ::set Result [::qw::number::subtract $Result $PriorAmountTotal]; ::if {$Result<0.0} { ::return 0.0; } } else { ::set Result [::qw::number::add $Result $PriorAmountTotal]; ::if {$Result>0.0} { ::return 0.0; } } ::return $Result; } ::set Percent [employeeInfoGet ".non_cash_taxable_benefits/$Benefit.percent"]; ::if {![::string is double $Percent]} { ::return 0.0; } ::set Percent [::qw::number::multiply $Percent 0.01]; ::set Expression [employeeInfoGet ".non_cash_taxable_benefits/$Benefit.percentage_base"]; ::if {$Expression eq ""} { ::set PercentageBase [taxable_income [::sargs .purpose "non_cash_taxable_benefits"]]; } else { ::set PercentageBase [percentage_base [::sargs .expression $Expression]]; } ::if {$PercentageBase==0.0} { ::return 0.0; } ::set Result [round2 [::qw::number::multiply $PercentageBase $Percent]]; ::return $Result; } public method EI {} { ::set Result 0.0; ::if {[employeeInfoGet ".federal.ei_exempt"]} { debugLog "EI Employee is exempt, no EI"; accountInfoSet ".result.description" "EI YTD = @Y"; employeeInfoSet ".ei_insurable_earnings" 0; ::return $Result; } ::set Ei_insurable_earnings [earningsSubjectTo ".ei"];debugLog "EI Insurable earnings==$Ei_insurable_earnings"; ::set Benefits [non_cash_taxable_benefits [::sargs .type "insurable"]];debugLog "EI Insurable benefits==$Benefits"; ::set Ei_insurable_earnings [::qw::number::add $Ei_insurable_earnings $Benefits];debugLog "EI Total EI earnings ==$Ei_insurable_earnings"; ::set Result [EI_CALC $Ei_insurable_earnings]; accountInfoSet ".result.description" "E.I. YTD = @Y"; employeeInfoSet ".ei_insurable_earnings" $Ei_insurable_earnings; ::set _employee_ei_deduction_period [::expr [accountInfoGet ".amount/pay_period_to_date"]+$Result]; ::return $Result; } public method EI_CALC {Ei_insurable_earnings} { ::set Result 0.0; ::if {$Ei_insurable_earnings<=0.0} { ::return $Result; } ::if {[employeeInfoGet ".federal.ei_exempt"]} { ::return $Result; } ::set Result [round2 [::expr $Ei_insurable_earnings*$_eiRate]]; debugLog "EI deduction for pay-period: $Result ($Ei_insurable_earnings*$_eiRate)"; ::set Limit [::expr $_eiMax-[accountInfoGet ".amount/year_to_date"]]; ;#// Keep employee from exceeding yearly maximum ::if {$Result>$Limit} { ::set Result $Limit; debugLog "EI Annual limit reached, deduction is: $Result"; } ::if {$Result<0.0} {::set Result 0.0;} ::return $Result; } public method PPIP {} { ::set Result 0.0; ::if {[employeeInfoGet ".provincial.ppip_exempt"]} { debugLog "PPIP Employee is exempt, no PPIP"; accountInfoSet ".result.description" "PPIP YTD = @Y"; employeeInfoSet ".ppip_insurable_earnings" 0; ::return $Result; } ::set Ppip_insurable_earnings [earningsSubjectTo ".ppip"];debugLog "PPIP Insurable earnings==$Ppip_insurable_earnings"; ::set Benefits [non_cash_taxable_benefits [::sargs .type "ppip_insurable"]];debugLog "PPIP Insurable benefits==$Benefits"; ::set Ppip_insurable_earnings [::qw::number::add $Ppip_insurable_earnings $Benefits];debugLog "PPIP Total PPIP earnings ==$Ppip_insurable_earnings"; ::set Result [PPIP_CALC $Ppip_insurable_earnings]; accountInfoSet ".result.description" "PPIP YTD = @Y"; employeeInfoSet ".ppip_insurable_earnings" $Ppip_insurable_earnings; ::set _employee_ppip_deduction_period [::expr [accountInfoGet ".amount/pay_period_to_date"]+$Result]; ::return $Result; } public method PPIP_CALC {Ppip_insurable_earnings} { ::set Result 0.0; ::if {$Ppip_insurable_earnings<=0.0} { ::return $Result; } ::if {[employeeInfoGet ".provincial.ppip_exempt"]} { ::return $Result; } ::set Result [round2 [::expr {$Ppip_insurable_earnings*$_ppipRate}]]; debugLog "PPIP deduction for pay-period: $Result ($Ppip_insurable_earnings*$_ppipRate)"; ::set Limit [::expr $_ppipMax-[accountInfoGet ".amount/year_to_date"]]; ;#// Keep employee from exceeding yearly maximum ::if {$Result>$Limit} { ::set Result $Limit; debugLog "PPIP Annual limit reached, deduction is: $Result"; } ::if {$Result<0.0} {::set Result 0.0;} ::return $Result; } public method CPP {} { ::set Result 0.0; ::if {[employeeInfoGet ".province_of_employment"] ne "PQ"} {::set DedName "CPP";} else {::set DedName "QPP";} ::if {[employeeInfoGet ".federal.cpp_exempt"]} { debugLog "$DedName Employee is exempt, no $DedName"; ::if {$DedName eq "CPP"} { accountInfoSet ".result.description" "CPP YTD = @Y"; } else { accountInfoSet ".result.description" "QPP YTD = @Y"; } employeeInfoSet ".cpp_pensionable_earnings" 0; ::return $Result; } ::set Cpp_pensionable_earnings [earningsSubjectTo ".cpp"]; debugLog "$DedName earnings: $Cpp_pensionable_earnings"; ::set Benefits [non_cash_taxable_benefits [::sargs .type "pensionable"]]; debugLog "$DedName pensionable benefits: $Benefits"; ::set Cpp_pensionable_earnings [::qw::number::add $Cpp_pensionable_earnings $Benefits]; debugLog "$DedName total pensionable earnings: $Cpp_pensionable_earnings"; ::set Range [::qw::odb::factory range]; $Range cpp_configure \ -index [$_employee ".paychecks.index/date"] \ -begin ".tag financial .date $_yearBeginDate" \ -end ".tag financial .date $_yearEndDate" \ ; ::set YearToDate [$Range odb_total ".path .cpp_pensionable_earnings .priority foreground"]; ::if {[::expr {$Cpp_pensionable_earnings+$YearToDate}]>$_cppMaxPE} { ::set Cpp_pensionable_earnings [::expr $_cppMaxPE-$YearToDate]; } ::if {$Cpp_pensionable_earnings<0.0} { ::set Cpp_pensionable_earnings 0.0; } $Range cpp_destroy; ::set CppMaximum $_cppMax; #// Assume default yearly maximum ::set Months 12; #// The number of months used to prorate the yearly exemption & maximum ::set DateOfBirth [employeeInfoGet ".date_of_birth"]; ::if {[stringToNumber $DateOfBirth]} { debugLog "$DedName date of birth found: $DateOfBirth"; ::set CppStartDate [::qw::date::add $DateOfBirth "year" "18"]; ::set CppStartDate [::qw::date::add $CppStartDate "month" "1"]; ::set CppStartDate [::qw::date::set $CppStartDate "day" "1"]; ::if {[::qw::date::difference $CppStartDate $_date "day"]>0} { debugLog "$DedName Employee is under 18, $DedName exempt"; ::set Cpp_pensionable_earnings 0.0; } ::if {$DedName eq "CPP"} { ::set Year [::qw::date::get $DateOfBirth "year"]; ::incr Year 70; ::if {$Year>2037} {::set Year 2037;} ::set CppEndDate [::qw::date::add $DateOfBirth "year" 70]; ::set CppEndDate [::qw::date::set $CppEndDate "day" [::qw::date::get $CppEndDate "days_in_month"]]; debugLog "$DedName Employee stops paying $DedName on $CppEndDate"; ::if {[::qw::date::difference $_date $CppEndDate "day"]>0} { debugLog "$DedName Employee is over 70, $DedName exempt"; ::set Cpp_pensionable_earnings 0.0; } } else { ::set CppEndDate [::qw::date::set $DateOfBirth "year" "2037"]; debugLog "$DedName Employee stops paying $DedName on $CppEndDate"; } ::if {[::qw::date::get $CppStartDate "year"]==[::qw::date::get $_date "year"]} { ::incr Months [::expr 1-[::qw::date::get $CppStartDate "month"]]; debugLog "$DedName Employee 18 this year, pays $DedName for $Months months"; } ::if {[::qw::date::get $CppEndDate "year"]==[::qw::date::get $_date "year"]} { ::set Months [::qw::date::get $CppEndDate "month"]; debugLog "$DedName Employee 70 this year, pays $DedName for $Months months"; } ::if {$Months==0} { debugLog "$DedName months are 0, no $DedName"; ::set Cpp_pensionable_earnings 0.0; } ::set CppMaximum [::expr {$_cppMax/12.0*$Months}]; debugLog "$DedName Prorated maximum for year is $CppMaximum ($_cppMax/12.0*$Months)"; } else { debugLog "$DedName No date of birth, maximum for year is $CppMaximum"; } ::if {[::expr {$Cpp_pensionable_earnings+$YearToDate}]>[::expr {$_cppMaxPE/12.0*$Months}]} { ::set Cpp_pensionable_earnings [::expr {$_cppMaxPE/12.0*$Months-$YearToDate}]; } ::if {$Cpp_pensionable_earnings<0.0} { ::set Cpp_pensionable_earnings 0.0; } ::set Result [CPP_CALC $Cpp_pensionable_earnings $CppMaximum]; ::if {$DedName eq "CPP"} { accountInfoSet ".result.description" "CPP YTD = @Y"; } else { accountInfoSet ".result.description" "QPP YTD = @Y"; } employeeInfoSet ".cpp_pensionable_earnings" $Cpp_pensionable_earnings; ::set _employee_cpp_deduction_period [::expr [accountInfoGet ".amount/pay_period_to_date"]+$Result]; ::if {![stringToNumber [employeeInfoGet ".date_of_birth"]]} { ::set Text "No date of birth found, assuming employee subject to $DedName"; details $Text "warning"; debugLog $Text; } ::return $Result; } public method CPP_CALC {CppEarningsCurrent CppMaximum} { ::if {[employeeInfoGet ".province_of_employment"] ne "PQ"} {::set DedName "CPP";} else {::set DedName "QPP";} debugLog "$DedName Pensionable Earnings, this check: $CppEarningsCurrent"; ::set Result 0.0; ::if {$CppEarningsCurrent==0.0} { debugLog "$DedName earnings 0: no $DedName"; ::return $Result; } ::if {[employeeInfoGet ".federal.cpp_exempt"]} { debugLog "$DedName Employee flagged as is exempt, no $DedName"; ::return $Result; } ::set CppEarningsPayPeriod [employeeDeductionEarningsPayPeriod ".type .cpp_pensionable_earnings"]; ::set CppEarningsBenefits 0.0; ::set CppPensionableEarnings 0.0; ::set CppPensionableEarnings [::qw::number::add $CppPensionableEarnings $CppEarningsCurrent]; ::set CppPensionableEarnings [::qw::number::add $CppPensionableEarnings $CppEarningsPayPeriod]; ::set CppPensionableEarnings [::qw::number::add $CppPensionableEarnings $CppEarningsBenefits]; debugLog "$DedName Pensionable Earnings, previous: $CppEarningsPayPeriod"; debugLog "$DedName Pensionable Benefits: $CppEarningsBenefits"; debugLog "$DedName Total Pensionable Earnings: $CppPensionableEarnings"; ::set Months 12; #// The number of months used to prorate the yearly exemption & maximum ::set PeriodExemption [::expr $_cppExm/[::expr double($_pay_frequency)]]; ::set PeriodExemption [truncate2 $PeriodExemption]; ;#// Drop all digits past 2 (as per T4127) debugLog "$DedName Exemption for period: $PeriodExemption ($_cppExm/[::expr double($_pay_frequency)])"; ::set PriorExemption [employeeDeductionEarningsPayPeriod ".type .cpp_exemption"]; ::if {$PriorExemption!=0.0} { debugLog "$DedName Exemption already used in period: $PriorExemption"; ::set PeriodExemption [::qw::number::subtract $PeriodExemption $PriorExemption]; ::if {$PeriodExemption<0.0} { ::set PeriodExemption 0.0; } } debugLog "$DedName Exemption for this check: $PeriodExemption"; employeeInfoSet ".cpp_exemption" $PeriodExemption; ::if {$PeriodExemption>$CppPensionableEarnings} { ::set PeriodExemption $CppPensionableEarnings; debugLog "$DedName Exemption adjusted to earnings $PeriodExemption"; } ::set CppPensionableEarnings [::expr $CppPensionableEarnings-$PeriodExemption]; ::if {$CppPensionableEarnings<0.0} { ::set CppPensionableEarnings 0.0; } debugLog "$DedName Contributable earnings: $CppPensionableEarnings"; ::set PeriodDeduction [::expr $CppPensionableEarnings*$_cppRate]; ;#// C.P.P. for *entire* pay period ::set PeriodDeduction [round2 $PeriodDeduction]; debugLog "$DedName Deduction for pay-period: $PeriodDeduction ($CppPensionableEarnings*$_cppRate)"; ::set PriorDeduction [accountInfoGet ".amount/pay_period_to_date"]; ::if {$PriorDeduction!=0.0} { debugLog "$DedName Ded. already taken in period: $PriorDeduction"; ::set PeriodDeduction [::qw::number::subtract $PeriodDeduction $PriorDeduction]; } debugLog "$DedName Deduction for this check: $PeriodDeduction"; ::set Limit [::expr $CppMaximum-[accountInfoGet ".amount/year_to_date"]]; ;#// Keep employee from exceeding yearly maximum ::if {$PeriodDeduction>$Limit} { ::set PeriodDeduction $Limit; debugLog "$DedName deduction for maximum reached: $PeriodDeduction ($CppMaximum-[accountInfoGet .amount/year_to_date])"; } ::set Result $PeriodDeduction; ::if {$Result<0.0} { ::set Result 0.0; } ::return $Result; } public method CPP2 {sargs} { ::set Result 0.0; ::set DedName [::sargs::get $sargs .deduction_name]; ::if {[employeeInfoGet ".federal.cpp_exempt"]} { debugLog "$DedName Employee is exempt, no $DedName"; accountInfoSet ".result.description" "$DedName YTD = @Y"; employeeInfoSet ".cpp2_pensionable_earnings" 0; ;#//??? ::return $Result; } ::set Cpp_pensionable_earnings [earningsSubjectTo ".cpp"]; debugLog "$DedName earnings: $Cpp_pensionable_earnings"; ::set Benefits [non_cash_taxable_benefits [::sargs .type "pensionable"]]; debugLog "$DedName pensionable benefits: $Benefits"; ::set Cpp_pensionable_earnings [::qw::number::add $Cpp_pensionable_earnings $Benefits]; debugLog "$DedName total pensionable earnings: $Cpp_pensionable_earnings"; ::set Range [::qw::odb::factory range]; $Range cpp_configure \ -index [$_employee ".paychecks.index/date"] \ -begin ".tag financial .date $_yearBeginDate" \ -end ".tag financial .date $_yearEndDate" \ ; ::set YearToDate [$Range odb_total ".path .cpp_pensionable_earnings .priority foreground"]; debugLog "$DedName pensionable earnings YTD: $YearToDate"; ::if {$Cpp_pensionable_earnings<0.0} { ::set Cpp_pensionable_earnings 0.0; } $Range cpp_destroy; ::set CppMaximum [::sargs::get $sargs .deduction_maximum]; ::set Cpp2_pensionable_earnings 0.0; ::set Months 12; #// The number of months used to prorate the yearly exemption & maximum ::set DateOfBirth [employeeInfoGet ".date_of_birth"]; ::if {[stringToNumber $DateOfBirth]} { debugLog "$DedName date of birth found: $DateOfBirth"; ::set CppStartDate [::qw::date::add $DateOfBirth "year" "18"]; ::set CppStartDate [::qw::date::add $CppStartDate "month" "1"]; ::set CppStartDate [::qw::date::set $CppStartDate "day" "1"]; ::if {[::qw::date::difference $CppStartDate $_date "day"]>0} { debugLog "$DedName Employee is under 18, $DedName exempt"; ::set Cpp_pensionable_earnings 0.0; } ::if {$DedName eq "CPP2"} { ::set Year [::qw::date::get $DateOfBirth "year"]; ::incr Year 70; ::if {$Year>2037} {::set Year 2037;} ::set CppEndDate [::qw::date::add $DateOfBirth "year" 70]; ::set CppEndDate [::qw::date::set $CppEndDate "day" [::qw::date::get $CppEndDate "days_in_month"]]; debugLog "$DedName Employee stops paying $DedName on $CppEndDate"; ::if {[::qw::date::difference $_date $CppEndDate "day"]>0} { debugLog "$DedName Employee is over 70, $DedName exempt"; ::set Cpp_pensionable_earnings 0.0; } } else { ::set CppEndDate [::qw::date::set $DateOfBirth "year" "2037"]; debugLog "$DedName Employee stops paying $DedName on $CppEndDate"; } ::if {[::qw::date::get $CppStartDate "year"]==[::qw::date::get $_date "year"]} { ::incr Months [::expr 1-[::qw::date::get $CppStartDate "month"]]; debugLog "$DedName Employee 18 this year, pays $DedName for $Months months"; } ::if {[::qw::date::get $CppEndDate "year"]==[::qw::date::get $_date "year"]} { ::set Months [::qw::date::get $CppEndDate "month"]; debugLog "$DedName Employee 70 this year, pays $DedName for $Months months"; } ::if {$Months==0} { debugLog "$DedName months are 0, no $DedName"; ::set Cpp_pensionable_earnings 0.0; } ::sargs::var::set sargs .earnings_maximum [::expr {[::sargs::get $sargs .earnings_maximum]/12.0*$Months}]; ::set CppMaximum [::expr {[::sargs::get $sargs .deduction_maximum]/12.0*$Months}]; ::sargs::var::set sargs .deduction_maximum $CppMaximum; ::sargs::var::set sargs .earnings_exempt [::expr {[::sargs::get $sargs .earnings_exempt]/12.0*$Months}]; debugLog "$DedName Prorated maximum for year is $CppMaximum ($_cpp2Max/12.0*$Months)"; } else { debugLog "$DedName No date of birth, maximum for year is $CppMaximum"; } ::set CPPMaxPE [::expr {$_cppMaxPE/12.0*$Months}]; ::set CPP2MaxPE [::sargs::get $sargs .earnings_maximum]; ::if {$DedName eq "CPP2"||$DedName eq "QPP2"} { ::set YTD_Cpp_pensionable_earnings [::expr {$Cpp_pensionable_earnings+$YearToDate}]; ::while {1} { ::if {$YTD_Cpp_pensionable_earnings<=$CPPMaxPE} { ::break; } ::if {$YTD_Cpp_pensionable_earnings<=$CPP2MaxPE} { ::set Cpp2_pensionable_earnings [::expr {$YTD_Cpp_pensionable_earnings-$CPPMaxPE}]; } else { ::set Cpp2_pensionable_earnings [::expr {$CPP2MaxPE-$YearToDate}]; ::if {$Cpp2_pensionable_earnings<0.0} { ::set Cpp2_pensionable_earnings 0.0; ::break; } } ::if {$Cpp2_pensionable_earnings>[::expr {$CPP2MaxPE-$CPPMaxPE}]} { ::set Cpp2_pensionable_earnings [::expr {$CPP2MaxPE-$CPPMaxPE}]; } else { } ::if {$Cpp2_pensionable_earnings>$Cpp_pensionable_earnings} { ::set Cpp2_pensionable_earnings $Cpp_pensionable_earnings; } ::break; } } ::set Result [CPP2_CALC $sargs .earnings_current $Cpp_pensionable_earnings .earnings_ytd $YearToDate .cpp2_pensionable_earnings $Cpp2_pensionable_earnings]; accountInfoSet ".result.description" "$DedName YTD = @Y"; ::if {$Cpp2_pensionable_earnings>0.0} { employeeInfoSet ".cpp_pensionable_earnings" [::expr {[employeeInfoGet .cpp_pensionable_earnings]+$Cpp2_pensionable_earnings}]; } employeeInfoSet ".cpp2_pensionable_earnings" $Cpp2_pensionable_earnings; ::set _employee_cpp2_deduction_period [::expr [accountInfoGet ".amount/pay_period_to_date"]+$Result]; ::if {![stringToNumber [employeeInfoGet ".date_of_birth"]]} { ::set Text "No date of birth found, assuming employee subject to $DedName"; details $Text "warning"; debugLog $Text; } ::return $Result; } public method CPP2_CALC {sargs} { ::set DedName [::sargs::get $sargs .deduction_name]; ::set CppEarningsCurrent [::sargs::get $sargs .earnings_current]; ::set CppMaximum [::sargs::get $sargs .deduction_maximum]; ::set CppExm [::sargs::get $sargs .earnings_exempt]; ::set CppRate [::sargs::get $sargs .deduction_rate]; debugLog "$DedName Pensionable Earnings, this check: $CppEarningsCurrent"; ::set Result 0.0; ::if {$CppEarningsCurrent==0.0} { debugLog "$DedName earnings 0: no $DedName"; ::return $Result; } ::if {[employeeInfoGet ".federal.cpp_exempt"]} { debugLog "$DedName Employee flagged as is exempt, no $DedName"; ::return $Result; } ::set CppEarningsPayPeriod [employeeDeductionEarningsPayPeriod ".type .cpp_pensionable_earnings"]; ::set CppEarningsBenefits 0.0; ::set CppPensionableEarnings 0.0; ::set CppPensionableEarnings [::qw::number::add $CppPensionableEarnings $CppEarningsCurrent]; ::set CppPensionableEarnings [::qw::number::add $CppPensionableEarnings $CppEarningsPayPeriod]; ::set CppPensionableEarnings [::qw::number::add $CppPensionableEarnings $CppEarningsBenefits]; debugLog "$DedName Pensionable Earnings, previous: $CppEarningsPayPeriod"; debugLog "$DedName Pensionable Benefits: $CppEarningsBenefits"; debugLog "$DedName Total Pensionable Earnings: $CppPensionableEarnings"; ::set Months 12; #// The number of months used to prorate the yearly exemption & maximum ::if {$DedName eq "CPP"||$DedName eq "QPP"} { ::set PeriodExemption [::expr $CppExm/[::expr double($_pay_frequency)]]; ::set PeriodExemption [truncate2 $PeriodExemption]; ;#// Drop all digits past 2 (as per T4127) debugLog "$DedName Exemption for period: $PeriodExemption ($CppExm/[::expr double($_pay_frequency)])"; } else { ::set PeriodExemption [::expr {$CppEarningsCurrent-[::sargs::get $sargs .cpp2_pensionable_earnings]}]; } ::if {$DedName eq "CPP"||$DedName eq "QPP"} { debugLog "$DedName Exemption for this check: $PeriodExemption"; employeeInfoSet ".cpp_exemption" $PeriodExemption; } else { ::set PeriodExemption [::expr {$CppPensionableEarnings-[::sargs::get $sargs .cpp2_pensionable_earnings]}]; debugLog "$DedName Exemption for this check: $PeriodExemption"; } ::if {$PeriodExemption>$CppPensionableEarnings} { ::set PeriodExemption $CppPensionableEarnings; debugLog "$DedName Exemption adjusted to earnings $PeriodExemption"; } ::set CppPensionableEarnings [::expr $CppPensionableEarnings-$PeriodExemption]; ::if {$CppPensionableEarnings<0.0} { ::set CppPensionableEarnings 0.0; } debugLog "$DedName Contributable earnings: $CppPensionableEarnings"; ::set PeriodDeduction [::expr $CppPensionableEarnings*$CppRate]; ;#// C.P.P. for *entire* pay period ::set PeriodDeduction [round2 $PeriodDeduction]; debugLog "$DedName Deduction for this check: $PeriodDeduction ($CppPensionableEarnings*$CppRate)"; ::set Limit [::expr $CppMaximum-[accountInfoGet ".amount/year_to_date"]]; ;#// Keep employee from exceeding yearly maximum ::if {$PeriodDeduction>$Limit} { ::set PeriodDeduction $Limit; debugLog "$DedName deduction for maximum reached: $PeriodDeduction ($CppMaximum-[accountInfoGet .amount/year_to_date])"; } ::set Result $PeriodDeduction; ::if {$Result<0.0} { ::set Result 0.0; } ::return $Result; } public method RPP {} { ::set Result 0.0; accountInfoSet ".result.description" "R.P.P. YTD = @Y"; ::set RPPMax $_rppMax; ;#// RPP Maximum ::set RPPYtd [accountInfoGet ".amount/year_to_date"]; ;#// RPP Year to date ::set RPPAllowed [::expr $RPPMax - $RPPYtd]; ;#// RPP Amount Allowed to deduct ::if {[payCodeValueGet ".rate"] ne ""} { ::set Result [payCodeValueGet ".rate"]; ::if {$Result > $RPPAllowed} { ::set Result $RPPAllowed; } ::return $Result; } ::set Percent [::expr [stringToNumber [payCodeValueGet ".percent"]]/100.0]; ::if {$Percent==0.0} {::return 0.0;} ::set Expression [payCodeValueGet ".percentage_base"]; ::if {$Expression ne ""} { ::set PercentageBase [percentage_base [::sargs ".expression" $Expression]]; } else { ::set PercentageBase [taxable_income]; } ::if {$PercentageBase==0.0} {::return 0.0;} ::set Result [round2 [::qw::number::multiply $PercentageBase $Percent]]; ::if {$Result > $RPPAllowed} { ::set Result $RPPAllowed; } ::return $Result; } public method RRSP {} { ::set Result 0.0; accountInfoSet ".result.description" "R.R.S.P. YTD = @Y"; ::set RRSPMax $_rrspMax; ;#// RRSP Maximum ::set RRSPYtd [accountInfoGet ".amount/year_to_date"]; ;#// RRSP Year to date ::set RRSPAllowed [::expr $RRSPMax - $RRSPYtd]; ;#// RRSP Amount Allowed to deduct ::if {[payCodeValueGet ".rate"] ne ""} { ::set Result [payCodeValueGet ".rate"]; ::if {$Result > $RRSPAllowed} { ::set Result $RRSPAllowed; } ::return $Result; } ::set Percent [::expr [stringToNumber [payCodeValueGet ".percent"]]/100.0]; ::if {$Percent==0.0} {::return 0.0;} ::set Expression [payCodeValueGet ".percentage_base"]; ::if {$Expression ne ""} { ::set PercentageBase [percentage_base [::sargs ".expression" $Expression]]; } else { ::set PercentageBase [taxable_income]; } ::if {$PercentageBase==0.0} {::return 0.0;} ::set Result [round2 [::qw::number::multiply $PercentageBase $Percent]]; ::if {$Result > $RRSPAllowed} { ::set Result $RRSPAllowed; } ::return $Result; } public method DONATION {} { ::set Result [percent_or_time_amount_get]; accountInfoSet ".result.description" "Donation"; ::return $Result; } public method UNION {} { ::set Result 0.0; ::if {[payCodeValueGet ".percent"] ne ""} { ::set Result [PER]; } else { ::set Result [TIME]; } ::if {[::file exists [::file join $::qw_program_folder nv2.dat scripts payroll_canada_union_deduction.qw_script]]} { ::set Result [::qw::script::source \ .script.path [::file join $::qw_program_folder nv2.dat scripts payroll_canada_union_deduction.qw_script] \ .database $_database \ .paycheck_date $_date \ .deduction_amount $Result \ .payrun_process_object $this \ ]; } accountInfoSet ".result.description" "Union Dues YTD = @Y"; employeeInfoIncrement ".union_dues" $Result; ::return $Result; } public method MANUAL_TAXCALC {} { ::set Time [payCodeValueGet ".quantity"]; ::set Rate [payCodeValueGet ".rate"]; ::if {![::string is integer $Rate]&&![::string is double $Rate]} {::set Rate 0;} ::if {$Rate eq ""} {::set Rate 0;} ::set Result $Rate; ::if {$Time ne ""} { ::if {![::string is integer $Time]&&![::string is double $Time]} {::set Time 0;} ::if {$Time eq ""} {::set Time 0;} ::set Result [round2 [::qw::number::multiply $Rate $Time]]; } ::return $Result; } public method TAXCALC {} { ::qw::payrun::debug_puts "TAX Calculation starts"; ::set Result 0.0; accountInfoSet ".result.description" "Income Tax YTD = @Y"; ::if {[employeeInfoGet ".federal.tax_exempt"]||[employeeInfoGet ".provincial.tax_exempt"]} { ::return $Result; } ::if {[employeeInfoGet ".federal.manual_tax_calculation"]||[employeeInfoGet ".provincial.manual_tax_calculation"]} { ::set Result [MANUAL_TAXCALC]; debugLog "Manual tax is $Result"; ::return $Result; } ::set NonCashTaxableBenefits 0.0; ::foreach Benefit {1 2 3 4} { ::set Amount [non_cash_taxable_benefit [::sargs .benefit $Benefit .type "taxable"]]; ::if {$Amount==0.0} { ::continue; } ::set Description [employeeInfoGet ".non_cash_taxable_benefits/$Benefit.description"]; employeeInfoSet ".taxable_benefit/$Benefit.amount" $Amount; employeeInfoSet ".taxable_benefit/$Benefit.description" $Description; ::set NonCashTaxableBenefits [::qw::number::add $NonCashTaxableBenefits $Amount]; } ::set NormalPayAccounts [::concat \ [accountsOfTypeXSubjectToY ".type OTHER .subject_to .tax .normal_balance debit"] \ [accountsOfTypeXSubjectToY ".type REGULAR .subject_to .tax"] \ [accountsOfTypeXSubjectToY ".type COMMISSION .subject_to .tax"] \ [accountsOfTypeXSubjectToY ".type STATUTORYHOLIDAY .subject_to .tax"] \ [accountsOfTypeXSubjectToY ".type VACATIONEARNED .subject_to .tax"] \ [accountsOfTypeXSubjectToY ".type VACATIONPAID .subject_to .tax"] \ ]; ::set BonusPayAccounts [::concat \ [accountsOfTypeXSubjectToY ".type BONUS .subject_to .tax"] \ [accountsOfTypeXSubjectToY ".type RETROACTIVEPAYINCREASE .subject_to .tax"] \ ]; ::set PriorBonusPay [accountsEarningsTotal $BonusPayAccounts "pay_period_to_date"]; ::set CurrentBonusPay [accountsEarningsTotal $BonusPayAccounts "now"]; ::set BonusPay [::qw::number::add $PriorBonusPay $CurrentBonusPay]; debugLog "TAX Bonus Pay on prior checks in pp: $PriorBonusPay"; debugLog "TAX Bonus Pay on this check: $CurrentBonusPay"; debugLog "TAX Bonus Pay this pay period: $BonusPay"; ::set BonusTax 0.0; ::if {$BonusPay!=0.00} { debugLog "TAX Bonus amount <> 0.00, doing bonus tax calculatuion"; ::set YtdNormalPay [accountsEarningsTotal $NormalPayAccounts "year_to_date"]; ::set YtdBonusPay [accountsEarningsTotal $BonusPayAccounts "year_to_date"]; ::set YtdUnion [earningsOfType "UNION" -amount ".amount/year_to_date"]; ::set YtdRPP [earningsOfType "RPP" -amount ".amount/year_to_date"]; ::set PrescribedZoneDeduction [employeeInfoGet ".federal.td1_prescribed_zone_deduction"]; ::set TotalRemuneration 0.0; ::set TotalRemuneration [::expr $TotalRemuneration+$YtdNormalPay]; ::set TotalRemuneration [::expr $TotalRemuneration+$YtdBonusPay]; ::set TotalRemuneration [::expr $TotalRemuneration-$YtdUnion]; ::set TotalRemuneration [::expr $TotalRemuneration-$YtdRPP]; ::set TotalRemuneration [::expr $TotalRemuneration-$PrescribedZoneDeduction]; debugLog "TAX Total Remuneration is $TotalRemuneration"; ::if {$TotalRemuneration<=5000.0} { ::set BonusTax [round2 [::expr $BonusPay*0.15]]; debugLog "BONUSTAX Total Remuneration <= 5000.00, tax is 15% of $BonusPay = $BonusTax"; } else { debugLog "BONUSTAX Total Remuneration > 5000.00"; ::set NormalPay [accountsEarningsTotal $NormalPayAccounts "now"]; debugLog "BONUSTAX Normal pay this check: $NormalPay"; ::if {$NormalPay<=0.0&&$_ppNumber>1} { ::set NormalPayForYear [accountsEarningsTotal $NormalPayAccounts "year_to_date"]; ::set ElapsedPayPeriods [::expr $_ppNumber-1]; ::set NormalPay [::qw::number::divide $NormalPayForYear $ElapsedPayPeriods]; debugLog "BONUSTAX Normal pay based on ytd pay $NormalPayForYear / pp $ElapsedPayPeriods: $NormalPay"; } ::if {$NormalPay<=0.0} { ::set NormalPay [employeeInfoGet ".normal_pay"]; debugLog "BONUSTAX Normal from employee setup: $NormalPay"; } debugLog "BONUSTAX NormalPay==$NormalPay"; ::if {$NormalPay<0.0} { ::set NormalPay 0.0; debugLog "BONUSTAX NormalPay==$NormalPay"; } ::if {$NormalPay==0.0} { details "\tNo \"normal pay\" amount found for tax calculation on bonus, doing normal tax calculation." "warning"; debugLog "\tNo \"normal pay\" amount found for tax calculation on bonus, doing normal tax calculation."; ::return [TAX $CurrentBonusPay]; } ::set Amount1 $NormalPay; ;#// ie: $400.00 ::set BonusPayYearToDate [accountsEarningsTotal $BonusPayAccounts "year_to_date"]; ;#// Note: This includes the bonus on this check ::set BonusPayYearToDate [::qw::number::subtract $BonusPayYearToDate $CurrentBonusPay]; ;#// So we subtract it here debugLog "BONUSTAX Year-to date bonuses: $BonusPayYearToDate"; ::set Amount2 [round2 [::qw::number::divide $BonusPayYearToDate $_pay_frequency]]; ;#// ie: $300/52=$5.77 debugLog "BONUSTAX Year-to-date bonuses pro-rated to pay-period: $Amount2"; ::set AdjustedNormalPay1 [::qw::number::add $NormalPay $Amount2]; ;#// ie: $400 + 5.77 = $405.77 debugLog "BONUSTAX Adjusted pay before this bonus: $AdjustedNormalPay1"; ::set Amount3 [round2 [::qw::number::divide $BonusPay $_pay_frequency]]; ;#// ie: $780 / 52 = $15 debugLog "BONUSTAX This bonus pro-rated to pay-period: $Amount3"; ::set AdjustedNormalPay2 [::expr $Amount1+$Amount2+$Amount3]; ;#// ie: $400 + $5.77 + $15 = 420.77 debugLog "BONUSTAX Adjusted pay including this bonus: $AdjustedNormalPay2"; debugLog "BONUSTAX Calculating tax on adjusted pay before this bonus ..."; ::set Tax1 [TAX $AdjustedNormalPay1]; ;#// ie: Tax on $405.77 debugLog "BONUSTAX Tax on adjusted pay before this bonus: $Tax1"; debugLog "BONUSTAX Calculating tax on adjusted pay including this bonus ..."; ::set Tax2 [TAX $AdjustedNormalPay2]; ;#// ie: Tax on $420.77 debugLog "BONUSTAX Tax on adjusted pay including this bonus: $Tax2"; ::set BonusTaxAdditional [::qw::number::subtract $Tax2 $Tax1]; debugLog "BONUSTAX Additional tax on this bonus for 1 pp: $BonusTaxAdditional"; ::set BonusTax [round2 [::qw::number::multiply $BonusTaxAdditional $_pay_frequency]]; debugLog "BONUSTAX Annualized tax on this bonus: $BonusTax"; } } ::set EarningsSubjectToTax [accountsEarningsTotal $NormalPayAccounts "now"]; ::set TaxDeductableAccounts [::concat \ [accountsOfTypeXSubjectToY ".type OTHER .subject_to .tax .normal_balance credit"] \ [accountsOfTypeXSubjectToY ".type RPP .subject_to .tax"] \ [accountsOfTypeXSubjectToY ".type RRSP .subject_to .tax"] \ [accountsOfTypeXSubjectToY ".type UNION .subject_to .tax"] \ ]; ::set DeductionsThatReduceTax [accountsEarningsTotal $TaxDeductableAccounts "now"]; ::set TaxableIncome 0.0; ::set TaxableIncome [::qw::number::add $TaxableIncome $EarningsSubjectToTax]; ::set TaxableIncome [::qw::number::add $TaxableIncome $DeductionsThatReduceTax]; ::set TaxableIncome [::qw::number::add $TaxableIncome $NonCashTaxableBenefits]; debugLog "TAX Regular earnings subject to tax: $EarningsSubjectToTax"; debugLog "TAX Deductions that reduce tax: $DeductionsThatReduceTax"; debugLog "TAX Non-cash Taxable Benefits (this check): $NonCashTaxableBenefits"; debugLog "TAX Taxable earnings: $TaxableIncome"; ::set Result [TAX $TaxableIncome]; debugLog "TAX Tax on $TaxableIncome: $Result"; debugLog "TAX Plus tax on bonus: $BonusTax"; ::set Result [::qw::number::add $Result $BonusTax]; debugLog "TAX Final deduction amount: $Result"; ::return $Result; } public method TAX {TaxableIncomeCurrent} { indentIncrement; ::set Result 0.0; ::set Accounts [::concat \ [accountsOfTypeXSubjectToY ".type OTHER .subject_to .tax"] \ [accountsOfTypeXSubjectToY ".type REGULAR .subject_to .tax"] \ [accountsOfTypeXSubjectToY ".type COMMISSION .subject_to .tax"] \ [accountsOfTypeXSubjectToY ".type STATUTORYHOLIDAY .subject_to .tax"] \ [accountsOfTypeXSubjectToY ".type VACATIONEARNED .subject_to .tax"] \ [accountsOfTypeXSubjectToY ".type VACATIONPAID .subject_to .tax"] \ ]; ::set TaxableIncomePayPeriod [accountsEarningsTotal $Accounts "pay_period_to_date"]; ::set TaxableBenefitsPayPeriod [non_cash_taxable_benefits_period_subject_to [::sargs .type "taxable"]]; ::set TaxableIncome 0.0; ::set TaxableIncome [::expr $TaxableIncome+$TaxableIncomeCurrent]; ::set TaxableIncome [::expr $TaxableIncome+$TaxableIncomePayPeriod]; ::set TaxableIncome [::expr $TaxableIncome+$TaxableBenefitsPayPeriod]; debugLog "TAX Taxable Income, this check: $TaxableIncomeCurrent"; debugLog "TAX Taxable Earnings, prior checks: $TaxableIncomePayPeriod"; debugLog "TAX Taxable benefits, prior checks: $TaxableBenefitsPayPeriod"; debugLog "TAX Total Taxable Income: $TaxableIncome"; ::if {1&&[::qw::date::difference $_date "20230101" "day"]<0} { ::set TaxableIncome [::expr $TaxableIncome*$_pay_frequency]; } else { ::if {$_province_of_employment ne "PQ"} { ::set TaxableIncome [::expr ($TaxableIncome-$_employee_cpp_deduction*(0.0100/0.0595))*$_pay_frequency]; } else { ::set TaxableIncome [::expr ($TaxableIncome-$_employee_cpp_deduction*(0.0100/0.0640))*$_pay_frequency]; } } ::if {$TaxableIncome<=0} { indentDecrement; ::return $Result; } debugLog "TAX Annualized Taxable Income: [round2 $TaxableIncome]"; ::while {1} { ::set Td1_fed_basic_claim $_td1_fed_basic_claim; ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::if {$TaxableIncome>177882} {::set Td1_fed_basic_claim [::expr {$Td1_fed_basic_claim-($TaxableIncome-177882)*0.0210639199279}];} ::if {$TaxableIncome>253414} {::set Td1_fed_basic_claim 14538;} ::break; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::if {$TaxableIncome>173205} {::set Td1_fed_basic_claim [::expr {$Td1_fed_basic_claim-($TaxableIncome-173205)*0.0210613621221}];} ::if {$TaxableIncome>246752} {::set Td1_fed_basic_claim 14156;} ::break; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::if {$TaxableIncome>165430} {::set Td1_fed_basic_claim [::expr {$Td1_fed_basic_claim-($TaxableIncome-165430)*0.0210548793508}];} ::if {$TaxableIncome>235675} {::set Td1_fed_basic_claim 13521;} ::break; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::if {$TaxableIncome>155625} {::set Td1_fed_basic_claim [::expr {$Td1_fed_basic_claim-($TaxableIncome-155625)*0.0254074421560}];} ::if {$TaxableIncome>221708} {::set Td1_fed_basic_claim 12719;} ::break; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::if {$TaxableIncome>151978} {::set Td1_fed_basic_claim [::expr {$Td1_fed_basic_claim-($TaxableIncome-151978)*0.0214928796119}];} ::if {$TaxableIncome>216511} {::set Td1_fed_basic_claim 12421;} ::break; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::if {$TaxableIncome>150473} {::set Td1_fed_basic_claim [::expr {$Td1_fed_basic_claim-($TaxableIncome-150473)*0.0145707801862}];} ::if {$TaxableIncome>214368} {::set Td1_fed_basic_claim 12298;} ::break; } ::break; } ::set FederalTax 0.0; ::if {![employeeInfoGet ".federal.tax_exempt"]} { ::set _td1_federal_claim_amount [employeeInfoGet ".federal.td1_claim_amount"]; ::if {$_td1_federal_claim_amount eq ""} { ::set _td1_federal_claim_amount $Td1_fed_basic_claim; } else { ::if {$_td1_federal_claim_amount>0.0} { ::if {$_td1_federal_claim_amount<$Td1_fed_basic_claim} { ::set Text "Federal TD1 claim amount $_td1_federal_claim_amount is below the minimum, using $Td1_fed_basic_claim"; details $Text "warning"; debugLog $Text; ::set _td1_federal_claim_amount $Td1_fed_basic_claim; } } } ::set TaxableIncomeFederal [::expr $TaxableIncome-[employeeInfoGet ".federal.additional_exemption"]]; ;#// Extra annual Federal exemption indentIncrement; ::if {$_province_of_employment ne "PQ"} { ::set FederalTax [FEDERAL-$_federalTableVersion $TaxableIncomeFederal] } else { ::set FederalTax [PQ-$_federalTableVersion $TaxableIncomeFederal]; } indentDecrement; } else { debugLog "TAX Employee is exempt from Federal tax"; } ::set _fedTax $FederalTax; ::set ProvincialTax 0.0; ::if {![employeeInfoGet ".provincial.tax_exempt"]} { ::if {$_province_of_employment ne "PQ"} { ::set _pClaim [employeeInfoGet ".provincial.td1_claim_amount"]; ::if {$_pClaim eq ""} { ::set _pClaim $_td1_prov_basic_claim; } else { ::if {$_pClaim>0.0} { ::if {$_pClaim<$_td1_prov_basic_claim} { ::set Text "Provincial TD1 claim amount $_pClaim is below the minimum, using $_td1_prov_basic_claim"; details $Text "warning"; debugLog $Text; ::set _pClaim $_td1_prov_basic_claim; } } } ::set TaxableIncomeProvincial $TaxableIncome; ::set TaxableIncomeProvincial [::expr $TaxableIncomeProvincial-[employeeInfoGet ".federal.additional_exemption"]]; ;#// Extra annual Federal exemption (applies to prov. as well.) indentIncrement; ::set ProvincialTax [$_province_of_employment-$_provincialTableVersion $TaxableIncomeProvincial]; indentDecrement; } } else { debugLog "TAX Employee is exempt from Provincial tax"; } ::set _provTax $ProvincialTax; ::set Result [::expr $FederalTax+$ProvincialTax]; ::set Result [::expr $Result/$_pay_frequency]; ::set Result [round2 $Result]; ::set _fedTaxPP [round2 [::expr $FederalTax/$_pay_frequency]]; ::set _provTaxPP [::expr $Result-$_fedTaxPP]; ::set AdditionalTax [employeeInfoGet ".federal.td1_additional_tax"]; ;#// Extra annual tax from federal TD1 debugLog "TAX TD1 Additional tax per pp $AdditionalTax"; ::set Result [::expr $Result+$AdditionalTax]; ::set PriorDeduction [accountInfoGet ".amount/pay_period_to_date"]; ::if {$PriorDeduction != 0.0} { debugLog "TAX Less tax deducted on prior checks: $PriorDeduction"; ::set Result [::expr $Result-$PriorDeduction]; debugLog "TAX Net tax deduction: $Result"; } indentDecrement; ::return $Result; } public method QTAXCALC {} { ::set Result 0.0; accountInfoSet ".result.description" "Quebec Tax YTD = @Y"; ::if {[employeeInfoGet ".quebec.tax_exempt"]} {::return $Result;} ::if {[employeeInfoGet ".quebec.manual_tax_calculation"]} { ::set Result [MANUAL_TAXCALC]; debugLog "Manual tax is $Result"; ::return $Result; } ::set TaxableBenefits [non_cash_taxable_benefits [::sargs .type "quebec_taxable"]]; ::set NonCashTaxableBenefits 0.0; ::foreach Benefit {1 2 3 4} { ::set Amount [non_cash_taxable_benefit [::sargs .benefit $Benefit .type "quebec_taxable"]]; ::if {$Amount==0.0} { ::continue; } ::set Description [employeeInfoGet ".non_cash_taxable_benefits/$Benefit.description"]; employeeInfoSet ".quebec_taxable_benefit/$Benefit.amount" $Amount; employeeInfoSet ".quebec_taxable_benefit/$Benefit.description" $Description; ::set NonCashTaxableBenefits [::qw::number::add $NonCashTaxableBenefits $Amount]; } ::set NormalPayAccounts [::concat \ [accountsOfTypeXSubjectToY ".type OTHER .subject_to .quebec_tax .normal_balance debit"] \ [accountsOfTypeXSubjectToY ".type REGULAR .subject_to .quebec_tax"] \ [accountsOfTypeXSubjectToY ".type COMMISSION .subject_to .quebec_tax"] \ [accountsOfTypeXSubjectToY ".type STATUTORYHOLIDAY .quebec_subject_to .tax"] \ [accountsOfTypeXSubjectToY ".type VACATIONPAID .subject_to .quebec_tax"] \ ]; ::set BonusPayAccounts [::concat \ [accountsOfTypeXSubjectToY ".type BONUS .subject_to .quebec_tax"] \ [accountsOfTypeXSubjectToY ".type RETROACTIVEPAYINCREASE .subject_to .quebec_tax"] \ ]; ::set PriorBonusPay [accountsEarningsTotal $BonusPayAccounts "pay_period_to_date"]; ::set CurrentBonusPay [accountsEarningsTotal $BonusPayAccounts "now"]; ::set BonusPay [::qw::number::add $PriorBonusPay $CurrentBonusPay]; debugLog "QTAX Bonus Pay on prior checks in pp: $PriorBonusPay"; debugLog "QTAX Bonus Pay on this check: $CurrentBonusPay"; debugLog "QTAX Bonus Pay this pay period: $BonusPay"; ::set BonusTax 0.0; ::if {$BonusPay!=0.0} { debugLog "QTAX Bonus amount <> 0.00, doing bonus tax calculatuion"; ::set YtdNormalPay [accountsEarningsTotal $NormalPayAccounts "year_to_date"]; ::set YtdBonusPay [accountsEarningsTotal $BonusPayAccounts "year_to_date"]; ::set YtdUnion [earningsOfType "UNION" -amount ".amount/year_to_date"]; ::set YtdRPP [earningsOfType "RPP" -amount ".amount/year_to_date"]; ::set PrescribedZoneDeduction [employeeInfoGet ".federal.td1_prescribed_zone_deduction"]; ::set TotalRemuneration 0.0; ::set TotalRemuneration [::expr $TotalRemuneration+$YtdNormalPay]; ::set TotalRemuneration [::expr $TotalRemuneration+$YtdBonusPay]; ::set TotalRemuneration [::expr $TotalRemuneration-$YtdUnion]; ::set TotalRemuneration [::expr $TotalRemuneration-$YtdRPP]; ::set TotalRemuneration [::expr $TotalRemuneration-$PrescribedZoneDeduction]; debugLog "QTAX Total Remuneration is $TotalRemuneration"; ::set TotalRemuneration [::expr $TotalRemuneration/$_ppNumber]; ::set TotalRemuneration [round2 [::expr $TotalRemuneration*$_pay_frequency]]; ::if {$TotalRemuneration<=$_quebec_bonus_threshold} { ::set BonusTax [round2 [::expr $BonusPay*0.08]]; debugLog "BONUSTAX Total Remuneration <= $_quebec_bonus_threshold, tax is 8% of $BonusPay = $BonusTax"; } else { debugLog "BONUSTAX Total Remuneration > $_quebec_bonus_threshold"; ::set NormalPay [accountsEarningsTotal $NormalPayAccounts "now"]; debugLog "BONUSTAX Normal pay this check: $NormalPay"; ::if {$NormalPay<=0.0&&$_ppNumber>1} { ::set NormalPayForYear [accountsEarningsTotal $NormalPayAccounts "year_to_date"]; ::set ElapsedPayPeriods [::expr $_ppNumber-1]; ::set NormalPay [::qw::number::divide $NormalPayForYear $ElapsedPayPeriods]; debugLog "BONUSTAX Normal pay based on ytd pay $NormalPayForYear / pp $ElapsedPayPeriods: $NormalPay"; } ::if {$NormalPay<=0.0} { ::set NormalPay [employeeInfoGet ".normal_pay"]; debugLog "BONUSTAX Normal from employee setup: $NormalPay"; } debugLog "BONUSTAX NormalPay==$NormalPay"; ::if {$NormalPay<0.0} { ::set NormalPay 0.0; debugLog "BONUSTAX NormalPay==$NormalPay"; } ::if {$NormalPay==0.0} { ::set Text "\tNo \"normal pay\" amount found for tax calculation on bonus, doing normal tax calculation."; details $Text "warning"; debugLog $Text; ::return [QTAX $CurrentBonusPay]; } ::set Amount1 $NormalPay; ;#// ie: $400.00 ::set BonusPayYearToDate [accountsEarningsTotal $BonusPayAccounts "year_to_date"]; ;#// Note: This includes the bonus on this check ::set BonusPayYearToDate [::qw::number::subtract $BonusPayYearToDate $CurrentBonusPay]; ;#// So we subtract it here debugLog "BONUSTAX Year-to date bonuses: $BonusPayYearToDate"; ::set Amount2 [round2 [::qw::number::divide $BonusPayYearToDate $_pay_frequency]]; ;#// ie: $300/52=$5.77 debugLog "BONUSTAX Year-to-date bonuses pro-rated to pay-period: $Amount2"; ::set AdjustedNormalPay1 [::qw::number::add $NormalPay $Amount2]; ;#// ie: $400 + 5.77 = $405.77 debugLog "BONUSTAX Adjusted pay before this bonus: $AdjustedNormalPay1"; ::set Amount3 [round2 [::qw::number::divide $BonusPay $_pay_frequency]]; ;#// ie: $780 / 52 = $15 debugLog "BONUSTAX This bonus pro-rated to pay-period: $Amount3"; ::set AdjustedNormalPay2 [::expr $Amount1+$Amount2+$Amount3]; ;#// ie: $400 + $5.77 + $15 = 420.77 debugLog "BONUSTAX Adjusted pay including this bonus: $AdjustedNormalPay2"; debugLog "BONUSTAX Calculating tax on adjusted pay before this bonus ..."; ::set Tax1 [QTAX $AdjustedNormalPay1]; ;#// ie: Tax on $405.77 debugLog "BONUSTAX Tax on adjusted pay before this bonus: $Tax1"; debugLog "BONUSTAX Calculating tax on adjusted pay including this bonus ..."; ::set Tax2 [QTAX $AdjustedNormalPay2]; ;#// ie: Tax on $420.77 debugLog "BONUSTAX Tax on adjusted pay including this bonus: $Tax2"; ::set BonusTaxAdditional [::qw::number::subtract $Tax2 $Tax1]; debugLog "BONUSTAX Additional tax on this bonus for 1 pp: $BonusTaxAdditional"; ::set BonusTax [round2 [::qw::number::multiply $BonusTaxAdditional $_pay_frequency]]; debugLog "BONUSTAX Annualized tax on this bonus: $BonusTax"; } } ::set EarningsSubjectToTax [accountsEarningsTotal $NormalPayAccounts "now"]; ::set TaxDeductableAccounts [::concat \ [accountsOfTypeXSubjectToY ".type OTHER .subject_to .quebec_tax .normal_balance credit"] \ [accountsOfTypeXSubjectToY ".type RPP .subject_to .quebec_tax"] \ [accountsOfTypeXSubjectToY ".type RRSP .subject_to .quebec_tax"] \ [accountsOfTypeXSubjectToY ".type UNION .subject_to .quebec_tax"] \ ]; ::set DeductionsThatReduceTax [accountsEarningsTotal $TaxDeductableAccounts "now"]; ::set TaxableIncome 0.0; ::set TaxableIncome [::qw::number::add $TaxableIncome $EarningsSubjectToTax]; ::set TaxableIncome [::qw::number::add $TaxableIncome $DeductionsThatReduceTax]; ::set TaxableIncome [::qw::number::add $TaxableIncome $NonCashTaxableBenefits]; debugLog "QTAX Regular earnings subject to tax: $EarningsSubjectToTax"; debugLog "QTAX Deductions that reduce tax: $DeductionsThatReduceTax"; debugLog "QTAX Non-cash Taxable Benefits (this check) $NonCashTaxableBenefits"; debugLog "QTAX Taxable earnings: $TaxableIncome"; ::set Result [QTAX $TaxableIncome]; debugLog "QTAX Tax on $TaxableIncome: $Result"; debugLog "QTAX Plus tax on bonus: $BonusTax"; ::set Result [::qw::number::add $Result $BonusTax]; debugLog "QTAX Final deduction amount: $Result"; ::return $Result; } public method QTAX {TaxableIncomeCurrent} { ::set Result 0.0; ::set Accounts [::concat \ [accountsOfTypeXSubjectToY ".type OTHER .subject_to .quebec_tax"] \ [accountsOfTypeXSubjectToY ".type REGULAR .subject_to .quebec_tax"] \ [accountsOfTypeXSubjectToY ".type COMMISSION .subject_to .quebec_tax"] \ [accountsOfTypeXSubjectToY ".type STATUTORYHOLIDAY .subject_to .quebec_tax"] \ [accountsOfTypeXSubjectToY ".type VACATIONEARNED .subject_to .quebec_tax"] \ [accountsOfTypeXSubjectToY ".type VACATIONPAID .subject_to .quebec_tax"] \ ]; ::set TaxableIncomePayPeriod [accountsEarningsTotal $Accounts "pay_period_to_date"]; ::set TaxableBenefitsPayPeriod [non_cash_taxable_benefits_period_subject_to [::sargs .type "quebec_taxable"]]; ::set TaxableIncome 0.0; ::set TaxableIncome [::expr $TaxableIncome+$TaxableIncomeCurrent]; ::set TaxableIncome [::expr $TaxableIncome+$TaxableIncomePayPeriod]; ::set TaxableIncome [::expr $TaxableIncome+$TaxableBenefitsPayPeriod]; debugLog "QTAX Taxable Income, this check: $TaxableIncomeCurrent"; debugLog "QTAX Taxable Earnings, prior checks: $TaxableIncomePayPeriod"; debugLog "QTAX Taxable benefits, prior checks: $TaxableBenefitsPayPeriod"; debugLog "QTAX Total Taxable Income: $TaxableIncome"; ::if {1&&[::qw::date::difference $_date "20230101" "day"]<0} { ::set TaxableIncome [::expr $TaxableIncome*$_pay_frequency]; } else { ::set TaxableIncome [::expr ($TaxableIncome-$_employee_cpp_deduction*(0.0100/0.0640))*$_pay_frequency]; } debugLog "QTAX Total Taxable Income Adjusted: $TaxableIncome"; ::if {$TaxableIncome<=0} {::return $Result;} ::set QuebecTax 0.0; ::if {![employeeInfoGet ".quebec.tax_exempt"]} { ::set _pClaim [employeeInfoGet ".quebec.claim_amount"]; ::if {$_pClaim eq ""} { ::set _pClaim $_td1_prov_basic_claim; } else { ::if {$_pClaim>0.0} { ::if {$_pClaim<$_td1_prov_basic_claim} { ::set Text "Quebec claim amount $_pClaim is below the minimum, using $_td1_prov_basic_claim"; details $Text "warning"; debugLog $Text; ::set _pClaim $_td1_prov_basic_claim; } } } ::set TaxableIncomeQuebec [::expr $TaxableIncome-[employeeInfoGet ".quebec.additional_deduction"]]; ;#// Extra annual Quebec exemption indentIncrement; ::set QuebecTax [QT-$_provincialTableVersion $TaxableIncomeQuebec] indentDecrement; } ::set Result [::expr $QuebecTax/$_pay_frequency]; ::set Result [round2 $Result]; ::set AdditionalTax [employeeInfoGet ".quebec.additional_tax"]; ;#// Extra Quebec tax debugLog "QTAX Additional tax per pp $AdditionalTax"; ::set Result [::expr $Result+$AdditionalTax]; ::set PriorDeduction [accountInfoGet ".amount/pay_period_to_date"]; ::if {$PriorDeduction != 0.0} { debugLog "QTAX Less tax deducted on prior checks: $PriorDeduction"; ::set Result [::expr $Result-$PriorDeduction]; debugLog "QTAX Net tax deduction: $Result"; } ::return $Result; } public method INSHOURS {} { ::set Result 0.0; ::if {[accountInfoGet ".result.amount"]==0.0} { ::return $Result; } ::if {[payCodeValueNumber ".insurable_hours"] != 0.0} { ::return [payCodeValueNumber ".insurable_hours"]; } ::if {[::string index [payCodeValueUcase ".insurable_hours"] 0] eq "T"} { ::return [::qw::number::scan [accountInfoGet ".result.quantity"]]; } ::if {[::string index [payCodeValueUcase ".insurable_hours"] 0] eq "C"} { ::if {$_minimum_wage!=0.0} { ::set Result [::expr [accountInfoGet ".result.amount"]/$_minimum_wage]; #// Divide payment by minimum wage ::set Tmp1 [::expr 1820.0/$_pay_frequency]; #// KLUDGE ALERT - Find max hours for PP (1820 = 35 per wk X 52) ::if {$Result>$Tmp1} { ::set Result $Tmp1; } ::set Result [round2 $Result]; }; } ::return $Result; } ::set _cpp_breakpoint "================================================================================================================="; public method set_tax_variables_federal {{s_args ""}} { ::if {[::sargs::get $s_args ".date"] ne ""} { ::set _date [::sargs::get $s_args ".date"]; } ::if {[::qw::date::difference $_date "20250701" "day"]>=0} { ::set _rppMax 33810; ;#// RPP Maximum Annual Contribution ::set _rrspMax 33810; ;#// RRSP Maximum Annual Contribution ::set _td1_fed_basic_claim 16129; #// lowered for high income ::set _eiMaxIE 65700; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0164; ;#// EI Rate ::set _eiMax 1077.48; ;#// EI Maximum deduction ::set _ppipMaxIE 98000; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00494; ;#// PPIP Rate ::set _ppipMax 484.12; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00692"; ::set _quebec_bonus_threshold 16143; ;#// Threshold to determine method to calc source deductions of itax from gratuities and retroactive pay ::set _cppExm 3500.0; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0595; ;#// CPP (and QPP) Rate ::set _cppMax 4034.10; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppBase 3356.10; ;#// CPP (and QPP) Maximum Base Employee and Employer Contribution ::set _cppMaxPE 71300.0; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _cpp2Rate 0.04; ;#// CPP (and QPP) Rate ::set _cpp2Max 396.00; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cpp2MaxPE 81200.0; ;#// CPP2(and QPP2) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20250701; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20250701; ;#// Becomes the suffix for the table method ::return; } ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _rppMax 33810; ;#// RPP Maximum Annual Contribution ::set _rrspMax 33810; ;#// RRSP Maximum Annual Contribution ::set _td1_fed_basic_claim 16129; #// lowered for high income ::set _eiMaxIE 65700; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0164; ;#// EI Rate ::set _eiMax 1077.48; ;#// EI Maximum deduction ::set _ppipMaxIE 98000; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00494; ;#// PPIP Rate ::set _ppipMax 484.12; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00692"; ::set _quebec_bonus_threshold 16143; ;#// Threshold to determine method to calc source deductions of itax from gratuities and retroactive pay ::set _cppExm 3500.0; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0595; ;#// CPP (and QPP) Rate ::set _cppMax 4034.10; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppBase 3356.10; ;#// CPP (and QPP) Maximum Base Employee and Employer Contribution ::set _cppMaxPE 71300.0; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _cpp2Rate 0.04; ;#// CPP (and QPP) Rate ::set _cpp2Max 396.00; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cpp2MaxPE 81200.0; ;#// CPP2(and QPP2) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20250101; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20250101; ;#// Becomes the suffix for the table method ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _rppMax 32490; ;#// RPP Maximum Annual Contribution ::set _rrspMax 32490; ;#// RRSP Maximum Annual Contribution ::set _td1_fed_basic_claim 15705; #// lowered for high income ::set _eiMaxIE 63200; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0166; ;#// EI Rate ::set _eiMax 1049.12; ;#// EI Maximum deduction ::set _ppipMaxIE 94000; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00494; ;#// PPIP Rate ::set _ppipMax 464.36; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00692"; ::set _quebec_bonus_threshold 16143; ;#// Threshold to determine method to calc source deductions of itax from gratuities and retroactive pay ::set _cppExm 3500.0; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0595; ;#// CPP (and QPP) Rate ::set _cppMax 3867.5; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppBase 3123.45; ::set _cppMaxPE 68500.0; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _cpp2Rate 0.04; ;#// CPP (and QPP) Rate ::set _cpp2Max 188.0; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cpp2MaxPE 73200.0; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20240101; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20240101; ;#// Becomes the suffix for the table method ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _rppMax 31560; ;#// RPP Maximum Annual Contribution ::set _rrspMax 31560; ;#// RRSP Maximum Annual Contribution ::set _td1_fed_basic_claim 15000; #// lowered for high income ::set _eiMaxIE 61500; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0163; ;#// EI Rate ::set _eiMax 1002.45; ;#// EI Maximum deduction ::set _ppipMaxIE 91000; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00494; ;#// PPIP Rate ::set _ppipMax 449.54; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00692"; ::set _quebec_bonus_threshold 16143; ;#// Threshold to determine method to calc source deductions of itax from gratuities and retroactive pay ::set _cppExm 3500; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0595; ;#// CPP (and QPP) Rate ::set _cppMax 3754.45; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppBase 3123.45; ::set _cppMaxPE 66600.00; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20230101; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20230101; ;#// Becomes the suffix for the table method ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _rppMax 30780; ;#// RPP Maximum Annual Contribution ::set _rrspMax 30780; ;#// RRSP Maximum Annual Contribution ::set _td1_fed_basic_claim 14398; #// lowered for high income ::set _eiMaxIE 60300; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0158; ;#// EI Rate ::set _eiMax 952.74; ;#// EI Maximum deduction ::set _ppipMaxIE 88000; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00494; ;#// PPIP Rate ::set _ppipMax 434.72; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00692"; ::set _quebec_bonus_threshold 16143; ;#// Threshold to determine method to calc source deductions of itax from gratuities and retroactive pay ::set _cppExm 3500; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0570; ;#// CPP (and QPP) Rate ::set _cppMax 3499.80; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppMaxPE 64900.00; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20220101; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20220101; ;#// Becomes the suffix for the table method ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _rppMax 29210; ;#// RPP Maximum Annual Contribution ::set _rrspMax 29210; ;#// RRSP Maximum Annual Contribution ::set _td1_fed_basic_claim 13808; #// lowered for high income ::set _eiMaxIE 56300; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0158; ;#// EI Rate ::set _eiMax 889.54; ;#// EI Maximum deduction ::set _ppipMaxIE 83500; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00494; ;#// PPIP Rate ::set _ppipMax 412.49; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00692"; ::set _quebec_bonus_threshold 15728; ;#// Threshold to determine method to calc source deductions of itax from gratuities and retroactive pay ::set _cppExm 3500; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0545; ;#// CPP (and QPP) Rate ::set _cppMax 3166.45; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppMaxPE 61600.00; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20210101; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20210101; ;#// Becomes the suffix for the table method ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _rppMax 27830; ;#// RPP Maximum Annual Contribution ::set _rrspMax 27830; ;#// RRSP Maximum Annual Contribution ::set _td1_fed_basic_claim 13229; #// lowered for high income ::set _eiMaxIE 54200; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0158; ;#// EI Rate ::set _eiMax 856.36; ;#// EI Maximum deduction ::set _ppipMaxIE 78500; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00494; ;#// PPIP Rate ::set _ppipMax 387.79; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00692"; ::set _quebec_bonus_threshold 15532; ;#// Threshold to determine method to calc source deductions of itax from gratuities and retroactive pay ::set _cppExm 3500; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0525; ;#// CPP (and QPP) Rate ::set _cppMax 2898.00; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppMaxPE 58700.00; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20200101; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20200101; ;#// Becomes the suffix for the table method ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _rppMax 26500; ;#// RPP Maximum Annual Contribution ::set _rrspMax 26500; ;#// RRSP Maximum Annual Contribution ::set _td1_fed_basic_claim 12069; ;#// Federal basic claim amount ::set _eiMaxIE 53100; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0162; ;#// EI Rate ::set _eiMax 860.22; ;#// EI Maximum deduction ::set _ppipMaxIE 76500; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00526; ;#// PPIP Rate ::set _ppipMax 402.39; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00736"; ::set _quebec_bonus_threshold 14550; ;#// Threshold to determine method to calc source deductions of itax from gratuities and retroactive pay ::set _cppExm 3500; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0510; ;#// CPP (and QPP) Rate ::set _cppMax 2748.90; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppMaxPE 57400.00; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20190101; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20190101; ;#// Becomes the suffix for the table method ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _rppMax 26230; ;#// RPP Maximum Annual Contribution ::set _rrspMax 26230; ;#// RRSP Maximum Annual Contribution ::set _td1_fed_basic_claim 11809; ;#// Federal basic claim amount ::set _eiMaxIE 51700; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0166; ;#// EI Rate ::set _eiMax 858.22; ;#// EI Maximum deduction ::set _ppipMaxIE 74000; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00548; ;#// PPIP Rate ::set _ppipMax 405.52; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00767"; ::set _quebec_bonus_threshold 14550; ;#// Threshold to determine method to calc source deductions of itax from gratuities and retroactive pay ::set _cppExm 3500; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0495; ;#// CPP (and QPP) Rate ::set _cppMax 2593.80; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppMaxPE 55900.00; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20180101; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20180101; ;#// Becomes the suffix for the table method ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _rppMax 26010; ;#// RPP Maximum Annual Contribution ::set _rrspMax 26010; ;#// RRSP Maximum Annual Contribution ::set _td1_fed_basic_claim 11635; ;#// Federal basic claim amount ::set _eiMaxIE 51300; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0163; ;#// EI Rate ::set _eiMax 836.19; ;#// EI Maximum deduction ::set _ppipMaxIE 72500; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00548; ;#// PPIP Rate ::set _ppipMax 397.30; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00767"; ::set _quebec_bonus_threshold 14550; ;#// Threshold to determine method to calc source deductions of itax from gratuities and retroactive pay ::set _cppExm 3500; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0495; ;#// CPP (and QPP) Rate ::set _cppMax 2564.10; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppMaxPE 55300.00; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20170101; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20170101; ;#// Becomes the suffix for the table method ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _rppMax 25370; ;#// RPP Maximum Annual Contribution ::set _rrspMax 25370; ;#// RRSP Maximum Annual Contribution (2009 == 21000, 2010 == 22000) ::set _td1_fed_basic_claim 11474; ;#// Federal basic claim amount ::set _eiMaxIE 50800; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0188; ;#// EI Rate ::set _eiMax 955.04; ;#// EI Maximum deduction ::set _ppipMaxIE 71500; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00548; ;#// PPIP Rate ::set _ppipMax 391.82; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00767"; ::set _quebec_bonus_threshold 14450; ;#// Threshold to determine method to calc source deductions of itax from gratuities and retroactive pay ::set _cppExm 3500; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0495; ;#// CPP (and QPP) Rate ::set _cppMax 2544.30; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppMaxPE 54900.00; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20160101; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20160101; ;#// Becomes the suffix for the table method ::return; } ::if {[::qw::date::difference $_date "20150101" "day"]>=0} { ::set _rppMax 24930; ;#// RPP Maximum Annual Contribution ::set _rrspMax 24930; ;#// RRSP Maximum Annual Contribution (2009 == 21000, 2010 == 22000) ::set _td1_fed_basic_claim 11327; ;#// Federal basic claim amount ::set _eiMaxIE 49500; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0188; ;#// EI Rate ::set _eiMax 930.60; ;#// EI Maximum deduction ::set _ppipMaxIE 70000; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00559; ;#// PPIP Rate ::set _ppipMax 391.30; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00782"; ::set _quebec_bonus_threshold 14300; ;#// Threshold to determine method to calc source deductions of itax from gratuities and retroactive pay ::set _cppExm 3500; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0495; ;#// CPP (and QPP) Rate ::set _cppMax 2479.95; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppMaxPE 53600.00; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20150101; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20150101; ;#// Becomes the suffix for the table method ::return; } ::if {[::qw::date::difference $_date "20140101" "day"]>=0} { ::set _rppMax 24270; ;#// RPP Maximum Annual Contribution ::set _rrspMax 24270; ;#// RRSP Maximum Annual Contribution (2009 == 21000, 2010 == 22000) ::set _td1_fed_basic_claim 11138; ;#// Federal basic claim amount ::set _eiMaxIE 48600; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0188; ;#// EI Rate ::set _eiMax 913.68; ;#// EI Maximum deduction ::set _ppipMaxIE 69000; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00559; ;#// PPIP Rate ::set _ppipMax 385.71; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00782"; ::set _quebec_bonus_threshold 14130; ;#// Threshold to determine method to calc source deductions of itax from gratuities and retroactive pay ::set _cppExm 3500; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0495; ;#// CPP (and QPP) Rate ::set _cppMax 2425.50; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppMaxPE 52500.00; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20140101; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20140101; ;#// Becomes the suffix for the table method ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _rppMax 23820; ;#// RPP Maximum Annual Contribution ::set _rrspMax 23820; ;#// RRSP Maximum Annual Contribution (2009 == 21000, 2010 == 22000) ::set _td1_fed_basic_claim 11038; ;#// Federal basic claim amount ::set _eiMaxIE 47400; ;#// EI Maximum Annual Insurable Earnings ::set _eiRate 0.0188; ;#// EI Rate ::set _eiMax 891.12; ;#// EI Maximum deduction ::set _ppipMaxIE 67500; ;#// PPIP Maximum Annual Insurable Earnings ::set _ppipRate 0.00559; ;#// PPIP Rate ::set _ppipMax 377.33; ;#// PPIP Maximum deduction ::set _employerPpipRate "0.00782"; ::set _quebec_bonus_threshold 14000; ;#// Threshold to determine tax calc for bonuses ::set _cppExm 3500; ;#// CPP (and QPP) Basic Exemption ::set _cppRate 0.0495; ;#// CPP (and QPP) Rate ::set _cppMax 2356.20; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppMaxPE 51100.00; ;#// CPP (and QPP) Maximum Annual Pensionable Earnings ::set _eEiRate 1.40; ;#// (default) EI Employer Contribution Rate ::set _federalTableVersion 20130101; ;#// Becomes the suffix for the table method ::set _provincialTableVersion 20130101; ;#// Becomes the suffix for the table method ::return; } } public method tax_variables_federal_get {} { ::lappend List _rppMax; ::lappend List _rrspMax; ::lappend List _td1_fed_basic_claim; ::lappend List _eiMaxIE; ::lappend List _eiRate; ::lappend List _eiMax; ::lappend List _ppipMaxIE; ::lappend List _ppipRate; ::lappend List _ppipMax; ::lappend List _employerPpipRate; ::lappend List _quebec_bonus_threshold; ::lappend List _cppExm; ::lappend List _cppRate; ::lappend List _cppMax; ::lappend List _cppMaxPE; ::lappend List _cpp2Rate; ::lappend List _cpp2Max; ::lappend List _cpp2MaxPE; ::lappend List _eEiRate; ::lappend List _federalTableVersion; ::lappend List _provincialTableVersion; ::foreach Var $List { ::sargs::var::set Result ".$Var" [::set $Var]; } ::return $Result; } public method tax_variables_provincial_get {} { ::lappend List _minimum_wage; ::lappend List _td1_prov_basic_claim; ::lappend List _WCBMaxAE; ::lappend List _provincialTableVersion; ::lappend List _eiRate; ;#// Quebec EI Rate ::lappend List _eiMaxIE; ;#// Quebec EI Maximum Annual Insurable Earnings ::lappend List _eiMax; ;#// Quebec EI Maximum deduction ::foreach Var $List { ::sargs::var::set Result ".$Var" [::set $Var]; } ::return $Result; } public method set_tax_variables_provincial {{s_args ""}} { ::if {[::sargs::get $s_args ".date"] ne ""} { ::set _date [::sargs::get $s_args ".date"]; } ::if {[::sargs::get $s_args ".province"] ne ""} { ::set _province_of_employment [::sargs::get $s_args ".province"]; } ::switch $_province_of_employment { "AB" { ::if {[::qw::date::difference $_date "20250701" "day"]>=0} { ::set _minimum_wage 15.00; ::set _td1_prov_basic_claim 22323; ::set _WCBMaxAE 106400; ::set _provincialTableVersion 20250701; ::return; } ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _minimum_wage 15.00; ::set _td1_prov_basic_claim 22323; ::set _WCBMaxAE 104600; ::set _provincialTableVersion 20250101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _minimum_wage 15.00; ::set _td1_prov_basic_claim 21885; ::set _WCBMaxAE 104600; ::set _provincialTableVersion 20240101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _minimum_wage 15.00; ::set _td1_prov_basic_claim 21003; ::set _WCBMaxAE 102100; ::set _provincialTableVersion 20230101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _minimum_wage 15.00; ::set _td1_prov_basic_claim 19369; ::set _WCBMaxAE 98700; ::set _provincialTableVersion 20190101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _minimum_wage 15.00; ::set _td1_prov_basic_claim 19369; ::set _WCBMaxAE 98700; ::set _provincialTableVersion 20190101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _minimum_wage 15.00; ::set _td1_prov_basic_claim 19369; ::set _WCBMaxAE 98700; ::set _provincialTableVersion 20190101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _minimum_wage 15.00; ::set _td1_prov_basic_claim 19369; ::set _WCBMaxAE 98700; ::set _provincialTableVersion 20190101; ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _minimum_wage 13.60; ::set _td1_prov_basic_claim 18915; ::set _WCBMaxAE 98700; ::set _provincialTableVersion 20180101; ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _minimum_wage 12.20; ::set _td1_prov_basic_claim 18690; ::set _WCBMaxAE 98700; ::set _provincialTableVersion 20170101; ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _minimum_wage 11.20; ::set _td1_prov_basic_claim 18451; ::set _WCBMaxAE 98700; ::set _provincialTableVersion 20151001; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20151001" "day"]>=0} { ::set _minimum_wage 10.20; ::set _td1_prov_basic_claim 18214; ::set _WCBMaxAE 90200; ::set _provincialTableVersion 20151001; ::return; } ::if {[::qw::date::difference $_date "20150101" "day"]>=0} { ::set _minimum_wage 10.20; ::set _td1_prov_basic_claim 18214; ::set _WCBMaxAE 90200; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20140101" "day"]>=0} { ::set _minimum_wage 9.95; ::set _td1_prov_basic_claim 17787; ::set _WCBMaxAE 90200; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _minimum_wage 9.75; ::set _td1_prov_basic_claim 17593; ::set _WCBMaxAE 90200; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } } "BC" { ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _minimum_wage 17.40; ::set _td1_prov_basic_claim 12932; ::set _WCBMaxAE 121500; ::set _provincialTableVersion 20250101; ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _minimum_wage 16.75; ::set _td1_prov_basic_claim 12580; ::set _WCBMaxAE 116700; ::set _provincialTableVersion 20240101; ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _minimum_wage 15.65; ::set _td1_prov_basic_claim 11981; ::set _WCBMaxAE 112800; ::set _provincialTableVersion 20230101; ::return; } ::if {[::qw::date::difference $_date "20220701" "day"]>=0} { ::set _minimum_wage 15.20; ::set _td1_prov_basic_claim 11302; ::set _WCBMaxAE 108400; ::set _provincialTableVersion 20220701; ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _minimum_wage 15.20; ::set _td1_prov_basic_claim 11302; ::set _WCBMaxAE 108400; ::set _provincialTableVersion 20220101; ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _minimum_wage 14.60; ::set _td1_prov_basic_claim 11070; ::set _WCBMaxAE 100000; ::set _provincialTableVersion 20210101; ::return; } ::if {[::qw::date::difference $_date "20200701" "day"]>=0} { ::set _minimum_wage 14.60; ::set _td1_prov_basic_claim 10949; ::set _WCBMaxAE 87100; ::set _provincialTableVersion 20200701; ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _minimum_wage 12.85; ::set _td1_prov_basic_claim 10949; ::set _WCBMaxAE 87100; ::set _provincialTableVersion 20200101; ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _minimum_wage 12.65; ::set _td1_prov_basic_claim 10682; ::set _WCBMaxAE 84800; ::set _provincialTableVersion 20190101; ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _minimum_wage 11.35; ::set _td1_prov_basic_claim 10412; ::set _WCBMaxAE 82700; ::set _provincialTableVersion 20180101; ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _minimum_wage 10.85; ::set _td1_prov_basic_claim 10208; ::set _WCBMaxAE 81900; ::set _provincialTableVersion 20170101; ::return; } ::if {[::qw::date::difference $_date "20160701" "day"]>=0} { ::set _minimum_wage 10.45; ::set _td1_prov_basic_claim 10027; ::set _WCBMaxAE 80600; ::set _provincialTableVersion 20160701; ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _minimum_wage 10.45; ::set _td1_prov_basic_claim 10027; ::set _WCBMaxAE 80600; ::set _provincialTableVersion 20160101; ::return; } ::if {[::qw::date::difference $_date "20150701" "day"]>=0} { ::set _minimum_wage 10.25; ::set _td1_prov_basic_claim 9938; ::set _WCBMaxAE 75700; ::set _provincialTableVersion 20150701; ::return; } ::if {[::qw::date::difference $_date "20150101" "day"]>=0} { ::set _minimum_wage 10.25; ::set _td1_prov_basic_claim 9938; ::set _WCBMaxAE 75700; ::set _provincialTableVersion 20150101; ::return; } ::if {[::qw::date::difference $_date "20140101" "day"]>=0} { ::set _minimum_wage 10.25; ::set _td1_prov_basic_claim 9869; ::set _WCBMaxAE 75700; ::set _provincialTableVersion 20140101; ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _minimum_wage 9.50; ::set _td1_prov_basic_claim 10276; ::set _WCBMaxAE 75700; ::set _provincialTableVersion 20130101; ::return; } } "MB" { ::if {[::qw::date::difference $_date "20250701" "day"]>=0} { ::set _minimum_wage 15.80; ::set _td1_prov_basic_claim 15591; ::set _WCBMaxAE 167050; ::set _provincialTableVersion 20250701; ::return; } ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _minimum_wage 15.80; ::set _td1_prov_basic_claim 15969; ::set _WCBMaxAE 167050; ::set _provincialTableVersion 20250101; ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _minimum_wage 15.30; ::set _td1_prov_basic_claim 15780; ::set _WCBMaxAE 160510; ::set _provincialTableVersion 20240101; ::return; } ::if {[::qw::date::difference $_date "20230701" "day"]>=0} { ::set _minimum_wage 13.50; ::set _td1_prov_basic_claim 19145; ::set _WCBMaxAE 153380; ::set _provincialTableVersion 20230701; ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _minimum_wage 13.50; ::set _td1_prov_basic_claim 10855; ::set _WCBMaxAE 153380; ::set _provincialTableVersion 20230101; ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _minimum_wage 11.95; ::set _td1_prov_basic_claim 10145; ::set _WCBMaxAE 150000; ::set _provincialTableVersion 20220101; ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _minimum_wage 11.90; ::set _td1_prov_basic_claim 9936; ::set _WCBMaxAE 127000; ::set _provincialTableVersion 20210101; ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _minimum_wage 11.65; ::set _td1_prov_basic_claim 9838; ::set _WCBMaxAE 127000; ::set _provincialTableVersion 20200101; ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _minimum_wage 11.35; ::set _td1_prov_basic_claim 9626; ::set _WCBMaxAE 127000; ::set _provincialTableVersion 20190101; ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _minimum_wage 11.15; ::set _td1_prov_basic_claim 9382; ::set _WCBMaxAE 127000; ::set _provincialTableVersion 20180101; ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _minimum_wage 11.00; ::set _td1_prov_basic_claim 9271; ::set _WCBMaxAE 127000; ::set _provincialTableVersion 20170101; ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _minimum_wage 11.00; ::set _td1_prov_basic_claim 9134; ::set _WCBMaxAE 125000; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20150101" "day"]>=0} { ::set _minimum_wage 10.70; ::set _td1_prov_basic_claim 9134; ::set _WCBMaxAE 111000; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20140101" "day"]>=0} { ::set _minimum_wage 10.45; ::set _td1_prov_basic_claim 9134; ::set _WCBMaxAE 111000; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _minimum_wage 10.25; ::set _td1_prov_basic_claim 8884; ::set _WCBMaxAE 111000; ;#// only change ::set _provincialTableVersion 20090101; ;#// no changes ::return; } } "NB" { ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _minimum_wage 15.30; ::set _td1_prov_basic_claim 13396; ::set _WCBMaxAE 84200; ::set _provincialTableVersion 20250101; ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _minimum_wage 14.75; ::set _td1_prov_basic_claim 13044; ::set _WCBMaxAE 76900; ::set _provincialTableVersion 20240101; ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _minimum_wage 13.75; ::set _td1_prov_basic_claim 12458; ::set _WCBMaxAE 74800; ::set _provincialTableVersion 20230101; ::return; } ::if {[::qw::date::difference $_date "20220701" "day"]>=0} { ::set _minimum_wage 11.75; ::set _td1_prov_basic_claim 12623; ::set _WCBMaxAE 69200; ::set _provincialTableVersion 20220101; ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _minimum_wage 11.75; ::set _td1_prov_basic_claim 10817; ::set _WCBMaxAE 69200; ::set _provincialTableVersion 20220101; ::return; } ::if {[::qw::date::difference $_date "20210701" "day"]>=0} { ::set _minimum_wage 11.70; ::set _td1_prov_basic_claim 10564; ::set _WCBMaxAE 67100; ::set _provincialTableVersion 20210701; ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _minimum_wage 11.70; ::set _td1_prov_basic_claim 10564; ::set _WCBMaxAE 67100; ::set _provincialTableVersion 20210101; ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _minimum_wage 11.50; ::set _td1_prov_basic_claim 10459; ::set _WCBMaxAE 66200; ::set _provincialTableVersion 20200101; ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _minimum_wage 11.25; ::set _td1_prov_basic_claim 10264; ::set _WCBMaxAE 64800; ::set _provincialTableVersion 20190101; ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _minimum_wage 11.00; ::set _td1_prov_basic_claim 10043; ::set _WCBMaxAE 63600; ::set _provincialTableVersion 20180101; ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _minimum_wage 10.65; ::set _td1_prov_basic_claim 9895; ::set _WCBMaxAE 62700; ::set _provincialTableVersion 20170101; ::return; } ::if {[::qw::date::difference $_date "20160701" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 9758; ::set _WCBMaxAE 61800; ::set _provincialTableVersion 20160701; ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 9758; ::set _WCBMaxAE 61800; ::set _provincialTableVersion 20160101; ::return; } ::if {[::qw::date::difference $_date "20150701" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 9633; ::set _WCBMaxAE 60100; ::set _provincialTableVersion 20150701; ::return; } ::if {[::qw::date::difference $_date "20150101" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 9633; ::set _WCBMaxAE 60100; ::set _provincialTableVersion 20150101; ::return; } ::if {[::qw::date::difference $_date "20140101" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 9472; ::set _WCBMaxAE 60100; ::set _provincialTableVersion 20140101; ::return; } ::if {[::qw::date::difference $_date "20130701" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 9388; ::set _WCBMaxAE 58100; ::set _provincialTableVersion 20130701; ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 9388; ::set _WCBMaxAE 58100; ::set _provincialTableVersion 20130101; ::return; } } "NL" { ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _minimum_wage 15.60; ::set _td1_prov_basic_claim 11067; ::set _WCBMaxAE 79345; ::set _provincialTableVersion 20250101; ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _minimum_wage 15.00; ::set _td1_prov_basic_claim 10818; ::set _WCBMaxAE 76955; ::set _provincialTableVersion 20240101; ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _minimum_wage 13.80; ::set _td1_prov_basic_claim 10382; ::set _WCBMaxAE 72870; ::set _provincialTableVersion 20230101; ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _minimum_wage 12.75; ::set _td1_prov_basic_claim 9803; ::set _WCBMaxAE 69005; ::set _provincialTableVersion 20220101; ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _minimum_wage 12.15; ::set _td1_prov_basic_claim 9536; ::set _WCBMaxAE 67985; ::set _provincialTableVersion 20210101; ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _minimum_wage 11.40; ::set _td1_prov_basic_claim 9498; ::set _WCBMaxAE 66980; ::set _provincialTableVersion 20200101; ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _minimum_wage 11.15; ::set _td1_prov_basic_claim 9414; ::set _WCBMaxAE 65600; ::set _provincialTableVersion 20190101; ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _minimum_wage 11.00; ::set _td1_prov_basic_claim 9247; ::set _WCBMaxAE 64375; ::set _provincialTableVersion 20180101; ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _minimum_wage 10.50; ::set _td1_prov_basic_claim 8978; ::set _WCBMaxAE 63420; ::set _provincialTableVersion 20170101; ::return; } ::if {[::qw::date::difference $_date "20160701" "day"]>=0} { ::set _minimum_wage 10.50; ::set _td1_prov_basic_claim 8802; ::set _WCBMaxAE 62540; ::set _provincialTableVersion 20160701; ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _minimum_wage 10.50; ::set _td1_prov_basic_claim 8802; ::set _WCBMaxAE 62540; ::set _provincialTableVersion 20160101; ::return; } ::if {[::qw::date::difference $_date "20150701" "day"]>=0} { ::set _minimum_wage 10.25; ::set _td1_prov_basic_claim 8767; ::set _WCBMaxAE 54155; ::set _provincialTableVersion 20150701; ::return; } ::if {[::qw::date::difference $_date "20150101" "day"]>=0} { ::set _minimum_wage 10.25; ::set _td1_prov_basic_claim 8767; ::set _WCBMaxAE 54155; ::set _provincialTableVersion 20150101; ::return; } ::if {[::qw::date::difference $_date "20140101" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 8578; ::set _WCBMaxAE 54155; ::set _provincialTableVersion 20140101; ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 8451; ::set _WCBMaxAE 54155; ::set _provincialTableVersion 20130101; ::return; } } "NS" { ::if {[::qw::date::difference $_date "20250701" "day"]>=0} { ::set _minimum_wage 15.20; ::set _td1_prov_basic_claim 11744; ::set _WCBMaxAE 76300; ::set _provincialTableVersion 20250701; ::return; } ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _minimum_wage 15.20; ::set _td1_prov_basic_claim 11744; ::set _WCBMaxAE 76300; ::set _provincialTableVersion 20250101; ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _minimum_wage 15.00; ::set _td1_prov_basic_claim 11481; ::set _WCBMaxAE 72500; ::set _provincialTableVersion 20240101; ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _minimum_wage 13.60; ::set _td1_prov_basic_claim 11481; ::set _WCBMaxAE 69800; ::set _provincialTableVersion 20230101; ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _minimum_wage 12.95; ::set _td1_prov_basic_claim 11481; ::set _WCBMaxAE 69000; ::set _provincialTableVersion 20180101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _minimum_wage 12.55; ::set _td1_prov_basic_claim 11481; ::set _WCBMaxAE 64500; ::set _provincialTableVersion 20180101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _minimum_wage 11.55; ::set _td1_prov_basic_claim 11481; ::set _WCBMaxAE 62000; ::set _provincialTableVersion 20180101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _minimum_wage 11.00; ::set _td1_prov_basic_claim 11481; ::set _WCBMaxAE 59800; ::set _provincialTableVersion 20180101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _minimum_wage 10.85; ::set _td1_prov_basic_claim 11481; ::set _WCBMaxAE 59800; ::set _provincialTableVersion 20180101; ;#// new Basic Personal Amount 25,000 ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _minimum_wage 10.70; ::set _td1_prov_basic_claim 8481; ::set _WCBMaxAE 59300; ::set _provincialTableVersion 20110101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _minimum_wage 10.60; ::set _td1_prov_basic_claim 8481; ::set _WCBMaxAE 58200; ::set _provincialTableVersion 20110101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20150101" "day"]>=0} { ::set _minimum_wage 10.40; ::set _td1_prov_basic_claim 8481; ::set _WCBMaxAE 56000; ::set _provincialTableVersion 20110101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20140101" "day"]>=0} { ::set _minimum_wage 10.30; ::set _td1_prov_basic_claim 8481; ::set _WCBMaxAE 56000; ::set _provincialTableVersion 20110101; ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _minimum_wage 10.15; ::set _td1_prov_basic_claim 8481; ::set _WCBMaxAE 54400; ::set _provincialTableVersion 20110101; ::return; } } "NT" { ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _minimum_wage 16.70; ::set _td1_prov_basic_claim 17842; ::set _WCBMaxAE 112600; ::set _provincialTableVersion 20250101; ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _minimum_wage 16.05; ::set _td1_prov_basic_claim 17373; ::set _WCBMaxAE 110600; ::set _provincialTableVersion 20240101; ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _minimum_wage 15.20; ::set _td1_prov_basic_claim 16593; ::set _WCBMaxAE 107400; ::set _provincialTableVersion 20230101; ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _minimum_wage 15.20; ::set _td1_prov_basic_claim 15609; ::set _WCBMaxAE 102200; ::set _provincialTableVersion 20220101; ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _minimum_wage 13.46; ::set _td1_prov_basic_claim 15243; ::set _WCBMaxAE 97300; ::set _provincialTableVersion 20210101; ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _minimum_wage 13.46; ::set _td1_prov_basic_claim 15093; ::set _WCBMaxAE 94500; ::set _provincialTableVersion 20200101; ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _minimum_wage 13.46; ::set _td1_prov_basic_claim 14811; ::set _WCBMaxAE 90600; ::set _provincialTableVersion 20190101; ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _minimum_wage 12.50; ::set _td1_prov_basic_claim 14492; ::set _WCBMaxAE 90600; ::set _provincialTableVersion 20180101; ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _minimum_wage 12.50; ::set _td1_prov_basic_claim 14278; ::set _WCBMaxAE 90600; ::set _provincialTableVersion 20170101; ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _minimum_wage 12.50; ::set _td1_prov_basic_claim 14081; ::set _WCBMaxAE 88600; ::set _provincialTableVersion 20160101; ::return; } ::if {[::qw::date::difference $_date "20150101" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 13900; ::set _WCBMaxAE 84200; ::set _provincialTableVersion 20150101; ::return; } ::if {[::qw::date::difference $_date "20140101" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 13668; ::set _WCBMaxAE 84200; ::set _provincialTableVersion 20140101; ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 13546; ::set _WCBMaxAE 84200; ::set _provincialTableVersion 20130101; ::return; } } "NU" { ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _minimum_wage 19.00; ::set _td1_prov_basic_claim 19274; ::set _WCBMaxAE 113900; ::set _provincialTableVersion 20250101; ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _minimum_wage 16.00; ::set _td1_prov_basic_claim 18767; ::set _WCBMaxAE 110600; ::set _provincialTableVersion 20240101; ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _minimum_wage 16.00; ::set _td1_prov_basic_claim 17925; ::set _WCBMaxAE 107400; ::set _provincialTableVersion 20230101; ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _minimum_wage 16.00; ::set _td1_prov_basic_claim 16862; ::set _WCBMaxAE 102200; ::set _provincialTableVersion 20220101; ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _minimum_wage 16.00; ::set _td1_prov_basic_claim 16467; ::set _WCBMaxAE 97300; ::set _provincialTableVersion 20210101; ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _minimum_wage 13.00; ::set _td1_prov_basic_claim 16304; ::set _WCBMaxAE 94500; ::set _provincialTableVersion 20200101; ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _minimum_wage 13.00; ::set _td1_prov_basic_claim 13618; ::set _WCBMaxAE 90600; ::set _provincialTableVersion 20190101; ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _minimum_wage 13.00; ::set _td1_prov_basic_claim 13325; ::set _WCBMaxAE 90600; ::set _provincialTableVersion 20180101; ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _minimum_wage 13.00; ::set _td1_prov_basic_claim 13128; ::set _WCBMaxAE 90600; ::set _provincialTableVersion 20170101; ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _minimum_wage 11.00; ::set _td1_prov_basic_claim 12947; ::set _WCBMaxAE 88600; ::set _provincialTableVersion 20160101; ::return; } ::if {[::qw::date::difference $_date "20150101" "day"]>=0} { ::set _minimum_wage 11.00; ::set _td1_prov_basic_claim 12781; ::set _WCBMaxAE 84200; ::set _provincialTableVersion 20150101; ::return; } ::if {[::qw::date::difference $_date "20140101" "day"]>=0} { ::set _minimum_wage 11.00; ::set _td1_prov_basic_claim 12567; ::set _WCBMaxAE 84200; ::set _provincialTableVersion 20140101; ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _minimum_wage 11.00; ::set _td1_prov_basic_claim 12455; ::set _WCBMaxAE 84200; ::set _provincialTableVersion 20130101; ::return; } } "ON" { ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _minimum_wage 17.20; ::set _td1_prov_basic_claim 12747; ::set _WCBMaxAE 117000; ::set _provincialTableVersion 20250101; ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _minimum_wage 16.55; ::set _td1_prov_basic_claim 12399; ::set _WCBMaxAE 112500; ::set _provincialTableVersion 20240101; ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _minimum_wage 15.50; ::set _td1_prov_basic_claim 11865; ::set _WCBMaxAE 110000; ::set _provincialTableVersion 20230101; ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _minimum_wage 14.35; ::set _td1_prov_basic_claim 11141; ::set _WCBMaxAE 100422; ::set _provincialTableVersion 20220101; ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _minimum_wage 14.25; ::set _td1_prov_basic_claim 10880; ::set _WCBMaxAE 97308; ::set _provincialTableVersion 20210101; ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _minimum_wage 14.00; ::set _td1_prov_basic_claim 10783; ::set _WCBMaxAE 95400; ::set _provincialTableVersion 20200101; ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _minimum_wage 14.00; ::set _td1_prov_basic_claim 10582; ::set _WCBMaxAE 90300; ::set _provincialTableVersion 20190101; ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _minimum_wage 14.00; ::set _td1_prov_basic_claim 10354; ::set _WCBMaxAE 90300; ::set _provincialTableVersion 20180101; ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _minimum_wage 11.40; ::set _td1_prov_basic_claim 10171; ::set _WCBMaxAE 88500; ::set _provincialTableVersion 20170101; ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _minimum_wage 11.25; ::set _td1_prov_basic_claim 10011; ::set _WCBMaxAE 88000; ::set _provincialTableVersion 20160101; ::return; } ::if {[::qw::date::difference $_date "20150101" "day"]>=0} { ::set _minimum_wage 11.00; ::set _td1_prov_basic_claim 9863; ::set _WCBMaxAE 84100; ::set _provincialTableVersion 20150101; ::return; } ::if {[::qw::date::difference $_date "20140901" "day"]>=0} { ::set _minimum_wage 11.00; ::set _td1_prov_basic_claim 9670; ::set _WCBMaxAE 84100; ::set _provincialTableVersion 20140901; ::return; } ::if {[::qw::date::difference $_date "20140101" "day"]>=0} { ::set _minimum_wage 10.25; ::set _td1_prov_basic_claim 9670; ::set _WCBMaxAE 84100; ::set _provincialTableVersion 20140101; ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _minimum_wage 10.25; ::set _td1_prov_basic_claim 9574; ::set _WCBMaxAE 83200; ::set _provincialTableVersion 20130101; ::return; } } "PE" { ::if {[::qw::date::difference $_date "20250701" "day"]>=0} { ::set _minimum_wage 16.00; ::set _td1_prov_basic_claim 15050; ::set _WCBMaxAE 82900; ::set _provincialTableVersion 20250101; ::return; } ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _minimum_wage 16.00; ::set _td1_prov_basic_claim 14650; ::set _WCBMaxAE 82900; ::set _provincialTableVersion 20250101; ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _minimum_wage 15.00; ::set _td1_prov_basic_claim 13500; ::set _WCBMaxAE 78400; ::set _provincialTableVersion 20240101; ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _minimum_wage 13.70; ::set _td1_prov_basic_claim 12000; ::set _WCBMaxAE 65000; ::set _provincialTableVersion 20230101; ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _minimum_wage 13.00; ::set _td1_prov_basic_claim 11250; ::set _WCBMaxAE 58300; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _minimum_wage 12.85; ::set _td1_prov_basic_claim 10500; ::set _WCBMaxAE 55300; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _minimum_wage 12.25; ::set _td1_prov_basic_claim 10000; ::set _WCBMaxAE 55300; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _minimum_wage 11.55; ::set _td1_prov_basic_claim 9160; ::set _WCBMaxAE 55000; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20180701" "day"]>=0} { ::set _minimum_wage 11.55; ::set _td1_prov_basic_claim 9160; ::set _WCBMaxAE 53400; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _minimum_wage 11.25; ::set _td1_prov_basic_claim 8160; ::set _WCBMaxAE 53400; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20170701" "day"]>=0} { ::set _minimum_wage 10.75; ::set _td1_prov_basic_claim 8320; ::set _WCBMaxAE 52800; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _minimum_wage 10.75; ::set _td1_prov_basic_claim 8000; ::set _WCBMaxAE 52800; ::set _provincialTableVersion 20090101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20160701" "day"]>=0} { ::set _minimum_wage 10.50; ::set _td1_prov_basic_claim 8292; ::set _WCBMaxAE 52200; ::set _provincialTableVersion 20090101; ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _minimum_wage 10.50; ::set _td1_prov_basic_claim 7708; ::set _WCBMaxAE 52200; ::set _provincialTableVersion 20090101; ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 7708; ::set _WCBMaxAE 50000; ::set _provincialTableVersion 20090101; ::return; } } "PQ" { ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _minimum_wage 15.75; ::set _td1_prov_basic_claim 18571; ::set _WCBMaxAE 98000; ::set _provincialTableVersion 20250101; ::set _eiRate .0131; ;#// Quebec EI Rate ::set _eiMaxIE 65700; ;#// Quebec EI Maximum Annual Insurable Earnings ::set _eiMax 860.67; ;#// Quebec EI Maximum deduction ::set _cppRate 0.06400; ;#// CPP (and QPP) Rate ::set _cppMax 4339.20; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppBase 3661.20; ;#// QPP Maximum Base Employee Contribution ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _minimum_wage 15.25; ::set _td1_prov_basic_claim 18056; ::set _WCBMaxAE 94000; ::set _provincialTableVersion 20240101; ::set _eiRate .0132; ;#// Quebec EI Rate ::set _eiMaxIE 63200; ;#// Quebec EI Maximum Annual Insurable Earnings ::set _eiMax 834.24; ;#// Quebec EI Maximum deduction ::set _cppRate 0.06400; ;#// CPP (and QPP) Rate ::set _cppMax 4160.00; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppBase 3407.40; ;#// ? ? ? jrp what is this ? ? ? answer: QPP Maximum Base Employee Contribution ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _minimum_wage 13.50; ::set _td1_prov_basic_claim 17183; ::set _WCBMaxAE 91000; ::set _provincialTableVersion 20230101; ::set _eiRate .0127; ;#// Quebec EI Rate ::set _eiMaxIE 61500; ;#// Quebec EI Maximum Annual Insurable Earnings ::set _eiMax 781.05; ;#// Quebec EI Maximum deduction ::set _cppRate 0.06400; ;#// CPP (and QPP) Rate ::set _cppMax 4038.40; ;#// CPP (and QPP) Maximum Annual Contribution ::set _cppBase 3407.40; ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _minimum_wage 13.50; ::set _td1_prov_basic_claim 16143; ::set _WCBMaxAE 88000; ::set _provincialTableVersion 20220101; ::set _eiRate .0120; ;#// Quebec EI Rate ::set _eiMaxIE 60300; ;#// Quebec EI Maximum Annual Insurable Earnings ::set _eiMax 723.60; ;#// Quebec EI Maximum deduction ::set _cppRate 0.06150; ;#// CPP (and QPP) Rate ::set _cppMax 3776.10; ;#// CPP (and QPP) Maximum Annual Contribution ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _minimum_wage 13.10; ::set _td1_prov_basic_claim 15728; ::set _WCBMaxAE 83500; ::set _provincialTableVersion 20210101; ::set _eiRate .0118; ;#// Quebec EI Rate ::set _eiMaxIE 56300; ;#// Quebec EI Maximum Annual Insurable Earnings ::set _eiMax 664.34; ;#// Quebec EI Maximum deduction ::set _cppRate 0.05900; ;#// CPP (and QPP) Rate ::set _cppMax 3427.90; ;#// CPP (and QPP) Maximum Annual Contribution ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _minimum_wage 12.50; ::set _td1_prov_basic_claim 15532; ::set _WCBMaxAE 74000; ::set _provincialTableVersion 20200101; ::set _eiRate .0120; ;#// Quebec EI Rate ::set _eiMaxIE 54200; ;#// Quebec EI Maximum Annual Insurable Earnings ::set _eiMax 650.40; ;#// Quebec EI Maximum deduction ::set _cppRate 0.05700; ;#// CPP (and QPP) Rate ::set _cppMax 3146.40; ;#// CPP (and QPP) Maximum Annual Contribution ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _minimum_wage 12.00; ::set _td1_prov_basic_claim 15269; ::set _WCBMaxAE 74000; ::set _provincialTableVersion 20190101; ::set _eiRate .0125; ;#// Quebec EI Rate ::set _eiMaxIE 53100; ;#// Quebec EI Maximum Annual Insurable Earnings ::set _eiMax 663.75; ;#// Quebec EI Maximum deduction ::set _cppRate 0.05550; ;#// CPP (and QPP) Rate ::set _cppMax 2991.45; ;#// CPP (and QPP) Maximum Annual Contribution ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _minimum_wage 10.75; ::set _td1_prov_basic_claim 15012; ::set _WCBMaxAE 74000; ::set _provincialTableVersion 20180101; ::set _eiRate .0130; ;#// Quebec EI Rate ::set _eiMaxIE 51700; ;#// Quebec EI Maximum Annual Insurable Earnings ::set _eiMax 672.10; ;#// Quebec EI Maximum deduction ::set _cppRate 0.05400; ;#// CPP (and QPP) Rate ::set _cppMax 2829.60; ;#// CPP (and QPP) Maximum Annual Contribution ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _minimum_wage 10.75; ::set _td1_prov_basic_claim 11635; ::set _WCBMaxAE 72500; ::set _provincialTableVersion 20170101; ::set _eiRate .0127; ;#// Quebec EI Rate ::set _eiMaxIE 51300; ;#// Quebec EI Maximum Annual Insurable Earnings ::set _eiMax 651.51; ;#// Quebec EI Maximum deduction ::set _cppRate 0.05400; ;#// CPP (and QPP) Rate ::set _cppMax 2797.20; ;#// CPP (and QPP) Maximum Annual Contribution ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _minimum_wage 10.55; ::set _td1_prov_basic_claim 11550; ::set _WCBMaxAE 71500; ::set _provincialTableVersion 20160101; ::set _eiRate .0152; ;#// Quebec EI Rate ::set _eiMaxIE 50800; ;#// Quebec EI Maximum Annual Insurable Earnings ::set _eiMax 772.16; ;#// Quebec EI Maximum deduction ::set _cppRate 0.05325; ;#// CPP (and QPP) Rate ::set _cppMax 2737.05; ;#// CPP (and QPP) Maximum Annual Contribution ::return; } ::if {[::qw::date::difference $_date "20150101" "day"]>=0} { ::set _minimum_wage 10.35; ::set _td1_prov_basic_claim 11425; ::set _WCBMaxAE 69000; ::set _provincialTableVersion 20150101; ::set _eiRate .0154; ;#// Quebec EI Rate ::set _eiMaxIE 49500; ;#// Quebec EI Maximum Annual Insurable Earnings ::set _eiMax 762.30; ;#// Quebec EI Maximum deduction ::set _cppRate 0.05250; ;#// CPP (and QPP) Rate ::set _cppMax 2630.25; ;#// CPP (and QPP) Maximum Annual Contribution ::return; } ::if {[::qw::date::difference $_date "20140101" "day"]>=0} { ::set _minimum_wage 10.15; ::set _td1_prov_basic_claim 11305; ::set _WCBMaxAE 69000; ::set _provincialTableVersion 20140101; ::set _eiRate .0153; ;#// Quebec EI Rate ::set _eiMaxIE 48600; ;#// Quebec EI Maximum Annual Insurable Earnings ::set _eiMax 743.58; ;#// Quebec EI Maximum deduction ::set _cppRate 0.05175; ;#// CPP (and QPP) Rate ::set _cppMax 2535.75; ;#// CPP (and QPP) Maximum Annual Contribution ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _minimum_wage 9.90; ::set _td1_prov_basic_claim 11195; ::set _WCBMaxAE 66000; ::set _provincialTableVersion 20130101; ::set _eiRate .0152; ;#// Quebec EI Rate ::set _eiMaxIE 47400; ;#// Quebec EI Maximum Annual Insurable Earnings ::set _eiMax 720.48; ;#// Quebec EI Maximum deduction ::set _cppRate 0.05100; ;#// CPP (and QPP) Rate ::set _cppMax 2427.60; ;#// CPP (and QPP) Maximum Annual Contribution ::return; } } "SK" { ::if {[::qw::date::difference $_date "20250701" "day"]>=0} { ::set _minimum_wage 15.00; ::set _td1_prov_basic_claim 19991; ::set _WCBMaxAE 104531; ::set _provincialTableVersion 20250101; ::return; } ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _minimum_wage 15.00; ::set _td1_prov_basic_claim 18991; ::set _WCBMaxAE 104531; ::set _provincialTableVersion 20250101; ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _minimum_wage 14.00; ::set _td1_prov_basic_claim 18491; ::set _WCBMaxAE 99945; ::set _provincialTableVersion 20240101; ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _minimum_wage 13.00; ::set _td1_prov_basic_claim 17661; ::set _WCBMaxAE 96945; ::set _provincialTableVersion 20230101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _minimum_wage 11.81; ::set _td1_prov_basic_claim 16615; ::set _WCBMaxAE 94440; ::set _provincialTableVersion 20220101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _minimum_wage 11.45; ::set _td1_prov_basic_claim 16225; ::set _WCBMaxAE 91100; ::set _provincialTableVersion 20210101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _minimum_wage 11.32; ::set _td1_prov_basic_claim 16065; ::set _WCBMaxAE 88906; ::set _provincialTableVersion 20180101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _minimum_wage 11.06; ::set _td1_prov_basic_claim 16065; ::set _WCBMaxAE 88314; ::set _provincialTableVersion 20180101; ;#// no changes ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _minimum_wage 10.96; ::set _td1_prov_basic_claim 16065; ::set _WCBMaxAE 82627; ::set _provincialTableVersion 20180101; ::return; } ::if {[::qw::date::difference $_date "20170701" "day"]>=0} { ::set _minimum_wage 10.72; ::set _td1_prov_basic_claim 16065; ::set _WCBMaxAE 76086; ::set _provincialTableVersion 20170701; ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _minimum_wage 10.72; ::set _td1_prov_basic_claim 16065; ::set _WCBMaxAE 76086; ::set _provincialTableVersion 20170101; ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _minimum_wage 10.50; ::set _td1_prov_basic_claim 15843; ::set _WCBMaxAE 69242; ::set _provincialTableVersion 20160101; ::return; } ::if {[::qw::date::difference $_date "20150101" "day"]>=0} { ::set _minimum_wage 10.20; ::set _td1_prov_basic_claim 15639; ::set _WCBMaxAE 59000; ::set _provincialTableVersion 20150101; ::return; } ::if {[::qw::date::difference $_date "20140101" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 15378; ::set _WCBMaxAE 59000; ::set _provincialTableVersion 20140101; ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _minimum_wage 10.00; ::set _td1_prov_basic_claim 15241; ::set _WCBMaxAE 59000; ::set _provincialTableVersion 20130101; ::return; } } "YK" { ::if {[::qw::date::difference $_date "20250101" "day"]>=0} { ::set _minimum_wage 17.59; ::set _td1_prov_basic_claim 16129; ::set _WCBMaxAE 104975; ::set _provincialTableVersion 20250101; ::return; } ::if {[::qw::date::difference $_date "20240101" "day"]>=0} { ::set _minimum_wage 16.77; ::set _td1_prov_basic_claim 15705; ::set _WCBMaxAE 102017; ::set _provincialTableVersion 20240101; ::return; } ::if {[::qw::date::difference $_date "20230101" "day"]>=0} { ::set _minimum_wage 15.70; ::set _td1_prov_basic_claim 15000; ::set _WCBMaxAE 98093; ::set _provincialTableVersion 20230101; ::return; } ::if {[::qw::date::difference $_date "20220101" "day"]>=0} { ::set _minimum_wage 15.20; ::set _td1_prov_basic_claim 14398; ::set _WCBMaxAE 94320; ::set _provincialTableVersion 20220101; ::return; } ::if {[::qw::date::difference $_date "20210101" "day"]>=0} { ::set _minimum_wage 13.71; ::set _td1_prov_basic_claim 13808; ::set _WCBMaxAE 91930; ::set _provincialTableVersion 20210101; ::return; } ::if {[::qw::date::difference $_date "20200701" "day"]>=0} { ::set _minimum_wage 12.71; ::set _td1_prov_basic_claim 14160; ::set _WCBMaxAE 90750; ::set _provincialTableVersion 20200701; ::return; } ::if {[::qw::date::difference $_date "20200101" "day"]>=0} { ::set _minimum_wage 11.71; ::set _td1_prov_basic_claim 12298; ::set _WCBMaxAE 85601; ::set _provincialTableVersion 20200101; ::return; } ::if {[::qw::date::difference $_date "20190101" "day"]>=0} { ::set _minimum_wage 11.51; ::set _td1_prov_basic_claim 12069; ::set _WCBMaxAE 85601; ::set _provincialTableVersion 20190101; ::return; } ::if {[::qw::date::difference $_date "20180101" "day"]>=0} { ::set _minimum_wage 11.32; ::set _td1_prov_basic_claim 11809; ::set _WCBMaxAE 85601; ::set _provincialTableVersion 20180101; ::return; } ::if {[::qw::date::difference $_date "20170101" "day"]>=0} { ::set _minimum_wage 11.07; ::set _td1_prov_basic_claim 11635; ::set _WCBMaxAE 85601; ::set _provincialTableVersion 20170101; ::return; } ::if {[::qw::date::difference $_date "20160101" "day"]>=0} { ::set _minimum_wage 10.86; ::set _td1_prov_basic_claim 11474; ::set _WCBMaxAE 80024; ::set _provincialTableVersion 20160101; ::return; } ::if {[::qw::date::difference $_date "20150701" "day"]>=0} { ::set _minimum_wage 10.72; ::set _td1_prov_basic_claim 11327; ::set _WCBMaxAE 80024; ::set _provincialTableVersion 20150701; ::return; } ::if {[::qw::date::difference $_date "20150101" "day"]>=0} { ::set _minimum_wage 10.72; ::set _td1_prov_basic_claim 11327; ::set _WCBMaxAE 80024; ::set _provincialTableVersion 20150101; ::return; } ::if {[::qw::date::difference $_date "20140101" "day"]>=0} { ::set _minimum_wage 10.30; ::set _td1_prov_basic_claim 11138; ::set _WCBMaxAE 80024; ::set _provincialTableVersion 20140101; ::return; } ::if {[::qw::date::difference $_date "20130101" "day"]>=0} { ::set _minimum_wage 10.30; ::set _td1_prov_basic_claim 11038; ::set _WCBMaxAE 80024; ::set _provincialTableVersion 20130101; ::return; } } "ZZ" { ::if {[::qw::date::difference $_date "20090101" "day"]>=0} { ::set _minimum_wage 5.00; ::set _td1_prov_basic_claim 0; ::set _WCBMaxAE 0; ::set _provincialTableVersion 20090101; ::return; } } default {::qw::bug "907020050401053840" "Employee has unknown province \"$Jurisdiction\".";} } } public method FEDERAL-20250701 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.14;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>57375} {::set R 0.205;::set K 3729;} ::if {$TaxableIncome>114750} {::set R 0.260;::set K 10041;} ::if {$TaxableIncome>177882} {::set R 0.290;::set K 15377;} ::if {$TaxableIncome>253414} {::set R 0.330;::set K 25514;} debugLog "--- Federal Tax Calculation (20250701) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::set YtdCpp2 [recRead "PROCN" "~AYRUN.2" "20"]; ;#// YtdCpp2 = YTD CPP2 (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::if {$_province_of_employment ne "PQ"} { ::set YtdCppBase [round2 [::expr $YtdCpp*(0.0495/0.0595)]]; } else { ::set YtdCppBase [round2 [::expr $YtdCpp*(0.0540/0.0640)]]; } ::if {$YtdCppBase>$_cppBase} { ::set YtdCppBase $_cppBase; } ::set K2C [::expr $K2Rate*$YtdCppBase]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCppBase $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1471.00} { ::set K4Wages 1471.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.15]]; ::if {$LSF>750} {::set LSF 750}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method AB-20250701 {TaxableIncome} { ::set T2 0; ;# Initialize provincial tax to deduct debugLog "--- Alberta Tax Calculation (20250701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set BaseV 0.06; ::set V $BaseV; ::set KP 0; ::if {$TaxableIncome>60000} {::set V 0.10;::set KP 2400;} ::if {$TaxableIncome>151234} {::set V 0.12;::set KP 5425;} ::if {$TaxableIncome>181481} {::set V 0.13;::set KP 7239;} ::if {$TaxableIncome>241974} {::set V 0.14;::set KP 9659;} ::if {$TaxableIncome>362961} {::set V 0.15;::set KP 13289;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*0.1}]; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K1P $Tmp1; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::set K5P [round2 [::expr {($K1P+$K2P-4800)*(0.02/0.08)}]]; ::if {$K5P<0.0} { ::set K5P 0.0; } debugLog "Alberta Supplimental tax credit" "(K5P)" "-" $K5P; ::set T4 [::expr $T4-$K5P]; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [expr $T2-$S]; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [::expr $Tmp1/$_pay_frequency]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method MB-20250701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Manitoba Tax Calculation (20250701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.108; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>46513} {::set V 0.1275; ::set KP 907;} ::if {$TaxableIncome>98796} {::set V 0.1740; ::set KP 5501;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NS-20250701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nova Scotia Tax Calculation (20250701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0879; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>30507} {::set V 0.1495; ::set KP 1879;} ::if {$TaxableIncome>61015} {::set V 0.1667; ::set KP 2929;} ::if {$TaxableIncome>95883} {::set V 0.1750; ::set KP 3725;} ::if {$TaxableIncome>154650} {::set V 0.2100; ::set KP 9137;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::if {$_pClaim<$_td1_prov_basic_claim} { ::set _pClaim $_td1_prov_basic_claim; } ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set T2 [::expr $T2-0]; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Tmp1 0; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method FEDERAL-20250101 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.15;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>57375} {::set R 0.205;::set K 3156;} ::if {$TaxableIncome>114750} {::set R 0.260;::set K 9467;} ::if {$TaxableIncome>177882} {::set R 0.290;::set K 14803;} ::if {$TaxableIncome>253414} {::set R 0.330;::set K 24940;} debugLog "--- Federal Tax Calculation (20250101) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::set YtdCpp2 [recRead "PROCN" "~AYRUN.2" "20"]; ;#// YtdCpp2 = YTD CPP2 (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::if {$_province_of_employment ne "PQ"} { ::set YtdCppBase [round2 [::expr $YtdCpp*(0.0495/0.0595)]]; } else { ::set YtdCppBase [round2 [::expr $YtdCpp*(0.0540/0.0640)]]; } ::if {$YtdCppBase>$_cppBase} { ::set YtdCppBase $_cppBase; } ::set K2C [::expr $K2Rate*$YtdCppBase]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCppBase $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1471.00} { ::set K4Wages 1471.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.15]]; ::if {$LSF>750} {::set LSF 750}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method AB-20250101 {TaxableIncome} { ::set T2 0; ;# Initialize provincial tax to deduct debugLog "--- Alberta Tax Calculation (20250101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set BaseV 0.10; ::set V $BaseV; ::set KP 0; ::if {$TaxableIncome>0} {::set V 0.10;::set KP 0;} ::if {$TaxableIncome>151234} {::set V 0.12;::set KP 3025;} ::if {$TaxableIncome>181481} {::set V 0.13;::set KP 4839;} ::if {$TaxableIncome>241974} {::set V 0.14;::set KP 7259;} ::if {$TaxableIncome>362961} {::set V 0.15;::set KP 10889;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*0.1}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [expr $T2-$S]; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [::expr $Tmp1/$_pay_frequency]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method BC-20250101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20250101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>49279} {::set V 0.0770;::set KP 1301;} ::if {$TaxableIncome>98560} {::set V 0.1050;::set KP 4061;} ::if {$TaxableIncome>113158} {::set V 0.1229;::set KP 6086;} ::if {$TaxableIncome>137407} {::set V 0.1470;::set KP 9398;} ::if {$TaxableIncome>186306} {::set V 0.1680;::set KP 13310;} ::if {$TaxableIncome>259829} {::set V 0.2050;::set KP 22924;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=25020} { ::set S $T4; ::if {$S>562} { ::set S 562; } } else { ::if {$A1<=40807} { ::set S [::expr {562-[round2 [::expr {($A1-25020)*0.0356}]]}];s ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method MB-20250101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Manitoba Tax Calculation (20250101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.108; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>47564} {::set V 0.1275; ::set KP 927;} ::if {$TaxableIncome>101200} {::set V 0.1740; ::set KP 5633;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20250101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20250101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.094; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>51306} {::set V 0.1400; ::set KP 2360;} ::if {$TaxableIncome>102614} {::set V 0.1600; ::set KP 4412;} ::if {$TaxableIncome>190060} {::set V 0.1954; ::set KP 11064;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20250101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20250101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.087; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>44192} {::set V 0.145; ::set KP 2563;} ::if {$TaxableIncome>88382} {::set V 0.158; ::set KP 3712;} ::if {$TaxableIncome>157792} {::set V 0.178; ::set KP 6868;} ::if {$TaxableIncome>220910} {::set V 0.198; ::set KP 11286;} ::if {$TaxableIncome>282214} {::set V 0.208; ::set KP 14108;} ::if {$TaxableIncome>564429} {::set V 0.213; ::set KP 16930;} ::if {$TaxableIncome>1128858} {::set V 0.218; ::set KP 22575;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NS-20250101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nova Scotia Tax Calculation (20250101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0879; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>30507} {::set V 0.1495; ::set KP 1879;} ::if {$TaxableIncome>61015} {::set V 0.1667; ::set KP 2929;} ::if {$TaxableIncome>95883} {::set V 0.1750; ::set KP 3725;} ::if {$TaxableIncome>154650} {::set V 0.2100; ::set KP 9137;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::if {$TaxableIncome>25000} { ::set Tmp1 [::expr {$TaxableIncome-25000}]; ::set Tmp1 [::expr {$Tmp1*0.06}]; ::set _pClaim [::expr {$_pClaim-$Tmp1}]; } ::if {$TaxableIncome>75000} { ::set _pClaim 8744; } ::if {$_pClaim<$_td1_prov_basic_claim} { ::set _pClaim $_td1_prov_basic_claim; } ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set T2 [::expr $T2-0]; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Tmp1 0; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NT-20250101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Northwest Territories Tax Calculation (20250101) ---"; debugLog "Annual taxable income (A) [round2 $TaxableIncome]"; ::set V 0;::set KP 0; ::set BaseV 0.0590; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>51964} {::set V 0.0860; ::set KP 1403;} ::if {$TaxableIncome>103930} {::set V 0.1220; ::set KP 5145;} ::if {$TaxableIncome>168967} {::set V 0.1405; ::set KP 8270;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2-)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NU-20250101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nunavut Tax Calculation (20250101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0400; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>54707} {::set V 0.0700; ::set KP 1641;} ::if {$TaxableIncome>109413} {::set V 0.0900; ::set KP 3829;} ::if {$TaxableIncome>177881} {::set V 0.1150; ::set KP 8276;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20250101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20250101) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>52886} {::set V 0.0915;::set KP 2168;} ::if {$TaxableIncome>105775} {::set V 0.1116;::set KP 4294;} ::if {$TaxableIncome>150000} {::set V 0.1216;::set KP 5794;} ::if {$TaxableIncome>220000} {::set V 0.1316;::set KP 7994;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>5710} { ::if {$T4<=7307} { ::set Tmp1 [::expr $T4-5710]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-5710]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-7307]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*544]; ::set Tmp1 [::expr $Tmp1+294]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PE-20250101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- P.E.I. Tax Calculation (20250101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0950; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>33328} {::set V 0.1347;::set KP 1323;} ::if {$TaxableIncome>64656} {::set V 0.1660;::set KP 3347;} ::if {$TaxableIncome>105000} {::set V 0.1762;::set KP 4418;} ::if {$TaxableIncome>140000} {::set V 0.1900;::set KP 6350;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0 debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PQ-20250701 {TaxableIncome {FederalVersion "20250701"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.1650; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method PQ-20250101 {TaxableIncome {FederalVersion "20250101"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.1650; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method QT-20250101 {TaxableIncome} { debugLog "--- Quebec Provincial Tax Calculation (20250101) ---"; debugLog "Annual income" "(A)" "" $TaxableIncome; ::set T0 0; ::if {[employeeInfoGet ".provincial.td1_claim_amount"] ne "X"} { ::set EmploymentIncomeDeduction [::expr $TaxableIncome*0.06]; ::if {$EmploymentIncomeDeduction>1420.00} { ::set EmploymentIncomeDeduction 1420.00; } ::set TaxableIncome [::expr $TaxableIncome-$EmploymentIncomeDeduction]; debugLog "Employ. Inc. Ded" "(H)" "-" $EmploymentIncomeDeduction; debugLog "Annual taxable income" "(I)" "" $TaxableIncome; ::set T 0.1400;::set K 0.0; ::if {$TaxableIncome>51780} {::set T 0.1900;::set K 2622.50;} ::if {$TaxableIncome>103545} {::set T 0.2400;::set K 7766;} ::if {$TaxableIncome>126000} {::set T 0.2575;::set K 9971;} debugLog "Provincial Tax Rate" "(T)" "*" $T; ::set T0 [::expr $TaxableIncome*$T]; ;#// T(I) ::set T0 [round2 $T0]; debugLog "Basic Tax" "" "=" $T0; ::set T0 [::expr $T0-$K]; ;#// - K debugLog "Adjustment Constant" "(K)" "-" $K; debugLog "Net Tax" "" "=" $T0; ::set E [round2 [::expr $_pClaim*0.14]]; ;#// 2024 updated from 0.15 ::set T0 [::expr $T0-$E]; ;#// - 0.20(E) debugLog "Claim Amount Credit" "" "-" $E; debugLog " (15% of $_pClaim)"; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Shares [::expr $Shares*$_pay_frequency]; ::set Q [round2 [::expr $Shares*0.15]]; debugLog "Share purchase tax credit" "(Q)" "-" $Q; debugLog " (15% of $Shares)"; ::set T0 [::expr $T0-$Q]; ;#// - 0.15(P(Q)) ::if {$T0<0} {::set T0 0;} } else { debugLog "Employee is exempt From Tax"; } debugLog "Net Annual Prov. Tax" "" "=" $T0; ::set ProvTax $T0; ::set ProvTax [truncate [::expr $ProvTax/$_pay_frequency] 2]; debugLog "Tax prorated for the PP" "" "=" $ProvTax; ::set ProvTax [::expr $ProvTax*$_pay_frequency]; ::return $ProvTax; } public method SK-20250101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Saskatchewan Tax Calculation (20250101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.105; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>53463} {::set V 0.125; ::set KP 1069;} ::if {$TaxableIncome>152750} {::set V 0.145; ::set KP 4124;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" [round2 $Tmp1]; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; # CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; # EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" [round2 $T4]; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" [round2 $V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" [round2 $S]; ::set LCPp 0; ::set LCPf 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares!=0} { ::set LCPp [::expr {$Shares*0.175}]; ::if {$LCPp>875} {::set LCPp 875;} ::set Tmp1 0;::set Shares 0; ::if {$Tmp1==-1} { ::set Tmp1 [::expr {$Tmp1+1}]; ::set Tmp1 50; ::set LCPf [::expr {$Shares*0.20}]; ::if {$LCPf>1000} {::set LCPf 1000;} } } ::set Tmp1 [::expr {$LCPf+$LCPp}]; ::if {$Tmp1 >=1000} {::set Tmp1 1000;} ::if {$Tmp1<=0} {::set Tmp1 0;} ::set T2 [::expr {$T2-$Tmp1}]; debugLog "Labour sp. funds credit" "(LCP)" "-" [round2 $Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" [round2 $T2]; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" [round2 $_fedTax] $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" [round2 $T2] $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" [round2 $Tmp1] $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [::expr {$Tmp1/$_pay_frequency}]; debugLog "Tax prorated for the PP" "" "=" [round2 $Tmp1]; ::return $T2; } public method YK-20250101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20250101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Td1_prov_basic_claim $_td1_prov_basic_claim; ::if {$TaxableIncome>177882} {::set Td1_prov_basic_claim [::expr {$Td1_prov_basic_claim-($TaxableIncome-177882)*0.0210639199279}];} ::if {$TaxableIncome>253414} {::set Td1_prov_basic_claim 14538;} ::set V 0;::set KP 0; ::set BaseV 0.0640; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>57375} {::set V 0.0900; ::set KP 1492;} ::if {$TaxableIncome>114750} {::set V 0.1090; ::set KP 3672;} ::if {$TaxableIncome>177882} {::set V 0.1280; ::set KP 7052;} ::if {$TaxableIncome>500000} {::set V 0.1500; ::set KP 18052;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1471} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1471}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method FEDERAL-20240101 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.15;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>55867} {::set R 0.205;::set K 3073;} ::if {$TaxableIncome>111733} {::set R 0.260;::set K 9218;} ::if {$TaxableIncome>173205} {::set R 0.290;::set K 14414;} ::if {$TaxableIncome>246752} {::set R 0.330;::set K 24284;} debugLog "--- Federal Tax Calculation (20240101) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::set YtdCpp2 [recRead "PROCN" "~AYRUN.2" "20"]; ;#// YtdCpp2 = YTD CPP2 (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::if {$_province_of_employment ne "PQ"} { ::set YtdCppBase [round2 [::expr $YtdCpp*(0.0495/0.0595)]]; } else { ::set YtdCppBase [round2 [::expr $YtdCpp*(0.0540/0.0640)]]; } ::if {$YtdCppBase>$_cppBase} { ::set YtdCppBase $_cppBase; } ::set K2C [::expr $K2Rate*$YtdCppBase]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCppBase $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1433.00} { ::set K4Wages 1433.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.15]]; ::if {$LSF>750} {::set LSF 750}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method AB-20240101 {TaxableIncome} { ::set T2 0; ;# Initialize provincial tax to deduct debugLog "--- Alberta Tax Calculation (20240101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set BaseV 0.10; ::set V $BaseV; ::set KP 0; ::if {$TaxableIncome>0} {::set V 0.10;::set KP 0;} ::if {$TaxableIncome>148269} {::set V 0.12;::set KP 2965;} ::if {$TaxableIncome>177922} {::set V 0.13;::set KP 4745;} ::if {$TaxableIncome>237230} {::set V 0.14;::set KP 7117;} ::if {$TaxableIncome>355845} {::set V 0.15;::set KP 10675;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*0.1}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [expr $T2-$S]; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [::expr $Tmp1/$_pay_frequency]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method BC-20240101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20240101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>47937} {::set V 0.0770;::set KP 1266;} ::if {$TaxableIncome>95875} {::set V 0.1050;::set KP 3950;} ::if {$TaxableIncome>110076} {::set V 0.1229;::set KP 5920;} ::if {$TaxableIncome>133664} {::set V 0.1470;::set KP 9142;} ::if {$TaxableIncome>181232} {::set V 0.1680;::set KP 12948;} ::if {$TaxableIncome>252752} {::set V 0.2050;::set KP 22299;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=24338} { ::set S $T4; ::if {$S>547} { ::set S 547; } } else { ::if {$A1<=39703} { ::set S [::expr {547-[round2 [::expr {($A1-24338)*0.0356}]]}];s ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method MB-20240101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Manitoba Tax Calculation (20240101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.108; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>47000} {::set V 0.1275; ::set KP 917;} ::if {$TaxableIncome>100000} {::set V 0.1740; ::set KP 5567;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20240101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20240101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.094; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>49958} {::set V 0.1400; ::set KP 2298;} ::if {$TaxableIncome>99916} {::set V 0.1600; ::set KP 4296;} ::if {$TaxableIncome>185064} {::set V 0.1954; ::set KP 10774;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20240101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20240101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.087; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>43198} {::set V 0.145; ::set KP 2505;} ::if {$TaxableIncome>86395} {::set V 0.158; ::set KP 3629;} ::if {$TaxableIncome>154244} {::set V 0.178; ::set KP 6713;} ::if {$TaxableIncome>215943} {::set V 0.198; ::set KP 11032;} ::if {$TaxableIncome>275870} {::set V 0.208; ::set KP 13791;} ::if {$TaxableIncome>551739} {::set V 0.213; ::set KP 16550;} ::if {$TaxableIncome>1103478} {::set V 0.218; ::set KP 22067;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NS-20240101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nova Scotia Tax Calculation (20180101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0879; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>29590} {::set V 0.1495; ::set KP 1823;} ::if {$TaxableIncome>59180} {::set V 0.1667; ::set KP 2841;} ::if {$TaxableIncome>93000} {::set V 0.1750; ::set KP 3613;} ::if {$TaxableIncome>150000} {::set V 0.2100; ::set KP 8863;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::if {$TaxableIncome>25000} { ::set Tmp1 [::expr {$TaxableIncome-25000}]; ::set Tmp1 [::expr {$Tmp1*0.06}]; ::set _pClaim [::expr {$_pClaim-$Tmp1}]; } ::if {$TaxableIncome>75000} { ::set _pClaim 8481; } ::if {$_pClaim<$_td1_prov_basic_claim} { ::set _pClaim $_td1_prov_basic_claim; } ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set T2 [::expr $T2-0]; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Tmp1 0; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NT-20240101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Northwest Territories Tax Calculation (20240101) ---"; debugLog "Annual taxable income (A) [round2 $TaxableIncome]"; ::set V 0;::set KP 0; ::set BaseV 0.0590; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>50597} {::set V 0.0860; ::set KP 1366;} ::if {$TaxableIncome>101198} {::set V 0.1220; ::set KP 5009;} ::if {$TaxableIncome>164525} {::set V 0.1405; ::set KP 8053;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2-)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NU-20240101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nunavut Tax Calculation (20240101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0400; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>53268} {::set V 0.0700; ::set KP 1598;} ::if {$TaxableIncome>106537} {::set V 0.0900; ::set KP 3729;} ::if {$TaxableIncome>173205} {::set V 0.1150; ::set KP 8059;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20240101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20240101) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>51446} {::set V 0.0915;::set KP 2109;} ::if {$TaxableIncome>102894} {::set V 0.1116;::set KP 4177;} ::if {$TaxableIncome>150000} {::set V 0.1216;::set KP 5677;} ::if {$TaxableIncome>220000} {::set V 0.1316;::set KP 7877;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>5554} { ::if {$T4<=7108} { ::set Tmp1 [::expr $T4-5554]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-5554]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-7108]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*529]; ::set Tmp1 [::expr $Tmp1+286]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PE-20240101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- P.E.I. Tax Calculation (20240101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0965; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>32656} {::set V 0.1363;::set KP 1300;} ::if {$TaxableIncome>64313} {::set V 0.1665;::set KP 3242;} ::if {$TaxableIncome>105000} {::set V 0.1800;::set KP 4659;} ::if {$TaxableIncome>140000} {::set V 0.1875;::set KP 5709;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0 debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PQ-20240101 {TaxableIncome {FederalVersion "20240101"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.1650; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method QT-20240101 {TaxableIncome} { debugLog "--- Quebec Provincial Tax Calculation (20240101) ---"; debugLog "Annual income" "(A)" "" $TaxableIncome; ::set T0 0; ::if {[employeeInfoGet ".provincial.td1_claim_amount"] ne "X"} { ::set EmploymentIncomeDeduction [::expr $TaxableIncome*0.06]; ::if {$EmploymentIncomeDeduction>1315.00} { ::set EmploymentIncomeDeduction 1315.00; } ::set TaxableIncome [::expr $TaxableIncome-$EmploymentIncomeDeduction]; debugLog "Employ. Inc. Ded" "(H)" "-" $EmploymentIncomeDeduction; debugLog "Annual taxable income" "(I)" "" $TaxableIncome; ::set T 0.1400;::set K 0.0; ::if {$TaxableIncome>51780} {::set T 0.1900;::set K 2589;} ::if {$TaxableIncome>103545} {::set T 0.2400;::set K 7766;} ::if {$TaxableIncome>126000} {::set T 0.2575;::set K 9971;} debugLog "Provincial Tax Rate" "(T)" "*" $T; ::set T0 [::expr $TaxableIncome*$T]; ;#// T(I) ::set T0 [round2 $T0]; debugLog "Basic Tax" "" "=" $T0; ::set T0 [::expr $T0-$K]; ;#// - K debugLog "Adjustment Constant" "(K)" "-" $K; debugLog "Net Tax" "" "=" $T0; ::set E [round2 [::expr $_pClaim*0.14]]; ;#// 2024 updated from 0.15 ::set T0 [::expr $T0-$E]; ;#// - 0.20(E) debugLog "Claim Amount Credit" "" "-" $E; debugLog " (15% of $_pClaim)"; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Shares [::expr $Shares*$_pay_frequency]; ::set Q [round2 [::expr $Shares*0.15]]; debugLog "Share purchase tax credit" "(Q)" "-" $Q; debugLog " (15% of $Shares)"; ::set T0 [::expr $T0-$Q]; ;#// - 0.15(P(Q)) ::if {$T0<0} {::set T0 0;} } else { debugLog "Employee is exempt From Tax"; } debugLog "Net Annual Prov. Tax" "" "=" $T0; ::set ProvTax $T0; ::set ProvTax [truncate [::expr $ProvTax/$_pay_frequency] 2]; debugLog "Tax prorated for the PP" "" "=" $ProvTax; ::set ProvTax [::expr $ProvTax*$_pay_frequency]; ::return $ProvTax; } public method SK-20240101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Saskatchewan Tax Calculation (20240101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.105; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>52057} {::set V 0.125; ::set KP 1041;} ::if {$TaxableIncome>148734} {::set V 0.145; ::set KP 4016;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" [round2 $Tmp1]; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; # CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; # EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" [round2 $T4]; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" [round2 $V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" [round2 $S]; ::set LCPp 0; ::set LCPf 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares!=0} { ::set LCPp [::expr {$Shares*0.175}]; ::if {$LCPp>875} {::set LCPp 875;} ::set Tmp1 0;::set Shares 0; ::if {$Tmp1==-1} { ::set Tmp1 [::expr {$Tmp1+1}]; ::set Tmp1 50; ::set LCPf [::expr {$Shares*0.20}]; ::if {$LCPf>1000} {::set LCPf 1000;} } } ::set Tmp1 [::expr {$LCPf+$LCPp}]; ::if {$Tmp1 >=1000} {::set Tmp1 1000;} ::if {$Tmp1<=0} {::set Tmp1 0;} ::set T2 [::expr {$T2-$Tmp1}]; debugLog "Labour sp. funds credit" "(LCP)" "-" [round2 $Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" [round2 $T2]; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" [round2 $_fedTax] $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" [round2 $T2] $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" [round2 $Tmp1] $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [::expr {$Tmp1/$_pay_frequency}]; debugLog "Tax prorated for the PP" "" "=" [round2 $Tmp1]; ::return $T2; } public method YK-20240101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20240101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Td1_prov_basic_claim $_td1_prov_basic_claim; ::if {$TaxableIncome>165430} {::set _td1_prov_basic_claim [::expr {$Td1_prov_basic_claim-($TaxableIncome-165430)*0.0210548793508}];} ::if {$TaxableIncome>235675} {::set _td1_prov_basic_claim 13521;} ::set V 0;::set KP 0; ::set BaseV 0.0640; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>55867} {::set V 0.0900; ::set KP 1453;} ::if {$TaxableIncome>111733} {::set V 0.1090; ::set KP 3575;} ::if {$TaxableIncome>173205} {::set V 0.1280; ::set KP 6866;} ::if {$TaxableIncome>500000} {::set V 0.1500; ::set KP 17866;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1433} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1433}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method MB-20230701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Manitoba Tax Calculation (20230701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.108; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>36842} {::set V 0.1275; ::set KP 718;} ::if {$TaxableIncome>79625} {::set V 0.1740; ::set KP 4421;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method FEDERAL-20230101 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.15;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>53359} {::set R 0.205;::set K 2935;} ::if {$TaxableIncome>106717} {::set R 0.260;::set K 8804;} ::if {$TaxableIncome>165430} {::set R 0.290;::set K 13767;} ::if {$TaxableIncome>235675} {::set R 0.330;::set K 23194;} debugLog "--- Federal Tax Calculation (20230101) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::if {$_province_of_employment ne "PQ"} { ::set YtdCppBase [round2 [::expr $YtdCpp*(0.0495/0.0595)]]; } else { ::set YtdCppBase [round2 [::expr $YtdCpp*(0.0540/0.0640)]]; } ::if {$YtdCppBase>$_cppBase} { ::set YtdCppBase $_cppBase; } ::set K2C [::expr $K2Rate*$YtdCppBase]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCppBase $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1368.00} { ::set K4Wages 1368.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.15]]; ::if {$LSF>750} {::set LSF 750}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method AB-20230101 {TaxableIncome} { ::set T2 0; ;# Initialize provincial tax to deduct debugLog "--- Alberta Tax Calculation (20230101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set BaseV 0.10; ::set V $BaseV; ::set KP 0; ::if {$TaxableIncome>0} {::set V 0.10;::set KP 0;} ::if {$TaxableIncome>142292} {::set V 0.12;::set KP 2846;} ::if {$TaxableIncome>170751} {::set V 0.13;::set KP 4553;} ::if {$TaxableIncome>227668} {::set V 0.14;::set KP 6830;} ::if {$TaxableIncome>341502} {::set V 0.15;::set KP 10245;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*0.1}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [expr $T2-$S]; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [::expr $Tmp1/$_pay_frequency]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method BC-20230101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20230101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>45654} {::set V 0.0770;::set KP 1205;} ::if {$TaxableIncome>91310} {::set V 0.1050;::set KP 3762;} ::if {$TaxableIncome>104835} {::set V 0.1229;::set KP 5638;} ::if {$TaxableIncome>127299} {::set V 0.1470;::set KP 8706;} ::if {$TaxableIncome>172299} {::set V 0.1680;::set KP 12331;} ::if {$TaxableIncome>240715} {::set V 0.2050;::set KP 21238;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=23179} { ::set S $T4; ::if {$S>521} { ::set S 521; } } else { ::if {$A1<=37814} { ::set S [::expr {521-[round2 [::expr {($A1-23179)*0.0356}]]}];s ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method MB-20230101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Manitoba Tax Calculation (20230101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.108; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>36842} {::set V 0.1275; ::set KP 718;} ::if {$TaxableIncome>79625} {::set V 0.1740; ::set KP 4421;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20230101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20230101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.094; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>47715} {::set V 0.1400; ::set KP 2195;} ::if {$TaxableIncome>95431} {::set V 0.1600; ::set KP 4104;} ::if {$TaxableIncome>176756} {::set V 0.1954; ::set KP 10290;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20230101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20230101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.087; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>41457} {::set V 0.145; ::set KP 2405;} ::if {$TaxableIncome>82913} {::set V 0.158; ::set KP 3482;} ::if {$TaxableIncome>148027} {::set V 0.178; ::set KP 6443;} ::if {$TaxableIncome>207239} {::set V 0.198; ::set KP 10588;} ::if {$TaxableIncome>264750} {::set V 0.208; ::set KP 13235;} ::if {$TaxableIncome>529500} {::set V 0.213; ::set KP 15883;} ::if {$TaxableIncome>1059000} {::set V 0.218; ::set KP 21178;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NS-20230101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nova Scotia Tax Calculation (20180101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0879; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>29590} {::set V 0.1495; ::set KP 1823;} ::if {$TaxableIncome>59180} {::set V 0.1667; ::set KP 2841;} ::if {$TaxableIncome>93000} {::set V 0.1750; ::set KP 3613;} ::if {$TaxableIncome>150000} {::set V 0.2100; ::set KP 8863;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::if {$TaxableIncome>25000} { ::set Tmp1 [::expr {$TaxableIncome-25000}]; ::set Tmp1 [::expr {$Tmp1*0.06}]; ::set _pClaim [::expr {$_pClaim-$Tmp1}]; } ::if {$TaxableIncome>75000} { ::set _pClaim 8481; } ::if {$_pClaim<$_td1_prov_basic_claim} { ::set _pClaim $_td1_prov_basic_claim; } ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set T2 [::expr $T2-0]; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Tmp1 0; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NT-20230101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Northwest Territories Tax Calculation (20230101) ---"; debugLog "Annual taxable income (A) [round2 $TaxableIncome]"; ::set V 0;::set KP 0; ::set BaseV 0.0590; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>48326} {::set V 0.0860; ::set KP 1305;} ::if {$TaxableIncome>96655} {::set V 0.1220; ::set KP 4784;} ::if {$TaxableIncome>157139} {::set V 0.1405; ::set KP 7691;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2-)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NU-20230101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nunavut Tax Calculation (20230101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0400; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>50877} {::set V 0.0700; ::set KP 1526;} ::if {$TaxableIncome>101754} {::set V 0.0900; ::set KP 3561;} ::if {$TaxableIncome>165429} {::set V 0.1150; ::set KP 7697;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20230101 {TaxableIncome} { ::set T2 0; # Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20230101) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>49231} {::set V 0.0915;::set KP 2018;} ::if {$TaxableIncome>98463} {::set V 0.1116;::set KP 3998;} ::if {$TaxableIncome>150000} {::set V 0.1216;::set KP 5498;} ::if {$TaxableIncome>220000} {::set V 0.1316;::set KP 7698;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>5315} { ::if {$T4<=6802} { ::set Tmp1 [::expr $T4-5315]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-5315]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-6802]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*506]; ::set Tmp1 [::expr $Tmp1+274]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PE-20230101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- P.E.I. Tax Calculation (20090101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0980; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>31984} {::set V 0.1380;::set KP 1279;} ::if {$TaxableIncome>63969} {::set V 0.1670;::set KP 3134;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0 ::set Tmp1 0; ::if {$T4>12500} { ::set Tmp1 [::expr $T4-12500]; ::set Tmp1 [::expr $Tmp1*0.10]; ::set V1 [round2 $Tmp1]; ::set T2 [::expr $T2+$V1]; } debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PQ-20230101 {TaxableIncome {FederalVersion "20230101"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.1650; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method QT-20230101 {TaxableIncome} { debugLog "--- Quebec Provincial Tax Calculation (20230101) ---"; debugLog "Annual income" "(A)" "" $TaxableIncome; ::set T0 0; ::if {[employeeInfoGet ".provincial.td1_claim_amount"] ne "X"} { ::set EmploymentIncomeDeduction [::expr $TaxableIncome*0.06]; ::if {$EmploymentIncomeDeduction>1315.00} { ::set EmploymentIncomeDeduction 1315.00; } ::set TaxableIncome [::expr $TaxableIncome-$EmploymentIncomeDeduction]; debugLog "Employ. Inc. Ded" "(H)" "-" $EmploymentIncomeDeduction; debugLog "Annual taxable income" "(I)" "" $TaxableIncome; ::set T 0.1500;::set K 0.0; ::if {$TaxableIncome>49275} {::set T 0.2000;::set K 2463;} ::if {$TaxableIncome>98540} {::set T 0.2400;::set K 6405;} ::if {$TaxableIncome>119910} {::set T 0.2575;::set K 8503;} debugLog "Provincial Tax Rate" "(T)" "*" $T; ::set T0 [::expr $TaxableIncome*$T]; ;#// T(I) ::set T0 [round2 $T0]; debugLog "Basic Tax" "" "=" $T0; ::set T0 [::expr $T0-$K]; ;#// - K debugLog "Adjustment Constant" "(K)" "-" $K; debugLog "Net Tax" "" "=" $T0; ::set E [round2 [::expr $_pClaim*0.15]]; ::set T0 [::expr $T0-$E]; ;#// - 0.20(E) debugLog "Claim Amount Credit" "" "-" $E; debugLog " (15% of $_pClaim)"; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Shares [::expr $Shares*$_pay_frequency]; ::set Q [round2 [::expr $Shares*0.15]]; debugLog "Share purchase tax credit" "(Q)" "-" $Q; debugLog " (15% of $Shares)"; ::set T0 [::expr $T0-$Q]; ;#// - 0.15(P(Q)) ::if {$T0<0} {::set T0 0;} } else { debugLog "Employee is exempt From Tax"; } debugLog "Net Annual Prov. Tax" "" "=" $T0; ::set ProvTax $T0; ::set ProvTax [truncate [::expr $ProvTax/$_pay_frequency] 2]; debugLog "Tax prorated for the PP" "" "=" $ProvTax; ::set ProvTax [::expr $ProvTax*$_pay_frequency]; ::return $ProvTax; } public method SK-20230101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Saskatchewan Tax Calculation (20230101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.105; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>49720} {::set V 0.125; ::set KP 994;} ::if {$TaxableIncome>142058} {::set V 0.145; ::set KP 3836;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" [round2 $Tmp1]; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; # CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; # EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" [round2 $T4]; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" [round2 $V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" [round2 $S]; ::set LCPp 0; ::set LCPf 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares!=0} { ::set LCPp [::expr {$Shares*0.175}]; ::if {$LCPp>875} {::set LCPp 875;} ::set Tmp1 0;::set Shares 0; ::if {$Tmp1==-1} { ::set Tmp1 [::expr {$Tmp1+1}]; ::set Tmp1 50; ::set LCPf [::expr {$Shares*0.20}]; ::if {$LCPf>1000} {::set LCPf 1000;} } } ::set Tmp1 [::expr {$LCPf+$LCPp}]; ::if {$Tmp1 >=1000} {::set Tmp1 1000;} ::if {$Tmp1<=0} {::set Tmp1 0;} ::set T2 [::expr {$T2-$Tmp1}]; debugLog "Labour sp. funds credit" "(LCP)" "-" [round2 $Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" [round2 $T2]; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" [round2 $_fedTax] $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" [round2 $T2] $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" [round2 $Tmp1] $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [::expr {$Tmp1/$_pay_frequency}]; debugLog "Tax prorated for the PP" "" "=" [round2 $Tmp1]; ::return $T2; } public method YK-20230101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20230101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Td1_prov_basic_claim $_td1_prov_basic_claim; ::if {$TaxableIncome>165430} {::set _td1_prov_basic_claim [::expr {$Td1_prov_basic_claim-($TaxableIncome-165430)*0.0210548793508}];} ::if {$TaxableIncome>235675} {::set _td1_prov_basic_claim 13521;} ::set V 0;::set KP 0; ::set BaseV 0.0640; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>53359} {::set V 0.0900; ::set KP 1387;} ::if {$TaxableIncome>106717} {::set V 0.1090; ::set KP 3415;} ::if {$TaxableIncome>165430} {::set V 0.1280; ::set KP 6558;} ::if {$TaxableIncome>500000} {::set V 0.1500; ::set KP 17558;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set PxCBase [round2 [::expr $PxC*(0.0495/0.0595)]]; ::if {$PxCBase>$_cppBase} { ::set PxCBase $_cppBase; } ::set K2P [::expr {[round2 [::expr {$PxCBase*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxCBase + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1368} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1368}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; debugLog "Tax prorated for the Fed" "" "=" [::expr $_fedTax/$_pay_frequency]; debugLog "Tax prorated for the Prov" "" "=" [::expr $_provTax/$_pay_frequency]; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method BC-20220701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20220701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>43070} {::set V 0.0770;::set KP 1137;} ::if {$TaxableIncome>86141} {::set V 0.1050;::set KP 3549;} ::if {$TaxableIncome>98901} {::set V 0.1229;::set KP 5319;} ::if {$TaxableIncome>120094} {::set V 0.1470;::set KP 8214;} ::if {$TaxableIncome>162832} {::set V 0.1680;::set KP 11633;} ::if {$TaxableIncome>227091} {::set V 0.2050;::set KP 20035;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=21867} { ::set S $T4; ::if {$S>491} { ::set S 491; } } else { ::if {$A1<=35659} { ::set S [::expr {491-[round2 [::expr {($A1-21867)*0.0356}]]}];s ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method FEDERAL-20220101 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.15;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>50197} {::set R 0.205;::set K 2761;} ::if {$TaxableIncome>100392} {::set R 0.260;::set K 8282;} ::if {$TaxableIncome>155625} {::set R 0.290;::set K 12951;} ::if {$TaxableIncome>221708} {::set R 0.330;::set K 21819;} debugLog "--- Federal Tax Calculation (20220101) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::set K2C [::expr $K2Rate*$YtdCpp]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCpp $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1287.00} { ::set K4Wages 1287.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.15]]; ::if {$LSF>750} {::set LSF 750}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method BC-20220101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20220101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>43070} {::set V 0.0770;::set KP 1137;} ::if {$TaxableIncome>86141} {::set V 0.1050;::set KP 3549;} ::if {$TaxableIncome>98901} {::set V 0.1229;::set KP 5319;} ::if {$TaxableIncome>120094} {::set V 0.1470;::set KP 8214;} ::if {$TaxableIncome>162832} {::set V 0.1680;::set KP 11633;} ::if {$TaxableIncome>227091} {::set V 0.2050;::set KP 20035;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=21867} { ::set S $T4; ::if {$S>491} { ::set S 491; } } else { ::if {$A1<=35659} { ::set S [::expr {491-[round2 [::expr {($A1-21867)*0.0356}]]}];s ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr $Shares*0.15]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method MB-20220101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Manitoba Tax Calculation (20220101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.108; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>34431} {::set V 0.1275; ::set KP 671;} ::if {$TaxableIncome>74416} {::set V 0.1740; ::set KP 4132;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20220101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20220101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.094; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>44887} {::set V 0.1482; ::set KP 2433;} ::if {$TaxableIncome>89775} {::set V 0.1652; ::set KP 3959;} ::if {$TaxableIncome>145955} {::set V 0.1784; ::set KP 5886;} ::if {$TaxableIncome>166280} {::set V 0.2030; ::set KP 9976;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20220101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20220101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.087; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>39147} {::set V 0.145; ::set KP 2271;} ::if {$TaxableIncome>78294} {::set V 0.158; ::set KP 3288;} ::if {$TaxableIncome>139780} {::set V 0.178; ::set KP 6084;} ::if {$TaxableIncome>195693} {::set V 0.198; ::set KP 9998;} ::if {$TaxableIncome>250000} {::set V 0.208; ::set KP 12498;} ::if {$TaxableIncome>500000} {::set V 0.213; ::set KP 14998;} ::if {$TaxableIncome>1000000} {::set V 0.218; ::set KP 19998;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NT-20220101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Northwest Territories Tax Calculation (20220101) ---"; debugLog "Annual taxable income (A) [round2 $TaxableIncome]"; ::set V 0;::set KP 0; ::set BaseV 0.0590; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>45462} {::set V 0.0860; ::set KP 1227;} ::if {$TaxableIncome>90927} {::set V 0.1220; ::set KP 4501;} ::if {$TaxableIncome>147826} {::set V 0.1405; ::set KP 7236;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2-)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NU-20220101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nunavut Tax Calculation (20220101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0400; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>47862} {::set V 0.0700; ::set KP 1436;} ::if {$TaxableIncome>95724} {::set V 0.0900; ::set KP 3350;} ::if {$TaxableIncome>155625} {::set V 0.1150; ::set KP 7241;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20220101 {TaxableIncome} { ::set T2 0; # Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20220101) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>46226} {::set V 0.0915;::set KP 1895;} ::if {$TaxableIncome>92454} {::set V 0.1116;::set KP 3754;} ::if {$TaxableIncome>150000} {::set V 0.1216;::set KP 5254;} ::if {$TaxableIncome>220000} {::set V 0.1316;::set KP 7454;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>4991} { ::if {$T4<=6387} { ::set Tmp1 [::expr $T4-4991]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-4991]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-6387]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*475]; ::set Tmp1 [::expr $Tmp1+257]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PQ-20220101 {TaxableIncome {FederalVersion "20220101"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.16303; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method QT-20220101 {TaxableIncome} { debugLog "--- Quebec Provincial Tax Calculation (20220101) ---"; debugLog "Annual income" "(A)" "" $TaxableIncome; ::set T0 0; ::if {[employeeInfoGet ".provincial.td1_claim_amount"] ne "X"} { ::set EmploymentIncomeDeduction [::expr $TaxableIncome*0.06]; ::if {$EmploymentIncomeDeduction>1235.00} { ::set EmploymentIncomeDeduction 1235.00; } ::set TaxableIncome [::expr $TaxableIncome-$EmploymentIncomeDeduction]; debugLog "Employ. Inc. Ded" "(H)" "-" $EmploymentIncomeDeduction; debugLog "Annual taxable income" "(I)" "" $TaxableIncome; ::set T 0.1500;::set K 0.0; ::if {$TaxableIncome>46295} {::set T 0.2000;::set K 2314;} ::if {$TaxableIncome>92580} {::set T 0.2400;::set K 6017;} ::if {$TaxableIncome>112655} {::set T 0.2575;::set K 7989;} debugLog "Provincial Tax Rate" "(T)" "*" $T; ::set T0 [::expr $TaxableIncome*$T]; ;#// T(I) ::set T0 [round2 $T0]; debugLog "Basic Tax" "" "=" $T0; ::set T0 [::expr $T0-$K]; ;#// - K debugLog "Adjustment Constant" "(K)" "-" $K; debugLog "Net Tax" "" "=" $T0; ::set E [round2 [::expr $_pClaim*0.15]]; ::set T0 [::expr $T0-$E]; ;#// - 0.20(E) debugLog "Claim Amount Credit" "" "-" $E; debugLog " (15% of $_pClaim)"; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Shares [::expr $Shares*$_pay_frequency]; ::set Q [round2 [::expr $Shares*0.15]]; debugLog "Share purchase tax credit" "(Q)" "-" $Q; debugLog " (15% of $Shares)"; ::set T0 [::expr $T0-$Q]; ;#// - 0.15(P(Q)) ::if {$T0<0} {::set T0 0;} } else { debugLog "Employee is exempt From Tax"; } debugLog "Net Annual Prov. Tax" "" "=" $T0; ::set ProvTax $T0; ::set ProvTax [truncate [::expr $ProvTax/$_pay_frequency] 2]; debugLog "Tax prorated for the PP" "" "=" $ProvTax; ::set ProvTax [::expr $ProvTax*$_pay_frequency]; ::return $ProvTax; } public method SK-20220101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Saskatchewan Tax Calculation (20220101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.105; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>46773} {::set V 0.125; ::set KP 935;} ::if {$TaxableIncome>133638} {::set V 0.145; ::set KP 3608;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" [round2 $Tmp1]; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; # CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; # EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" [round2 $T4]; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" [round2 $V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" [round2 $S]; ::set LCPp 0; ::set LCPf 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares!=0} { ::set LCPp [::expr {$Shares*0.175}]; ::if {$LCPp>875} {::set LCPp 875;} ::set Tmp1 0;::set Shares 0; ::if {$Tmp1==-1} { ::set Tmp1 [::expr {$Tmp1+1}]; ::set Tmp1 50; ::set LCPf [::expr {$Shares*0.20}]; ::if {$LCPf>1000} {::set LCPf 1000;} } } ::set Tmp1 [::expr {$LCPf+$LCPp}]; ::if {$Tmp1 >=1000} {::set Tmp1 1000;} ::if {$Tmp1<=0} {::set Tmp1 0;} ::set T2 [::expr {$T2-$Tmp1}]; debugLog "Labour sp. funds credit" "(LCP)" "-" [round2 $Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" [round2 $T2]; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" [round2 $_fedTax] $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" [round2 $T2] $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" [round2 $Tmp1] $Amt "%"; ::set Tmp1 [::expr {$Tmp1/$_pay_frequency}]; debugLog "Tax prorated for the PP" "" "=" [round2 $Tmp1]; ::return $T2; } public method YK-20220101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20220101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Td1_prov_basic_claim $_td1_prov_basic_claim; ::if {$TaxableIncome>155625} {::set _td1_prov_basic_claim [::expr {$Td1_prov_basic_claim-($TaxableIncome-155625)*0.0254074421560}];} ::if {$TaxableIncome>221708} {::set _td1_prov_basic_claim 12719;} ::set V 0;::set KP 0; ::set BaseV 0.0640; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>50197} {::set V 0.0900; ::set KP 1305;} ::if {$TaxableIncome>100392} {::set V 0.1090; ::set KP 3213;} ::if {$TaxableIncome>155625} {::set V 0.1280; ::set KP 6169;} ::if {$TaxableIncome>500000} {::set V 0.1500; ::set KP 17169;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1287} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1287}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20210701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20210701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0912; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>43835} {::set V 0.1482; ::set KP 2499;} ::if {$TaxableIncome>87671} {::set V 0.1652; ::set KP 3989;} ::if {$TaxableIncome>142534} {::set V 0.1784; ::set KP 5870;} ::if {$TaxableIncome>162383} {::set V 0.2030; ::set KP 9865;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method FEDERAL-20210101 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.15;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>49020} {::set R 0.205;::set K 2696;} ::if {$TaxableIncome>98040} {::set R 0.260;::set K 8088;} ::if {$TaxableIncome>151978} {::set R 0.290;::set K 12648;} ::if {$TaxableIncome>216511} {::set R 0.330;::set K 21308;} debugLog "--- Federal Tax Calculation (20210101) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::set K2C [::expr $K2Rate*$YtdCpp]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCpp $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1257.00} { ::set K4Wages 1257.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.15]]; ::if {$LSF>750} {::set LSF 750}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method BC-20210101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20210101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>42184} {::set V 0.0770;::set KP 1114;} ::if {$TaxableIncome>84369} {::set V 0.1050;::set KP 3476;} ::if {$TaxableIncome>96866} {::set V 0.1229;::set KP 5210;} ::if {$TaxableIncome>117623} {::set V 0.1470;::set KP 8045;} ::if {$TaxableIncome>159483} {::set V 0.1680;::set KP 11394;} ::if {$TaxableIncome>220420} {::set V 0.2050;::set KP 19623;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=21418} { ::set S $T4; ::if {$S>481} { ::set S 481; } } else { ::if {$A1<=34929} { ::set S [::expr {481-[round2 [::expr {($A1-21418)*0.0356}]]}];s ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr $Shares*0.15]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method MB-20210101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Manitoba Tax Calculation (20210101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.108; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>33723} {::set V 0.1275; ::set KP 658;} ::if {$TaxableIncome>72885} {::set V 0.1740; ::set KP 4047;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20210101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20210101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0968; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>43835} {::set V 0.1482; ::set KP 2253;} ::if {$TaxableIncome>87671} {::set V 0.1652; ::set KP 3744;} ::if {$TaxableIncome>142534} {::set V 0.1784; ::set KP 5625;} ::if {$TaxableIncome>162383} {::set V 0.2030; ::set KP 9620;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20210101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20210101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.087; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>38081} {::set V 0.145; ::set KP 2209;} ::if {$TaxableIncome>76161} {::set V 0.158; ::set KP 3199;} ::if {$TaxableIncome>135973} {::set V 0.173; ::set KP 5238;} ::if {$TaxableIncome>190363} {::set V 0.183; ::set KP 7142;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NT-20210101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Northwest Territories Tax Calculation (20210101) ---"; debugLog "Annual taxable income (A) [round2 $TaxableIncome]"; ::set V 0;::set KP 0; ::set BaseV 0.0590; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>44396} {::set V 0.0860; ::set KP 1199;} ::if {$TaxableIncome>88796} {::set V 0.1220; ::set KP 4395;} ::if {$TaxableIncome>144362} {::set V 0.1405; ::set KP 7066;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2-)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NU-20210101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nunavut Tax Calculation (20210101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0400; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>46740} {::set V 0.0700; ::set KP 1402;} ::if {$TaxableIncome>93480} {::set V 0.0900; ::set KP 3272;} ::if {$TaxableIncome>151978} {::set V 0.1150; ::set KP 7071;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20210101 {TaxableIncome} { ::set T2 0; # Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20210101) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>45142} {::set V 0.0915;::set KP 1851;} ::if {$TaxableIncome>90287} {::set V 0.1116;::set KP 3666;} ::if {$TaxableIncome>150000} {::set V 0.1216;::set KP 5166;} ::if {$TaxableIncome>220000} {::set V 0.1316;::set KP 7366;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>4874} { ::if {$T4<=6237} { ::set Tmp1 [::expr $T4-4874]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-4874]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-6237]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*464]; ::set Tmp1 [::expr $Tmp1+251]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PQ-20210101 {TaxableIncome {FederalVersion "20210101"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.1650; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method QT-20210101 {TaxableIncome} { debugLog "--- Quebec Provincial Tax Calculation (20210101) ---"; debugLog "Annual income" "(A)" "" $TaxableIncome; ::set T0 0; ::if {[employeeInfoGet ".provincial.td1_claim_amount"] ne "X"} { ::set EmploymentIncomeDeduction [::expr $TaxableIncome*0.06]; ::if {$EmploymentIncomeDeduction>1205.00} { ::set EmploymentIncomeDeduction 1205.00; } ::set TaxableIncome [::expr $TaxableIncome-$EmploymentIncomeDeduction]; debugLog "Employ. Inc. Ded" "(H)" "-" $EmploymentIncomeDeduction; debugLog "Annual taxable income" "(I)" "" $TaxableIncome; ::set T 0.1500;::set K 0.0; ::if {$TaxableIncome>45105} {::set T 0.2000;::set K 2255;} ::if {$TaxableIncome>90200} {::set T 0.2400;::set K 5863;} ::if {$TaxableIncome>109755} {::set T 0.2575;::set K 7783;} debugLog "Provincial Tax Rate" "(T)" "*" $T; ::set T0 [::expr $TaxableIncome*$T]; ;#// T(I) ::set T0 [round2 $T0]; debugLog "Basic Tax" "" "=" $T0; ::set T0 [::expr $T0-$K]; ;#// - K debugLog "Adjustment Constant" "(K)" "-" $K; debugLog "Net Tax" "" "=" $T0; ::set E [round2 [::expr $_pClaim*0.15]]; ::set T0 [::expr $T0-$E]; ;#// - 0.20(E) debugLog "Claim Amount Credit" "" "-" $E; debugLog " (15% of $_pClaim)"; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Shares [::expr $Shares*$_pay_frequency]; ::set Q [round2 [::expr $Shares*0.15]]; debugLog "Share purchase tax credit" "(Q)" "-" $Q; debugLog " (15% of $Shares)"; ::set T0 [::expr $T0-$Q]; ;#// - 0.15(P(Q)) ::if {$T0<0} {::set T0 0;} } else { debugLog "Employee is exempt From Tax"; } debugLog "Net Annual Prov. Tax" "" "=" $T0; ::set ProvTax $T0; ::set ProvTax [truncate [::expr $ProvTax/$_pay_frequency] 2]; debugLog "Tax prorated for the PP" "" "=" $ProvTax; ::set ProvTax [::expr $ProvTax*$_pay_frequency]; ::return $ProvTax; } public method SK-20210101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Saskatchewan Tax Calculation (20210101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.105; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>45677} {::set V 0.125; ::set KP 914;} ::if {$TaxableIncome>130506} {::set V 0.145; ::set KP 3524;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" [round2 $Tmp1]; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; # CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; # EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" [round2 $T4]; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" [round2 $V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" [round2 $S]; ::set LCPp 0; ::set LCPf 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares!=0} { ::set LCPp [::expr {$Shares*0.175}]; ::if {$LCPp>875} {::set LCPp 875;} ::set Tmp1 0;::set Shares 0; ::if {$Tmp1==-1} { ::set Tmp1 [::expr {$Tmp1+1}]; ::set Tmp1 50; ::set LCPf [::expr {$Shares*0.20}]; ::if {$LCPf>1000} {::set LCPf 1000;} } } ::set Tmp1 [::expr {$LCPf+$LCPp}]; ::if {$Tmp1 >=1000} {::set Tmp1 1000;} ::if {$Tmp1<=0} {::set Tmp1 0;} ::set T2 [::expr {$T2-$Tmp1}]; debugLog "Labour sp. funds credit" "(LCP)" "-" [round2 $Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" [round2 $T2]; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" [round2 $_fedTax] $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" [round2 $T2] $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" [round2 $Tmp1] $Amt "%"; ::set Tmp1 [::expr {$Tmp1/$_pay_frequency}]; debugLog "Tax prorated for the PP" "" "=" [round2 $Tmp1]; ::return $T2; } public method YK-20210101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20210101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Td1_prov_basic_claim $_td1_prov_basic_claim; ::if {$TaxableIncome>151978} {::set _td1_prov_basic_claim [::expr {$Td1_prov_basic_claim-($TaxableIncome-151978)*0.0214928796119}];} ::if {$TaxableIncome>214368} {::set _td1_prov_basic_claim 12298;} ::set V 0;::set KP 0; ::set BaseV 0.0640; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>49020} {::set V 0.0900; ::set KP 1275;} ::if {$TaxableIncome>98040} {::set V 0.1090; ::set KP 3137;} ::if {$TaxableIncome>151978} {::set V 0.1280; ::set KP 6025;} ::if {$TaxableIncome>500000} {::set V 0.1500; ::set KP 17025;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1257} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1257}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr {$Shares*0.25}]; ::set Tmp1 [round2 $Tmp1]; ::if {$Tmp1>1250} {::set Tmp1 1250;} ::if {$Tmp1<0} {::set Tmp1 0;} } ::set T2 [::expr {$T2-$Tmp1}]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method BC-20200701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20200701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>41725} {::set V 0.0770;::set KP 1102;} ::if {$TaxableIncome>83451} {::set V 0.1050;::set KP 3438;} ::if {$TaxableIncome>95812} {::set V 0.1229;::set KP 5153;} ::if {$TaxableIncome>116344} {::set V 0.1470;::set KP 7957;} ::if {$TaxableIncome>157748} {::set V 0.1680;::set KP 11270;} ::if {$TaxableIncome>220000} {::set V 0.2420;::set KP 27550;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=21185} { ::set S $T4; ::if {$S>476} { ::set S 476; } } else { ::if {$A1<=34556} { ::set S [::expr {476-[round2 [::expr {($A1-21185)*0.0356}]]}];s ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr $Shares*0.15]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method YK-20200701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20200701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Td1_prov_basic_claim $_td1_prov_basic_claim; ::if {$TaxableIncome>150473} {::set _td1_prov_basic_claim [::expr {$Td1_prov_basic_claim-($TaxableIncome-150473)*0.0291415603724}];} ::if {$TaxableIncome>214368} {::set _td1_prov_basic_claim 12298;} ::set V 0;::set KP 0; ::set BaseV 0.0640; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>48535} {::set V 0.0900; ::set KP 1262;} ::if {$TaxableIncome>97069} {::set V 0.1090; ::set KP 3106;} ::if {$TaxableIncome>150473} {::set V 0.1280; ::set KP 5965;} ::if {$TaxableIncome>500000} {::set V 0.1500; ::set KP 16965;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1245} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1245}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr {$Shares*0.25}]; ::set Tmp1 [round2 $Tmp1]; ::if {$Tmp1>1250} {::set Tmp1 1250;} ::if {$Tmp1<0} {::set Tmp1 0;} } ::set T2 [::expr {$T2-$Tmp1}]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method FEDERAL-20200101 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.15;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>48535} {::set R 0.205;::set K 2669;} ::if {$TaxableIncome>97069} {::set R 0.260;::set K 8008;} ::if {$TaxableIncome>150473} {::set R 0.290;::set K 12522;} ::if {$TaxableIncome>214368} {::set R 0.330;::set K 21097;} debugLog "--- Federal Tax Calculation (20200101) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::set K2C [::expr $K2Rate*$YtdCpp]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCpp $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1245.00} { ::set K4Wages 1245.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.15]]; ::if {$LSF>750} {::set LSF 750}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method BC-20200101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20200101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>41725} {::set V 0.0770;::set KP 1102;} ::if {$TaxableIncome>83451} {::set V 0.1050;::set KP 3438;} ::if {$TaxableIncome>95812} {::set V 0.1229;::set KP 5153;} ::if {$TaxableIncome>116344} {::set V 0.1470;::set KP 7957;} ::if {$TaxableIncome>157748} {::set V 0.1680;::set KP 11270;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=21185} { ::set S $T4; ::if {$S>476} { ::set S 476; } } else { ::if {$A1<=33702} { ::set S [::expr {476-[round2 [::expr {($A1-21185)*0.0356}]]}];s ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr $Shares*0.15]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method MB-20200101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Manitoba Tax Calculation (20200101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.108; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>33389} {::set V 0.1275; ::set KP 651;} ::if {$TaxableIncome>72164} {::set V 0.1740; ::set KP 4007;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20200101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20200101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0968; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>43401} {::set V 0.1482; ::set KP 2231;} ::if {$TaxableIncome>86803} {::set V 0.1652; ::set KP 3706;} ::if {$TaxableIncome>141122} {::set V 0.1784; ::set KP 5569;} ::if {$TaxableIncome>160776} {::set V 0.1960; ::set KP 9524;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20200101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20200101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.087; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>37929} {::set V 0.145; ::set KP 2200;} ::if {$TaxableIncome>75858} {::set V 0.158; ::set KP 3186;} ::if {$TaxableIncome>135432} {::set V 0.173; ::set KP 5218;} ::if {$TaxableIncome>189604} {::set V 0.183; ::set KP 7114;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NT-20200101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Northwest Territories Tax Calculation (20200101) ---"; debugLog "Annual taxable income (A) [round2 $TaxableIncome]"; ::set V 0;::set KP 0; ::set BaseV 0.0590; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>43957} {::set V 0.0860; ::set KP 1187;} ::if {$TaxableIncome>87916} {::set V 0.1220; ::set KP 4352;} ::if {$TaxableIncome>142932} {::set V 0.1405; ::set KP 6996;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2-)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NU-20200101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nunavut Tax Calculation (20200101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0400; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>46277} {::set V 0.0700; ::set KP 1388;} ::if {$TaxableIncome>92555} {::set V 0.0900; ::set KP 3239;} ::if {$TaxableIncome>150473} {::set V 0.1150; ::set KP 7001;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20200101 {TaxableIncome} { ::set T2 0; # Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20200101) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>44740} {::set V 0.0915;::set KP 1834;} ::if {$TaxableIncome>89482} {::set V 0.1116;::set KP 3633;} ::if {$TaxableIncome>150000} {::set V 0.1216;::set KP 5133;} ::if {$TaxableIncome>220000} {::set V 0.1316;::set KP 7333;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>4830} { ::if {$T4<=6182} { ::set Tmp1 [::expr $T4-4830]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-4830]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-6182]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*460]; ::set Tmp1 [::expr $Tmp1+249]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PQ-20200101 {TaxableIncome {FederalVersion "20200101"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.1650; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method QT-20200101 {TaxableIncome} { debugLog "--- Quebec Provincial Tax Calculation (20200101) ---"; debugLog "Annual income" "(A)" "" $TaxableIncome; ::set T0 0; ::if {[employeeInfoGet ".provincial.td1_claim_amount"] ne "X"} { ::set EmploymentIncomeDeduction [::expr $TaxableIncome*0.06]; ::if {$EmploymentIncomeDeduction>1190.00} { ::set EmploymentIncomeDeduction 1190.00; } ::set TaxableIncome [::expr $TaxableIncome-$EmploymentIncomeDeduction]; debugLog "Employ. Inc. Ded" "(H)" "-" $EmploymentIncomeDeduction; debugLog "Annual taxable income" "(I)" "" $TaxableIncome; ::set T 0.1500;::set K 0.0; ::if {$TaxableIncome>44545} {::set T 0.2000;::set K 2227;} ::if {$TaxableIncome>89080} {::set T 0.2400;::set K 5790;} ::if {$TaxableIncome>108390} {::set T 0.2575;::set K 7687;} debugLog "Provincial Tax Rate" "(T)" "*" $T; ::set T0 [::expr $TaxableIncome*$T]; ;#// T(I) ::set T0 [round2 $T0]; debugLog "Basic Tax" "" "=" $T0; ::set T0 [::expr $T0-$K]; ;#// - K debugLog "Adjustment Constant" "(K)" "-" $K; debugLog "Net Tax" "" "=" $T0; ::set E [round2 [::expr $_pClaim*0.15]]; ::set T0 [::expr $T0-$E]; ;#// - 0.20(E) debugLog "Claim Amount Credit" "" "-" $E; debugLog " (15% of $_pClaim)"; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Shares [::expr $Shares*$_pay_frequency]; ::set Q [round2 [::expr $Shares*0.15]]; debugLog "Share purchase tax credit" "(Q)" "-" $Q; debugLog " (15% of $Shares)"; ::set T0 [::expr $T0-$Q]; ;#// - 0.15(P(Q)) ::if {$T0<0} {::set T0 0;} } else { debugLog "Employee is exempt From Tax"; } debugLog "Net Annual Prov. Tax" "" "=" $T0; ::set ProvTax $T0; ::set ProvTax [truncate [::expr $ProvTax/$_pay_frequency] 2]; debugLog "Tax prorated for the PP" "" "=" $ProvTax; ::set ProvTax [::expr $ProvTax*$_pay_frequency]; ::return $ProvTax; } public method YK-20200101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20200101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0640; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>48535} {::set V 0.0900; ::set KP 1262;} ::if {$TaxableIncome>97069} {::set V 0.1090; ::set KP 3106;} ::if {$TaxableIncome>150473} {::set V 0.1280; ::set KP 5965;} ::if {$TaxableIncome>500000} {::set V 0.1500; ::set KP 16965;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1245} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1245}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr {$Shares*0.25}]; ::set Tmp1 [round2 $Tmp1]; ::if {$Tmp1>1250} {::set Tmp1 1250;} ::if {$Tmp1<0} {::set Tmp1 0;} } ::set T2 [::expr {$T2-$Tmp1}]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method FEDERAL-20190101 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.15;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>47630} {::set R 0.205;::set K 2620;} ::if {$TaxableIncome>95259} {::set R 0.260;::set K 7859;} ::if {$TaxableIncome>147667} {::set R 0.290;::set K 12289;} ::if {$TaxableIncome>210371} {::set R 0.330;::set K 20704;} debugLog "--- Federal Tax Calculation (20190101) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::set K2C [::expr $K2Rate*$YtdCpp]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCpp $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1222.00} { ::set K4Wages 1222.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.15]]; ::if {$LSF>750} {::set LSF 750}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method AB-20190101 {TaxableIncome} { ::set T2 0; ;# Initialize provincial tax to deduct debugLog "--- Alberta Tax Calculation (20190101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set BaseV 0.10; ::set V $BaseV; ::set KP 0; ::if {$TaxableIncome>0} {::set V 0.10;::set KP 0;} ::if {$TaxableIncome>131200} {::set V 0.12;::set KP 2624;} ::if {$TaxableIncome>157464} {::set V 0.13;::set KP 4199;} ::if {$TaxableIncome>209952} {::set V 0.14;::set KP 6299;} ::if {$TaxableIncome>314928} {::set V 0.15;::set KP 9448;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*0.1}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [expr $T2-$S]; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [::expr $Tmp1/$_pay_frequency]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method BC-20190101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20190101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>40707} {::set V 0.0770;::set KP 1075;} ::if {$TaxableIncome>81416} {::set V 0.1050;::set KP 3354;} ::if {$TaxableIncome>93476} {::set V 0.1229;::set KP 5028;} ::if {$TaxableIncome>113506} {::set V 0.1470;::set KP 7763;} ::if {$TaxableIncome>153900} {::set V 0.1680;::set KP 10995;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=20668} { ::set S $T4; ::if {$S>464} { ::set S 464; } } else { ::if {$A1<=33702} { ::set S [::expr {464-[round2 [::expr {($A1-20668)*0.0356}]]}];s ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr $Shares*0.15]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method MB-20190101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Manitoba Tax Calculation (20190101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.108; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>32670} {::set V 0.1275; ::set KP 637;} ::if {$TaxableIncome>70610} {::set V 0.1740; ::set KP 3920;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*"0.15"]; ::if {$Tmp1>1800} {::set Tmp1 1800;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20190101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20190101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0968; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>42592} {::set V 0.1482; ::set KP 2189;} ::if {$TaxableIncome>85184} {::set V 0.1652; ::set KP 3637;} ::if {$TaxableIncome>138491} {::set V 0.1784; ::set KP 5465;} ::if {$TaxableIncome>157778} {::set V 0.1960; ::set KP 9347;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20190101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20190101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.087; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>37591} {::set V 0.145; ::set KP 2180;} ::if {$TaxableIncome>75181} {::set V 0.158; ::set KP 3158;} ::if {$TaxableIncome>134224} {::set V 0.173; ::set KP 5171;} ::if {$TaxableIncome>187913} {::set V 0.183; ::set KP 7050;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::if {$TaxableIncome<=50000} { ::set V2 0; } else { ::set Blist { {50000 0} {55000 100} {60000 200} {65000 300} {70000 400} {75000 500} {80000 600} {100000 700} {125000 800} {175000 900} {250000 1000} {300000 1100} {350000 1200} {400000 1300} {450000 1400} {500000 1500} {550000 1600} {600000 1700} }; ::set Pos 0; ::while {$Pos<[::llength $Blist]&&$TaxableIncome>[::lindex [::lindex $Blist $Pos] 0]} { ::incr Pos; } ::incr Pos -1; ::set V2 [::expr {($TaxableIncome-[::lindex [::lindex $Blist $Pos] 0])*0.10}]; ::if {$V2>100} { ::set V2 [::expr {[::lindex [::lindex $Blist $Pos] 1]+100}]; } else { ::set V2 [::expr {[::lindex [::lindex $Blist $Pos] 1]+$V2}]; } } ::set T2 [::expr $T2+$V2]; ::set Amt [round2 $V2]; debugLog "Provincial surtax" "(V2)" "+" $V2; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NT-20190101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Northwest Territories Tax Calculation (20190101) ---"; debugLog "Annual taxable income (A) [round2 $TaxableIncome]"; ::set V 0;::set KP 0; ::set BaseV 0.0590; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>43137} {::set V 0.0860; ::set KP 1165;} ::if {$TaxableIncome>86277} {::set V 0.1220; ::set KP 4271;} ::if {$TaxableIncome>140267} {::set V 0.1405; ::set KP 6866;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2-)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NU-20190101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nunavut Tax Calculation (20190101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0400; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>45414} {::set V 0.0700; ::set KP 1362;} ::if {$TaxableIncome>90829} {::set V 0.0900; ::set KP 3179;} ::if {$TaxableIncome>147667} {::set V 0.1150; ::set KP 6871;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20190101 {TaxableIncome} { ::set T2 0; # Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20190101) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>43906} {::set V 0.0915;::set KP 1800;} ::if {$TaxableIncome>87813} {::set V 0.1116;::set KP 3565;} ::if {$TaxableIncome>150000} {::set V 0.1216;::set KP 5065;} ::if {$TaxableIncome>220000} {::set V 0.1316;::set KP 7265;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>4740} { ::if {$T4<=6067} { ::set Tmp1 [::expr $T4-4740]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-4740]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-6067]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*452]; ::set Tmp1 [::expr $Tmp1+244]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PQ-20190101 {TaxableIncome {FederalVersion "20190101"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.1650; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method QT-20190101 {TaxableIncome} { debugLog "--- Quebec Provincial Tax Calculation (20190101) ---"; debugLog "Annual income" "(A)" "" $TaxableIncome; ::set T0 0; ::if {[employeeInfoGet ".provincial.td1_claim_amount"] ne "X"} { ::set EmploymentIncomeDeduction [::expr $TaxableIncome*0.06]; ::if {$EmploymentIncomeDeduction>1170.00} { ::set EmploymentIncomeDeduction 1170.00; } ::set TaxableIncome [::expr $TaxableIncome-$EmploymentIncomeDeduction]; debugLog "Employ. Inc. Ded" "(H)" "-" $EmploymentIncomeDeduction; debugLog "Annual taxable income" "(I)" "" $TaxableIncome; ::set T 0.1500;::set K 0.0; ::if {$TaxableIncome>43790} {::set T 0.2000;::set K 2189;} ::if {$TaxableIncome>87575} {::set T 0.2400;::set K 5692;} ::if {$TaxableIncome>106555} {::set T 0.2575;::set K 7557;} debugLog "Provincial Tax Rate" "(T)" "*" $T; ::set T0 [::expr $TaxableIncome*$T]; ;#// T(I) ::set T0 [round2 $T0]; debugLog "Basic Tax" "" "=" $T0; ::set T0 [::expr $T0-$K]; ;#// - K debugLog "Adjustment Constant" "(K)" "-" $K; debugLog "Net Tax" "" "=" $T0; ::set E [round2 [::expr $_pClaim*0.15]]; ::set T0 [::expr $T0-$E]; ;#// - 0.20(E) debugLog "Claim Amount Credit" "" "-" $E; debugLog " (15% of $_pClaim)"; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Shares [::expr $Shares*$_pay_frequency]; ::set Q [round2 [::expr $Shares*0.15]]; debugLog "Share purchase tax credit" "(Q)" "-" $Q; debugLog " (15% of $Shares)"; ::set T0 [::expr $T0-$Q]; ;#// - 0.15(P(Q)) ::if {$T0<0} {::set T0 0;} } else { debugLog "Employee is exempt From Tax"; } debugLog "Net Annual Prov. Tax" "" "=" $T0; ::set ProvTax $T0; ::set ProvTax [truncate [::expr $ProvTax/$_pay_frequency] 2]; debugLog "Tax prorated for the PP" "" "=" $ProvTax; ::set ProvTax [::expr $ProvTax*$_pay_frequency]; ::return $ProvTax; } public method YK-20190101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20190101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0640; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>47630} {::set V 0.0900; ::set KP 1238;} ::if {$TaxableIncome>95259} {::set V 0.1090; ::set KP 3048;} ::if {$TaxableIncome>147667} {::set V 0.1280; ::set KP 5854;} ::if {$TaxableIncome>500000} {::set V 0.1500; ::set KP 16854;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1222} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1222}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr {$Shares*0.25}]; ::set Tmp1 [round2 $Tmp1]; ::if {$Tmp1>1250} {::set Tmp1 1250;} ::if {$Tmp1<0} {::set Tmp1 0;} } ::set T2 [::expr {$T2-$Tmp1}]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20180701-CANCELLED {TaxableIncome} { ::set T2 0; # Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20180701) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>42960} {::set V 0.0915;::set KP 1761;} ::if {$TaxableIncome>71500} {::set V 0.1285;::set KP 4407;} ::if {$TaxableIncome>82000} {::set V 0.1785;::set KP 8507;} ::if {$TaxableIncome>85923} {::set V 0.1584;::set KP 6780;} ::if {$TaxableIncome>92000} {::set V 0.2384;::set KP 14140;} ::if {$TaxableIncome>150000} {::set V 0.2584;::set KP 17140;} ::if {$TaxableIncome>220000} {::set V 0.2790;::set KP 21672;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*442]; ::set Tmp1 [::expr $Tmp1+239]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method FEDERAL-20180101 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.15;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>46605} {::set R 0.205;::set K 2563;} ::if {$TaxableIncome>93208} {::set R 0.260;::set K 7690;} ::if {$TaxableIncome>144489} {::set R 0.290;::set K 12024;} ::if {$TaxableIncome>205842} {::set R 0.330;::set K 20258;} debugLog "--- Federal Tax Calculation (20180101) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::set K2C [::expr $K2Rate*$YtdCpp]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCpp $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1195.00} { ::set K4Wages 1195.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.15]]; ::if {$LSF>750} {::set LSF 750}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method AB-20180101 {TaxableIncome} { ::set T2 0; ;# Initialize provincial tax to deduct debugLog "--- Alberta Tax Calculation (20180101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set BaseV 0.10; ::set V $BaseV; ::set KP 0; ::if {$TaxableIncome>0} {::set V 0.10;::set KP 0;} ::if {$TaxableIncome>128145} {::set V 0.12;::set KP 2563;} ::if {$TaxableIncome>153773} {::set V 0.13;::set KP 4101;} ::if {$TaxableIncome>205031} {::set V 0.14;::set KP 6151;} ::if {$TaxableIncome>307547} {::set V 0.15;::set KP 9226;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*0.1}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [expr $T2-$S]; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [::expr $Tmp1/$_pay_frequency]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method BC-20180101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20180101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>39676} {::set V 0.0770;::set KP 1047;} ::if {$TaxableIncome>79353} {::set V 0.1050;::set KP 3269;} ::if {$TaxableIncome>91107} {::set V 0.1229;::set KP 4900;} ::if {$TaxableIncome>110630} {::set V 0.1470;::set KP 7566;} ::if {$TaxableIncome>150000} {::set V 0.1680;::set KP 10716;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=20144} { ::set S $T4; ::if {$S>453.00} { ::set S 453.00; } } else { ::if {$A1<=32868.72} { ::set S [::expr {453.00-[round2 [::expr {($A1-20144)*0.0356}]]}];s ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr $Shares*0.15]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method MB-20180101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Manitoba Tax Calculation (20180101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.108; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>31843} {::set V 0.1275; ::set KP 621;} ::if {$TaxableIncome>68821} {::set V 0.1740; ::set KP 3821;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*"0.15"]; ::if {$Tmp1>1800} {::set Tmp1 1800;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20180101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20180101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0968; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>41675} {::set V 0.1482; ::set KP 2142;} ::if {$TaxableIncome>83351} {::set V 0.1652; ::set KP 3559;} ::if {$TaxableIncome>135510} {::set V 0.1784; ::set KP 5348;} ::if {$TaxableIncome>154382} {::set V 0.1960; ::set KP 9146;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20180101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20180101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.087; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>36926} {::set V 0.145; ::set KP 2142;} ::if {$TaxableIncome>73852} {::set V 0.158; ::set KP 3102;} ::if {$TaxableIncome>131850} {::set V 0.173; ::set KP 5080;} ::if {$TaxableIncome>184590} {::set V 0.183; ::set KP 6925;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::if {$TaxableIncome<=50000} { ::set V2 0; } else { ::set Blist { {50000 0} {55000 100} {60000 200} {65000 300} {70000 400} {75000 500} {80000 600} {100000 700} {125000 800} {175000 900} {250000 1000} {300000 1100} {350000 1200} {400000 1300} {450000 1400} {500000 1500} {550000 1600} {600000 1700} }; ::set Pos 0; ::while {$Pos<[::llength $Blist]&&$TaxableIncome>[::lindex [::lindex $Blist $Pos] 0]} { ::incr Pos; } ::incr Pos -1; ::set V2 [::expr {($TaxableIncome-[::lindex [::lindex $Blist $Pos] 0])*0.10}]; ::if {$V2>100} { ::set V2 [::expr {[::lindex [::lindex $Blist $Pos] 1]+100}]; } else { ::set V2 [::expr {[::lindex [::lindex $Blist $Pos] 1]+$V2}]; } } ::set T2 [::expr $T2+$V2]; ::set Amt [round2 $V2]; debugLog "Provincial surtax" "(V2)" "+" $V2; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NS-20180101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nova Scotia Tax Calculation (20180101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0879; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>29590} {::set V 0.1495; ::set KP 1823;} ::if {$TaxableIncome>59180} {::set V 0.1667; ::set KP 2841;} ::if {$TaxableIncome>93000} {::set V 0.1750; ::set KP 3613;} ::if {$TaxableIncome>150000} {::set V 0.2100; ::set KP 8863;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::if {$TaxableIncome>25000} { ::set Tmp1 [::expr {$TaxableIncome-25000}]; ::set Tmp1 [::expr {$Tmp1*0.06}]; ::set _pClaim [::expr {$_pClaim-$Tmp1}]; } ::if {$TaxableIncome>75000} { ::set _pClaim 8481; } ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set T2 [::expr $T2-0]; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Tmp1 0; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NT-20180101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Northwest Territories Tax Calculation (20180101) ---"; debugLog "Annual taxable income (A) [round2 $TaxableIncome]"; ::set V 0;::set KP 0; ::set BaseV 0.0590; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>42209} {::set V 0.0860; ::set KP 1140;} ::if {$TaxableIncome>84420} {::set V 0.1220; ::set KP 4179;} ::if {$TaxableIncome>137248} {::set V 0.1405; ::set KP 6718;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2-)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NU-20180101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nunavut Tax Calculation (20180101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0400; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>44437} {::set V 0.0700; ::set KP 1333;} ::if {$TaxableIncome>88874} {::set V 0.0900; ::set KP 3111;} ::if {$TaxableIncome>144488} {::set V 0.1150; ::set KP 6723;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20180101 {TaxableIncome} { ::set T2 0; # Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20180101) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>42960} {::set V 0.0915;::set KP 1761;} ::if {$TaxableIncome>85923} {::set V 0.1116;::set KP 3488;} ::if {$TaxableIncome>150000} {::set V 0.1216;::set KP 4988;} ::if {$TaxableIncome>220000} {::set V 0.1316;::set KP 7188;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>4638} { ::if {$T4<=5936} { ::set Tmp1 [::expr $T4-4638]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-4638]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-5936]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*442]; ::set Tmp1 [::expr $Tmp1+239]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PQ-20180101 {TaxableIncome {FederalVersion "20180101"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.1650; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method QT-20180101 {TaxableIncome} { debugLog "--- Quebec Provincial Tax Calculation (20180101) ---"; debugLog "Annual income" "(A)" "" $TaxableIncome; ::set T0 0; ::if {[employeeInfoGet ".provincial.td1_claim_amount"] ne "X"} { ::set EmploymentIncomeDeduction [::expr $TaxableIncome*0.06]; ::if {$EmploymentIncomeDeduction>1150.00} { ::set EmploymentIncomeDeduction 1150.00; } ::set TaxableIncome [::expr $TaxableIncome-$EmploymentIncomeDeduction]; debugLog "Employ. Inc. Ded" "(H)" "-" $EmploymentIncomeDeduction; debugLog "Annual taxable income" "(I)" "" $TaxableIncome; ::set T 0.1500;::set K 0.0; ::if {$TaxableIncome>43055} {::set T 0.2000;::set K 2152;} ::if {$TaxableIncome>86105} {::set T 0.2400;::set K 5596;} ::if {$TaxableIncome>104765} {::set T 0.2575;::set K 7430;} debugLog "Provincial Tax Rate" "(T)" "*" $T; ::set T0 [::expr $TaxableIncome*$T]; ;#// T(I) ::set T0 [round2 $T0]; debugLog "Basic Tax" "" "=" $T0; ::set T0 [::expr $T0-$K]; ;#// - K debugLog "Adjustment Constant" "(K)" "-" $K; debugLog "Net Tax" "" "=" $T0; ::set E [round2 [::expr $_pClaim*0.15]]; ::set T0 [::expr $T0-$E]; ;#// - 0.20(E) debugLog "Claim Amount Credit" "" "-" $E; debugLog " (15% of $_pClaim)"; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Shares [::expr $Shares*$_pay_frequency]; ::set Q [round2 [::expr $Shares*0.15]]; debugLog "Share purchase tax credit" "(Q)" "-" $Q; debugLog " (15% of $Shares)"; ::set T0 [::expr $T0-$Q]; ;#// - 0.15(P(Q)) ::if {$T0<0} {::set T0 0;} } else { debugLog "Employee is exempt From Tax"; } debugLog "Net Annual Prov. Tax" "" "=" $T0; ::set ProvTax $T0; ::set ProvTax [truncate [::expr $ProvTax/$_pay_frequency] 2]; debugLog "Tax prorated for the PP" "" "=" $ProvTax; ::set ProvTax [::expr $ProvTax*$_pay_frequency]; ::return $ProvTax; } public method SK-20180101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Saskatchewan Tax Calculation (20180101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.105; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>45225} {::set V 0.125; ::set KP 905;} ::if {$TaxableIncome>129214} {::set V 0.145; ::set KP 3489;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" [round2 $Tmp1]; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; # CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; # EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" [round2 $T4]; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" [round2 $V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" [round2 $S]; ::set LCPp 0; ::set LCPf 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares!=0} { ::set LCPp [::expr {$Shares*0.175}]; ::if {$LCPp>875} {::set LCPp 875;} ::set Tmp1 0;::set Shares 0; ::if {$Tmp1==-1} { ::set Tmp1 [::expr {$Tmp1+1}]; ::set Tmp1 50; ::set LCPf [::expr {$Shares*0.20}]; ::if {$LCPf>1000} {::set LCPf 1000;} } } ::set Tmp1 [::expr {$LCPf+$LCPp}]; ::if {$Tmp1 >=1000} {::set Tmp1 1000;} ::if {$Tmp1<=0} {::set Tmp1 0;} ::set T2 [::expr {$T2-$Tmp1}]; debugLog "Labour sp. funds credit" "(LCP)" "-" [round2 $Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" [round2 $T2]; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" [round2 $_fedTax] $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" [round2 $T2] $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" [round2 $Tmp1] $Amt "%"; ::set Tmp1 [::expr {$Tmp1/$_pay_frequency}]; debugLog "Tax prorated for the PP" "" "=" [round2 $Tmp1]; ::return $T2; } public method YK-20180101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20180101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0640; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>46605} {::set V 0.0900; ::set KP 1212;} ::if {$TaxableIncome>93208} {::set V 0.1090; ::set KP 2983;} ::if {$TaxableIncome>144489} {::set V 0.1280; ::set KP 5728;} ::if {$TaxableIncome>500000} {::set V 0.1500; ::set KP 16728;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1195} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1195}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr {$Shares*0.25}]; ::set Tmp1 [round2 $Tmp1]; ::if {$Tmp1>1250} {::set Tmp1 1250;} ::if {$Tmp1<0} {::set Tmp1 0;} } ::set T2 [::expr {$T2-$Tmp1}]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method SK-20170701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Saskatchewan Tax Calculation (20170701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.105; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>45225} {::set V 0.125; ::set KP 905;} ::if {$TaxableIncome>129214} {::set V 0.145; ::set KP 3489;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" [round2 $Tmp1]; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; # CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; # EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" [round2 $T4]; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" [round2 $V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" [round2 $S]; ::set LCPp 0; ::set LCPf 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares!=0} { ::set LCPp [::expr {$Shares*0.20}]; ::if {$LCPp>525} {::set LCPp 525;} ::set Tmp1 0;::set Shares 0; ::if {$Tmp1==-1} { ::set Tmp1 [::expr {$Tmp1+1}]; ::set Tmp1 50; ::set LCPf [::expr {$Shares*0.20}]; ::if {$LCPf>1000} {::set LCPf 1000;} } } ::set Tmp1 [::expr {$LCPf+$LCPp}]; ::if {$Tmp1 >=1000} {::set Tmp1 1000;} ::if {$Tmp1<=0} {::set Tmp1 0;} ::set T2 [::expr {$T2-$Tmp1}]; debugLog "Labour sp. funds credit" "(LCP)" "-" [round2 $Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" [round2 $T2]; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" [round2 $_fedTax] $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" [round2 $T2] $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" [round2 $Tmp1] $Amt "%"; ::set Tmp1 [::expr {$Tmp1/$_pay_frequency}]; debugLog "Tax prorated for the PP" "" "=" [round2 $Tmp1]; ::return $T2; } public method FEDERAL-20170101 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.15;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>45916} {::set R 0.205;::set K 2525;} ::if {$TaxableIncome>91831} {::set R 0.260;::set K 7576;} ::if {$TaxableIncome>142353} {::set R 0.290;::set K 11847;} ::if {$TaxableIncome>202800} {::set R 0.330;::set K 19959;} debugLog "--- Federal Tax Calculation (20170101) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::set K2C [::expr $K2Rate*$YtdCpp]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCpp $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1178.00} { ::set K4Wages 1178.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.15]]; ::if {$LSF>750} {::set LSF 750}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method AB-20170101 {TaxableIncome} { ::set T2 0; ;# Initialize provincial tax to deduct debugLog "--- Alberta Tax Calculation (20170101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set BaseV 0.10; ::set V $BaseV; ::set KP 0; ::if {$TaxableIncome>0} {::set V 0.10;::set KP 0;} ::if {$TaxableIncome>126625} {::set V 0.12;::set KP 2533;} ::if {$TaxableIncome>151950} {::set V 0.13;::set KP 4052;} ::if {$TaxableIncome>202600} {::set V 0.14;::set KP 6078;} ::if {$TaxableIncome>303900} {::set V 0.15;::set KP 9117;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*0.1}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [expr $T2-$S]; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [::expr $Tmp1/$_pay_frequency]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method BC-20170101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20170101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>38898} {::set V 0.0770;::set KP 1027;} ::if {$TaxableIncome>77797} {::set V 0.1050;::set KP 3205;} ::if {$TaxableIncome>89320} {::set V 0.1229;::set KP 4804;} ::if {$TaxableIncome>108460} {::set V 0.1470;::set KP 7418;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=19749} { ::set S $T4; ::if {$S>444.00} { ::set S 444.00; } } else { ::if {$A1<=32220.91} { ::set S [::expr {444.00-[round2 [::expr {($A1-19749)*0.0356}]]}];s ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr $Shares*0.15]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method MB-20170101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Manitoba Tax Calculation (20170101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.108; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>31465} {::set V 0.1275; ::set KP 614;} ::if {$TaxableIncome>68005} {::set V 0.1740; ::set KP 3776;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*"0.15"]; ::if {$Tmp1>1800} {::set Tmp1 1800;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20170101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20170101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0968; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>41059} {::set V 0.1482; ::set KP 2110;} ::if {$TaxableIncome>82119} {::set V 0.1652; ::set KP 3506;} ::if {$TaxableIncome>133507} {::set V 0.1784; ::set KP 5269;} ::if {$TaxableIncome>152100} {::set V 0.1960; ::set KP 9010;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20170101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20170101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.087; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>35851} {::set V 0.145; ::set KP 2079;} ::if {$TaxableIncome>71701} {::set V 0.158; ::set KP 3011;} ::if {$TaxableIncome>128010} {::set V 0.173; ::set KP 4932;} ::if {$TaxableIncome>179214} {::set V 0.183; ::set KP 6724;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::if {$TaxableIncome<=50000} { ::set V2 0; } else { ::set Blist { {50000 0} {55000 100} {60000 200} {65000 300} {70000 400} {75000 500} {80000 600} {100000 700} {125000 800} {175000 900} {250000 1000} {300000 1100} {350000 1200} {400000 1300} {450000 1400} {500000 1500} {550000 1600} {600000 1700} }; ::set Pos 0; ::while {$Pos<[::llength $Blist]&&$TaxableIncome>[::lindex [::lindex $Blist $Pos] 0]} { ::incr Pos; } ::incr Pos -1; ::set V2 [::expr {($TaxableIncome-[::lindex [::lindex $Blist $Pos] 0])*0.10}]; ::if {$V2>100} { ::set V2 [::expr {[::lindex [::lindex $Blist $Pos] 1]+100}]; } else { ::set V2 [::expr {[::lindex [::lindex $Blist $Pos] 1]+$V2}]; } } ::set T2 [::expr $T2+$V2]; ::set Amt [round2 $V2]; debugLog "Provincial surtax" "(V2)" "+" $V2; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NT-20170101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Northwest Territories Tax Calculation (20170101) ---"; debugLog "Annual taxable income (A) [round2 $TaxableIncome]"; ::set V 0;::set KP 0; ::set BaseV 0.0590; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>41585} {::set V 0.0860; ::set KP 1123;} ::if {$TaxableIncome>83172} {::set V 0.1220; ::set KP 4117;} ::if {$TaxableIncome>135219} {::set V 0.1405; ::set KP 6619;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2-)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NU-20170101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nunavut Tax Calculation (20170101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0400; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>43780} {::set V 0.0700; ::set KP 1313;} ::if {$TaxableIncome>87560} {::set V 0.0900; ::set KP 3065;} ::if {$TaxableIncome>142353} {::set V 0.1150; ::set KP 6623;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20170101 {TaxableIncome} { ::set T2 0; # Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20170101) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>42201} {::set V 0.0915;::set KP 1730;} ::if {$TaxableIncome>84404} {::set V 0.1116;::set KP 3427;} ::if {$TaxableIncome>150000} {::set V 0.1216;::set KP 4927;} ::if {$TaxableIncome>220000} {::set V 0.1316;::set KP 7127;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>4556} { ::if {$T4<=5831} { ::set Tmp1 [::expr $T4-4556]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-4556]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-5831]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*434]; ::set Tmp1 [::expr $Tmp1+235]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PQ-20170101 {TaxableIncome {FederalVersion "20170101"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.1650; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method QT-20170101 {TaxableIncome} { debugLog "--- Quebec Provincial Tax Calculation (20170101) ---"; debugLog "Annual income" "(A)" "" $TaxableIncome; ::set T0 0; ::if {[employeeInfoGet ".provincial.td1_claim_amount"] ne "X"} { ::set EmploymentIncomeDeduction [::expr $TaxableIncome*0.06]; ::if {$EmploymentIncomeDeduction>1140.00} { ::set EmploymentIncomeDeduction 1140.00; } ::set TaxableIncome [::expr $TaxableIncome-$EmploymentIncomeDeduction]; debugLog "Employ. Inc. Ded" "(H)" "-" $EmploymentIncomeDeduction; debugLog "Annual taxable income" "(I)" "" $TaxableIncome; ::set T 0.1600;::set K 0.0; ::if {$TaxableIncome>42705} {::set T 0.2000;::set K 1708;} ::if {$TaxableIncome>85405} {::set T 0.2400;::set K 5124;} ::if {$TaxableIncome>103915} {::set T 0.2575;::set K 6943;} debugLog "Provincial Tax Rate" "(T)" "*" $T; ::set T0 [::expr $TaxableIncome*$T]; ;#// T(I) ::set T0 [round2 $T0]; debugLog "Basic Tax" "" "=" $T0; ::set T0 [::expr $T0-$K]; ;#// - K debugLog "Adjustment Constant" "(K)" "-" $K; debugLog "Net Tax" "" "=" $T0; ::set E [round2 [::expr $_pClaim*0.20]]; ::set T0 [::expr $T0-$E]; ;#// - 0.20(E) debugLog "Claim Amount Credit" "" "-" $E; debugLog " (20% of $_pClaim)"; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Shares [::expr $Shares*$_pay_frequency]; ::set Q [round2 [::expr $Shares*0.15]]; debugLog "Share purchase tax credit" "(Q)" "-" $Q; debugLog " (15% of $Shares)"; ::set T0 [::expr $T0-$Q]; ;#// - 0.15(P(Q)) ::if {$T0<0} {::set T0 0;} } else { debugLog "Employee is exempt From Tax"; } debugLog "Net Annual Prov. Tax" "" "=" $T0; ::set ProvTax $T0; ::set ProvTax [truncate [::expr $ProvTax/$_pay_frequency] 2]; debugLog "Tax prorated for the PP" "" "=" $ProvTax; ::set ProvTax [::expr $ProvTax*$_pay_frequency]; ::return $ProvTax; } public method SK-20170101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Saskatchewan Tax Calculation (20170101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.11; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>45225} {::set V 0.13; ::set KP 905;} ::if {$TaxableIncome>129214} {::set V 0.15; ::set KP 3489;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" [round2 $Tmp1]; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; # CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; # EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" [round2 $T4]; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" [round2 $V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" [round2 $S]; ::set LCPp 0; ::set LCPf 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares!=0} { ::set LCPp [::expr {$Shares*0.20}]; ::if {$LCPp>525} {::set LCPp 525;} ::set Tmp1 0;::set Shares 0; ::if {$Tmp1==-1} { ::set Tmp1 [::expr {$Tmp1+1}]; ::set Tmp1 50; ::set LCPf [::expr {$Shares*0.20}]; ::if {$LCPf>1000} {::set LCPf 1000;} } } ::set Tmp1 [::expr {$LCPf+$LCPp}]; ::if {$Tmp1 >=1000} {::set Tmp1 1000;} ::if {$Tmp1<=0} {::set Tmp1 0;} ::set T2 [::expr {$T2-$Tmp1}]; debugLog "Labour sp. funds credit" "(LCP)" "-" [round2 $Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" [round2 $T2]; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" [round2 $_fedTax] $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" [round2 $T2] $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" [round2 $Tmp1] $Amt "%"; ::set Tmp1 [::expr {$Tmp1/$_pay_frequency}]; debugLog "Tax prorated for the PP" "" "=" [round2 $Tmp1]; ::return $T2; } public method YK-20170101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20170101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0640; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>45916} {::set V 0.0900; ::set KP 1194;} ::if {$TaxableIncome>91831} {::set V 0.1090; ::set KP 2939;} ::if {$TaxableIncome>142353} {::set V 0.1280; ::set KP 5643;} ::if {$TaxableIncome>500000} {::set V 0.1500; ::set KP 16643;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1178} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1178}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr {$Shares*0.25}]; ::set Tmp1 [round2 $Tmp1]; ::if {$Tmp1>1250} {::set Tmp1 1250;} ::if {$Tmp1<0} {::set Tmp1 0;} } ::set T2 [::expr {$T2-$Tmp1}]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method BC-20160701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20160101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>38210} {::set V 0.0770;::set KP 1009;} ::if {$TaxableIncome>76421} {::set V 0.1050;::set KP 3149;} ::if {$TaxableIncome>87741} {::set V 0.1229;::set KP 4719;} ::if {$TaxableIncome>106543} {::set V 0.1470;::set KP 7287;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=19629} { ::set S $T4; ::if {$S>436.00} { ::set S 436.00; } } else { ::if {$A1<=31673.20} { ::set S [::expr {436.00-[round2 [::expr {($A1-19629)*0.0362}]]}];s ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr $Shares*0.15]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20160701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20160101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0968; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>40492} {::set V 0.1482; ::set KP 2081;} ::if {$TaxableIncome>80985} {::set V 0.1652; ::set KP 3458;} ::if {$TaxableIncome>131664} {::set V 0.1784; ::set KP 5196;} ::if {$TaxableIncome>150000} {::set V 0.1960; ::set KP 7836;} ::if {$TaxableIncome>250000} {::set V 0.1485; ::set KP -4039;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20160701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20160101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.087; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>35148} {::set V 0.145; ::set KP 2039;} ::if {$TaxableIncome>70295} {::set V 0.158; ::set KP 2952;} ::if {$TaxableIncome>125500} {::set V 0.173; ::set KP 4835;} ::if {$TaxableIncome>175700} {::set V 0.183; ::set KP 6592;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::if {$TaxableIncome<=50000} { ::set V2 0; } else { ::set Blist { {50000 0} {55000 100} {60000 200} {65000 300} {70000 400} {75000 500} {80000 600} {100000 700} {125000 800} {175000 900} {250000 1000} {300000 1100} {350000 1200} {400000 1300} {450000 1400} {500000 1500} {550000 1600} {600000 1700} }; ::set Pos 0; ::while {$Pos<[::llength $Blist]&&$TaxableIncome>[::lindex [::lindex $Blist $Pos] 0]} { ::incr Pos; } ::incr Pos -1; ::set V2 [::expr {($TaxableIncome-[::lindex [::lindex $Blist $Pos] 0])*0.10}]; ::if {$V2>100} { ::set V2 [::expr {[::lindex [::lindex $Blist $Pos] 1]+100}]; } else { ::set V2 [::expr {[::lindex [::lindex $Blist $Pos] 1]+$V2}]; } } ::set T2 [::expr $T2+$V2]; ::set Amt [round2 $V2]; debugLog "Provincial surtax" "(V2)" "+" $V2; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method FEDERAL-20160101 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.15;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>45282} {::set R 0.205;::set K 2491;} ::if {$TaxableIncome>90563} {::set R 0.260;::set K 7471;} ::if {$TaxableIncome>140388} {::set R 0.290;::set K 11683;} ::if {$TaxableIncome>200000} {::set R 0.330;::set K 19683;} debugLog "--- Federal Tax Calculation (20160101) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::set K2C [::expr $K2Rate*$YtdCpp]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCpp $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1161.00} { ::set K4Wages 1161.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.05]]; ::if {$LSF>250} {::set LSF 250}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method BC-20160101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20160101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>38210} {::set V 0.0770;::set KP 1009;} ::if {$TaxableIncome>76421} {::set V 0.1050;::set KP 3149;} ::if {$TaxableIncome>87741} {::set V 0.1229;::set KP 4719;} ::if {$TaxableIncome>106543} {::set V 0.1470;::set KP 7287;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=19171} { ::set S $T4; ::if {$S>436.00} { ::set S 436.00; } } else { ::if {$A1<=31628.14} { ::set S [::expr {436.00-[round2 [::expr {($A1-19171)*0.035}]]}];s ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr $Shares*0.15]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20160101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20160101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0968; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>40492} {::set V 0.1482; ::set KP 2081;} ::if {$TaxableIncome>80985} {::set V 0.1652; ::set KP 3458;} ::if {$TaxableIncome>131664} {::set V 0.1784; ::set KP 5196;} ::if {$TaxableIncome>150000} {::set V 0.2100; ::set KP 9936;} ::if {$TaxableIncome>250000} {::set V 0.2575; ::set KP 21811;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20160101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20160101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.077; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>35148} {::set V 0.125; ::set KP 1687;} ::if {$TaxableIncome>70295} {::set V 0.133; ::set KP 2249;} ::if {$TaxableIncome>125500} {::set V 0.143; ::set KP 3504;} ::if {$TaxableIncome>175700} {::set V 0.153; ::set KP 5261;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NT-20160101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Northwest Territories Tax Calculation (20160101) ---"; debugLog "Annual taxable income (A) [round2 $TaxableIncome]"; ::set V 0;::set KP 0; ::set BaseV 0.0590; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>41011} {::set V 0.0860; ::set KP 1107;} ::if {$TaxableIncome>82024} {::set V 0.1220; ::set KP 4060;} ::if {$TaxableIncome>133353} {::set V 0.1405; ::set KP 6527;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2-)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NU-20160101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nunavut Tax Calculation (20160101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0400; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>43176} {::set V 0.0700; ::set KP 1295;} ::if {$TaxableIncome>86351} {::set V 0.0900; ::set KP 3022;} ::if {$TaxableIncome>140388} {::set V 0.1150; ::set KP 6532;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20160101 {TaxableIncome} { ::set T2 0; # Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20160101) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>41536} {::set V 0.0915;::set KP 1703;} ::if {$TaxableIncome>83075} {::set V 0.1116;::set KP 3373;} ::if {$TaxableIncome>150000} {::set V 0.1216;::set KP 4873;} ::if {$TaxableIncome>220000} {::set V 0.1316;::set KP 7073;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>4484} { ::if {$T4<=5739} { ::set Tmp1 [::expr $T4-4484]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-4484]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-5739]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*427]; ::set Tmp1 [::expr $Tmp1+231]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PQ-20160101 {TaxableIncome {FederalVersion "20160101"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.1650; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method QT-20160101 {TaxableIncome} { debugLog "--- Quebec Provincial Tax Calculation (20160101) ---"; debugLog "Annual income" "(A)" "" $TaxableIncome; ::set T0 0; ::if {[employeeInfoGet ".provincial.td1_claim_amount"] ne "X"} { ::set EmploymentIncomeDeduction [::expr $TaxableIncome*0.06]; ::if {$EmploymentIncomeDeduction>1130.00} { ::set EmploymentIncomeDeduction 1130.00; } ::set TaxableIncome [::expr $TaxableIncome-$EmploymentIncomeDeduction]; debugLog "Employ. Inc. Ded" "(H)" "-" $EmploymentIncomeDeduction; debugLog "Annual taxable income" "(I)" "" $TaxableIncome; ::set T 0.1600;::set K 0.0; ::if {$TaxableIncome>42390} {::set T 0.2000;::set K 1695.00;} ::if {$TaxableIncome>84780} {::set T 0.2400;::set K 5086.00;} ::if {$TaxableIncome>103150} {::set T 0.2575;::set K 6891.00;} debugLog "Provincial Tax Rate" "(T)" "*" $T; ::set T0 [::expr $TaxableIncome*$T]; ;#// T(I) ::set T0 [round2 $T0]; debugLog "Basic Tax" "" "=" $T0; ::set T0 [::expr $T0-$K]; ;#// - K debugLog "Adjustment Constant" "(K)" "-" $K; debugLog "Net Tax" "" "=" $T0; ::set E [round2 [::expr $_pClaim*0.20]]; ::set T0 [::expr $T0-$E]; ;#// - 0.20(E) debugLog "Claim Amount Credit" "" "-" $E; debugLog " (20% of $_pClaim)"; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Shares [::expr $Shares*$_pay_frequency]; ::set Q [round2 [::expr $Shares*0.15]]; debugLog "Share purchase tax credit" "(Q)" "-" $Q; debugLog " (15% of $Shares)"; ::set T0 [::expr $T0-$Q]; ;#// - 0.15(P(Q)) ::if {$T0<0} {::set T0 0;} } else { debugLog "Employee is exempt From Tax"; } debugLog "Net Annual Prov. Tax" "" "=" $T0; ::set ProvTax $T0; ::set ProvTax [truncate [::expr $ProvTax/$_pay_frequency] 2]; debugLog "Tax prorated for the PP" "" "=" $ProvTax; ::set ProvTax [::expr $ProvTax*$_pay_frequency]; ::return $ProvTax; } public method SK-20160101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Saskatchewan Tax Calculation (20160101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.11; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>44601} {::set V 0.13; ::set KP 892;} ::if {$TaxableIncome>127430} {::set V 0.15; ::set KP 3441;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" [round2 $Tmp1]; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; # CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; # EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" [round2 $T4]; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" [round2 $V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" [round2 $S]; ::set LCPp 0; ::set LCPf 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares!=0} { ::set LCPp [::expr {$Shares*0.20}]; ::if {$LCPp>525} {::set LCPp 525;} ::set Tmp1 0;::set Shares 0; ::if {$Tmp1==-1} { ::set Tmp1 [::expr {$Tmp1+1}]; ::set Tmp1 50; ::set LCPf [::expr {$Shares*0.20}]; ::if {$LCPf>1000} {::set LCPf 1000;} } } ::set Tmp1 [::expr {$LCPf+$LCPp}]; ::if {$Tmp1 >=1000} {::set Tmp1 1000;} ::if {$Tmp1<=0} {::set Tmp1 0;} ::set T2 [::expr {$T2-$Tmp1}]; debugLog "Labour sp. funds credit" "(LCP)" "-" [round2 $Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" [round2 $T2]; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" [round2 $_fedTax] $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" [round2 $T2] $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" [round2 $Tmp1] $Amt "%"; ::set Tmp1 [::expr {$Tmp1/$_pay_frequency}]; debugLog "Tax prorated for the PP" "" "=" [round2 $Tmp1]; ::return $T2; } public method YK-20160101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20160101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0640; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>45282} {::set V 0.0900; ::set KP 1177;} ::if {$TaxableIncome>90563} {::set V 0.1090; ::set KP 2898;} ::if {$TaxableIncome>140388} {::set V 0.1280; ::set KP 5565;} ::if {$TaxableIncome>500000} {::set V 0.1500; ::set KP 16565;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1161} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1161}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr {$Shares*0.25}]; ::set Tmp1 [round2 $Tmp1]; ::if {$Tmp1>1250} {::set Tmp1 1250;} ::if {$Tmp1<0} {::set Tmp1 0;} } ::set T2 [::expr {$T2-$Tmp1}]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method AB-20151001 {TaxableIncome} { ::set T2 0; ;# Initialize provincial tax to deduct debugLog "--- Alberta Tax Calculation (20151001) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set BaseV 0.10; ::set V $BaseV; ::set KP 0; ::if {$TaxableIncome>0} {::set V 0.10;::set KP 0;} ::if {$TaxableIncome>125000} {::set V 0.12;::set KP 2500;} ::if {$TaxableIncome>150000} {::set V 0.13;::set KP 4000;} ::if {$TaxableIncome>200000} {::set V 0.14;::set KP 6000;} ::if {$TaxableIncome>300000} {::set V 0.15;::set KP 9000;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*0.1}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [expr $T2-$S]; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [::expr $Tmp1/$_pay_frequency]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method BC-20150701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20150701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>37869} {::set V 0.0770;::set KP 1000;} ::if {$TaxableIncome>75740} {::set V 0.1050;::set KP 3120;} ::if {$TaxableIncome>86958} {::set V 0.1229;::set KP 4677;} ::if {$TaxableIncome>105592} {::set V 0.1470;::set KP 7222;} ::if {$TaxableIncome>151050} {::set V 0.1680;::set KP 10394;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=19673} { ::set S $T4; ::if {$S>452.00} { ::set S 452.00; } } else { ::if {$A1<=31567.74} { ::set S [::expr {452.00-[round2 [::expr {($A1-19673)*0.038}]]}]; ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr $Shares*0.15]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20150701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20150701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0968; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>39973} {::set V 0.1482; ::set KP 2055;} ::if {$TaxableIncome>79946} {::set V 0.1652; ::set KP 3414;} ::if {$TaxableIncome>129975} {::set V 0.1784; ::set KP 5129;} ::if {$TaxableIncome>150000} {::set V 0.2416; ::set KP 14609;} ::if {$TaxableIncome>250000} {::set V 0.3366; ::set KP 38359;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20150701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20150701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.077; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>35008} {::set V 0.125; ::set KP 1680;} ::if {$TaxableIncome>70015} {::set V 0.133; ::set KP 2241;} ::if {$TaxableIncome>125000} {::set V 0.143; ::set KP 3491;} ::if {$TaxableIncome>175000} {::set V 0.153; ::set KP 5241;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method YK-20150701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20150701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0576; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>44701} {::set V 0.0832; ::set KP 1144;} ::if {$TaxableIncome>89401} {::set V 0.1036; ::set KP 2968;} ::if {$TaxableIncome>138586} {::set V 0.1283; ::set KP 6405;} ::if {$TaxableIncome>500000} {::set V 0.1724; ::set KP 28405;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1146} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1146}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr {$Shares*0.25}]; ::set Tmp1 [round2 $Tmp1]; ::if {$Tmp1>1250} {::set Tmp1 1250;} ::if {$Tmp1<0} {::set Tmp1 0;} } ::set T2 [::expr {$T2-$Tmp1}]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method FEDERAL-20150101 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.15;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>44701} {::set R 0.22;::set K 3129;} ::if {$TaxableIncome>89401} {::set R 0.26;::set K 6705;} ::if {$TaxableIncome>138586} {::set R 0.29;::set K 10863;} debugLog "--- Federal Tax Calculation (20150101) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::set K2C [::expr $K2Rate*$YtdCpp]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCpp $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1146.00} { ::set K4Wages 1146.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.15]]; ::if {$LSF>750} {::set LSF 750}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method BC-20150101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20150101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>37869} {::set V 0.0770;::set KP 1000;} ::if {$TaxableIncome>75740} {::set V 0.1050;::set KP 3120;} ::if {$TaxableIncome>86958} {::set V 0.1229;::set KP 4677;} ::if {$TaxableIncome>105592} {::set V 0.1470;::set KP 7222;} ::if {$TaxableIncome>151050} {::set V 0.1680;::set KP 10394;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=18327} { ::set S $T4; ::if {$S>412.00} { ::set S 412.00; } } else { ::if {$A1<=31202.00} { ::set S [::expr {412.00-[round2 [::expr {($A1-18327)*0.032}]]}]; ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr $Shares*0.15]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20150101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20150101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0968; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>39973} {::set V 0.1482; ::set KP 2055;} ::if {$TaxableIncome>79946} {::set V 0.1652; ::set KP 3414;} ::if {$TaxableIncome>129975} {::set V 0.1784; ::set KP 5129;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20150101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20150101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.077; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>35008} {::set V 0.125; ::set KP 1680;} ::if {$TaxableIncome>70015} {::set V 0.133; ::set KP 2241;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NT-20150101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Northwest Territories Tax Calculation (20150101) ---"; debugLog "Annual taxable income (A) [round2 $TaxableIncome]"; ::set V 0;::set KP 0; ::set BaseV 0.0590; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>40484} {::set V 0.0860; ::set KP 1093;} ::if {$TaxableIncome>80971} {::set V 0.1220; ::set KP 4008;} ::if {$TaxableIncome>131641} {::set V 0.1405; ::set KP 6443;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2-)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NU-20150101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nunavut Tax Calculation (20150101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0400; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>42622} {::set V 0.0700; ::set KP 1279;} ::if {$TaxableIncome>85243} {::set V 0.0900; ::set KP 2984;} ::if {$TaxableIncome>138586} {::set V 0.1150; ::set KP 6448;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20150101 {TaxableIncome} { ::set T2 0; # Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20150101) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>40922} {::set V 0.0915;::set KP 1678;} ::if {$TaxableIncome>81847} {::set V 0.1116;::set KP 3323;} ::if {$TaxableIncome>150000} {::set V 0.1216;::set KP 4823;} ::if {$TaxableIncome>220000} {::set V 0.1316;::set KP 7023;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>4418} { ::if {$T4<=5654} { ::set Tmp1 [::expr $T4-4418]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-4418]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-5654]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*421]; ::set Tmp1 [::expr $Tmp1+228]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PQ-20150101 {TaxableIncome {FederalVersion "20150101"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.1650; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method QT-20150101 {TaxableIncome} { debugLog "--- Quebec Provincial Tax Calculation (20150101) ---"; debugLog "Annual income" "(A)" "" $TaxableIncome; ::set T0 0; ::if {[employeeInfoGet ".provincial.td1_claim_amount"] ne "X"} { ::set EmploymentIncomeDeduction [::expr $TaxableIncome*0.06]; ::if {$EmploymentIncomeDeduction>1120.00} { ::set EmploymentIncomeDeduction 1120.00; } ::set TaxableIncome [::expr $TaxableIncome-$EmploymentIncomeDeduction]; debugLog "Employ. Inc. Ded" "(H)" "-" $EmploymentIncomeDeduction; debugLog "Annual taxable income" "(I)" "" $TaxableIncome; ::set T 0.1600;::set K 0.0; ::if {$TaxableIncome>41935} {::set T 0.2000;::set K 1677.00;} ::if {$TaxableIncome>83865} {::set T 0.2400;::set K 5032.00;} ::if {$TaxableIncome>102040} {::set T 0.2575;::set K 6817.00;} debugLog "Provincial Tax Rate" "(T)" "*" $T; ::set T0 [::expr $TaxableIncome*$T]; ;#// T(I) ::set T0 [round2 $T0]; debugLog "Basic Tax" "" "=" $T0; ::set T0 [::expr $T0-$K]; ;#// - K debugLog "Adjustment Constant" "(K)" "-" $K; debugLog "Net Tax" "" "=" $T0; ::set E [round2 [::expr $_pClaim*0.20]]; ::set T0 [::expr $T0-$E]; ;#// - 0.20(E) debugLog "Claim Amount Credit" "" "-" $E; debugLog " (20% of $_pClaim)"; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Shares [::expr $Shares*$_pay_frequency]; ::set Q [round2 [::expr $Shares*0.15]]; debugLog "Share purchase tax credit" "(Q)" "-" $Q; debugLog " (15% of $Shares)"; ::set T0 [::expr $T0-$Q]; ;#// - 0.15(P(Q)) ::if {$T0<0} {::set T0 0;} } else { debugLog "Employee is exempt From Tax"; } debugLog "Net Annual Prov. Tax" "" "=" $T0; ::set ProvTax $T0; ::set ProvTax [truncate [::expr $ProvTax/$_pay_frequency] 2]; debugLog "Tax prorated for the PP" "" "=" $ProvTax; ::set ProvTax [::expr $ProvTax*$_pay_frequency]; ::return $ProvTax; } public method SK-20150101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Saskatchewan Tax Calculation (20150101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.11; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>44028} {::set V 0.13; ::set KP 881;} ::if {$TaxableIncome>125795} {::set V 0.15; ::set KP 3396;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" [round2 $Tmp1]; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; # CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; # EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" [round2 $T4]; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" [round2 $V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" [round2 $S]; ::set LCPp 0; ::set LCPf 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares!=0} { ::set LCPp [::expr {$Shares*0.20}]; ::if {$LCPp>525} {::set LCPp 525;} ::set Tmp1 0;::set Shares 0; ::if {$Tmp1==-1} { ::set Tmp1 [::expr {$Tmp1+1}]; ::set Tmp1 50; ::set LCPf [::expr {$Shares*0.20}]; ::if {$LCPf>1000} {::set LCPf 1000;} } } ::set Tmp1 [::expr {$LCPf+$LCPp}]; ::if {$Tmp1 >=1000} {::set Tmp1 1000;} ::if {$Tmp1<=0} {::set Tmp1 0;} ::set T2 [::expr {$T2-$Tmp1}]; debugLog "Labour sp. funds credit" "(LCP)" "-" [round2 $Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" [round2 $T2]; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" [round2 $_fedTax] $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" [round2 $T2] $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" [round2 $Tmp1] $Amt "%"; ::set Tmp1 [::expr {$Tmp1/$_pay_frequency}]; debugLog "Tax prorated for the PP" "" "=" [round2 $Tmp1]; ::return $T2; } public method YK-20150101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20150101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0704; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>44701} {::set V 0.0968; ::set KP 1180;} ::if {$TaxableIncome>89401} {::set V 0.1144; ::set KP 2754;} ::if {$TaxableIncome>138586} {::set V 0.1276; ::set KP 4583;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1146} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1146}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::if {$T4>6000} { ::set V1 [::expr {$T4-6000}]; ::set V1 [::expr {$V1*0.05}]; ::set V1 [round2 $V1]; } ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr {$Shares*0.25}]; ::set Tmp1 [round2 $Tmp1]; ::if {$Tmp1>1250} {::set Tmp1 1250;} ::if {$Tmp1<0} {::set Tmp1 0;} } ::set T2 [::expr {$T2-$Tmp1}]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20140901 {TaxableIncome} { ::set T2 0; # Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20140901) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>40120} {::set V 0.0915;::set KP 1645;} ::if {$TaxableIncome>80242} {::set V 0.1116;::set KP 3258;} ::if {$TaxableIncome>150000} {::set V 0.1416;::set KP 7758;} ::if {$TaxableIncome>220000} {::set V 0.1716;::set KP 14358;} ::if {$TaxableIncome>514090} {::set V 0.1316;::set KP -6206;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>4331} { ::if {$T4<=5543} { ::set Tmp1 [::expr $T4-4331]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-4331]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-5543]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*413]; ::set Tmp1 [::expr $Tmp1+223]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method FEDERAL-20140101 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.15;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>43953} {::set R 0.22;::set K 3077;} ::if {$TaxableIncome>87907} {::set R 0.26;::set K 6593;} ::if {$TaxableIncome>136270} {::set R 0.29;::set K 10681;} debugLog "--- Federal Tax Calculation (20140101) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::set K2C [::expr $K2Rate*$YtdCpp]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCpp $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1127.00} { ::set K4Wages 1127.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.15]]; ::if {$LSF>750} {::set LSF 750}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method BC-20140101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20140101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>37606} {::set V 0.0770;::set KP 993;} ::if {$TaxableIncome>75213} {::set V 0.1050;::set KP 3099;} ::if {$TaxableIncome>86354} {::set V 0.1229;::set KP 4644;} ::if {$TaxableIncome>104858} {::set V 0.1470;::set KP 7172;} ::if {$TaxableIncome>150000} {::set V 0.1680;::set KP 10322;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=18200} { ::set S $T4; ::if {$S>409.00} { ::set S 409.00; } } else { ::if {$A1<=30981.25} { ::set S [::expr {409.00-[round2 [::expr {($A1-18200)*0.032}]]}]; ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr $Shares*0.15]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20140101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20140101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0968; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>39305} {::set V 0.1482; ::set KP 2020;} ::if {$TaxableIncome>78609} {::set V 0.1652; ::set KP 3357;} ::if {$TaxableIncome>127802} {::set V 0.1784; ::set KP 5044;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20140101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20140101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.077; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>34254} {::set V 0.125; ::set KP 1644;} ::if {$TaxableIncome>68508} {::set V 0.133; ::set KP 2192;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NT-20140101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Northwest Territories Tax Calculation (20140101) ---"; debugLog "Annual taxable income (A) [round2 $TaxableIncome]"; ::set V 0;::set KP 0; ::set BaseV 0.0590; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>39808} {::set V 0.0860; ::set KP 1075;} ::if {$TaxableIncome>79618} {::set V 0.1220; ::set KP 3941;} ::if {$TaxableIncome>129441} {::set V 0.1405; ::set KP 6336;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2-)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NU-20140101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nunavut Tax Calculation (20140101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0400; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>41909} {::set V 0.0700; ::set KP 1257;} ::if {$TaxableIncome>83818} {::set V 0.0900; ::set KP 2934;} ::if {$TaxableIncome>136270} {::set V 0.1150; ::set KP 6340;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20140101 {TaxableIncome} { ::set T2 0; # Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20140101) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>40120} {::set V 0.0915;::set KP 1645;} ::if {$TaxableIncome>80242} {::set V 0.1116;::set KP 3258;} ::if {$TaxableIncome>514090} {::set V 0.1316;::set KP 13540;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>4331} { ::if {$T4<=5543} { ::set Tmp1 [::expr $T4-4331]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-4331]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-5543]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*413]; ::set Tmp1 [::expr $Tmp1+223]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PQ-20140101 {TaxableIncome {FederalVersion "20140101"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.1650; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method QT-20140101 {TaxableIncome} { debugLog "--- Quebec Provincial Tax Calculation (20140101) ---"; debugLog "Annual income" "(A)" "" $TaxableIncome; ::set T0 0; ::if {[employeeInfoGet ".provincial.td1_claim_amount"] ne "X"} { ::set EmploymentIncomeDeduction [::expr $TaxableIncome*0.06]; ::if {$EmploymentIncomeDeduction>1110.00} { ::set EmploymentIncomeDeduction 1110.00; } ::set TaxableIncome [::expr $TaxableIncome-$EmploymentIncomeDeduction]; debugLog "Employ. Inc. Ded" "(H)" "-" $EmploymentIncomeDeduction; debugLog "Annual taxable income" "(I)" "" $TaxableIncome; ::set T 0.1600;::set K 0.0; ::if {$TaxableIncome>41495} {::set T 0.2000;::set K 1659.00;} ::if {$TaxableIncome>82985} {::set T 0.2400;::set K 4979.00;} ::if {$TaxableIncome>100970} {::set T 0.2575;::set K 6746.00;} debugLog "Provincial Tax Rate" "(T)" "*" $T; ::set T0 [::expr $TaxableIncome*$T]; ;#// T(I) ::set T0 [round2 $T0]; debugLog "Basic Tax" "" "=" $T0; ::set T0 [::expr $T0-$K]; ;#// - K debugLog "Adjustment Constant" "(K)" "-" $K; debugLog "Net Tax" "" "=" $T0; ::set E [round2 [::expr $_pClaim*0.20]]; ::set T0 [::expr $T0-$E]; ;#// - 0.20(E) debugLog "Claim Amount Credit" "" "-" $E; debugLog " (20% of $_pClaim)"; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Shares [::expr $Shares*$_pay_frequency]; ::set Q [round2 [::expr $Shares*0.15]]; debugLog "Share purchase tax credit" "(Q)" "-" $Q; debugLog " (15% of $Shares)"; ::set T0 [::expr $T0-$Q]; ;#// - 0.15(P(Q)) ::if {$T0<0} {::set T0 0;} } else { debugLog "Employee is exempt From Tax"; } debugLog "Net Annual Prov. Tax" "" "=" $T0; ::set ProvTax $T0; ::set ProvTax [truncate [::expr $ProvTax/$_pay_frequency] 2]; debugLog "Tax prorated for the PP" "" "=" $ProvTax; ::set ProvTax [::expr $ProvTax*$_pay_frequency]; ::return $ProvTax; } public method SK-20140101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Saskatchewan Tax Calculation (20140101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.11; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>43292} {::set V 0.13; ::set KP 866;} ::if {$TaxableIncome>123692} {::set V 0.15; ::set KP 3340;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" [round2 $Tmp1]; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; # CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; # EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" [round2 $T4]; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" [round2 $V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" [round2 $S]; ::set LCPp 0; ::set LCPf 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares!=0} { ::set LCPp [::expr {$Shares*0.20}]; ::if {$LCPp>525} {::set LCPp 525;} ::set Tmp1 0;::set Shares 0; ::if {$Tmp1==-1} { ::set Tmp1 [::expr {$Tmp1+1}]; ::set Tmp1 50; ::set LCPf [::expr {$Shares*0.20}]; ::if {$LCPf>1000} {::set LCPf 1000;} } } ::set Tmp1 [::expr {$LCPf+$LCPp}]; ::if {$Tmp1 >=1000} {::set Tmp1 1000;} ::if {$Tmp1<=0} {::set Tmp1 0;} ::set T2 [::expr {$T2-$Tmp1}]; debugLog "Labour sp. funds credit" "(LCP)" "-" [round2 $Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" [round2 $T2]; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" [round2 $_fedTax] $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" [round2 $T2] $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" [round2 $Tmp1] $Amt "%"; ::set Tmp1 [::expr {$Tmp1/$_pay_frequency}]; debugLog "Tax prorated for the PP" "" "=" [round2 $Tmp1]; ::return $T2; } public method YK-20140101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20140101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0704; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>43953} {::set V 0.0968; ::set KP 1160;} ::if {$TaxableIncome>87907} {::set V 0.1144; ::set KP 2708;} ::if {$TaxableIncome>136270} {::set V 0.1276; ::set KP 4506;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1127} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1127}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::if {$T4>6000} { ::set V1 [::expr {$T4-6000}]; ::set V1 [::expr {$V1*0.05}]; ::set V1 [round2 $V1]; } ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr {$Shares*0.25}]; ::set Tmp1 [round2 $Tmp1]; ::if {$Tmp1>1250} {::set Tmp1 1250;} ::if {$Tmp1<0} {::set Tmp1 0;} } ::set T2 [::expr {$T2-$Tmp1}]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20130701 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20130701) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0968; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>38954} {::set V 0.1482; ::set KP 2002;} ::if {$TaxableIncome>77908} {::set V 0.1652; ::set KP 3327;} ::if {$TaxableIncome>126662} {::set V 0.1784; ::set KP 4999;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method FEDERAL-20130101 {TaxableIncome} { ::set Result 0.0; ;#// Initialize Federal Tax ::set R 0.15;::set K 0; ::set K2Rate $R;::set K2Percentage [::expr $K2Rate*100]; ::if {$TaxableIncome>43561} {::set R 0.22;::set K 3049;} ::if {$TaxableIncome>87123} {::set R 0.26;::set K 6534;} ::if {$TaxableIncome>135054} {::set R 0.29;::set K 10586;} debugLog "--- Federal Tax Calculation (20130101) ---"; debugLog "Annual taxable income" "(A)" "" "[round2 $TaxableIncome]"; debugLog "Federal tax rate" "(R)" "*" [round2 $R]; ::set T0 [::expr $TaxableIncome*$R]; ::set T0 [round2 $T0]; debugLog "Federal tax" "(R*A)" "=" "[round2 $T0]"; debugLog "Adjustment constant" "(K)" "-" $K; ::set T0 [::expr $T0-$K]; ;#// T0#=(RA-K) debugLog "Federal tax" "" "=" $T0; ::set T1 [::expr $K2Rate*$_td1_federal_claim_amount]; ;#// K1 - Non-ref. personal tax credit ::set T1 [round2 $T1]; ;#// Round it debugLog "Non-ref tax credit" "(K1)" "-" $T1; debugLog " ($K2Rate X $_td1_federal_claim_amount)"; ::set T0 [::expr $T0-$T1]; ;#// T0#=(RA-K-K1) ::set YtdCpp [recRead "PROCN" "~AYRUN.2" "10"]; ;#// YtdCpp = YTD CPP (includes this PP) ::if {$YtdCpp>=$_cppMax} { ::set YtdCpp $_cppMax; } else { ::set YtdCpp [round2 $_employee_cpp_deduction_period]; ::set YtdCpp [::expr $YtdCpp*$_pay_frequency]; ::set YtdCpp [round2 $YtdCpp]; ::if {$YtdCpp>$_cppMax} { ::set YtdCpp $_cppMax; } } recWrite $YtdCpp "PROCN" "~AYRUN.2" "30"; ;#// Store for prov. tables ::set K2C [::expr $K2Rate*$YtdCpp]; ::set K2C [round2 $K2C]; ::set YtdEi [recRead "PROCN" "~AYRUN.2" "11"]; ;#// YtdEi = YTD EI (includes this PP) ::set T2 [::expr $_eiRate*$_eiMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } else { ::set YtdEi [round2 $_employee_ei_deduction_period]; ::set YtdEi [::expr $YtdEi*$_pay_frequency]; ::set YtdEi [round2 $YtdEi] ::if {$YtdEi>=$T2} { ::set YtdEi $T2; } } recWrite $YtdEi "PROCN" "~AYRUN.2" "31"; ;#// Store for prov. tables ::set K2U [::expr $K2Rate*$YtdEi]; ::set K2U [round2 $K2U]; ::set YtdPpip [recRead "PROCN" "~AYRUN.2" "12"]; ;#// YtdPpip = YTD PPIP (includes this PP) ::set T2 [::expr $_ppipRate*$_ppipMaxIE]; ::set T2 [round2 $T2]; ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } else { ::set YtdPpip [round2 $_employee_ppip_deduction_period]; ::set YtdPpip [::expr $YtdPpip*$_pay_frequency]; ::set YtdPpip [round2 $YtdPpip] ::if {$YtdPpip>=$T2} { ::set YtdPpip $T2; } } recWrite $YtdPpip "PROCN" "~AYRUN.2" "32"; ;#// Store for prov. tables ::set K2P [::expr $K2Rate*$YtdPpip]; ::set K2P [round2 $K2P]; ::set K2 [::expr $K2C+$K2U+$K2P]; debugLog "CPP/EI tax credit" "(K2)" "-" $K2; debugLog " ( $K2Percentage% of CPP $YtdCpp $K2C"; debugLog " +$K2Percentage% of EI $YtdEi $K2U)"; ::if {$YtdPpip>0.0} { debugLog " +$K2Percentage% of PPIP $YtdPpip $K2P)"; } ::set T0 [round2 [::expr $T0-$K2]]; ::set K4Wages $TaxableIncome; ::if {$K4Wages>1117.00} { ::set K4Wages 1117.00; } ::set K4 [round2 [::expr $K2Rate*$K4Wages]]; debugLog "Canada Employment Credit" "(K4)" "-" $K4; debugLog " ($K2Percentage% X $K4Wages)"; ::set T0 [::expr $T0-$K4]; ::if {$T0<0} {::set T0 0;} debugLog "Annual basic fed. tax" "(T3)" "=" $T0; ::set _annualBasicFederalTax $T0; ;#// T3 is the Basic federal tax ::set LSF 0; ::set Shares [employeeInfoGet ".federal.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set LSF [round2 [::expr $Shares*0.15]]; ::if {$LSF>750} {::set LSF 750}; ::if {$LSF<0} {::set LSF 0;} } debugLog "LSF credit (Fed)" "(LSF)" "-" $LSF; ::set T1 [round2 [::expr $T0-$LSF]]; ;#// T1 is the Total federal tax ::if {$T1<0.0} {::set T1 0.0;} debugLog "Annual federal tax" "(T1)" "=" $T1; ::set Result $T1; ;#// Federal Tax to deduct (annual) ::return $Result; } public method BC-20130101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- British Columbia Tax Calculation (20130101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0506; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>37568} {::set V 0.0770;::set KP 992;} ::if {$TaxableIncome>77138} {::set V 0.1050;::set KP 3096;} ::if {$TaxableIncome>86268} {::set V 0.1229;::set KP 4640;} ::if {$TaxableIncome>104754} {::set V 0.1470;::set KP 7164;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set A1 [::expr $TaxableIncome+[employeeInfoGet ".federal.td1_prescribed_zone_deduction"]]; ::if {$A1>0} { ::if {$A1<=18181} { ::set S $T4; ::if {$S>409.00} { ::set S 409.00; } } else { ::if {$A1<=30962.25} { ::set S [::expr {409.00-[round2 [::expr {($A1-18181)*0.032}]]}]; ::if {$S>$T4} { ::set S $T4; } } } } ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr $Shares*0.15]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NB-20130101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- New Brunswick Tax Calculation (20130101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0910; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>38954} {::set V 0.1210; ::set KP 1169;} ::if {$TaxableIncome>77908} {::set V 0.1240; ::set KP 1402;} ::if {$TaxableIncome>126662} {::set V 0.1430; ::set KP 3809;} ::set T4 [::expr $TaxableIncome * $V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NL-20130101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Newfoundland & Labrador Tax Calculation (20130101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.077; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>33748} {::set V 0.125; ::set KP 1620;} ::if {$TaxableIncome>67496} {::set V 0.133; ::set KP 2160;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set Amt [round2 $V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set Amt [round2 0]; debugLog "Prov tax reduction" "(S)" "-" $Amt; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {[stringToNumber $Shares]} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; ::set Amt [round2 $Tmp1]; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::set Amt [round2 $_fedTax]; ::set Amt 0; ::if {$TaxableIncome !=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $_provTax+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NT-20130101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Northwest Territories Tax Calculation (20130101) ---"; debugLog "Annual taxable income (A) [round2 $TaxableIncome]"; ::set V 0;::set KP 0; ::set BaseV 0.0590; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>39453} {::set V 0.0860; ::set KP 1065;} ::if {$TaxableIncome>78908} {::set V 0.1220; ::set KP 3906;} ::if {$TaxableIncome>128286} {::set V 0.1405; ::set KP 6279;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2-)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NU-20130101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nunavut Tax Calculation (20130101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0400; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>41535} {::set V 0.0700; ::set KP 1246;} ::if {$TaxableIncome>83071} {::set V 0.0900; ::set KP 2907;} ::if {$TaxableIncome>135054} {::set V 0.1150; ::set KP 6284;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Prov tax reduction" "(S)" "-" $S; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ON-20130101 {TaxableIncome} { ::set T2 0; # Initialize provincial tax to deduct debugLog "--- Ontario Tax Calculation (20130101) ---"; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set V 0;::set KP 0; ::set BaseV 0.0505; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>39723} {::set V 0.0915;::set KP 1629;} ::if {$TaxableIncome>79448} {::set V 0.1116;::set KP 3226;} ::if {$TaxableIncome>509000} {::set V 0.1316;::set KP 13406;} ::set T4 [round2 [::expr $TaxableIncome*$V]]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::if {$T4>4289} { ::if {$T4<=5489} { ::set Tmp1 [::expr $T4-4289]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; } else { ::set Tmp1 [::expr $T4-4289]; ::set Tmp1 [::expr $Tmp1*0.20]; ::set V1 [::expr $V1+$Tmp1]; ::set Tmp1 [::expr $T4-5489]; ::set Tmp1 [::expr $Tmp1*0.36]; ::set V1 [::expr $V1+$Tmp1]; } ::set V1 [round2 $V1]; } ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set V2 0; ::set Lessor 0; ::if {$TaxableIncome>20000} {::set V2 300;::set Lessor [::expr ($TaxableIncome - 20000) * 0.06];} ::if {$TaxableIncome>36000} {::set V2 450;::set Lessor [::expr 300 + (0.06 * ($TaxableIncome - 36000))];} ::if {$TaxableIncome>48000} {::set V2 600;::set Lessor [::expr 450 + (0.25 * ($TaxableIncome - 48000))];} ::if {$TaxableIncome>72000} {::set V2 750;::set Lessor [::expr 600 + (0.25 * ($TaxableIncome - 72000))];} ::if {$TaxableIncome>200000} {::set V2 900;::set Lessor [::expr 750 + (0.25 * ($TaxableIncome - 200000))];} ::if {$Lessor<=$V2} {::set V2 $Lessor;} ::set T2 [::expr $T2+$V2]; debugLog "Health Ins Premium" "(V2)" "+" $V2; ::set S [::expr $T4+$V1]; ::set Tmp1 [employeeInfoGet ".provincial.td1_y_factor"]; ::set Tmp1 [::expr $Tmp1*409]; ::set Tmp1 [::expr $Tmp1+221]; ::set Tmp1 [::expr $Tmp1*2]; ::set Tmp1 [::expr $Tmp1-$S]; ::set S [round2 $S]; ::if {$Tmp1<$S} {::set S $Tmp1;} ::if {$S<0} {::set S 0;} ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PQ-20130101 {TaxableIncome {FederalVersion "20130101"}} { debugLog "--- Quebec Federal Tax Calculation ($FederalVersion) ---"; ::set ProvRate 0.1650; ;#// Federal Abatement Rate debugLog "= Federal Tax - (Annual Basic Federal Tax * Abatement Rate)"; debugLog "= T1 - (T3 * $ProvRate)"; debugLog " Calculating Federal Tax ..."; indentIncrement; ::set FederalTax [FEDERAL-$FederalVersion $TaxableIncome]; ;#// Calculate Federal Tax indentDecrement; ::set Abatement [::expr $_annualBasicFederalTax*$ProvRate]; ;#// Calc Federal abatement (on T3) ::set Abatement [round2 $Abatement]; debugLog "= $FederalTax - ($_annualBasicFederalTax * $ProvRate)"; debugLog "= $FederalTax - $Abatement"; ::set FederalTax [::expr $FederalTax-$Abatement]; debugLog "= $FederalTax"; ::set Tmp1 [round2 [::expr $FederalTax/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $FederalTax; } public method QT-20130101 {TaxableIncome} { debugLog "--- Quebec Provincial Tax Calculation (20130101) ---"; debugLog "Annual income" "(A)" "" $TaxableIncome; ::set T0 0; ::if {[employeeInfoGet ".provincial.td1_claim_amount"] ne "X"} { ::set EmploymentIncomeDeduction [::expr $TaxableIncome*0.06]; ::if {$EmploymentIncomeDeduction>1100.00} { ::set EmploymentIncomeDeduction 1100.00; } ::set TaxableIncome [::expr $TaxableIncome-$EmploymentIncomeDeduction]; debugLog "Employ. Inc. Ded" "(H)" "-" $EmploymentIncomeDeduction; debugLog "Annual taxable income" "(I)" "" $TaxableIncome; ::set T 0.1600;::set K 0.0; ::if {$TaxableIncome>41095} {::set T 0.2000;::set K 1644.00;} ::if {$TaxableIncome>82190} {::set T 0.2400;::set K 4931.00;} ::if {$TaxableIncome>100000} {::set T 0.2575;::set K 6681.00;} debugLog "Provincial Tax Rate" "(T)" "*" $T; ::set T0 [::expr $TaxableIncome*$T]; ;#// T(I) ::set T0 [round2 $T0]; debugLog "Basic Tax" "" "=" $T0; ::set T0 [::expr $T0-$K]; ;#// - K debugLog "Adjustment Constant" "(K)" "-" $K; debugLog "Net Tax" "" "=" $T0; ::set E [round2 [::expr $_pClaim*0.20]]; ::set T0 [::expr $T0-$E]; ;#// - 0.20(E) debugLog "Claim Amount Credit" "" "-" $E; debugLog " (20% of $_pClaim)"; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Shares [::expr $Shares*$_pay_frequency]; ::set Q [round2 [::expr $Shares*0.15]]; debugLog "Share purchase tax credit" "(Q)" "-" $Q; debugLog " (15% of $Shares)"; ::set T0 [::expr $T0-$Q]; ;#// - 0.15(P(Q)) ::if {$T0<0} {::set T0 0;} } else { debugLog "Employee is exempt From Tax"; } debugLog "Net Annual Prov. Tax" "" "=" $T0; ::set ProvTax $T0; ::set ProvTax [truncate [::expr $ProvTax/$_pay_frequency] 2]; debugLog "Tax prorated for the PP" "" "=" $ProvTax; ::set ProvTax [::expr $ProvTax*$_pay_frequency]; ::return $ProvTax; } public method SK-20130101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Saskatchewan Tax Calculation (20130101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.11; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>42906} {::set V 0.13; ::set KP 858;} ::if {$TaxableIncome>122589} {::set V 0.15; ::set KP 3310;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" [round2 $Tmp1]; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; # CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; # EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" [round2 $T4]; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" [round2 $V1]; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" [round2 $S]; ::set LCPp 0; ::set LCPf 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares!=0} { ::set LCPp [::expr {$Shares*0.20}]; ::if {$LCPp>525} {::set LCPp 525;} ::set Tmp1 0;::set Shares 0; ::if {$Tmp1==-1} { ::set Tmp1 [::expr {$Tmp1+1}]; ::set Tmp1 50; ::set LCPf [::expr {$Shares*0.20}]; ::if {$LCPf>1000} {::set LCPf 1000;} } } ::set Tmp1 [::expr {$LCPf+$LCPp}]; ::if {$Tmp1 >=1000} {::set Tmp1 1000;} ::if {$Tmp1<=0} {::set Tmp1 0;} ::set T2 [::expr {$T2-$Tmp1}]; debugLog "Labour sp. funds credit" "(LCP)" "-" [round2 $Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Net provincial tax" "(T2)" "=" [round2 $T2]; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" [round2 $TaxableIncome]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" [round2 $_fedTax] $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" [round2 $T2] $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" [round2 $Tmp1] $Amt "%"; ::set Tmp1 [::expr {$Tmp1/$_pay_frequency}]; debugLog "Tax prorated for the PP" "" "=" [round2 $Tmp1]; ::return $T2; } public method YK-20130101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Yukon Tax Calculation (20130101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0704; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>43561} {::set V 0.0968; ::set KP 1150;} ::if {$TaxableIncome>87123} {::set V 0.1144; ::set KP 2683;} ::if {$TaxableIncome>135054} {::set V 0.1276; ::set KP 4466;} ::set T4 [::expr {$TaxableIncome*$V}]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*$BaseV}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)" ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr {$T4-$K2P}]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr {$T4-$K3P}]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; ::if {$TaxableIncome<1117} { ::set K4P [::expr {$BaseV*$TaxableIncome}]; } else { ::set K4P [::expr {$BaseV*1117}]; } debugLog "Canada Employment Credit" "(K4P)" "-" $K4P; ::set T4 [::expr {$T4-$K4P}]; debugLog "Basic territorial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::if {$T4>6000} { ::set V1 [::expr {$T4-6000}]; ::set V1 [::expr {$V1*0.05}]; ::set V1 [round2 $V1]; } ::set T2 [::expr {$T2+$V1}]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr {$T2-$S}]; debugLog "Provincial tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 [::expr {$Shares*0.25}]; ::set Tmp1 [round2 $Tmp1]; ::if {$Tmp1>1250} {::set Tmp1 1250;} ::if {$Tmp1<0} {::set Tmp1 0;} } ::set T2 [::expr {$T2-$Tmp1}]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds cr." "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$T2/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr {$T2+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method NS-20110101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Nova Scotia Tax Calculation (20110101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0; ::set KP 0; ::set BaseV 0.0879; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>29590} {::set V 0.1495; ::set KP 1823;} ::if {$TaxableIncome>59180} {::set V 0.1667; ::set KP 2841;} ::if {$TaxableIncome>93000} {::set V 0.1750; ::set KP 3613;} ::if {$TaxableIncome>150000} {::set V 0.2100; ::set KP 8863;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set T2 [::expr $T2-0]; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::set Tmp1 0; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*0.20]; ::if {$Tmp1>2000} {::set Tmp1 2000;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method PE-20090101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- P.E.I. Tax Calculation (20090101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.0980; ::if {$TaxableIncome>0} {::set V $BaseV;::set KP 0;} ::if {$TaxableIncome>31984} {::set V 0.1380;::set KP 1279;} ::if {$TaxableIncome>63969} {::set V 0.1670;::set KP 3134;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0 ::set Tmp1 0; ::if {$T4>12500} { ::set Tmp1 [::expr $T4-12500]; ::set Tmp1 [::expr $Tmp1*0.10]; ::set V1 [round2 $Tmp1]; ::set T2 [::expr $T2+$V1]; } debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method MB-20090101 {TaxableIncome} { ::set T2 0; ;#// Initialize provincial tax to deduct debugLog "--- Manitoba Tax Calculation (20090101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set V 0;::set KP 0; ::set BaseV 0.108; ::if {$TaxableIncome>0} {::set V $BaseV; ::set KP 0;} ::if {$TaxableIncome>31000} {::set V 0.1275; ::set KP 605;} ::if {$TaxableIncome>67000} {::set V 0.1740; ::set KP 3720;} ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr $T4-$KP]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr $_pClaim*$BaseV]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr $T4-$Tmp1]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr $T2+$T4]; ::set V1 0; ::set T2 [::expr $T2+$V1]; debugLog "Provincial surtax" "(V1)" "+" $V1; ::set S 0.0; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set Shares [employeeInfoGet ".provincial.lsf_purchase_amount"]; ::if {$Shares ne ""} { ::set Tmp1 $Shares; ::set Tmp1 [::expr $Tmp1*"0.15"]; ::if {$Tmp1>1800} {::set Tmp1 1800;} ::if {$Tmp1<0} {::set Tmp1 0;} ::set Tmp1 [round2 $Tmp1]; } ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr $Tmp1/$_pay_frequency]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method AB-20090101 {TaxableIncome} { ::set T2 0; ;# Initialize provincial tax to deduct debugLog "--- Alberta Tax Calculation (20090101) ---"; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set BaseV 0.10; ::set V $BaseV; ::set KP 0; ::set T4 [::expr $TaxableIncome*$V]; ::set T4 [round2 $T4]; debugLog "Provincial tax rate" "(V)" "*" $V; debugLog "Provincial tax" "(V*A)" "=" $T4; debugLog "Adjustment constant" "(KP)" "-" $KP; ::set T4 [::expr {$T4-$KP}]; debugLog "Basic provincial tax" "(T2)" "=" $T4; ::set Tmp1 [::expr {$_pClaim*0.1}]; ::set Tmp1 [round2 $Tmp1]; ::set T4 [::expr {$T4-$Tmp1}]; debugLog "Prov non-ref tax credit" "(K1P)" "-" $Tmp1; debugLog " ($BaseV X $_pClaim)"; ::set K2P 0.0; ::set PxC [recRead "PROCN" "~AYRUN.2" "30"]; ;#// CPP\QPP (Calculated by FEDERAL) ::set PxE [recRead "PROCN" "~AYRUN.2" "31"]; ;#// EI (Calculated by FEDERAL) ::set K2P [::expr {[round2 [::expr {$PxC*$BaseV}]]+[round2 [::expr {$PxE*$BaseV}]]}]; ::set T4 [::expr $T4-$K2P]; debugLog "CPP/EI non-ref tax credit" "(K2P)" "-" $K2P; debugLog " ($BaseV X \[$PxC + $PxE\])"; ::set K3P [round2 [employeeInfoGet ".provincial.other_tax_credits"]]; ::set T4 [::expr $T4-$K3P]; debugLog "Other non-refundable tax credits" "(K3P)" "-" $K3P; debugLog "Basic provincial tax" "(T4)" "=" $T4; ::set T2 [::expr {$T2+$T4}]; ::set V1 0; ::set T2 [::expr $T2+$V1]; ::set S 0; ::set T2 [expr $T2-$S]; ::set T2 [::expr $T2-$S]; debugLog "Prov tax reduction" "(S)" "-" $S; ::set Tmp1 0; ::set T2 [::expr $T2-$Tmp1]; ::if {$T2<0} {::set T2 0;} ::set T2 [round2 $T2]; ::set _provTax $T2; debugLog "Labour sp. funds credit" "(LCP)" "-" $Tmp1; debugLog "Net provincial tax" "(T2)" "=" $T2; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $_fedTax/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $T2/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "+" $T2 $Amt "%"; ::set Tmp1 [::expr $T2+$_fedTax]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr $Tmp1/$TaxableIncome]; ::set Amt [::expr $Amt*100]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [::expr $Tmp1/$_pay_frequency]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $T2; } public method ZZ-20090101 {TaxableIncome} { ::set FSTRate 0.48; ;#// Federal Surtax Rate debugLog "--- Outside Canada Tax Calculation (20090101) ---"; ::set _provTax [::expr {$_annualBasicFederalTax*$FSTRate}]; ;#// T2#=V(RA-K-K1-K2) ::set _provTax [round2 $_provTax]; debugLog "Additional federal tax" "" "" $_provTax; debugLog " ([::expr $FSTRate*100]% of [round2 $_annualBasicFederalTax])"; debugLog [::string repeat "-" 42]; debugLog "Annual taxable income" "(A)" "" $TaxableIncome; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_fedTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Federal Tax" "(T1)" "" $_fedTax $Amt "%"; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$_provTax/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Provincial Tax" "(T2)" "" $_provTax $Amt "%"; ::set Tmp1 [::expr {$_provTax+$_fedTax}]; ::set Amt 0; ::if {$TaxableIncome!=0} { ::set Amt [::expr {$Tmp1/$TaxableIncome}]; ::set Amt [::expr {$Amt*100}]; ::set Amt [round2 $Amt]; } debugLog "Total Fed & Prov Tax" "(T)" "=" $Tmp1 $Amt "%"; ::set Tmp1 [round2 [::expr {$Tmp1/$_pay_frequency}]]; debugLog "Tax prorated for the PP" "" "=" $Tmp1; ::return $_provTax; } public method ~AYRUN.12 {args} { ::return; debugLog [::string repeat "-" 42]; debugLog "Quebec Deduction Reduction"; ::set OldFedTax $_fedTaxPP; ::set NewFedTax $OldFedTax; debugLog "******** _provTaxPP *********" "" "" $_provTaxPP; ::set OldQueTax $_provTaxPP; ::set NewQueTax $OldQueTax; ::set OldQpp $_employee_cpp_deduction_period; ::set NewQpp $OldQpp; ::set OldNet [employeeInfoGet ".net_pay"]; ::set NewNet $OldNet; ::set Net [::expr [employeeInfoGet ".net_pay"]-$_fedTaxPP]; debugLog "Net pay after Federal Tax" "" "" [employeeInfoGet ".net_pay"]; ::set Net [::expr $Net+$_employee_cpp_deduction_period]; # Add Q.P.P. back in ::set Net [::expr $Net+$OldQueTax]; # Add Quebec tax back in debugLog "Q.P.P." "" "+" $_employee_cpp_deduction_period; debugLog "Quebec Tax" "" "+" $OldQueTax; debugLog "Net pay available for QPP" "(N)" "=" $Net; ::if {$Net>0} { ::if {$Net<=$_employee_cpp_deduction_period} { ::if {$Net<$_employee_cpp_deduction_period} { ::set CQ $Net; } else { ::set CQ $_employee_cpp_deduction_period; } debugLog "Maximum QPP deduction" "(CQ)" "" $CQ; ::set Tmp3 [recRead "PROCN" "~AYRUN.2" "10"]; # Get current YTD ::set Tmp3 [::expr $Tmp3-$_employee_cpp_deduction_period]; # Deduct original QPP ::set Tmp3 [::expr $Tmp3+$CQ]; # Add in adjusted QPP recWrite $Tmp3 "PROCN" "~AYRUN.2" "10"; # Write it back ::set _employee_cpp_deduction $CQ; debugLogStop; TAXCALC; debugLogStart; debugLog "Federal tax recalculated" "" "" $NewFedTax; } } ::set Net [::expr $Net-$OldQueTax]; # Subtract original Quebec tax ::if {$Net!=$OldNet} { debugLog "Net pay now" "" "" $Net; } ::set NewFedTax $_fedTaxPP; ::set NewQpp $_employee_cpp_deduction_period; ::set _employee_cpp_deduction $NewQpp; # Get current QPP amt ::set _employee_cpp_deduction [::expr $_employee_cpp_deduction_period+$OldFedTax]; # Add original FedTax ::set _employee_cpp_deduction [::expr $_employee_cpp_deduction_period-$NewFedTax]; # Subtract new FedTax ::if {$_employee_cpp_deduction_period<0} {::set _employee_cpp_deduction 0;}; # CAN BE NEGATIVE IN RARE CASES# ::set NewQpp $_employee_cpp_deduction_period; debugLog "Q.P.P. now" "" "" $NewQpp; ::set Net [::expr $Net-$_fedTaxPP]; # Subtract federal tax ::set Net [::expr $Net-$NewQpp]; # Subtract Qpp ::set Net [::expr $Net-$OldQueTax]; # Subtract Que Tax ::if {$Net<0} { ::set Tmp1 [::expr $OldQueTax+$Net]; ::if {$Tmp1<0} { ::set Tmp1 0; # Deduct 0.00 } ::set Net [::expr $Net+$OldQueTax]; # Add old Quebec tax back in ::set NewQueTax $Tmp1; ::set Net [::expr $Net-$NewQueTax]; # Subtract new Quebec tax debugLog "Quebec tax changed to" "" "" $NewQueTax; } ::if {$Net<0} { ::set Tmp1 [::expr $_employee_cpp_deduction_period+$Net]; ::if {$Tmp1<0} { ::set Tmp1 0; # Deduct 0.00 } ::set Net [::expr $Net+$_employee_cpp_deduction_period]; # Add old QPP back in ::set _employee_cpp_deduction $Tmp1; ::set Net [::expr $Net-$_employee_cpp_deduction_period]; # Subtract new QPP ::set NewQpp $_mployee_cpp_deduction_period; debugLog "Q.P.P. changed to" "" "" $NewQpp; } ::set _amt $NewFedTax; ::set _net [::expr [employeeInfoGet ".net_pay"]+$OldFedTax-$NewFedTax]; ::set _net [::expr [employeeInfoGet ".net_pay"]+$OldQueTax-$NewQueTax]; ::set _net [::expr [employeeInfoGet ".net_pay"]+$OldQpp-$NewQpp]; ::set NewNet [employeeInfoGet ".net_pay"]; debugLog "Federal Tax" "" "" $OldFedTax $NewFedTax; debugLog "Quebec Tax" "" "" $OldQueTax $NewQueTax; debugLog "Q.P.P." "" "" $OldQpp $NewQpp; debugLog "Net" "" "" $OldNet $NewNet; debugLog [::string repeat "-" 42]; } } }