115 lines
No EOL
5.3 KiB
PHP
115 lines
No EOL
5.3 KiB
PHP
<?php
|
|
|
|
//-------------------- wiederkehrende abfragen ---------------------------------------------------
|
|
$a_touren = $GLOBALS['a_touren'];
|
|
$a_fahrzg = $GLOBALS['a_fahrzg'];
|
|
$a_fahrer = $GLOBALS['a_fahrer'];
|
|
$a_planbz = $GLOBALS['a_planbz'];
|
|
$a_planbf = $GLOBALS['a_planbf'];
|
|
//------------------------------------------------------------------------------------------------
|
|
|
|
$tourdata = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE id='".$_POST['id']."'");
|
|
|
|
$ta_id= array_search($tourdata['tour'], array_column($a_touren, 'id'));
|
|
$tourx['tname']=$a_touren[$ta_id]['tour'];
|
|
$tourx['aktiv']=$a_touren[$ta_id]['aktiv'];
|
|
|
|
|
|
$ma_id= array_search($a_touren[$ta_id]['s_fahrer'], array_column($a_fahrer, 'id')); $tourx['sfahrer']=$a_fahrer[$ma_id]['name'];
|
|
|
|
if ($tourdata['typ']==3 ) {
|
|
$tourx['fahrer_array1'] = $GLOBALS['mysql']->query_array("SELECT DISTINCT mitarbeiter.id, mitarbeiter.name FROM mitarbeiter
|
|
JOIN tourenliste
|
|
WHERE tourenliste.tour='".$tourdata['tour']."' AND tourenliste.fahrer=mitarbeiter.id
|
|
AND mitarbeiter.aktiv>0 AND mitarbeiter.gh>0 ORDER BY mitarbeiter.name");
|
|
$tourx['fahrer_array2']=$GLOBALS['mysql']->query_array("SELECT * FROM mitarbeiter WHERE aktiv>0 AND gh>0 ORDER BY name");
|
|
|
|
}
|
|
if ($tourdata['typ']==4 ) {
|
|
$tourx['fahrer_array1'] = $GLOBALS['mysql']->query_array("SELECT DISTINCT mitarbeiter.id, mitarbeiter.name FROM mitarbeiter
|
|
JOIN tourenliste
|
|
WHERE tourenliste.tour='".$tourdata['tour']."' AND tourenliste.fahrer=mitarbeiter.id
|
|
AND mitarbeiter.aktiv>0 AND mitarbeiter.lvz>0 ORDER BY mitarbeiter.name");
|
|
$tourx['fahrer_array2']=$GLOBALS['mysql']->query_array("SELECT * FROM mitarbeiter WHERE aktiv>0 AND lvz>0 ORDER BY name"); }
|
|
if ($tourdata['typ']==5 ) {
|
|
$tourx['fahrer_array1'] = $GLOBALS['mysql']->query_array("SELECT DISTINCT mitarbeiter.id, mitarbeiter.name FROM mitarbeiter
|
|
JOIN tourenliste
|
|
WHERE tourenliste.tour='".$tourdata['tour']."' AND tourenliste.fahrer=mitarbeiter.id
|
|
AND mitarbeiter.aktiv>0 AND mitarbeiter.pin>0 ORDER BY mitarbeiter.name");
|
|
$tourx['fahrer_array2']=$GLOBALS['mysql']->query_array("SELECT * FROM mitarbeiter WHERE aktiv>0 AND pin>0 ORDER BY name"); }
|
|
if ($tourdata['typ']==17) {
|
|
$tourx['fahrer_array1'] = $GLOBALS['mysql']->query_array("SELECT DISTINCT mitarbeiter.id, mitarbeiter.name FROM mitarbeiter
|
|
JOIN tourenliste
|
|
WHERE tourenliste.tour='".$tourdata['tour']."' AND tourenliste.fahrer=mitarbeiter.id
|
|
AND mitarbeiter.aktiv>0 AND mitarbeiter.lvzz>0 ORDER BY mitarbeiter.name");
|
|
$tourx['fahrer_array2']=$GLOBALS['mysql']->query_array("SELECT * FROM mitarbeiter WHERE aktiv>0 AND lvzz>0 ORDER BY name");
|
|
}
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
//echo'<pre>'; print_r($row['tour']); echo'</pre>';
|
|
|
|
$tourx['id']=$tourdata['id'];
|
|
$tourx['typ']=$tourdata['typ'];
|
|
$tourx['smsstatus']=$tourdata['smsstatus'];
|
|
$tourx['smsid']=$tourdata['smsid'];
|
|
|
|
//-------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
$tourx['fahrer_id']=$tourdata['fahrer'];
|
|
$tourx['auto_id']=$tourdata['auto'];
|
|
$tourx['smsid']=$tourdata['smsid'];
|
|
$tourx['infotext']=$tourdata['infotext'];
|
|
|
|
//$ma_id= array_search($a_fahrer, array_column($a_fahrer, 'id')); $tourx['fahrer_name']=$a_fahrer[$ma_id]['name'];
|
|
|
|
//------------- kein Stammfahrer
|
|
if($a_touren[$ta_id]['s_fahrer'] ==0) {
|
|
$tourx['stamm_info']=2; $tourx['stamminfo']="kein Stammfahrer";
|
|
} else {
|
|
//------------- Stammfahrer da
|
|
|
|
//---------------------------------------------------------- umbauen in Arrayload !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
$test_sf = $GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE tag='".$tag."' AND monat='".$monat."' AND jahr='".$jahr."' AND mid='".$stammfahrer."' ");
|
|
if($test_sf['num_rows'] > 0) {
|
|
$tourx['stamm_info']=1;
|
|
$ma_id= array_search($stammfahrer, array_column($a_fahrer, 'id'));
|
|
$pa_id= array_search($test_sf['grund'], array_column($a_planbz, 'id'));
|
|
$pnichtda=$a_planbz[$pa_id]['nichtda'];
|
|
if($pnichtda==$tourdata['typ']) {
|
|
|
|
$tourx['stamminfo']=$a_fahrer[$ma_id]['name']."</br>".$a_planbz[$pa_id]['bez']; $tourx['stamm_info']=2;
|
|
}
|
|
if($pnichtda==1) {
|
|
$ma_id= array_search($stammfahrer, array_column($a_fahrer, 'id'));
|
|
$tourx['stamminfo']=$a_fahrer[$ma_id]['name']."</br>".$a_planbz[$pa_id]['bez']; $tourx['stamm_info']=2;
|
|
}
|
|
}
|
|
//------------- Mitarbeiter da
|
|
$test_ma = $GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE tag='".$tag."' AND monat='".$monat."' AND jahr='".$jahr."' AND mid='".$row['fahrer']."' ");
|
|
if($test_ma['num_rows'] > 0) {
|
|
$pa_id= array_search($test_ma['grund'], array_column($a_planbz, 'id'));
|
|
$pnichtda=$a_planbz[$pa_id]['nichtda'];
|
|
if($pnichtda==$tourdata['typ']) { $tourx['fahrer_ok']=0; }
|
|
else if($pnichtda==1) { $tourx['fahrer_ok']=0; }
|
|
else if($pnichtda==99) { $tourx['fahrer_ok']=3; }
|
|
else { $tourx['fahrer_ok']=2; }
|
|
} else {
|
|
$tourx['fahrer_ok']=1;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// echo'<pre>'; print_r($tourx); echo'</pre>';
|
|
|
|
|
|
$template->assign('auto_array', $a_fahrzg);
|
|
$template->assign('tour', $tourx);
|
|
$template->assign('content', 'tpl/ajax/ntour.tpl');
|
|
|
|
?>
|