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

Merged
merged 3 commits into from
Aug 6, 2024

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 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.

@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?

@ruchamahabal
Copy link
Member

The issue for which the incorrect fix was made seems unnecessary. Payroll for some employee won't be run the month after employee was relieved (when employee wasn't working there).

Employee tax exemption proof submission has some other use case, but not replicable anymore.

This was referenced Aug 6, 2024
ruchamahabal pushed a commit that referenced this pull request Aug 6, 2024
…before end of payroll period. (backport #1779) (#2053)

(cherry picked from commit 4c961fb)

Co-authored-by: Kitti U. @ Ecosoft <[email protected]>
ruchamahabal pushed a commit that referenced this pull request Aug 6, 2024
…before end of payroll period. (backport #1779) (#2054)

(cherry picked from commit 4c961fb)

Co-authored-by: Kitti U. @ Ecosoft <[email protected]>
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 pushed a commit that referenced this pull request Aug 7, 2024
## [15.25.2](v15.25.1...v15.25.2) (2024-08-07)

### Bug Fixes

* bank entry reference in payroll (backport [#2037](#2037)) ([#2039](#2039)) ([432f977](432f977))
* concurrency issue leading to duplicate attendance insertion ([#2041](#2041)) ([#2043](#2043)) ([957537c](957537c))
* filter and bold issue in Salary Payments Based On Payment Mode (backport [#2025](#2025)) ([#2049](#2049)) ([46ed7be](46ed7be))
* filter in reports (backport [#1987](#1987)) ([#2045](#2045)) ([ac35324](ac35324))
* query in Provident Fund and Professional Tax Deductions reports (backport [#2026](#2026)) ([#2034](#2034)) ([8d056db](8d056db))
* rendering the email template subject in leave notification (backport [#2027](#2027)) ([#2047](#2047)) ([cd1bdc0](cd1bdc0))
* wrong compute of CTC on salary slip, if employee relieving date before end of payroll period. (backport [#1779](#1779)) ([#2054](#2054)) ([ddf4cdb](ddf4cdb))
* wrong translation of "Manual" ([1bdc836](1bdc836))
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.

2 participants