Skip to content

Commit

Permalink
fix(Problem of deductions from salaries)
Browse files Browse the repository at this point in the history
- Red coloring of employees for whom the net salary is negative
- Added an error message reporting the case of employees for whom the net salary is negative

closes #7525
  • Loading branch information
lomamech committed Mar 1, 2024
1 parent 5b4e4b7 commit 8a9647f
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 2 deletions.
4 changes: 4 additions & 0 deletions client/src/css/structure.css
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,10 @@ a[disabled] {
background-color: #ffb3b3 !important;
}

.negative {
background-color: #ffb3b3 !important;
}

.expired {
background-color: #ff000083 !important;
}
Expand Down
1 change: 1 addition & 0 deletions client/src/i18n/en/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,7 @@
"ONLY_TWO_SECTORS":"Please select two sectors only",
"ONLY_TWO_VILLAGES":"Please select two villages only",
"ATTENTION_CONFIGURED": "Warning! Only employees waiting for configuration can be configured",
"ATTENTION_NEGATIVE_VALUE": "Warning, there are employees for whom the totality of their deductions is greater than their gross salary, please correct this problem​",
"ATTENTION_PAYSLIPS": "Warning! There are no payslips records for employees waiting for configuration",
"ATTENTION_WAITING_LIST": "Warning! Only configured employees can be placed in the payroll waiting list",
"ATTENTION_SELECTED": "Warning! You have not selected any element",
Expand Down
1 change: 1 addition & 0 deletions client/src/i18n/fr/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,7 @@
"ONLY_TWO_SECTORS":"Veuillez sélectionner seulement deux secteurs",
"ONLY_TWO_VILLAGES":"Veuillez sélectionner seulement deux villages",
"ATTENTION_CONFIGURED": "Attention, seul les employés en attentes de configuration peuvent être configuré",
"ATTENTION_NEGATIVE_VALUE": "Attention, Il y'a des employés pour lequel la totalité de leurs retenues est supérieur à leur salaire brute, veuillez corrigé ce problème",
"ATTENTION_PAYSLIPS": "Attention, il n'existe pas les fiches de paies pour les employés en attente de configuration",
"ATTENTION_SELECTED": "Attention, vous n'avez sélectionné aucun élément",
"ATTENTION_WAITING_LIST": "Attention, seule les employes configurés peuvent être placés dans la liste d'attente",
Expand Down
12 changes: 11 additions & 1 deletion client/src/modules/multiple_payroll/multiple_payroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function MultiplePayrollController(
enableColumnMenus : false,
flatEntityAccess : true,
fastWatch : true,
rowTemplate : '/modules/templates/row.negative.html',
columnDefs,
onRegisterApi : (api) => { vm.gridApi = api; },
};
Expand Down Expand Up @@ -201,8 +202,17 @@ function MultiplePayrollController(
vm.putOnWaiting = function putOnWaiting() {
const employees = vm.gridApi.selection.getSelectedRows();
vm.getSelectedEmployees = employees;
let numberOfEmployeesWithNegativeSalary = 0;

if (employees.length) {
employees.forEach(emp => {
if (emp.net_salary < 0) {
numberOfEmployeesWithNegativeSalary++;
}
});

if (numberOfEmployeesWithNegativeSalary > 0) {
Notify.danger('FORM.WARNINGS.ATTENTION_NEGATIVE_VALUE');
} else if (employees.length && (numberOfEmployeesWithNegativeSalary === 0)) {
// get All Employees Uuid
const employeesUuid = employees.map(emp => emp.employee_uuid);

Expand Down
11 changes: 11 additions & 0 deletions client/src/modules/templates/row.negative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- This template is taken from https://raw.githubusercontent.com/angular-ui/ui-grid/master/src/templates/ui-grid/ui-grid-row.html -->

<div
ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.uid"
ui-grid-one-bind-id-grid="rowRenderIndex + '-' + col.uid + '-cell'"
class="ui-grid-cell"
ng-class="{ 'ui-grid-row-header-cell': col.isRowHeader, 'negative' : row.entity.negativeValue }"
data-vals="{{col.isRowHeader}}"
role="{{col.isRowHeader ? 'rowheader' : 'gridcell'}}"
ui-grid-cell>
</div>
3 changes: 2 additions & 1 deletion server/controllers/payroll/multiplePayroll/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ function find(options) {
payroll.payment_date, payroll.base_taxable, payroll.basic_salary, payroll.gross_salary, payroll.grade_salary,
payroll.text, payroll.net_salary, payroll.working_day, payroll.total_day, payroll.daily_salary,
payroll.amount_paid, payroll.status_id, payroll.status, (payroll.net_salary - payroll.amount_paid) AS balance,
payroll.hrreference, payroll.cost_center_id, payroll.service_name
payroll.hrreference, payroll.cost_center_id, payroll.service_name,
IF (payroll.net_salary < 0, 1, 0) AS negativeValue
FROM(
SELECT employee.uuid AS employee_uuid, employee.reference, em.text AS hrreference, employee.code,
employee.date_embauche, employee.nb_enfant,employee.individual_salary, creditor_group.account_id,
Expand Down

0 comments on commit 8a9647f

Please sign in to comment.