From: Kilian Saffran Date: Wed, 7 Apr 2021 08:13:44 +0000 (+0200) Subject: v20210407 X-Git-Url: http://cloud.dks.lu/git/?a=commitdiff_plain;h=3933e1d79109d99f529ced73e6aed2db8015a477;p=pot_lu.git v20210407 --- diff --git a/app/api.php b/app/api.php new file mode 100644 index 00000000..f44eafac --- /dev/null +++ b/app/api.php @@ -0,0 +1,71 @@ + $value) + { + if ((is_file("lib/".$value) && strpos($value,'.') !== 0) && substr_compare($value, ".php", -strlen(".php")) === 0){ + //error_log("lib/".$value); + require("lib/".$value); + } + } + $moduleclasses = scandir("lib/POT"); + foreach ($moduleclasses as $key => $value) + { + if ((is_file("lib/POT/".$value) && strpos($value,'.') !== 0) && substr_compare($value, ".php", -strlen(".php")) === 0){ + //echo $value."
"; + //error_log("lib/POT/".$value); + require("lib/POT/".$value); + } + } + $html = array( "result" => null); + $db = new database($cfg["db"]); + $tracker = null; + header('Content-Type: text/plain'); + if (isset($_SERVER["HTTP_POT_TRACKER"]) && isset($_SERVER["HTTP_POT_SCHEMA"]) && isset($_SERVER["HTTP_POT_API_KEY"]) && ($_SERVER["HTTP_USER_AGENT"] == "POT Hourtrax") ){ + $tracker = $db->query("select * from ".$_SERVER["HTTP_POT_SCHEMA"].".timetrackerconfig where trackerhostname='".$_SERVER["HTTP_POT_TRACKER"]."' and authmethod='".$_SERVER["HTTP_POT_API_KEY"]."';"); + } + //echo print_r($_SERVER,true); + //echo print_r($_POST,true); + //echo print_r($tracker,true); + if (isset($tracker["id"])){ + $p=$_POST; + if (isset($p["cl"]) && isset($p["fn"]) && $p["cl"] != "database"){ + + if (class_exists($p["cl"])) { + //error_log("Class ".$p["cl"]." exists" ); + $strclass=$p["cl"]; + $cl = new $strclass($db,$cfg); + if (!method_exists($cl,$p["fn"])){ + $html["error"] = "class ".$p["cl"]."->method ".$p["fn"]." does not exist!"; + } + $r = new ReflectionMethod($strclass, $p["fn"]); + $metparams = $r->getParameters(); + $fnp = array(); + $prcnt = 0; + foreach ($metparams as $pp) { + //error_log("param: ".$pp->getName()); + if (isset($p[$pp->getName()])){ + array_push($fnp,$p[$pp->getName()]); + } + if ($pp->isOptional() === false){ + $prcnt++; + } + $html["fnparams"][$pp->getName()] = (($pp->isOptional() === true)?"optional":"required"); + } + //error_log(print_r($fnp,true)); + if (count($fnp) < $prcnt){ + $html["error"] = "Function has ".$prcnt." required parameters!"; + } else { + echo "call fn"; + $html["result"]["data"] = call_user_func_array(array($cl, $p["fn"]), $fnp); + //error_log(print_r($html,true)); + } + } else { + $html["error"] = "class ".$params["cl"]." does not exist!"; + } + } + + json_encode($html); + } + + +?> \ No newline at end of file diff --git a/app/db.php b/app/db.php index efe94338..f6fc02f5 100644 --- a/app/db.php +++ b/app/db.php @@ -1,7 +1,7 @@ $value) { if ((is_file("lib/".$value) && strpos($value,'.') !== 0) && substr_compare($value, ".php", -strlen(".php")) === 0){ @@ -237,7 +237,7 @@ } } - elseif ($p["fn"] == "setnewpassword"){ + elseif (isset($p["fn"]) && $p["fn"] == "setnewpassword"){ #$vcode = $se->randomstring(6); #$vcode = lc($vcode); #$db->exec("UPDATE users set vcode='".$vcode."' where id=".$sess["id"].";"); @@ -255,10 +255,10 @@ #$mret = $eml->sendemail('user_forgotpasswd',$p["email"],$data); } $html["result"]["data"] = $data; - } elseif ($p["fn"] == "genpwd"){ + } elseif (isset($p["fn"]) && $p["fn"] == "genpwd"){ $newpwd = $se->randomstring(12); $html["result"]["data"]["password"] = $newpwd; - } elseif ($p["fn"] == "savenewpwd"){ + } elseif (isset($p["fn"]) && $p["fn"] == "savenewpwd"){ if (length($db->securetext($p["pwd"])) > 9){ $pwd = hash('sha256',$db->securetext($p["pwd"])); $db->exec("UPDATE public.users SET userpassword = '".$pwd."' WHERE id='".$db->securetext($p["iduser"])."';"); diff --git a/app/lib/POT/Company.php b/app/lib/POT/Company.php index 106240c3..c134e101 100644 --- a/app/lib/POT/Company.php +++ b/app/lib/POT/Company.php @@ -176,6 +176,6 @@ on conflict on constraint worktimes_pkey do update set startdate=excluded.startdate, enddate=excluded.enddate, defaultdayhours=excluded.defaultdayhours, maxdayhours=excluded.maxdayhours, defaultweekhours=excluded.defaultweekhours, maxweekhours=excluded.maxweekhours, maxinterruptionhours=excluded.maxinterruptionhours, isdefault=excluded.isdefault, mindailyrecuperation=excluded.mindailyrecuperation, maxhourspercents=excluded.maxhourspercents;"; } - + } ?> \ No newline at end of file diff --git a/app/lib/POT/TimeTracker.php b/app/lib/POT/TimeTracker.php index be1c600b..e86c7953 100644 --- a/app/lib/POT/TimeTracker.php +++ b/app/lib/POT/TimeTracker.php @@ -28,7 +28,7 @@ public function getEmptyTrackDataSet($schema,$idstaff,$daydate){ } public function saveTrackDataSets($schema,$daydate,$idstaff,$trackdata){ - + //print STDERR Dumper($trackdata); $ttids = array(); foreach ($trackdata as $t ){ @@ -43,6 +43,24 @@ public function saveTrackDataSets($schema,$daydate,$idstaff,$trackdata){ return 1; } +public function setTracker($schema,$tracker,$data){ + $atdd = json_decode($data); + $tdd= $atdd[0]; + echo "Set Tracker!\n"; + //echo print_r($tdd,true); + $insnew = "INSERT INTO ".$schema.".timetracker (id,id_staff,daydate,stamp_in,stamp_in_tracker) VALUES ('".$tdd->id."','".$tdd->id_staff."',date('".$tdd->daydate."'),'".$tdd->stamp_in."','".$tracker."') on conflict on constraint timetracker_pkey do nothing;"; + //echo $insnew."\n"; + $this->dbh->exec($insnew); + if ($tdd["stamp_out"] != null) { + $updout= "UPDATE ".$schema.".timetracker SET stamp_out='".$tdd->stamp_out."',stamp_out_tracker='".$tracker."' WHERE id='".$tdd->id."';"; + //echo $updout."\n", + $this->dbh->exec($updout); + } + + return "OK"; +} + + // function SyncToTimeTracker(){ // } @@ -60,14 +78,127 @@ public function saveTrackDataSets($schema,$daydate,$idstaff,$trackdata){ return $this->dbh->queryarray($sql); } - public function syncToStation($schema,$id_staff){ + public function getStaffSQL($schema,$trackername,$id_staff = null){ + $where = ""; + if ($id_staff != null){ + $where = "where id_staff in ('".$id_staff."')"; + } + $stsql = "select id,prename,surname,isdeleted, + case when istimetrackenabled is null or timetrackers::text not like '%\"".$trackername."\"%' then true else null end as isdisabled, + timetrackerlang as lang,timetrackerfixtime as fixtime, + timetrackerpin as pin, timetrackerrestriction as restriction + from ".$schema.".staff ".$where.";"; + $stfdata = $this->dbh->queryarray($stsql); + $sqldata = ""; + foreach ($stfdata as $st){ + $sqldata .= $this->dbh->createReplaceDDL("staff",$st)."\n"; + } + $syncto="select * from ".$schema.".timetrackersync;"; - $stsql = "select * from ".$schema.".staff where id='".$id_staff."'"; + + $trackers = $this->dbh->queryarray($syncto); + #Create SQLITE staff REPLACE TO - $worksql = "select * from ".$schema.".staffreportperioddays where id='".$id_staff."' and daydate >= current_date;"; + $worksql = "select srpd.id,srpd.id_staff,srpd.daydate,srpd.timestart1,srpd.timestart2,srpd.timeend1,srpd.timeend2 from ".$schema.".staffreportperioddays srpd where srpd.daydate >= current_date and id_staff in (select id_staff from ".$schema.".staffreportperioddays where modified > '".$modtime."' group by id_staff);"; + $wkdata = $this->dbh->queryarray($worksql); + foreach ($wkdata as $wk){ + $sqldata .= $this->dbh->createReplaceDDL("staffworktimes",$wk)."\n"; + } + return $sqldata; + } + public function send_setstaff($schema,$id_staff){ + $stq = $this->dbh->query("select id, staffnumber,prename,surname,case when istimetrackenabled then 1 else null end as isenabled,timetrackerpin as pin, timetrackerfixtime as fixtime,timetrackerlang as lang, timetrackerrestriction as restriction from ".$schema.".staff where id='".$id_staff."'"); + $sth = $this->dbh->query("select id,timetrackers from ".$schema.".staff where id='".$id_staff."'"); + if ($sth["timetrackers"]){ + $hh = json_decode($sth["timetrackers"]); + } + if ($stq["id"]){ + foreach ($stq as $k => $v){ + $cmd .= $k.'='.$v.";"; + } + $cmd = 'bin/setstaff.sh \''.$cmd.'\''; + } + + //error_log("CMD to SEND:". $cmd); + $res = array(); + foreach ($hh as $host){ + $res[$host] = $this->exec_curl('{"cl":"ssh","fn":"exec","host":"'.$host.'","cmd":"'.$cmd.'"}'); + } + + return $res; } + public function send_cleanfp($schema,$id_staff){ + $stq = $this->dbh->query("select id,timetrackers from ".$schema.".staff where id='".$id_staff."'"); + $cmd = 'bin/clearfingerprint.sh '.$id_staff.''; + $res = array(); + $hh = json_decode($stq["timetrackers"]); + foreach ($hh as $host){ + $res[$host] = $this->exec_curl('{"cl":"ssh","fn":"exec","host":"'.$host.'","cmd":"'.$cmd.'"}'); + } + + return $res; + } + + private function exec_curl($data){ + $result = null; + //error_log("sending to ".$this->cfg["htxurl"]." -> ".$data); + try { + $curlconn = curl_init(); + $headers = array(); + curl_setopt($curlconn, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curlconn, CURLOPT_POST, 1); + curl_setopt($curlconn, CURLOPT_USERAGENT, $this->cfg["curlua"]); + array_push($headers,'Authorization: Basic '.base64_encode($this->cfg["htxuser"].':'.$this->cfg["htxpwd"])); + array_push($headers,'Content-Type: application/json'); + curl_setopt($curlconn, CURLOPT_HTTPHEADER, $headers); + #$fp = fopen(dirname(__FILE__).'/errorlog.txt', 'w'); + curl_setopt($curlconn, CURLOPT_URL, $this->cfg["htxurl"]); + curl_setopt($curlconn, CURLOPT_POSTFIELDS, $data); + curl_setopt($curlconn, CURLOPT_VERBOSE, 0); + # curl_setopt($curlconn, CURLOPT_STDERR, $fp); + + $result = curl_exec($curlconn); + + if (curl_errno($curlconn)){ + error_log('Curl Error:'.curl_error($curlconn)); + return null; + } + } catch(Exception $e){ + error_log("CURL init Error : ".$e->getMessage()); + } + return $result; + } + + public function getWeekStamps($schema,$date){ + + $xsql = "select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from ".$schema.".staffcontract sc join ".$schema.".staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('".$date."') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('".$date."') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from ".$schema.".timetracker tt where tt.daydate between date_trunc('week',date('".$date."')) and date(date_trunc('week',date('".$date."')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;"; + //file_put_contents("sql.log",$schema.$date.$xsql,FILE_APPEND); + return $this->dbh->queryarray($xsql); + } + + } ?> diff --git a/app/lib/config.php b/app/lib/config.php index 1745a7dc..5090ecd4 100644 --- a/app/lib/config.php +++ b/app/lib/config.php @@ -15,6 +15,10 @@ "user" => 'potlu2_user', "password" => 'dMY8xGB6cBLzrDGE', ), + "htxuser" => "htx", + "htxpwd" => "Aib5aevo", + "htxurl" => "https://htx.plandutravail.lu/htx/api.php", + "curlua" => "POT Local Test Server", //"liveurl" => "https://app.plandutravail.lu", // "cookie" => "potlu140", // "db"=> array( @@ -33,6 +37,7 @@ // "user" => 'potlubeta_user', // "password" => 'EHkxYW8gJ7NERu5H', // ), + "tmppath" => "data/tmp/", "lang" => "de", "toolspath" => "tools", diff --git a/app/lib/database.php b/app/lib/database.php index 87c8a3e8..c34456b1 100644 --- a/app/lib/database.php +++ b/app/lib/database.php @@ -123,6 +123,17 @@ class database { $inssql = "INSERT INTO ".$schema.".".$table." (".implode(",",$dc).") VALUES (".implode(",",$dv).");"; return $inssql; } + + public function createReplaceDDL($table,$data,$schema=null){ + $dc = array(); + $dv = array(); + foreach ($data as $col => $val){ + array_push($dc,$col); + array_push($dv,$this->value($val)); + } + $replsql = "REPLACE INTO ".(($schema != null)?$schema.".":"").$table." (".implode(",",$dc).") VALUES (".implode(",",$dv).");"; + return $replsql; + } public function newuuid(){ $nid = $this->query("SELECT lower(hex( randomblob(4)) || '-' || hex( randomblob(2)) || '-' || hex( randomblob(2)) || '-' || hex( randomblob(2)) || '-' || hex(randomblob(6))) as id;"); diff --git a/app/lib/lang/de.php b/app/lib/lang/de.php index b2d19611..ebbd21d5 100644 --- a/app/lib/lang/de.php +++ b/app/lib/lang/de.php @@ -1,6 +1,7 @@ array("1" => "Mo","2" => "Di","3" => "Mi","4" => "Do", "5" => "Fr", "6" => "Sa", "7" => "So"), "pot_long" => "Plan d'organisation du travail", + "home" => "Home", "weeklytemplates" => "Wochen-Vorlagen", "template" => "Vorlagen", "staff" => "Arbeitnehmer", @@ -240,5 +241,12 @@ "partunempl" => "Kurzarbeit", "normalview" => "Normale Ansicht", "detailview" => "Detail-Ansicht", - "trackdiff" => "Stechuhr
Differenz" + "trackdiff" => "Stechuhr
Differenz", + "prevweek" => "vorige", + "nextweek" => "nächste", + "staffname" => "Name", + "weektotal" => "Total
Woche", + "monthdiff" => "Diff
Monat", + "perioddiff" => "Diff
Periode", + "updtracker" => "Stechuhr aktualisieren" ); ?> \ No newline at end of file diff --git a/app/lib/lang/fr.php b/app/lib/lang/fr.php index 72f11c9f..1b8dbd15 100644 --- a/app/lib/lang/fr.php +++ b/app/lib/lang/fr.php @@ -241,5 +241,12 @@ "partunempl" => "Ch. Partielle.", "normalview" => "vue normale", "detailview" => "vue détaillé", - "trackdiff" => "diff.
pointage" + "trackdiff" => "diff.
pointage", + "prevweek" => "précédant", + "nextweek" => "prochaine", + "staffname" => "Name", + "weektotal" => "Total
Semaine", + "monthdiff" => "Diff
mois", + "perioddiff" => "Diff
Période", + "updtracker" => "màj Pointeuse" ); ?> \ No newline at end of file diff --git a/app/put.log b/app/put.log new file mode 100644 index 00000000..e69de29b diff --git a/app/sql.log b/app/sql.log new file mode 100644 index 00000000..330bdb96 --- /dev/null +++ b/app/sql.log @@ -0,0 +1,2281 @@ +alicehartmann2021-04-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-04')) and date(date_trunc('week',date('2021-04-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-04')) and date(date_trunc('week',date('2021-04-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-04')) and date(date_trunc('week',date('2021-04-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-07select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-07') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-07') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-07')) and date(date_trunc('week',date('2021-04-07')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-14select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-14') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-14') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-14')) and date(date_trunc('week',date('2021-04-14')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-22select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-22') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-22') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-22')) and date(date_trunc('week',date('2021-04-22')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-29select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-29') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-29') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-29')) and date(date_trunc('week',date('2021-04-29')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-06select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-06') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-06') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-06')) and date(date_trunc('week',date('2021-05-06')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-28select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-28') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-28') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-28')) and date(date_trunc('week',date('2021-04-28')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-14select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-14') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-14') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-14')) and date(date_trunc('week',date('2021-04-14')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-07select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-07') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-07') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-07')) and date(date_trunc('week',date('2021-04-07')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-03-31select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-03-31') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-03-31') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-03-31')) and date(date_trunc('week',date('2021-03-31')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-03-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-03-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-03-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-03-04')) and date(date_trunc('week',date('2021-03-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-04')) and date(date_trunc('week',date('2021-04-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-04')) and date(date_trunc('week',date('2021-04-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-03-11select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-03-11') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-03-11') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-03-11')) and date(date_trunc('week',date('2021-03-11')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-04')) and date(date_trunc('week',date('2021-04-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-04')) and date(date_trunc('week',date('2021-04-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-04')) and date(date_trunc('week',date('2021-04-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-04')) and date(date_trunc('week',date('2021-04-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-04')) and date(date_trunc('week',date('2021-04-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-03-28select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-03-28') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-03-28') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-03-28')) and date(date_trunc('week',date('2021-03-28')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-03-21select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-03-21') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-03-21') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-03-21')) and date(date_trunc('week',date('2021-03-21')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-03-14select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-03-14') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-03-14') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-03-14')) and date(date_trunc('week',date('2021-03-14')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-03-07select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-03-07') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-03-07') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-03-07')) and date(date_trunc('week',date('2021-03-07')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-02-28select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-02-28') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-02-28') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-02-28')) and date(date_trunc('week',date('2021-02-28')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-02-21select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-02-21') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-02-21') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-02-21')) and date(date_trunc('week',date('2021-02-21')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-02-14select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-02-14') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-02-14') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-02-14')) and date(date_trunc('week',date('2021-02-14')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-02-07select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-02-07') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-02-07') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-02-07')) and date(date_trunc('week',date('2021-02-07')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-01-31select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-01-31') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-01-31') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-01-31')) and date(date_trunc('week',date('2021-01-31')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-01-24select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-01-24') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-01-24') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-01-24')) and date(date_trunc('week',date('2021-01-24')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-01-17select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-01-17') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-01-17') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-01-17')) and date(date_trunc('week',date('2021-01-17')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-01-10select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-01-10') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-01-10') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-01-10')) and date(date_trunc('week',date('2021-01-10')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-01-03select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-01-03') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-01-03') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-01-03')) and date(date_trunc('week',date('2021-01-03')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-12-27select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-12-27') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-12-27') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-12-27')) and date(date_trunc('week',date('2020-12-27')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-12-20select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-12-20') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-12-20') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-12-20')) and date(date_trunc('week',date('2020-12-20')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-12-13select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-12-13') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-12-13') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-12-13')) and date(date_trunc('week',date('2020-12-13')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-12-06select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-12-06') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-12-06') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-12-06')) and date(date_trunc('week',date('2020-12-06')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-11-29select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-11-29') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-11-29') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-11-29')) and date(date_trunc('week',date('2020-11-29')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-11-22select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-11-22') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-11-22') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-11-22')) and date(date_trunc('week',date('2020-11-22')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-11-15select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-11-15') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-11-15') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-11-15')) and date(date_trunc('week',date('2020-11-15')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-11-08select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-11-08') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-11-08') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-11-08')) and date(date_trunc('week',date('2020-11-08')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-11-01select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-11-01') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-11-01') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-11-01')) and date(date_trunc('week',date('2020-11-01')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-10-25select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-10-25') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-10-25') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-10-25')) and date(date_trunc('week',date('2020-10-25')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-10-18select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-10-18') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-10-18') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-10-18')) and date(date_trunc('week',date('2020-10-18')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-10-11select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-10-11') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-10-11') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-10-11')) and date(date_trunc('week',date('2020-10-11')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-10-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-10-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-10-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-10-04')) and date(date_trunc('week',date('2020-10-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-09-27select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-09-27') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-09-27') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-09-27')) and date(date_trunc('week',date('2020-09-27')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-09-20select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-09-20') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-09-20') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-09-20')) and date(date_trunc('week',date('2020-09-20')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-09-13select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-09-13') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-09-13') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-09-13')) and date(date_trunc('week',date('2020-09-13')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-09-06select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-09-06') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-09-06') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-09-06')) and date(date_trunc('week',date('2020-09-06')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-08-30select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-08-30') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-08-30') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-08-30')) and date(date_trunc('week',date('2020-08-30')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-08-23select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-08-23') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-08-23') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-08-23')) and date(date_trunc('week',date('2020-08-23')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-08-16select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-08-16') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-08-16') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-08-16')) and date(date_trunc('week',date('2020-08-16')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-08-09select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-08-09') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-08-09') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-08-09')) and date(date_trunc('week',date('2020-08-09')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-08-02select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-08-02') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-08-02') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-08-02')) and date(date_trunc('week',date('2020-08-02')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-07-26select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-07-26') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-07-26') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-07-26')) and date(date_trunc('week',date('2020-07-26')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-07-19select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-07-19') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-07-19') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-07-19')) and date(date_trunc('week',date('2020-07-19')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-07-12select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-07-12') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-07-12') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-07-12')) and date(date_trunc('week',date('2020-07-12')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-07-05select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-07-05') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-07-05') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-07-05')) and date(date_trunc('week',date('2020-07-05')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-06-28select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-06-28') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-06-28') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-06-28')) and date(date_trunc('week',date('2020-06-28')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-06-21select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-06-21') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-06-21') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-06-21')) and date(date_trunc('week',date('2020-06-21')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-06-14select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-06-14') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-06-14') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-06-14')) and date(date_trunc('week',date('2020-06-14')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-06-07select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-06-07') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-06-07') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-06-07')) and date(date_trunc('week',date('2020-06-07')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-05-31select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-05-31') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-05-31') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-05-31')) and date(date_trunc('week',date('2020-05-31')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-05-24select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-05-24') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-05-24') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-05-24')) and date(date_trunc('week',date('2020-05-24')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-05-17select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-05-17') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-05-17') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-05-17')) and date(date_trunc('week',date('2020-05-17')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-05-10select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-05-10') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-05-10') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-05-10')) and date(date_trunc('week',date('2020-05-10')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-05-03select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-05-03') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-05-03') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-05-03')) and date(date_trunc('week',date('2020-05-03')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-04-26select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-04-26') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-04-26') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-04-26')) and date(date_trunc('week',date('2020-04-26')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-04-19select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-04-19') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-04-19') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-04-19')) and date(date_trunc('week',date('2020-04-19')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-04-12select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-04-12') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-04-12') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-04-12')) and date(date_trunc('week',date('2020-04-12')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-04-05select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-04-05') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-04-05') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-04-05')) and date(date_trunc('week',date('2020-04-05')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2020-03-29select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2020-03-29') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2020-03-29') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2020-03-29')) and date(date_trunc('week',date('2020-03-29')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-04')) and date(date_trunc('week',date('2021-04-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-11select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-11') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-11') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-11')) and date(date_trunc('week',date('2021-04-11')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-18select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-18') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-18') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-18')) and date(date_trunc('week',date('2021-04-18')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-25select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-25') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-25') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-25')) and date(date_trunc('week',date('2021-04-25')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-02select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-02') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-02') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-02')) and date(date_trunc('week',date('2021-05-02')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-09select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-09') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-09') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-09')) and date(date_trunc('week',date('2021-05-09')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-16select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-16') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-16') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-16')) and date(date_trunc('week',date('2021-05-16')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-09select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-09') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-09') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-09')) and date(date_trunc('week',date('2021-05-09')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-02select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-02') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-02') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-02')) and date(date_trunc('week',date('2021-05-02')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-25select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-25') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-25') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-25')) and date(date_trunc('week',date('2021-04-25')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-18select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-18') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-18') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-18')) and date(date_trunc('week',date('2021-04-18')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-11select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-11') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-11') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-11')) and date(date_trunc('week',date('2021-04-11')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-04')) and date(date_trunc('week',date('2021-04-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-11select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-11') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-11') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-11')) and date(date_trunc('week',date('2021-04-11')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-18select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-18') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-18') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-18')) and date(date_trunc('week',date('2021-04-18')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-25select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-25') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-25') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-25')) and date(date_trunc('week',date('2021-04-25')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-02select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-02') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-02') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-02')) and date(date_trunc('week',date('2021-05-02')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-09select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-09') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-09') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-09')) and date(date_trunc('week',date('2021-05-09')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-16select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-16') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-16') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-16')) and date(date_trunc('week',date('2021-05-16')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-23select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-23') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-23') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-23')) and date(date_trunc('week',date('2021-05-23')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-30select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-30') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-30') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-30')) and date(date_trunc('week',date('2021-05-30')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-06-06select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-06-06') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-06-06') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-06-06')) and date(date_trunc('week',date('2021-06-06')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-06-13select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-06-13') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-06-13') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-06-13')) and date(date_trunc('week',date('2021-06-13')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-06-20select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-06-20') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-06-20') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-06-20')) and date(date_trunc('week',date('2021-06-20')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-06-13select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-06-13') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-06-13') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-06-13')) and date(date_trunc('week',date('2021-06-13')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-06-06select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-06-06') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-06-06') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-06-06')) and date(date_trunc('week',date('2021-06-06')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-30select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-30') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-30') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-30')) and date(date_trunc('week',date('2021-05-30')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-23select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-23') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-23') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-23')) and date(date_trunc('week',date('2021-05-23')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-16select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-16') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-16') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-16')) and date(date_trunc('week',date('2021-05-16')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-09select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-09') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-09') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-09')) and date(date_trunc('week',date('2021-05-09')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-02select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-02') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-02') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-02')) and date(date_trunc('week',date('2021-05-02')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-25select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-25') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-25') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-25')) and date(date_trunc('week',date('2021-04-25')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-18select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-18') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-18') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-18')) and date(date_trunc('week',date('2021-04-18')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-11select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-11') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-11') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-11')) and date(date_trunc('week',date('2021-04-11')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-18select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-18') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-18') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-18')) and date(date_trunc('week',date('2021-04-18')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-25select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-25') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-25') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-25')) and date(date_trunc('week',date('2021-04-25')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-05-02select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-05-02') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-05-02') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-05-02')) and date(date_trunc('week',date('2021-05-02')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-25select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-25') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-25') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-25')) and date(date_trunc('week',date('2021-04-25')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-18select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-18') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-18') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-18')) and date(date_trunc('week',date('2021-04-18')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff;alicehartmann2021-04-04select yy.id_staff,yy.staffname,xx.cw,xx.montime,xx.tuetime,xx.wedtime,xx.thutime,xx.fritime,xx.sattime,xx.suntime,xx.weeksum from ( + select st.id as id_staff,st.surname || ' ' || st.prename as staffname from alicehartmann.staffcontract sc join alicehartmann.staff st on (st.id=sc.id_staff) + where (sc.enddate >= date_trunc('week',date('2021-04-04') + interval '6 days') or enddate is null) and sc.startdate <= date_trunc('week',date('2021-04-04') + interval '6 days') + and st.isdeleted is null + group by st.id,st.surname,st.prename) yy left join ( + select id_staff,cw, + to_char(sum(case when dow = 1 then daystamptime else null end),'HH24:MI') as montime, + to_char(sum(case when dow = 2 then daystamptime else null end),'HH24:MI') as tuetime, + to_char(sum(case when dow = 3 then daystamptime else null end),'HH24:MI') as wedtime, + to_char(sum(case when dow = 4 then daystamptime else null end),'HH24:MI') as thutime, + to_char(sum(case when dow = 5 then daystamptime else null end),'HH24:MI') as fritime, + to_char(sum(case when dow = 6 then daystamptime else null end),'HH24:MI') as sattime, + to_char(sum(case when dow = 7 then daystamptime else null end),'HH24:MI') as suntime, + to_char(sum(daystamptime),'HH24:MI') as weeksum + from ( + select id_staff, + date_part('week',daydate) as cw, + sum(coalesce((stamp_out-stamp_in)::interval,'00:00:00')) as daystamptime, + date_part('isodow',daydate) as dow,daydate + from alicehartmann.timetracker tt where tt.daydate between date_trunc('week',date('2021-04-04')) and date(date_trunc('week',date('2021-04-04')) + interval '6 days') group by tt.id_staff,daydate + ) ttd group by id_staff,cw) xx on yy.id_staff=xx.id_staff; \ No newline at end of file diff --git a/app/tmpl/module/index.html b/app/tmpl/module/index.html index 9cb91e8d..d9bb72e9 100644 --- a/app/tmpl/module/index.html +++ b/app/tmpl/module/index.html @@ -28,6 +28,7 @@
{{ lbl.refperiods }} {{ lbl.staff }} + {{ lbl.timetracker }}
diff --git a/app/tmpl/module/js/request.js b/app/tmpl/module/js/request.js index 93abe788..9e7cf5d4 100644 --- a/app/tmpl/module/js/request.js +++ b/app/tmpl/module/js/request.js @@ -1,4 +1,4 @@ -var api = location.origin + '/potapp/'; +var api = location.origin + '/'; // var api2 = location.origin + '/'; // console.log("API 2",api2); var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}} diff --git a/app/tmpl/module/staff/pnl_basedata.html b/app/tmpl/module/staff/pnl_basedata.html index c07d7694..0e5b16fe 100644 --- a/app/tmpl/module/staff/pnl_basedata.html +++ b/app/tmpl/module/staff/pnl_basedata.html @@ -93,6 +93,7 @@ - - - - -
+ +
diff --git a/app/tmpl/module/staff/staff.js b/app/tmpl/module/staff/staff.js index dbaacb95..ffff0596 100644 --- a/app/tmpl/module/staff/staff.js +++ b/app/tmpl/module/staff/staff.js @@ -190,6 +190,10 @@ let staff ={ staff.current_id = udata[0].id; dataform.cleanform2("staff",staff.choices); postData("db.php",{ "get":"staff","schemata":schemata,"id":udata[0].id}).then(data => { + console.log("staffdata",data.result.data); + if (data.result.data["istimetrackenabled"] == true){ + data.result.data["istimetrackenabled"] = "1" + } dataform.fillformbydataclass2("staff",staff.choices,data.result.data,'dataform.savefield(this,null);'); staffcontract.gettbldata(); staffperiods.gettbldata(); @@ -247,7 +251,7 @@ let staff ={ }, getTimeTrackers: function(){ - postData("db.php",{"get":"getTimeTrackerList","schemata":schemata}).then(data => { + postData("db.php",{"cl":"TimeTracker","fn":"getTimeTrackerList","schema":schemata}).then(data => { dataform.fillselectlist(staff.choices["timetrackers"],data.result.data,'id','trackername'); }); }, @@ -267,6 +271,24 @@ let staff ={ } }, cleanfingerprints: function(){ - alert("Noch nicht aktiviert!\nPas activé pour l'instant!") + showdataloaddlg('','
{{ lbl.waitmsg }}
'); + postData('db.php',{"cl":"TimeTracker","fn":"send_cleanfp","schema":schemata,"id_staff":staff.current_id}).then(data => { + console.log("Clean returns",data); + closedataloaddlg(); + }).catch(err => { + closedataloaddlg(); + console.log("Clean err returns",data); + }); + }, + sendtotracker: function(){ + showdataloaddlg('','
{{ lbl.waitmsg }}
'); + postData('db.php',{"cl":"TimeTracker","fn":"send_setstaff","schema":schemata,"id_staff":staff.current_id}).then(data => { + console.log("SetStaff returns",data); + closedataloaddlg(); + }).catch(err => { + closedataloaddlg(); + console.log("SetStaff err returns",data); + }); + //alert("Noch nicht aktiviert!\nPas activé pour l'instant!") } } diff --git a/app/tmpl/module/timeclock.html b/app/tmpl/module/timeclock.html index 4e77ce98..289ac166 100644 --- a/app/tmpl/module/timeclock.html +++ b/app/tmpl/module/timeclock.html @@ -1,9 +1,13 @@
- {{ lbl.back }} + {{ lbl.home }}
{{ lbl.timeclock }}
+ +
Woche:
+
-
\ No newline at end of file +
+ \ No newline at end of file diff --git a/app/tmpl/module/timeclock/timeclock.js b/app/tmpl/module/timeclock/timeclock.js new file mode 100644 index 00000000..7c7f28c0 --- /dev/null +++ b/app/tmpl/module/timeclock/timeclock.js @@ -0,0 +1,90 @@ +function initpage(){ + timeclock.inittable(); +} + +let timeclock = { + tbl: null, + inittable: function(){ + flatpickr("#weekselect",{altInput: true, + altFormat: "d.m.Y", + dateFormat: "Y-m-d", + "locale": "{{ session.lang }}", + weekNumbers: true, + "plugins": [new weekSelect({})], + "onChange": function(){ timeclock.loadWeek(); } + }); + + timeclock.tbl = new Tabulator("#tbl_timeclock", { + headerFilterPlaceholder: "{{ lbl.filter }}", + height: "calc(100vh - 111px)", + layout: "fitDataFill", + selectable: 1, + // rowDblClick:function(e, row){ + // //console.log("DBLCLICK",row._row.data.id); + // workplans.tbl.selectRow(row._row.data.id); + // workplans.edit(); + // }, + rowContext:function(e, row){e.preventDefault(); }, + // groupBy:["weeknum"], + // groupStartOpen:[true], + // groupClosedShowCalcs:true, + // groupHeader:[ + // function(value, count, data){ + // return "Semaine " + value; + // }, + // ], + columns: [ + { title: "{{ lbl.staffname }}",field: "staffname",headerFilter:"input"}, + { title: "{{ lbl.monday }}
DD.MM.YYYY",field: "montime"}, + { title: "{{ lbl.tuesday }}
DD.MM.YYYY",field: "tuetime"}, + { title: "{{ lbl.wednesday }}
DD.MM.YYYY",field: "wedtime" }, + { title: "{{ lbl.thursday }}
DD.MM.YYYY",field: "thutime"}, + { title: "{{ lbl.friday }}
DD.MM.YYYY",field: "fritime" }, + { title: "{{ lbl.saturday }}
DD.MM.YYYY",field: "sattime" }, + { title: "{{ lbl.sunday }}
DD.MM.YYYY",field: "suntime" }, + { title: "{{ lbl.weektotal }}",field: "weeksum"}, + { title: "{{ lbl.monthdiff }}",field: "monthdiff"}, + { title: "{{ lbl.perioddiff }}",field: "perioddiff"} + ] + }); + document.getElementById('weekselect')._flatpickr.setDate(moment().format('YYYY-MM-DD')); + timeclock.gettbldata(); + }, + gettbldata: function(){ + let wsobj = document.getElementById('weekselect').value; + postData("db.php",{"cl":"TimeTracker","fn":"getWeekStamps","schema":schemata,"date":wsobj}).then(data => { + let aa = ["mon","tue","wed","thu","fri","sat","sun"]; + let mondate = moment(wsobj).startOf('week').format('YYYY-MM-DD'); + for (var d=0;d 0) then - txtval := '-' || replace(txtval,'-',''); - end if; - return txtval; -end; + AS $$ +declare + txtval text; +begin + txtval := to_char(itime,'HH24:MI'); + if (position( '-' in txtval) > 0) then + txtval := '-' || replace(txtval,'-',''); + end if; + return txtval; +end; $$; diff --git a/dev/db/live/potlu2_db.brasserie_du_theatrexx.pg.full.sql b/dev/db/live/potlu2_db.brasserie_du_theatrexx.pg.full.sql index 6169715c..897761f0 100644 --- a/dev/db/live/potlu2_db.brasserie_du_theatrexx.pg.full.sql +++ b/dev/db/live/potlu2_db.brasserie_du_theatrexx.pg.full.sql @@ -29,11 +29,11 @@ CREATE SCHEMA brasserie_du_theatrexx; CREATE FUNCTION brasserie_du_theatrexx.trg_before_upd_schematable() RETURNS trigger LANGUAGE plpgsql - AS $$ - begin - new.modified = now(); - RETURN NEW; - END; + AS $$ + begin + new.modified = now(); + RETURN NEW; + END; $$; diff --git a/test/sendcmd.sh b/test/sendcmd.sh new file mode 100644 index 00000000..554f4a3f --- /dev/null +++ b/test/sendcmd.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +AUTH=$(echo -n htx:Aib5aevo | base64) +curl \ + -A "DKS POT TestTool" \ + -H "Authorization: Basic $AUTH" \ + --header "Content-Type: application/json" \ + --request POST \ + --data '{"cl":"ssh","fn":"exec","host":"dhart-pot03","cmd":"bin/clearfingerprint.sh 6f8036b4-338f-a581-2256-4e8c59646836"}' \ +https://htx.plandutravail.lu/htx/api.php \ No newline at end of file