jb-data.de/scripts/ajax/pi_freetrp.php
2025-08-11 22:23:30 +02:00

49 lines
No EOL
1.9 KiB
PHP

<?php
// echo'<pre>'; print_r($row_nichtda); echo'</pre>';
error_reporting(E_ALL); ini_set('display_errors',0);
header('Content-Type: text/html; charset=utf-8');
//-----------------------------------------------------
$wochentag=date(w);
$jahr = (int)date('Y');
$kw_aktuell = (int)date('W');
$time=time();
$ptime=$time-22000;
//-----------------------------------------------------
//-----------------------------------------------------
//-----------------------------------------------------
$testcar = $GLOBALS['mysql']->query("SELECT * FROM fahrzeuge WHERE aktiv>0 and aktiv<90 and besitz<4 and typ>2 ORDER BY kz"); $key=0; //Transporter
while($row = $testcar->fetch_assoc()) {
$t=date('j',$time); $m=date('n',$time); $j=date('Y',$time);
// kein Eintrag, fahrzeug nicht eingesetzt
$test_kal = $GLOBALS['mysql']->query_single("SELECT * FROM fplaner WHERE tag='".$t."' and monat='".$m."' and jahr='".$j."' and fid='".$row['id']."'");
if($test_kal['num_rows'] == 0) {
$test_tour2 = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE time>'".$ptime."' and time<'".$time."' and auto='".$row['id']."'");
if($test_tour2['num_rows'] == 0) {
$test_tour = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE time>'".$time."' and auto='".$row['id']."' ORDER BY time");
if($test_tour['num_rows'] == 0) {
$info[$key]['car'] =$row['kz'];
$info[$key]['time']=0;
$info[$key]['ort'] =$row['standort'];
$key++;
} else {
if($test_tour['typ']!=8) {
if($test_tour['typ']!=15) {
$info[$key]['time']=$test_tour['time'];
$info[$key]['rest']=round(($test_tour['time']-$time)/3600);
$info[$key]['car'] =$row['kz'];
$info[$key]['ort'] =$row['standort'];
$key++;
}
}
}
}
}
}
$template->assign('info', $info);
$template->assign('content', 'tpl/ajax/pi_freecar.tpl');
?>