3448-worker_calendar-payedHolidays #846

Merged
carlosjr merged 11 commits from 3448-worker_calendar-payedHolidays into dev 2022-01-17 09:09:46 +00:00
8 changed files with 47 additions and 5 deletions

View File

@ -0,0 +1,25 @@
ALTER TABLE `postgresql`.`business` ADD payedHolidays INT NULL;
ALTER TABLE `postgresql`.`business` CHANGE payedHolidays payedHolidays INT NULL AFTER reasonEndFk;
CREATE OR REPLACE
ALGORITHM = UNDEFINED VIEW `vn`.`workerLabour` AS
select
`b`.`business_id` AS `businessFk`,
`p`.`id_trabajador` AS `workerFk`,
`bl`.`workcenter_id` AS `workCenterFk`,
`b`.`date_start` AS `started`,
`b`.`date_end` AS `ended`,
`d`.`id` AS `departmentFk`,
`b`.`payedHolidays` AS `payedHolidays`
from
((((`postgresql`.`person` `p`
join `postgresql`.`profile` `pr` on
((`pr`.`person_id` = `p`.`person_id`)))
join `postgresql`.`business` `b` on
((`b`.`client_id` = `pr`.`profile_id`)))
join `postgresql`.`business_labour` `bl` on
((`b`.`business_id` = `bl`.`business_id`)))
join `vn`.`department` `d` on
((`d`.`id` = `bl`.`department_id`)))
order by
`b`.`date_start` desc

View File

@ -112,6 +112,13 @@ module.exports = Self => {
const contracts = await models.WorkerLabour.find(filter, myOptions);
let [firstContract] = contracts;
let payedHolidays;
if (firstContract.payedHolidays)
payedHolidays = firstContract.payedHolidays;
else payedHolidays = 0;
let totalHolidays = 0;
let holidaysEnjoyed = 0;
@ -166,8 +173,7 @@ module.exports = Self => {
return isLeapYear(year) ? 366 : 365;
}
return {totalHolidays, holidaysEnjoyed};
return {totalHolidays, holidaysEnjoyed, payedHolidays};
};
function isLeapYear(year) {

View File

@ -9,16 +9,19 @@
"properties": {
"businessFk": {
"id": true,
"type": "Number"
"type": "number"
},
"workerFk": {
"type": "Number"
"type": "number"
},
"started": {
"type": "date"
},
"ended": {
"type": "date"
},
"payedHolidays": {
"type": "number"
}
},
"relations": {

View File

@ -28,6 +28,9 @@
{{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed}}
{{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}}
</div>
<div>
{{'Paid holidays' | translate}} {{$ctrl.contractHolidays.payedHolidays}} {{'days' | translate}}
</div>
</div>
<div class="totalBox" style="text-align: center;">

View File

@ -71,6 +71,10 @@ class Controller extends Section {
}
}
get payedHolidays() {
return this._businessId;
}
buildYearFilter() {
const now = new Date();
now.setFullYear(now.getFullYear() + 1);

View File

@ -9,3 +9,4 @@ Choose an absence type from the right menu: Elige un tipo de ausencia desde el m
To start adding absences, click an absence type from the right menu and then on the day you want to add an absence: Para empezar a añadir ausencias, haz clic en un tipo de ausencia desde el menu de la derecha y después en el día que quieres añadir la ausencia
You can just add absences within the current year: Solo puedes añadir ausencias dentro del año actual
Current day: Día actual
Paid holidays: Vacaciones pagadas