268 lines
17 KiB
PHP
268 lines
17 KiB
PHP
<?php
|
|
ini_set('display_errors',0);
|
|
|
|
$tage = array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag");
|
|
$anlage = $GLOBALS['mysql']->query_single("SELECT * FROM kartenlog ORDER BY logID DESC LIMIT 1"); $anz=0;
|
|
|
|
|
|
|
|
$jahr = (int)date('Y');
|
|
$monat=(int)date('m');
|
|
$tag=(int)date('j');
|
|
$wochentag=date('w');
|
|
|
|
if($wochentag==0 && date('G')>10) { $tag++; if($tag>date('t')) { $monat++; $tag=1; } if($monat==13) { $jahr++; $monat=1; }}
|
|
if($wochentag!=0 && date('G')>17) { $tag++; if($tag>date('t')) { $monat++; $tag=1; } if($monat==13) { $jahr++; $monat=1; }}
|
|
//--------- Polizeimeldungen
|
|
//---------------------------------------------------------------------------- Polizeimeldungen
|
|
$tmpdata = $GLOBALS['mysql']->query_single("SELECT * FROM verkehr_polizei");
|
|
$datapol=$tmpdata['num_rows'];
|
|
if($tmpdata['num_rows'] != 0) {
|
|
$tempdata = $GLOBALS['mysql']->query("SELECT * FROM verkehr_polizei"); $key=0;
|
|
while($row = $tempdata->fetch_assoc()) {
|
|
$pdata[$key]['adresse1']=$row['adresse1'];
|
|
$pdata[$key]['adresse2']=$row['adresse2'];
|
|
$pdata[$key]['reason']=$row['reason'];
|
|
$key++;
|
|
}
|
|
}
|
|
$template->assign('datapol', $datapol);
|
|
$template->assign('time', time());
|
|
if(isset($pdata)) { $template->assign('pdata', $pdata); }
|
|
//--------- Normplan LVZ
|
|
// $data_norm = $GLOBALS['mysql']->query_single("SELECT * FROM normplan WHERE tag='".$tag."' AND monat='".$monat."' AND jahr='".$jahr."'");
|
|
// $normdate2=$tage[date("w",mktime(0, 0, 0,$monat,$tag,$jahr))]; $normdate=$normdate2.", den ".$tag.".".$monat.".".$jahr;
|
|
// $template->assign('normdate',$normdate); $template->assign('nplan',$data_norm);
|
|
//--------- Ende Normplan LVZ
|
|
|
|
if(time()-$anlage['zeit']<80) { //99
|
|
$ma1 = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$anlage['user']."'");
|
|
$ma=$ma1['name'];
|
|
$manr=$ma1['id'];
|
|
$template->assign('ma',$ma);
|
|
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
//---------- Tag 1 ------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
$tmptime=mktime(0,0,0,$monat,$tag,$jahr);
|
|
$test = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE tag='".$tag."' and monat='".$monat."' and jahr='".$jahr."' and fahrer='".$anlage['user']."'");
|
|
$template->assign('anz',1);
|
|
if($test['num_rows'] == 0) {
|
|
$tag_tour1[$key]['noplan']=1;
|
|
$tag_tour1[$key]['datum']=$tag.".".$monat.".".$jahr;
|
|
} else {
|
|
$key=0;
|
|
$tag_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE tag='".$tag."' and monat='".$monat."' and jahr='".$jahr."' and fahrer='".$anlage['user']."'");
|
|
while($row = $tag_tour->fetch_assoc()) {
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
|
|
//--------------------------------- Personalabfrage
|
|
$tag_tour1[$key]['$fahrernichtda']=0;
|
|
$row_nichtda = $GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE mid='".$row['fahrer']."' AND tag='".$tag."' AND monat='".$monat."' AND jahr='".$jahr."'");
|
|
if($row_nichtda['num_rows'] > 0) {
|
|
$row_gnichtda = $GLOBALS['mysql']->query_single("SELECT * FROM planer_bez WHERE id='".$row_nichtda['grund']."'");
|
|
if($row_gnichtda['nichtda']==1) { $tag_tour1[$key]['fahrernichtda']=1; //- fahrer den ganzen tag nicht da
|
|
} else {
|
|
if($row['fahrer']!=$row_tour['s_fahrer']) { $tag_tour1[$key]['fahrernichtda']=2; }
|
|
if($row_gnichtda['nichtda']==$row['typ']) { $tag_tour1[$key]['fahrernichtda']=1; } //-- kein dieser touren typ nicht der fahrer da
|
|
}
|
|
} else {
|
|
if($row['fahrer']!=$row_tour['s_fahrer']) { $tag_tour1[$key]['fahrernichtda']=2; }
|
|
if((int)$row['smsid']<1) {$tag_tour1[$key]['fahrernichtda']=3; }
|
|
if($row['fahrer']<1) {$tag_tour1[$key]['fahrernichtda']=1; }
|
|
}
|
|
$tag_tour1[$key]['autonichtda']=0;//----------- auto
|
|
$row_anichtda = $GLOBALS['mysql']->query_single("SELECT * FROM fplaner WHERE fid='".$row['auto']."' AND tag='".$tag."' AND monat='".$monat."' AND jahr='".$jahr."'");
|
|
if($row_anichtda['num_rows'] != 0) { $tag_tour1[$key]['autonichtda']=1; }
|
|
if($tag_tour1[$key]['autonichtda']!=1) { if($row['auto']!=$row_tour['s_auto']) { $tag_tour1[$key]['autonichtda']=2; }}
|
|
//----------
|
|
$tag_tour1[$key]['datum']=$row['tag'].".".$row['monat'].".".$row['jahr'];
|
|
$tmptime=mktime(0,0,0,$row['monat'],$row['tag'],$row['jahr']);
|
|
$tag_tour1[$key]['zeit']=$row['zeit'];
|
|
$tag_tour1[$key]['key']=$key;
|
|
$tag_tour1[$key]['tour']=$row_tour['tour'];
|
|
$tag_tour1[$key]['aktiv']=$row_tour['aktiv'];
|
|
$data_auto1 = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'");
|
|
$tag_tour1[$key]['kennz']=$data_auto1['kz'];
|
|
if($row['typ']== 7) { $tag_tour1[$key]['info']=$row['gewicht']." kg"; $tag_tour1[$key]['ianz']=1; }
|
|
if($row['typ']== 8) { $tag_tour1[$key]['info']=$row['gewicht']." kg"; $tag_tour1[$key]['ianz']=1; }
|
|
if($row['typ']==11) { $tag_tour1[$key]['info']=$row['gewicht']." kg"; $tag_tour1[$key]['ianz']=1; }
|
|
if($row['typ']==12) { $tag_tour1[$key]['info']=$row['gewicht']." kg"; $tag_tour1[$key]['ianz']=1; }
|
|
if($row['typ']==13) { $tag_tour1[$key]['info']=$row['gewicht']." kg"; $tag_tour1[$key]['ianz']=1; }
|
|
if($row['typ']==14) { $tag_tour1[$key]['info']=$row['gewicht']." kg"; $tag_tour1[$key]['ianz']=1; }
|
|
if($row['typ']==19) { $tag_tour1[$key]['info']=$row['gewicht']." kg"; $tag_tour1[$key]['ianz']=1; }
|
|
if($row['typ']==15) { $tag_tour1[$key]['info']=$row['exemplare']." St."; $tag_tour1[$key]['ianz']=1; }
|
|
$key++;
|
|
}
|
|
$template->assign('tag_tour1',$tag_tour1);
|
|
}
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
//---------- Tag 2 ------------------------------------------------------------------------------------------------------------------------------------------
|
|
$temptime=strtotime("+1 day",$tmptime); $jahr2 = (int)date('Y',$temptime); $monat2=(int)date('m',$temptime); $tag2=(int)date('j',$temptime);
|
|
$test = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE tag='".$tag2."' and monat='".$monat2."' and jahr='".$jahr2."' and fahrer='".$anlage['user']."'");
|
|
if($test['num_rows'] == 0) {
|
|
$tag_tour2[$key]['noplan']=1;
|
|
$tag_tour2[$key]['datum']=$tag2.".".$monat2.".".$jahr2;
|
|
} else {
|
|
$key=0; //$template->assign('anz',$tag2);
|
|
$tag_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE tag='".$tag2."' and monat='".$monat2."' and jahr='".$jahr2."' and fahrer='".$anlage['user']."'");
|
|
while($row = $tag_tour->fetch_assoc()) {
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
|
|
//----------
|
|
$tag_tour2[$key]['datum']=$row['tag'].".".$row['monat'].".".$row['jahr'];
|
|
//$tmptime=mktime(0,0,0,$row['monat'],$row['tag'],$row['jahr']);
|
|
$tag_tour2[$key]['zeit']=$row['zeit'];
|
|
$tag_tour2[$key]['key']=$key;
|
|
$tag_tour2[$key]['tour']=$row_tour['tour'];
|
|
$tag_tour2[$key]['aktiv']=$row_tour['aktiv'];
|
|
$data_auto1 = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'");
|
|
$tag_tour2[$key]['kennz']=$data_auto1['kz'];
|
|
if($row['typ']== 7) { $tag_tour2[$key]['info']=$row['gewicht']." kg"; $tag_tour2[$key]['ianz']=1; }
|
|
if($row['typ']== 8) { $tag_tour2[$key]['info']=$row['gewicht']." kg"; $tag_tour2[$key]['ianz']=1; }
|
|
if($row['typ']==11) { $tag_tour2[$key]['info']=$row['gewicht']." kg"; $tag_tour2[$key]['ianz']=1; }
|
|
if($row['typ']==12) { $tag_tour2[$key]['info']=$row['gewicht']." kg"; $tag_tour2[$key]['ianz']=1; }
|
|
if($row['typ']==13) { $tag_tour2[$key]['info']=$row['gewicht']." kg"; $tag_tour2[$key]['ianz']=1; }
|
|
if($row['typ']==14) { $tag_tour2[$key]['info']=$row['gewicht']." kg"; $tag_tour2[$key]['ianz']=1; }
|
|
if($row['typ']==19) { $tag_tour2[$key]['info']=$row['gewicht']." kg"; $tag_tour2[$key]['ianz']=1; }
|
|
if($row['typ']==15) { $tag_tour2[$key]['info']=$row['exemplare']." St."; $tag_tour2[$key]['ianz']=1; }
|
|
$key++;
|
|
}
|
|
$template->assign('tag_tour2',$tag_tour2);
|
|
}
|
|
//---------- Tag 3 ------------------------------------------------------------------------------------------------------------------------------------------
|
|
$temptime=strtotime("+2 day",$tmptime); $jahr3 = (int)date('Y',$temptime); $monat3=(int)date('m',$temptime); $tag3=(int)date('j',$temptime);
|
|
$test = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE tag='".$tag3."' and monat='".$monat3."' and jahr='".$jahr3."' and fahrer='".$anlage['user']."'");
|
|
if($test['num_rows'] == 0) {
|
|
$tag_tour3[$key]['noplan']=1;
|
|
$tag_tour3[$key]['datum']=$tag3.".".$monat3.".".$jahr3;
|
|
} else {
|
|
$key=0; //$template->assign('anz',$tag2);
|
|
$tag_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE tag='".$tag3."' and monat='".$monat3."' and jahr='".$jahr3."' and fahrer='".$anlage['user']."'");
|
|
while($row = $tag_tour->fetch_assoc()) {
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
|
|
//----------
|
|
$tag_tour3[$key]['datum']=$row['tag'].".".$row['monat'].".".$row['jahr'];
|
|
//$tmptime=mktime(0,0,0,$row['monat'],$row['tag'],$row['jahr']);
|
|
$tag_tour3[$key]['zeit']=$row['zeit'];
|
|
$tag_tour3[$key]['key']=$key;
|
|
$tag_tour3[$key]['tour']=$row_tour['tour'];
|
|
$tag_tour3[$key]['aktiv']=$row_tour['aktiv'];
|
|
$data_auto1 = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'");
|
|
$tag_tour3[$key]['kennz']=$data_auto1['kz'];
|
|
if($row['typ']== 7) { $tag_tour3[$key]['info']=$row['gewicht']." kg"; $tag_tour3[$key]['ianz']=1; }
|
|
if($row['typ']== 8) { $tag_tour3[$key]['info']=$row['gewicht']." kg"; $tag_tour3[$key]['ianz']=1; }
|
|
if($row['typ']==11) { $tag_tour3[$key]['info']=$row['gewicht']." kg"; $tag_tour3[$key]['ianz']=1; }
|
|
if($row['typ']==12) { $tag_tour3[$key]['info']=$row['gewicht']." kg"; $tag_tour3[$key]['ianz']=1; }
|
|
if($row['typ']==13) { $tag_tour3[$key]['info']=$row['gewicht']." kg"; $tag_tour3[$key]['ianz']=1; }
|
|
if($row['typ']==14) { $tag_tour3[$key]['info']=$row['gewicht']." kg"; $tag_tour3[$key]['ianz']=1; }
|
|
if($row['typ']==19) { $tag_tour3[$key]['info']=$row['gewicht']." kg"; $tag_tour3[$key]['ianz']=1; }
|
|
if($row['typ']==15) { $tag_tour3[$key]['info']=$row['exemplare']." St."; $tag_tour3[$key]['ianz']=1; }
|
|
$key++;
|
|
}
|
|
$template->assign('tag_tour3',$tag_tour3);
|
|
}
|
|
//---------- Tag 4 ------------------------------------------------------------------------------------------------------------------------------------------
|
|
$temptime=strtotime("+3 day",$tmptime); $jahr4 = (int)date('Y',$temptime); $monat4=(int)date('m',$temptime); $tag4=(int)date('j',$temptime);
|
|
$test = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE tag='".$tag4."' and monat='".$monat4."' and jahr='".$jahr4."' and fahrer='".$anlage['user']."'");
|
|
if($test['num_rows'] == 0) {
|
|
$tag_tour4[$key]['noplan']=1;
|
|
$tag_tour4[$key]['datum']=$tag4.".".$monat4.".".$jahr4;
|
|
} else {
|
|
$key=0; //$template->assign('anz',$tag2);
|
|
$tag_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE tag='".$tag4."' and monat='".$monat4."' and jahr='".$jahr4."' and fahrer='".$anlage['user']."'");
|
|
while($row = $tag_tour->fetch_assoc()) {
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
|
|
//----------
|
|
$tag_tour4[$key]['datum']=$row['tag'].".".$row['monat'].".".$row['jahr'];
|
|
//$tmptime=mktime(0,0,0,$row['monat'],$row['tag'],$row['jahr']);
|
|
$tag_tour4[$key]['zeit']=$row['zeit'];
|
|
$tag_tour4[$key]['key']=$key;
|
|
$tag_tour4[$key]['tour']=$row_tour['tour'];
|
|
$tag_tour4[$key]['aktiv']=$row_tour['aktiv'];
|
|
$data_auto1 = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'");
|
|
$tag_tour4[$key]['kennz']=$data_auto1['kz'];
|
|
if($row['typ']== 7) { $tag_tour4[$key]['info']=$row['gewicht']." kg"; $tag_tour4[$key]['ianz']=1; }
|
|
if($row['typ']== 8) { $tag_tour4[$key]['info']=$row['gewicht']." kg"; $tag_tour4[$key]['ianz']=1; }
|
|
if($row['typ']==11) { $tag_tour4[$key]['info']=$row['gewicht']." kg"; $tag_tour4[$key]['ianz']=1; }
|
|
if($row['typ']==12) { $tag_tour4[$key]['info']=$row['gewicht']." kg"; $tag_tour4[$key]['ianz']=1; }
|
|
if($row['typ']==13) { $tag_tour4[$key]['info']=$row['gewicht']." kg"; $tag_tour4[$key]['ianz']=1; }
|
|
if($row['typ']==14) { $tag_tour4[$key]['info']=$row['gewicht']." kg"; $tag_tour4[$key]['ianz']=1; }
|
|
if($row['typ']==19) { $tag_tour4[$key]['info']=$row['gewicht']." kg"; $tag_tour4[$key]['ianz']=1; }
|
|
if($row['typ']==15) { $tag_tour4[$key]['info']=$row['exemplare']." St."; $tag_tour4[$key]['ianz']=1; }
|
|
$key++;
|
|
}
|
|
$template->assign('tag_tour4',$tag_tour4);
|
|
}
|
|
//---------- Tag 5 ------------------------------------------------------------------------------------------------------------------------------------------
|
|
$temptime=strtotime("+4 day",$tmptime); $jahr5 = (int)date('Y',$temptime); $monat5=(int)date('m',$temptime); $tag5=(int)date('j',$temptime);
|
|
$test = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE tag='".$tag5."' and monat='".$monat5."' and jahr='".$jahr5."' and fahrer='".$anlage['user']."'");
|
|
if($test['num_rows'] == 0) {
|
|
$tag_tour5[$key]['noplan']=1;
|
|
$tag_tour5[$key]['datum']=$tag5.".".$monat5.".".$jahr5;
|
|
} else {
|
|
$key=0; //$template->assign('anz',$tag2);
|
|
$tag_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE tag='".$tag5."' and monat='".$monat5."' and jahr='".$jahr5."' and fahrer='".$anlage['user']."'");
|
|
while($row = $tag_tour->fetch_assoc()) {
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
|
|
//----------
|
|
$tag_tour5[$key]['datum']=$row['tag'].".".$row['monat'].".".$row['jahr'];
|
|
//$tmptime=mktime(0,0,0,$row['monat'],$row['tag'],$row['jahr']);
|
|
$tag_tour5[$key]['zeit']=$row['zeit'];
|
|
$tag_tour5[$key]['key']=$key;
|
|
$tag_tour5[$key]['tour']=$row_tour['tour'];
|
|
$tag_tour5[$key]['aktiv']=$row_tour['aktiv'];
|
|
$data_auto1 = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'");
|
|
$tag_tour5[$key]['kennz']=$data_auto1['kz'];
|
|
if($row['typ']== 7) { $tag_tour5[$key]['info']=$row['gewicht']." kg"; $tag_tour5[$key]['ianz']=1; }
|
|
if($row['typ']== 8) { $tag_tour5[$key]['info']=$row['gewicht']." kg"; $tag_tour5[$key]['ianz']=1; }
|
|
if($row['typ']==11) { $tag_tour5[$key]['info']=$row['gewicht']." kg"; $tag_tour5[$key]['ianz']=1; }
|
|
if($row['typ']==12) { $tag_tour5[$key]['info']=$row['gewicht']." kg"; $tag_tour5[$key]['ianz']=1; }
|
|
if($row['typ']==13) { $tag_tour5[$key]['info']=$row['gewicht']." kg"; $tag_tour5[$key]['ianz']=1; }
|
|
if($row['typ']==14) { $tag_tour5[$key]['info']=$row['gewicht']." kg"; $tag_tour5[$key]['ianz']=1; }
|
|
if($row['typ']==19) { $tag_tour5[$key]['info']=$row['gewicht']." kg"; $tag_tour5[$key]['ianz']=1; }
|
|
if($row['typ']==15) { $tag_tour5[$key]['info']=$row['exemplare']." St."; $tag_tour5[$key]['ianz']=1; }
|
|
$key++;
|
|
}
|
|
$template->assign('tag_tour5',$tag_tour5);
|
|
}
|
|
} else {
|
|
$GLOBALS['door']=0;
|
|
|
|
$key=0;
|
|
// $test = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE tag='".$tag."' and monat='".$monat."' and jahr='".$jahr."' and fahrer='".$anlage['user']."' ORDER BY logID ");
|
|
// if($test['num_rows'] != 0) {
|
|
//------------------------------------------------ Zeitumrechnung nach bedarf
|
|
$testb1 = $GLOBALS['mysql']->query_single("SELECT * FROM baustellen WHERE startts=0");
|
|
if($testb1['num_rows'] != 0) {
|
|
$testbx = $GLOBALS['mysql']->query("SELECT * FROM baustellen WHERE startts=0");
|
|
while($row = $testbx->fetch_assoc()) {
|
|
$st = explode(".", $row['start']);
|
|
$startzeit=mktime(0,0,0, $st[1],$st[0],$st[2]);
|
|
$GLOBALS['mysql']->insert("UPDATE baustellen SET startts='".$startzeit."' WHERE id='".$row['id']."'");
|
|
|
|
$et = explode(".", $row['ende']);
|
|
$endzeit=mktime(0,0,0, $et[1],$et[0],$et[2]); //echo $endzeit;
|
|
$GLOBALS['mysql']->insert("UPDATE baustellen SET endts='".$endzeit."' WHERE id='".$row['id']."'");
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------ baustellen auslesen
|
|
|
|
$time=time();
|
|
$testb2 = $GLOBALS['mysql']->query_single("SELECT * FROM baustellen WHERE startts<'".$time."' and endts>'".$time."'");
|
|
if($testb2['num_rows'] != 0) {
|
|
$tour = $GLOBALS['mysql']->query("SELECT * FROM baustellen WHERE startts<'".$time."' and endts>'".$time."'");
|
|
while($row = $tour->fetch_assoc()) {
|
|
$bdata[$key]['ort']= $row['ort']; //echo "-".$row['ort'];
|
|
$bdata[$key]['grund']= $row['grund'];
|
|
$bdata[$key]['bezeichnung']= $row['bezeichnung'];
|
|
$bdata[$key]['ende']= $row['ende'];
|
|
$key++;
|
|
}
|
|
}
|
|
$template->assign('bdata',$bdata);
|
|
}
|
|
$template->assign('content', 'tpl/ajax/pi_hallo2.tpl');
|
|
|
|
|
|
?>
|