v20210319
authorkilian (dks-laptop) <ksaffran@dks.lu>
Fri, 19 Mar 2021 12:00:45 +0000 (13:00 +0100)
committerkilian (dks-laptop) <ksaffran@dks.lu>
Fri, 19 Mar 2021 12:00:45 +0000 (13:00 +0100)
app/lib/POT/Staff.php
app/tmpl/module/periods/reportperiod.js

index ff678c2..a3fd2d4 100644 (file)
@@ -97,7 +97,7 @@ where sc.id_staff='".$id_staff."'
       }
       $chsql = "select sum(maxdays) as maxdays,sum(contracthours - ('00:00:'|| extract(second from contracthours))::interval ) as itmcontracthours from (
 select sum(maxdays) as maxdays,sum(maxdays) * (round(cast(((extract(epoch from (current_date + weekhours::interval)::timestamp) - extract(epoch from current_date::timestamp))/3600.0) /weekdays as numeric) ,2)+0.00) * '01:00:00'::interval as contracthours from (
-select case when count(daydate) >= weekdays then weekdays else weekdays-count(daydate)-count(sundays) end as maxdays, calweek,count(daydate) as cntdays,count(sundays) as sundays,weekdays,weekhours from (
+select case when count(daydate) >= weekdays then weekdays else weekdays-count(daydate)-1 end as maxdays, calweek,count(daydate) as cntdays,count(sundays) as sundays,weekdays,weekhours from (
        
        select id_staff,date(date_trunc('week',daydate)) as calweek,daydate,case when date_part('isodow',daydate)::int4=7 then 1 else null end as sundays
        from ".$schema.".staffreportperioddays 
@@ -122,6 +122,7 @@ left join (
 // ) wdays ) rnddays;";
       //OLD
      // print STDERR "CONTRACT:".$chsql."\n========\n";
+     error_log("set contract:".$chsql);
       $checkhours = $this->dbh->query($chsql);
 
       $usql = "update ".$schema.".staffreportperiod set maxdays=".(($checkhours["maxdays"] != "")?$checkhours["maxdays"]:'null').",contracthours=".(($checkhours["itmcontracthours"] !=  "")?"'".$checkhours["itmcontracthours"]."'":'null')." where id_staff='".$id_staff."' and id_reportperiod='".$pp["id"]."';" ;
index 9c6c941..661fe7e 100644 (file)
@@ -89,7 +89,7 @@ let reportperiod ={
         {title: '<span style="font-size: 9pt;">{{ lbl.suppsunwork }}</span>',width: 50, field:"suppvacancysunwork",hozAlign:"right",headerSort: false,headerVertical:true},
         {title: '<span style="font-size: 8pt;">{{ lbl.avgweek_short }}</span>',width: 60, field:"avgtotalweekhours",hozAlign:"right",headerSort: false,formatter:periodAVGFormatter},
         {title: '<span style="font-size: 9pt;">{{ lbl.validated }}</span>',width: 40, field:"isvalidated",hozAlign:"center",headerSort: false,formatter:"tickCross", formatterParams:{allowEmpty:true,allowTruthy: false},headerVertical:true},
-        // {title: '<span style="font-size: 9pt;">{{ lbl.maxdays }}</span>',width: 60, field:"maxdays",hozAlign:"center",headerSort: false}
+        {title: '<span style="font-size: 9pt;">{{ lbl.maxdays }}</span>',width: 60, field:"maxdays",hozAlign:"center",headerSort: false}
         
       ] 
     });