KMI HRM · PROBLEM SOLVED · OCTOBER 2026

Problem solved: changing salary rules without changing last month’s pay

Every company changes its salary rules eventually. Overtime gets capped, the late policy changes, one plant works differently from another. If those rules live in the code, each change needs a developer and puts old calculations at risk. Any business running payroll, in any country, meets this problem.

About this project

How attendance, HR and payroll for a Pakistani company of several sites and plants came together, from fingerprint machines to the phone in an HR manager’s hand.

In short

Salary rules change, but last month’s salary must stay exactly as it was. We solved it by giving each rule a start date and a level in the company, so payroll always uses the rule that applied on that day.

Why editing a rule is dangerous

The simple design is one settings page: overtime rate here, short-day limit there. It works until someone changes a number and a past month is recalculated. Suddenly October’s salary sheet no longer matches what was paid, and nobody can explain why.

Two questions for every rule

So payroll asks one question for each day of each employee: which rule was in force for this person on this date?

  • When does it start? Rules are never edited over the old value. A new version is added with its own start date.
  • Who does it cover? A rule set closer to the employee wins over a broader one for the whole business.

What moved out of the code

Short days, overtime rounding and limits, the sandwich rule for leave around holidays, and the full attendance bonus all became policy settings. So did statutory deductions such as social security and provident fund, along with leave entitlement and carry-forward. The final settlement when someone leaves reads from the same rules.

Letting HR test before they trust

People do not trust a calculation they cannot check. So the Policies page has a one-day tester: pick a case and see which rule applies and what it produces, before it touches a salary sheet. HR can answer “why was this deducted?” without calling a developer, and that matters as much as the calculation being correct.

What we shipped

  • Salary policies with start dates, per company level
  • Statutory deductions, leave balances and final settlement
  • A one-day tester on the Policies page

Lesson learned

Anything that decides money should have a date on it. If you cannot answer “what was the rule on that day?”, you cannot defend the number.