Third-Culture-Software / bhima

A hospital information management application for rural Congolese hospitals
https://docs.bhi.ma/
GNU General Public License v2.0
218 stars 104 forks source link

Add Feature to Multiply Pay Indices by Frequency for Employee grade #7745

Closed lomamech closed 1 week ago

lomamech commented 2 weeks ago

Add Feature to Multiply Pay Indices by Frequency for Employee Categorization

lomamech commented 2 weeks ago

TO TEST A PULL REQUEST (PR) In order to test this pull request, it will be necessary to create new rubrics that will be linked to the employee grades for configuration.

lomamech commented 2 weeks ago

The first step is to create new rubrics in the Human Resources/Payroll Rubric Management module. image

lomamech commented 2 weeks ago

The context for these rubrics is as follows: we are in a situation where a special bonus is configured by grade. For grade G1, the value is 2, for grade G2, the value is 5, and for grade G3, the value is 10. During the payroll period, the payroll manager will enter the number or frequency corresponding to the payroll month, and the system will assign to the rubric the product of the configured value for the grade and the frequency.

First, "Enable index payment system" in Human Resources > Payroll Settings

To create rubrics linked to grades, simply click on the "Add a Payroll Rubric" button, then enter the following fields:

lomamech commented 2 weeks ago

You can thus create one or more rubrics linked to employee grades.

CONFIGURATION OF GRADE-LINKED RUBRICS

The configuration of grade-linked rubrics allows payroll parameters to be adjusted according to the hierarchical levels of employees. Each grade can be assigned a specific value for rubrics such as bonuses or other benefits. These rubrics enable flexible and automated management of payroll elements, ensuring better accuracy in salary calculations.

lomamech commented 2 weeks ago

To proceed with the configuration, simply access the Indexes/Staffing Indices Management modules. image

lomamech commented 2 weeks ago

Here is the main interface. To access the configuration interface, simply click on the menu. image

image

The grade-linked rubrics appear in the menu with a book icon. Simply click on it to access the configuration form.

lomamech commented 2 weeks ago

The configuration form displays the heading Settings for Calculating Rubrics Based on Employee Grades, followed by the name of the rubric to be configured. image There is a field to select the grade and enter the corresponding value. It should be noted that the system restricts the configuration to multiple grades with different values. To modify a grade, simply delete it and recreate it.

lomamech commented 2 weeks ago

Here is the interface with several grades configured. image

lomamech commented 2 weeks ago

USE CASES For the use case, we will reuse the existing rubric configurations. To do this, we will go to the Human Resources / Payroll Rubric Configuration module and modify the configuration of the rubrics (indices) by adding the new rubrics linked to grades.

image

lomamech commented 2 weeks ago

Next, it will be necessary to check the new rubrics linked to the grade. image

lomamech commented 2 weeks ago

It is now necessary to create a new payroll period with the following parameters: Human Resources / Pay Period Configuration image

image

lomamech commented 2 weeks ago

The final step involves configuring the payroll. To do this, simply go to the Human Resources / Indexes Multiple Payroll (index-based) module, and in the interface, select the newly created payroll period along with the list of configured employees.

image To configure an employee, simply click on the Action area, then on the Configure button. The configuration form will then appear. image

lomamech commented 2 weeks ago

The configuration interface allows you to enter values for the configured rubrics. For the grade-linked rubrics, there are three areas: the first is for the frequency (editable), the second indicates the value that has been configured for the rubric, and the last shows the product (frequency multiplied by the value).

image

This new feature has been added to assist the payroll manager by allowing them to perform certain calculations outside the BHIMA system.

lomamech commented 2 weeks ago

@jniles @jmcameron I have just completed this latest PR with instructions on how to perform the test. If possible, you can proceed with the code review.

lomamech commented 2 weeks ago

I am curious: can I create a rubric linked to a grade that does not respect those rules? For example, can I make it a monetary value? Can I make it an different kind of index type?

I'm just trying to understand the impact if the user makes a mistake in configuring this, since it is not at all obvious.

Personally, I would expect a bonus related to the grade to be configured on the grade page, not on the rubrics page. I would also expect that if these options can only be applied in a certain way, we shouldn't let the user make a mistake by mis-applying the options.

I completely understand you. It would have been possible, on another configuration interface besides the one for creating payroll items, to select indexed, non-monetary items with an index type such as "this item is another benefit". Yes, you're right, configuring payroll items is indeed a delicate task. Personally, I opted for the quickest solution to implement.

In my opinion, the ideal solution would be a new modeling of the payroll module to merge the old system with the index-based national system. Additionally, it would be relevant to introduce a hybrid system where some employees would be paid based on an index, while others would continue to receive a fixed salary. The current payroll module is the result of several implementation periods: 2014-2015, 2017, 2019, and 2022. A complete overhaul would be the best option.

jniles commented 2 weeks ago

@lomamech would you be able to make an issue with some proposals about how to overhaul the payroll systems?

lomamech commented 1 week ago

would you be able to make an issue with some proposals about how to overhaul the payroll systems?

All right

lomamech commented 1 week ago

I tried the instructions in the PR and it seems to work fine. However, I did have to add a reminder to enable index based payroll (see this step).

Some of the end-to-end tests related to rubrics fail. To see this error, run this:

npm install
npx update-browserslist-db@latest
npx playwright install chromium
npm run test:e2e-5

I only glanced at the code. I will look at it more carefully in the next review.

I encourage you to also resolve any changes the @jniles suggested.

I may try to update dependencies in master, so you should verify/update your depdencies before force-pushing your updates.

It's done, the test passes now

lomamech commented 1 week ago

The server/models/migrations/next/migrate.sql file still has a broken merge. It needs to be fixed.

I looked at the code; it looks okay but I did make a few comments.

All tests pass. Thanks @lomamech !

Sorry I had fixed the problem, but when I saved the file with Ctrl + S it didn't take effect

lomamech commented 1 week ago

@jmcameron It's done

jmcameron commented 1 week ago

@lomamech Thanks. I'll try to look at it tomorrow.

Hopefully @jniles will have a chance to look it over again before we merge it.

lomamech commented 1 week ago

@lomamech Thanks. I'll try to look at it tomorrow.

Hopefully @jniles will have a chance to look it over again before we merge it.

Okay and thank you

jniles commented 1 week ago

LGTM. All my changes have been addressed.