insert("UPDATE tourenliste SET lohnstatus='".$_POST['lohn']."' WHERE id='".$_POST['tourID']."'"); $row_tourl = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE id='".$_POST['tourID']."'"); $ttemp=$row_tourl['tour']; $ta_id= array_search($ttemp, array_column($a_touren, 'id')); $back['lastnote']="Lohn ".$_POST['lohn']." für Tour ".$row_tourl['tour']." gespeichert."; $back['success'] = true; $back['zeile'] = $_POST['tourID']; $back['alt'] = 5; echo json_encode($back); break; case 'car_save'; $GLOBALS['mysql']->insert("UPDATE tourenliste SET auto='".$_POST['car']."' WHERE id='".$_POST['tourID']."'"); $row_tourl = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE id='".$_POST['tourID']."'"); $ttemp=$row_tourl['tour']; $ta_id= array_search($ttemp, array_column($a_touren, 'id')); $atemp=$_POST['car']; $aa_id= array_search($atemp, array_column($a_fahrzg, 'id')); $back['lastnote']="Fahrzeug ".$a_fahrzg[$aa_id]['kz']." für Tour ".$row_tourx['tour']." gespeichert."; $back['success'] = true; $back['zeile'] = $_POST['tourID']; $back['alt'] = 5; echo json_encode($back); break; case 'user_save'; // $ttemp=$row['tour']; $ta_id= array_search($ttemp, array_column($a_touren, 'id')); // $atemp=$row['auto']; $aa_id= array_search($atemp, array_column($a_fahrzg, 'id')); // $mtemp=$row['fahrer']; $ma_id= array_search($mtemp, array_column($a_fahrer, 'id')); $GLOBALS['mysql']->insert("UPDATE tourenliste SET fahrer='".$_POST['user']."' WHERE id='".$_POST['tourID']."'"); $row_tourl = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE id='".$_POST['tourID']."'"); $ttemp=$row_tourl['tour']; $ta_id= array_search($ttemp, array_column($a_touren, 'id')); $atemp=$_POST['car']; $aa_id= array_search($atemp, array_column($a_fahrzg, 'id')); $back['lastnote']="Fahrer ".$a_fahrer[$ma_id]['name']." für Tour ".$row_tourx['tour']." gespeichert."; $back['success'] = true; $back['zeile'] = $_POST['tourID']; $back['alt'] = 5; echo json_encode($back); break; case 'load_car_icon'; //echo $_POST['tourID']; $touri = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE id='".$_POST['tourID']."'"); //$unixdate=mktime(0,0,0, $touri['monat'],$touri['tag'],$touri['jahr']); if($touri['auto']==0 OR $touri['fahrer']==49) { if($touri['auto']==0) { $anzeige=99; } if($touri['fahrer']==49) { $anzeige=49; } } else { $cari = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$touri['auto']."'"); if($cari['aktiv']==0) { $anzeige=1; } else { //$plani = $GLOBALS['mysql']->query_single("SELECT * FROM fplaner WHERE timestamp LIKE '".$unixdate." %' and fid='".$touri['auto']."'"); $plani = $GLOBALS['mysql']->query_single("SELECT * FROM fplaner WHERE tag='".$touri['tag']."' and monat='".$touri['monat']."' and jahr='".$touri['jahr']."' and fid='".$touri['auto']."'"); if($plani['num_rows']== 0) { if($cari['besitz']<3) { $anzeige=3; } else { $anzeige=5; } // auswahl fremdes Fahrzeug } else { $fplani = $GLOBALS['mysql']->query_single("SELECT * FROM fplaner_bez WHERE id='".$plani['grund']."'"); if($fplani['aktiv']== 0) { $anzeige=1; } if($fplani['aktiv']== 1) { $anzeige=2; } if($fplani['aktiv']== 2) { $anzeige=4; } } } } if($anzeige==0) { $back['htmlresult']=' '; } if($anzeige==1) { $back['htmlresult']=' '; } if($anzeige==2) { $back['htmlresult']=' '; } if($anzeige==3) { $back['htmlresult']=' '; } if($anzeige==4) { $back['htmlresult']=' '; } if($anzeige==5) { $back['htmlresult']=' '; } if($anzeige==49) { $back['htmlresult']=' '; } if($anzeige==99) { $back['htmlresult']=' '; } $back['zeile'] = $_POST['tourID']; $back['alt'] = 5; echo json_encode($back); break; //--------------------- user icon nachladen case 'load_user_icon'; //echo $_POST['tourID']; $touri2 = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE id='".$_POST['tourID']."'"); if($touri2['fahrer']==0 OR $touri2['fahrer']==49) { if($touri2['fahrer']==0) { $anzeige=4; } if($touri2['fahrer']==49) { $anzeige=49; } } else { $useri2 = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$touri2['fahrer']."'"); if($useri2['aktiv']==0) { $anzeige=1; //Fahrer nicht aktiv / ausgeschieden } else { $plani = $GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE tag='".$touri2['tag']."' and monat='".$touri2['monat']."' and jahr='".$touri2['jahr']."' and mid='".$touri2['fahrer']."'"); if($plani['num_rows']== 0) { if($useri2['saso']>0) { $anzeige=3; } else { $anzeige=2; } // auswahl fremdes Fahrzeug } else { $plani = $GLOBALS['mysql']->query_single("SELECT * FROM planer_bez WHERE id='".$plani['grund']."'"); if($plani['nichtda']== 1) { $anzeige=1; } elseif($plani['nichtda']== 8) { $anzeige=1; } elseif($plani['nichtda']==19) { $anzeige=1; } else { $anzeige=2; } } } } if($anzeige==0) { $back['htmlresult']=' '; } if($anzeige==1) { $back['htmlresult']=' '; } if($anzeige==2) { $back['htmlresult']=' '; } if($anzeige==3) { $back['htmlresult']=' '; } if($anzeige==4) { $back['htmlresult']=' '; } if($anzeige==49) { $back['htmlresult']=' '; } $back['zeile'] = $_POST['tourID']; $back['alt'] = 5; echo json_encode($back); break; case 'load_free_cars'; default: //--------------------- freie Fahrzeuge ss $key=0; $jahr = (int)date('Y'); $kw = (int)date('W'); //-- trp nachts // $tag = (int)date('d', $_POST['date']); // $monat= (int)date('m', $_POST['date']); // $jahr = (int)date('Y', $_POST['date']); $tempcar = $GLOBALS['mysql']->query("SELECT * FROM fahrzeuge WHERE aktiv=1 and besitz<3 and typ>2 ORDER BY kz"); while($row = $tempcar->fetch_assoc()) { $istabfrage = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE kw='".$kw."' AND jahr='".$jahr."' AND auto='".$row['id']."' and typ>4"); //$istabfrage = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE timestamp LIKE '".$_POST['date']."' AND auto='".$row['id']."' and typ>4"); $pauto = $GLOBALS['mysql']->query_single("SELECT * FROM fplaner WHERE timestamp LIKE '".$_POST['date']." %' and fid='".$row['id']."'"); if($istabfrage['num_rows']== 0) { if($pauto['num_rows']== 0) { $seite['trp'][$key]=$row['kz']." (".$row['hersteller']." ".$row['name'].")"; $key++; } } } echo json_encode($seite); endswitch; ?>