401(k) Matching Limit Calculation Error

Without the ROUND statment below, the Payroll Calculation Code Unit incorrectly sets a limit that has rounding errors in it. It only becomes an issue if matching was not done correctly earlier in the year, or the employee hits the maximum dollar limit for the year. MILT EmployerMatchPercent(VAR PayrollJnlLine : Record “Payroll Journal Line”) : Decimal … REPEAT // What was Employee Rate back then? PayrollJnlLine2.“Posting Date” := “Posting Date”; EmployeeRate := GetEmployeeRate(PayrollJnlLine2); // What was match bracket data back then? WITH BracketLine DO BEGIN SETRANGE(“Effective Date”,0D,PayrollLedgerEntry.“Posting Date”); FIND(’+’); IF (“Max %” > 0) AND (EmployeeRate > “Max %”) THEN MatchPercent := “Max %” * “Match %” / 100.0 ELSE MatchPercent := EmployeeRate * “Match %” / 100.0; END; // Calculate Employee contribution, with limit // EECont := “Taxable Amount” * EmployeeRate / 100; EECont := ROUND(“Taxable Amount” * EmployeeRate / 100); // QD BUG 1/28/03 - Must round to avoid accumulated YTDEECont errors IF EECont + YTDEECont > BracketLine.Limit THEN IF YTDEECont > BracketLine.Limit THEN EECont := 0 ELSE EECont := BracketLine.Limit - YTDEECont; YTDEECont := YTDEECont + EECont; …