QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
-EXEC: UPDATE portanova.staffreportperioddays SET timestart1='09:30',timeend1='18:30',timestart2=null,timeend2=null,pausestart1='14:30',pauseend1='15:30',pausestart2=null,pauseend2=null,timepause='01:00',timepausetracked='00:00',workhourstracked='00:00',daycomment=null,vacancycomment=null,vacancyhours=null,vacillcomment=null,vacillhours=null,vacextracomment=null,vacextrahours=null,vacschoolcomment=null,vacschoolhours=null,recupcomment=null,recuperationhours=null,partunempcomment=null,partunemplhours=null,otherpaidhourscomment=null,otherpaidhours=null,dayhourstracked='00:00' WHERE id='c233cc20-66d2-5bb0-bfb8-111ef06270f1';
-QUERYARRAY: select daydate from portanova.vacancydays v where daydate between date(date_trunc('week',date('2024-01-31'))) and date(date_trunc('week',date('2024-01-31')) + interval '6 days');
-QUERY: select id from portanova.reportperiod where date('2024-01-31') between startdate and enddate;
-QUERY: select date(date_trunc('year',startdate)) as yearstart ,* from portanova.reportperiod where id='83cf3c4f-62f1-b8a8-c377-d5ae8445dc1e';
-EXEC: update portanova.staffreportperioddays spds set
+EXEC: UPDATE demo2m17.staffreportperioddays SET timestart1='11:00',timeend1='14:00',timestart2='17:00',timeend2='20:40',pausestart1=null,pauseend1=null,pausestart2=null,pauseend2=null,timepause='00:00',timepausetracked='00:00',workhourstracked='00:00',daycomment=null,vacancycomment=null,vacancyhours=null,vacillcomment=null,vacillhours=null,vacextracomment=null,vacextrahours=null,vacschoolcomment=null,vacschoolhours=null,recupcomment=null,recuperationhours=null,partunempcomment=null,partunemplhours=null,otherpaidhourscomment=null,otherpaidhours=null,dayhourstracked='00:00' WHERE id='ee765c0b-3764-0426-fc15-3f1f2555eeba';
+QUERYARRAY: select daydate from demo2m17.vacancydays v where daydate between date(date_trunc('week',date('2024-02-28'))) and date(date_trunc('week',date('2024-02-28')) + interval '6 days');
+QUERY: select id from demo2m17.reportperiod where date('2024-02-28') between startdate and enddate;
+QUERY: select date(date_trunc('year',startdate)) as yearstart ,* from demo2m17.reportperiod where id='08737d53-1fb6-2284-c6c0-418b1ac7e2fa';
+EXEC: update demo2m17.staffreportperioddays spds set
workhours=ds.worktime, timepause=case when ds.timepause::interval > '00:00:00' then ds.timepause else null end,
dayhours=(ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours )::interval, interruptionhours = ds.interruption ,
contracthours=case when ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours::interval > '00:00:00'::interval then ds.wdcontracthours else null end
timestart2::interval - timeend1::interval
else null end as interruption,
wdcontracthours
- from portanova.staffreportperioddays where id in (select id from portanova.staffreportperioddays where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate between date(date_trunc('week',date('2023-12-01'))) and date(date_trunc('week',date('2024-01-31')) + interval '6 days'))
+ from demo2m17.staffreportperioddays where id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-01-01'))) and date(date_trunc('week',date('2024-02-29')) + interval '6 days'))
) preds) ds where spds.id=ds.id;
-EXEC: update portanova.staffreportperioddays SET nighthours = null where id in (select id from portanova.staffreportperioddays where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate between date(date_trunc('week',date('2023-12-01'))) and date(date_trunc('week',date('2024-01-31')) + interval '6 days'));
-EXEC: update portanova.staffreportperioddays spds set
+EXEC: update demo2m17.staffreportperioddays SET nighthours = null where id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-01-01'))) and date(date_trunc('week',date('2024-02-29')) + interval '6 days'));
+EXEC: update demo2m17.staffreportperioddays spds set
nighthours=nh from (
select id,daydate,timestart1,timeend1, timestart2,timeend2,
coalesce((case when timeend1 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend1::interval end) -
(case when timestart1 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart1::interval end),'00:00:00'::interval)
+ coalesce((case when timeend2 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend2::interval end) -
(case when timestart2 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart2::interval end),'00:00:00'::interval) as nh
- from portanova.staffreportperioddays s where
+ from demo2m17.staffreportperioddays s where
(timeend1 between '01:00:01' and '05:59:59' or timeend2 between '01:00:01' and '05:59:59'
or timestart1 between '01:00:01' and '05:59:59' or timestart2 between '01:00:01' and '05:59:59')
- and id in (select id from portanova.staffreportperioddays where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate between date(date_trunc('week',date('2023-12-01'))) and date(date_trunc('week',date('2024-01-31')) + interval '6 days'))
+ and id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-01-01'))) and date(date_trunc('week',date('2024-02-29')) + interval '6 days'))
) ds
where spds.id=ds.id
QUERY: select max(rowx) as statussuncount, sum(modx) as suppvacancysunwork from (
select daydate,rowx, case when mod(rowx,20) = 0 then 2 else null end as modx from (
- select daydate,row_number() over (order by daydate) as rowx from portanova.staffreportperioddays
- where daydate between date('2023-01-01') and date('2023-12-31')
+ select daydate,row_number() over (order by daydate) as rowx from demo2m17.staffreportperioddays
+ where daydate between date('2024-01-01') and date('2024-12-31')
and date_part('isodow',daydate)::int4 = 7 and workhours > '00:00:00'::time
- and id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' order by daydate
- ) xsunday where daydate between date('2023-12-01') and date('2024-01-31')
+ and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by daydate
+ ) xsunday where daydate between date('2024-01-01') and date('2024-02-29')
) sunresult;
-QUERY: select id_period, case when sum(plusdays) over (order by startdate) >= 6 then null else plusdays end as plusdays from (
+QUERY: select id_period, case when sum(plusdays) over (order by startdate) >= 6 then 6 else case when plusdays = 0 then null else plusdays end end as plusdays from (
select id_period,sum(week44s) as plusdays,startdate from (
- select weekstart,case when (sum(sumx) over (order by weekstart)%8)::integer = 0 then 1 else null end as week44s,r.id as id_period,r.startdate,r.enddate, 1 as cnt from (
+ select weekstart,case when (sum(sumx) over (order by weekstart)%8)::integer = 0 then 0 else 1 end as week44s,r.id as id_period,r.startdate,r.enddate from (
select weekstart,case when sum(cnt44) > 0 then 0 else 1 end as sumx,
max(daydate) as maxdate from (
SELECT date(date_trunc('week',yy.daydate)) as weekstart,daydate, dayhours,
- (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2023-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) as xx,yy.timestart,yy.ntimeend,
- case when (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2023-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) > '44:00:00'::interval then 1 else 0 end as cnt44
+ (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2024-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) as xx,yy.timestart,yy.ntimeend,
+ case when (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2024-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) >= '44:00:00'::interval then 1 else 0 end as cnt44
FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend,xx_1.dayhours
FROM ( SELECT sr.id_staff, sr.daydate,sr.dayhours,
CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
- FROM portanova.staffreportperioddays sr
-
- WHERE sr.id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and sr.daydate between date('2023-01-01') and date(date_trunc('week',date('2023-01-01') + interval '1 year') - interval '1 day')
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and sr.daydate between date('2024-01-01') and date(date_trunc('week',date('2024-01-01') + interval '1 year') - interval '1 day')
and sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone
and (sr.timestart1 IS NOT null or sr.timestart2 IS NOT null)
ORDER BY sr.id_staff, sr.daydate) xx_1) yy order by yy.daydate,weekstart
) aa group by aa.weekstart order by weekstart
) bb
- join portanova.reportperiod r on (bb.weekstart between r.startdate and r.enddate)
+ join demo2m17.reportperiod r on (bb.weekstart between r.startdate and r.enddate)
group by weekstart,r.id,bb.sumx order by weekstart
) ff group by id_period,startdate) ss
- where id_period='83cf3c4f-62f1-b8a8-c377-d5ae8445dc1e'
+ where id_period='08737d53-1fb6-2284-c6c0-418b1ac7e2fa'
group by id_period,startdate,ss.plusdays;
QUERY: select weekstart,id_staff,avgtotalhours from (
select ws.weekstart, ws.id_staff,
FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
date(date_trunc('week', daydate) + interval '6 days') AS weekend,
date_part('week', daydate) AS calweek,
- date_part('isoyear', daydate) AS calyear from portanova.staffreportperioddays
- where id_staff= 'eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate between date(date_trunc('week',date('2023-12-01'))) and date(date_trunc('week',date('2024-01-31')) + interval '6 days')
- --where id_staff= 'eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate between date('2023-12-01') and date('2024-01-31')
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-01-01'))) and date(date_trunc('week',date('2024-02-29')) + interval '6 days')
+ --where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-01-01') and date('2024-02-29')
) srpd GROUP BY srpd.weekstart,srpd.id_staff
ORDER BY weekstart) ws) wsavg order by weekstart DESC LIMIT 1;
-EXEC: update portanova.staffreportperiod rpd set
+EXEC: update demo2m17.staffreportperiod rpd set
--contracthours=csp.contracthours,
workhours=csp.workhours,
vacancyill=csp.vacillhours,
partunemplhours=csp.partunemplhours,
totalhours=csp.totalhours,
nighthours=csp.nighthours,
- recuperationhours=csp.recuperationhours,statussuncount=3,suppvacancysunwork=null,suppvacancy44hours=1,status44hcount=null,last44date=null,avgtotalweekhours=null,hoursdiff=csp.diffhours
+ recuperationhours=csp.recuperationhours,statussuncount=null,suppvacancysunwork=null,suppvacancy44hours=null,status44hcount=null,last44date=null,avgtotalweekhours=null,hoursdiff=csp.diffhours
FROM (
select contracthours,workhours,totalhours,recuperationhours, totalhours-contracthours as diffhours,id,vacillhours,vacancynormal,vacextrahours,otherpaidhours,partunemplhours,nighthours from (
select dp.id,
coalesce(dp.payedhours0,'00:00:00'::interval) as payedhours0,
coalesce(dp.payedhours40,'00:00:00'::interval) as payedhours40,
coalesce(dp.transferedhours,'00:00:00'::interval) as transferedhours
- from portanova.staffreportperioddays pd
- join portanova.staffreportperiod dp on (pd.id_staff=dp.id_staff and dp.id_reportperiod = '83cf3c4f-62f1-b8a8-c377-d5ae8445dc1e')
- where pd.id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and pd.daydate between date('2023-12-01') and date('2024-01-31')
+ from demo2m17.staffreportperioddays pd
+ join demo2m17.staffreportperiod dp on (pd.id_staff=dp.id_staff and dp.id_reportperiod = '08737d53-1fb6-2284-c6c0-418b1ac7e2fa')
+ where pd.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and pd.daydate between date('2024-01-01') and date('2024-02-29')
group by dp.id,dp.payedhours,dp.transferedhourscalc
) rp) csp where csp.id=rpd.id;
QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
- FROM portanova.staffreportperiod srp
- LEFT JOIN portanova.staff st ON srp.id_staff = st.id
- LEFT JOIN portanova.reportperiod rp ON srp.id_reportperiod = rp.id
- LEFT JOIN portanova.staffgroups sgr ON st.id_staffgroup = sgr.id
- WHERE st.isdeleted IS NULL AND srp.id_staff = 'eda4fd22-9dcf-4d61-327b-e039b9f48107'
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
-QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from portanova.reportperiod where id='83cf3c4f-62f1-b8a8-c377-d5ae8445dc1e'
+QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from demo2m17.reportperiod where id='351cf732-61ee-8ad4-47fb-78b63159cacb'
QUERYBYKEY: select ws.weekstart,ws.weekend,ws.calweek,ws.calyear, ws.id_staff
,to_char(ws.workhours::interval,'HH24:MI') as workhours
,to_char(ws.vacancyhours,'HH24:MI') as vacancynormal
from (
SELECT weekstart,weekend,calweek,calyear, id_staff,
sum(CASE WHEN srpd.workhours IS NULL THEN '00:00:00'::interval ELSE srpd.workhours::interval END) AS workhours,
- sum(case when srpd.daydate between date('2023-12-01') and date('2024-01-31') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
- --sum(case when srpd.daydate between date('2023-12-01') and date('2024-01-31') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
+ sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
+ --sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
sum(CASE WHEN srpd.vacancyhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacancyhours::interval END) AS vacancyhours,
sum(CASE WHEN srpd.vacillhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacillhours::interval END) AS vacillhours,
sum(CASE WHEN srpd.vacextrahours IS NULL THEN '00:00:00'::interval ELSE srpd.vacextrahours::interval END) AS vacextrahours,
FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
date(date_trunc('week', daydate) + interval '6 days') AS weekend,
date_part('week', daydate) AS calweek,
- date_part('isoyear', daydate) AS calyear from portanova.staffreportperioddays
- where id_staff= 'eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate between date('2023-11-27') and date('2024-02-04')
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-02-26') and date('2024-05-05')
) srpd GROUP BY srpd.weekstart,srpd.weekend,srpd.calweek,srpd.calyear,srpd.id_staff
ORDER BY weekstart) ws left join (
select date(date_trunc('week',pd.daydate)) as weekstart,pd.id_staff,max(sc.weekdays) as cmpcontractdays,max(sc.weekhours) as cmpweekhours,
case when count(pd.daydate) < avg(sc.weekdays) then count(pd.daydate) else avg(sc.weekdays) end as contractworkdays,
case when count(pd.daydate) < avg(sc.weekdays) then avg(sc.weekhours/ sc.weekdays) * count(pd.daydate) else avg(sc.weekhours/ sc.weekdays) * avg(sc.weekdays) end as contracthours ,sum(case when coalesce(pd.workhours,'00:00:00'::time) > '00:00:00'::time then 1 else 0 end) as realworkdays
from ( select id_staff,weekdays ,weekhours,
- case when startdate> date('2023-11-27') then startdate else date('2023-11-27') end as staffperiodstart,
- case when enddate is null or enddate > date('2024-02-04') then date('2024-02-04')
- else enddate end as staffperiodend from portanova.staffcontract where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107'
- and startdate < date('2024-02-04')
+ case when startdate> date('2024-02-26') then startdate else date('2024-02-26') end as staffperiodstart,
+ case when enddate is null or enddate > date('2024-05-05') then date('2024-05-05')
+ else enddate end as staffperiodend from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ and startdate < date('2024-05-05')
) sc
- join portanova.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
+ join demo2m17.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
group by date(date_trunc('week',pd.daydate)),pd.id_staff
) cd on ws.id_staff = cd.id_staff and ws.weekstart=cd.weekstart
left join (
select lpd.id_staff,date(date_trunc('week',lpd.daydate)) as weekstart,lpd.daydate,
case when wk.defaultweekhours is null then wkdef.defaultweekhours else wk.defaultweekhours end as defaultweekhours ,
case when wk.maxweekhours is null then wkdef.maxweekhours else wk.maxweekhours end as maxweekhours
- from portanova.staffreportperioddays lpd
- left join portanova.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
- cross join (select * from portanova.worktimes where isdefault=true) wkdef
- where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and lpd.daydate between date('2023-11-27') and date('2024-02-04')
+ from demo2m17.staffreportperioddays lpd
+ left join demo2m17.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
+ cross join (select * from demo2m17.worktimes where isdefault=true) wkdef
+ where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and lpd.daydate between date('2024-02-26') and date('2024-05-05')
order by lpd.daydate ) mh group by id_staff,weekstart
) maxdata on ws.id_staff = maxdata.id_staff and ws.weekstart=maxdata.weekstart
left join (
select weekstart,id_staff,coalesce(sum(daytracked),'00:00:00'::interval) as weektrackedhours from (
select daydate,id_staff,weekstart,case when sum(trackedhours) > '06:00:00'::interval then sum(trackedhours)- '00:30:00'::interval else coalesce(sum(trackedhours),'00:00:00'::interval) end as daytracked from (
-select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from portanova.timetracker
-where daydate between date('2023-12-01') and date('2024-01-31') and id_staff ='eda4fd22-9dcf-4d61-327b-e039b9f48107') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
+select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from demo2m17.timetracker
+where daydate between date('2024-03-01') and date('2024-04-30') and id_staff ='d8e44d1a-359c-055b-72dc-343c57fdfb76') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
) ttr on ws.weekstart=ttr.weekstart and ws.id_staff=ttr.id_staff;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
QUERYARRAY: SELECT pd.id,pd.id_staff,pd.id_reportperiod,pd.daydate,pd.payedpause,pd.daytype,pd.daycomment,
vacancycomment,vacillcomment,vacextracomment,recupcomment,otherpaidhourscomment,partunempcomment,
to_char(max(tt.trackedtime),'HH24:MI') as trackedtime,
max(case when tt.trackedtime is null or pd.workhours is null then null else interval_to_char(coalesce(tt.trackedtime::interval,'00:00:00'::interval) - coalesce(pd.workhours::interval,'00:00:00'::interval)) end) as trackeddiff,
null as incompletetrack
- FROM portanova.staffreportperioddays pd
- JOIN portanova.staff st ON pd.id_staff = st.id and st.id='eda4fd22-9dcf-4d61-327b-e039b9f48107' and st.isdeleted is null
+ FROM demo2m17.staffreportperioddays pd
+ JOIN demo2m17.staff st ON pd.id_staff = st.id and st.id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and st.isdeleted is null
LEFT JOIN ( SELECT yy.id_staff, yy.ndaydate AS daydate,case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend AS tmfrom, yy.daydate + yy.timestart AS tmto,
yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend) AS realinterval,
date_part('epoch', yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend)) * '00:00:01'::interval AS freehours
FROM ( SELECT sr.id_staff, sr.daydate,
CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
- FROM portanova.staffreportperioddays sr
- WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107'
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
ORDER BY sr.id_staff, sr.daydate) xx_1) yy) freehours ON pd.id_staff = freehours.id_staff AND freehours.daydate = pd.daydate
- left join portanova.worktimes wk on pd.daydate between wk.startdate and wk.enddate
- cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from portanova.worktimes where isdefault =true) wkstd
- left join portanova.vacancydays vd on pd.daydate=vd.daydate
- left join portanova.reportperiod rp on (pd.id_reportperiod=rp.id)
+ left join demo2m17.worktimes wk on pd.daydate between wk.startdate and wk.enddate
+ cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from demo2m17.worktimes where isdefault =true) wkstd
+ left join demo2m17.vacancydays vd on pd.daydate=vd.daydate
+ left join demo2m17.reportperiod rp on (pd.id_reportperiod=rp.id)
left join (
select
sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as sumdayall,
( select *, tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) as pauseduration,
to_char(lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in),'HH24:MI') || '-' || to_char(tx.stamp_in,'HH24:MI') as pausetime,
case when tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
- from portanova.timetracker tx where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and tx.daydate between date('2023-11-27') and date('2024-02-04')
+ from demo2m17.timetracker tx where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and tx.daydate between date('2024-02-26') and date('2024-05-05')
order by tx.stamp_in) tt
group by tt.daydate
) tt on pd.daydate=tt.daydate
- WHERE pd.daydate between date('2023-11-27') and date('2024-02-04')
+ WHERE pd.daydate between date('2024-02-26') and date('2024-05-05')
group by pd.id,rp.viewpartunempl,rp.viewvacschool
ORDER BY pd.id_staff, pd.daydate;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
- us.isblocked is null group by se.id,us.id,ugrp.id;
-QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='portanova';
-QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
- join users us on (us.id=se.id_user)
- left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
- us.isblocked is null group by se.id,us.id,ugrp.id;
-QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='portanova';
-QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
- join users us on (us.id=se.id_user)
- left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
- us.isblocked is null group by se.id,us.id,ugrp.id;
-QUERYARRAY: select sg.id,sg.groupname,sg.groupcolor,sg.isdefault,COALESCE(count(st.id), 0) AS staffmembers FROM portanova.staffgroups sg LEFT JOIN portanova.staff st ON (st.id_staffgroup = sg.id) WHERE st.isdeleted IS NULL GROUP BY sg.id ORDER BY sg.groupname;
-QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
- join users us on (us.id=se.id_user)
- left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
- us.isblocked is null group by se.id,us.id,ugrp.id;
-QUERYARRAY: select id,trackername from portanova.timetrackerconfig order by trackername
-QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
- join users us on (us.id=se.id_user)
- left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
- us.isblocked is null group by se.id,us.id,ugrp.id;
-QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
- join users us on (us.id=se.id_user)
- left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
- us.isblocked is null group by se.id,us.id,ugrp.id;
-QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
- join users us on (us.id=se.id_user)
- left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
- us.isblocked is null group by se.id,us.id,ugrp.id;
-QUERYARRAY: select ttr.*, st.* ,stg.groupname,'<span style="font-weight: bold;">' || COALESCE(coalesce(st.surname,'') || ' ', '') || COALESCE(st.prename, '') || '</span><br/>' || '<span style="color:' || coalesce(st.color,'') || ';font-style: italic;">'|| coalesce(st.job,'') || '</span>' AS staffname,sc.staffstatus from portanova.staff st
- LEFT JOIN portanova.staffgroups stg ON st.id_staffgroup = stg.id
- left join (select id_staff, case when min(startdate) <= current_date and (max(enddate) is null or max(enddate) >= current_date) then 'current'
- when min(startdate) > current_date then 'futur' when max(enddate) < current_date then 'past' else null end as staffstatus,min(startdate)as startdate,max(enddate) as enddate from (select id_staff,startdate,case when enddate is null then current_date else enddate end as enddate from portanova.staffcontract) scc group by id_staff) sc on (st.id=sc.id_staff)
- cross join (select timetrackertype,case when timetrackertype is not null then true else null end as istimetrackerenabled,periodtypes from public.companies where schemata='portanova') ttr
- where st.isdeleted is null order by groupname,st.staffnumber,surname,prename;
-QUERYARRAY: select id,tmplname,tmplcolor as bgcolor FROM portanova.daytemplate order by tmplname;
-QUERYARRAY: SELECT wp.id,wp.workplan,wp.isdefault,wp.weekhours,wp.weekdays,
- coalesce((((((wp.workplan || ' / ') ||substr(wp.weekhours::text, 1, 5)) || 'h / ') || wp.weekdays) || 'j / libre: ') || (( SELECT string_agg(ww.wday, ',') AS string_agg FROM ( SELECT public.day_name(json_array_elements_text(wp.freeweekdayslist)) AS wday) ww)),wp.workplan ) AS dspworkplandetail
- FROM portanova.workplans wp
- ORDER BY wp.isdefault, wp.workplan;
-QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
- join users us on (us.id=se.id_user)
- left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
-QUERY: select * from portanova.staff where id='eda4fd22-9dcf-4d61-327b-e039b9f48107' and isdeleted is null;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ --to_char(srp.vacancyhours, 'HH24:MI'::text) AS vacancyhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select * from demo2m17.staff where id='349a79cc-8e6e-0809-a53f-7524d0b97754' and isdeleted is null;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ --to_char(srp.vacancyhours, 'HH24:MI'::text) AS vacancyhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = '349a79cc-8e6e-0809-a53f-7524d0b97754'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
-QUERYARRAY: SELECT id,id as id_staffcontract,id_staff,startdate,enddate,weekdays,to_char(weekhours, 'HH24:MI'::text) AS weekhours,defaultfreedays from portanova.staffcontract where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' order by startdate,enddate;
-QUERYARRAY: select vac.id_staff || '-' || vac.vacyear as id,vac.id_staff,vac.vacyear,
- to_char(vac.vacnormal,'HH24:MI') as vachours,
- to_char(vac.vacnormal,'HH24:MI') as vacnormal,
- to_char(vac.vacrestbefore,'HH24:MI') as vacrestbefore,
- to_char(vac.vacextra,'HH24:MI') as vacextra,
- coalesce(to_char(plan.vacnormalplanned,'HH24:MI'),'00:00') as vacnormalplanned,
- coalesce(to_char(plan.vacextraplanned,'HH24:MI'),'00:00') as vacextraplanned,
- coalesce(to_char(plan.vacnormalplanned + plan.vacextraplanned,'HH24:MI'),'00:00') as vacplanned,
- coalesce(to_char(vac.vacnormal + vac.vacrestbefore + vac.vacextra,'HH24:MI'),'00:00') as vactotal
- from (
- select id_staff,vacyear,
- sum(case when vactype is null or vactype ='normal' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacnormal,
- sum(case when vactype ='rest' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacrestbefore,
- sum(case when vactype ='extra' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacextra
- from portanova.staffvacancyyear group by id_staff,vacyear ) vac
- left join (
- select id_staff,date_part('year',daydate) as vyear,
- coalesce(sum(vacancyhours),'00:00:00'::interval) as vacnormalplanned,
- coalesce(sum(vacextrahours),'00:00:00'::interval) as vacextraplanned
- from portanova.staffreportperioddays
- where (vacancyhours is not null or vacextrahours is not null)
- group by vyear,id_staff) plan on (vac.id_staff=plan.id_staff and vac.vacyear=plan.vyear)
- where vac.id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107'
- order by vacyear DESC;
-QUERYARRAY: select id_staff || '_' || mmonth || '_' || myear as id,surname || ' ' || prename as staffname ,id_staff,groupname,
- -- vacancyhours,vacillhours,vacextrahours,vacancycomment,vacillcomment,vacextracomment,mday,daydate,vactotal,
- mmonth,myear, case when regexp_replace(string_agg(case when mday='01' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='01' then vcomment else null end,','),',,',',','g') end as c01,string_agg(case when mday='01' then vtypes else null end,'') as t01,to_char(sum(case when mday='01' then vactotal else null end),'HH24:MI') as d01,case when regexp_replace(string_agg(case when mday='02' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='02' then vcomment else null end,','),',,',',','g') end as c02,string_agg(case when mday='02' then vtypes else null end,'') as t02,to_char(sum(case when mday='02' then vactotal else null end),'HH24:MI') as d02,case when regexp_replace(string_agg(case when mday='03' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='03' then vcomment else null end,','),',,',',','g') end as c03,string_agg(case when mday='03' then vtypes else null end,'') as t03,to_char(sum(case when mday='03' then vactotal else null end),'HH24:MI') as d03,case when regexp_replace(string_agg(case when mday='04' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='04' then vcomment else null end,','),',,',',','g') end as c04,string_agg(case when mday='04' then vtypes else null end,'') as t04,to_char(sum(case when mday='04' then vactotal else null end),'HH24:MI') as d04,case when regexp_replace(string_agg(case when mday='05' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='05' then vcomment else null end,','),',,',',','g') end as c05,string_agg(case when mday='05' then vtypes else null end,'') as t05,to_char(sum(case when mday='05' then vactotal else null end),'HH24:MI') as d05,case when regexp_replace(string_agg(case when mday='06' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='06' then vcomment else null end,','),',,',',','g') end as c06,string_agg(case when mday='06' then vtypes else null end,'') as t06,to_char(sum(case when mday='06' then vactotal else null end),'HH24:MI') as d06,case when regexp_replace(string_agg(case when mday='07' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='07' then vcomment else null end,','),',,',',','g') end as c07,string_agg(case when mday='07' then vtypes else null end,'') as t07,to_char(sum(case when mday='07' then vactotal else null end),'HH24:MI') as d07,case when regexp_replace(string_agg(case when mday='08' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='08' then vcomment else null end,','),',,',',','g') end as c08,string_agg(case when mday='08' then vtypes else null end,'') as t08,to_char(sum(case when mday='08' then vactotal else null end),'HH24:MI') as d08,case when regexp_replace(string_agg(case when mday='09' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='09' then vcomment else null end,','),',,',',','g') end as c09,string_agg(case when mday='09' then vtypes else null end,'') as t09,to_char(sum(case when mday='09' then vactotal else null end),'HH24:MI') as d09,case when regexp_replace(string_agg(case when mday='10' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='10' then vcomment else null end,','),',,',',','g') end as c10,string_agg(case when mday='10' then vtypes else null end,'') as t10,to_char(sum(case when mday='10' then vactotal else null end),'HH24:MI') as d10,case when regexp_replace(string_agg(case when mday='11' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='11' then vcomment else null end,','),',,',',','g') end as c11,string_agg(case when mday='11' then vtypes else null end,'') as t11,to_char(sum(case when mday='11' then vactotal else null end),'HH24:MI') as d11,case when regexp_replace(string_agg(case when mday='12' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='12' then vcomment else null end,','),',,',',','g') end as c12,string_agg(case when mday='12' then vtypes else null end,'') as t12,to_char(sum(case when mday='12' then vactotal else null end),'HH24:MI') as d12,case when regexp_replace(string_agg(case when mday='13' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='13' then vcomment else null end,','),',,',',','g') end as c13,string_agg(case when mday='13' then vtypes else null end,'') as t13,to_char(sum(case when mday='13' then vactotal else null end),'HH24:MI') as d13,case when regexp_replace(string_agg(case when mday='14' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='14' then vcomment else null end,','),',,',',','g') end as c14,string_agg(case when mday='14' then vtypes else null end,'') as t14,to_char(sum(case when mday='14' then vactotal else null end),'HH24:MI') as d14,case when regexp_replace(string_agg(case when mday='15' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='15' then vcomment else null end,','),',,',',','g') end as c15,string_agg(case when mday='15' then vtypes else null end,'') as t15,to_char(sum(case when mday='15' then vactotal else null end),'HH24:MI') as d15,case when regexp_replace(string_agg(case when mday='16' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='16' then vcomment else null end,','),',,',',','g') end as c16,string_agg(case when mday='16' then vtypes else null end,'') as t16,to_char(sum(case when mday='16' then vactotal else null end),'HH24:MI') as d16,case when regexp_replace(string_agg(case when mday='17' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='17' then vcomment else null end,','),',,',',','g') end as c17,string_agg(case when mday='17' then vtypes else null end,'') as t17,to_char(sum(case when mday='17' then vactotal else null end),'HH24:MI') as d17,case when regexp_replace(string_agg(case when mday='18' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='18' then vcomment else null end,','),',,',',','g') end as c18,string_agg(case when mday='18' then vtypes else null end,'') as t18,to_char(sum(case when mday='18' then vactotal else null end),'HH24:MI') as d18,case when regexp_replace(string_agg(case when mday='19' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='19' then vcomment else null end,','),',,',',','g') end as c19,string_agg(case when mday='19' then vtypes else null end,'') as t19,to_char(sum(case when mday='19' then vactotal else null end),'HH24:MI') as d19,case when regexp_replace(string_agg(case when mday='20' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='20' then vcomment else null end,','),',,',',','g') end as c20,string_agg(case when mday='20' then vtypes else null end,'') as t20,to_char(sum(case when mday='20' then vactotal else null end),'HH24:MI') as d20,case when regexp_replace(string_agg(case when mday='21' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='21' then vcomment else null end,','),',,',',','g') end as c21,string_agg(case when mday='21' then vtypes else null end,'') as t21,to_char(sum(case when mday='21' then vactotal else null end),'HH24:MI') as d21,case when regexp_replace(string_agg(case when mday='22' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='22' then vcomment else null end,','),',,',',','g') end as c22,string_agg(case when mday='22' then vtypes else null end,'') as t22,to_char(sum(case when mday='22' then vactotal else null end),'HH24:MI') as d22,case when regexp_replace(string_agg(case when mday='23' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='23' then vcomment else null end,','),',,',',','g') end as c23,string_agg(case when mday='23' then vtypes else null end,'') as t23,to_char(sum(case when mday='23' then vactotal else null end),'HH24:MI') as d23,case when regexp_replace(string_agg(case when mday='24' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='24' then vcomment else null end,','),',,',',','g') end as c24,string_agg(case when mday='24' then vtypes else null end,'') as t24,to_char(sum(case when mday='24' then vactotal else null end),'HH24:MI') as d24,case when regexp_replace(string_agg(case when mday='25' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='25' then vcomment else null end,','),',,',',','g') end as c25,string_agg(case when mday='25' then vtypes else null end,'') as t25,to_char(sum(case when mday='25' then vactotal else null end),'HH24:MI') as d25,case when regexp_replace(string_agg(case when mday='26' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='26' then vcomment else null end,','),',,',',','g') end as c26,string_agg(case when mday='26' then vtypes else null end,'') as t26,to_char(sum(case when mday='26' then vactotal else null end),'HH24:MI') as d26,case when regexp_replace(string_agg(case when mday='27' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='27' then vcomment else null end,','),',,',',','g') end as c27,string_agg(case when mday='27' then vtypes else null end,'') as t27,to_char(sum(case when mday='27' then vactotal else null end),'HH24:MI') as d27,case when regexp_replace(string_agg(case when mday='28' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='28' then vcomment else null end,','),',,',',','g') end as c28,string_agg(case when mday='28' then vtypes else null end,'') as t28,to_char(sum(case when mday='28' then vactotal else null end),'HH24:MI') as d28,case when regexp_replace(string_agg(case when mday='29' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='29' then vcomment else null end,','),',,',',','g') end as c29,string_agg(case when mday='29' then vtypes else null end,'') as t29,to_char(sum(case when mday='29' then vactotal else null end),'HH24:MI') as d29,case when regexp_replace(string_agg(case when mday='30' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='30' then vcomment else null end,','),',,',',','g') end as c30,string_agg(case when mday='30' then vtypes else null end,'') as t30,to_char(sum(case when mday='30' then vactotal else null end),'HH24:MI') as d30,case when regexp_replace(string_agg(case when mday='31' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='31' then vcomment else null end,','),',,',',','g') end as c31,string_agg(case when mday='31' then vtypes else null end,'') as t31,to_char(sum(case when mday='31' then vactotal else null end),'HH24:MI') as d31, to_char(sum(vacillhours),'HH24:MI') as totalill,
- to_char(sum(vacextrahours),'HH24:MI') as totalextra,
- to_char(sum(vacancyhours),'HH24:MI') as totalvac from (
- select st.prename,st.surname,spd.id_staff,to_char(spd.daydate,'YYYY') as vacyear,spd.daydate,sg.id as id_staffgroup,sg.groupname,
- coalesce(spd.vacancyhours::interval,'00:00:00'::interval) + coalesce(spd.vacillhours::interval,'00:00:00'::interval) + coalesce(spd.vacextrahours::interval,'00:00:00'::interval) as vactotal,
- spd.vacancyhours,spd.vacillhours,spd.vacextrahours,
- spd.vacancycomment, spd.vacillcomment, spd.vacextracomment,
- case when spd.vacancyhours is not null then 'n' else '' end || case when spd.vacillhours is not null then 'i' else '' end || case when spd.vacextrahours is not null then 'e' else '' end as vtypes,
- coalesce(spd.vacancycomment,'') || ',' || coalesce(spd.vacillcomment,'') || ',' || coalesce(spd.vacextracomment,'') as vcomment,
- to_char(spd.daydate,'DD') as mday,
- to_char(spd.daydate,'MM') as mmonth,
- to_char(spd.daydate,'YYYY') as myear
- from portanova.staffreportperioddays spd
- join portanova.staff st on (st.id=spd.id_staff)
- join portanova.staffgroups sg on (st.id_staffgroup=sg.id)
- where (spd.vacancyhours is not null or spd.vacillhours is not null or spd.vacextrahours is not null) and id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107'
- ) vd group by staffname,groupname,id_staff,myear,mmonth order by myear,staffname,mmonth
+QUERY: select * from demo2m17.staff where id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and isdeleted is null;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
- FROM portanova.staffreportperiod srp
- LEFT JOIN portanova.staff st ON srp.id_staff = st.id
- LEFT JOIN portanova.reportperiod rp ON srp.id_reportperiod = rp.id
- LEFT JOIN portanova.staffgroups sgr ON st.id_staffgroup = sgr.id
- WHERE st.isdeleted IS NULL AND srp.id_staff = 'eda4fd22-9dcf-4d61-327b-e039b9f48107'
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
-QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from portanova.reportperiod where id='83cf3c4f-62f1-b8a8-c377-d5ae8445dc1e'
+QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from demo2m17.reportperiod where id='351cf732-61ee-8ad4-47fb-78b63159cacb'
QUERYBYKEY: select ws.weekstart,ws.weekend,ws.calweek,ws.calyear, ws.id_staff
,to_char(ws.workhours::interval,'HH24:MI') as workhours
,to_char(ws.vacancyhours,'HH24:MI') as vacancynormal
from (
SELECT weekstart,weekend,calweek,calyear, id_staff,
sum(CASE WHEN srpd.workhours IS NULL THEN '00:00:00'::interval ELSE srpd.workhours::interval END) AS workhours,
- sum(case when srpd.daydate between date('2023-12-01') and date('2024-01-31') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
- --sum(case when srpd.daydate between date('2023-12-01') and date('2024-01-31') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
+ sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
+ --sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
sum(CASE WHEN srpd.vacancyhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacancyhours::interval END) AS vacancyhours,
sum(CASE WHEN srpd.vacillhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacillhours::interval END) AS vacillhours,
sum(CASE WHEN srpd.vacextrahours IS NULL THEN '00:00:00'::interval ELSE srpd.vacextrahours::interval END) AS vacextrahours,
FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
date(date_trunc('week', daydate) + interval '6 days') AS weekend,
date_part('week', daydate) AS calweek,
- date_part('isoyear', daydate) AS calyear from portanova.staffreportperioddays
- where id_staff= 'eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate between date('2023-11-27') and date('2024-02-04')
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-02-26') and date('2024-05-05')
) srpd GROUP BY srpd.weekstart,srpd.weekend,srpd.calweek,srpd.calyear,srpd.id_staff
ORDER BY weekstart) ws left join (
select date(date_trunc('week',pd.daydate)) as weekstart,pd.id_staff,max(sc.weekdays) as cmpcontractdays,max(sc.weekhours) as cmpweekhours,
case when count(pd.daydate) < avg(sc.weekdays) then count(pd.daydate) else avg(sc.weekdays) end as contractworkdays,
case when count(pd.daydate) < avg(sc.weekdays) then avg(sc.weekhours/ sc.weekdays) * count(pd.daydate) else avg(sc.weekhours/ sc.weekdays) * avg(sc.weekdays) end as contracthours ,sum(case when coalesce(pd.workhours,'00:00:00'::time) > '00:00:00'::time then 1 else 0 end) as realworkdays
from ( select id_staff,weekdays ,weekhours,
- case when startdate> date('2023-11-27') then startdate else date('2023-11-27') end as staffperiodstart,
- case when enddate is null or enddate > date('2024-02-04') then date('2024-02-04')
- else enddate end as staffperiodend from portanova.staffcontract where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107'
- and startdate < date('2024-02-04')
+ case when startdate> date('2024-02-26') then startdate else date('2024-02-26') end as staffperiodstart,
+ case when enddate is null or enddate > date('2024-05-05') then date('2024-05-05')
+ else enddate end as staffperiodend from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ and startdate < date('2024-05-05')
) sc
- join portanova.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
+ join demo2m17.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
group by date(date_trunc('week',pd.daydate)),pd.id_staff
) cd on ws.id_staff = cd.id_staff and ws.weekstart=cd.weekstart
left join (
select lpd.id_staff,date(date_trunc('week',lpd.daydate)) as weekstart,lpd.daydate,
case when wk.defaultweekhours is null then wkdef.defaultweekhours else wk.defaultweekhours end as defaultweekhours ,
case when wk.maxweekhours is null then wkdef.maxweekhours else wk.maxweekhours end as maxweekhours
- from portanova.staffreportperioddays lpd
- left join portanova.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
- cross join (select * from portanova.worktimes where isdefault=true) wkdef
- where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and lpd.daydate between date('2023-11-27') and date('2024-02-04')
+ from demo2m17.staffreportperioddays lpd
+ left join demo2m17.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
+ cross join (select * from demo2m17.worktimes where isdefault=true) wkdef
+ where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and lpd.daydate between date('2024-02-26') and date('2024-05-05')
order by lpd.daydate ) mh group by id_staff,weekstart
) maxdata on ws.id_staff = maxdata.id_staff and ws.weekstart=maxdata.weekstart
left join (
select weekstart,id_staff,coalesce(sum(daytracked),'00:00:00'::interval) as weektrackedhours from (
select daydate,id_staff,weekstart,case when sum(trackedhours) > '06:00:00'::interval then sum(trackedhours)- '00:30:00'::interval else coalesce(sum(trackedhours),'00:00:00'::interval) end as daytracked from (
-select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from portanova.timetracker
-where daydate between date('2023-12-01') and date('2024-01-31') and id_staff ='eda4fd22-9dcf-4d61-327b-e039b9f48107') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
+select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from demo2m17.timetracker
+where daydate between date('2024-03-01') and date('2024-04-30') and id_staff ='d8e44d1a-359c-055b-72dc-343c57fdfb76') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
) ttr on ws.weekstart=ttr.weekstart and ws.id_staff=ttr.id_staff;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
QUERYARRAY: SELECT pd.id,pd.id_staff,pd.id_reportperiod,pd.daydate,pd.payedpause,pd.daytype,pd.daycomment,
vacancycomment,vacillcomment,vacextracomment,recupcomment,otherpaidhourscomment,partunempcomment,
to_char(max(tt.trackedtime),'HH24:MI') as trackedtime,
max(case when tt.trackedtime is null or pd.workhours is null then null else interval_to_char(coalesce(tt.trackedtime::interval,'00:00:00'::interval) - coalesce(pd.workhours::interval,'00:00:00'::interval)) end) as trackeddiff,
null as incompletetrack
- FROM portanova.staffreportperioddays pd
- JOIN portanova.staff st ON pd.id_staff = st.id and st.id='eda4fd22-9dcf-4d61-327b-e039b9f48107' and st.isdeleted is null
+ FROM demo2m17.staffreportperioddays pd
+ JOIN demo2m17.staff st ON pd.id_staff = st.id and st.id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and st.isdeleted is null
LEFT JOIN ( SELECT yy.id_staff, yy.ndaydate AS daydate,case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend AS tmfrom, yy.daydate + yy.timestart AS tmto,
yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend) AS realinterval,
date_part('epoch', yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend)) * '00:00:01'::interval AS freehours
FROM ( SELECT sr.id_staff, sr.daydate,
CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
- FROM portanova.staffreportperioddays sr
- WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107'
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
ORDER BY sr.id_staff, sr.daydate) xx_1) yy) freehours ON pd.id_staff = freehours.id_staff AND freehours.daydate = pd.daydate
- left join portanova.worktimes wk on pd.daydate between wk.startdate and wk.enddate
- cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from portanova.worktimes where isdefault =true) wkstd
- left join portanova.vacancydays vd on pd.daydate=vd.daydate
- left join portanova.reportperiod rp on (pd.id_reportperiod=rp.id)
+ left join demo2m17.worktimes wk on pd.daydate between wk.startdate and wk.enddate
+ cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from demo2m17.worktimes where isdefault =true) wkstd
+ left join demo2m17.vacancydays vd on pd.daydate=vd.daydate
+ left join demo2m17.reportperiod rp on (pd.id_reportperiod=rp.id)
left join (
select
sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as sumdayall,
( select *, tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) as pauseduration,
to_char(lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in),'HH24:MI') || '-' || to_char(tx.stamp_in,'HH24:MI') as pausetime,
case when tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
- from portanova.timetracker tx where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and tx.daydate between date('2023-11-27') and date('2024-02-04')
+ from demo2m17.timetracker tx where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and tx.daydate between date('2024-02-26') and date('2024-05-05')
order by tx.stamp_in) tt
group by tt.daydate
) tt on pd.daydate=tt.daydate
- WHERE pd.daydate between date('2023-11-27') and date('2024-02-04')
+ WHERE pd.daydate between date('2024-02-26') and date('2024-05-05')
group by pd.id,rp.viewpartunempl,rp.viewvacschool
ORDER BY pd.id_staff, pd.daydate;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
-QUERY: select daydate as datebefore,to_char(case when timestart2 is null then timeend1 else timeend2 end,'HH24:MI') as timeendbefore from portanova.staffreportperioddays where id_staff= 'eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate < date('2023-12-06') and (timestart1 is not null or timestart2 is not null) order by daydate desc limit 1;
-QUERY: select daydate as dateafter ,to_char(case when timestart1 is null then timestart2 else timestart1 end,'HH24:MI') as timestartafter from portanova.staffreportperioddays where id_staff= 'eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate > date('2023-12-06') and (timestart1 is not null or timestart2 is not null) order by daydate asc limit 1;
-QUERY: select weekhours from portanova.staffcontract where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and ((date('2023-12-06') between startdate and enddate) or (startdate <= date('2023-12-06') and enddate is null)) order by startdate,enddate nulls first limit 1;
+QUERY: select daydate as datebefore,to_char(case when timestart2 is null then timeend1 else timeend2 end,'HH24:MI') as timeendbefore from demo2m17.staffreportperioddays where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate < date('2024-05-02') and (timestart1 is not null or timestart2 is not null) order by daydate desc limit 1;
+QUERY: select daydate as dateafter ,to_char(case when timestart1 is null then timestart2 else timestart1 end,'HH24:MI') as timestartafter from demo2m17.staffreportperioddays where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate > date('2024-05-02') and (timestart1 is not null or timestart2 is not null) order by daydate asc limit 1;
+QUERY: select weekhours from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and ((date('2024-05-02') between startdate and enddate) or (startdate <= date('2024-05-02') and enddate is null)) order by startdate,enddate nulls first limit 1;
QUERY: select to_char(wk.maxdayhours,'HH24:MI') as maxdayhours,
to_char(wk.maxweekhours,'HH24:MI') as maxweekhours,
to_char(wk.maxinterruptionhours,'HH24:MI') as maxinterruptionhours,
to_char(wk.mindailyrecuperation,'HH24:MI') as mindailyrecuperation,
to_char(wk.defaultweekhours,'HH24:MI') as defaultweekhours,
- '2023-12-05' as datebefore,
- '18:30' as timebefore,
- '2023-12-07' as dateafter,
- '09:30' as timeafter
- from portanova.worktimes wk where (date('2023-12-06') between wk.startdate and wk.enddate) or (wk.startdate is null and wk.enddate is null) and maxhourspercents is null
+ '2024-05-01' as datebefore,
+ '20:40' as timebefore,
+ '2024-05-03' as dateafter,
+ '11:00' as timeafter
+ from demo2m17.worktimes wk where (date('2024-05-02') between wk.startdate and wk.enddate) or (wk.startdate is null and wk.enddate is null) and maxhourspercents is null
order by wk.startdate,wk.enddate nulls last limit 1;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
QUERYARRAY: select id,id_staff,daydate,to_char(stamp_in,'HH24:MI') as stamp_in,to_char(stamp_out,'HH24:MI') as stamp_out,
case when stamp_in is null or stamp_out is null then null else to_char(stamp_out-stamp_in,'HH24:MI') end as total,tracktype, to_char(stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') as pauseduration,
to_char(lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') || '-' || to_char(stamp_in,'HH24:MI') as pausetime,
case when stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
- from portanova.timetracker where daydate=date('2023-12-06') and id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' order by stamp_in,stamp_out;
-QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
- join users us on (us.id=se.id_user)
- left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
- us.isblocked is null group by se.id,us.id,ugrp.id;
+ from demo2m17.timetracker where daydate=date('2024-05-02') and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by stamp_in,stamp_out;
QUERYARRAY: select id,id_staff,daydate,to_char(stamp_in,'HH24:MI') as stamp_in,to_char(stamp_out,'HH24:MI') as stamp_out,
case when stamp_in is null or stamp_out is null then null else to_char(stamp_out-stamp_in,'HH24:MI') end as total,tracktype, to_char(stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') as pauseduration,
to_char(lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') || '-' || to_char(stamp_in,'HH24:MI') as pausetime,
case when stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
- from portanova.timetracker where daydate=date('2023-12-06') and id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' order by stamp_in,stamp_out;
+ from demo2m17.timetracker where daydate=date('2024-05-02') and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by stamp_in,stamp_out;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
-EXEC: UPDATE portanova.staffreportperioddays SET timestart1='09:30',timeend1='18:30',timestart2=null,timeend2=null,pausestart1='14:30',pauseend1='15:30',pausestart2=null,pauseend2=null,timepause='01:00',timepausetracked='00:00',workhourstracked='00:00',daycomment=null,vacancycomment=null,vacancyhours=null,vacillcomment=null,vacillhours=null,vacextracomment=null,vacextrahours=null,vacschoolcomment=null,vacschoolhours=null,recupcomment=null,recuperationhours=null,partunempcomment=null,partunemplhours=null,otherpaidhourscomment=null,otherpaidhours=null,dayhourstracked='00:00' WHERE id='4e853d22-d4b6-bce5-5e98-51a64b5f350e';
-QUERYARRAY: select daydate from portanova.vacancydays v where daydate between date(date_trunc('week',date('2023-12-06'))) and date(date_trunc('week',date('2023-12-06')) + interval '6 days');
-QUERY: select id from portanova.reportperiod where date('2023-12-06') between startdate and enddate;
-QUERY: select date(date_trunc('year',startdate)) as yearstart ,* from portanova.reportperiod where id='83cf3c4f-62f1-b8a8-c377-d5ae8445dc1e';
-EXEC: update portanova.staffreportperioddays spds set
+EXEC: UPDATE demo2m17.staffreportperioddays SET timestart1='11:00',timeend1='14:00',timestart2='17:00',timeend2='20:40',pausestart1=null,pauseend1=null,pausestart2=null,pauseend2=null,timepause='00:00',timepausetracked='00:00',workhourstracked='00:00',daycomment=null,vacancycomment=null,vacancyhours=null,vacillcomment=null,vacillhours=null,vacextracomment=null,vacextrahours=null,vacschoolcomment=null,vacschoolhours=null,recupcomment=null,recuperationhours=null,partunempcomment=null,partunemplhours=null,otherpaidhourscomment=null,otherpaidhours=null,dayhourstracked='00:00' WHERE id='fe6e4b01-7e6f-2357-96b7-2b6b3b195bc0';
+QUERYARRAY: select daydate from demo2m17.vacancydays v where daydate between date(date_trunc('week',date('2024-05-02'))) and date(date_trunc('week',date('2024-05-02')) + interval '6 days');
+QUERY: select id,dayhours from demo2m17.staffreportperioddays where daydate=date('2024-05-01') and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76';
+QUERY: select id from demo2m17.reportperiod where date('2024-05-02') between startdate and enddate;
+QUERY: select date(date_trunc('year',startdate)) as yearstart ,* from demo2m17.reportperiod where id='';
+EXEC: update demo2m17.staffreportperioddays spds set
workhours=ds.worktime, timepause=case when ds.timepause::interval > '00:00:00' then ds.timepause else null end,
dayhours=(ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours )::interval, interruptionhours = ds.interruption ,
contracthours=case when ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours::interval > '00:00:00'::interval then ds.wdcontracthours else null end
timestart2::interval - timeend1::interval
else null end as interruption,
wdcontracthours
- from portanova.staffreportperioddays where id in (select id from portanova.staffreportperioddays where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate between date(date_trunc('week',date('2023-12-01'))) and date(date_trunc('week',date('2024-01-31')) + interval '6 days'))
+ from demo2m17.staffreportperioddays where id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date(''))) and date(date_trunc('week',date('')) + interval '6 days'))
) preds) ds where spds.id=ds.id;
-EXEC: update portanova.staffreportperioddays SET nighthours = null where id in (select id from portanova.staffreportperioddays where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate between date(date_trunc('week',date('2023-12-01'))) and date(date_trunc('week',date('2024-01-31')) + interval '6 days'));
-EXEC: update portanova.staffreportperioddays spds set
+EXEC: update demo2m17.staffreportperioddays SET nighthours = null where id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date(''))) and date(date_trunc('week',date('')) + interval '6 days'));
+EXEC: update demo2m17.staffreportperioddays spds set
nighthours=nh from (
select id,daydate,timestart1,timeend1, timestart2,timeend2,
coalesce((case when timeend1 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend1::interval end) -
(case when timestart1 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart1::interval end),'00:00:00'::interval)
+ coalesce((case when timeend2 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend2::interval end) -
(case when timestart2 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart2::interval end),'00:00:00'::interval) as nh
- from portanova.staffreportperioddays s where
+ from demo2m17.staffreportperioddays s where
(timeend1 between '01:00:01' and '05:59:59' or timeend2 between '01:00:01' and '05:59:59'
or timestart1 between '01:00:01' and '05:59:59' or timestart2 between '01:00:01' and '05:59:59')
- and id in (select id from portanova.staffreportperioddays where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate between date(date_trunc('week',date('2023-12-01'))) and date(date_trunc('week',date('2024-01-31')) + interval '6 days'))
+ and id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date(''))) and date(date_trunc('week',date('')) + interval '6 days'))
) ds
where spds.id=ds.id
QUERY: select max(rowx) as statussuncount, sum(modx) as suppvacancysunwork from (
select daydate,rowx, case when mod(rowx,20) = 0 then 2 else null end as modx from (
- select daydate,row_number() over (order by daydate) as rowx from portanova.staffreportperioddays
- where daydate between date('2023-01-01') and date('2023-12-31')
+ select daydate,row_number() over (order by daydate) as rowx from demo2m17.staffreportperioddays
+ where daydate between date('-01-01') and date('-12-31')
and date_part('isodow',daydate)::int4 = 7 and workhours > '00:00:00'::time
- and id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' order by daydate
- ) xsunday where daydate between date('2023-12-01') and date('2024-01-31')
+ and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by daydate
+ ) xsunday where daydate between date('') and date('')
) sunresult;
QUERY: select id_period, case when sum(plusdays) over (order by startdate) >= 6 then 6 else case when plusdays = 0 then null else plusdays end end as plusdays from (
select id_period,sum(week44s) as plusdays,startdate from (
select weekstart,case when sum(cnt44) > 0 then 0 else 1 end as sumx,
max(daydate) as maxdate from (
SELECT date(date_trunc('week',yy.daydate)) as weekstart,daydate, dayhours,
- (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2023-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) as xx,yy.timestart,yy.ntimeend,
- case when (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2023-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) >= '44:00:00'::interval then 1 else 0 end as cnt44
+ (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) as xx,yy.timestart,yy.ntimeend,
+ case when (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) >= '44:00:00'::interval then 1 else 0 end as cnt44
FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend,xx_1.dayhours
FROM ( SELECT sr.id_staff, sr.daydate,sr.dayhours,
CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
- FROM portanova.staffreportperioddays sr
- WHERE sr.id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and sr.daydate between date('2023-01-01') and date(date_trunc('week',date('2023-01-01') + interval '1 year') - interval '1 day')
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and sr.daydate between date('') and date(date_trunc('week',date('') + interval '1 year') - interval '1 day')
and sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone
and (sr.timestart1 IS NOT null or sr.timestart2 IS NOT null)
ORDER BY sr.id_staff, sr.daydate) xx_1) yy order by yy.daydate,weekstart
) aa group by aa.weekstart order by weekstart
) bb
- join portanova.reportperiod r on (bb.weekstart between r.startdate and r.enddate)
+ join demo2m17.reportperiod r on (bb.weekstart between r.startdate and r.enddate)
group by weekstart,r.id,bb.sumx order by weekstart
) ff group by id_period,startdate) ss
- where id_period='83cf3c4f-62f1-b8a8-c377-d5ae8445dc1e'
+ where id_period=''
group by id_period,startdate,ss.plusdays;
QUERY: select weekstart,id_staff,avgtotalhours from (
select ws.weekstart, ws.id_staff,
FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
date(date_trunc('week', daydate) + interval '6 days') AS weekend,
date_part('week', daydate) AS calweek,
- date_part('isoyear', daydate) AS calyear from portanova.staffreportperioddays
- where id_staff= 'eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate between date(date_trunc('week',date('2023-12-01'))) and date(date_trunc('week',date('2024-01-31')) + interval '6 days')
- --where id_staff= 'eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate between date('2023-12-01') and date('2024-01-31')
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date(''))) and date(date_trunc('week',date('')) + interval '6 days')
+ --where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('') and date('')
) srpd GROUP BY srpd.weekstart,srpd.id_staff
ORDER BY weekstart) ws) wsavg order by weekstart DESC LIMIT 1;
-EXEC: update portanova.staffreportperiod rpd set
+EXEC: update demo2m17.staffreportperiod rpd set
--contracthours=csp.contracthours,
workhours=csp.workhours,
vacancyill=csp.vacillhours,
partunemplhours=csp.partunemplhours,
totalhours=csp.totalhours,
nighthours=csp.nighthours,
- recuperationhours=csp.recuperationhours,statussuncount=3,suppvacancysunwork=null,suppvacancy44hours=null,status44hcount=null,last44date=null,avgtotalweekhours=null,hoursdiff=csp.diffhours
+ recuperationhours=csp.recuperationhours,statussuncount=null,suppvacancysunwork=null,suppvacancy44hours=null,status44hcount=null,last44date=null,avgtotalweekhours=null,hoursdiff=csp.diffhours
FROM (
select contracthours,workhours,totalhours,recuperationhours, totalhours-contracthours as diffhours,id,vacillhours,vacancynormal,vacextrahours,otherpaidhours,partunemplhours,nighthours from (
select dp.id,
coalesce(dp.payedhours0,'00:00:00'::interval) as payedhours0,
coalesce(dp.payedhours40,'00:00:00'::interval) as payedhours40,
coalesce(dp.transferedhours,'00:00:00'::interval) as transferedhours
- from portanova.staffreportperioddays pd
- join portanova.staffreportperiod dp on (pd.id_staff=dp.id_staff and dp.id_reportperiod = '83cf3c4f-62f1-b8a8-c377-d5ae8445dc1e')
- where pd.id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and pd.daydate between date('2023-12-01') and date('2024-01-31')
+ from demo2m17.staffreportperioddays pd
+ join demo2m17.staffreportperiod dp on (pd.id_staff=dp.id_staff and dp.id_reportperiod = '')
+ where pd.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and pd.daydate between date('') and date('')
group by dp.id,dp.payedhours,dp.transferedhourscalc
) rp) csp where csp.id=rpd.id;
QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
- FROM portanova.staffreportperiod srp
- LEFT JOIN portanova.staff st ON srp.id_staff = st.id
- LEFT JOIN portanova.reportperiod rp ON srp.id_reportperiod = rp.id
- LEFT JOIN portanova.staffgroups sgr ON st.id_staffgroup = sgr.id
- WHERE st.isdeleted IS NULL AND srp.id_staff = 'eda4fd22-9dcf-4d61-327b-e039b9f48107'
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
-QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from portanova.reportperiod where id='83cf3c4f-62f1-b8a8-c377-d5ae8445dc1e'
+QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from demo2m17.reportperiod where id='351cf732-61ee-8ad4-47fb-78b63159cacb'
QUERYBYKEY: select ws.weekstart,ws.weekend,ws.calweek,ws.calyear, ws.id_staff
,to_char(ws.workhours::interval,'HH24:MI') as workhours
,to_char(ws.vacancyhours,'HH24:MI') as vacancynormal
from (
SELECT weekstart,weekend,calweek,calyear, id_staff,
sum(CASE WHEN srpd.workhours IS NULL THEN '00:00:00'::interval ELSE srpd.workhours::interval END) AS workhours,
- sum(case when srpd.daydate between date('2023-12-01') and date('2024-01-31') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
- --sum(case when srpd.daydate between date('2023-12-01') and date('2024-01-31') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
+ sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
+ --sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
sum(CASE WHEN srpd.vacancyhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacancyhours::interval END) AS vacancyhours,
sum(CASE WHEN srpd.vacillhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacillhours::interval END) AS vacillhours,
sum(CASE WHEN srpd.vacextrahours IS NULL THEN '00:00:00'::interval ELSE srpd.vacextrahours::interval END) AS vacextrahours,
FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
date(date_trunc('week', daydate) + interval '6 days') AS weekend,
date_part('week', daydate) AS calweek,
- date_part('isoyear', daydate) AS calyear from portanova.staffreportperioddays
- where id_staff= 'eda4fd22-9dcf-4d61-327b-e039b9f48107' and daydate between date('2023-11-27') and date('2024-02-04')
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-02-26') and date('2024-05-05')
) srpd GROUP BY srpd.weekstart,srpd.weekend,srpd.calweek,srpd.calyear,srpd.id_staff
ORDER BY weekstart) ws left join (
select date(date_trunc('week',pd.daydate)) as weekstart,pd.id_staff,max(sc.weekdays) as cmpcontractdays,max(sc.weekhours) as cmpweekhours,
case when count(pd.daydate) < avg(sc.weekdays) then count(pd.daydate) else avg(sc.weekdays) end as contractworkdays,
case when count(pd.daydate) < avg(sc.weekdays) then avg(sc.weekhours/ sc.weekdays) * count(pd.daydate) else avg(sc.weekhours/ sc.weekdays) * avg(sc.weekdays) end as contracthours ,sum(case when coalesce(pd.workhours,'00:00:00'::time) > '00:00:00'::time then 1 else 0 end) as realworkdays
from ( select id_staff,weekdays ,weekhours,
- case when startdate> date('2023-11-27') then startdate else date('2023-11-27') end as staffperiodstart,
- case when enddate is null or enddate > date('2024-02-04') then date('2024-02-04')
- else enddate end as staffperiodend from portanova.staffcontract where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107'
- and startdate < date('2024-02-04')
+ case when startdate> date('2024-02-26') then startdate else date('2024-02-26') end as staffperiodstart,
+ case when enddate is null or enddate > date('2024-05-05') then date('2024-05-05')
+ else enddate end as staffperiodend from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ and startdate < date('2024-05-05')
) sc
- join portanova.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
+ join demo2m17.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
group by date(date_trunc('week',pd.daydate)),pd.id_staff
) cd on ws.id_staff = cd.id_staff and ws.weekstart=cd.weekstart
left join (
select lpd.id_staff,date(date_trunc('week',lpd.daydate)) as weekstart,lpd.daydate,
case when wk.defaultweekhours is null then wkdef.defaultweekhours else wk.defaultweekhours end as defaultweekhours ,
case when wk.maxweekhours is null then wkdef.maxweekhours else wk.maxweekhours end as maxweekhours
- from portanova.staffreportperioddays lpd
- left join portanova.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
- cross join (select * from portanova.worktimes where isdefault=true) wkdef
- where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and lpd.daydate between date('2023-11-27') and date('2024-02-04')
+ from demo2m17.staffreportperioddays lpd
+ left join demo2m17.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
+ cross join (select * from demo2m17.worktimes where isdefault=true) wkdef
+ where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and lpd.daydate between date('2024-02-26') and date('2024-05-05')
order by lpd.daydate ) mh group by id_staff,weekstart
) maxdata on ws.id_staff = maxdata.id_staff and ws.weekstart=maxdata.weekstart
left join (
select weekstart,id_staff,coalesce(sum(daytracked),'00:00:00'::interval) as weektrackedhours from (
select daydate,id_staff,weekstart,case when sum(trackedhours) > '06:00:00'::interval then sum(trackedhours)- '00:30:00'::interval else coalesce(sum(trackedhours),'00:00:00'::interval) end as daytracked from (
-select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from portanova.timetracker
-where daydate between date('2023-12-01') and date('2024-01-31') and id_staff ='eda4fd22-9dcf-4d61-327b-e039b9f48107') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
+select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from demo2m17.timetracker
+where daydate between date('2024-03-01') and date('2024-04-30') and id_staff ='d8e44d1a-359c-055b-72dc-343c57fdfb76') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
) ttr on ws.weekstart=ttr.weekstart and ws.id_staff=ttr.id_staff;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
QUERYARRAY: SELECT pd.id,pd.id_staff,pd.id_reportperiod,pd.daydate,pd.payedpause,pd.daytype,pd.daycomment,
vacancycomment,vacillcomment,vacextracomment,recupcomment,otherpaidhourscomment,partunempcomment,
to_char(max(tt.trackedtime),'HH24:MI') as trackedtime,
max(case when tt.trackedtime is null or pd.workhours is null then null else interval_to_char(coalesce(tt.trackedtime::interval,'00:00:00'::interval) - coalesce(pd.workhours::interval,'00:00:00'::interval)) end) as trackeddiff,
null as incompletetrack
- FROM portanova.staffreportperioddays pd
- JOIN portanova.staff st ON pd.id_staff = st.id and st.id='eda4fd22-9dcf-4d61-327b-e039b9f48107' and st.isdeleted is null
+ FROM demo2m17.staffreportperioddays pd
+ JOIN demo2m17.staff st ON pd.id_staff = st.id and st.id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and st.isdeleted is null
LEFT JOIN ( SELECT yy.id_staff, yy.ndaydate AS daydate,case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend AS tmfrom, yy.daydate + yy.timestart AS tmto,
yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend) AS realinterval,
date_part('epoch', yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend)) * '00:00:01'::interval AS freehours
FROM ( SELECT sr.id_staff, sr.daydate,
CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
- FROM portanova.staffreportperioddays sr
- WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107'
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
ORDER BY sr.id_staff, sr.daydate) xx_1) yy) freehours ON pd.id_staff = freehours.id_staff AND freehours.daydate = pd.daydate
- left join portanova.worktimes wk on pd.daydate between wk.startdate and wk.enddate
- cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from portanova.worktimes where isdefault =true) wkstd
- left join portanova.vacancydays vd on pd.daydate=vd.daydate
- left join portanova.reportperiod rp on (pd.id_reportperiod=rp.id)
+ left join demo2m17.worktimes wk on pd.daydate between wk.startdate and wk.enddate
+ cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from demo2m17.worktimes where isdefault =true) wkstd
+ left join demo2m17.vacancydays vd on pd.daydate=vd.daydate
+ left join demo2m17.reportperiod rp on (pd.id_reportperiod=rp.id)
left join (
select
sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as sumdayall,
( select *, tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) as pauseduration,
to_char(lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in),'HH24:MI') || '-' || to_char(tx.stamp_in,'HH24:MI') as pausetime,
case when tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
- from portanova.timetracker tx where id_staff='eda4fd22-9dcf-4d61-327b-e039b9f48107' and tx.daydate between date('2023-11-27') and date('2024-02-04')
+ from demo2m17.timetracker tx where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and tx.daydate between date('2024-02-26') and date('2024-05-05')
order by tx.stamp_in) tt
group by tt.daydate
) tt on pd.daydate=tt.daydate
- WHERE pd.daydate between date('2023-11-27') and date('2024-02-04')
+ WHERE pd.daydate between date('2024-02-26') and date('2024-05-05')
group by pd.id,rp.viewpartunempl,rp.viewvacschool
ORDER BY pd.id_staff, pd.daydate;
QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
join users us on (us.id=se.id_user)
left join usergroups ugrp on (ugrp.id=us.id_usergroup)
- where se.id= 'd3012122-762e-cc6c-0e78-7fb6787225bd' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT distinct(us.schema_name),case when cp.company is null then 'schema:' || us.schema_name else company end as company ,
+ us.schema_name AS schemaname,
+ case when datasetname is null then 'schema:' || us.schema_name else datasetname end as datasetname
+ FROM ( select schema_name from information_schema.schemata where schema_owner != 'postgres' and schema_name != 'public') us
+ JOIN companies cp ON cp.schemata = us.schema_name AND cp.isdeleted IS null and cp.company is not null and cp.portal='app';
+QUERY: select terms from demo2m17.users where id='e9e6880b-75c7-70b5-ce61-49cf6d62630f';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: select sg.id,sg.groupname,sg.groupcolor,sg.isdefault,COALESCE(count(st.id), 0) AS staffmembers FROM demo2m17.staffgroups sg LEFT JOIN demo2m17.staff st ON (st.id_staffgroup = sg.id) WHERE st.isdeleted IS NULL GROUP BY sg.id ORDER BY sg.groupname;
+QUERYARRAY: select ttr.*, st.* ,stg.groupname,'<span style="font-weight: bold;">' || COALESCE(coalesce(st.surname,'') || ' ', '') || COALESCE(st.prename, '') || '</span><br/>' || '<span style="color:' || coalesce(st.color,'') || ';font-style: italic;">'|| coalesce(st.job,'') || '</span>' AS staffname,sc.staffstatus from demo2m17.staff st
+ LEFT JOIN demo2m17.staffgroups stg ON st.id_staffgroup = stg.id
+ left join (select id_staff, case when min(startdate) <= current_date and (max(enddate) is null or max(enddate) >= current_date) then 'current'
+ when min(startdate) > current_date then 'futur' when max(enddate) < current_date then 'past' else null end as staffstatus,min(startdate)as startdate,max(enddate) as enddate from (select id_staff,startdate,case when enddate is null then current_date else enddate end as enddate from demo2m17.staffcontract) scc group by id_staff) sc on (st.id=sc.id_staff)
+ cross join (select timetrackertype,case when timetrackertype is not null then true else null end as istimetrackerenabled,periodtypes from public.companies where schemata='demo2m17') ttr
+ where st.isdeleted is null order by groupname,st.staffnumber,surname,prename;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT wp.id,wp.workplan,wp.isdefault,wp.weekhours,wp.weekdays,
+ coalesce((((((wp.workplan || ' / ') ||substr(wp.weekhours::text, 1, 5)) || 'h / ') || wp.weekdays) || 'j / libre: ') || (( SELECT string_agg(ww.wday, ',') AS string_agg FROM ( SELECT public.day_name(json_array_elements_text(wp.freeweekdayslist)) AS wday) ww)),wp.workplan ) AS dspworkplandetail
+ FROM demo2m17.workplans wp
+ ORDER BY wp.isdefault, wp.workplan;
+QUERYARRAY: select id,tmplname,tmplcolor as bgcolor FROM demo2m17.daytemplate order by tmplname;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select * from demo2m17.staff where id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and isdeleted is null;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: select vac.id_staff || '-' || vac.vacyear as id,vac.id_staff,vac.vacyear,
+ to_char(vac.vacnormal,'HH24:MI') as vachours,
+ to_char(vac.vacnormal,'HH24:MI') as vacnormal,
+ to_char(vac.vacrestbefore,'HH24:MI') as vacrestbefore,
+ to_char(vac.vacextra,'HH24:MI') as vacextra,
+ coalesce(to_char(plan.vacnormalplanned,'HH24:MI'),'00:00') as vacnormalplanned,
+ coalesce(to_char(plan.vacextraplanned,'HH24:MI'),'00:00') as vacextraplanned,
+ coalesce(to_char(plan.vacnormalplanned + plan.vacextraplanned,'HH24:MI'),'00:00') as vacplanned,
+ coalesce(to_char(vac.vacnormal + vac.vacrestbefore + vac.vacextra,'HH24:MI'),'00:00') as vactotal
+ from (
+ select id_staff,vacyear,
+ sum(case when vactype is null or vactype ='normal' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacnormal,
+ sum(case when vactype ='rest' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacrestbefore,
+ sum(case when vactype ='extra' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacextra
+ from demo2m17.staffvacancyyear group by id_staff,vacyear ) vac
+ left join (
+ select id_staff,date_part('year',daydate) as vyear,
+ coalesce(sum(vacancyhours),'00:00:00'::interval) as vacnormalplanned,
+ coalesce(sum(vacextrahours),'00:00:00'::interval) as vacextraplanned
+ from demo2m17.staffreportperioddays
+ where (vacancyhours is not null or vacextrahours is not null)
+ group by vyear,id_staff) plan on (vac.id_staff=plan.id_staff and vac.vacyear=plan.vyear)
+ where vac.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ order by vacyear DESC;
+QUERYARRAY: SELECT id,id as id_staffcontract,id_staff,startdate,enddate,weekdays,to_char(weekhours, 'HH24:MI'::text) AS weekhours,defaultfreedays from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by startdate,enddate;
+QUERYARRAY: select id_staff || '_' || mmonth || '_' || myear as id,surname || ' ' || prename as staffname ,id_staff,groupname,
+ -- vacancyhours,vacillhours,vacextrahours,vacancycomment,vacillcomment,vacextracomment,mday,daydate,vactotal,
+ mmonth,myear, case when regexp_replace(string_agg(case when mday='01' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='01' then vcomment else null end,','),',,',',','g') end as c01,string_agg(case when mday='01' then vtypes else null end,'') as t01,to_char(sum(case when mday='01' then vactotal else null end),'HH24:MI') as d01,case when regexp_replace(string_agg(case when mday='02' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='02' then vcomment else null end,','),',,',',','g') end as c02,string_agg(case when mday='02' then vtypes else null end,'') as t02,to_char(sum(case when mday='02' then vactotal else null end),'HH24:MI') as d02,case when regexp_replace(string_agg(case when mday='03' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='03' then vcomment else null end,','),',,',',','g') end as c03,string_agg(case when mday='03' then vtypes else null end,'') as t03,to_char(sum(case when mday='03' then vactotal else null end),'HH24:MI') as d03,case when regexp_replace(string_agg(case when mday='04' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='04' then vcomment else null end,','),',,',',','g') end as c04,string_agg(case when mday='04' then vtypes else null end,'') as t04,to_char(sum(case when mday='04' then vactotal else null end),'HH24:MI') as d04,case when regexp_replace(string_agg(case when mday='05' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='05' then vcomment else null end,','),',,',',','g') end as c05,string_agg(case when mday='05' then vtypes else null end,'') as t05,to_char(sum(case when mday='05' then vactotal else null end),'HH24:MI') as d05,case when regexp_replace(string_agg(case when mday='06' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='06' then vcomment else null end,','),',,',',','g') end as c06,string_agg(case when mday='06' then vtypes else null end,'') as t06,to_char(sum(case when mday='06' then vactotal else null end),'HH24:MI') as d06,case when regexp_replace(string_agg(case when mday='07' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='07' then vcomment else null end,','),',,',',','g') end as c07,string_agg(case when mday='07' then vtypes else null end,'') as t07,to_char(sum(case when mday='07' then vactotal else null end),'HH24:MI') as d07,case when regexp_replace(string_agg(case when mday='08' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='08' then vcomment else null end,','),',,',',','g') end as c08,string_agg(case when mday='08' then vtypes else null end,'') as t08,to_char(sum(case when mday='08' then vactotal else null end),'HH24:MI') as d08,case when regexp_replace(string_agg(case when mday='09' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='09' then vcomment else null end,','),',,',',','g') end as c09,string_agg(case when mday='09' then vtypes else null end,'') as t09,to_char(sum(case when mday='09' then vactotal else null end),'HH24:MI') as d09,case when regexp_replace(string_agg(case when mday='10' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='10' then vcomment else null end,','),',,',',','g') end as c10,string_agg(case when mday='10' then vtypes else null end,'') as t10,to_char(sum(case when mday='10' then vactotal else null end),'HH24:MI') as d10,case when regexp_replace(string_agg(case when mday='11' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='11' then vcomment else null end,','),',,',',','g') end as c11,string_agg(case when mday='11' then vtypes else null end,'') as t11,to_char(sum(case when mday='11' then vactotal else null end),'HH24:MI') as d11,case when regexp_replace(string_agg(case when mday='12' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='12' then vcomment else null end,','),',,',',','g') end as c12,string_agg(case when mday='12' then vtypes else null end,'') as t12,to_char(sum(case when mday='12' then vactotal else null end),'HH24:MI') as d12,case when regexp_replace(string_agg(case when mday='13' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='13' then vcomment else null end,','),',,',',','g') end as c13,string_agg(case when mday='13' then vtypes else null end,'') as t13,to_char(sum(case when mday='13' then vactotal else null end),'HH24:MI') as d13,case when regexp_replace(string_agg(case when mday='14' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='14' then vcomment else null end,','),',,',',','g') end as c14,string_agg(case when mday='14' then vtypes else null end,'') as t14,to_char(sum(case when mday='14' then vactotal else null end),'HH24:MI') as d14,case when regexp_replace(string_agg(case when mday='15' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='15' then vcomment else null end,','),',,',',','g') end as c15,string_agg(case when mday='15' then vtypes else null end,'') as t15,to_char(sum(case when mday='15' then vactotal else null end),'HH24:MI') as d15,case when regexp_replace(string_agg(case when mday='16' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='16' then vcomment else null end,','),',,',',','g') end as c16,string_agg(case when mday='16' then vtypes else null end,'') as t16,to_char(sum(case when mday='16' then vactotal else null end),'HH24:MI') as d16,case when regexp_replace(string_agg(case when mday='17' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='17' then vcomment else null end,','),',,',',','g') end as c17,string_agg(case when mday='17' then vtypes else null end,'') as t17,to_char(sum(case when mday='17' then vactotal else null end),'HH24:MI') as d17,case when regexp_replace(string_agg(case when mday='18' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='18' then vcomment else null end,','),',,',',','g') end as c18,string_agg(case when mday='18' then vtypes else null end,'') as t18,to_char(sum(case when mday='18' then vactotal else null end),'HH24:MI') as d18,case when regexp_replace(string_agg(case when mday='19' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='19' then vcomment else null end,','),',,',',','g') end as c19,string_agg(case when mday='19' then vtypes else null end,'') as t19,to_char(sum(case when mday='19' then vactotal else null end),'HH24:MI') as d19,case when regexp_replace(string_agg(case when mday='20' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='20' then vcomment else null end,','),',,',',','g') end as c20,string_agg(case when mday='20' then vtypes else null end,'') as t20,to_char(sum(case when mday='20' then vactotal else null end),'HH24:MI') as d20,case when regexp_replace(string_agg(case when mday='21' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='21' then vcomment else null end,','),',,',',','g') end as c21,string_agg(case when mday='21' then vtypes else null end,'') as t21,to_char(sum(case when mday='21' then vactotal else null end),'HH24:MI') as d21,case when regexp_replace(string_agg(case when mday='22' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='22' then vcomment else null end,','),',,',',','g') end as c22,string_agg(case when mday='22' then vtypes else null end,'') as t22,to_char(sum(case when mday='22' then vactotal else null end),'HH24:MI') as d22,case when regexp_replace(string_agg(case when mday='23' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='23' then vcomment else null end,','),',,',',','g') end as c23,string_agg(case when mday='23' then vtypes else null end,'') as t23,to_char(sum(case when mday='23' then vactotal else null end),'HH24:MI') as d23,case when regexp_replace(string_agg(case when mday='24' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='24' then vcomment else null end,','),',,',',','g') end as c24,string_agg(case when mday='24' then vtypes else null end,'') as t24,to_char(sum(case when mday='24' then vactotal else null end),'HH24:MI') as d24,case when regexp_replace(string_agg(case when mday='25' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='25' then vcomment else null end,','),',,',',','g') end as c25,string_agg(case when mday='25' then vtypes else null end,'') as t25,to_char(sum(case when mday='25' then vactotal else null end),'HH24:MI') as d25,case when regexp_replace(string_agg(case when mday='26' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='26' then vcomment else null end,','),',,',',','g') end as c26,string_agg(case when mday='26' then vtypes else null end,'') as t26,to_char(sum(case when mday='26' then vactotal else null end),'HH24:MI') as d26,case when regexp_replace(string_agg(case when mday='27' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='27' then vcomment else null end,','),',,',',','g') end as c27,string_agg(case when mday='27' then vtypes else null end,'') as t27,to_char(sum(case when mday='27' then vactotal else null end),'HH24:MI') as d27,case when regexp_replace(string_agg(case when mday='28' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='28' then vcomment else null end,','),',,',',','g') end as c28,string_agg(case when mday='28' then vtypes else null end,'') as t28,to_char(sum(case when mday='28' then vactotal else null end),'HH24:MI') as d28,case when regexp_replace(string_agg(case when mday='29' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='29' then vcomment else null end,','),',,',',','g') end as c29,string_agg(case when mday='29' then vtypes else null end,'') as t29,to_char(sum(case when mday='29' then vactotal else null end),'HH24:MI') as d29,case when regexp_replace(string_agg(case when mday='30' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='30' then vcomment else null end,','),',,',',','g') end as c30,string_agg(case when mday='30' then vtypes else null end,'') as t30,to_char(sum(case when mday='30' then vactotal else null end),'HH24:MI') as d30,case when regexp_replace(string_agg(case when mday='31' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='31' then vcomment else null end,','),',,',',','g') end as c31,string_agg(case when mday='31' then vtypes else null end,'') as t31,to_char(sum(case when mday='31' then vactotal else null end),'HH24:MI') as d31, to_char(sum(vacillhours),'HH24:MI') as totalill,
+ to_char(sum(vacextrahours),'HH24:MI') as totalextra,
+ to_char(sum(vacancyhours),'HH24:MI') as totalvac from (
+ select st.prename,st.surname,spd.id_staff,to_char(spd.daydate,'YYYY') as vacyear,spd.daydate,sg.id as id_staffgroup,sg.groupname,
+ coalesce(spd.vacancyhours::interval,'00:00:00'::interval) + coalesce(spd.vacillhours::interval,'00:00:00'::interval) + coalesce(spd.vacextrahours::interval,'00:00:00'::interval) as vactotal,
+ spd.vacancyhours,spd.vacillhours,spd.vacextrahours,
+ spd.vacancycomment, spd.vacillcomment, spd.vacextracomment,
+ case when spd.vacancyhours is not null then 'n' else '' end || case when spd.vacillhours is not null then 'i' else '' end || case when spd.vacextrahours is not null then 'e' else '' end as vtypes,
+ coalesce(spd.vacancycomment,'') || ',' || coalesce(spd.vacillcomment,'') || ',' || coalesce(spd.vacextracomment,'') as vcomment,
+ to_char(spd.daydate,'DD') as mday,
+ to_char(spd.daydate,'MM') as mmonth,
+ to_char(spd.daydate,'YYYY') as myear
+ from demo2m17.staffreportperioddays spd
+ join demo2m17.staff st on (st.id=spd.id_staff)
+ join demo2m17.staffgroups sg on (st.id_staffgroup=sg.id)
+ where (spd.vacancyhours is not null or spd.vacillhours is not null or spd.vacextrahours is not null) and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ) vd group by staffname,groupname,id_staff,myear,mmonth order by myear,staffname,mmonth
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
us.isblocked is null group by se.id,us.id,ugrp.id;
QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
- FROM portanova.staffreportperiod srp
- LEFT JOIN portanova.staff st ON srp.id_staff = st.id
- LEFT JOIN portanova.reportperiod rp ON srp.id_reportperiod = rp.id
- LEFT JOIN portanova.staffgroups sgr ON st.id_staffgroup = sgr.id
- WHERE st.isdeleted IS NULL AND srp.id_staff = 'eda4fd22-9dcf-4d61-327b-e039b9f48107'
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select * from demo2m17.staff where id='850c482c-41ca-284f-07e7-9b08ba7b9bd7' and isdeleted is null;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ --to_char(srp.vacancyhours, 'HH24:MI'::text) AS vacancyhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = '850c482c-41ca-284f-07e7-9b08ba7b9bd7'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select * from demo2m17.staff where id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and isdeleted is null;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ --to_char(srp.vacancyhours, 'HH24:MI'::text) AS vacancyhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from demo2m17.reportperiod where id='351cf732-61ee-8ad4-47fb-78b63159cacb'
+QUERYBYKEY: select ws.weekstart,ws.weekend,ws.calweek,ws.calyear, ws.id_staff
+ ,to_char(ws.workhours::interval,'HH24:MI') as workhours
+ ,to_char(ws.vacancyhours,'HH24:MI') as vacancynormal
+ ,to_char(ws.vacillhours,'HH24:MI') as vacancyill
+ ,to_char(ws.vacextrahours,'HH24:MI') as vacancyextra
+ ,to_char(ws.vacschoolhours,'HH24:MI') as vacancyschool
+ ,to_char(ws.otherpaidhours,'HH24:MI') as otherpaidhours
+ ,to_char(ws.partunemplhours,'HH24:MI') as partunemplhours
+ ,to_char(ws.recuperationhours,'HH24:MI') as recuperationhours
+ ,to_char(ws.totalhours,'HH24:MI') as totalhours
+ ,cd.contractworkdays
+ ,cd.cmpcontractdays
+ ,cd.cmpweekhours
+ ,to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval),'HH24:MI') as weektrackedhours
+ ,ws.periodworkhours
+ ,interval_to_char(sum(coalesce(ttr.weektrackedhours,'00:00:00'::interval)) over (order by ws.weekstart) - sum(ws.periodworkhours::interval) over (order by ws.weekstart)) as periodtrackdiff
+ ,sum(ws.workhours::interval) over (order by ws.weekstart) as runningworkhours
+ ,interval_to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval) - ws.periodworkhours::interval) as trackeddiff
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else to_char(cd.contracthours,'HH24:MI') end as contracthours
+ ,to_char(AVG(ws.totalhours) over (order by ws.weekstart),'HH24:MI') as avgtotalhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then '00:00' else interval_to_char(ws.totalhours-cd.contracthours) end as diffhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then
+ to_char(case when cd.cmpweekhours < '40:00:00'::interval then cd.contracthours * 1.15 * cd.contractworkdays else (cd.contractworkdays*'08:00:00'::interval) + (cd.contractworkdays* case when maxdata.maxweekhours > '48:00:00' then '01:16:50'::interval else '00:50:00'::interval end) end,'HH24:MI')
+ else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours * 1.15 else maxdata.maxweekhours end,'HH24:MI')
+ end as maxweekhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours else maxdata.defaultweekhours end,'HH24:MI')
+ end as defaultweekhours
+ from (
+ SELECT weekstart,weekend,calweek,calyear, id_staff,
+ sum(CASE WHEN srpd.workhours IS NULL THEN '00:00:00'::interval ELSE srpd.workhours::interval END) AS workhours,
+ sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
+ --sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
+ sum(CASE WHEN srpd.vacancyhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacancyhours::interval END) AS vacancyhours,
+ sum(CASE WHEN srpd.vacillhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacillhours::interval END) AS vacillhours,
+ sum(CASE WHEN srpd.vacextrahours IS NULL THEN '00:00:00'::interval ELSE srpd.vacextrahours::interval END) AS vacextrahours,
+ sum(CASE WHEN srpd.vacschoolhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacschoolhours::interval END) AS vacschoolhours,
+ sum(CASE WHEN srpd.recuperationhours IS NULL THEN '00:00:00'::interval ELSE srpd.recuperationhours::interval END) AS recuperationhours,
+ sum(CASE WHEN srpd.otherpaidhours IS NULL THEN '00:00:00'::interval ELSE srpd.otherpaidhours::interval END) AS otherpaidhours,
+ sum(CASE WHEN srpd.partunemplhours IS NULL THEN '00:00:00'::interval ELSE srpd.partunemplhours::interval END) AS partunemplhours,
+ sum(CASE WHEN srpd.dayhours IS NULL THEN '00:00:00'::interval ELSE srpd.dayhours::interval END) AS totalhours,
+ sum(CASE WHEN srpd.workhours > '00:00:00'::time without time zone OR srpd.recuperationhours > '00:00:00'::time without time zone OR srpd.vacancyhours > '00:00:00'::time without time zone OR srpd.vacillhours > '00:00:00'::time without time zone OR srpd.vacextrahours > '00:00:00'::time without time zone OR srpd.vacschoolhours > '00:00:00'::time without time zone OR srpd.otherpaidhours > '00:00:00'::time without time zone or srpd.partunemplhours > '00:00:00'::time without time zone THEN 1 ELSE 0 END) AS workdays,
+ sum( CASE WHEN srpd.contracthours IS NULL THEN '00:00:00'::interval ELSE srpd.contracthours::interval END) AS contracthours
+ FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
+ date(date_trunc('week', daydate) + interval '6 days') AS weekend,
+ date_part('week', daydate) AS calweek,
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-02-26') and date('2024-05-05')
+ ) srpd GROUP BY srpd.weekstart,srpd.weekend,srpd.calweek,srpd.calyear,srpd.id_staff
+ ORDER BY weekstart) ws left join (
+ select date(date_trunc('week',pd.daydate)) as weekstart,pd.id_staff,max(sc.weekdays) as cmpcontractdays,max(sc.weekhours) as cmpweekhours,
+ case when count(pd.daydate) < avg(sc.weekdays) then count(pd.daydate) else avg(sc.weekdays) end as contractworkdays,
+ case when count(pd.daydate) < avg(sc.weekdays) then avg(sc.weekhours/ sc.weekdays) * count(pd.daydate) else avg(sc.weekhours/ sc.weekdays) * avg(sc.weekdays) end as contracthours ,sum(case when coalesce(pd.workhours,'00:00:00'::time) > '00:00:00'::time then 1 else 0 end) as realworkdays
+ from ( select id_staff,weekdays ,weekhours,
+ case when startdate> date('2024-02-26') then startdate else date('2024-02-26') end as staffperiodstart,
+ case when enddate is null or enddate > date('2024-05-05') then date('2024-05-05')
+ else enddate end as staffperiodend from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ and startdate < date('2024-05-05')
+ ) sc
+ join demo2m17.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
+ group by date(date_trunc('week',pd.daydate)),pd.id_staff
+ ) cd on ws.id_staff = cd.id_staff and ws.weekstart=cd.weekstart
+ left join (
+ select id_staff,weekstart,max(defaultweekhours) as defaultweekhours,avg(maxweekhours) as maxweekhours from (
+ select lpd.id_staff,date(date_trunc('week',lpd.daydate)) as weekstart,lpd.daydate,
+ case when wk.defaultweekhours is null then wkdef.defaultweekhours else wk.defaultweekhours end as defaultweekhours ,
+ case when wk.maxweekhours is null then wkdef.maxweekhours else wk.maxweekhours end as maxweekhours
+ from demo2m17.staffreportperioddays lpd
+ left join demo2m17.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
+ cross join (select * from demo2m17.worktimes where isdefault=true) wkdef
+ where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and lpd.daydate between date('2024-02-26') and date('2024-05-05')
+ order by lpd.daydate ) mh group by id_staff,weekstart
+ ) maxdata on ws.id_staff = maxdata.id_staff and ws.weekstart=maxdata.weekstart
+ left join (
+ select weekstart,id_staff,coalesce(sum(daytracked),'00:00:00'::interval) as weektrackedhours from (
+ select daydate,id_staff,weekstart,case when sum(trackedhours) > '06:00:00'::interval then sum(trackedhours)- '00:30:00'::interval else coalesce(sum(trackedhours),'00:00:00'::interval) end as daytracked from (
+select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from demo2m17.timetracker
+where daydate between date('2024-03-01') and date('2024-04-30') and id_staff ='d8e44d1a-359c-055b-72dc-343c57fdfb76') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
+ ) ttr on ws.weekstart=ttr.weekstart and ws.id_staff=ttr.id_staff;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT pd.id,pd.id_staff,pd.id_reportperiod,pd.daydate,pd.payedpause,pd.daytype,pd.daycomment,
+ vacancycomment,vacillcomment,vacextracomment,recupcomment,otherpaidhourscomment,partunempcomment,
+ pd.daytemplate,pd.vacschoolcomment,rp.viewpartunempl,rp.viewvacschool,
+ date(date_trunc('week',pd.daydate)) as weekstart,
+ to_char(pd.timestart1::interval, 'HH24:MI') AS timestart1,
+ to_char(pd.timeend1::interval, 'HH24:MI') AS timeend1,
+ to_char(pd.timestart2::interval, 'HH24:MI') AS timestart2,
+ to_char(pd.timeend2::interval, 'HH24:MI') AS timeend2,
+ to_char(pd.timepause::interval, 'HH24:MI') AS timepause,
+ -- coalesce('<div class="dspvacancynormal">' || to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN null ELSE pd.vacancyhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyill">' || to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN null else pd.vacillhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyextra">' || to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN null ELSE pd.vacextrahours END::interval, 'HH24:MI') || '</div>','') AS dspvacancyhours,
+ to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacancyhours END::interval, 'HH24:MI') AS vacancyhours,
+ to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacillhours END::interval, 'HH24:MI') AS vacillhours,
+ to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacextrahours END::interval, 'HH24:MI') AS vacextrahours,
+ to_char(CASE WHEN pd.vacschoolhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacschoolhours END::interval, 'HH24:MI') AS vacschoolhours,
+ to_char(CASE WHEN pd.otherpaidhours::interval = '00:00:00'::interval THEN NULL ELSE pd.otherpaidhours END::interval, 'HH24:MI') AS otherpaidhours,
+ to_char(CASE WHEN pd.partunemplhours::interval = '00:00:00'::interval THEN NULL ELSE pd.partunemplhours END::interval, 'HH24:MI') AS partunemplhours,
+ to_char(pd.contracthours::interval, 'HH24:MI') AS contracthours,
+ to_char(CASE WHEN pd.workhours::interval = '00:00:00'::interval THEN NULL ELSE pd.workhours END::interval, 'HH24:MI') AS workhours,
+ to_char(CASE WHEN pd.dayhours::interval = '00:00:00'::interval THEN NULL ELSE pd.dayhours END::interval, 'HH24:MI') AS dayhours,
+ to_char(case WHEN pd.recuperationhours::interval = '00:00:00'::interval THEN NULL ELSE pd.recuperationhours END::interval, 'HH24:MI') AS recuperationhours,
+ to_char(CASE WHEN pd.interruptionhours::interval = '00:00:00'::interval THEN NULL ELSE pd.interruptionhours END::interval, 'HH24:MI') AS interruptionhours,
+ to_char(CASE WHEN pd.nighthours::interval = '00:00:00'::interval THEN NULL ELSE pd.nighthours END::interval, 'HH24:MI') AS nighthours,
+ to_char(pd.pausestart1::interval, 'HH24:MI') AS pausestart1,
+ to_char(pd.pauseend1::interval, 'HH24:MI') AS pauseend1,
+ to_char(pd.pausestart2::interval, 'HH24:MI') AS pausestart2,
+ to_char(pd.pauseend2::interval, 'HH24:MI') AS pauseend2,
+ COALESCE((to_char(pd.pausestart1::interval, 'HH24:MI') || '-') || to_char(pd.pauseend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.pausestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.pausestart2::interval, 'HH24:MI')) || '-') || to_char(pd.pauseend2::interval, 'HH24:MI'), '') AS dsppausedata,
+ COALESCE((to_char(pd.timestart1::interval, 'HH24:MI') || '-') || to_char(pd.timeend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.timestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.timestart2::interval, 'HH24:MI')) || '-') || to_char(pd.timeend2::interval, 'HH24:MI'), '') AS dspworkdata,
+ CASE WHEN max(freehours.freehours) < '00:00:00'::interval THEN NULL ELSE to_char(max(freehours.freehours), 'HH24:MI') END AS freehoursafter,
+ to_char(coalesce(max(wk.defaultdayhours),max(wkstd.defaultdayhours)),'HH24:MI') as defaultdayhours,
+ to_char(coalesce(max(wk.maxdayhours),max(wkstd.maxdayhours)),'HH24:MI') as maxdayhours,
+ to_char(coalesce(max(wk.mindailyrecuperation),max(wkstd.mindailyrecuperation)),'HH24:MI') as mindailyrecuperation,
+ to_char(coalesce(max(wk.maxinterruptionhours),max(wkstd.maxinterruptionhours)),'HH24:MI') as maxinterruptionhours,
+ max(vd.vacancyname) as vacancyname,
+ to_char(max(tt.trackedtime),'HH24:MI') as trackedtime,
+ max(case when tt.trackedtime is null or pd.workhours is null then null else interval_to_char(coalesce(tt.trackedtime::interval,'00:00:00'::interval) - coalesce(pd.workhours::interval,'00:00:00'::interval)) end) as trackeddiff,
+ null as incompletetrack
+ FROM demo2m17.staffreportperioddays pd
+ JOIN demo2m17.staff st ON pd.id_staff = st.id and st.id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and st.isdeleted is null
+ LEFT JOIN ( SELECT yy.id_staff, yy.ndaydate AS daydate,case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend AS tmfrom, yy.daydate + yy.timestart AS tmto,
+ yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend) AS realinterval,
+ date_part('epoch', yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend)) * '00:00:01'::interval AS freehours
+ FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
+ lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
+ xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend
+ FROM ( SELECT sr.id_staff, sr.daydate,
+ CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
+ CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY sr.id_staff, sr.daydate) xx_1) yy) freehours ON pd.id_staff = freehours.id_staff AND freehours.daydate = pd.daydate
+ left join demo2m17.worktimes wk on pd.daydate between wk.startdate and wk.enddate
+ cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from demo2m17.worktimes where isdefault =true) wkstd
+ left join demo2m17.vacancydays vd on pd.daydate=vd.daydate
+ left join demo2m17.reportperiod rp on (pd.id_reportperiod=rp.id)
+ left join (
+ select
+ sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as sumdayall,
+ string_agg(minpauseok::text,'') as minpauses, null as incompletetrack,
+ case when sum(minpauseok) = 0 and sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) >= '06:00:00'::interval then sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) - '00:30:00'::interval else sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) end as trackedtime,daydate from
+ ( select *, tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) as pauseduration,
+ to_char(lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in),'HH24:MI') || '-' || to_char(tx.stamp_in,'HH24:MI') as pausetime,
+ case when tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker tx where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and tx.daydate between date('2024-02-26') and date('2024-05-05')
+ order by tx.stamp_in) tt
+ group by tt.daydate
+ ) tt on pd.daydate=tt.daydate
+ WHERE pd.daydate between date('2024-02-26') and date('2024-05-05')
+ group by pd.id,rp.viewpartunempl,rp.viewvacschool
+ ORDER BY pd.id_staff, pd.daydate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select daydate as datebefore,to_char(case when timestart2 is null then timeend1 else timeend2 end,'HH24:MI') as timeendbefore from demo2m17.staffreportperioddays where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate < date('2024-03-21') and (timestart1 is not null or timestart2 is not null) order by daydate desc limit 1;
+QUERY: select daydate as dateafter ,to_char(case when timestart1 is null then timestart2 else timestart1 end,'HH24:MI') as timestartafter from demo2m17.staffreportperioddays where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate > date('2024-03-21') and (timestart1 is not null or timestart2 is not null) order by daydate asc limit 1;
+QUERY: select weekhours from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and ((date('2024-03-21') between startdate and enddate) or (startdate <= date('2024-03-21') and enddate is null)) order by startdate,enddate nulls first limit 1;
+QUERY: select to_char(wk.maxdayhours,'HH24:MI') as maxdayhours,
+ to_char(wk.maxweekhours,'HH24:MI') as maxweekhours,
+ to_char(wk.maxinterruptionhours,'HH24:MI') as maxinterruptionhours,
+ to_char(wk.mindailyrecuperation,'HH24:MI') as mindailyrecuperation,
+ to_char(wk.defaultweekhours,'HH24:MI') as defaultweekhours,
+ '2024-03-20' as datebefore,
+ '20:40' as timebefore,
+ '2024-03-22' as dateafter,
+ '11:00' as timeafter
+ from demo2m17.worktimes wk where (date('2024-03-21') between wk.startdate and wk.enddate) or (wk.startdate is null and wk.enddate is null) and maxhourspercents is null
+ order by wk.startdate,wk.enddate nulls last limit 1;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: select id,id_staff,daydate,to_char(stamp_in,'HH24:MI') as stamp_in,to_char(stamp_out,'HH24:MI') as stamp_out,
+ case when stamp_in is null or stamp_out is null then null else to_char(stamp_out-stamp_in,'HH24:MI') end as total,tracktype, to_char(stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') as pauseduration,
+ to_char(lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') || '-' || to_char(stamp_in,'HH24:MI') as pausetime,
+ case when stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker where daydate=date('2024-03-21') and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by stamp_in,stamp_out;
+QUERYARRAY: select id,id_staff,daydate,to_char(stamp_in,'HH24:MI') as stamp_in,to_char(stamp_out,'HH24:MI') as stamp_out,
+ case when stamp_in is null or stamp_out is null then null else to_char(stamp_out-stamp_in,'HH24:MI') end as total,tracktype, to_char(stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') as pauseduration,
+ to_char(lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') || '-' || to_char(stamp_in,'HH24:MI') as pausetime,
+ case when stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker where daydate=date('2024-03-21') and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by stamp_in,stamp_out;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+EXEC: UPDATE demo2m17.staffreportperioddays SET timestart1='11:00',timeend1='14:00',timestart2='17:00',timeend2='20:40',pausestart1=null,pauseend1=null,pausestart2=null,pauseend2=null,timepause='00:00',timepausetracked='00:00',workhourstracked='00:00',daycomment=null,vacancycomment=null,vacancyhours=null,vacillcomment=null,vacillhours=null,vacextracomment=null,vacextrahours=null,vacschoolcomment=null,vacschoolhours=null,recupcomment=null,recuperationhours=null,partunempcomment=null,partunemplhours=null,otherpaidhourscomment=null,otherpaidhours=null,dayhourstracked='00:00' WHERE id='0e36a93d-fc77-6c40-72b7-34dc7232d8c0';
+QUERYARRAY: select daydate from demo2m17.vacancydays v where daydate between date(date_trunc('week',date('2024-03-21'))) and date(date_trunc('week',date('2024-03-21')) + interval '6 days');
+QUERY: select id from demo2m17.reportperiod where date('2024-03-21') between startdate and enddate;
+QUERY: select date(date_trunc('year',startdate)) as yearstart ,* from demo2m17.reportperiod where id='351cf732-61ee-8ad4-47fb-78b63159cacb';
+EXEC: update demo2m17.staffreportperioddays spds set
+ workhours=ds.worktime, timepause=case when ds.timepause::interval > '00:00:00' then ds.timepause else null end,
+ dayhours=(ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours )::interval, interruptionhours = ds.interruption ,
+ contracthours=case when ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours::interval > '00:00:00'::interval then ds.wdcontracthours else null end
+ from (
+ select preds.id,case when preds.recuperationhours is null then '00:00:00'::interval else preds.recuperationhours::interval end as recup,
+ case when preds.vacancyhours is null then '00:00:00'::time else preds.vacancyhours end as vachours,
+ case when preds.vacillhours is null then '00:00:00'::time else preds.vacillhours end as vacillhours,
+ case when preds.vacextrahours is null then '00:00:00'::time else preds.vacextrahours end as vacextrahours,
+ case when preds.otherpaidhours is null then '00:00:00'::time else preds.otherpaidhours end as otherpaidhours,
+ case when preds.partunemplhours is null then '00:00:00'::time else preds.partunemplhours end as partunemplhours,
+ preds.interruption,
+ (preds.dt1+preds.dt2)-(preds.pdt1+preds.pdt2) as worktime,
+ (preds.pdt1+preds.pdt2) as timepause,
+ wdcontracthours
+ from ( select id, recuperationhours,vacancyhours,vacillhours,vacextrahours,otherpaidhours,payedpause,partunemplhours,nighthours,
+ case when timestart1 is not null and timeend1 is not null then case when timeend1 < timestart1 then '24:00:00'::interval + timeend1::interval - timestart1::interval else timeend1::interval - timestart1::interval end else '00:00:00'::interval end as dt1,
+ case when timestart2 is not null and timeend2 is not null then case when timeend2 < timestart2 then '24:00:00'::interval + timeend2::interval - timestart2::interval else timeend2::interval - timestart2::interval end else '00:00:00'::interval end as dt2,
+ case when pausestart1 between timestart1 and case when timeend1 < timestart1 then timeend1::interval + '24:00:00'::interval else timeend1::interval end and pauseend1 between timestart1 and case when timeend1 < timestart1 then timeend1::interval + '24:00:00'::interval else timeend1::interval end then case when pauseend1 < pausestart1 then '24:00:00'::interval + pauseend1::interval - pausestart1::interval else pauseend1::interval - pausestart1::interval end else '00:00:00'::interval end as pdt1,
+ case when pausestart1 between timestart2 and case when timeend2 < timestart2 then timeend2::interval + '24:00:00'::interval else timeend2::interval end and pauseend2 between timestart2 and case when timeend2 < timestart2 then timeend2::interval + '24:00:00'::interval else timeend2::interval end then case when pauseend2 < pausestart2 then '24:00:00'::interval + pauseend2::interval - pausestart2::interval else pauseend2::interval - pausestart2::interval end else '00:00:00'::interval end as pdt2,
+ case when timestart2 is not null and timeend1 is not null and timestart1 is not null and timeend2 is not null then
+ timestart2::interval - timeend1::interval
+ else null end as interruption,
+ wdcontracthours
+ from demo2m17.staffreportperioddays where id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days'))
+ ) preds) ds where spds.id=ds.id;
+EXEC: update demo2m17.staffreportperioddays SET nighthours = null where id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days'));
+EXEC: update demo2m17.staffreportperioddays spds set
+ nighthours=nh from (
+ select id,daydate,timestart1,timeend1, timestart2,timeend2,
+ coalesce((case when timeend1 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend1::interval end) -
+ (case when timestart1 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart1::interval end),'00:00:00'::interval)
+ + coalesce((case when timeend2 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend2::interval end) -
+ (case when timestart2 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart2::interval end),'00:00:00'::interval) as nh
+ from demo2m17.staffreportperioddays s where
+ (timeend1 between '01:00:01' and '05:59:59' or timeend2 between '01:00:01' and '05:59:59'
+ or timestart1 between '01:00:01' and '05:59:59' or timestart2 between '01:00:01' and '05:59:59')
+ and id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days'))
+ ) ds
+ where spds.id=ds.id
+QUERY: select max(rowx) as statussuncount, sum(modx) as suppvacancysunwork from (
+ select daydate,rowx, case when mod(rowx,20) = 0 then 2 else null end as modx from (
+ select daydate,row_number() over (order by daydate) as rowx from demo2m17.staffreportperioddays
+ where daydate between date('2024-01-01') and date('2024-12-31')
+ and date_part('isodow',daydate)::int4 = 7 and workhours > '00:00:00'::time
+ and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by daydate
+ ) xsunday where daydate between date('2024-03-01') and date('2024-04-30')
+ ) sunresult;
+QUERY: select id_period, case when sum(plusdays) over (order by startdate) >= 6 then 6 else case when plusdays = 0 then null else plusdays end end as plusdays from (
+ select id_period,sum(week44s) as plusdays,startdate from (
+ select weekstart,case when (sum(sumx) over (order by weekstart)%8)::integer = 0 then 0 else 1 end as week44s,r.id as id_period,r.startdate,r.enddate from (
+ select weekstart,case when sum(cnt44) > 0 then 0 else 1 end as sumx,
+ max(daydate) as maxdate from (
+ SELECT date(date_trunc('week',yy.daydate)) as weekstart,daydate, dayhours,
+ (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2024-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) as xx,yy.timestart,yy.ntimeend,
+ case when (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2024-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) >= '44:00:00'::interval then 1 else 0 end as cnt44
+ FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
+ lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
+ xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend,xx_1.dayhours
+ FROM ( SELECT sr.id_staff, sr.daydate,sr.dayhours,
+ CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
+ CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and sr.daydate between date('2024-01-01') and date(date_trunc('week',date('2024-01-01') + interval '1 year') - interval '1 day')
+ and sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone
+ and (sr.timestart1 IS NOT null or sr.timestart2 IS NOT null)
+ ORDER BY sr.id_staff, sr.daydate) xx_1) yy order by yy.daydate,weekstart
+ ) aa group by aa.weekstart order by weekstart
+
+ ) bb
+ join demo2m17.reportperiod r on (bb.weekstart between r.startdate and r.enddate)
+ group by weekstart,r.id,bb.sumx order by weekstart
+
+ ) ff group by id_period,startdate) ss
+ where id_period='351cf732-61ee-8ad4-47fb-78b63159cacb'
+ group by id_period,startdate,ss.plusdays;
+QUERY: select weekstart,id_staff,avgtotalhours from (
+ select ws.weekstart, ws.id_staff,
+ AVG(ws.totalhours) over (order by ws.weekstart) as avgtotalhours
+ from (
+ SELECT weekstart, id_staff,
+sum(CASE WHEN srpd.dayhours IS NULL THEN '00:00:00'::interval ELSE srpd.dayhours::interval END) AS totalhours
+ FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
+ date(date_trunc('week', daydate) + interval '6 days') AS weekend,
+ date_part('week', daydate) AS calweek,
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days')
+ --where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-03-01') and date('2024-04-30')
+ ) srpd GROUP BY srpd.weekstart,srpd.id_staff
+ ORDER BY weekstart) ws) wsavg order by weekstart DESC LIMIT 1;
+EXEC: update demo2m17.staffreportperiod rpd set
+ --contracthours=csp.contracthours,
+ workhours=csp.workhours,
+ vacancyill=csp.vacillhours,
+ vacancynormal=csp.vacancynormal,
+ vacancyextra=csp.vacextrahours,
+ otherpaidhours=csp.otherpaidhours,
+ partunemplhours=csp.partunemplhours,
+ totalhours=csp.totalhours,
+ nighthours=csp.nighthours,
+ recuperationhours=csp.recuperationhours,statussuncount=9,suppvacancysunwork=null,suppvacancy44hours=6,status44hcount=null,last44date=null,avgtotalweekhours=null,hoursdiff=csp.diffhours
+ FROM (
+ select contracthours,workhours,totalhours,recuperationhours, totalhours-contracthours as diffhours,id,vacillhours,vacancynormal,vacextrahours,otherpaidhours,partunemplhours,nighthours from (
+ select dp.id,
+ sum(pd.workhours) as workhours,
+ sum(pd.dayhours) as totalhours,
+ sum(coalesce(pd.nighthours,'00:00:00'::interval)) as nighthours,
+ sum(coalesce(pd.vacancyhours,'00:00:00'::time)) as vacancynormal,
+ sum(coalesce(pd.vacillhours,'00:00:00'::time)) as vacillhours,
+ sum(coalesce(pd.vacextrahours,'00:00:00'::time)) as vacextrahours,
+ sum(coalesce(pd.otherpaidhours,'00:00:00'::time)) as otherpaidhours,
+ sum(coalesce(pd.partunemplhours,'00:00:00'::time)) as partunemplhours,
+ sum(coalesce(pd.recuperationhours,'00:00:00'::time)) as recuperationhours,
+ coalesce(dp.contracthours,'00:00:00'::interval) as contracthours,
+ coalesce(dp.payedhours0,'00:00:00'::interval) as payedhours0,
+ coalesce(dp.payedhours40,'00:00:00'::interval) as payedhours40,
+ coalesce(dp.transferedhours,'00:00:00'::interval) as transferedhours
+ from demo2m17.staffreportperioddays pd
+ join demo2m17.staffreportperiod dp on (pd.id_staff=dp.id_staff and dp.id_reportperiod = '351cf732-61ee-8ad4-47fb-78b63159cacb')
+ where pd.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and pd.daydate between date('2024-03-01') and date('2024-04-30')
+ group by dp.id,dp.payedhours,dp.transferedhourscalc
+ ) rp) csp where csp.id=rpd.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ --to_char(srp.vacancyhours, 'HH24:MI'::text) AS vacancyhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from demo2m17.reportperiod where id='351cf732-61ee-8ad4-47fb-78b63159cacb'
+QUERYBYKEY: select ws.weekstart,ws.weekend,ws.calweek,ws.calyear, ws.id_staff
+ ,to_char(ws.workhours::interval,'HH24:MI') as workhours
+ ,to_char(ws.vacancyhours,'HH24:MI') as vacancynormal
+ ,to_char(ws.vacillhours,'HH24:MI') as vacancyill
+ ,to_char(ws.vacextrahours,'HH24:MI') as vacancyextra
+ ,to_char(ws.vacschoolhours,'HH24:MI') as vacancyschool
+ ,to_char(ws.otherpaidhours,'HH24:MI') as otherpaidhours
+ ,to_char(ws.partunemplhours,'HH24:MI') as partunemplhours
+ ,to_char(ws.recuperationhours,'HH24:MI') as recuperationhours
+ ,to_char(ws.totalhours,'HH24:MI') as totalhours
+ ,cd.contractworkdays
+ ,cd.cmpcontractdays
+ ,cd.cmpweekhours
+ ,to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval),'HH24:MI') as weektrackedhours
+ ,ws.periodworkhours
+ ,interval_to_char(sum(coalesce(ttr.weektrackedhours,'00:00:00'::interval)) over (order by ws.weekstart) - sum(ws.periodworkhours::interval) over (order by ws.weekstart)) as periodtrackdiff
+ ,sum(ws.workhours::interval) over (order by ws.weekstart) as runningworkhours
+ ,interval_to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval) - ws.periodworkhours::interval) as trackeddiff
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else to_char(cd.contracthours,'HH24:MI') end as contracthours
+ ,to_char(AVG(ws.totalhours) over (order by ws.weekstart),'HH24:MI') as avgtotalhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then '00:00' else interval_to_char(ws.totalhours-cd.contracthours) end as diffhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then
+ to_char(case when cd.cmpweekhours < '40:00:00'::interval then cd.contracthours * 1.15 * cd.contractworkdays else (cd.contractworkdays*'08:00:00'::interval) + (cd.contractworkdays* case when maxdata.maxweekhours > '48:00:00' then '01:16:50'::interval else '00:50:00'::interval end) end,'HH24:MI')
+ else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours * 1.15 else maxdata.maxweekhours end,'HH24:MI')
+ end as maxweekhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours else maxdata.defaultweekhours end,'HH24:MI')
+ end as defaultweekhours
+ from (
+ SELECT weekstart,weekend,calweek,calyear, id_staff,
+ sum(CASE WHEN srpd.workhours IS NULL THEN '00:00:00'::interval ELSE srpd.workhours::interval END) AS workhours,
+ sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
+ --sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
+ sum(CASE WHEN srpd.vacancyhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacancyhours::interval END) AS vacancyhours,
+ sum(CASE WHEN srpd.vacillhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacillhours::interval END) AS vacillhours,
+ sum(CASE WHEN srpd.vacextrahours IS NULL THEN '00:00:00'::interval ELSE srpd.vacextrahours::interval END) AS vacextrahours,
+ sum(CASE WHEN srpd.vacschoolhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacschoolhours::interval END) AS vacschoolhours,
+ sum(CASE WHEN srpd.recuperationhours IS NULL THEN '00:00:00'::interval ELSE srpd.recuperationhours::interval END) AS recuperationhours,
+ sum(CASE WHEN srpd.otherpaidhours IS NULL THEN '00:00:00'::interval ELSE srpd.otherpaidhours::interval END) AS otherpaidhours,
+ sum(CASE WHEN srpd.partunemplhours IS NULL THEN '00:00:00'::interval ELSE srpd.partunemplhours::interval END) AS partunemplhours,
+ sum(CASE WHEN srpd.dayhours IS NULL THEN '00:00:00'::interval ELSE srpd.dayhours::interval END) AS totalhours,
+ sum(CASE WHEN srpd.workhours > '00:00:00'::time without time zone OR srpd.recuperationhours > '00:00:00'::time without time zone OR srpd.vacancyhours > '00:00:00'::time without time zone OR srpd.vacillhours > '00:00:00'::time without time zone OR srpd.vacextrahours > '00:00:00'::time without time zone OR srpd.vacschoolhours > '00:00:00'::time without time zone OR srpd.otherpaidhours > '00:00:00'::time without time zone or srpd.partunemplhours > '00:00:00'::time without time zone THEN 1 ELSE 0 END) AS workdays,
+ sum( CASE WHEN srpd.contracthours IS NULL THEN '00:00:00'::interval ELSE srpd.contracthours::interval END) AS contracthours
+ FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
+ date(date_trunc('week', daydate) + interval '6 days') AS weekend,
+ date_part('week', daydate) AS calweek,
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-02-26') and date('2024-05-05')
+ ) srpd GROUP BY srpd.weekstart,srpd.weekend,srpd.calweek,srpd.calyear,srpd.id_staff
+ ORDER BY weekstart) ws left join (
+ select date(date_trunc('week',pd.daydate)) as weekstart,pd.id_staff,max(sc.weekdays) as cmpcontractdays,max(sc.weekhours) as cmpweekhours,
+ case when count(pd.daydate) < avg(sc.weekdays) then count(pd.daydate) else avg(sc.weekdays) end as contractworkdays,
+ case when count(pd.daydate) < avg(sc.weekdays) then avg(sc.weekhours/ sc.weekdays) * count(pd.daydate) else avg(sc.weekhours/ sc.weekdays) * avg(sc.weekdays) end as contracthours ,sum(case when coalesce(pd.workhours,'00:00:00'::time) > '00:00:00'::time then 1 else 0 end) as realworkdays
+ from ( select id_staff,weekdays ,weekhours,
+ case when startdate> date('2024-02-26') then startdate else date('2024-02-26') end as staffperiodstart,
+ case when enddate is null or enddate > date('2024-05-05') then date('2024-05-05')
+ else enddate end as staffperiodend from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ and startdate < date('2024-05-05')
+ ) sc
+ join demo2m17.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
+ group by date(date_trunc('week',pd.daydate)),pd.id_staff
+ ) cd on ws.id_staff = cd.id_staff and ws.weekstart=cd.weekstart
+ left join (
+ select id_staff,weekstart,max(defaultweekhours) as defaultweekhours,avg(maxweekhours) as maxweekhours from (
+ select lpd.id_staff,date(date_trunc('week',lpd.daydate)) as weekstart,lpd.daydate,
+ case when wk.defaultweekhours is null then wkdef.defaultweekhours else wk.defaultweekhours end as defaultweekhours ,
+ case when wk.maxweekhours is null then wkdef.maxweekhours else wk.maxweekhours end as maxweekhours
+ from demo2m17.staffreportperioddays lpd
+ left join demo2m17.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
+ cross join (select * from demo2m17.worktimes where isdefault=true) wkdef
+ where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and lpd.daydate between date('2024-02-26') and date('2024-05-05')
+ order by lpd.daydate ) mh group by id_staff,weekstart
+ ) maxdata on ws.id_staff = maxdata.id_staff and ws.weekstart=maxdata.weekstart
+ left join (
+ select weekstart,id_staff,coalesce(sum(daytracked),'00:00:00'::interval) as weektrackedhours from (
+ select daydate,id_staff,weekstart,case when sum(trackedhours) > '06:00:00'::interval then sum(trackedhours)- '00:30:00'::interval else coalesce(sum(trackedhours),'00:00:00'::interval) end as daytracked from (
+select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from demo2m17.timetracker
+where daydate between date('2024-03-01') and date('2024-04-30') and id_staff ='d8e44d1a-359c-055b-72dc-343c57fdfb76') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
+ ) ttr on ws.weekstart=ttr.weekstart and ws.id_staff=ttr.id_staff;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT pd.id,pd.id_staff,pd.id_reportperiod,pd.daydate,pd.payedpause,pd.daytype,pd.daycomment,
+ vacancycomment,vacillcomment,vacextracomment,recupcomment,otherpaidhourscomment,partunempcomment,
+ pd.daytemplate,pd.vacschoolcomment,rp.viewpartunempl,rp.viewvacschool,
+ date(date_trunc('week',pd.daydate)) as weekstart,
+ to_char(pd.timestart1::interval, 'HH24:MI') AS timestart1,
+ to_char(pd.timeend1::interval, 'HH24:MI') AS timeend1,
+ to_char(pd.timestart2::interval, 'HH24:MI') AS timestart2,
+ to_char(pd.timeend2::interval, 'HH24:MI') AS timeend2,
+ to_char(pd.timepause::interval, 'HH24:MI') AS timepause,
+ -- coalesce('<div class="dspvacancynormal">' || to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN null ELSE pd.vacancyhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyill">' || to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN null else pd.vacillhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyextra">' || to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN null ELSE pd.vacextrahours END::interval, 'HH24:MI') || '</div>','') AS dspvacancyhours,
+ to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacancyhours END::interval, 'HH24:MI') AS vacancyhours,
+ to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacillhours END::interval, 'HH24:MI') AS vacillhours,
+ to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacextrahours END::interval, 'HH24:MI') AS vacextrahours,
+ to_char(CASE WHEN pd.vacschoolhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacschoolhours END::interval, 'HH24:MI') AS vacschoolhours,
+ to_char(CASE WHEN pd.otherpaidhours::interval = '00:00:00'::interval THEN NULL ELSE pd.otherpaidhours END::interval, 'HH24:MI') AS otherpaidhours,
+ to_char(CASE WHEN pd.partunemplhours::interval = '00:00:00'::interval THEN NULL ELSE pd.partunemplhours END::interval, 'HH24:MI') AS partunemplhours,
+ to_char(pd.contracthours::interval, 'HH24:MI') AS contracthours,
+ to_char(CASE WHEN pd.workhours::interval = '00:00:00'::interval THEN NULL ELSE pd.workhours END::interval, 'HH24:MI') AS workhours,
+ to_char(CASE WHEN pd.dayhours::interval = '00:00:00'::interval THEN NULL ELSE pd.dayhours END::interval, 'HH24:MI') AS dayhours,
+ to_char(case WHEN pd.recuperationhours::interval = '00:00:00'::interval THEN NULL ELSE pd.recuperationhours END::interval, 'HH24:MI') AS recuperationhours,
+ to_char(CASE WHEN pd.interruptionhours::interval = '00:00:00'::interval THEN NULL ELSE pd.interruptionhours END::interval, 'HH24:MI') AS interruptionhours,
+ to_char(CASE WHEN pd.nighthours::interval = '00:00:00'::interval THEN NULL ELSE pd.nighthours END::interval, 'HH24:MI') AS nighthours,
+ to_char(pd.pausestart1::interval, 'HH24:MI') AS pausestart1,
+ to_char(pd.pauseend1::interval, 'HH24:MI') AS pauseend1,
+ to_char(pd.pausestart2::interval, 'HH24:MI') AS pausestart2,
+ to_char(pd.pauseend2::interval, 'HH24:MI') AS pauseend2,
+ COALESCE((to_char(pd.pausestart1::interval, 'HH24:MI') || '-') || to_char(pd.pauseend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.pausestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.pausestart2::interval, 'HH24:MI')) || '-') || to_char(pd.pauseend2::interval, 'HH24:MI'), '') AS dsppausedata,
+ COALESCE((to_char(pd.timestart1::interval, 'HH24:MI') || '-') || to_char(pd.timeend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.timestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.timestart2::interval, 'HH24:MI')) || '-') || to_char(pd.timeend2::interval, 'HH24:MI'), '') AS dspworkdata,
+ CASE WHEN max(freehours.freehours) < '00:00:00'::interval THEN NULL ELSE to_char(max(freehours.freehours), 'HH24:MI') END AS freehoursafter,
+ to_char(coalesce(max(wk.defaultdayhours),max(wkstd.defaultdayhours)),'HH24:MI') as defaultdayhours,
+ to_char(coalesce(max(wk.maxdayhours),max(wkstd.maxdayhours)),'HH24:MI') as maxdayhours,
+ to_char(coalesce(max(wk.mindailyrecuperation),max(wkstd.mindailyrecuperation)),'HH24:MI') as mindailyrecuperation,
+ to_char(coalesce(max(wk.maxinterruptionhours),max(wkstd.maxinterruptionhours)),'HH24:MI') as maxinterruptionhours,
+ max(vd.vacancyname) as vacancyname,
+ to_char(max(tt.trackedtime),'HH24:MI') as trackedtime,
+ max(case when tt.trackedtime is null or pd.workhours is null then null else interval_to_char(coalesce(tt.trackedtime::interval,'00:00:00'::interval) - coalesce(pd.workhours::interval,'00:00:00'::interval)) end) as trackeddiff,
+ null as incompletetrack
+ FROM demo2m17.staffreportperioddays pd
+ JOIN demo2m17.staff st ON pd.id_staff = st.id and st.id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and st.isdeleted is null
+ LEFT JOIN ( SELECT yy.id_staff, yy.ndaydate AS daydate,case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend AS tmfrom, yy.daydate + yy.timestart AS tmto,
+ yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend) AS realinterval,
+ date_part('epoch', yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend)) * '00:00:01'::interval AS freehours
+ FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
+ lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
+ xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend
+ FROM ( SELECT sr.id_staff, sr.daydate,
+ CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
+ CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY sr.id_staff, sr.daydate) xx_1) yy) freehours ON pd.id_staff = freehours.id_staff AND freehours.daydate = pd.daydate
+ left join demo2m17.worktimes wk on pd.daydate between wk.startdate and wk.enddate
+ cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from demo2m17.worktimes where isdefault =true) wkstd
+ left join demo2m17.vacancydays vd on pd.daydate=vd.daydate
+ left join demo2m17.reportperiod rp on (pd.id_reportperiod=rp.id)
+ left join (
+ select
+ sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as sumdayall,
+ string_agg(minpauseok::text,'') as minpauses, null as incompletetrack,
+ case when sum(minpauseok) = 0 and sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) >= '06:00:00'::interval then sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) - '00:30:00'::interval else sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) end as trackedtime,daydate from
+ ( select *, tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) as pauseduration,
+ to_char(lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in),'HH24:MI') || '-' || to_char(tx.stamp_in,'HH24:MI') as pausetime,
+ case when tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker tx where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and tx.daydate between date('2024-02-26') and date('2024-05-05')
+ order by tx.stamp_in) tt
+ group by tt.daydate
+ ) tt on pd.daydate=tt.daydate
+ WHERE pd.daydate between date('2024-02-26') and date('2024-05-05')
+ group by pd.id,rp.viewpartunempl,rp.viewvacschool
+ ORDER BY pd.id_staff, pd.daydate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ --to_char(srp.vacancyhours, 'HH24:MI'::text) AS vacancyhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select * from demo2m17.staff where id='349a79cc-8e6e-0809-a53f-7524d0b97754' and isdeleted is null;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ --to_char(srp.vacancyhours, 'HH24:MI'::text) AS vacancyhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = '349a79cc-8e6e-0809-a53f-7524d0b97754'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select * from demo2m17.staff where id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and isdeleted is null;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ --to_char(srp.vacancyhours, 'HH24:MI'::text) AS vacancyhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select * from demo2m17.staff where id='349a79cc-8e6e-0809-a53f-7524d0b97754' and isdeleted is null;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ --to_char(srp.vacancyhours, 'HH24:MI'::text) AS vacancyhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from demo2m17.reportperiod where id='4fa00f63-1b1e-0d91-333e-bc316e53ae78'
+QUERYBYKEY: select ws.weekstart,ws.weekend,ws.calweek,ws.calyear, ws.id_staff
+ ,to_char(ws.workhours::interval,'HH24:MI') as workhours
+ ,to_char(ws.vacancyhours,'HH24:MI') as vacancynormal
+ ,to_char(ws.vacillhours,'HH24:MI') as vacancyill
+ ,to_char(ws.vacextrahours,'HH24:MI') as vacancyextra
+ ,to_char(ws.vacschoolhours,'HH24:MI') as vacancyschool
+ ,to_char(ws.otherpaidhours,'HH24:MI') as otherpaidhours
+ ,to_char(ws.partunemplhours,'HH24:MI') as partunemplhours
+ ,to_char(ws.recuperationhours,'HH24:MI') as recuperationhours
+ ,to_char(ws.totalhours,'HH24:MI') as totalhours
+ ,cd.contractworkdays
+ ,cd.cmpcontractdays
+ ,cd.cmpweekhours
+ ,to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval),'HH24:MI') as weektrackedhours
+ ,ws.periodworkhours
+ ,interval_to_char(sum(coalesce(ttr.weektrackedhours,'00:00:00'::interval)) over (order by ws.weekstart) - sum(ws.periodworkhours::interval) over (order by ws.weekstart)) as periodtrackdiff
+ ,sum(ws.workhours::interval) over (order by ws.weekstart) as runningworkhours
+ ,interval_to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval) - ws.periodworkhours::interval) as trackeddiff
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else to_char(cd.contracthours,'HH24:MI') end as contracthours
+ ,to_char(AVG(ws.totalhours) over (order by ws.weekstart),'HH24:MI') as avgtotalhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then '00:00' else interval_to_char(ws.totalhours-cd.contracthours) end as diffhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then
+ to_char(case when cd.cmpweekhours < '40:00:00'::interval then cd.contracthours * 1.15 * cd.contractworkdays else (cd.contractworkdays*'08:00:00'::interval) + (cd.contractworkdays* case when maxdata.maxweekhours > '48:00:00' then '01:16:50'::interval else '00:50:00'::interval end) end,'HH24:MI')
+ else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours * 1.15 else maxdata.maxweekhours end,'HH24:MI')
+ end as maxweekhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours else maxdata.defaultweekhours end,'HH24:MI')
+ end as defaultweekhours
+ from (
+ SELECT weekstart,weekend,calweek,calyear, id_staff,
+ sum(CASE WHEN srpd.workhours IS NULL THEN '00:00:00'::interval ELSE srpd.workhours::interval END) AS workhours,
+ sum(case when srpd.daydate between date('2023-01-01') and date('2023-02-28') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
+ --sum(case when srpd.daydate between date('2023-01-01') and date('2023-02-28') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
+ sum(CASE WHEN srpd.vacancyhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacancyhours::interval END) AS vacancyhours,
+ sum(CASE WHEN srpd.vacillhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacillhours::interval END) AS vacillhours,
+ sum(CASE WHEN srpd.vacextrahours IS NULL THEN '00:00:00'::interval ELSE srpd.vacextrahours::interval END) AS vacextrahours,
+ sum(CASE WHEN srpd.vacschoolhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacschoolhours::interval END) AS vacschoolhours,
+ sum(CASE WHEN srpd.recuperationhours IS NULL THEN '00:00:00'::interval ELSE srpd.recuperationhours::interval END) AS recuperationhours,
+ sum(CASE WHEN srpd.otherpaidhours IS NULL THEN '00:00:00'::interval ELSE srpd.otherpaidhours::interval END) AS otherpaidhours,
+ sum(CASE WHEN srpd.partunemplhours IS NULL THEN '00:00:00'::interval ELSE srpd.partunemplhours::interval END) AS partunemplhours,
+ sum(CASE WHEN srpd.dayhours IS NULL THEN '00:00:00'::interval ELSE srpd.dayhours::interval END) AS totalhours,
+ sum(CASE WHEN srpd.workhours > '00:00:00'::time without time zone OR srpd.recuperationhours > '00:00:00'::time without time zone OR srpd.vacancyhours > '00:00:00'::time without time zone OR srpd.vacillhours > '00:00:00'::time without time zone OR srpd.vacextrahours > '00:00:00'::time without time zone OR srpd.vacschoolhours > '00:00:00'::time without time zone OR srpd.otherpaidhours > '00:00:00'::time without time zone or srpd.partunemplhours > '00:00:00'::time without time zone THEN 1 ELSE 0 END) AS workdays,
+ sum( CASE WHEN srpd.contracthours IS NULL THEN '00:00:00'::interval ELSE srpd.contracthours::interval END) AS contracthours
+ FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
+ date(date_trunc('week', daydate) + interval '6 days') AS weekend,
+ date_part('week', daydate) AS calweek,
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2022-12-26') and date('2023-03-05')
+ ) srpd GROUP BY srpd.weekstart,srpd.weekend,srpd.calweek,srpd.calyear,srpd.id_staff
+ ORDER BY weekstart) ws left join (
+ select date(date_trunc('week',pd.daydate)) as weekstart,pd.id_staff,max(sc.weekdays) as cmpcontractdays,max(sc.weekhours) as cmpweekhours,
+ case when count(pd.daydate) < avg(sc.weekdays) then count(pd.daydate) else avg(sc.weekdays) end as contractworkdays,
+ case when count(pd.daydate) < avg(sc.weekdays) then avg(sc.weekhours/ sc.weekdays) * count(pd.daydate) else avg(sc.weekhours/ sc.weekdays) * avg(sc.weekdays) end as contracthours ,sum(case when coalesce(pd.workhours,'00:00:00'::time) > '00:00:00'::time then 1 else 0 end) as realworkdays
+ from ( select id_staff,weekdays ,weekhours,
+ case when startdate> date('2022-12-26') then startdate else date('2022-12-26') end as staffperiodstart,
+ case when enddate is null or enddate > date('2023-03-05') then date('2023-03-05')
+ else enddate end as staffperiodend from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ and startdate < date('2023-03-05')
+ ) sc
+ join demo2m17.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
+ group by date(date_trunc('week',pd.daydate)),pd.id_staff
+ ) cd on ws.id_staff = cd.id_staff and ws.weekstart=cd.weekstart
+ left join (
+ select id_staff,weekstart,max(defaultweekhours) as defaultweekhours,avg(maxweekhours) as maxweekhours from (
+ select lpd.id_staff,date(date_trunc('week',lpd.daydate)) as weekstart,lpd.daydate,
+ case when wk.defaultweekhours is null then wkdef.defaultweekhours else wk.defaultweekhours end as defaultweekhours ,
+ case when wk.maxweekhours is null then wkdef.maxweekhours else wk.maxweekhours end as maxweekhours
+ from demo2m17.staffreportperioddays lpd
+ left join demo2m17.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
+ cross join (select * from demo2m17.worktimes where isdefault=true) wkdef
+ where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and lpd.daydate between date('2022-12-26') and date('2023-03-05')
+ order by lpd.daydate ) mh group by id_staff,weekstart
+ ) maxdata on ws.id_staff = maxdata.id_staff and ws.weekstart=maxdata.weekstart
+ left join (
+ select weekstart,id_staff,coalesce(sum(daytracked),'00:00:00'::interval) as weektrackedhours from (
+ select daydate,id_staff,weekstart,case when sum(trackedhours) > '06:00:00'::interval then sum(trackedhours)- '00:30:00'::interval else coalesce(sum(trackedhours),'00:00:00'::interval) end as daytracked from (
+select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from demo2m17.timetracker
+where daydate between date('2023-01-01') and date('2023-02-28') and id_staff ='d8e44d1a-359c-055b-72dc-343c57fdfb76') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
+ ) ttr on ws.weekstart=ttr.weekstart and ws.id_staff=ttr.id_staff;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select * from demo2m17.staff where id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and isdeleted is null;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT pd.id,pd.id_staff,pd.id_reportperiod,pd.daydate,pd.payedpause,pd.daytype,pd.daycomment,
+ vacancycomment,vacillcomment,vacextracomment,recupcomment,otherpaidhourscomment,partunempcomment,
+ pd.daytemplate,pd.vacschoolcomment,rp.viewpartunempl,rp.viewvacschool,
+ date(date_trunc('week',pd.daydate)) as weekstart,
+ to_char(pd.timestart1::interval, 'HH24:MI') AS timestart1,
+ to_char(pd.timeend1::interval, 'HH24:MI') AS timeend1,
+ to_char(pd.timestart2::interval, 'HH24:MI') AS timestart2,
+ to_char(pd.timeend2::interval, 'HH24:MI') AS timeend2,
+ to_char(pd.timepause::interval, 'HH24:MI') AS timepause,
+ -- coalesce('<div class="dspvacancynormal">' || to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN null ELSE pd.vacancyhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyill">' || to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN null else pd.vacillhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyextra">' || to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN null ELSE pd.vacextrahours END::interval, 'HH24:MI') || '</div>','') AS dspvacancyhours,
+ to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacancyhours END::interval, 'HH24:MI') AS vacancyhours,
+ to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacillhours END::interval, 'HH24:MI') AS vacillhours,
+ to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacextrahours END::interval, 'HH24:MI') AS vacextrahours,
+ to_char(CASE WHEN pd.vacschoolhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacschoolhours END::interval, 'HH24:MI') AS vacschoolhours,
+ to_char(CASE WHEN pd.otherpaidhours::interval = '00:00:00'::interval THEN NULL ELSE pd.otherpaidhours END::interval, 'HH24:MI') AS otherpaidhours,
+ to_char(CASE WHEN pd.partunemplhours::interval = '00:00:00'::interval THEN NULL ELSE pd.partunemplhours END::interval, 'HH24:MI') AS partunemplhours,
+ to_char(pd.contracthours::interval, 'HH24:MI') AS contracthours,
+ to_char(CASE WHEN pd.workhours::interval = '00:00:00'::interval THEN NULL ELSE pd.workhours END::interval, 'HH24:MI') AS workhours,
+ to_char(CASE WHEN pd.dayhours::interval = '00:00:00'::interval THEN NULL ELSE pd.dayhours END::interval, 'HH24:MI') AS dayhours,
+ to_char(case WHEN pd.recuperationhours::interval = '00:00:00'::interval THEN NULL ELSE pd.recuperationhours END::interval, 'HH24:MI') AS recuperationhours,
+ to_char(CASE WHEN pd.interruptionhours::interval = '00:00:00'::interval THEN NULL ELSE pd.interruptionhours END::interval, 'HH24:MI') AS interruptionhours,
+ to_char(CASE WHEN pd.nighthours::interval = '00:00:00'::interval THEN NULL ELSE pd.nighthours END::interval, 'HH24:MI') AS nighthours,
+ to_char(pd.pausestart1::interval, 'HH24:MI') AS pausestart1,
+ to_char(pd.pauseend1::interval, 'HH24:MI') AS pauseend1,
+ to_char(pd.pausestart2::interval, 'HH24:MI') AS pausestart2,
+ to_char(pd.pauseend2::interval, 'HH24:MI') AS pauseend2,
+ COALESCE((to_char(pd.pausestart1::interval, 'HH24:MI') || '-') || to_char(pd.pauseend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.pausestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.pausestart2::interval, 'HH24:MI')) || '-') || to_char(pd.pauseend2::interval, 'HH24:MI'), '') AS dsppausedata,
+ COALESCE((to_char(pd.timestart1::interval, 'HH24:MI') || '-') || to_char(pd.timeend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.timestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.timestart2::interval, 'HH24:MI')) || '-') || to_char(pd.timeend2::interval, 'HH24:MI'), '') AS dspworkdata,
+ CASE WHEN max(freehours.freehours) < '00:00:00'::interval THEN NULL ELSE to_char(max(freehours.freehours), 'HH24:MI') END AS freehoursafter,
+ to_char(coalesce(max(wk.defaultdayhours),max(wkstd.defaultdayhours)),'HH24:MI') as defaultdayhours,
+ to_char(coalesce(max(wk.maxdayhours),max(wkstd.maxdayhours)),'HH24:MI') as maxdayhours,
+ to_char(coalesce(max(wk.mindailyrecuperation),max(wkstd.mindailyrecuperation)),'HH24:MI') as mindailyrecuperation,
+ to_char(coalesce(max(wk.maxinterruptionhours),max(wkstd.maxinterruptionhours)),'HH24:MI') as maxinterruptionhours,
+ max(vd.vacancyname) as vacancyname,
+ to_char(max(tt.trackedtime),'HH24:MI') as trackedtime,
+ max(case when tt.trackedtime is null or pd.workhours is null then null else interval_to_char(coalesce(tt.trackedtime::interval,'00:00:00'::interval) - coalesce(pd.workhours::interval,'00:00:00'::interval)) end) as trackeddiff,
+ null as incompletetrack
+ FROM demo2m17.staffreportperioddays pd
+ JOIN demo2m17.staff st ON pd.id_staff = st.id and st.id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and st.isdeleted is null
+ LEFT JOIN ( SELECT yy.id_staff, yy.ndaydate AS daydate,case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend AS tmfrom, yy.daydate + yy.timestart AS tmto,
+ yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend) AS realinterval,
+ date_part('epoch', yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend)) * '00:00:01'::interval AS freehours
+ FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
+ lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
+ xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend
+ FROM ( SELECT sr.id_staff, sr.daydate,
+ CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
+ CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY sr.id_staff, sr.daydate) xx_1) yy) freehours ON pd.id_staff = freehours.id_staff AND freehours.daydate = pd.daydate
+ left join demo2m17.worktimes wk on pd.daydate between wk.startdate and wk.enddate
+ cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from demo2m17.worktimes where isdefault =true) wkstd
+ left join demo2m17.vacancydays vd on pd.daydate=vd.daydate
+ left join demo2m17.reportperiod rp on (pd.id_reportperiod=rp.id)
+ left join (
+ select
+ sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as sumdayall,
+ string_agg(minpauseok::text,'') as minpauses, null as incompletetrack,
+ case when sum(minpauseok) = 0 and sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) >= '06:00:00'::interval then sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) - '00:30:00'::interval else sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) end as trackedtime,daydate from
+ ( select *, tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) as pauseduration,
+ to_char(lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in),'HH24:MI') || '-' || to_char(tx.stamp_in,'HH24:MI') as pausetime,
+ case when tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker tx where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and tx.daydate between date('2022-12-26') and date('2023-03-05')
+ order by tx.stamp_in) tt
+ group by tt.daydate
+ ) tt on pd.daydate=tt.daydate
+ WHERE pd.daydate between date('2022-12-26') and date('2023-03-05')
+ group by pd.id,rp.viewpartunempl,rp.viewvacschool
+ ORDER BY pd.id_staff, pd.daydate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ --to_char(srp.vacancyhours, 'HH24:MI'::text) AS vacancyhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from demo2m17.reportperiod where id='9ad3b315-fb23-93ea-6aeb-7b1b72675c43'
+QUERYBYKEY: select ws.weekstart,ws.weekend,ws.calweek,ws.calyear, ws.id_staff
+ ,to_char(ws.workhours::interval,'HH24:MI') as workhours
+ ,to_char(ws.vacancyhours,'HH24:MI') as vacancynormal
+ ,to_char(ws.vacillhours,'HH24:MI') as vacancyill
+ ,to_char(ws.vacextrahours,'HH24:MI') as vacancyextra
+ ,to_char(ws.vacschoolhours,'HH24:MI') as vacancyschool
+ ,to_char(ws.otherpaidhours,'HH24:MI') as otherpaidhours
+ ,to_char(ws.partunemplhours,'HH24:MI') as partunemplhours
+ ,to_char(ws.recuperationhours,'HH24:MI') as recuperationhours
+ ,to_char(ws.totalhours,'HH24:MI') as totalhours
+ ,cd.contractworkdays
+ ,cd.cmpcontractdays
+ ,cd.cmpweekhours
+ ,to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval),'HH24:MI') as weektrackedhours
+ ,ws.periodworkhours
+ ,interval_to_char(sum(coalesce(ttr.weektrackedhours,'00:00:00'::interval)) over (order by ws.weekstart) - sum(ws.periodworkhours::interval) over (order by ws.weekstart)) as periodtrackdiff
+ ,sum(ws.workhours::interval) over (order by ws.weekstart) as runningworkhours
+ ,interval_to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval) - ws.periodworkhours::interval) as trackeddiff
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else to_char(cd.contracthours,'HH24:MI') end as contracthours
+ ,to_char(AVG(ws.totalhours) over (order by ws.weekstart),'HH24:MI') as avgtotalhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then '00:00' else interval_to_char(ws.totalhours-cd.contracthours) end as diffhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then
+ to_char(case when cd.cmpweekhours < '40:00:00'::interval then cd.contracthours * 1.15 * cd.contractworkdays else (cd.contractworkdays*'08:00:00'::interval) + (cd.contractworkdays* case when maxdata.maxweekhours > '48:00:00' then '01:16:50'::interval else '00:50:00'::interval end) end,'HH24:MI')
+ else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours * 1.15 else maxdata.maxweekhours end,'HH24:MI')
+ end as maxweekhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours else maxdata.defaultweekhours end,'HH24:MI')
+ end as defaultweekhours
+ from (
+ SELECT weekstart,weekend,calweek,calyear, id_staff,
+ sum(CASE WHEN srpd.workhours IS NULL THEN '00:00:00'::interval ELSE srpd.workhours::interval END) AS workhours,
+ sum(case when srpd.daydate between date('2023-09-01') and date('2023-10-31') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
+ --sum(case when srpd.daydate between date('2023-09-01') and date('2023-10-31') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
+ sum(CASE WHEN srpd.vacancyhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacancyhours::interval END) AS vacancyhours,
+ sum(CASE WHEN srpd.vacillhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacillhours::interval END) AS vacillhours,
+ sum(CASE WHEN srpd.vacextrahours IS NULL THEN '00:00:00'::interval ELSE srpd.vacextrahours::interval END) AS vacextrahours,
+ sum(CASE WHEN srpd.vacschoolhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacschoolhours::interval END) AS vacschoolhours,
+ sum(CASE WHEN srpd.recuperationhours IS NULL THEN '00:00:00'::interval ELSE srpd.recuperationhours::interval END) AS recuperationhours,
+ sum(CASE WHEN srpd.otherpaidhours IS NULL THEN '00:00:00'::interval ELSE srpd.otherpaidhours::interval END) AS otherpaidhours,
+ sum(CASE WHEN srpd.partunemplhours IS NULL THEN '00:00:00'::interval ELSE srpd.partunemplhours::interval END) AS partunemplhours,
+ sum(CASE WHEN srpd.dayhours IS NULL THEN '00:00:00'::interval ELSE srpd.dayhours::interval END) AS totalhours,
+ sum(CASE WHEN srpd.workhours > '00:00:00'::time without time zone OR srpd.recuperationhours > '00:00:00'::time without time zone OR srpd.vacancyhours > '00:00:00'::time without time zone OR srpd.vacillhours > '00:00:00'::time without time zone OR srpd.vacextrahours > '00:00:00'::time without time zone OR srpd.vacschoolhours > '00:00:00'::time without time zone OR srpd.otherpaidhours > '00:00:00'::time without time zone or srpd.partunemplhours > '00:00:00'::time without time zone THEN 1 ELSE 0 END) AS workdays,
+ sum( CASE WHEN srpd.contracthours IS NULL THEN '00:00:00'::interval ELSE srpd.contracthours::interval END) AS contracthours
+ FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
+ date(date_trunc('week', daydate) + interval '6 days') AS weekend,
+ date_part('week', daydate) AS calweek,
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2023-08-28') and date('2023-11-05')
+ ) srpd GROUP BY srpd.weekstart,srpd.weekend,srpd.calweek,srpd.calyear,srpd.id_staff
+ ORDER BY weekstart) ws left join (
+ select date(date_trunc('week',pd.daydate)) as weekstart,pd.id_staff,max(sc.weekdays) as cmpcontractdays,max(sc.weekhours) as cmpweekhours,
+ case when count(pd.daydate) < avg(sc.weekdays) then count(pd.daydate) else avg(sc.weekdays) end as contractworkdays,
+ case when count(pd.daydate) < avg(sc.weekdays) then avg(sc.weekhours/ sc.weekdays) * count(pd.daydate) else avg(sc.weekhours/ sc.weekdays) * avg(sc.weekdays) end as contracthours ,sum(case when coalesce(pd.workhours,'00:00:00'::time) > '00:00:00'::time then 1 else 0 end) as realworkdays
+ from ( select id_staff,weekdays ,weekhours,
+ case when startdate> date('2023-08-28') then startdate else date('2023-08-28') end as staffperiodstart,
+ case when enddate is null or enddate > date('2023-11-05') then date('2023-11-05')
+ else enddate end as staffperiodend from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ and startdate < date('2023-11-05')
+ ) sc
+ join demo2m17.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
+ group by date(date_trunc('week',pd.daydate)),pd.id_staff
+ ) cd on ws.id_staff = cd.id_staff and ws.weekstart=cd.weekstart
+ left join (
+ select id_staff,weekstart,max(defaultweekhours) as defaultweekhours,avg(maxweekhours) as maxweekhours from (
+ select lpd.id_staff,date(date_trunc('week',lpd.daydate)) as weekstart,lpd.daydate,
+ case when wk.defaultweekhours is null then wkdef.defaultweekhours else wk.defaultweekhours end as defaultweekhours ,
+ case when wk.maxweekhours is null then wkdef.maxweekhours else wk.maxweekhours end as maxweekhours
+ from demo2m17.staffreportperioddays lpd
+ left join demo2m17.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
+ cross join (select * from demo2m17.worktimes where isdefault=true) wkdef
+ where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and lpd.daydate between date('2023-08-28') and date('2023-11-05')
+ order by lpd.daydate ) mh group by id_staff,weekstart
+ ) maxdata on ws.id_staff = maxdata.id_staff and ws.weekstart=maxdata.weekstart
+ left join (
+ select weekstart,id_staff,coalesce(sum(daytracked),'00:00:00'::interval) as weektrackedhours from (
+ select daydate,id_staff,weekstart,case when sum(trackedhours) > '06:00:00'::interval then sum(trackedhours)- '00:30:00'::interval else coalesce(sum(trackedhours),'00:00:00'::interval) end as daytracked from (
+select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from demo2m17.timetracker
+where daydate between date('2023-09-01') and date('2023-10-31') and id_staff ='d8e44d1a-359c-055b-72dc-343c57fdfb76') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
+ ) ttr on ws.weekstart=ttr.weekstart and ws.id_staff=ttr.id_staff;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT pd.id,pd.id_staff,pd.id_reportperiod,pd.daydate,pd.payedpause,pd.daytype,pd.daycomment,
+ vacancycomment,vacillcomment,vacextracomment,recupcomment,otherpaidhourscomment,partunempcomment,
+ pd.daytemplate,pd.vacschoolcomment,rp.viewpartunempl,rp.viewvacschool,
+ date(date_trunc('week',pd.daydate)) as weekstart,
+ to_char(pd.timestart1::interval, 'HH24:MI') AS timestart1,
+ to_char(pd.timeend1::interval, 'HH24:MI') AS timeend1,
+ to_char(pd.timestart2::interval, 'HH24:MI') AS timestart2,
+ to_char(pd.timeend2::interval, 'HH24:MI') AS timeend2,
+ to_char(pd.timepause::interval, 'HH24:MI') AS timepause,
+ -- coalesce('<div class="dspvacancynormal">' || to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN null ELSE pd.vacancyhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyill">' || to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN null else pd.vacillhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyextra">' || to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN null ELSE pd.vacextrahours END::interval, 'HH24:MI') || '</div>','') AS dspvacancyhours,
+ to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacancyhours END::interval, 'HH24:MI') AS vacancyhours,
+ to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacillhours END::interval, 'HH24:MI') AS vacillhours,
+ to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacextrahours END::interval, 'HH24:MI') AS vacextrahours,
+ to_char(CASE WHEN pd.vacschoolhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacschoolhours END::interval, 'HH24:MI') AS vacschoolhours,
+ to_char(CASE WHEN pd.otherpaidhours::interval = '00:00:00'::interval THEN NULL ELSE pd.otherpaidhours END::interval, 'HH24:MI') AS otherpaidhours,
+ to_char(CASE WHEN pd.partunemplhours::interval = '00:00:00'::interval THEN NULL ELSE pd.partunemplhours END::interval, 'HH24:MI') AS partunemplhours,
+ to_char(pd.contracthours::interval, 'HH24:MI') AS contracthours,
+ to_char(CASE WHEN pd.workhours::interval = '00:00:00'::interval THEN NULL ELSE pd.workhours END::interval, 'HH24:MI') AS workhours,
+ to_char(CASE WHEN pd.dayhours::interval = '00:00:00'::interval THEN NULL ELSE pd.dayhours END::interval, 'HH24:MI') AS dayhours,
+ to_char(case WHEN pd.recuperationhours::interval = '00:00:00'::interval THEN NULL ELSE pd.recuperationhours END::interval, 'HH24:MI') AS recuperationhours,
+ to_char(CASE WHEN pd.interruptionhours::interval = '00:00:00'::interval THEN NULL ELSE pd.interruptionhours END::interval, 'HH24:MI') AS interruptionhours,
+ to_char(CASE WHEN pd.nighthours::interval = '00:00:00'::interval THEN NULL ELSE pd.nighthours END::interval, 'HH24:MI') AS nighthours,
+ to_char(pd.pausestart1::interval, 'HH24:MI') AS pausestart1,
+ to_char(pd.pauseend1::interval, 'HH24:MI') AS pauseend1,
+ to_char(pd.pausestart2::interval, 'HH24:MI') AS pausestart2,
+ to_char(pd.pauseend2::interval, 'HH24:MI') AS pauseend2,
+ COALESCE((to_char(pd.pausestart1::interval, 'HH24:MI') || '-') || to_char(pd.pauseend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.pausestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.pausestart2::interval, 'HH24:MI')) || '-') || to_char(pd.pauseend2::interval, 'HH24:MI'), '') AS dsppausedata,
+ COALESCE((to_char(pd.timestart1::interval, 'HH24:MI') || '-') || to_char(pd.timeend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.timestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.timestart2::interval, 'HH24:MI')) || '-') || to_char(pd.timeend2::interval, 'HH24:MI'), '') AS dspworkdata,
+ CASE WHEN max(freehours.freehours) < '00:00:00'::interval THEN NULL ELSE to_char(max(freehours.freehours), 'HH24:MI') END AS freehoursafter,
+ to_char(coalesce(max(wk.defaultdayhours),max(wkstd.defaultdayhours)),'HH24:MI') as defaultdayhours,
+ to_char(coalesce(max(wk.maxdayhours),max(wkstd.maxdayhours)),'HH24:MI') as maxdayhours,
+ to_char(coalesce(max(wk.mindailyrecuperation),max(wkstd.mindailyrecuperation)),'HH24:MI') as mindailyrecuperation,
+ to_char(coalesce(max(wk.maxinterruptionhours),max(wkstd.maxinterruptionhours)),'HH24:MI') as maxinterruptionhours,
+ max(vd.vacancyname) as vacancyname,
+ to_char(max(tt.trackedtime),'HH24:MI') as trackedtime,
+ max(case when tt.trackedtime is null or pd.workhours is null then null else interval_to_char(coalesce(tt.trackedtime::interval,'00:00:00'::interval) - coalesce(pd.workhours::interval,'00:00:00'::interval)) end) as trackeddiff,
+ null as incompletetrack
+ FROM demo2m17.staffreportperioddays pd
+ JOIN demo2m17.staff st ON pd.id_staff = st.id and st.id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and st.isdeleted is null
+ LEFT JOIN ( SELECT yy.id_staff, yy.ndaydate AS daydate,case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend AS tmfrom, yy.daydate + yy.timestart AS tmto,
+ yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend) AS realinterval,
+ date_part('epoch', yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend)) * '00:00:01'::interval AS freehours
+ FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
+ lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
+ xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend
+ FROM ( SELECT sr.id_staff, sr.daydate,
+ CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
+ CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY sr.id_staff, sr.daydate) xx_1) yy) freehours ON pd.id_staff = freehours.id_staff AND freehours.daydate = pd.daydate
+ left join demo2m17.worktimes wk on pd.daydate between wk.startdate and wk.enddate
+ cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from demo2m17.worktimes where isdefault =true) wkstd
+ left join demo2m17.vacancydays vd on pd.daydate=vd.daydate
+ left join demo2m17.reportperiod rp on (pd.id_reportperiod=rp.id)
+ left join (
+ select
+ sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as sumdayall,
+ string_agg(minpauseok::text,'') as minpauses, null as incompletetrack,
+ case when sum(minpauseok) = 0 and sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) >= '06:00:00'::interval then sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) - '00:30:00'::interval else sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) end as trackedtime,daydate from
+ ( select *, tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) as pauseduration,
+ to_char(lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in),'HH24:MI') || '-' || to_char(tx.stamp_in,'HH24:MI') as pausetime,
+ case when tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker tx where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and tx.daydate between date('2023-08-28') and date('2023-11-05')
+ order by tx.stamp_in) tt
+ group by tt.daydate
+ ) tt on pd.daydate=tt.daydate
+ WHERE pd.daydate between date('2023-08-28') and date('2023-11-05')
+ group by pd.id,rp.viewpartunempl,rp.viewvacschool
+ ORDER BY pd.id_staff, pd.daydate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT distinct(us.schema_name),case when cp.company is null then 'schema:' || us.schema_name else company end as company ,
+ us.schema_name AS schemaname,
+ case when datasetname is null then 'schema:' || us.schema_name else datasetname end as datasetname
+ FROM ( select schema_name from information_schema.schemata where schema_owner != 'postgres' and schema_name != 'public') us
+ JOIN companies cp ON cp.schemata = us.schema_name AND cp.isdeleted IS null and cp.company is not null and cp.portal='app';
+QUERY: select terms from demo2m17.users where id='e9e6880b-75c7-70b5-ce61-49cf6d62630f';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT wp.id,wp.workplan,wp.isdefault,wp.weekhours,wp.weekdays,
+ coalesce((((((wp.workplan || ' / ') ||substr(wp.weekhours::text, 1, 5)) || 'h / ') || wp.weekdays) || 'j / libre: ') || (( SELECT string_agg(ww.wday, ',') AS string_agg FROM ( SELECT public.day_name(json_array_elements_text(wp.freeweekdayslist)) AS wday) ww)),wp.workplan ) AS dspworkplandetail
+ FROM demo2m17.workplans wp
+ ORDER BY wp.isdefault, wp.workplan;
+QUERYARRAY: SELECT id,startdate,enddate,id_parentreportperiod,periodtype,viewpartunempl,periodlength,periodunit,sector,periodlength || ' ' || periodunit as dspunit, to_char(startdate,'MM/YY') || ' - ' || to_char(enddate,'MM/YY') as dspperiod FROM demo2m17.reportperiod rp ORDER BY startdate DESC, enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: select id,tmplname,tmplcolor as bgcolor FROM demo2m17.daytemplate order by tmplname;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '08737d53-1fb6-2284-c6c0-418b1ac7e2fa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from demo2m17.reportperiod where id='08737d53-1fb6-2284-c6c0-418b1ac7e2fa'
+QUERYBYKEY: select ws.weekstart,ws.weekend,ws.calweek,ws.calyear, ws.id_staff
+ ,to_char(ws.workhours::interval,'HH24:MI') as workhours
+ ,to_char(ws.vacancyhours,'HH24:MI') as vacancynormal
+ ,to_char(ws.vacillhours,'HH24:MI') as vacancyill
+ ,to_char(ws.vacextrahours,'HH24:MI') as vacancyextra
+ ,to_char(ws.vacschoolhours,'HH24:MI') as vacancyschool
+ ,to_char(ws.otherpaidhours,'HH24:MI') as otherpaidhours
+ ,to_char(ws.partunemplhours,'HH24:MI') as partunemplhours
+ ,to_char(ws.recuperationhours,'HH24:MI') as recuperationhours
+ ,to_char(ws.totalhours,'HH24:MI') as totalhours
+ ,cd.contractworkdays
+ ,cd.cmpcontractdays
+ ,cd.cmpweekhours
+ ,to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval),'HH24:MI') as weektrackedhours
+ ,ws.periodworkhours
+ ,interval_to_char(sum(coalesce(ttr.weektrackedhours,'00:00:00'::interval)) over (order by ws.weekstart) - sum(ws.periodworkhours::interval) over (order by ws.weekstart)) as periodtrackdiff
+ ,sum(ws.workhours::interval) over (order by ws.weekstart) as runningworkhours
+ ,interval_to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval) - ws.periodworkhours::interval) as trackeddiff
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else to_char(cd.contracthours,'HH24:MI') end as contracthours
+ ,to_char(AVG(ws.totalhours) over (order by ws.weekstart),'HH24:MI') as avgtotalhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then '00:00' else interval_to_char(ws.totalhours-cd.contracthours) end as diffhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then
+ to_char(case when cd.cmpweekhours < '40:00:00'::interval then cd.contracthours * 1.15 * cd.contractworkdays else (cd.contractworkdays*'08:00:00'::interval) + (cd.contractworkdays* case when maxdata.maxweekhours > '48:00:00' then '01:16:50'::interval else '00:50:00'::interval end) end,'HH24:MI')
+ else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours * 1.15 else maxdata.maxweekhours end,'HH24:MI')
+ end as maxweekhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours else maxdata.defaultweekhours end,'HH24:MI')
+ end as defaultweekhours
+ from (
+ SELECT weekstart,weekend,calweek,calyear, id_staff,
+ sum(CASE WHEN srpd.workhours IS NULL THEN '00:00:00'::interval ELSE srpd.workhours::interval END) AS workhours,
+ sum(case when srpd.daydate between date('2024-01-01') and date('2024-02-29') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
+ --sum(case when srpd.daydate between date('2024-01-01') and date('2024-02-29') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
+ sum(CASE WHEN srpd.vacancyhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacancyhours::interval END) AS vacancyhours,
+ sum(CASE WHEN srpd.vacillhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacillhours::interval END) AS vacillhours,
+ sum(CASE WHEN srpd.vacextrahours IS NULL THEN '00:00:00'::interval ELSE srpd.vacextrahours::interval END) AS vacextrahours,
+ sum(CASE WHEN srpd.vacschoolhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacschoolhours::interval END) AS vacschoolhours,
+ sum(CASE WHEN srpd.recuperationhours IS NULL THEN '00:00:00'::interval ELSE srpd.recuperationhours::interval END) AS recuperationhours,
+ sum(CASE WHEN srpd.otherpaidhours IS NULL THEN '00:00:00'::interval ELSE srpd.otherpaidhours::interval END) AS otherpaidhours,
+ sum(CASE WHEN srpd.partunemplhours IS NULL THEN '00:00:00'::interval ELSE srpd.partunemplhours::interval END) AS partunemplhours,
+ sum(CASE WHEN srpd.dayhours IS NULL THEN '00:00:00'::interval ELSE srpd.dayhours::interval END) AS totalhours,
+ sum(CASE WHEN srpd.workhours > '00:00:00'::time without time zone OR srpd.recuperationhours > '00:00:00'::time without time zone OR srpd.vacancyhours > '00:00:00'::time without time zone OR srpd.vacillhours > '00:00:00'::time without time zone OR srpd.vacextrahours > '00:00:00'::time without time zone OR srpd.vacschoolhours > '00:00:00'::time without time zone OR srpd.otherpaidhours > '00:00:00'::time without time zone or srpd.partunemplhours > '00:00:00'::time without time zone THEN 1 ELSE 0 END) AS workdays,
+ sum( CASE WHEN srpd.contracthours IS NULL THEN '00:00:00'::interval ELSE srpd.contracthours::interval END) AS contracthours
+ FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
+ date(date_trunc('week', daydate) + interval '6 days') AS weekend,
+ date_part('week', daydate) AS calweek,
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= '6e2a60cc-2123-f295-f3ef-1b76047a7db3' and daydate between date('2024-01-01') and date('2024-03-03')
+ ) srpd GROUP BY srpd.weekstart,srpd.weekend,srpd.calweek,srpd.calyear,srpd.id_staff
+ ORDER BY weekstart) ws left join (
+ select date(date_trunc('week',pd.daydate)) as weekstart,pd.id_staff,max(sc.weekdays) as cmpcontractdays,max(sc.weekhours) as cmpweekhours,
+ case when count(pd.daydate) < avg(sc.weekdays) then count(pd.daydate) else avg(sc.weekdays) end as contractworkdays,
+ case when count(pd.daydate) < avg(sc.weekdays) then avg(sc.weekhours/ sc.weekdays) * count(pd.daydate) else avg(sc.weekhours/ sc.weekdays) * avg(sc.weekdays) end as contracthours ,sum(case when coalesce(pd.workhours,'00:00:00'::time) > '00:00:00'::time then 1 else 0 end) as realworkdays
+ from ( select id_staff,weekdays ,weekhours,
+ case when startdate> date('2024-01-01') then startdate else date('2024-01-01') end as staffperiodstart,
+ case when enddate is null or enddate > date('2024-03-03') then date('2024-03-03')
+ else enddate end as staffperiodend from demo2m17.staffcontract where id_staff='6e2a60cc-2123-f295-f3ef-1b76047a7db3'
+ and startdate < date('2024-03-03')
+ ) sc
+ join demo2m17.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
+ group by date(date_trunc('week',pd.daydate)),pd.id_staff
+ ) cd on ws.id_staff = cd.id_staff and ws.weekstart=cd.weekstart
+ left join (
+ select id_staff,weekstart,max(defaultweekhours) as defaultweekhours,avg(maxweekhours) as maxweekhours from (
+ select lpd.id_staff,date(date_trunc('week',lpd.daydate)) as weekstart,lpd.daydate,
+ case when wk.defaultweekhours is null then wkdef.defaultweekhours else wk.defaultweekhours end as defaultweekhours ,
+ case when wk.maxweekhours is null then wkdef.maxweekhours else wk.maxweekhours end as maxweekhours
+ from demo2m17.staffreportperioddays lpd
+ left join demo2m17.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
+ cross join (select * from demo2m17.worktimes where isdefault=true) wkdef
+ where id_staff='6e2a60cc-2123-f295-f3ef-1b76047a7db3' and lpd.daydate between date('2024-01-01') and date('2024-03-03')
+ order by lpd.daydate ) mh group by id_staff,weekstart
+ ) maxdata on ws.id_staff = maxdata.id_staff and ws.weekstart=maxdata.weekstart
+ left join (
+ select weekstart,id_staff,coalesce(sum(daytracked),'00:00:00'::interval) as weektrackedhours from (
+ select daydate,id_staff,weekstart,case when sum(trackedhours) > '06:00:00'::interval then sum(trackedhours)- '00:30:00'::interval else coalesce(sum(trackedhours),'00:00:00'::interval) end as daytracked from (
+select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from demo2m17.timetracker
+where daydate between date('2024-01-01') and date('2024-02-29') and id_staff ='6e2a60cc-2123-f295-f3ef-1b76047a7db3') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
+ ) ttr on ws.weekstart=ttr.weekstart and ws.id_staff=ttr.id_staff;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT pd.id,pd.id_staff,pd.id_reportperiod,pd.daydate,pd.payedpause,pd.daytype,pd.daycomment,
+ vacancycomment,vacillcomment,vacextracomment,recupcomment,otherpaidhourscomment,partunempcomment,
+ pd.daytemplate,pd.vacschoolcomment,rp.viewpartunempl,rp.viewvacschool,
+ date(date_trunc('week',pd.daydate)) as weekstart,
+ to_char(pd.timestart1::interval, 'HH24:MI') AS timestart1,
+ to_char(pd.timeend1::interval, 'HH24:MI') AS timeend1,
+ to_char(pd.timestart2::interval, 'HH24:MI') AS timestart2,
+ to_char(pd.timeend2::interval, 'HH24:MI') AS timeend2,
+ to_char(pd.timepause::interval, 'HH24:MI') AS timepause,
+ -- coalesce('<div class="dspvacancynormal">' || to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN null ELSE pd.vacancyhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyill">' || to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN null else pd.vacillhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyextra">' || to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN null ELSE pd.vacextrahours END::interval, 'HH24:MI') || '</div>','') AS dspvacancyhours,
+ to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacancyhours END::interval, 'HH24:MI') AS vacancyhours,
+ to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacillhours END::interval, 'HH24:MI') AS vacillhours,
+ to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacextrahours END::interval, 'HH24:MI') AS vacextrahours,
+ to_char(CASE WHEN pd.vacschoolhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacschoolhours END::interval, 'HH24:MI') AS vacschoolhours,
+ to_char(CASE WHEN pd.otherpaidhours::interval = '00:00:00'::interval THEN NULL ELSE pd.otherpaidhours END::interval, 'HH24:MI') AS otherpaidhours,
+ to_char(CASE WHEN pd.partunemplhours::interval = '00:00:00'::interval THEN NULL ELSE pd.partunemplhours END::interval, 'HH24:MI') AS partunemplhours,
+ to_char(pd.contracthours::interval, 'HH24:MI') AS contracthours,
+ to_char(CASE WHEN pd.workhours::interval = '00:00:00'::interval THEN NULL ELSE pd.workhours END::interval, 'HH24:MI') AS workhours,
+ to_char(CASE WHEN pd.dayhours::interval = '00:00:00'::interval THEN NULL ELSE pd.dayhours END::interval, 'HH24:MI') AS dayhours,
+ to_char(case WHEN pd.recuperationhours::interval = '00:00:00'::interval THEN NULL ELSE pd.recuperationhours END::interval, 'HH24:MI') AS recuperationhours,
+ to_char(CASE WHEN pd.interruptionhours::interval = '00:00:00'::interval THEN NULL ELSE pd.interruptionhours END::interval, 'HH24:MI') AS interruptionhours,
+ to_char(CASE WHEN pd.nighthours::interval = '00:00:00'::interval THEN NULL ELSE pd.nighthours END::interval, 'HH24:MI') AS nighthours,
+ to_char(pd.pausestart1::interval, 'HH24:MI') AS pausestart1,
+ to_char(pd.pauseend1::interval, 'HH24:MI') AS pauseend1,
+ to_char(pd.pausestart2::interval, 'HH24:MI') AS pausestart2,
+ to_char(pd.pauseend2::interval, 'HH24:MI') AS pauseend2,
+ COALESCE((to_char(pd.pausestart1::interval, 'HH24:MI') || '-') || to_char(pd.pauseend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.pausestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.pausestart2::interval, 'HH24:MI')) || '-') || to_char(pd.pauseend2::interval, 'HH24:MI'), '') AS dsppausedata,
+ COALESCE((to_char(pd.timestart1::interval, 'HH24:MI') || '-') || to_char(pd.timeend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.timestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.timestart2::interval, 'HH24:MI')) || '-') || to_char(pd.timeend2::interval, 'HH24:MI'), '') AS dspworkdata,
+ CASE WHEN max(freehours.freehours) < '00:00:00'::interval THEN NULL ELSE to_char(max(freehours.freehours), 'HH24:MI') END AS freehoursafter,
+ to_char(coalesce(max(wk.defaultdayhours),max(wkstd.defaultdayhours)),'HH24:MI') as defaultdayhours,
+ to_char(coalesce(max(wk.maxdayhours),max(wkstd.maxdayhours)),'HH24:MI') as maxdayhours,
+ to_char(coalesce(max(wk.mindailyrecuperation),max(wkstd.mindailyrecuperation)),'HH24:MI') as mindailyrecuperation,
+ to_char(coalesce(max(wk.maxinterruptionhours),max(wkstd.maxinterruptionhours)),'HH24:MI') as maxinterruptionhours,
+ max(vd.vacancyname) as vacancyname,
+ to_char(max(tt.trackedtime),'HH24:MI') as trackedtime,
+ max(case when tt.trackedtime is null or pd.workhours is null then null else interval_to_char(coalesce(tt.trackedtime::interval,'00:00:00'::interval) - coalesce(pd.workhours::interval,'00:00:00'::interval)) end) as trackeddiff,
+ null as incompletetrack
+ FROM demo2m17.staffreportperioddays pd
+ JOIN demo2m17.staff st ON pd.id_staff = st.id and st.id='6e2a60cc-2123-f295-f3ef-1b76047a7db3' and st.isdeleted is null
+ LEFT JOIN ( SELECT yy.id_staff, yy.ndaydate AS daydate,case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend AS tmfrom, yy.daydate + yy.timestart AS tmto,
+ yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend) AS realinterval,
+ date_part('epoch', yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend)) * '00:00:01'::interval AS freehours
+ FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
+ lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
+ xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend
+ FROM ( SELECT sr.id_staff, sr.daydate,
+ CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
+ CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='6e2a60cc-2123-f295-f3ef-1b76047a7db3'
+ ORDER BY sr.id_staff, sr.daydate) xx_1) yy) freehours ON pd.id_staff = freehours.id_staff AND freehours.daydate = pd.daydate
+ left join demo2m17.worktimes wk on pd.daydate between wk.startdate and wk.enddate
+ cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from demo2m17.worktimes where isdefault =true) wkstd
+ left join demo2m17.vacancydays vd on pd.daydate=vd.daydate
+ left join demo2m17.reportperiod rp on (pd.id_reportperiod=rp.id)
+ left join (
+ select
+ sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as sumdayall,
+ string_agg(minpauseok::text,'') as minpauses, null as incompletetrack,
+ case when sum(minpauseok) = 0 and sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) >= '06:00:00'::interval then sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) - '00:30:00'::interval else sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) end as trackedtime,daydate from
+ ( select *, tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) as pauseduration,
+ to_char(lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in),'HH24:MI') || '-' || to_char(tx.stamp_in,'HH24:MI') as pausetime,
+ case when tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker tx where id_staff='6e2a60cc-2123-f295-f3ef-1b76047a7db3' and tx.daydate between date('2024-01-01') and date('2024-03-03')
+ order by tx.stamp_in) tt
+ group by tt.daydate
+ ) tt on pd.daydate=tt.daydate
+ WHERE pd.daydate between date('2024-01-01') and date('2024-03-03')
+ group by pd.id,rp.viewpartunempl,rp.viewvacschool
+ ORDER BY pd.id_staff, pd.daydate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '351cf732-61ee-8ad4-47fb-78b63159cacb'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from demo2m17.reportperiod where id='351cf732-61ee-8ad4-47fb-78b63159cacb'
+QUERYBYKEY: select ws.weekstart,ws.weekend,ws.calweek,ws.calyear, ws.id_staff
+ ,to_char(ws.workhours::interval,'HH24:MI') as workhours
+ ,to_char(ws.vacancyhours,'HH24:MI') as vacancynormal
+ ,to_char(ws.vacillhours,'HH24:MI') as vacancyill
+ ,to_char(ws.vacextrahours,'HH24:MI') as vacancyextra
+ ,to_char(ws.vacschoolhours,'HH24:MI') as vacancyschool
+ ,to_char(ws.otherpaidhours,'HH24:MI') as otherpaidhours
+ ,to_char(ws.partunemplhours,'HH24:MI') as partunemplhours
+ ,to_char(ws.recuperationhours,'HH24:MI') as recuperationhours
+ ,to_char(ws.totalhours,'HH24:MI') as totalhours
+ ,cd.contractworkdays
+ ,cd.cmpcontractdays
+ ,cd.cmpweekhours
+ ,to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval),'HH24:MI') as weektrackedhours
+ ,ws.periodworkhours
+ ,interval_to_char(sum(coalesce(ttr.weektrackedhours,'00:00:00'::interval)) over (order by ws.weekstart) - sum(ws.periodworkhours::interval) over (order by ws.weekstart)) as periodtrackdiff
+ ,sum(ws.workhours::interval) over (order by ws.weekstart) as runningworkhours
+ ,interval_to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval) - ws.periodworkhours::interval) as trackeddiff
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else to_char(cd.contracthours,'HH24:MI') end as contracthours
+ ,to_char(AVG(ws.totalhours) over (order by ws.weekstart),'HH24:MI') as avgtotalhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then '00:00' else interval_to_char(ws.totalhours-cd.contracthours) end as diffhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then
+ to_char(case when cd.cmpweekhours < '40:00:00'::interval then cd.contracthours * 1.15 * cd.contractworkdays else (cd.contractworkdays*'08:00:00'::interval) + (cd.contractworkdays* case when maxdata.maxweekhours > '48:00:00' then '01:16:50'::interval else '00:50:00'::interval end) end,'HH24:MI')
+ else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours * 1.15 else maxdata.maxweekhours end,'HH24:MI')
+ end as maxweekhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours else maxdata.defaultweekhours end,'HH24:MI')
+ end as defaultweekhours
+ from (
+ SELECT weekstart,weekend,calweek,calyear, id_staff,
+ sum(CASE WHEN srpd.workhours IS NULL THEN '00:00:00'::interval ELSE srpd.workhours::interval END) AS workhours,
+ sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
+ --sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
+ sum(CASE WHEN srpd.vacancyhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacancyhours::interval END) AS vacancyhours,
+ sum(CASE WHEN srpd.vacillhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacillhours::interval END) AS vacillhours,
+ sum(CASE WHEN srpd.vacextrahours IS NULL THEN '00:00:00'::interval ELSE srpd.vacextrahours::interval END) AS vacextrahours,
+ sum(CASE WHEN srpd.vacschoolhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacschoolhours::interval END) AS vacschoolhours,
+ sum(CASE WHEN srpd.recuperationhours IS NULL THEN '00:00:00'::interval ELSE srpd.recuperationhours::interval END) AS recuperationhours,
+ sum(CASE WHEN srpd.otherpaidhours IS NULL THEN '00:00:00'::interval ELSE srpd.otherpaidhours::interval END) AS otherpaidhours,
+ sum(CASE WHEN srpd.partunemplhours IS NULL THEN '00:00:00'::interval ELSE srpd.partunemplhours::interval END) AS partunemplhours,
+ sum(CASE WHEN srpd.dayhours IS NULL THEN '00:00:00'::interval ELSE srpd.dayhours::interval END) AS totalhours,
+ sum(CASE WHEN srpd.workhours > '00:00:00'::time without time zone OR srpd.recuperationhours > '00:00:00'::time without time zone OR srpd.vacancyhours > '00:00:00'::time without time zone OR srpd.vacillhours > '00:00:00'::time without time zone OR srpd.vacextrahours > '00:00:00'::time without time zone OR srpd.vacschoolhours > '00:00:00'::time without time zone OR srpd.otherpaidhours > '00:00:00'::time without time zone or srpd.partunemplhours > '00:00:00'::time without time zone THEN 1 ELSE 0 END) AS workdays,
+ sum( CASE WHEN srpd.contracthours IS NULL THEN '00:00:00'::interval ELSE srpd.contracthours::interval END) AS contracthours
+ FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
+ date(date_trunc('week', daydate) + interval '6 days') AS weekend,
+ date_part('week', daydate) AS calweek,
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-02-26') and date('2024-05-05')
+ ) srpd GROUP BY srpd.weekstart,srpd.weekend,srpd.calweek,srpd.calyear,srpd.id_staff
+ ORDER BY weekstart) ws left join (
+ select date(date_trunc('week',pd.daydate)) as weekstart,pd.id_staff,max(sc.weekdays) as cmpcontractdays,max(sc.weekhours) as cmpweekhours,
+ case when count(pd.daydate) < avg(sc.weekdays) then count(pd.daydate) else avg(sc.weekdays) end as contractworkdays,
+ case when count(pd.daydate) < avg(sc.weekdays) then avg(sc.weekhours/ sc.weekdays) * count(pd.daydate) else avg(sc.weekhours/ sc.weekdays) * avg(sc.weekdays) end as contracthours ,sum(case when coalesce(pd.workhours,'00:00:00'::time) > '00:00:00'::time then 1 else 0 end) as realworkdays
+ from ( select id_staff,weekdays ,weekhours,
+ case when startdate> date('2024-02-26') then startdate else date('2024-02-26') end as staffperiodstart,
+ case when enddate is null or enddate > date('2024-05-05') then date('2024-05-05')
+ else enddate end as staffperiodend from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ and startdate < date('2024-05-05')
+ ) sc
+ join demo2m17.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
+ group by date(date_trunc('week',pd.daydate)),pd.id_staff
+ ) cd on ws.id_staff = cd.id_staff and ws.weekstart=cd.weekstart
+ left join (
+ select id_staff,weekstart,max(defaultweekhours) as defaultweekhours,avg(maxweekhours) as maxweekhours from (
+ select lpd.id_staff,date(date_trunc('week',lpd.daydate)) as weekstart,lpd.daydate,
+ case when wk.defaultweekhours is null then wkdef.defaultweekhours else wk.defaultweekhours end as defaultweekhours ,
+ case when wk.maxweekhours is null then wkdef.maxweekhours else wk.maxweekhours end as maxweekhours
+ from demo2m17.staffreportperioddays lpd
+ left join demo2m17.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
+ cross join (select * from demo2m17.worktimes where isdefault=true) wkdef
+ where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and lpd.daydate between date('2024-02-26') and date('2024-05-05')
+ order by lpd.daydate ) mh group by id_staff,weekstart
+ ) maxdata on ws.id_staff = maxdata.id_staff and ws.weekstart=maxdata.weekstart
+ left join (
+ select weekstart,id_staff,coalesce(sum(daytracked),'00:00:00'::interval) as weektrackedhours from (
+ select daydate,id_staff,weekstart,case when sum(trackedhours) > '06:00:00'::interval then sum(trackedhours)- '00:30:00'::interval else coalesce(sum(trackedhours),'00:00:00'::interval) end as daytracked from (
+select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from demo2m17.timetracker
+where daydate between date('2024-03-01') and date('2024-04-30') and id_staff ='d8e44d1a-359c-055b-72dc-343c57fdfb76') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
+ ) ttr on ws.weekstart=ttr.weekstart and ws.id_staff=ttr.id_staff;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT pd.id,pd.id_staff,pd.id_reportperiod,pd.daydate,pd.payedpause,pd.daytype,pd.daycomment,
+ vacancycomment,vacillcomment,vacextracomment,recupcomment,otherpaidhourscomment,partunempcomment,
+ pd.daytemplate,pd.vacschoolcomment,rp.viewpartunempl,rp.viewvacschool,
+ date(date_trunc('week',pd.daydate)) as weekstart,
+ to_char(pd.timestart1::interval, 'HH24:MI') AS timestart1,
+ to_char(pd.timeend1::interval, 'HH24:MI') AS timeend1,
+ to_char(pd.timestart2::interval, 'HH24:MI') AS timestart2,
+ to_char(pd.timeend2::interval, 'HH24:MI') AS timeend2,
+ to_char(pd.timepause::interval, 'HH24:MI') AS timepause,
+ -- coalesce('<div class="dspvacancynormal">' || to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN null ELSE pd.vacancyhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyill">' || to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN null else pd.vacillhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyextra">' || to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN null ELSE pd.vacextrahours END::interval, 'HH24:MI') || '</div>','') AS dspvacancyhours,
+ to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacancyhours END::interval, 'HH24:MI') AS vacancyhours,
+ to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacillhours END::interval, 'HH24:MI') AS vacillhours,
+ to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacextrahours END::interval, 'HH24:MI') AS vacextrahours,
+ to_char(CASE WHEN pd.vacschoolhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacschoolhours END::interval, 'HH24:MI') AS vacschoolhours,
+ to_char(CASE WHEN pd.otherpaidhours::interval = '00:00:00'::interval THEN NULL ELSE pd.otherpaidhours END::interval, 'HH24:MI') AS otherpaidhours,
+ to_char(CASE WHEN pd.partunemplhours::interval = '00:00:00'::interval THEN NULL ELSE pd.partunemplhours END::interval, 'HH24:MI') AS partunemplhours,
+ to_char(pd.contracthours::interval, 'HH24:MI') AS contracthours,
+ to_char(CASE WHEN pd.workhours::interval = '00:00:00'::interval THEN NULL ELSE pd.workhours END::interval, 'HH24:MI') AS workhours,
+ to_char(CASE WHEN pd.dayhours::interval = '00:00:00'::interval THEN NULL ELSE pd.dayhours END::interval, 'HH24:MI') AS dayhours,
+ to_char(case WHEN pd.recuperationhours::interval = '00:00:00'::interval THEN NULL ELSE pd.recuperationhours END::interval, 'HH24:MI') AS recuperationhours,
+ to_char(CASE WHEN pd.interruptionhours::interval = '00:00:00'::interval THEN NULL ELSE pd.interruptionhours END::interval, 'HH24:MI') AS interruptionhours,
+ to_char(CASE WHEN pd.nighthours::interval = '00:00:00'::interval THEN NULL ELSE pd.nighthours END::interval, 'HH24:MI') AS nighthours,
+ to_char(pd.pausestart1::interval, 'HH24:MI') AS pausestart1,
+ to_char(pd.pauseend1::interval, 'HH24:MI') AS pauseend1,
+ to_char(pd.pausestart2::interval, 'HH24:MI') AS pausestart2,
+ to_char(pd.pauseend2::interval, 'HH24:MI') AS pauseend2,
+ COALESCE((to_char(pd.pausestart1::interval, 'HH24:MI') || '-') || to_char(pd.pauseend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.pausestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.pausestart2::interval, 'HH24:MI')) || '-') || to_char(pd.pauseend2::interval, 'HH24:MI'), '') AS dsppausedata,
+ COALESCE((to_char(pd.timestart1::interval, 'HH24:MI') || '-') || to_char(pd.timeend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.timestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.timestart2::interval, 'HH24:MI')) || '-') || to_char(pd.timeend2::interval, 'HH24:MI'), '') AS dspworkdata,
+ CASE WHEN max(freehours.freehours) < '00:00:00'::interval THEN NULL ELSE to_char(max(freehours.freehours), 'HH24:MI') END AS freehoursafter,
+ to_char(coalesce(max(wk.defaultdayhours),max(wkstd.defaultdayhours)),'HH24:MI') as defaultdayhours,
+ to_char(coalesce(max(wk.maxdayhours),max(wkstd.maxdayhours)),'HH24:MI') as maxdayhours,
+ to_char(coalesce(max(wk.mindailyrecuperation),max(wkstd.mindailyrecuperation)),'HH24:MI') as mindailyrecuperation,
+ to_char(coalesce(max(wk.maxinterruptionhours),max(wkstd.maxinterruptionhours)),'HH24:MI') as maxinterruptionhours,
+ max(vd.vacancyname) as vacancyname,
+ to_char(max(tt.trackedtime),'HH24:MI') as trackedtime,
+ max(case when tt.trackedtime is null or pd.workhours is null then null else interval_to_char(coalesce(tt.trackedtime::interval,'00:00:00'::interval) - coalesce(pd.workhours::interval,'00:00:00'::interval)) end) as trackeddiff,
+ null as incompletetrack
+ FROM demo2m17.staffreportperioddays pd
+ JOIN demo2m17.staff st ON pd.id_staff = st.id and st.id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and st.isdeleted is null
+ LEFT JOIN ( SELECT yy.id_staff, yy.ndaydate AS daydate,case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend AS tmfrom, yy.daydate + yy.timestart AS tmto,
+ yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend) AS realinterval,
+ date_part('epoch', yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend)) * '00:00:01'::interval AS freehours
+ FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
+ lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
+ xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend
+ FROM ( SELECT sr.id_staff, sr.daydate,
+ CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
+ CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY sr.id_staff, sr.daydate) xx_1) yy) freehours ON pd.id_staff = freehours.id_staff AND freehours.daydate = pd.daydate
+ left join demo2m17.worktimes wk on pd.daydate between wk.startdate and wk.enddate
+ cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from demo2m17.worktimes where isdefault =true) wkstd
+ left join demo2m17.vacancydays vd on pd.daydate=vd.daydate
+ left join demo2m17.reportperiod rp on (pd.id_reportperiod=rp.id)
+ left join (
+ select
+ sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as sumdayall,
+ string_agg(minpauseok::text,'') as minpauses, null as incompletetrack,
+ case when sum(minpauseok) = 0 and sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) >= '06:00:00'::interval then sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) - '00:30:00'::interval else sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) end as trackedtime,daydate from
+ ( select *, tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) as pauseduration,
+ to_char(lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in),'HH24:MI') || '-' || to_char(tx.stamp_in,'HH24:MI') as pausetime,
+ case when tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker tx where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and tx.daydate between date('2024-02-26') and date('2024-05-05')
+ order by tx.stamp_in) tt
+ group by tt.daydate
+ ) tt on pd.daydate=tt.daydate
+ WHERE pd.daydate between date('2024-02-26') and date('2024-05-05')
+ group by pd.id,rp.viewpartunempl,rp.viewvacschool
+ ORDER BY pd.id_staff, pd.daydate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select daydate as datebefore,to_char(case when timestart2 is null then timeend1 else timeend2 end,'HH24:MI') as timeendbefore from demo2m17.staffreportperioddays where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate < date('2024-04-01') and (timestart1 is not null or timestart2 is not null) order by daydate desc limit 1;
+QUERY: select daydate as dateafter ,to_char(case when timestart1 is null then timestart2 else timestart1 end,'HH24:MI') as timestartafter from demo2m17.staffreportperioddays where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate > date('2024-04-01') and (timestart1 is not null or timestart2 is not null) order by daydate asc limit 1;
+QUERY: select weekhours from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and ((date('2024-04-01') between startdate and enddate) or (startdate <= date('2024-04-01') and enddate is null)) order by startdate,enddate nulls first limit 1;
+QUERY: select to_char(wk.maxdayhours,'HH24:MI') as maxdayhours,
+ to_char(wk.maxweekhours,'HH24:MI') as maxweekhours,
+ to_char(wk.maxinterruptionhours,'HH24:MI') as maxinterruptionhours,
+ to_char(wk.mindailyrecuperation,'HH24:MI') as mindailyrecuperation,
+ to_char(wk.defaultweekhours,'HH24:MI') as defaultweekhours,
+ '2024-03-31' as datebefore,
+ '20:40' as timebefore,
+ '2024-04-03' as dateafter,
+ '11:00' as timeafter
+ from demo2m17.worktimes wk where (date('2024-04-01') between wk.startdate and wk.enddate) or (wk.startdate is null and wk.enddate is null) and maxhourspercents is null
+ order by wk.startdate,wk.enddate nulls last limit 1;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: select id,id_staff,daydate,to_char(stamp_in,'HH24:MI') as stamp_in,to_char(stamp_out,'HH24:MI') as stamp_out,
+ case when stamp_in is null or stamp_out is null then null else to_char(stamp_out-stamp_in,'HH24:MI') end as total,tracktype, to_char(stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') as pauseduration,
+ to_char(lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') || '-' || to_char(stamp_in,'HH24:MI') as pausetime,
+ case when stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker where daydate=date('2024-04-01') and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by stamp_in,stamp_out;
+QUERYARRAY: select id,id_staff,daydate,to_char(stamp_in,'HH24:MI') as stamp_in,to_char(stamp_out,'HH24:MI') as stamp_out,
+ case when stamp_in is null or stamp_out is null then null else to_char(stamp_out-stamp_in,'HH24:MI') end as total,tracktype, to_char(stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') as pauseduration,
+ to_char(lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') || '-' || to_char(stamp_in,'HH24:MI') as pausetime,
+ case when stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker where daydate=date('2024-04-01') and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by stamp_in,stamp_out;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+EXEC: UPDATE demo2m17.staffreportperioddays SET timestart1='11:00',timeend1='14:00',timestart2='17:00',timeend2='20:40',pausestart1=null,pauseend1=null,pausestart2=null,pauseend2=null,timepause='00:00',timepausetracked='00:00',workhourstracked='00:00',daycomment=null,vacancycomment=null,vacancyhours=null,vacillcomment=null,vacillhours=null,vacextracomment=null,vacextrahours=null,vacschoolcomment=null,vacschoolhours=null,recupcomment=null,recuperationhours=null,partunempcomment=null,partunemplhours=null,otherpaidhourscomment='jour ferié',otherpaidhours=null,dayhourstracked='00:00' WHERE id='659bfa66-be20-0fc0-9313-b66d6f16c94e';
+QUERYARRAY: select daydate from demo2m17.vacancydays v where daydate between date(date_trunc('week',date('2024-04-01'))) and date(date_trunc('week',date('2024-04-01')) + interval '6 days');
+QUERY: select id,dayhours from demo2m17.staffreportperioddays where daydate=date('2024-04-01') and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76';
+QUERY: select id from demo2m17.reportperiod where date('2024-04-01') between startdate and enddate;
+QUERY: select date(date_trunc('year',startdate)) as yearstart ,* from demo2m17.reportperiod where id='351cf732-61ee-8ad4-47fb-78b63159cacb';
+EXEC: update demo2m17.staffreportperioddays spds set
+ workhours=ds.worktime, timepause=case when ds.timepause::interval > '00:00:00' then ds.timepause else null end,
+ dayhours=(ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours )::interval, interruptionhours = ds.interruption ,
+ contracthours=case when ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours::interval > '00:00:00'::interval then ds.wdcontracthours else null end
+ from (
+ select preds.id,case when preds.recuperationhours is null then '00:00:00'::interval else preds.recuperationhours::interval end as recup,
+ case when preds.vacancyhours is null then '00:00:00'::time else preds.vacancyhours end as vachours,
+ case when preds.vacillhours is null then '00:00:00'::time else preds.vacillhours end as vacillhours,
+ case when preds.vacextrahours is null then '00:00:00'::time else preds.vacextrahours end as vacextrahours,
+ case when preds.otherpaidhours is null then '00:00:00'::time else preds.otherpaidhours end as otherpaidhours,
+ case when preds.partunemplhours is null then '00:00:00'::time else preds.partunemplhours end as partunemplhours,
+ preds.interruption,
+ (preds.dt1+preds.dt2)-(preds.pdt1+preds.pdt2) as worktime,
+ (preds.pdt1+preds.pdt2) as timepause,
+ wdcontracthours
+ from ( select id, recuperationhours,vacancyhours,vacillhours,vacextrahours,otherpaidhours,payedpause,partunemplhours,nighthours,
+ case when timestart1 is not null and timeend1 is not null then case when timeend1 < timestart1 then '24:00:00'::interval + timeend1::interval - timestart1::interval else timeend1::interval - timestart1::interval end else '00:00:00'::interval end as dt1,
+ case when timestart2 is not null and timeend2 is not null then case when timeend2 < timestart2 then '24:00:00'::interval + timeend2::interval - timestart2::interval else timeend2::interval - timestart2::interval end else '00:00:00'::interval end as dt2,
+ case when pausestart1 between timestart1 and case when timeend1 < timestart1 then timeend1::interval + '24:00:00'::interval else timeend1::interval end and pauseend1 between timestart1 and case when timeend1 < timestart1 then timeend1::interval + '24:00:00'::interval else timeend1::interval end then case when pauseend1 < pausestart1 then '24:00:00'::interval + pauseend1::interval - pausestart1::interval else pauseend1::interval - pausestart1::interval end else '00:00:00'::interval end as pdt1,
+ case when pausestart1 between timestart2 and case when timeend2 < timestart2 then timeend2::interval + '24:00:00'::interval else timeend2::interval end and pauseend2 between timestart2 and case when timeend2 < timestart2 then timeend2::interval + '24:00:00'::interval else timeend2::interval end then case when pauseend2 < pausestart2 then '24:00:00'::interval + pauseend2::interval - pausestart2::interval else pauseend2::interval - pausestart2::interval end else '00:00:00'::interval end as pdt2,
+ case when timestart2 is not null and timeend1 is not null and timestart1 is not null and timeend2 is not null then
+ timestart2::interval - timeend1::interval
+ else null end as interruption,
+ wdcontracthours
+ from demo2m17.staffreportperioddays where id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days'))
+ ) preds) ds where spds.id=ds.id;
+EXEC: update demo2m17.staffreportperioddays SET nighthours = null where id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days'));
+EXEC: update demo2m17.staffreportperioddays spds set
+ nighthours=nh from (
+ select id,daydate,timestart1,timeend1, timestart2,timeend2,
+ coalesce((case when timeend1 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend1::interval end) -
+ (case when timestart1 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart1::interval end),'00:00:00'::interval)
+ + coalesce((case when timeend2 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend2::interval end) -
+ (case when timestart2 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart2::interval end),'00:00:00'::interval) as nh
+ from demo2m17.staffreportperioddays s where
+ (timeend1 between '01:00:01' and '05:59:59' or timeend2 between '01:00:01' and '05:59:59'
+ or timestart1 between '01:00:01' and '05:59:59' or timestart2 between '01:00:01' and '05:59:59')
+ and id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days'))
+ ) ds
+ where spds.id=ds.id
+QUERY: select max(rowx) as statussuncount, sum(modx) as suppvacancysunwork from (
+ select daydate,rowx, case when mod(rowx,20) = 0 then 2 else null end as modx from (
+ select daydate,row_number() over (order by daydate) as rowx from demo2m17.staffreportperioddays
+ where daydate between date('2024-01-01') and date('2024-12-31')
+ and date_part('isodow',daydate)::int4 = 7 and workhours > '00:00:00'::time
+ and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by daydate
+ ) xsunday where daydate between date('2024-03-01') and date('2024-04-30')
+ ) sunresult;
+QUERY: select id_period, case when sum(plusdays) over (order by startdate) >= 6 then 2 else case when plusdays = 0 then null else plusdays end end as plusdays from (
+ select id_period,sum(week44s) as plusdays,startdate from (
+ select weekstart,case when (sum(sumx) over (order by weekstart)%8)::integer = 0 then 0 else 1 end as week44s,r.id as id_period,r.startdate,r.enddate from (
+ select weekstart,case when sum(cnt44) > 0 then 0 else 1 end as sumx,
+ max(daydate) as maxdate from (
+ SELECT date(date_trunc('week',yy.daydate)) as weekstart,daydate, dayhours,
+ (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2024-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) as xx,yy.timestart,yy.ntimeend,
+ case when (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2024-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) >= '44:00:00'::interval then 1 else 0 end as cnt44
+ FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
+ lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
+ xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend,xx_1.dayhours
+ FROM ( SELECT sr.id_staff, sr.daydate,sr.dayhours,
+ CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
+ CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and sr.daydate between date('2024-01-01') and date(date_trunc('week',date('2024-01-01') + interval '1 year') - interval '1 day')
+ and sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone
+ and (sr.timestart1 IS NOT null or sr.timestart2 IS NOT null)
+ ORDER BY sr.id_staff, sr.daydate) xx_1) yy order by yy.daydate,weekstart
+ ) aa group by aa.weekstart order by weekstart
+
+ ) bb
+ join demo2m17.reportperiod r on (bb.weekstart between r.startdate and r.enddate)
+ group by weekstart,r.id,bb.sumx order by weekstart
+
+ ) ff group by id_period,startdate) ss
+ where id_period='351cf732-61ee-8ad4-47fb-78b63159cacb'
+ group by id_period,startdate,ss.plusdays;
+QUERY: select weekstart,id_staff,avgtotalhours from (
+ select ws.weekstart, ws.id_staff,
+ AVG(ws.totalhours) over (order by ws.weekstart) as avgtotalhours
+ from (
+ SELECT weekstart, id_staff,
+sum(CASE WHEN srpd.dayhours IS NULL THEN '00:00:00'::interval ELSE srpd.dayhours::interval END) AS totalhours
+ FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
+ date(date_trunc('week', daydate) + interval '6 days') AS weekend,
+ date_part('week', daydate) AS calweek,
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days')
+ --where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-03-01') and date('2024-04-30')
+ ) srpd GROUP BY srpd.weekstart,srpd.id_staff
+ ORDER BY weekstart) ws) wsavg order by weekstart DESC LIMIT 1;
+EXEC: update demo2m17.staffreportperiod rpd set
+ --contracthours=csp.contracthours,
+ workhours=csp.workhours,
+ vacancyill=csp.vacillhours,
+ vacancynormal=csp.vacancynormal,
+ vacancyextra=csp.vacextrahours,
+ otherpaidhours=csp.otherpaidhours,
+ partunemplhours=csp.partunemplhours,
+ totalhours=csp.totalhours,
+ nighthours=csp.nighthours,
+ recuperationhours=csp.recuperationhours,statussuncount=9,suppvacancysunwork=null,suppvacancy44hours=2,status44hcount=null,last44date=null,avgtotalweekhours=null,hoursdiff=csp.diffhours
+ FROM (
+ select contracthours,workhours,totalhours,recuperationhours, totalhours-contracthours as diffhours,id,vacillhours,vacancynormal,vacextrahours,otherpaidhours,partunemplhours,nighthours from (
+ select dp.id,
+ sum(pd.workhours) as workhours,
+ sum(pd.dayhours) as totalhours,
+ sum(coalesce(pd.nighthours,'00:00:00'::interval)) as nighthours,
+ sum(coalesce(pd.vacancyhours,'00:00:00'::time)) as vacancynormal,
+ sum(coalesce(pd.vacillhours,'00:00:00'::time)) as vacillhours,
+ sum(coalesce(pd.vacextrahours,'00:00:00'::time)) as vacextrahours,
+ sum(coalesce(pd.otherpaidhours,'00:00:00'::time)) as otherpaidhours,
+ sum(coalesce(pd.partunemplhours,'00:00:00'::time)) as partunemplhours,
+ sum(coalesce(pd.recuperationhours,'00:00:00'::time)) as recuperationhours,
+ coalesce(dp.contracthours,'00:00:00'::interval) as contracthours,
+ coalesce(dp.payedhours0,'00:00:00'::interval) as payedhours0,
+ coalesce(dp.payedhours40,'00:00:00'::interval) as payedhours40,
+ coalesce(dp.transferedhours,'00:00:00'::interval) as transferedhours
+ from demo2m17.staffreportperioddays pd
+ join demo2m17.staffreportperiod dp on (pd.id_staff=dp.id_staff and dp.id_reportperiod = '351cf732-61ee-8ad4-47fb-78b63159cacb')
+ where pd.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and pd.daydate between date('2024-03-01') and date('2024-04-30')
+ group by dp.id,dp.payedhours,dp.transferedhourscalc
+ ) rp) csp where csp.id=rpd.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ --to_char(srp.vacancyhours, 'HH24:MI'::text) AS vacancyhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from demo2m17.reportperiod where id='351cf732-61ee-8ad4-47fb-78b63159cacb'
+QUERYBYKEY: select ws.weekstart,ws.weekend,ws.calweek,ws.calyear, ws.id_staff
+ ,to_char(ws.workhours::interval,'HH24:MI') as workhours
+ ,to_char(ws.vacancyhours,'HH24:MI') as vacancynormal
+ ,to_char(ws.vacillhours,'HH24:MI') as vacancyill
+ ,to_char(ws.vacextrahours,'HH24:MI') as vacancyextra
+ ,to_char(ws.vacschoolhours,'HH24:MI') as vacancyschool
+ ,to_char(ws.otherpaidhours,'HH24:MI') as otherpaidhours
+ ,to_char(ws.partunemplhours,'HH24:MI') as partunemplhours
+ ,to_char(ws.recuperationhours,'HH24:MI') as recuperationhours
+ ,to_char(ws.totalhours,'HH24:MI') as totalhours
+ ,cd.contractworkdays
+ ,cd.cmpcontractdays
+ ,cd.cmpweekhours
+ ,to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval),'HH24:MI') as weektrackedhours
+ ,ws.periodworkhours
+ ,interval_to_char(sum(coalesce(ttr.weektrackedhours,'00:00:00'::interval)) over (order by ws.weekstart) - sum(ws.periodworkhours::interval) over (order by ws.weekstart)) as periodtrackdiff
+ ,sum(ws.workhours::interval) over (order by ws.weekstart) as runningworkhours
+ ,interval_to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval) - ws.periodworkhours::interval) as trackeddiff
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else to_char(cd.contracthours,'HH24:MI') end as contracthours
+ ,to_char(AVG(ws.totalhours) over (order by ws.weekstart),'HH24:MI') as avgtotalhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then '00:00' else interval_to_char(ws.totalhours-cd.contracthours) end as diffhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then
+ to_char(case when cd.cmpweekhours < '40:00:00'::interval then cd.contracthours * 1.15 * cd.contractworkdays else (cd.contractworkdays*'08:00:00'::interval) + (cd.contractworkdays* case when maxdata.maxweekhours > '48:00:00' then '01:16:50'::interval else '00:50:00'::interval end) end,'HH24:MI')
+ else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours * 1.15 else maxdata.maxweekhours end,'HH24:MI')
+ end as maxweekhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours else maxdata.defaultweekhours end,'HH24:MI')
+ end as defaultweekhours
+ from (
+ SELECT weekstart,weekend,calweek,calyear, id_staff,
+ sum(CASE WHEN srpd.workhours IS NULL THEN '00:00:00'::interval ELSE srpd.workhours::interval END) AS workhours,
+ sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
+ --sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
+ sum(CASE WHEN srpd.vacancyhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacancyhours::interval END) AS vacancyhours,
+ sum(CASE WHEN srpd.vacillhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacillhours::interval END) AS vacillhours,
+ sum(CASE WHEN srpd.vacextrahours IS NULL THEN '00:00:00'::interval ELSE srpd.vacextrahours::interval END) AS vacextrahours,
+ sum(CASE WHEN srpd.vacschoolhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacschoolhours::interval END) AS vacschoolhours,
+ sum(CASE WHEN srpd.recuperationhours IS NULL THEN '00:00:00'::interval ELSE srpd.recuperationhours::interval END) AS recuperationhours,
+ sum(CASE WHEN srpd.otherpaidhours IS NULL THEN '00:00:00'::interval ELSE srpd.otherpaidhours::interval END) AS otherpaidhours,
+ sum(CASE WHEN srpd.partunemplhours IS NULL THEN '00:00:00'::interval ELSE srpd.partunemplhours::interval END) AS partunemplhours,
+ sum(CASE WHEN srpd.dayhours IS NULL THEN '00:00:00'::interval ELSE srpd.dayhours::interval END) AS totalhours,
+ sum(CASE WHEN srpd.workhours > '00:00:00'::time without time zone OR srpd.recuperationhours > '00:00:00'::time without time zone OR srpd.vacancyhours > '00:00:00'::time without time zone OR srpd.vacillhours > '00:00:00'::time without time zone OR srpd.vacextrahours > '00:00:00'::time without time zone OR srpd.vacschoolhours > '00:00:00'::time without time zone OR srpd.otherpaidhours > '00:00:00'::time without time zone or srpd.partunemplhours > '00:00:00'::time without time zone THEN 1 ELSE 0 END) AS workdays,
+ sum( CASE WHEN srpd.contracthours IS NULL THEN '00:00:00'::interval ELSE srpd.contracthours::interval END) AS contracthours
+ FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
+ date(date_trunc('week', daydate) + interval '6 days') AS weekend,
+ date_part('week', daydate) AS calweek,
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-02-26') and date('2024-05-05')
+ ) srpd GROUP BY srpd.weekstart,srpd.weekend,srpd.calweek,srpd.calyear,srpd.id_staff
+ ORDER BY weekstart) ws left join (
+ select date(date_trunc('week',pd.daydate)) as weekstart,pd.id_staff,max(sc.weekdays) as cmpcontractdays,max(sc.weekhours) as cmpweekhours,
+ case when count(pd.daydate) < avg(sc.weekdays) then count(pd.daydate) else avg(sc.weekdays) end as contractworkdays,
+ case when count(pd.daydate) < avg(sc.weekdays) then avg(sc.weekhours/ sc.weekdays) * count(pd.daydate) else avg(sc.weekhours/ sc.weekdays) * avg(sc.weekdays) end as contracthours ,sum(case when coalesce(pd.workhours,'00:00:00'::time) > '00:00:00'::time then 1 else 0 end) as realworkdays
+ from ( select id_staff,weekdays ,weekhours,
+ case when startdate> date('2024-02-26') then startdate else date('2024-02-26') end as staffperiodstart,
+ case when enddate is null or enddate > date('2024-05-05') then date('2024-05-05')
+ else enddate end as staffperiodend from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ and startdate < date('2024-05-05')
+ ) sc
+ join demo2m17.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
+ group by date(date_trunc('week',pd.daydate)),pd.id_staff
+ ) cd on ws.id_staff = cd.id_staff and ws.weekstart=cd.weekstart
+ left join (
+ select id_staff,weekstart,max(defaultweekhours) as defaultweekhours,avg(maxweekhours) as maxweekhours from (
+ select lpd.id_staff,date(date_trunc('week',lpd.daydate)) as weekstart,lpd.daydate,
+ case when wk.defaultweekhours is null then wkdef.defaultweekhours else wk.defaultweekhours end as defaultweekhours ,
+ case when wk.maxweekhours is null then wkdef.maxweekhours else wk.maxweekhours end as maxweekhours
+ from demo2m17.staffreportperioddays lpd
+ left join demo2m17.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
+ cross join (select * from demo2m17.worktimes where isdefault=true) wkdef
+ where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and lpd.daydate between date('2024-02-26') and date('2024-05-05')
+ order by lpd.daydate ) mh group by id_staff,weekstart
+ ) maxdata on ws.id_staff = maxdata.id_staff and ws.weekstart=maxdata.weekstart
+ left join (
+ select weekstart,id_staff,coalesce(sum(daytracked),'00:00:00'::interval) as weektrackedhours from (
+ select daydate,id_staff,weekstart,case when sum(trackedhours) > '06:00:00'::interval then sum(trackedhours)- '00:30:00'::interval else coalesce(sum(trackedhours),'00:00:00'::interval) end as daytracked from (
+select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from demo2m17.timetracker
+where daydate between date('2024-03-01') and date('2024-04-30') and id_staff ='d8e44d1a-359c-055b-72dc-343c57fdfb76') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
+ ) ttr on ws.weekstart=ttr.weekstart and ws.id_staff=ttr.id_staff;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT pd.id,pd.id_staff,pd.id_reportperiod,pd.daydate,pd.payedpause,pd.daytype,pd.daycomment,
+ vacancycomment,vacillcomment,vacextracomment,recupcomment,otherpaidhourscomment,partunempcomment,
+ pd.daytemplate,pd.vacschoolcomment,rp.viewpartunempl,rp.viewvacschool,
+ date(date_trunc('week',pd.daydate)) as weekstart,
+ to_char(pd.timestart1::interval, 'HH24:MI') AS timestart1,
+ to_char(pd.timeend1::interval, 'HH24:MI') AS timeend1,
+ to_char(pd.timestart2::interval, 'HH24:MI') AS timestart2,
+ to_char(pd.timeend2::interval, 'HH24:MI') AS timeend2,
+ to_char(pd.timepause::interval, 'HH24:MI') AS timepause,
+ -- coalesce('<div class="dspvacancynormal">' || to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN null ELSE pd.vacancyhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyill">' || to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN null else pd.vacillhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyextra">' || to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN null ELSE pd.vacextrahours END::interval, 'HH24:MI') || '</div>','') AS dspvacancyhours,
+ to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacancyhours END::interval, 'HH24:MI') AS vacancyhours,
+ to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacillhours END::interval, 'HH24:MI') AS vacillhours,
+ to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacextrahours END::interval, 'HH24:MI') AS vacextrahours,
+ to_char(CASE WHEN pd.vacschoolhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacschoolhours END::interval, 'HH24:MI') AS vacschoolhours,
+ to_char(CASE WHEN pd.otherpaidhours::interval = '00:00:00'::interval THEN NULL ELSE pd.otherpaidhours END::interval, 'HH24:MI') AS otherpaidhours,
+ to_char(CASE WHEN pd.partunemplhours::interval = '00:00:00'::interval THEN NULL ELSE pd.partunemplhours END::interval, 'HH24:MI') AS partunemplhours,
+ to_char(pd.contracthours::interval, 'HH24:MI') AS contracthours,
+ to_char(CASE WHEN pd.workhours::interval = '00:00:00'::interval THEN NULL ELSE pd.workhours END::interval, 'HH24:MI') AS workhours,
+ to_char(CASE WHEN pd.dayhours::interval = '00:00:00'::interval THEN NULL ELSE pd.dayhours END::interval, 'HH24:MI') AS dayhours,
+ to_char(case WHEN pd.recuperationhours::interval = '00:00:00'::interval THEN NULL ELSE pd.recuperationhours END::interval, 'HH24:MI') AS recuperationhours,
+ to_char(CASE WHEN pd.interruptionhours::interval = '00:00:00'::interval THEN NULL ELSE pd.interruptionhours END::interval, 'HH24:MI') AS interruptionhours,
+ to_char(CASE WHEN pd.nighthours::interval = '00:00:00'::interval THEN NULL ELSE pd.nighthours END::interval, 'HH24:MI') AS nighthours,
+ to_char(pd.pausestart1::interval, 'HH24:MI') AS pausestart1,
+ to_char(pd.pauseend1::interval, 'HH24:MI') AS pauseend1,
+ to_char(pd.pausestart2::interval, 'HH24:MI') AS pausestart2,
+ to_char(pd.pauseend2::interval, 'HH24:MI') AS pauseend2,
+ COALESCE((to_char(pd.pausestart1::interval, 'HH24:MI') || '-') || to_char(pd.pauseend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.pausestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.pausestart2::interval, 'HH24:MI')) || '-') || to_char(pd.pauseend2::interval, 'HH24:MI'), '') AS dsppausedata,
+ COALESCE((to_char(pd.timestart1::interval, 'HH24:MI') || '-') || to_char(pd.timeend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.timestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.timestart2::interval, 'HH24:MI')) || '-') || to_char(pd.timeend2::interval, 'HH24:MI'), '') AS dspworkdata,
+ CASE WHEN max(freehours.freehours) < '00:00:00'::interval THEN NULL ELSE to_char(max(freehours.freehours), 'HH24:MI') END AS freehoursafter,
+ to_char(coalesce(max(wk.defaultdayhours),max(wkstd.defaultdayhours)),'HH24:MI') as defaultdayhours,
+ to_char(coalesce(max(wk.maxdayhours),max(wkstd.maxdayhours)),'HH24:MI') as maxdayhours,
+ to_char(coalesce(max(wk.mindailyrecuperation),max(wkstd.mindailyrecuperation)),'HH24:MI') as mindailyrecuperation,
+ to_char(coalesce(max(wk.maxinterruptionhours),max(wkstd.maxinterruptionhours)),'HH24:MI') as maxinterruptionhours,
+ max(vd.vacancyname) as vacancyname,
+ to_char(max(tt.trackedtime),'HH24:MI') as trackedtime,
+ max(case when tt.trackedtime is null or pd.workhours is null then null else interval_to_char(coalesce(tt.trackedtime::interval,'00:00:00'::interval) - coalesce(pd.workhours::interval,'00:00:00'::interval)) end) as trackeddiff,
+ null as incompletetrack
+ FROM demo2m17.staffreportperioddays pd
+ JOIN demo2m17.staff st ON pd.id_staff = st.id and st.id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and st.isdeleted is null
+ LEFT JOIN ( SELECT yy.id_staff, yy.ndaydate AS daydate,case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend AS tmfrom, yy.daydate + yy.timestart AS tmto,
+ yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend) AS realinterval,
+ date_part('epoch', yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend)) * '00:00:01'::interval AS freehours
+ FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
+ lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
+ xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend
+ FROM ( SELECT sr.id_staff, sr.daydate,
+ CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
+ CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY sr.id_staff, sr.daydate) xx_1) yy) freehours ON pd.id_staff = freehours.id_staff AND freehours.daydate = pd.daydate
+ left join demo2m17.worktimes wk on pd.daydate between wk.startdate and wk.enddate
+ cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from demo2m17.worktimes where isdefault =true) wkstd
+ left join demo2m17.vacancydays vd on pd.daydate=vd.daydate
+ left join demo2m17.reportperiod rp on (pd.id_reportperiod=rp.id)
+ left join (
+ select
+ sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as sumdayall,
+ string_agg(minpauseok::text,'') as minpauses, null as incompletetrack,
+ case when sum(minpauseok) = 0 and sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) >= '06:00:00'::interval then sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) - '00:30:00'::interval else sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) end as trackedtime,daydate from
+ ( select *, tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) as pauseduration,
+ to_char(lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in),'HH24:MI') || '-' || to_char(tx.stamp_in,'HH24:MI') as pausetime,
+ case when tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker tx where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and tx.daydate between date('2024-02-26') and date('2024-05-05')
+ order by tx.stamp_in) tt
+ group by tt.daydate
+ ) tt on pd.daydate=tt.daydate
+ WHERE pd.daydate between date('2024-02-26') and date('2024-05-05')
+ group by pd.id,rp.viewpartunempl,rp.viewvacschool
+ ORDER BY pd.id_staff, pd.daydate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select daydate as datebefore,to_char(case when timestart2 is null then timeend1 else timeend2 end,'HH24:MI') as timeendbefore from demo2m17.staffreportperioddays where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate < date('2024-03-11') and (timestart1 is not null or timestart2 is not null) order by daydate desc limit 1;
+QUERY: select daydate as dateafter ,to_char(case when timestart1 is null then timestart2 else timestart1 end,'HH24:MI') as timestartafter from demo2m17.staffreportperioddays where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate > date('2024-03-11') and (timestart1 is not null or timestart2 is not null) order by daydate asc limit 1;
+QUERY: select weekhours from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and ((date('2024-03-11') between startdate and enddate) or (startdate <= date('2024-03-11') and enddate is null)) order by startdate,enddate nulls first limit 1;
+QUERY: select to_char(wk.maxdayhours,'HH24:MI') as maxdayhours,
+ to_char(wk.maxweekhours,'HH24:MI') as maxweekhours,
+ to_char(wk.maxinterruptionhours,'HH24:MI') as maxinterruptionhours,
+ to_char(wk.mindailyrecuperation,'HH24:MI') as mindailyrecuperation,
+ to_char(wk.defaultweekhours,'HH24:MI') as defaultweekhours,
+ '2024-03-10' as datebefore,
+ '20:40' as timebefore,
+ '2024-03-13' as dateafter,
+ '11:00' as timeafter
+ from demo2m17.worktimes wk where (date('2024-03-11') between wk.startdate and wk.enddate) or (wk.startdate is null and wk.enddate is null) and maxhourspercents is null
+ order by wk.startdate,wk.enddate nulls last limit 1;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: select id,id_staff,daydate,to_char(stamp_in,'HH24:MI') as stamp_in,to_char(stamp_out,'HH24:MI') as stamp_out,
+ case when stamp_in is null or stamp_out is null then null else to_char(stamp_out-stamp_in,'HH24:MI') end as total,tracktype, to_char(stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') as pauseduration,
+ to_char(lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') || '-' || to_char(stamp_in,'HH24:MI') as pausetime,
+ case when stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker where daydate=date('2024-03-11') and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by stamp_in,stamp_out;
+QUERYARRAY: select id,id_staff,daydate,to_char(stamp_in,'HH24:MI') as stamp_in,to_char(stamp_out,'HH24:MI') as stamp_out,
+ case when stamp_in is null or stamp_out is null then null else to_char(stamp_out-stamp_in,'HH24:MI') end as total,tracktype, to_char(stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') as pauseduration,
+ to_char(lag(stamp_out) over (partition by id_staff,daydate order by stamp_in),'HH24:MI') || '-' || to_char(stamp_in,'HH24:MI') as pausetime,
+ case when stamp_in - lag(stamp_out) over (partition by id_staff,daydate order by stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker where daydate=date('2024-03-11') and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by stamp_in,stamp_out;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+EXEC: update demo2m17.staffreportperioddays set timestart1 = null, timeend1 =null, timestart2 = null, timeend2 = null, pausestart1 = null, pauseend1 =null, pausestart2 = null, pauseend2 = null, timepause = null, vacancyhours = null, vacillhours = null, vacextrahours = null, otherpaidhours = null, partunemplhours= null, recuperationhours = null, workhours=null, dayhours=null,vacancycomment=null,vacillcomment=null,vacextracomment=null,recupcomment=null,otherpaidhourscomment=null,partunempcomment=null, daytemplate=null where id in ('7e9fb347-c3b2-7a06-030e-b8cb03b0e7cd');
+EXEC: update demo2m17.staffreportperioddays spds set
+ workhours=ds.worktime, timepause=case when ds.timepause::interval > '00:00:00' then ds.timepause else null end,
+ dayhours=(ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours )::interval, interruptionhours = ds.interruption ,
+ contracthours=case when ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours::interval > '00:00:00'::interval then ds.wdcontracthours else null end
+ from (
+ select preds.id,case when preds.recuperationhours is null then '00:00:00'::interval else preds.recuperationhours::interval end as recup,
+ case when preds.vacancyhours is null then '00:00:00'::time else preds.vacancyhours end as vachours,
+ case when preds.vacillhours is null then '00:00:00'::time else preds.vacillhours end as vacillhours,
+ case when preds.vacextrahours is null then '00:00:00'::time else preds.vacextrahours end as vacextrahours,
+ case when preds.otherpaidhours is null then '00:00:00'::time else preds.otherpaidhours end as otherpaidhours,
+ case when preds.partunemplhours is null then '00:00:00'::time else preds.partunemplhours end as partunemplhours,
+ preds.interruption,
+ (preds.dt1+preds.dt2)-(preds.pdt1+preds.pdt2) as worktime,
+ (preds.pdt1+preds.pdt2) as timepause,
+ wdcontracthours
+ from ( select id, recuperationhours,vacancyhours,vacillhours,vacextrahours,otherpaidhours,payedpause,partunemplhours,nighthours,
+ case when timestart1 is not null and timeend1 is not null then case when timeend1 < timestart1 then '24:00:00'::interval + timeend1::interval - timestart1::interval else timeend1::interval - timestart1::interval end else '00:00:00'::interval end as dt1,
+ case when timestart2 is not null and timeend2 is not null then case when timeend2 < timestart2 then '24:00:00'::interval + timeend2::interval - timestart2::interval else timeend2::interval - timestart2::interval end else '00:00:00'::interval end as dt2,
+ case when pausestart1 between timestart1 and case when timeend1 < timestart1 then timeend1::interval + '24:00:00'::interval else timeend1::interval end and pauseend1 between timestart1 and case when timeend1 < timestart1 then timeend1::interval + '24:00:00'::interval else timeend1::interval end then case when pauseend1 < pausestart1 then '24:00:00'::interval + pauseend1::interval - pausestart1::interval else pauseend1::interval - pausestart1::interval end else '00:00:00'::interval end as pdt1,
+ case when pausestart1 between timestart2 and case when timeend2 < timestart2 then timeend2::interval + '24:00:00'::interval else timeend2::interval end and pauseend2 between timestart2 and case when timeend2 < timestart2 then timeend2::interval + '24:00:00'::interval else timeend2::interval end then case when pauseend2 < pausestart2 then '24:00:00'::interval + pauseend2::interval - pausestart2::interval else pauseend2::interval - pausestart2::interval end else '00:00:00'::interval end as pdt2,
+ case when timestart2 is not null and timeend1 is not null and timestart1 is not null and timeend2 is not null then
+ timestart2::interval - timeend1::interval
+ else null end as interruption,
+ wdcontracthours
+ from demo2m17.staffreportperioddays where id in ('7e9fb347-c3b2-7a06-030e-b8cb03b0e7cd')
+ ) preds) ds where spds.id=ds.id;
+EXEC: update demo2m17.staffreportperioddays SET nighthours = null where id in ('7e9fb347-c3b2-7a06-030e-b8cb03b0e7cd');
+EXEC: update demo2m17.staffreportperioddays spds set
+ nighthours=nh from (
+ select id,daydate,timestart1,timeend1, timestart2,timeend2,
+ coalesce((case when timeend1 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend1::interval end) -
+ (case when timestart1 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart1::interval end),'00:00:00'::interval)
+ + coalesce((case when timeend2 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend2::interval end) -
+ (case when timestart2 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart2::interval end),'00:00:00'::interval) as nh
+ from demo2m17.staffreportperioddays s where
+ (timeend1 between '01:00:01' and '05:59:59' or timeend2 between '01:00:01' and '05:59:59'
+ or timestart1 between '01:00:01' and '05:59:59' or timestart2 between '01:00:01' and '05:59:59')
+ and id in ('7e9fb347-c3b2-7a06-030e-b8cb03b0e7cd')
+ ) ds
+ where spds.id=ds.id
+QUERY: select date(date_trunc('year',startdate)) as yearstart ,* from demo2m17.reportperiod where id='351cf732-61ee-8ad4-47fb-78b63159cacb';
+EXEC: update demo2m17.staffreportperioddays spds set
+ workhours=ds.worktime, timepause=case when ds.timepause::interval > '00:00:00' then ds.timepause else null end,
+ dayhours=(ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours )::interval, interruptionhours = ds.interruption ,
+ contracthours=case when ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours::interval > '00:00:00'::interval then ds.wdcontracthours else null end
+ from (
+ select preds.id,case when preds.recuperationhours is null then '00:00:00'::interval else preds.recuperationhours::interval end as recup,
+ case when preds.vacancyhours is null then '00:00:00'::time else preds.vacancyhours end as vachours,
+ case when preds.vacillhours is null then '00:00:00'::time else preds.vacillhours end as vacillhours,
+ case when preds.vacextrahours is null then '00:00:00'::time else preds.vacextrahours end as vacextrahours,
+ case when preds.otherpaidhours is null then '00:00:00'::time else preds.otherpaidhours end as otherpaidhours,
+ case when preds.partunemplhours is null then '00:00:00'::time else preds.partunemplhours end as partunemplhours,
+ preds.interruption,
+ (preds.dt1+preds.dt2)-(preds.pdt1+preds.pdt2) as worktime,
+ (preds.pdt1+preds.pdt2) as timepause,
+ wdcontracthours
+ from ( select id, recuperationhours,vacancyhours,vacillhours,vacextrahours,otherpaidhours,payedpause,partunemplhours,nighthours,
+ case when timestart1 is not null and timeend1 is not null then case when timeend1 < timestart1 then '24:00:00'::interval + timeend1::interval - timestart1::interval else timeend1::interval - timestart1::interval end else '00:00:00'::interval end as dt1,
+ case when timestart2 is not null and timeend2 is not null then case when timeend2 < timestart2 then '24:00:00'::interval + timeend2::interval - timestart2::interval else timeend2::interval - timestart2::interval end else '00:00:00'::interval end as dt2,
+ case when pausestart1 between timestart1 and case when timeend1 < timestart1 then timeend1::interval + '24:00:00'::interval else timeend1::interval end and pauseend1 between timestart1 and case when timeend1 < timestart1 then timeend1::interval + '24:00:00'::interval else timeend1::interval end then case when pauseend1 < pausestart1 then '24:00:00'::interval + pauseend1::interval - pausestart1::interval else pauseend1::interval - pausestart1::interval end else '00:00:00'::interval end as pdt1,
+ case when pausestart1 between timestart2 and case when timeend2 < timestart2 then timeend2::interval + '24:00:00'::interval else timeend2::interval end and pauseend2 between timestart2 and case when timeend2 < timestart2 then timeend2::interval + '24:00:00'::interval else timeend2::interval end then case when pauseend2 < pausestart2 then '24:00:00'::interval + pauseend2::interval - pausestart2::interval else pauseend2::interval - pausestart2::interval end else '00:00:00'::interval end as pdt2,
+ case when timestart2 is not null and timeend1 is not null and timestart1 is not null and timeend2 is not null then
+ timestart2::interval - timeend1::interval
+ else null end as interruption,
+ wdcontracthours
+ from demo2m17.staffreportperioddays where id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days'))
+ ) preds) ds where spds.id=ds.id;
+EXEC: update demo2m17.staffreportperioddays SET nighthours = null where id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days'));
+EXEC: update demo2m17.staffreportperioddays spds set
+ nighthours=nh from (
+ select id,daydate,timestart1,timeend1, timestart2,timeend2,
+ coalesce((case when timeend1 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend1::interval end) -
+ (case when timestart1 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart1::interval end),'00:00:00'::interval)
+ + coalesce((case when timeend2 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend2::interval end) -
+ (case when timestart2 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart2::interval end),'00:00:00'::interval) as nh
+ from demo2m17.staffreportperioddays s where
+ (timeend1 between '01:00:01' and '05:59:59' or timeend2 between '01:00:01' and '05:59:59'
+ or timestart1 between '01:00:01' and '05:59:59' or timestart2 between '01:00:01' and '05:59:59')
+ and id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days'))
+ ) ds
+ where spds.id=ds.id
+QUERY: select max(rowx) as statussuncount, sum(modx) as suppvacancysunwork from (
+ select daydate,rowx, case when mod(rowx,20) = 0 then 2 else null end as modx from (
+ select daydate,row_number() over (order by daydate) as rowx from demo2m17.staffreportperioddays
+ where daydate between date('2024-01-01') and date('2024-12-31')
+ and date_part('isodow',daydate)::int4 = 7 and workhours > '00:00:00'::time
+ and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by daydate
+ ) xsunday where daydate between date('2024-03-01') and date('2024-04-30')
+ ) sunresult;
+QUERY: select id_period, case when sum(plusdays) over (order by startdate) >= 6 then 2 else case when plusdays = 0 then null else plusdays end end as plusdays from (
+ select id_period,sum(week44s) as plusdays,startdate from (
+ select weekstart,case when (sum(sumx) over (order by weekstart)%8)::integer = 0 then 0 else 1 end as week44s,r.id as id_period,r.startdate,r.enddate from (
+ select weekstart,case when sum(cnt44) > 0 then 0 else 1 end as sumx,
+ max(daydate) as maxdate from (
+ SELECT date(date_trunc('week',yy.daydate)) as weekstart,daydate, dayhours,
+ (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2024-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) as xx,yy.timestart,yy.ntimeend,
+ case when (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2024-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) >= '44:00:00'::interval then 1 else 0 end as cnt44
+ FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
+ lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
+ xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend,xx_1.dayhours
+ FROM ( SELECT sr.id_staff, sr.daydate,sr.dayhours,
+ CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
+ CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and sr.daydate between date('2024-01-01') and date(date_trunc('week',date('2024-01-01') + interval '1 year') - interval '1 day')
+ and sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone
+ and (sr.timestart1 IS NOT null or sr.timestart2 IS NOT null)
+ ORDER BY sr.id_staff, sr.daydate) xx_1) yy order by yy.daydate,weekstart
+ ) aa group by aa.weekstart order by weekstart
+
+ ) bb
+ join demo2m17.reportperiod r on (bb.weekstart between r.startdate and r.enddate)
+ group by weekstart,r.id,bb.sumx order by weekstart
+
+ ) ff group by id_period,startdate) ss
+ where id_period='351cf732-61ee-8ad4-47fb-78b63159cacb'
+ group by id_period,startdate,ss.plusdays;
+QUERY: select weekstart,id_staff,avgtotalhours from (
+ select ws.weekstart, ws.id_staff,
+ AVG(ws.totalhours) over (order by ws.weekstart) as avgtotalhours
+ from (
+ SELECT weekstart, id_staff,
+sum(CASE WHEN srpd.dayhours IS NULL THEN '00:00:00'::interval ELSE srpd.dayhours::interval END) AS totalhours
+ FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
+ date(date_trunc('week', daydate) + interval '6 days') AS weekend,
+ date_part('week', daydate) AS calweek,
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days')
+ --where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-03-01') and date('2024-04-30')
+ ) srpd GROUP BY srpd.weekstart,srpd.id_staff
+ ORDER BY weekstart) ws) wsavg order by weekstart DESC LIMIT 1;
+EXEC: update demo2m17.staffreportperiod rpd set
+ --contracthours=csp.contracthours,
+ workhours=csp.workhours,
+ vacancyill=csp.vacillhours,
+ vacancynormal=csp.vacancynormal,
+ vacancyextra=csp.vacextrahours,
+ otherpaidhours=csp.otherpaidhours,
+ partunemplhours=csp.partunemplhours,
+ totalhours=csp.totalhours,
+ nighthours=csp.nighthours,
+ recuperationhours=csp.recuperationhours,statussuncount=9,suppvacancysunwork=null,suppvacancy44hours=2,status44hcount=null,last44date=null,avgtotalweekhours=null,hoursdiff=csp.diffhours
+ FROM (
+ select contracthours,workhours,totalhours,recuperationhours, totalhours-contracthours as diffhours,id,vacillhours,vacancynormal,vacextrahours,otherpaidhours,partunemplhours,nighthours from (
+ select dp.id,
+ sum(pd.workhours) as workhours,
+ sum(pd.dayhours) as totalhours,
+ sum(coalesce(pd.nighthours,'00:00:00'::interval)) as nighthours,
+ sum(coalesce(pd.vacancyhours,'00:00:00'::time)) as vacancynormal,
+ sum(coalesce(pd.vacillhours,'00:00:00'::time)) as vacillhours,
+ sum(coalesce(pd.vacextrahours,'00:00:00'::time)) as vacextrahours,
+ sum(coalesce(pd.otherpaidhours,'00:00:00'::time)) as otherpaidhours,
+ sum(coalesce(pd.partunemplhours,'00:00:00'::time)) as partunemplhours,
+ sum(coalesce(pd.recuperationhours,'00:00:00'::time)) as recuperationhours,
+ coalesce(dp.contracthours,'00:00:00'::interval) as contracthours,
+ coalesce(dp.payedhours0,'00:00:00'::interval) as payedhours0,
+ coalesce(dp.payedhours40,'00:00:00'::interval) as payedhours40,
+ coalesce(dp.transferedhours,'00:00:00'::interval) as transferedhours
+ from demo2m17.staffreportperioddays pd
+ join demo2m17.staffreportperiod dp on (pd.id_staff=dp.id_staff and dp.id_reportperiod = '351cf732-61ee-8ad4-47fb-78b63159cacb')
+ where pd.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and pd.daydate between date('2024-03-01') and date('2024-04-30')
+ group by dp.id,dp.payedhours,dp.transferedhourscalc
+ ) rp) csp where csp.id=rpd.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ --to_char(srp.vacancyhours, 'HH24:MI'::text) AS vacancyhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from demo2m17.reportperiod where id='351cf732-61ee-8ad4-47fb-78b63159cacb'
+QUERYBYKEY: select ws.weekstart,ws.weekend,ws.calweek,ws.calyear, ws.id_staff
+ ,to_char(ws.workhours::interval,'HH24:MI') as workhours
+ ,to_char(ws.vacancyhours,'HH24:MI') as vacancynormal
+ ,to_char(ws.vacillhours,'HH24:MI') as vacancyill
+ ,to_char(ws.vacextrahours,'HH24:MI') as vacancyextra
+ ,to_char(ws.vacschoolhours,'HH24:MI') as vacancyschool
+ ,to_char(ws.otherpaidhours,'HH24:MI') as otherpaidhours
+ ,to_char(ws.partunemplhours,'HH24:MI') as partunemplhours
+ ,to_char(ws.recuperationhours,'HH24:MI') as recuperationhours
+ ,to_char(ws.totalhours,'HH24:MI') as totalhours
+ ,cd.contractworkdays
+ ,cd.cmpcontractdays
+ ,cd.cmpweekhours
+ ,to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval),'HH24:MI') as weektrackedhours
+ ,ws.periodworkhours
+ ,interval_to_char(sum(coalesce(ttr.weektrackedhours,'00:00:00'::interval)) over (order by ws.weekstart) - sum(ws.periodworkhours::interval) over (order by ws.weekstart)) as periodtrackdiff
+ ,sum(ws.workhours::interval) over (order by ws.weekstart) as runningworkhours
+ ,interval_to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval) - ws.periodworkhours::interval) as trackeddiff
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else to_char(cd.contracthours,'HH24:MI') end as contracthours
+ ,to_char(AVG(ws.totalhours) over (order by ws.weekstart),'HH24:MI') as avgtotalhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then '00:00' else interval_to_char(ws.totalhours-cd.contracthours) end as diffhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then
+ to_char(case when cd.cmpweekhours < '40:00:00'::interval then cd.contracthours * 1.15 * cd.contractworkdays else (cd.contractworkdays*'08:00:00'::interval) + (cd.contractworkdays* case when maxdata.maxweekhours > '48:00:00' then '01:16:50'::interval else '00:50:00'::interval end) end,'HH24:MI')
+ else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours * 1.15 else maxdata.maxweekhours end,'HH24:MI')
+ end as maxweekhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours else maxdata.defaultweekhours end,'HH24:MI')
+ end as defaultweekhours
+ from (
+ SELECT weekstart,weekend,calweek,calyear, id_staff,
+ sum(CASE WHEN srpd.workhours IS NULL THEN '00:00:00'::interval ELSE srpd.workhours::interval END) AS workhours,
+ sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
+ --sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
+ sum(CASE WHEN srpd.vacancyhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacancyhours::interval END) AS vacancyhours,
+ sum(CASE WHEN srpd.vacillhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacillhours::interval END) AS vacillhours,
+ sum(CASE WHEN srpd.vacextrahours IS NULL THEN '00:00:00'::interval ELSE srpd.vacextrahours::interval END) AS vacextrahours,
+ sum(CASE WHEN srpd.vacschoolhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacschoolhours::interval END) AS vacschoolhours,
+ sum(CASE WHEN srpd.recuperationhours IS NULL THEN '00:00:00'::interval ELSE srpd.recuperationhours::interval END) AS recuperationhours,
+ sum(CASE WHEN srpd.otherpaidhours IS NULL THEN '00:00:00'::interval ELSE srpd.otherpaidhours::interval END) AS otherpaidhours,
+ sum(CASE WHEN srpd.partunemplhours IS NULL THEN '00:00:00'::interval ELSE srpd.partunemplhours::interval END) AS partunemplhours,
+ sum(CASE WHEN srpd.dayhours IS NULL THEN '00:00:00'::interval ELSE srpd.dayhours::interval END) AS totalhours,
+ sum(CASE WHEN srpd.workhours > '00:00:00'::time without time zone OR srpd.recuperationhours > '00:00:00'::time without time zone OR srpd.vacancyhours > '00:00:00'::time without time zone OR srpd.vacillhours > '00:00:00'::time without time zone OR srpd.vacextrahours > '00:00:00'::time without time zone OR srpd.vacschoolhours > '00:00:00'::time without time zone OR srpd.otherpaidhours > '00:00:00'::time without time zone or srpd.partunemplhours > '00:00:00'::time without time zone THEN 1 ELSE 0 END) AS workdays,
+ sum( CASE WHEN srpd.contracthours IS NULL THEN '00:00:00'::interval ELSE srpd.contracthours::interval END) AS contracthours
+ FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
+ date(date_trunc('week', daydate) + interval '6 days') AS weekend,
+ date_part('week', daydate) AS calweek,
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-02-26') and date('2024-05-05')
+ ) srpd GROUP BY srpd.weekstart,srpd.weekend,srpd.calweek,srpd.calyear,srpd.id_staff
+ ORDER BY weekstart) ws left join (
+ select date(date_trunc('week',pd.daydate)) as weekstart,pd.id_staff,max(sc.weekdays) as cmpcontractdays,max(sc.weekhours) as cmpweekhours,
+ case when count(pd.daydate) < avg(sc.weekdays) then count(pd.daydate) else avg(sc.weekdays) end as contractworkdays,
+ case when count(pd.daydate) < avg(sc.weekdays) then avg(sc.weekhours/ sc.weekdays) * count(pd.daydate) else avg(sc.weekhours/ sc.weekdays) * avg(sc.weekdays) end as contracthours ,sum(case when coalesce(pd.workhours,'00:00:00'::time) > '00:00:00'::time then 1 else 0 end) as realworkdays
+ from ( select id_staff,weekdays ,weekhours,
+ case when startdate> date('2024-02-26') then startdate else date('2024-02-26') end as staffperiodstart,
+ case when enddate is null or enddate > date('2024-05-05') then date('2024-05-05')
+ else enddate end as staffperiodend from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ and startdate < date('2024-05-05')
+ ) sc
+ join demo2m17.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
+ group by date(date_trunc('week',pd.daydate)),pd.id_staff
+ ) cd on ws.id_staff = cd.id_staff and ws.weekstart=cd.weekstart
+ left join (
+ select id_staff,weekstart,max(defaultweekhours) as defaultweekhours,avg(maxweekhours) as maxweekhours from (
+ select lpd.id_staff,date(date_trunc('week',lpd.daydate)) as weekstart,lpd.daydate,
+ case when wk.defaultweekhours is null then wkdef.defaultweekhours else wk.defaultweekhours end as defaultweekhours ,
+ case when wk.maxweekhours is null then wkdef.maxweekhours else wk.maxweekhours end as maxweekhours
+ from demo2m17.staffreportperioddays lpd
+ left join demo2m17.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
+ cross join (select * from demo2m17.worktimes where isdefault=true) wkdef
+ where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and lpd.daydate between date('2024-02-26') and date('2024-05-05')
+ order by lpd.daydate ) mh group by id_staff,weekstart
+ ) maxdata on ws.id_staff = maxdata.id_staff and ws.weekstart=maxdata.weekstart
+ left join (
+ select weekstart,id_staff,coalesce(sum(daytracked),'00:00:00'::interval) as weektrackedhours from (
+ select daydate,id_staff,weekstart,case when sum(trackedhours) > '06:00:00'::interval then sum(trackedhours)- '00:30:00'::interval else coalesce(sum(trackedhours),'00:00:00'::interval) end as daytracked from (
+select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from demo2m17.timetracker
+where daydate between date('2024-03-01') and date('2024-04-30') and id_staff ='d8e44d1a-359c-055b-72dc-343c57fdfb76') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
+ ) ttr on ws.weekstart=ttr.weekstart and ws.id_staff=ttr.id_staff;
+QUERY: select date(date_trunc('year',startdate)) as yearstart ,* from demo2m17.reportperiod where id='351cf732-61ee-8ad4-47fb-78b63159cacb';
+EXEC: update demo2m17.staffreportperioddays spds set
+ workhours=ds.worktime, timepause=case when ds.timepause::interval > '00:00:00' then ds.timepause else null end,
+ dayhours=(ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours )::interval, interruptionhours = ds.interruption ,
+ contracthours=case when ds.worktime::interval + ds.vachours::interval + ds.vacillhours::interval + ds.vacextrahours::interval + ds.otherpaidhours::interval + ds.recup::interval + ds.partunemplhours::interval > '00:00:00'::interval then ds.wdcontracthours else null end
+ from (
+ select preds.id,case when preds.recuperationhours is null then '00:00:00'::interval else preds.recuperationhours::interval end as recup,
+ case when preds.vacancyhours is null then '00:00:00'::time else preds.vacancyhours end as vachours,
+ case when preds.vacillhours is null then '00:00:00'::time else preds.vacillhours end as vacillhours,
+ case when preds.vacextrahours is null then '00:00:00'::time else preds.vacextrahours end as vacextrahours,
+ case when preds.otherpaidhours is null then '00:00:00'::time else preds.otherpaidhours end as otherpaidhours,
+ case when preds.partunemplhours is null then '00:00:00'::time else preds.partunemplhours end as partunemplhours,
+ preds.interruption,
+ (preds.dt1+preds.dt2)-(preds.pdt1+preds.pdt2) as worktime,
+ (preds.pdt1+preds.pdt2) as timepause,
+ wdcontracthours
+ from ( select id, recuperationhours,vacancyhours,vacillhours,vacextrahours,otherpaidhours,payedpause,partunemplhours,nighthours,
+ case when timestart1 is not null and timeend1 is not null then case when timeend1 < timestart1 then '24:00:00'::interval + timeend1::interval - timestart1::interval else timeend1::interval - timestart1::interval end else '00:00:00'::interval end as dt1,
+ case when timestart2 is not null and timeend2 is not null then case when timeend2 < timestart2 then '24:00:00'::interval + timeend2::interval - timestart2::interval else timeend2::interval - timestart2::interval end else '00:00:00'::interval end as dt2,
+ case when pausestart1 between timestart1 and case when timeend1 < timestart1 then timeend1::interval + '24:00:00'::interval else timeend1::interval end and pauseend1 between timestart1 and case when timeend1 < timestart1 then timeend1::interval + '24:00:00'::interval else timeend1::interval end then case when pauseend1 < pausestart1 then '24:00:00'::interval + pauseend1::interval - pausestart1::interval else pauseend1::interval - pausestart1::interval end else '00:00:00'::interval end as pdt1,
+ case when pausestart1 between timestart2 and case when timeend2 < timestart2 then timeend2::interval + '24:00:00'::interval else timeend2::interval end and pauseend2 between timestart2 and case when timeend2 < timestart2 then timeend2::interval + '24:00:00'::interval else timeend2::interval end then case when pauseend2 < pausestart2 then '24:00:00'::interval + pauseend2::interval - pausestart2::interval else pauseend2::interval - pausestart2::interval end else '00:00:00'::interval end as pdt2,
+ case when timestart2 is not null and timeend1 is not null and timestart1 is not null and timeend2 is not null then
+ timestart2::interval - timeend1::interval
+ else null end as interruption,
+ wdcontracthours
+ from demo2m17.staffreportperioddays where id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days'))
+ ) preds) ds where spds.id=ds.id;
+EXEC: update demo2m17.staffreportperioddays SET nighthours = null where id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days'));
+EXEC: update demo2m17.staffreportperioddays spds set
+ nighthours=nh from (
+ select id,daydate,timestart1,timeend1, timestart2,timeend2,
+ coalesce((case when timeend1 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend1::interval end) -
+ (case when timestart1 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart1::interval end),'00:00:00'::interval)
+ + coalesce((case when timeend2 not between '01:00:01'::interval and '05:59:59'::interval then '06:00:00'::interval else timeend2::interval end) -
+ (case when timestart2 not between '01:00:01'::interval and '05:59:59'::interval then '01:00:00'::interval else timestart2::interval end),'00:00:00'::interval) as nh
+ from demo2m17.staffreportperioddays s where
+ (timeend1 between '01:00:01' and '05:59:59' or timeend2 between '01:00:01' and '05:59:59'
+ or timestart1 between '01:00:01' and '05:59:59' or timestart2 between '01:00:01' and '05:59:59')
+ and id in (select id from demo2m17.staffreportperioddays where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days'))
+ ) ds
+ where spds.id=ds.id
+QUERY: select max(rowx) as statussuncount, sum(modx) as suppvacancysunwork from (
+ select daydate,rowx, case when mod(rowx,20) = 0 then 2 else null end as modx from (
+ select daydate,row_number() over (order by daydate) as rowx from demo2m17.staffreportperioddays
+ where daydate between date('2024-01-01') and date('2024-12-31')
+ and date_part('isodow',daydate)::int4 = 7 and workhours > '00:00:00'::time
+ and id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' order by daydate
+ ) xsunday where daydate between date('2024-03-01') and date('2024-04-30')
+ ) sunresult;
+QUERY: select id_period, case when sum(plusdays) over (order by startdate) >= 6 then 2 else case when plusdays = 0 then null else plusdays end end as plusdays from (
+ select id_period,sum(week44s) as plusdays,startdate from (
+ select weekstart,case when (sum(sumx) over (order by weekstart)%8)::integer = 0 then 0 else 1 end as week44s,r.id as id_period,r.startdate,r.enddate from (
+ select weekstart,case when sum(cnt44) > 0 then 0 else 1 end as sumx,
+ max(daydate) as maxdate from (
+ SELECT date(date_trunc('week',yy.daydate)) as weekstart,daydate, dayhours,
+ (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2024-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) as xx,yy.timestart,yy.ntimeend,
+ case when (date_part('epoch', yy.daydate + yy.timestart - (coalesce(yy.ndaydate,date('2024-01-01')) + coalesce(yy.ntimeend,'00:00:00'::time without time zone))) * '00:00:01'::interval) >= '44:00:00'::interval then 1 else 0 end as cnt44
+ FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
+ lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
+ xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend,xx_1.dayhours
+ FROM ( SELECT sr.id_staff, sr.daydate,sr.dayhours,
+ CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
+ CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and sr.daydate between date('2024-01-01') and date(date_trunc('week',date('2024-01-01') + interval '1 year') - interval '1 day')
+ and sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone
+ and (sr.timestart1 IS NOT null or sr.timestart2 IS NOT null)
+ ORDER BY sr.id_staff, sr.daydate) xx_1) yy order by yy.daydate,weekstart
+ ) aa group by aa.weekstart order by weekstart
+
+ ) bb
+ join demo2m17.reportperiod r on (bb.weekstart between r.startdate and r.enddate)
+ group by weekstart,r.id,bb.sumx order by weekstart
+
+ ) ff group by id_period,startdate) ss
+ where id_period='351cf732-61ee-8ad4-47fb-78b63159cacb'
+ group by id_period,startdate,ss.plusdays;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select weekstart,id_staff,avgtotalhours from (
+ select ws.weekstart, ws.id_staff,
+ AVG(ws.totalhours) over (order by ws.weekstart) as avgtotalhours
+ from (
+ SELECT weekstart, id_staff,
+sum(CASE WHEN srpd.dayhours IS NULL THEN '00:00:00'::interval ELSE srpd.dayhours::interval END) AS totalhours
+ FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
+ date(date_trunc('week', daydate) + interval '6 days') AS weekend,
+ date_part('week', daydate) AS calweek,
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date(date_trunc('week',date('2024-03-01'))) and date(date_trunc('week',date('2024-04-30')) + interval '6 days')
+ --where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-03-01') and date('2024-04-30')
+ ) srpd GROUP BY srpd.weekstart,srpd.id_staff
+ ORDER BY weekstart) ws) wsavg order by weekstart DESC LIMIT 1;
+QUERYARRAY: SELECT pd.id,pd.id_staff,pd.id_reportperiod,pd.daydate,pd.payedpause,pd.daytype,pd.daycomment,
+ vacancycomment,vacillcomment,vacextracomment,recupcomment,otherpaidhourscomment,partunempcomment,
+ pd.daytemplate,pd.vacschoolcomment,rp.viewpartunempl,rp.viewvacschool,
+ date(date_trunc('week',pd.daydate)) as weekstart,
+ to_char(pd.timestart1::interval, 'HH24:MI') AS timestart1,
+ to_char(pd.timeend1::interval, 'HH24:MI') AS timeend1,
+ to_char(pd.timestart2::interval, 'HH24:MI') AS timestart2,
+ to_char(pd.timeend2::interval, 'HH24:MI') AS timeend2,
+ to_char(pd.timepause::interval, 'HH24:MI') AS timepause,
+ -- coalesce('<div class="dspvacancynormal">' || to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN null ELSE pd.vacancyhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyill">' || to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN null else pd.vacillhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyextra">' || to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN null ELSE pd.vacextrahours END::interval, 'HH24:MI') || '</div>','') AS dspvacancyhours,
+ to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacancyhours END::interval, 'HH24:MI') AS vacancyhours,
+ to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacillhours END::interval, 'HH24:MI') AS vacillhours,
+ to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacextrahours END::interval, 'HH24:MI') AS vacextrahours,
+ to_char(CASE WHEN pd.vacschoolhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacschoolhours END::interval, 'HH24:MI') AS vacschoolhours,
+ to_char(CASE WHEN pd.otherpaidhours::interval = '00:00:00'::interval THEN NULL ELSE pd.otherpaidhours END::interval, 'HH24:MI') AS otherpaidhours,
+ to_char(CASE WHEN pd.partunemplhours::interval = '00:00:00'::interval THEN NULL ELSE pd.partunemplhours END::interval, 'HH24:MI') AS partunemplhours,
+ to_char(pd.contracthours::interval, 'HH24:MI') AS contracthours,
+ to_char(CASE WHEN pd.workhours::interval = '00:00:00'::interval THEN NULL ELSE pd.workhours END::interval, 'HH24:MI') AS workhours,
+ to_char(CASE WHEN pd.dayhours::interval = '00:00:00'::interval THEN NULL ELSE pd.dayhours END::interval, 'HH24:MI') AS dayhours,
+ to_char(case WHEN pd.recuperationhours::interval = '00:00:00'::interval THEN NULL ELSE pd.recuperationhours END::interval, 'HH24:MI') AS recuperationhours,
+ to_char(CASE WHEN pd.interruptionhours::interval = '00:00:00'::interval THEN NULL ELSE pd.interruptionhours END::interval, 'HH24:MI') AS interruptionhours,
+ to_char(CASE WHEN pd.nighthours::interval = '00:00:00'::interval THEN NULL ELSE pd.nighthours END::interval, 'HH24:MI') AS nighthours,
+ to_char(pd.pausestart1::interval, 'HH24:MI') AS pausestart1,
+ to_char(pd.pauseend1::interval, 'HH24:MI') AS pauseend1,
+ to_char(pd.pausestart2::interval, 'HH24:MI') AS pausestart2,
+ to_char(pd.pauseend2::interval, 'HH24:MI') AS pauseend2,
+ COALESCE((to_char(pd.pausestart1::interval, 'HH24:MI') || '-') || to_char(pd.pauseend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.pausestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.pausestart2::interval, 'HH24:MI')) || '-') || to_char(pd.pauseend2::interval, 'HH24:MI'), '') AS dsppausedata,
+ COALESCE((to_char(pd.timestart1::interval, 'HH24:MI') || '-') || to_char(pd.timeend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.timestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.timestart2::interval, 'HH24:MI')) || '-') || to_char(pd.timeend2::interval, 'HH24:MI'), '') AS dspworkdata,
+ CASE WHEN max(freehours.freehours) < '00:00:00'::interval THEN NULL ELSE to_char(max(freehours.freehours), 'HH24:MI') END AS freehoursafter,
+ to_char(coalesce(max(wk.defaultdayhours),max(wkstd.defaultdayhours)),'HH24:MI') as defaultdayhours,
+ to_char(coalesce(max(wk.maxdayhours),max(wkstd.maxdayhours)),'HH24:MI') as maxdayhours,
+ to_char(coalesce(max(wk.mindailyrecuperation),max(wkstd.mindailyrecuperation)),'HH24:MI') as mindailyrecuperation,
+ to_char(coalesce(max(wk.maxinterruptionhours),max(wkstd.maxinterruptionhours)),'HH24:MI') as maxinterruptionhours,
+ max(vd.vacancyname) as vacancyname,
+ to_char(max(tt.trackedtime),'HH24:MI') as trackedtime,
+ max(case when tt.trackedtime is null or pd.workhours is null then null else interval_to_char(coalesce(tt.trackedtime::interval,'00:00:00'::interval) - coalesce(pd.workhours::interval,'00:00:00'::interval)) end) as trackeddiff,
+ null as incompletetrack
+ FROM demo2m17.staffreportperioddays pd
+ JOIN demo2m17.staff st ON pd.id_staff = st.id and st.id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and st.isdeleted is null
+ LEFT JOIN ( SELECT yy.id_staff, yy.ndaydate AS daydate,case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend AS tmfrom, yy.daydate + yy.timestart AS tmto,
+ yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend) AS realinterval,
+ date_part('epoch', yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend)) * '00:00:01'::interval AS freehours
+ FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
+ lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
+ xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend
+ FROM ( SELECT sr.id_staff, sr.daydate,
+ CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
+ CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY sr.id_staff, sr.daydate) xx_1) yy) freehours ON pd.id_staff = freehours.id_staff AND freehours.daydate = pd.daydate
+ left join demo2m17.worktimes wk on pd.daydate between wk.startdate and wk.enddate
+ cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from demo2m17.worktimes where isdefault =true) wkstd
+ left join demo2m17.vacancydays vd on pd.daydate=vd.daydate
+ left join demo2m17.reportperiod rp on (pd.id_reportperiod=rp.id)
+ left join (
+ select
+ sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as sumdayall,
+ string_agg(minpauseok::text,'') as minpauses, null as incompletetrack,
+ case when sum(minpauseok) = 0 and sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) >= '06:00:00'::interval then sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) - '00:30:00'::interval else sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) end as trackedtime,daydate from
+ ( select *, tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) as pauseduration,
+ to_char(lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in),'HH24:MI') || '-' || to_char(tx.stamp_in,'HH24:MI') as pausetime,
+ case when tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker tx where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and tx.daydate between date('2024-02-26') and date('2024-05-05')
+ order by tx.stamp_in) tt
+ group by tt.daydate
+ ) tt on pd.daydate=tt.daydate
+ WHERE pd.daydate between date('2024-02-26') and date('2024-05-05')
+ group by pd.id,rp.viewpartunempl,rp.viewvacschool
+ ORDER BY pd.id_staff, pd.daydate;
+EXEC: update demo2m17.staffreportperiod rpd set
+ --contracthours=csp.contracthours,
+ workhours=csp.workhours,
+ vacancyill=csp.vacillhours,
+ vacancynormal=csp.vacancynormal,
+ vacancyextra=csp.vacextrahours,
+ otherpaidhours=csp.otherpaidhours,
+ partunemplhours=csp.partunemplhours,
+ totalhours=csp.totalhours,
+ nighthours=csp.nighthours,
+ recuperationhours=csp.recuperationhours,statussuncount=9,suppvacancysunwork=null,suppvacancy44hours=2,status44hcount=null,last44date=null,avgtotalweekhours=null,hoursdiff=csp.diffhours
+ FROM (
+ select contracthours,workhours,totalhours,recuperationhours, totalhours-contracthours as diffhours,id,vacillhours,vacancynormal,vacextrahours,otherpaidhours,partunemplhours,nighthours from (
+ select dp.id,
+ sum(pd.workhours) as workhours,
+ sum(pd.dayhours) as totalhours,
+ sum(coalesce(pd.nighthours,'00:00:00'::interval)) as nighthours,
+ sum(coalesce(pd.vacancyhours,'00:00:00'::time)) as vacancynormal,
+ sum(coalesce(pd.vacillhours,'00:00:00'::time)) as vacillhours,
+ sum(coalesce(pd.vacextrahours,'00:00:00'::time)) as vacextrahours,
+ sum(coalesce(pd.otherpaidhours,'00:00:00'::time)) as otherpaidhours,
+ sum(coalesce(pd.partunemplhours,'00:00:00'::time)) as partunemplhours,
+ sum(coalesce(pd.recuperationhours,'00:00:00'::time)) as recuperationhours,
+ coalesce(dp.contracthours,'00:00:00'::interval) as contracthours,
+ coalesce(dp.payedhours0,'00:00:00'::interval) as payedhours0,
+ coalesce(dp.payedhours40,'00:00:00'::interval) as payedhours40,
+ coalesce(dp.transferedhours,'00:00:00'::interval) as transferedhours
+ from demo2m17.staffreportperioddays pd
+ join demo2m17.staffreportperiod dp on (pd.id_staff=dp.id_staff and dp.id_reportperiod = '351cf732-61ee-8ad4-47fb-78b63159cacb')
+ where pd.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and pd.daydate between date('2024-03-01') and date('2024-04-30')
+ group by dp.id,dp.payedhours,dp.transferedhourscalc
+ ) rp) csp where csp.id=rpd.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ --to_char(srp.vacancyhours, 'HH24:MI'::text) AS vacancyhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_staff = 'd8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate DESC, rp.enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select date(date_trunc('week',startdate)) as startdate,startdate as periodstart, enddate as periodend,date(date_trunc('week',enddate) + interval '6 days') as enddate from demo2m17.reportperiod where id='351cf732-61ee-8ad4-47fb-78b63159cacb'
+QUERYBYKEY: select ws.weekstart,ws.weekend,ws.calweek,ws.calyear, ws.id_staff
+ ,to_char(ws.workhours::interval,'HH24:MI') as workhours
+ ,to_char(ws.vacancyhours,'HH24:MI') as vacancynormal
+ ,to_char(ws.vacillhours,'HH24:MI') as vacancyill
+ ,to_char(ws.vacextrahours,'HH24:MI') as vacancyextra
+ ,to_char(ws.vacschoolhours,'HH24:MI') as vacancyschool
+ ,to_char(ws.otherpaidhours,'HH24:MI') as otherpaidhours
+ ,to_char(ws.partunemplhours,'HH24:MI') as partunemplhours
+ ,to_char(ws.recuperationhours,'HH24:MI') as recuperationhours
+ ,to_char(ws.totalhours,'HH24:MI') as totalhours
+ ,cd.contractworkdays
+ ,cd.cmpcontractdays
+ ,cd.cmpweekhours
+ ,to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval),'HH24:MI') as weektrackedhours
+ ,ws.periodworkhours
+ ,interval_to_char(sum(coalesce(ttr.weektrackedhours,'00:00:00'::interval)) over (order by ws.weekstart) - sum(ws.periodworkhours::interval) over (order by ws.weekstart)) as periodtrackdiff
+ ,sum(ws.workhours::interval) over (order by ws.weekstart) as runningworkhours
+ ,interval_to_char(coalesce(ttr.weektrackedhours,'00:00:00'::interval) - ws.periodworkhours::interval) as trackeddiff
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else to_char(cd.contracthours,'HH24:MI') end as contracthours
+ ,to_char(AVG(ws.totalhours) over (order by ws.weekstart),'HH24:MI') as avgtotalhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then '00:00' else interval_to_char(ws.totalhours-cd.contracthours) end as diffhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then
+ to_char(case when cd.cmpweekhours < '40:00:00'::interval then cd.contracthours * 1.15 * cd.contractworkdays else (cd.contractworkdays*'08:00:00'::interval) + (cd.contractworkdays* case when maxdata.maxweekhours > '48:00:00' then '01:16:50'::interval else '00:50:00'::interval end) end,'HH24:MI')
+ else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours * 1.15 else maxdata.maxweekhours end,'HH24:MI')
+ end as maxweekhours
+ ,case when cd.contractworkdays < cd.cmpcontractdays then to_char(cd.contractworkdays*'08:00:00'::interval,'HH24:MI') else
+ to_char(case when cd.contracthours < '40:00:00'::interval then cd.contracthours else maxdata.defaultweekhours end,'HH24:MI')
+ end as defaultweekhours
+ from (
+ SELECT weekstart,weekend,calweek,calyear, id_staff,
+ sum(CASE WHEN srpd.workhours IS NULL THEN '00:00:00'::interval ELSE srpd.workhours::interval END) AS workhours,
+ sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhours,
+ --sum(case when srpd.daydate between date('2024-03-01') and date('2024-04-30') then coalesce(srpd.workhours::interval, '00:00:00'::interval) else '00:00:00'::interval end) as periodworkhoursnopause,
+ sum(CASE WHEN srpd.vacancyhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacancyhours::interval END) AS vacancyhours,
+ sum(CASE WHEN srpd.vacillhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacillhours::interval END) AS vacillhours,
+ sum(CASE WHEN srpd.vacextrahours IS NULL THEN '00:00:00'::interval ELSE srpd.vacextrahours::interval END) AS vacextrahours,
+ sum(CASE WHEN srpd.vacschoolhours IS NULL THEN '00:00:00'::interval ELSE srpd.vacschoolhours::interval END) AS vacschoolhours,
+ sum(CASE WHEN srpd.recuperationhours IS NULL THEN '00:00:00'::interval ELSE srpd.recuperationhours::interval END) AS recuperationhours,
+ sum(CASE WHEN srpd.otherpaidhours IS NULL THEN '00:00:00'::interval ELSE srpd.otherpaidhours::interval END) AS otherpaidhours,
+ sum(CASE WHEN srpd.partunemplhours IS NULL THEN '00:00:00'::interval ELSE srpd.partunemplhours::interval END) AS partunemplhours,
+ sum(CASE WHEN srpd.dayhours IS NULL THEN '00:00:00'::interval ELSE srpd.dayhours::interval END) AS totalhours,
+ sum(CASE WHEN srpd.workhours > '00:00:00'::time without time zone OR srpd.recuperationhours > '00:00:00'::time without time zone OR srpd.vacancyhours > '00:00:00'::time without time zone OR srpd.vacillhours > '00:00:00'::time without time zone OR srpd.vacextrahours > '00:00:00'::time without time zone OR srpd.vacschoolhours > '00:00:00'::time without time zone OR srpd.otherpaidhours > '00:00:00'::time without time zone or srpd.partunemplhours > '00:00:00'::time without time zone THEN 1 ELSE 0 END) AS workdays,
+ sum( CASE WHEN srpd.contracthours IS NULL THEN '00:00:00'::interval ELSE srpd.contracthours::interval END) AS contracthours
+ FROM (select *,date(date_trunc('week', daydate)) AS weekstart,
+ date(date_trunc('week', daydate) + interval '6 days') AS weekend,
+ date_part('week', daydate) AS calweek,
+ date_part('isoyear', daydate) AS calyear from demo2m17.staffreportperioddays
+ where id_staff= 'd8e44d1a-359c-055b-72dc-343c57fdfb76' and daydate between date('2024-02-26') and date('2024-05-05')
+ ) srpd GROUP BY srpd.weekstart,srpd.weekend,srpd.calweek,srpd.calyear,srpd.id_staff
+ ORDER BY weekstart) ws left join (
+ select date(date_trunc('week',pd.daydate)) as weekstart,pd.id_staff,max(sc.weekdays) as cmpcontractdays,max(sc.weekhours) as cmpweekhours,
+ case when count(pd.daydate) < avg(sc.weekdays) then count(pd.daydate) else avg(sc.weekdays) end as contractworkdays,
+ case when count(pd.daydate) < avg(sc.weekdays) then avg(sc.weekhours/ sc.weekdays) * count(pd.daydate) else avg(sc.weekhours/ sc.weekdays) * avg(sc.weekdays) end as contracthours ,sum(case when coalesce(pd.workhours,'00:00:00'::time) > '00:00:00'::time then 1 else 0 end) as realworkdays
+ from ( select id_staff,weekdays ,weekhours,
+ case when startdate> date('2024-02-26') then startdate else date('2024-02-26') end as staffperiodstart,
+ case when enddate is null or enddate > date('2024-05-05') then date('2024-05-05')
+ else enddate end as staffperiodend from demo2m17.staffcontract where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ and startdate < date('2024-05-05')
+ ) sc
+ join demo2m17.staffreportperioddays pd on (pd.id_staff=sc.id_staff and pd.daydate between sc.staffperiodstart and sc.staffperiodend)
+ group by date(date_trunc('week',pd.daydate)),pd.id_staff
+ ) cd on ws.id_staff = cd.id_staff and ws.weekstart=cd.weekstart
+ left join (
+ select id_staff,weekstart,max(defaultweekhours) as defaultweekhours,avg(maxweekhours) as maxweekhours from (
+ select lpd.id_staff,date(date_trunc('week',lpd.daydate)) as weekstart,lpd.daydate,
+ case when wk.defaultweekhours is null then wkdef.defaultweekhours else wk.defaultweekhours end as defaultweekhours ,
+ case when wk.maxweekhours is null then wkdef.maxweekhours else wk.maxweekhours end as maxweekhours
+ from demo2m17.staffreportperioddays lpd
+ left join demo2m17.worktimes wk on (lpd.daydate between wk.startdate and wk.enddate)
+ cross join (select * from demo2m17.worktimes where isdefault=true) wkdef
+ where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and lpd.daydate between date('2024-02-26') and date('2024-05-05')
+ order by lpd.daydate ) mh group by id_staff,weekstart
+ ) maxdata on ws.id_staff = maxdata.id_staff and ws.weekstart=maxdata.weekstart
+ left join (
+ select weekstart,id_staff,coalesce(sum(daytracked),'00:00:00'::interval) as weektrackedhours from (
+ select daydate,id_staff,weekstart,case when sum(trackedhours) > '06:00:00'::interval then sum(trackedhours)- '00:30:00'::interval else coalesce(sum(trackedhours),'00:00:00'::interval) end as daytracked from (
+select daydate,date(date_trunc('week',daydate)) as weekstart,id_staff,(stamp_out-stamp_in)::interval as trackedhours from demo2m17.timetracker
+where daydate between date('2024-03-01') and date('2024-04-30') and id_staff ='d8e44d1a-359c-055b-72dc-343c57fdfb76') tto group by daydate,id_staff,weekstart,trackedhours) ttx group by weekstart,id_staff
+ ) ttr on ws.weekstart=ttr.weekstart and ws.id_staff=ttr.id_staff;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT pd.id,pd.id_staff,pd.id_reportperiod,pd.daydate,pd.payedpause,pd.daytype,pd.daycomment,
+ vacancycomment,vacillcomment,vacextracomment,recupcomment,otherpaidhourscomment,partunempcomment,
+ pd.daytemplate,pd.vacschoolcomment,rp.viewpartunempl,rp.viewvacschool,
+ date(date_trunc('week',pd.daydate)) as weekstart,
+ to_char(pd.timestart1::interval, 'HH24:MI') AS timestart1,
+ to_char(pd.timeend1::interval, 'HH24:MI') AS timeend1,
+ to_char(pd.timestart2::interval, 'HH24:MI') AS timestart2,
+ to_char(pd.timeend2::interval, 'HH24:MI') AS timeend2,
+ to_char(pd.timepause::interval, 'HH24:MI') AS timepause,
+ -- coalesce('<div class="dspvacancynormal">' || to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN null ELSE pd.vacancyhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyill">' || to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN null else pd.vacillhours END::interval, 'HH24:MI') || '</div>','') ||
+ -- coalesce('<div class="dspvacancyextra">' || to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN null ELSE pd.vacextrahours END::interval, 'HH24:MI') || '</div>','') AS dspvacancyhours,
+ to_char(CASE WHEN pd.vacancyhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacancyhours END::interval, 'HH24:MI') AS vacancyhours,
+ to_char(CASE WHEN pd.vacillhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacillhours END::interval, 'HH24:MI') AS vacillhours,
+ to_char(CASE WHEN pd.vacextrahours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacextrahours END::interval, 'HH24:MI') AS vacextrahours,
+ to_char(CASE WHEN pd.vacschoolhours::interval = '00:00:00'::interval THEN NULL ELSE pd.vacschoolhours END::interval, 'HH24:MI') AS vacschoolhours,
+ to_char(CASE WHEN pd.otherpaidhours::interval = '00:00:00'::interval THEN NULL ELSE pd.otherpaidhours END::interval, 'HH24:MI') AS otherpaidhours,
+ to_char(CASE WHEN pd.partunemplhours::interval = '00:00:00'::interval THEN NULL ELSE pd.partunemplhours END::interval, 'HH24:MI') AS partunemplhours,
+ to_char(pd.contracthours::interval, 'HH24:MI') AS contracthours,
+ to_char(CASE WHEN pd.workhours::interval = '00:00:00'::interval THEN NULL ELSE pd.workhours END::interval, 'HH24:MI') AS workhours,
+ to_char(CASE WHEN pd.dayhours::interval = '00:00:00'::interval THEN NULL ELSE pd.dayhours END::interval, 'HH24:MI') AS dayhours,
+ to_char(case WHEN pd.recuperationhours::interval = '00:00:00'::interval THEN NULL ELSE pd.recuperationhours END::interval, 'HH24:MI') AS recuperationhours,
+ to_char(CASE WHEN pd.interruptionhours::interval = '00:00:00'::interval THEN NULL ELSE pd.interruptionhours END::interval, 'HH24:MI') AS interruptionhours,
+ to_char(CASE WHEN pd.nighthours::interval = '00:00:00'::interval THEN NULL ELSE pd.nighthours END::interval, 'HH24:MI') AS nighthours,
+ to_char(pd.pausestart1::interval, 'HH24:MI') AS pausestart1,
+ to_char(pd.pauseend1::interval, 'HH24:MI') AS pauseend1,
+ to_char(pd.pausestart2::interval, 'HH24:MI') AS pausestart2,
+ to_char(pd.pauseend2::interval, 'HH24:MI') AS pauseend2,
+ COALESCE((to_char(pd.pausestart1::interval, 'HH24:MI') || '-') || to_char(pd.pauseend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.pausestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.pausestart2::interval, 'HH24:MI')) || '-') || to_char(pd.pauseend2::interval, 'HH24:MI'), '') AS dsppausedata,
+ COALESCE((to_char(pd.timestart1::interval, 'HH24:MI') || '-') || to_char(pd.timeend1::interval, 'HH24:MI'), '') || COALESCE(((CASE WHEN pd.timestart1 IS NOT NULL THEN '<br/>' ELSE '' END || to_char(pd.timestart2::interval, 'HH24:MI')) || '-') || to_char(pd.timeend2::interval, 'HH24:MI'), '') AS dspworkdata,
+ CASE WHEN max(freehours.freehours) < '00:00:00'::interval THEN NULL ELSE to_char(max(freehours.freehours), 'HH24:MI') END AS freehoursafter,
+ to_char(coalesce(max(wk.defaultdayhours),max(wkstd.defaultdayhours)),'HH24:MI') as defaultdayhours,
+ to_char(coalesce(max(wk.maxdayhours),max(wkstd.maxdayhours)),'HH24:MI') as maxdayhours,
+ to_char(coalesce(max(wk.mindailyrecuperation),max(wkstd.mindailyrecuperation)),'HH24:MI') as mindailyrecuperation,
+ to_char(coalesce(max(wk.maxinterruptionhours),max(wkstd.maxinterruptionhours)),'HH24:MI') as maxinterruptionhours,
+ max(vd.vacancyname) as vacancyname,
+ to_char(max(tt.trackedtime),'HH24:MI') as trackedtime,
+ max(case when tt.trackedtime is null or pd.workhours is null then null else interval_to_char(coalesce(tt.trackedtime::interval,'00:00:00'::interval) - coalesce(pd.workhours::interval,'00:00:00'::interval)) end) as trackeddiff,
+ null as incompletetrack
+ FROM demo2m17.staffreportperioddays pd
+ JOIN demo2m17.staff st ON pd.id_staff = st.id and st.id='d8e44d1a-359c-055b-72dc-343c57fdfb76' and st.isdeleted is null
+ LEFT JOIN ( SELECT yy.id_staff, yy.ndaydate AS daydate,case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend AS tmfrom, yy.daydate + yy.timestart AS tmto,
+ yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend) AS realinterval,
+ date_part('epoch', yy.daydate + yy.timestart - (case when yy.ntimeend < yy.timestart then yy.daydate else yy.ndaydate end + yy.ntimeend)) * '00:00:01'::interval AS freehours
+ FROM ( SELECT lag(xx_1.daydate, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ndaydate,
+ lag(xx_1.timeend, 1) OVER (ORDER BY xx_1.id_staff, xx_1.daydate) AS ntimeend,
+ xx_1.id_staff, xx_1.daydate, xx_1.timestart, xx_1.timeend
+ FROM ( SELECT sr.id_staff, sr.daydate,
+ CASE WHEN sr.timestart1 IS NOT NULL THEN sr.timestart1 ELSE sr.timestart2 END AS timestart,
+ CASE WHEN sr.timestart2 IS NOT NULL THEN sr.timeend2 ELSE sr.timeend1 END AS timeend
+ FROM demo2m17.staffreportperioddays sr
+ WHERE sr.dayhours IS NOT NULL AND sr.dayhours <> '00:00:00'::time without time zone and sr.id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76'
+ ORDER BY sr.id_staff, sr.daydate) xx_1) yy) freehours ON pd.id_staff = freehours.id_staff AND freehours.daydate = pd.daydate
+ left join demo2m17.worktimes wk on pd.daydate between wk.startdate and wk.enddate
+ cross join (select defaultdayhours,maxdayhours,mindailyrecuperation,maxinterruptionhours from demo2m17.worktimes where isdefault =true) wkstd
+ left join demo2m17.vacancydays vd on pd.daydate=vd.daydate
+ left join demo2m17.reportperiod rp on (pd.id_reportperiod=rp.id)
+ left join (
+ select
+ sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as sumdayall,
+ string_agg(minpauseok::text,'') as minpauses, null as incompletetrack,
+ case when sum(minpauseok) = 0 and sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) >= '06:00:00'::interval then sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) - '00:30:00'::interval else sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) end as trackedtime,daydate from
+ ( select *, tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) as pauseduration,
+ to_char(lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in),'HH24:MI') || '-' || to_char(tx.stamp_in,'HH24:MI') as pausetime,
+ case when tx.stamp_in - lag(tx.stamp_out) over (partition by tx.id_staff,tx.daydate order by tx.stamp_in) > '00:30:00'::interval then 1 else 0 end as minpauseok
+ from demo2m17.timetracker tx where id_staff='d8e44d1a-359c-055b-72dc-343c57fdfb76' and tx.daydate between date('2024-02-26') and date('2024-05-05')
+ order by tx.stamp_in) tt
+ group by tt.daydate
+ ) tt on pd.daydate=tt.daydate
+ WHERE pd.daydate between date('2024-02-26') and date('2024-05-05')
+ group by pd.id,rp.viewpartunempl,rp.viewvacschool
+ ORDER BY pd.id_staff, pd.daydate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '83fc81c6-cf10-b3d0-b0a4-4043fc29efaa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '08737d53-1fb6-2284-c6c0-418b1ac7e2fa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT id,startdate,enddate,id_parentreportperiod,periodtype,viewpartunempl,periodlength,periodunit,sector,periodlength || ' ' || periodunit as dspunit, to_char(startdate,'MM/YY') || ' - ' || to_char(enddate,'MM/YY') as dspperiod FROM demo2m17.reportperiod rp ORDER BY startdate DESC, enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT wp.id,wp.workplan,wp.isdefault,wp.weekhours,wp.weekdays,
+ coalesce((((((wp.workplan || ' / ') ||substr(wp.weekhours::text, 1, 5)) || 'h / ') || wp.weekdays) || 'j / libre: ') || (( SELECT string_agg(ww.wday, ',') AS string_agg FROM ( SELECT public.day_name(json_array_elements_text(wp.freeweekdayslist)) AS wday) ww)),wp.workplan ) AS dspworkplandetail
+ FROM demo2m17.workplans wp
+ ORDER BY wp.isdefault, wp.workplan;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: select id,tmplname,tmplcolor as bgcolor FROM demo2m17.daytemplate order by tmplname;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '08737d53-1fb6-2284-c6c0-418b1ac7e2fa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '83fc81c6-cf10-b3d0-b0a4-4043fc29efaa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '351cf732-61ee-8ad4-47fb-78b63159cacb'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '08737d53-1fb6-2284-c6c0-418b1ac7e2fa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '83fc81c6-cf10-b3d0-b0a4-4043fc29efaa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= '4c45b03e-055e-9290-13c8-92f454629705' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select us.id,cp.schemata from public.users us left join public.companies cp on (us.id_company=cp.id) where lower(us.username)=lower('ksaffran@dks.lu') and us.userpassword = 'a1b496fa520a1c52edd076ca7a59e56667e7ebeb5ba5ba966d2d01628e165359' and us.isblocked is null;
+EXEC: delete from public.sessions where id_user='e9e6880b-75c7-70b5-ce61-49cf6d62630f' and remote_addr='::1' and user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0';
+QUERY: insert into public.sessions (id_user,id,remote_addr,user_agent,sessiondata) VALUES( 'e9e6880b-75c7-70b5-ce61-49cf6d62630f',public.getuuid(), '::1','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0',('{"schemata":"demo2m17"}'::text)::json) returning id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT distinct(us.schema_name),case when cp.company is null then 'schema:' || us.schema_name else company end as company ,
+ us.schema_name AS schemaname,
+ case when datasetname is null then 'schema:' || us.schema_name else datasetname end as datasetname
+ FROM ( select schema_name from information_schema.schemata where schema_owner != 'postgres' and schema_name != 'public') us
+ JOIN companies cp ON cp.schemata = us.schema_name AND cp.isdeleted IS null and cp.company is not null and cp.portal='app';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select terms from demo2m17.users where id='e9e6880b-75c7-70b5-ce61-49cf6d62630f';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT id,startdate,enddate,id_parentreportperiod,periodtype,viewpartunempl,periodlength,periodunit,sector,periodlength || ' ' || periodunit as dspunit, to_char(startdate,'MM/YY') || ' - ' || to_char(enddate,'MM/YY') as dspperiod FROM demo2m17.reportperiod rp ORDER BY startdate DESC, enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT wp.id,wp.workplan,wp.isdefault,wp.weekhours,wp.weekdays,
+ coalesce((((((wp.workplan || ' / ') ||substr(wp.weekhours::text, 1, 5)) || 'h / ') || wp.weekdays) || 'j / libre: ') || (( SELECT string_agg(ww.wday, ',') AS string_agg FROM ( SELECT public.day_name(json_array_elements_text(wp.freeweekdayslist)) AS wday) ww)),wp.workplan ) AS dspworkplandetail
+ FROM demo2m17.workplans wp
+ ORDER BY wp.isdefault, wp.workplan;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: select id,tmplname,tmplcolor as bgcolor FROM demo2m17.daytemplate order by tmplname;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '08737d53-1fb6-2284-c6c0-418b1ac7e2fa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '9ad3b315-fb23-93ea-6aeb-7b1b72675c43'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = 'c22d8487-da4d-e0ae-72f9-e568a803f45e'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select terms from demo2m17.users where id='e9e6880b-75c7-70b5-ce61-49cf6d62630f';
+QUERYARRAY: SELECT distinct(us.schema_name),case when cp.company is null then 'schema:' || us.schema_name else company end as company ,
+ us.schema_name AS schemaname,
+ case when datasetname is null then 'schema:' || us.schema_name else datasetname end as datasetname
+ FROM ( select schema_name from information_schema.schemata where schema_owner != 'postgres' and schema_name != 'public') us
+ JOIN companies cp ON cp.schemata = us.schema_name AND cp.isdeleted IS null and cp.company is not null and cp.portal='app';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT wp.id,wp.workplan,wp.isdefault,wp.weekhours,wp.weekdays,
+ coalesce((((((wp.workplan || ' / ') ||substr(wp.weekhours::text, 1, 5)) || 'h / ') || wp.weekdays) || 'j / libre: ') || (( SELECT string_agg(ww.wday, ',') AS string_agg FROM ( SELECT public.day_name(json_array_elements_text(wp.freeweekdayslist)) AS wday) ww)),wp.workplan ) AS dspworkplandetail
+ FROM demo2m17.workplans wp
+ ORDER BY wp.isdefault, wp.workplan;
+QUERYARRAY: SELECT id,startdate,enddate,id_parentreportperiod,periodtype,viewpartunempl,periodlength,periodunit,sector,periodlength || ' ' || periodunit as dspunit, to_char(startdate,'MM/YY') || ' - ' || to_char(enddate,'MM/YY') as dspperiod FROM demo2m17.reportperiod rp ORDER BY startdate DESC, enddate DESC;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: select id,tmplname,tmplcolor as bgcolor FROM demo2m17.daytemplate order by tmplname;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '83fc81c6-cf10-b3d0-b0a4-4043fc29efaa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '8e529c66-1364-a821-83dc-0c4cab9b9a54'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '1662b1e5-0b51-74fe-3741-e983ea8488b0'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '83fc81c6-cf10-b3d0-b0a4-4043fc29efaa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '9ad3b315-fb23-93ea-6aeb-7b1b72675c43'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = 'ea2658c0-4953-55e7-6de6-b80cdf147ea3'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = 'c22d8487-da4d-e0ae-72f9-e568a803f45e'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = 'ea2658c0-4953-55e7-6de6-b80cdf147ea3'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '83fc81c6-cf10-b3d0-b0a4-4043fc29efaa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '08737d53-1fb6-2284-c6c0-418b1ac7e2fa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '83fc81c6-cf10-b3d0-b0a4-4043fc29efaa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '08737d53-1fb6-2284-c6c0-418b1ac7e2fa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '9ad3b315-fb23-93ea-6aeb-7b1b72675c43'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = 'c22d8487-da4d-e0ae-72f9-e568a803f45e'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '83fc81c6-cf10-b3d0-b0a4-4043fc29efaa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = 'ea2658c0-4953-55e7-6de6-b80cdf147ea3'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '8e529c66-1364-a821-83dc-0c4cab9b9a54'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '9ad3b315-fb23-93ea-6aeb-7b1b72675c43'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT st.prename, st.surname, coalesce(st.surname || ' ','') || coalesce(st.prename,'') as name,
+ to_char(srp.contracthours, 'HH24:MI'::text) AS contracthours,
+ to_char(srp.workhours, 'HH24:MI'::text) AS workhours,
+ to_char(srp.vacancyill, 'HH24:MI'::text) AS vacancyill,
+ to_char(srp.vacancynormal, 'HH24:MI'::text) AS vacancynormal,
+ to_char(srp.vacancyextra, 'HH24:MI'::text) AS vacancyextra,
+ to_char(srp.otherpaidhours, 'HH24:MI'::text) AS otherpaidhours,
+ to_char(srp.partunemplhours, 'HH24:MI'::text) AS partunemplhours,
+ to_char(srp.recuperationhours, 'HH24:MI'::text) AS recuperationhours,
+ to_char(srp.nighthours, 'HH24:MI'::text) AS nighthours,
+ case when position('-' in to_char(srp.hoursdiff, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.hoursdiff, 'HH24:MI'),'-','') else to_char(srp.hoursdiff, 'HH24:MI') end as hoursdiff,
+ to_char(srp.totalhours, 'HH24:MI'::text) AS totalhours,
+ srp.id as id_staffreportperiod,srp.id_reportperiod, srp.id_staff, srp.id, rp.startdate, rp.enddate,
+ COALESCE(st.surname || ' '::text, ''::text) || COALESCE(st.prename, ''::text) AS staffname,
+ st.id_staffgroup, sgr.groupname,
+ case when position('-' in to_char(srp.transferedhours, 'HH24:MI')) > 0 then '-' || replace(to_char(srp.transferedhours, 'HH24:MI'),'-','') else to_char(srp.transferedhours, 'HH24:MI') end as transferedhours,
+ case when suppvacancysunwork is not null and suppvacancysunwork > 0 then '+' || suppvacancysunwork else null end as suppvacancysunwork,
+ case when suppvacancy44hours is not null and suppvacancy44hours > 0 then '+' || suppvacancy44hours else null end as suppvacancy44hours
+ ,itmcontracthours,maxdays,srp.isvalidated,
+ to_char(srp.payedhours40calc,'HH24:MI'::text) AS payedhours,
+ to_char(payedhours0, 'HH24:MI'::text) as payedhours0,
+ to_char(payedhours40, 'HH24:MI'::text) as payedhours40,
+ to_char(payedhours40calc, 'HH24:MI'::text) as payedhours40calc,
+ to_char(hourstotransfer, 'HH24:MI'::text) as hourstotransfer,
+ to_char(hourstotransfercalc, 'HH24:MI'::text) as hourstotransfercalc,
+ to_char(nighthourstotransfer, 'HH24:MI'::text) as nighthourstotransfer,
+ to_char(nighthourstotransfercalc, 'HH24:MI'::text) as nighthourstotransfercalc,
+ to_char(srp.avgtotalweekhours, 'HH24:MI'::text) AS avgtotalweekhours
+ FROM demo2m17.staffreportperiod srp
+ LEFT JOIN demo2m17.staff st ON srp.id_staff = st.id
+ LEFT JOIN demo2m17.reportperiod rp ON srp.id_reportperiod = rp.id
+ LEFT JOIN demo2m17.staffgroups sgr ON st.id_staffgroup = sgr.id
+ WHERE st.isdeleted IS NULL AND srp.id_reportperiod = '08737d53-1fb6-2284-c6c0-418b1ac7e2fa'
+ ORDER BY st.surname, st.prename, srp.id_staff, rp.startdate, rp.enddate;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select terms from demo2m17.users where id='e9e6880b-75c7-70b5-ce61-49cf6d62630f';
+QUERYARRAY: SELECT distinct(us.schema_name),case when cp.company is null then 'schema:' || us.schema_name else company end as company ,
+ us.schema_name AS schemaname,
+ case when datasetname is null then 'schema:' || us.schema_name else datasetname end as datasetname
+ FROM ( select schema_name from information_schema.schemata where schema_owner != 'postgres' and schema_name != 'public') us
+ JOIN companies cp ON cp.schemata = us.schema_name AND cp.isdeleted IS null and cp.company is not null and cp.portal='app';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+EXEC: UPDATE public.users set lang='de' WHERE id='e9e6880b-75c7-70b5-ce61-49cf6d62630f';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT distinct(us.schema_name),case when cp.company is null then 'schema:' || us.schema_name else company end as company ,
+ us.schema_name AS schemaname,
+ case when datasetname is null then 'schema:' || us.schema_name else datasetname end as datasetname
+ FROM ( select schema_name from information_schema.schemata where schema_owner != 'postgres' and schema_name != 'public') us
+ JOIN companies cp ON cp.schemata = us.schema_name AND cp.isdeleted IS null and cp.company is not null and cp.portal='app';
+QUERY: select terms from demo2m17.users where id='e9e6880b-75c7-70b5-ce61-49cf6d62630f';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: select id,trackername from demo2m17.timetrackerconfig order by trackername
+QUERYARRAY: select sg.id,sg.groupname,sg.groupcolor,sg.isdefault,COALESCE(count(st.id), 0) AS staffmembers FROM demo2m17.staffgroups sg LEFT JOIN demo2m17.staff st ON (st.id_staffgroup = sg.id) WHERE st.isdeleted IS NULL GROUP BY sg.id ORDER BY sg.groupname;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT wp.id,wp.workplan,wp.isdefault,wp.weekhours,wp.weekdays,
+ coalesce((((((wp.workplan || ' / ') ||substr(wp.weekhours::text, 1, 5)) || 'h / ') || wp.weekdays) || 'j / libre: ') || (( SELECT string_agg(ww.wday, ',') AS string_agg FROM ( SELECT public.day_name(json_array_elements_text(wp.freeweekdayslist)) AS wday) ww)),wp.workplan ) AS dspworkplandetail
+ FROM demo2m17.workplans wp
+ ORDER BY wp.isdefault, wp.workplan;
+QUERYARRAY: select ttr.*, st.* ,stg.groupname,'<span style="font-weight: bold;">' || COALESCE(coalesce(st.surname,'') || ' ', '') || COALESCE(st.prename, '') || '</span><br/>' || '<span style="color:' || coalesce(st.color,'') || ';font-style: italic;">'|| coalesce(st.job,'') || '</span>' AS staffname,sc.staffstatus from demo2m17.staff st
+ LEFT JOIN demo2m17.staffgroups stg ON st.id_staffgroup = stg.id
+ left join (select id_staff, case when min(startdate) <= current_date and (max(enddate) is null or max(enddate) >= current_date) then 'current'
+ when min(startdate) > current_date then 'futur' when max(enddate) < current_date then 'past' else null end as staffstatus,min(startdate)as startdate,max(enddate) as enddate from (select id_staff,startdate,case when enddate is null then current_date else enddate end as enddate from demo2m17.staffcontract) scc group by id_staff) sc on (st.id=sc.id_staff)
+ cross join (select timetrackertype,case when timetrackertype is not null then true else null end as istimetrackerenabled,periodtypes from public.companies where schemata='demo2m17') ttr
+ where st.isdeleted is null order by groupname,st.staffnumber,surname,prename;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: select id,tmplname,tmplcolor as bgcolor FROM demo2m17.daytemplate order by tmplname;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select * from demo2m17.staff where id='29488caf-66ac-84e6-ab9b-1aebadd8bcf2' and isdeleted is null;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: select vac.id_staff || '-' || vac.vacyear as id,vac.id_staff,vac.vacyear,
+ to_char(vac.vacnormal,'HH24:MI') as vachours,
+ to_char(vac.vacnormal,'HH24:MI') as vacnormal,
+ to_char(vac.vacrestbefore,'HH24:MI') as vacrestbefore,
+ to_char(vac.vacextra,'HH24:MI') as vacextra,
+ coalesce(to_char(plan.vacnormalplanned,'HH24:MI'),'00:00') as vacnormalplanned,
+ coalesce(to_char(plan.vacextraplanned,'HH24:MI'),'00:00') as vacextraplanned,
+ coalesce(to_char(plan.vacnormalplanned + plan.vacextraplanned,'HH24:MI'),'00:00') as vacplanned,
+ coalesce(to_char(vac.vacnormal + vac.vacrestbefore + vac.vacextra,'HH24:MI'),'00:00') as vactotal
+ from (
+ select id_staff,vacyear,
+ sum(case when vactype is null or vactype ='normal' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacnormal,
+ sum(case when vactype ='rest' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacrestbefore,
+ sum(case when vactype ='extra' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacextra
+ from demo2m17.staffvacancyyear group by id_staff,vacyear ) vac
+ left join (
+ select id_staff,date_part('year',daydate) as vyear,
+ coalesce(sum(vacancyhours),'00:00:00'::interval) as vacnormalplanned,
+ coalesce(sum(vacextrahours),'00:00:00'::interval) as vacextraplanned
+ from demo2m17.staffreportperioddays
+ where (vacancyhours is not null or vacextrahours is not null)
+ group by vyear,id_staff) plan on (vac.id_staff=plan.id_staff and vac.vacyear=plan.vyear)
+ where vac.id_staff='29488caf-66ac-84e6-ab9b-1aebadd8bcf2'
+ order by vacyear DESC;
+QUERYARRAY: SELECT id,id as id_staffcontract,id_staff,startdate,enddate,weekdays,to_char(weekhours, 'HH24:MI'::text) AS weekhours,defaultfreedays from demo2m17.staffcontract where id_staff='29488caf-66ac-84e6-ab9b-1aebadd8bcf2' order by startdate,enddate;
+QUERYARRAY: select id_staff || '_' || mmonth || '_' || myear as id,surname || ' ' || prename as staffname ,id_staff,groupname,
+ -- vacancyhours,vacillhours,vacextrahours,vacancycomment,vacillcomment,vacextracomment,mday,daydate,vactotal,
+ mmonth,myear, case when regexp_replace(string_agg(case when mday='01' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='01' then vcomment else null end,','),',,',',','g') end as c01,string_agg(case when mday='01' then vtypes else null end,'') as t01,to_char(sum(case when mday='01' then vactotal else null end),'HH24:MI') as d01,case when regexp_replace(string_agg(case when mday='02' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='02' then vcomment else null end,','),',,',',','g') end as c02,string_agg(case when mday='02' then vtypes else null end,'') as t02,to_char(sum(case when mday='02' then vactotal else null end),'HH24:MI') as d02,case when regexp_replace(string_agg(case when mday='03' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='03' then vcomment else null end,','),',,',',','g') end as c03,string_agg(case when mday='03' then vtypes else null end,'') as t03,to_char(sum(case when mday='03' then vactotal else null end),'HH24:MI') as d03,case when regexp_replace(string_agg(case when mday='04' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='04' then vcomment else null end,','),',,',',','g') end as c04,string_agg(case when mday='04' then vtypes else null end,'') as t04,to_char(sum(case when mday='04' then vactotal else null end),'HH24:MI') as d04,case when regexp_replace(string_agg(case when mday='05' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='05' then vcomment else null end,','),',,',',','g') end as c05,string_agg(case when mday='05' then vtypes else null end,'') as t05,to_char(sum(case when mday='05' then vactotal else null end),'HH24:MI') as d05,case when regexp_replace(string_agg(case when mday='06' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='06' then vcomment else null end,','),',,',',','g') end as c06,string_agg(case when mday='06' then vtypes else null end,'') as t06,to_char(sum(case when mday='06' then vactotal else null end),'HH24:MI') as d06,case when regexp_replace(string_agg(case when mday='07' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='07' then vcomment else null end,','),',,',',','g') end as c07,string_agg(case when mday='07' then vtypes else null end,'') as t07,to_char(sum(case when mday='07' then vactotal else null end),'HH24:MI') as d07,case when regexp_replace(string_agg(case when mday='08' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='08' then vcomment else null end,','),',,',',','g') end as c08,string_agg(case when mday='08' then vtypes else null end,'') as t08,to_char(sum(case when mday='08' then vactotal else null end),'HH24:MI') as d08,case when regexp_replace(string_agg(case when mday='09' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='09' then vcomment else null end,','),',,',',','g') end as c09,string_agg(case when mday='09' then vtypes else null end,'') as t09,to_char(sum(case when mday='09' then vactotal else null end),'HH24:MI') as d09,case when regexp_replace(string_agg(case when mday='10' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='10' then vcomment else null end,','),',,',',','g') end as c10,string_agg(case when mday='10' then vtypes else null end,'') as t10,to_char(sum(case when mday='10' then vactotal else null end),'HH24:MI') as d10,case when regexp_replace(string_agg(case when mday='11' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='11' then vcomment else null end,','),',,',',','g') end as c11,string_agg(case when mday='11' then vtypes else null end,'') as t11,to_char(sum(case when mday='11' then vactotal else null end),'HH24:MI') as d11,case when regexp_replace(string_agg(case when mday='12' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='12' then vcomment else null end,','),',,',',','g') end as c12,string_agg(case when mday='12' then vtypes else null end,'') as t12,to_char(sum(case when mday='12' then vactotal else null end),'HH24:MI') as d12,case when regexp_replace(string_agg(case when mday='13' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='13' then vcomment else null end,','),',,',',','g') end as c13,string_agg(case when mday='13' then vtypes else null end,'') as t13,to_char(sum(case when mday='13' then vactotal else null end),'HH24:MI') as d13,case when regexp_replace(string_agg(case when mday='14' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='14' then vcomment else null end,','),',,',',','g') end as c14,string_agg(case when mday='14' then vtypes else null end,'') as t14,to_char(sum(case when mday='14' then vactotal else null end),'HH24:MI') as d14,case when regexp_replace(string_agg(case when mday='15' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='15' then vcomment else null end,','),',,',',','g') end as c15,string_agg(case when mday='15' then vtypes else null end,'') as t15,to_char(sum(case when mday='15' then vactotal else null end),'HH24:MI') as d15,case when regexp_replace(string_agg(case when mday='16' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='16' then vcomment else null end,','),',,',',','g') end as c16,string_agg(case when mday='16' then vtypes else null end,'') as t16,to_char(sum(case when mday='16' then vactotal else null end),'HH24:MI') as d16,case when regexp_replace(string_agg(case when mday='17' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='17' then vcomment else null end,','),',,',',','g') end as c17,string_agg(case when mday='17' then vtypes else null end,'') as t17,to_char(sum(case when mday='17' then vactotal else null end),'HH24:MI') as d17,case when regexp_replace(string_agg(case when mday='18' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='18' then vcomment else null end,','),',,',',','g') end as c18,string_agg(case when mday='18' then vtypes else null end,'') as t18,to_char(sum(case when mday='18' then vactotal else null end),'HH24:MI') as d18,case when regexp_replace(string_agg(case when mday='19' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='19' then vcomment else null end,','),',,',',','g') end as c19,string_agg(case when mday='19' then vtypes else null end,'') as t19,to_char(sum(case when mday='19' then vactotal else null end),'HH24:MI') as d19,case when regexp_replace(string_agg(case when mday='20' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='20' then vcomment else null end,','),',,',',','g') end as c20,string_agg(case when mday='20' then vtypes else null end,'') as t20,to_char(sum(case when mday='20' then vactotal else null end),'HH24:MI') as d20,case when regexp_replace(string_agg(case when mday='21' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='21' then vcomment else null end,','),',,',',','g') end as c21,string_agg(case when mday='21' then vtypes else null end,'') as t21,to_char(sum(case when mday='21' then vactotal else null end),'HH24:MI') as d21,case when regexp_replace(string_agg(case when mday='22' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='22' then vcomment else null end,','),',,',',','g') end as c22,string_agg(case when mday='22' then vtypes else null end,'') as t22,to_char(sum(case when mday='22' then vactotal else null end),'HH24:MI') as d22,case when regexp_replace(string_agg(case when mday='23' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='23' then vcomment else null end,','),',,',',','g') end as c23,string_agg(case when mday='23' then vtypes else null end,'') as t23,to_char(sum(case when mday='23' then vactotal else null end),'HH24:MI') as d23,case when regexp_replace(string_agg(case when mday='24' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='24' then vcomment else null end,','),',,',',','g') end as c24,string_agg(case when mday='24' then vtypes else null end,'') as t24,to_char(sum(case when mday='24' then vactotal else null end),'HH24:MI') as d24,case when regexp_replace(string_agg(case when mday='25' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='25' then vcomment else null end,','),',,',',','g') end as c25,string_agg(case when mday='25' then vtypes else null end,'') as t25,to_char(sum(case when mday='25' then vactotal else null end),'HH24:MI') as d25,case when regexp_replace(string_agg(case when mday='26' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='26' then vcomment else null end,','),',,',',','g') end as c26,string_agg(case when mday='26' then vtypes else null end,'') as t26,to_char(sum(case when mday='26' then vactotal else null end),'HH24:MI') as d26,case when regexp_replace(string_agg(case when mday='27' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='27' then vcomment else null end,','),',,',',','g') end as c27,string_agg(case when mday='27' then vtypes else null end,'') as t27,to_char(sum(case when mday='27' then vactotal else null end),'HH24:MI') as d27,case when regexp_replace(string_agg(case when mday='28' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='28' then vcomment else null end,','),',,',',','g') end as c28,string_agg(case when mday='28' then vtypes else null end,'') as t28,to_char(sum(case when mday='28' then vactotal else null end),'HH24:MI') as d28,case when regexp_replace(string_agg(case when mday='29' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='29' then vcomment else null end,','),',,',',','g') end as c29,string_agg(case when mday='29' then vtypes else null end,'') as t29,to_char(sum(case when mday='29' then vactotal else null end),'HH24:MI') as d29,case when regexp_replace(string_agg(case when mday='30' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='30' then vcomment else null end,','),',,',',','g') end as c30,string_agg(case when mday='30' then vtypes else null end,'') as t30,to_char(sum(case when mday='30' then vactotal else null end),'HH24:MI') as d30,case when regexp_replace(string_agg(case when mday='31' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='31' then vcomment else null end,','),',,',',','g') end as c31,string_agg(case when mday='31' then vtypes else null end,'') as t31,to_char(sum(case when mday='31' then vactotal else null end),'HH24:MI') as d31, to_char(sum(vacillhours),'HH24:MI') as totalill,
+ to_char(sum(vacextrahours),'HH24:MI') as totalextra,
+ to_char(sum(vacancyhours),'HH24:MI') as totalvac from (
+ select st.prename,st.surname,spd.id_staff,to_char(spd.daydate,'YYYY') as vacyear,spd.daydate,sg.id as id_staffgroup,sg.groupname,
+ coalesce(spd.vacancyhours::interval,'00:00:00'::interval) + coalesce(spd.vacillhours::interval,'00:00:00'::interval) + coalesce(spd.vacextrahours::interval,'00:00:00'::interval) as vactotal,
+ spd.vacancyhours,spd.vacillhours,spd.vacextrahours,
+ spd.vacancycomment, spd.vacillcomment, spd.vacextracomment,
+ case when spd.vacancyhours is not null then 'n' else '' end || case when spd.vacillhours is not null then 'i' else '' end || case when spd.vacextrahours is not null then 'e' else '' end as vtypes,
+ coalesce(spd.vacancycomment,'') || ',' || coalesce(spd.vacillcomment,'') || ',' || coalesce(spd.vacextracomment,'') as vcomment,
+ to_char(spd.daydate,'DD') as mday,
+ to_char(spd.daydate,'MM') as mmonth,
+ to_char(spd.daydate,'YYYY') as myear
+ from demo2m17.staffreportperioddays spd
+ join demo2m17.staff st on (st.id=spd.id_staff)
+ join demo2m17.staffgroups sg on (st.id_staffgroup=sg.id)
+ where (spd.vacancyhours is not null or spd.vacillhours is not null or spd.vacextrahours is not null) and id_staff='29488caf-66ac-84e6-ab9b-1aebadd8bcf2'
+ ) vd group by staffname,groupname,id_staff,myear,mmonth order by myear,staffname,mmonth
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select * from demo2m17.staff where id='a32da709-0202-71c4-43c9-bc89fdf5aaba' and isdeleted is null;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT id,id as id_staffcontract,id_staff,startdate,enddate,weekdays,to_char(weekhours, 'HH24:MI'::text) AS weekhours,defaultfreedays from demo2m17.staffcontract where id_staff='a32da709-0202-71c4-43c9-bc89fdf5aaba' order by startdate,enddate;
+cextra,'HH24:MI') as vacextra,
+ coalesce(to_char(plan.vacnormalplanned,'HH24:MI'),'00:00') as vacnormalplanned,
+ coalesce(to_char(plan.vacextraplanned,'HH24:MI'),'00:00') as vacextraplanned,
+ coalesce(to_char(plan.vacnormalplanned + plan.vacextraplanned,'HH24:MI'),'00:00') as vacplanned,
+ coalesce(to_char(vac.vacnormal + vac.vacrestbefore + vac.vacextra,'HH24:MI'),'00:00') as vactotal
+ from (
+ select id_staff,vacyear,
+ sum(case when vactype is null or vactype ='normal' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacnormal,
+ sum(case when vactype ='rest' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacrestbefore,
+ sum(case when vactype ='extra' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacextra
+ from demo2m17.staffvacancyyear group by id_staff,vacyear ) vac
+ left join (
+ select id_staff,date_part('year',daydate) as vyear,
+ coalesce(sum(vacancyhours),'00:00:00'::interval) as vacnormalplanned,
+ coalesce(sum(vacextrahours),'00:00:00'::interval) as vacextraplanned
+ from demo2m17.staffreportperioddays
+ where (vacancyhours is not null or vacextrahours is not null)
+ group by vyear,id_staff) plan on (vac.id_staff=plan.id_staff and vac.vacyear=plan.vyear)
+ where vac.id_staff='a32da709-0202-71c4-43c9-bc89fdf5aaba'
+ order by vacyear DESC;
+QUERYARRAY: select id_staff || '_' || mmonth || '_' || myear as id,surname || ' ' || prename as staffname ,id_staff,groupname,
+ -- vacancyhours,vacillhours,vacextrahours,vacancycomment,vacillcomment,vacextracomment,mday,daydate,vactotal,
+ mmonth,myear, case when regexp_replace(string_agg(case when mday='01' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='01' then vcomment else null end,','),',,',',','g') end as c01,string_agg(case when mday='01' then vtypes else null end,'') as t01,to_char(sum(case when mday='01' then vactotal else null end),'HH24:MI') as d01,case when regexp_replace(string_agg(case when mday='02' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='02' then vcomment else null end,','),',,',',','g') end as c02,string_agg(case when mday='02' then vtypes else null end,'') as t02,to_char(sum(case when mday='02' then vactotal else null end),'HH24:MI') as d02,case when regexp_replace(string_agg(case when mday='03' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='03' then vcomment else null end,','),',,',',','g') end as c03,string_agg(case when mday='03' then vtypes else null end,'') as t03,to_char(sum(case when mday='03' then vactotal else null end),'HH24:MI') as d03,case when regexp_replace(string_agg(case when mday='04' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='04' then vcomment else null end,','),',,',',','g') end as c04,string_agg(case when mday='04' then vtypes else null end,'') as t04,to_char(sum(case when mday='04' then vactotal else null end),'HH24:MI') as d04,case when regexp_replace(string_agg(case when mday='05' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='05' then vcomment else null end,','),',,',',','g') end as c05,string_agg(case when mday='05' then vtypes else null end,'') as t05,to_char(sum(case when mday='05' then vactotal else null end),'HH24:MI') as d05,case when regexp_replace(string_agg(case when mday='06' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='06' then vcomment else null end,','),',,',',','g') end as c06,string_agg(case when mday='06' then vtypes else null end,'') as t06,to_char(sum(case when mday='06' then vactotal else null end),'HH24:MI') as d06,case when regexp_replace(string_agg(case when mday='07' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='07' then vcomment else null end,','),',,',',','g') end as c07,string_agg(case when mday='07' then vtypes else null end,'') as t07,to_char(sum(case when mday='07' then vactotal else null end),'HH24:MI') as d07,case when regexp_replace(string_agg(case when mday='08' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='08' then vcomment else null end,','),',,',',','g') end as c08,string_agg(case when mday='08' then vtypes else null end,'') as t08,to_char(sum(case when mday='08' then vactotal else null end),'HH24:MI') as d08,case when regexp_replace(string_agg(case when mday='09' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='09' then vcomment else null end,','),',,',',','g') end as c09,string_agg(case when mday='09' then vtypes else null end,'') as t09,to_char(sum(case when mday='09' then vactotal else null end),'HH24:MI') as d09,case when regexp_replace(string_agg(case when mday='10' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='10' then vcomment else null end,','),',,',',','g') end as c10,string_agg(case when mday='10' then vtypes else null end,'') as t10,to_char(sum(case when mday='10' then vactotal else null end),'HH24:MI') as d10,case when regexp_replace(string_agg(case when mday='11' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='11' then vcomment else null end,','),',,',',','g') end as c11,string_agg(case when mday='11' then vtypes else null end,'') as t11,to_char(sum(case when mday='11' then vactotal else null end),'HH24:MI') as d11,case when regexp_replace(string_agg(case when mday='12' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='12' then vcomment else null end,','),',,',',','g') end as c12,string_agg(case when mday='12' then vtypes else null end,'') as t12,to_char(sum(case when mday='12' then vactotal else null end),'HH24:MI') as d12,case when regexp_replace(string_agg(case when mday='13' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='13' then vcomment else null end,','),',,',',','g') end as c13,string_agg(case when mday='13' then vtypes else null end,'') as t13,to_char(sum(case when mday='13' then vactotal else null end),'HH24:MI') as d13,case when regexp_replace(string_agg(case when mday='14' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='14' then vcomment else null end,','),',,',',','g') end as c14,string_agg(case when mday='14' then vtypes else null end,'') as t14,to_char(sum(case when mday='14' then vactotal else null end),'HH24:MI') as d14,case when regexp_replace(string_agg(case when mday='15' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='15' then vcomment else null end,','),',,',',','g') end as c15,string_agg(case when mday='15' then vtypes else null end,'') as t15,to_char(sum(case when mday='15' then vactotal else null end),'HH24:MI') as d15,case when regexp_replace(string_agg(case when mday='16' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='16' then vcomment else null end,','),',,',',','g') end as c16,string_agg(case when mday='16' then vtypes else null end,'') as t16,to_char(sum(case when mday='16' then vactotal else null end),'HH24:MI') as d16,case when regexp_replace(string_agg(case when mday='17' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='17' then vcomment else null end,','),',,',',','g') end as c17,string_agg(case when mday='17' then vtypes else null end,'') as t17,to_char(sum(case when mday='17' then vactotal else null end),'HH24:MI') as d17,case when regexp_replace(string_agg(case when mday='18' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='18' then vcomment else null end,','),',,',',','g') end as c18,string_agg(case when mday='18' then vtypes else null end,'') as t18,to_char(sum(case when mday='18' then vactotal else null end),'HH24:MI') as d18,case when regexp_replace(string_agg(case when mday='19' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='19' then vcomment else null end,','),',,',',','g') end as c19,string_agg(case when mday='19' then vtypes else null end,'') as t19,to_char(sum(case when mday='19' then vactotal else null end),'HH24:MI') as d19,case when regexp_replace(string_agg(case when mday='20' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='20' then vcomment else null end,','),',,',',','g') end as c20,string_agg(case when mday='20' then vtypes else null end,'') as t20,to_char(sum(case when mday='20' then vactotal else null end),'HH24:MI') as d20,case when regexp_replace(string_agg(case when mday='21' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='21' then vcomment else null end,','),',,',',','g') end as c21,string_agg(case when mday='21' then vtypes else null end,'') as t21,to_char(sum(case when mday='21' then vactotal else null end),'HH24:MI') as d21,case when regexp_replace(string_agg(case when mday='22' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='22' then vcomment else null end,','),',,',',','g') end as c22,string_agg(case when mday='22' then vtypes else null end,'') as t22,to_char(sum(case when mday='22' then vactotal else null end),'HH24:MI') as d22,case when regexp_replace(string_agg(case when mday='23' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='23' then vcomment else null end,','),',,',',','g') end as c23,string_agg(case when mday='23' then vtypes else null end,'') as t23,to_char(sum(case when mday='23' then vactotal else null end),'HH24:MI') as d23,case when regexp_replace(string_agg(case when mday='24' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='24' then vcomment else null end,','),',,',',','g') end as c24,string_agg(case when mday='24' then vtypes else null end,'') as t24,to_char(sum(case when mday='24' then vactotal else null end),'HH24:MI') as d24,case when regexp_replace(string_agg(case when mday='25' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='25' then vcomment else null end,','),',,',',','g') end as c25,string_agg(case when mday='25' then vtypes else null end,'') as t25,to_char(sum(case when mday='25' then vactotal else null end),'HH24:MI') as d25,case when regexp_replace(string_agg(case when mday='26' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='26' then vcomment else null end,','),',,',',','g') end as c26,string_agg(case when mday='26' then vtypes else null end,'') as t26,to_char(sum(case when mday='26' then vactotal else null end),'HH24:MI') as d26,case when regexp_replace(string_agg(case when mday='27' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='27' then vcomment else null end,','),',,',',','g') end as c27,string_agg(case when mday='27' then vtypes else null end,'') as t27,to_char(sum(case when mday='27' then vactotal else null end),'HH24:MI') as d27,case when regexp_replace(string_agg(case when mday='28' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='28' then vcomment else null end,','),',,',',','g') end as c28,string_agg(case when mday='28' then vtypes else null end,'') as t28,to_char(sum(case when mday='28' then vactotal else null end),'HH24:MI') as d28,case when regexp_replace(string_agg(case when mday='29' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='29' then vcomment else null end,','),',,',',','g') end as c29,string_agg(case when mday='29' then vtypes else null end,'') as t29,to_char(sum(case when mday='29' then vactotal else null end),'HH24:MI') as d29,case when regexp_replace(string_agg(case when mday='30' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='30' then vcomment else null end,','),',,',',','g') end as c30,string_agg(case when mday='30' then vtypes else null end,'') as t30,to_char(sum(case when mday='30' then vactotal else null end),'HH24:MI') as d30,case when regexp_replace(string_agg(case when mday='31' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='31' then vcomment else null end,','),',,',',','g') end as c31,string_agg(case when mday='31' then vtypes else null end,'') as t31,to_char(sum(case when mday='31' then vactotal else null end),'HH24:MI') as d31, to_char(sum(vacillhours),'HH24:MI') as totalill,
+ to_char(sum(vacextrahours),'HH24:MI') as totalextra,
+ to_char(sum(vacancyhours),'HH24:MI') as totalvac from (
+ select st.prename,st.surname,spd.id_staff,to_char(spd.daydate,'YYYY') as vacyear,spd.daydate,sg.id as id_staffgroup,sg.groupname,
+ coalesce(spd.vacancyhours::interval,'00:00:00'::interval) + coalesce(spd.vacillhours::interval,'00:00:00'::interval) + coalesce(spd.vacextrahours::interval,'00:00:00'::interval) as vactotal,
+ spd.vacancyhours,spd.vacillhours,spd.vacextrahours,
+ spd.vacancycomment, spd.vacillcomment, spd.vacextracomment,
+ case when spd.vacancyhours is not null then 'n' else '' end || case when spd.vacillhours is not null then 'i' else '' end || case when spd.vacextrahours is not null then 'e' else '' end as vtypes,
+ coalesce(spd.vacancycomment,'') || ',' || coalesce(spd.vacillcomment,'') || ',' || coalesce(spd.vacextracomment,'') as vcomment,
+ to_char(spd.daydate,'DD') as mday,
+ to_char(spd.daydate,'MM') as mmonth,
+ to_char(spd.daydate,'YYYY') as myear
+ from demo2m17.staffreportperioddays spd
+ join demo2m17.staff st on (st.id=spd.id_staff)
+ join demo2m17.staffgroups sg on (st.id_staffgroup=sg.id)
+ where (spd.vacancyhours is not null or spd.vacillhours is not null or spd.vacextrahours is not null) and id_staff='a32da709-0202-71c4-43c9-bc89fdf5aaba'
+ ) vd group by staffname,groupname,id_staff,myear,mmonth order by myear,staffname,mmonth
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select * from demo2m17.staff where id='8ad632ef-aa14-468d-ede6-283cb9c1ce24' and isdeleted is null;
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERYARRAY: SELECT id,id as id_staffcontract,id_staff,startdate,enddate,weekdays,to_char(weekhours, 'HH24:MI'::text) AS weekhours,defaultfreedays from demo2m17.staffcontract where id_staff='8ad632ef-aa14-468d-ede6-283cb9c1ce24' order by startdate,enddate;
+QUERYARRAY: select vac.id_staff || '-' || vac.vacyear as id,vac.id_staff,vac.vacyear,
+ to_char(vac.vacnormal,'HH24:MI') as vachours,
+ to_char(vac.vacnormal,'HH24:MI') as vacnormal,
+ to_char(vac.vacrestbefore,'HH24:MI') as vacrestbefore,
+ to_char(vac.vacextra,'HH24:MI') as vacextra,
+ coalesce(to_char(plan.vacnormalplanned,'HH24:MI'),'00:00') as vacnormalplanned,
+ coalesce(to_char(plan.vacextraplanned,'HH24:MI'),'00:00') as vacextraplanned,
+ coalesce(to_char(plan.vacnormalplanned + plan.vacextraplanned,'HH24:MI'),'00:00') as vacplanned,
+ coalesce(to_char(vac.vacnormal + vac.vacrestbefore + vac.vacextra,'HH24:MI'),'00:00') as vactotal
+ from (
+ select id_staff,vacyear,
+ sum(case when vactype is null or vactype ='normal' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacnormal,
+ sum(case when vactype ='rest' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacrestbefore,
+ sum(case when vactype ='extra' then coalesce(vachours,'00:00:00'::interval) else '00:00:00'::interval end) as vacextra
+ from demo2m17.staffvacancyyear group by id_staff,vacyear ) vac
+ left join (
+ select id_staff,date_part('year',daydate) as vyear,
+ coalesce(sum(vacancyhours),'00:00:00'::interval) as vacnormalplanned,
+ coalesce(sum(vacextrahours),'00:00:00'::interval) as vacextraplanned
+ from demo2m17.staffreportperioddays
+ where (vacancyhours is not null or vacextrahours is not null)
+ group by vyear,id_staff) plan on (vac.id_staff=plan.id_staff and vac.vacyear=plan.vyear)
+ where vac.id_staff='8ad632ef-aa14-468d-ede6-283cb9c1ce24'
+ order by vacyear DESC;
+QUERYARRAY: select id_staff || '_' || mmonth || '_' || myear as id,surname || ' ' || prename as staffname ,id_staff,groupname,
+ -- vacancyhours,vacillhours,vacextrahours,vacancycomment,vacillcomment,vacextracomment,mday,daydate,vactotal,
+ mmonth,myear, case when regexp_replace(string_agg(case when mday='01' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='01' then vcomment else null end,','),',,',',','g') end as c01,string_agg(case when mday='01' then vtypes else null end,'') as t01,to_char(sum(case when mday='01' then vactotal else null end),'HH24:MI') as d01,case when regexp_replace(string_agg(case when mday='02' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='02' then vcomment else null end,','),',,',',','g') end as c02,string_agg(case when mday='02' then vtypes else null end,'') as t02,to_char(sum(case when mday='02' then vactotal else null end),'HH24:MI') as d02,case when regexp_replace(string_agg(case when mday='03' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='03' then vcomment else null end,','),',,',',','g') end as c03,string_agg(case when mday='03' then vtypes else null end,'') as t03,to_char(sum(case when mday='03' then vactotal else null end),'HH24:MI') as d03,case when regexp_replace(string_agg(case when mday='04' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='04' then vcomment else null end,','),',,',',','g') end as c04,string_agg(case when mday='04' then vtypes else null end,'') as t04,to_char(sum(case when mday='04' then vactotal else null end),'HH24:MI') as d04,case when regexp_replace(string_agg(case when mday='05' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='05' then vcomment else null end,','),',,',',','g') end as c05,string_agg(case when mday='05' then vtypes else null end,'') as t05,to_char(sum(case when mday='05' then vactotal else null end),'HH24:MI') as d05,case when regexp_replace(string_agg(case when mday='06' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='06' then vcomment else null end,','),',,',',','g') end as c06,string_agg(case when mday='06' then vtypes else null end,'') as t06,to_char(sum(case when mday='06' then vactotal else null end),'HH24:MI') as d06,case when regexp_replace(string_agg(case when mday='07' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='07' then vcomment else null end,','),',,',',','g') end as c07,string_agg(case when mday='07' then vtypes else null end,'') as t07,to_char(sum(case when mday='07' then vactotal else null end),'HH24:MI') as d07,case when regexp_replace(string_agg(case when mday='08' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='08' then vcomment else null end,','),',,',',','g') end as c08,string_agg(case when mday='08' then vtypes else null end,'') as t08,to_char(sum(case when mday='08' then vactotal else null end),'HH24:MI') as d08,case when regexp_replace(string_agg(case when mday='09' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='09' then vcomment else null end,','),',,',',','g') end as c09,string_agg(case when mday='09' then vtypes else null end,'') as t09,to_char(sum(case when mday='09' then vactotal else null end),'HH24:MI') as d09,case when regexp_replace(string_agg(case when mday='10' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='10' then vcomment else null end,','),',,',',','g') end as c10,string_agg(case when mday='10' then vtypes else null end,'') as t10,to_char(sum(case when mday='10' then vactotal else null end),'HH24:MI') as d10,case when regexp_replace(string_agg(case when mday='11' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='11' then vcomment else null end,','),',,',',','g') end as c11,string_agg(case when mday='11' then vtypes else null end,'') as t11,to_char(sum(case when mday='11' then vactotal else null end),'HH24:MI') as d11,case when regexp_replace(string_agg(case when mday='12' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='12' then vcomment else null end,','),',,',',','g') end as c12,string_agg(case when mday='12' then vtypes else null end,'') as t12,to_char(sum(case when mday='12' then vactotal else null end),'HH24:MI') as d12,case when regexp_replace(string_agg(case when mday='13' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='13' then vcomment else null end,','),',,',',','g') end as c13,string_agg(case when mday='13' then vtypes else null end,'') as t13,to_char(sum(case when mday='13' then vactotal else null end),'HH24:MI') as d13,case when regexp_replace(string_agg(case when mday='14' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='14' then vcomment else null end,','),',,',',','g') end as c14,string_agg(case when mday='14' then vtypes else null end,'') as t14,to_char(sum(case when mday='14' then vactotal else null end),'HH24:MI') as d14,case when regexp_replace(string_agg(case when mday='15' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='15' then vcomment else null end,','),',,',',','g') end as c15,string_agg(case when mday='15' then vtypes else null end,'') as t15,to_char(sum(case when mday='15' then vactotal else null end),'HH24:MI') as d15,case when regexp_replace(string_agg(case when mday='16' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='16' then vcomment else null end,','),',,',',','g') end as c16,string_agg(case when mday='16' then vtypes else null end,'') as t16,to_char(sum(case when mday='16' then vactotal else null end),'HH24:MI') as d16,case when regexp_replace(string_agg(case when mday='17' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='17' then vcomment else null end,','),',,',',','g') end as c17,string_agg(case when mday='17' then vtypes else null end,'') as t17,to_char(sum(case when mday='17' then vactotal else null end),'HH24:MI') as d17,case when regexp_replace(string_agg(case when mday='18' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='18' then vcomment else null end,','),',,',',','g') end as c18,string_agg(case when mday='18' then vtypes else null end,'') as t18,to_char(sum(case when mday='18' then vactotal else null end),'HH24:MI') as d18,case when regexp_replace(string_agg(case when mday='19' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='19' then vcomment else null end,','),',,',',','g') end as c19,string_agg(case when mday='19' then vtypes else null end,'') as t19,to_char(sum(case when mday='19' then vactotal else null end),'HH24:MI') as d19,case when regexp_replace(string_agg(case when mday='20' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='20' then vcomment else null end,','),',,',',','g') end as c20,string_agg(case when mday='20' then vtypes else null end,'') as t20,to_char(sum(case when mday='20' then vactotal else null end),'HH24:MI') as d20,case when regexp_replace(string_agg(case when mday='21' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='21' then vcomment else null end,','),',,',',','g') end as c21,string_agg(case when mday='21' then vtypes else null end,'') as t21,to_char(sum(case when mday='21' then vactotal else null end),'HH24:MI') as d21,case when regexp_replace(string_agg(case when mday='22' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='22' then vcomment else null end,','),',,',',','g') end as c22,string_agg(case when mday='22' then vtypes else null end,'') as t22,to_char(sum(case when mday='22' then vactotal else null end),'HH24:MI') as d22,case when regexp_replace(string_agg(case when mday='23' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='23' then vcomment else null end,','),',,',',','g') end as c23,string_agg(case when mday='23' then vtypes else null end,'') as t23,to_char(sum(case when mday='23' then vactotal else null end),'HH24:MI') as d23,case when regexp_replace(string_agg(case when mday='24' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='24' then vcomment else null end,','),',,',',','g') end as c24,string_agg(case when mday='24' then vtypes else null end,'') as t24,to_char(sum(case when mday='24' then vactotal else null end),'HH24:MI') as d24,case when regexp_replace(string_agg(case when mday='25' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='25' then vcomment else null end,','),',,',',','g') end as c25,string_agg(case when mday='25' then vtypes else null end,'') as t25,to_char(sum(case when mday='25' then vactotal else null end),'HH24:MI') as d25,case when regexp_replace(string_agg(case when mday='26' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='26' then vcomment else null end,','),',,',',','g') end as c26,string_agg(case when mday='26' then vtypes else null end,'') as t26,to_char(sum(case when mday='26' then vactotal else null end),'HH24:MI') as d26,case when regexp_replace(string_agg(case when mday='27' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='27' then vcomment else null end,','),',,',',','g') end as c27,string_agg(case when mday='27' then vtypes else null end,'') as t27,to_char(sum(case when mday='27' then vactotal else null end),'HH24:MI') as d27,case when regexp_replace(string_agg(case when mday='28' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='28' then vcomment else null end,','),',,',',','g') end as c28,string_agg(case when mday='28' then vtypes else null end,'') as t28,to_char(sum(case when mday='28' then vactotal else null end),'HH24:MI') as d28,case when regexp_replace(string_agg(case when mday='29' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='29' then vcomment else null end,','),',,',',','g') end as c29,string_agg(case when mday='29' then vtypes else null end,'') as t29,to_char(sum(case when mday='29' then vactotal else null end),'HH24:MI') as d29,case when regexp_replace(string_agg(case when mday='30' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='30' then vcomment else null end,','),',,',',','g') end as c30,string_agg(case when mday='30' then vtypes else null end,'') as t30,to_char(sum(case when mday='30' then vactotal else null end),'HH24:MI') as d30,case when regexp_replace(string_agg(case when mday='31' then vcomment else null end,','),',,',',','g') = ',' then null else regexp_replace(string_agg(case when mday='31' then vcomment else null end,','),',,',',','g') end as c31,string_agg(case when mday='31' then vtypes else null end,'') as t31,to_char(sum(case when mday='31' then vactotal else null end),'HH24:MI') as d31, to_char(sum(vacillhours),'HH24:MI') as totalill,
+ to_char(sum(vacextrahours),'HH24:MI') as totalextra,
+ to_char(sum(vacancyhours),'HH24:MI') as totalvac from (
+ select st.prename,st.surname,spd.id_staff,to_char(spd.daydate,'YYYY') as vacyear,spd.daydate,sg.id as id_staffgroup,sg.groupname,
+ coalesce(spd.vacancyhours::interval,'00:00:00'::interval) + coalesce(spd.vacillhours::interval,'00:00:00'::interval) + coalesce(spd.vacextrahours::interval,'00:00:00'::interval) as vactotal,
+ spd.vacancyhours,spd.vacillhours,spd.vacextrahours,
+ spd.vacancycomment, spd.vacillcomment, spd.vacextracomment,
+ case when spd.vacancyhours is not null then 'n' else '' end || case when spd.vacillhours is not null then 'i' else '' end || case when spd.vacextrahours is not null then 'e' else '' end as vtypes,
+ coalesce(spd.vacancycomment,'') || ',' || coalesce(spd.vacillcomment,'') || ',' || coalesce(spd.vacextracomment,'') as vcomment,
+ to_char(spd.daydate,'DD') as mday,
+ to_char(spd.daydate,'MM') as mmonth,
+ to_char(spd.daydate,'YYYY') as myear
+ from demo2m17.staffreportperioddays spd
+ join demo2m17.staff st on (st.id=spd.id_staff)
+ join demo2m17.staffgroups sg on (st.id_staffgroup=sg.id)
+ where (spd.vacancyhours is not null or spd.vacillhours is not null or spd.vacextrahours is not null) and id_staff='8ad632ef-aa14-468d-ede6-283cb9c1ce24'
+ ) vd group by staffname,groupname,id_staff,myear,mmonth order by myear,staffname,mmonth
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select timetrackertype,sector,portal,module_vacancy,datasetname from public.companies where schemata='demo2m17';
+QUERY: select se.id as idsession,us.lang,us.id,us.username,ugrp.id as usergroup,replace(replace(replace(us.id_staffgroups::text,'"',''),'[',''),']','') as staffgroups,se.sessiondata from sessions se
+ join users us on (us.id=se.id_user)
+ left join usergroups ugrp on (ugrp.id=us.id_usergroup)
+ where se.id= 'f071dc36-b9d5-4e26-10c5-944e452fa126' and se.remote_addr= '::1' and se.user_agent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0' and
+ us.isblocked is null group by se.id,us.id,ugrp.id;
+QUERY: select terms from demo2m17.users where id='e9e6880b-75c7-70b5-ce61-49cf6d62630f';
+QUERYARRAY: SELECT distinct(us.schema_name),case when cp.company is null then 'schema:' || us.schema_name else company end as company ,
+ us.schema_name AS schemaname,
+ case when datasetname is null then 'schema:' || us.schema_name else datasetname end as datasetname
+ FROM ( select schema_name from information_schema.schemata where schema_owner != 'postgres' and schema_name != 'public') us
+ JOIN companies cp ON cp.schemata = us.schema_name AND cp.isdeleted IS null and cp.company is not null and cp.portal='app';