statistics 2

This commit is contained in:
Walter Hupfeld 2020-09-05 17:36:49 +02:00
parent c0124a05b6
commit 8ee6fb3185
2 changed files with 37 additions and 7 deletions

View File

@ -90,4 +90,6 @@ i.wa {
left: 50%; left: 50%;
z-index: 1000; z-index: 1000;
display:none; display:none;
} }
.statistik td, th {border: 1px solid grey; font-size: smaller;}

View File

@ -87,6 +87,8 @@ function nl2br2($string) {
function get_statistics($numVehicle,$strWhere) { function get_statistics($numVehicle,$strWhere) {
global $db; global $db;
global $arrUnfallart;
global $arrUnfalltyp;
$strSQL="SELECT $strSQL="SELECT
sum(IstRad) as rad, sum(IstRad) as rad,
sum(IstPKW) as pkw, sum(IstPKW) as pkw,
@ -107,8 +109,8 @@ function nl2br2($string) {
$strTable.="<tr><td>PKWs</td><td>".$row['pkw']."</td></tr>"; $strTable.="<tr><td>PKWs</td><td>".$row['pkw']."</td></tr>";
$strTable.="<tr><td>Fussgänger</td><td>".$row['fuss']."</td></tr>"; $strTable.="<tr><td>Fussgänger</td><td>".$row['fuss']."</td></tr>";
$strTable.="<tr><td>Krafträder</td><td>".$row['krad']."</td></tr>"; $strTable.="<tr><td>Krafträder</td><td>".$row['krad']."</td></tr>";
$strTable.="<tr><td>LKWs</td><td>".$row['lkw']."</td></tr>"; $strTable.="<tr><td>LKWs</td><td>".$row['lkw']."</td></tr>\n";
$strTable.="<tr><td>Sonstiges</td><td>".$row['sonstiges']."</td></tr>"; $strTable.="<tr><td>Sonstiges</td><td>".$row['sonstiges']."</td></tr>\n";
} }
/* /*
@ -143,13 +145,39 @@ function nl2br2($string) {
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstRad=0"; WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstRad=0";
break; break;
} }
$result = $db->query($strSQL); $result = $db->query($strSQL);
if ($row = $result->fetchArray()) { if ($row = $result->fetchArray()) {
$strTable.="<tr><td>Alleinunfälle</td><td>".$row['count']."</td></tr>"; $strTable.="<tr><td>Alleinunfälle und Unfälle mit geicher Fahrzeugart</td><td>".$row['count']."</td></tr>";
} }
$strTable.="</table>"; $strTable.="</table>";
//Unfallart
$strSQL="SELECT UART, count(UART) as anz FROM Unfallorte2019_Hamm WHERE ".$strWhere." GROUP BY UART";
$strTable.="<h5>Unfallart</h5>";
$strTable.="<table class='statistik'>";
$result = $db->query($strSQL);
while ($row = $result->fetchArray()) {
$strTable.="<tr><td>".$arrUnfallart[$row['UART']]."</td><td>".$row['anz']."</td></tr>\n";
}
$strTable.="</table>";
//Unfallart
$strSQL="SELECT UTYP1, count(UTYP1) as anz FROM Unfallorte2019_Hamm WHERE ".$strWhere." GROUP BY UTYP1";
$strTable.="<h5>Unfalltyp</h5>";
$strTable.="<table class='statistik'>";
$result = $db->query($strSQL);
while ($row = $result->fetchArray()) {
$strTable.="<tr><td>".$arrUnfalltyp[$row['UTYP1']]."</td><td>".$row['anz']."</td></tr>\n";
}
$strTable.="</table>";
$strTable.="<a href='https://recht.nrw.de/lmi/owa/br_vbl_show_pdf?p_id=12225' target='_blank'>Unfalltpyen</a><br>";
$strTable.="<a href='https://www.destatis.de/DE/Themen/Gesellschaft-Umwelt/Verkehrsunfaelle/Methoden/verkehrsunfaelle-grundbegriffe.pdf?__blob=publicationFile' target='_blank'>Unfallbeschreibung</a><br>";
return $strTable; return $strTable;
} }