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. (backport #1779) #2053

Merged

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Aug 6, 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 false commit -> 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

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.


This is an automatic backport of pull request #1779 done by [Mergify](https://mergify.com).

…before end of payroll period. (#1779)

(cherry picked from commit 4c961fb)
@mergify mergify bot requested a review from ruchamahabal as a code owner August 6, 2024 11:18
@ruchamahabal ruchamahabal merged commit f8837e4 into version-14-hotfix Aug 6, 2024
8 checks passed
@mergify mergify bot deleted the mergify/bp/version-14-hotfix/pr-1779 branch August 6, 2024 11:43
frappe-pr-bot pushed a commit that referenced this pull request Aug 7, 2024
## [14.29.3](v14.29.2...v14.29.3) (2024-08-07)

### Bug Fixes

* concurrency issue leading to duplicate attendance insertion ([#2041](#2041)) ([#2042](#2042)) ([3411d7a](3411d7a))
* filter and bold issue in Salary Payments Based On Payment Mode (backport [#2025](#2025)) ([#2048](#2048)) ([0913976](0913976))
* filter in reports (backport [#1987](#1987)) ([#2044](#2044)) ([adeb482](adeb482))
* query in Provident Fund and Professional Tax Deductions reports (backport [#2026](#2026)) ([#2033](#2033)) ([617de87](617de87))
* rendering the email template subject in leave notification (backport [#2027](#2027)) ([#2046](#2046)) ([1e576fc](1e576fc))
* wrong compute of CTC on salary slip, if employee relieving date before end of payroll period. (backport [#1779](#1779)) ([#2053](#2053)) ([f8837e4](f8837e4))
@frappe-pr-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 14.29.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants