Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrong compute of CTC on salary slip, if employee relieving date before end of payroll period. #1779

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

kittiu
Copy link
Contributor

@kittiu kittiu commented May 15, 2024

Calculation of CTC on Salary Slip is rediculous wrong if Employee's relieving date is set before end of payroll period.
And from the testing, I only find this commit to blame -> 4303a9b
and so, this PR is just removing it.

To explain the problem, I am testing with a simple salary structure with just income and tax.

  • Payroll Peirod = 1 Jan 2024 - 31 Dec 2024
  • Base Salary = 10,000 (120,000 for CTC of 12 months)
  • Employee Relieving Date = 15 Dec 2024 (if change to 31 Dec, or no relieving date, no problem)

Create the Slary Slip for January 2024

image

image

CTC wil be be 250,000 !!!

image

Looking at the code that I removed, he is the culprit.

if month_diff(period_end, start_date) > 1:
	start_date = add_months(start_date, -(month_diff(period_end, start_date) + 1))

As

  • month_diff(period_end, start_date) = month_diff( 15 Dec 2024 , 1 Jan 2024 ) = 12 months
  • start_date = add_months(1 Jan 2024, -13) = 1 Dec 2022

And so, 1 Dec 2022 until 15 Dec 2024 is 25 months, which compute to CTC = 10,000 * 25 = 250,000

Note: even if we use period_end very close to start_date, i.e. 15 Feb, it is still make a very wrong computation. So, I am really don't know the reason of having such code.

@kittiu kittiu requested a review from ruchamahabal as a code owner May 15, 2024 15:10
@ruchamahabal ruchamahabal self-assigned this May 17, 2024
@kittiu
Copy link
Contributor Author

kittiu commented Jun 1, 2024

May I follow up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants