diff --git a/www-ssl/admin/aktiv.php b/www-ssl/admin/aktiv.php index f7a44c7d..ddc7c3e8 100755 --- a/www-ssl/admin/aktiv.php +++ b/www-ssl/admin/aktiv.php @@ -45,15 +45,22 @@ echo "\n"; echo "\t". Get_Text("pub_aktive_Nick"). "\n"; echo "\t". Get_Text("pub_aktive_Anzahl"). "\n"; echo "\t". Get_Text("pub_aktive_Time"). "\n"; +echo "\t". Get_Text("pub_aktive_Time"). " Weight\n"; +echo "\tFreeloader ". Get_Text("pub_aktive_Anzahl"). "\n"; +echo "\tFreeloader ". Get_Text("pub_aktive_Time"). "\n"; +echo "\t". Get_Text("pub_aktive_Time"). " result\n"; echo "\t". Get_Text("pub_aktive_Active"). "\n"; echo "\n"; -$SQL = "SELECT ShiftEntry.UID, COUNT(ShiftEntry.UID) AS NR, SUM(Shifts.Len) as LEN ". - "FROM `ShiftEntry` ". - "LEFT JOIN `Shifts` ON ShiftEntry.SID=Shifts.SID ". - "WHERE NOT UID=0 ". - "GROUP BY UID ". - "ORDER BY LEN DESC, NR DESC, UID "; +$SQL = " +SELECT d.UID, d.nr, d.len, d.lenWeight, f.nr AS nrFree, f.len AS lenFree, d.lenWeight - COALESCE(f.len, 0) as lenReal + FROM + (SELECT e.UID, COUNT(s.Len) as nr, SUM(s.Len) as len, SUM( s.Len*(1+(((HOUR(s.DateS)+2)%24)<10 and ((HOUR(s.DateE)+2)%24)<10)) ) as lenWeight FROM `Shifts` AS s INNER JOIN `ShiftEntry` AS e USING(SID) WHERE NOT UID=0 GROUP BY UID) as d + LEFT JOIN + (SELECT UID, COUNT(Length) AS nr, SUM(Length) AS len FROM `ShiftFreeloader` GROUP BY UID) AS f + USING(UID) + ORDER BY lenReal DESC, nr DESC, UID"; + $Erg = mysql_query($SQL, $con); echo mysql_error($con); $rowcount = mysql_num_rows($Erg); @@ -63,12 +70,18 @@ for ($i=0; $i<$rowcount; $i++) { echo "\n\n\t\n"; echo "\t\t". UID2Nick(mysql_result($Erg, $i, "UID")). "\n"; - echo "\t\t". mysql_result($Erg, $i, "NR"). "\n"; - echo "\t\t". mysql_result($Erg, $i, "LEN"). "h\n"; + echo "\t\t". mysql_result($Erg, $i, "nr"). "x\n"; + echo "\t\t". mysql_result($Erg, $i, "len"). "h\n"; + echo "\t\t". mysql_result($Erg, $i, "lenWeight"). "h\n"; + echo "\t\t". mysql_result($Erg, $i, "nrFree"). "x\n"; + echo "\t\t". mysql_result($Erg, $i, "lenFree"). "h\n"; + echo "\t\t". mysql_result($Erg, $i, "lenReal"). "h\n"; + + echo "\t\t"; if (IsSet($_POST["Anzahl"])) { - if( $_POST["Anzahl"] < mysql_result($Erg, $i, "LEN") ) + if( $_POST["Anzahl"] < mysql_result($Erg, $i, "lenReal") ) { $aktivecount++; if( $_POST["SendType"]=="Show..")