327 lines
14 KiB
PHP
327 lines
14 KiB
PHP
<?php
|
|
//echo'<pre>'; print_r($row); echo'</pre>';
|
|
setlocale(LC_TIME, "de_DE.utf8");
|
|
error_reporting(E_ALL); ini_set('display_errors',1);
|
|
|
|
$xt=$_POST['tag'];
|
|
$xm=$_POST['monat'];
|
|
$xj=$_POST['jahr'];
|
|
|
|
|
|
$template->assign('xt', $xt);
|
|
$template->assign('xm', $xm);
|
|
$template->assign('xj', $xj);
|
|
//----------------------------------------------------------------------------------------------
|
|
$i=0;
|
|
//----------------------------------------------------------------------------------------------
|
|
//--- Linke Tourspalte PVL
|
|
$tt1 = $GLOBALS['mysql']->sql("SELECT * FROM tourenliste WHERE tag='".$xt."' and monat='".$xm."' and jahr='".$xj."' and typ in (2,3) ORDER BY typ,tour");
|
|
$key=0; $menge=0; $stamminfo=" ";
|
|
//--- trennung bei typwechsel
|
|
while($row = $tt1->fetch_assoc()) {
|
|
if ($i!=$row['typ'] && $key!=0) { $nt1[$key]['test']=99; } else { $nt1[$key]['test']=1; }
|
|
|
|
$nt1[$key]['t_info'] = 0;
|
|
$nt1[$key]['m_info'] = 0;
|
|
$nt1[$key]['s_info'] = 0;
|
|
$nt1[$key]['c_info'] = 0;
|
|
$nt1[$key]['csinfo'] = 0;
|
|
$nt1[$key]['aktiv'] = $_SESSION['tour'][$row['tour']]['aktiv'];
|
|
$nt1[$key]['tour'] = $_SESSION['tour'][$row['tour']]['tour'];
|
|
$stammfahrer = $_SESSION['tour'][$row['tour']]['s_fahrer'];
|
|
$nt1[$key]['fname'] = $_SESSION['ma_all'][$row['fahrer']]['name'];
|
|
$nt1[$key]['id']=$row['id'];
|
|
$nt1[$key]['typ']=$row['typ'];
|
|
$nt1[$key]['smsstatus']=$row['smsstatus'];
|
|
$nt1[$key]['kz']=$_SESSION['car'][$row['auto']]['kz'];
|
|
$nt1[$key]['smsid']=$row['smsid'];
|
|
$nt1[$key]['infotext']=$row['infotext'];
|
|
//--------------------------------------------------------------------------
|
|
if($stammfahrer==0) { $nt1[$key]['s_info'] = 1; } // gibt kein Stammfahrer
|
|
$test_sf = $GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE tag='".$xt."' AND monat='".$xm."' AND jahr='".$xj."' AND mid='".$stammfahrer."' ");
|
|
//echo'<pre>'; print_r($test_sf); echo'</pre>';
|
|
if($test_sf['num_rows'] > 0) {
|
|
if($_SESSION['pbz'][$test_sf['grund']]['nichtda']!=0) { $nt1[$key]['s_info'] = 2;
|
|
if($_SESSION['pbz'][$test_sf['grund']]['nichtda']==$row['typ']) { $nt1[$key]['s_info'] = 3; }
|
|
}
|
|
}
|
|
//-------- MA
|
|
if($row['fahrer'] == 0) {
|
|
$nt1[$key]['m_info'] = 3;
|
|
}else {
|
|
if($_SESSION['tour'][$row['tour']]['aktiv'] == 0) { $nt1[$key]['m_info'] = 1; }
|
|
}
|
|
if($nt1[$key]['s_info'] != 0) {
|
|
$nt1[$key]['m_info'] = 4;
|
|
if ($row['fahrer']==0) { $nt1[$key]['m_info'] = 3; }
|
|
$test_m = $GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE tag='".$xt."' AND monat='".$xm."' AND jahr='".$xj."' AND mid='".$row['fahrer']."'");
|
|
|
|
|
|
if($test_m['num_rows'] !=0) {
|
|
if($_SESSION['pbz'][$test_m['grund']]['nichtda']==1) { $nt1[$key]['m_info'] = 3; }
|
|
if($_SESSION['pbz'][$test_m['grund']]['nichtda'] >1) { $nt1[$key]['m_info'] = 2;
|
|
if($_SESSION['pbz'][$test_sf['grund']]['nichtda']==$row['typ']) { $nt1[$key]['m_info'] = 3; }
|
|
if($_SESSION['pbz'][$test_m['grund']]['nichtda']==4) { $nt1[$key]['m_info'] = 3; }
|
|
}
|
|
// test wo anders eingesetzt
|
|
}
|
|
}
|
|
//-------------------------- kurzer Fahrzeugcheck
|
|
// csinfo 1-keinStammCar * 2-nicht JB * 3-kein Fahrzeug/unklar
|
|
if($row['auto'] == 0) { $nt1[$key]['csinfo'] = 3; }
|
|
if($_SESSION['tour'][$row['tour']]['s_auto'] == 0) { $nt1[$key]['csinfo'] = 1; }
|
|
$test_c = $GLOBALS['mysql']->query_single("SELECT * FROM fplaner WHERE tag='".$xt."' AND monat='".$xm."' AND jahr='".$xj."' AND fid='".$row['auto']."'");
|
|
if($test_c['num_rows'] !=0) { $nt1[$key]['csinfo'] = 3; }
|
|
if($nt1[$key]['csinfo']==0 && $_SESSION['car'][$row['auto']]['besitz']!=1) { $nt1[$key]['csinfo'] = 2; }
|
|
// c_info 1-keinStammCar * 2-doppelte Einsatzprüfung 3-rot doppelter Einsatz
|
|
//--------- doppelter Fahrzeug einsatz
|
|
if($row['auto'] !=99) {
|
|
$test_dc = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE tag='".$xt."' AND monat='".$xm."' AND jahr='".$xj."' AND auto='".$row['auto']."' AND fahrer !='".$row['fahrer']."' ");
|
|
if($test_dc['num_rows'] !=0) { $nt1[$key]['c_info'] = 3; }
|
|
}
|
|
//--------- Stammfahrzeug eingesetzt ?
|
|
if($nt1[$key]['c_info'] ==0) {
|
|
if($_SESSION['tour'][$row['tour']]['s_auto'] != $row['auto']) { $nt1[$key]['c_info'] = 2; }
|
|
}
|
|
//---------
|
|
// echo'<pre>'; print_r($test_m); echo'</pre>';
|
|
|
|
// 1 es gibt keinen Stammfahrer
|
|
// 2 Stammfahrer nicht da
|
|
// 3 Stammfahrer für diesen typ
|
|
// 4 offen kein Fahrer
|
|
//------------------------------------------------------------------------------------------------------------------------------------------
|
|
// ---------- ALT
|
|
//-------------------------------------------------------------------------- sicher unnötige
|
|
$nt1[$key]['fahrer_id']=$row['fahrer'];
|
|
$nt1[$key]['auto_id']=$row['auto'];
|
|
$nt1[$key]['kw']=$row['kw'];
|
|
$nt1[$key]['tid']=$row['tour'];
|
|
$nt1[$key]['tourid'] = $_SESSION['tour'][$row['tour']]['id']; // fraglich
|
|
$i=$row['typ'];
|
|
$t=$row['tour'];
|
|
//------------- geschätzte km eintragen
|
|
if ($row['km']<1) {
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET km='".$_SESSION['tour'][$row['tour']]['km']."' WHERE id='".$row['id']."'");
|
|
//echo $_SESSION['tour'][$row['tour']]['km']."-";
|
|
}
|
|
//------------- kein Stammfahrer
|
|
$nt1[$key]['stamm_info']=0;
|
|
if($stammfahrer ==0) {
|
|
$nt1[$key]['stamm_info']=2;
|
|
$stamminfo="kein Stammfahrer";
|
|
}
|
|
//------------- Stammfahrer da ALT
|
|
$test_sf = $GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE tag='".$xt."' AND monat='".$xm."' AND jahr='".$xj."' AND mid='".$stammfahrer."' ");
|
|
if($test_sf['num_rows'] > 0) {
|
|
$nt1[$key]['stamm_info']=1;
|
|
$maf1[$key]['fahrer'] = $_SESSION['ma_all'][$row['fahrer']]['name'];
|
|
$fahrertest = $_SESSION['ma_all'][$stammfahrer]['name'];
|
|
$pnichtda = $_SESSION['pbz'][$test_sf['grund']]['nichtda'];
|
|
$grundtext = $_SESSION['pbz'][$test_sf['grund']]['bez'];
|
|
if($pnichtda==$row['typ']) {
|
|
$stamminfo=$fahrertest." ".$grundtext;
|
|
}
|
|
if($pnichtda==1) {
|
|
$stamminfo=$fahrertest." ".$grundtext;
|
|
}
|
|
}
|
|
$nt1[$key]['stamminfo']=str_replace(" ","_",$stamminfo); // umwandlung für Tooltip
|
|
//------------- Mitarbeiter da
|
|
$test_ma = $GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE tag='".$xt."' AND monat='".$xm."' AND jahr='".$xj."' AND mid='".$row['fahrer']."' ");
|
|
if($test_ma['num_rows'] > 0) {
|
|
$pnichtda = $_SESSION['pbz'][$test_ma['grund']]['nichtda'];
|
|
if($pnichtda==$row['typ']) { $nt1[$key]['fahrer_ok']=0; }
|
|
else if($pnichtda==1) { $nt1[$key]['fahrer_ok']=0; }
|
|
else if($pnichtda==99) { $nt1[$key]['fahrer_ok']=3; }
|
|
else { $nt1[$key]['fahrer_ok']=2; }
|
|
} else {
|
|
$nt1[$key]['fahrer_ok']=1;
|
|
}
|
|
|
|
//-------------- Abnahmetour
|
|
$nt1[$key]['zusatz']=0;
|
|
if($row['tour']>90000) {
|
|
if($row['tour']<91000) { $nt1[$key]['zusatz']=1; } else { $nt1[$key]['zusatz']=2;
|
|
}
|
|
}
|
|
//nt1[$key]['n_update']= $_SESSION['ma_all'][$row['m_update']]['name'];
|
|
//nt1[$key]['var']=$_SESSION['ma_all'][$row['m_update']]['name']." am: ".$row['t_update'];
|
|
$nt1[$key]['m_update']=$row['m_update'];
|
|
$nt1[$key]['t_update']=$row['t_update'];
|
|
$key++;
|
|
}
|
|
//if ($test>0) { $test=0; nt1[$key]['tour']=99999999; $key++; }// trennlinie
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$template->assign('nt1', $nt1);
|
|
//----------------------------------------------------------------------------------------------
|
|
//--- rechte Tourspalte LVZ
|
|
$tt2 = $GLOBALS['mysql']->sql("SELECT * FROM tourenliste WHERE tag='".$xt."' and monat='".$xm."' and jahr='".$xj."' and typ in (4,5,17) ORDER BY typ,tour"); $key=0; $menge=0; $stamminfo=" ";
|
|
|
|
$key=0; $menge=0; $stamminfo=" ";
|
|
//--- trennung bei typwechsel
|
|
while($row = $tt2->fetch_assoc()) {
|
|
if ($i!=$row['typ'] && $key!=0) { $nt2[$key]['test']=99; } else { $nt2[$key]['test']=1; }
|
|
|
|
$nt2[$key]['t_info'] = 0;
|
|
$nt2[$key]['m_info'] = 0;
|
|
$nt2[$key]['s_info'] = 0;
|
|
$nt2[$key]['c_info'] = 0;
|
|
$nt2[$key]['csinfo'] = 0;
|
|
$nt2[$key]['aktiv'] = $_SESSION['tour'][$row['tour']]['aktiv'];
|
|
$nt2[$key]['tour'] = $_SESSION['tour'][$row['tour']]['tour'];
|
|
$stammfahrer = $_SESSION['tour'][$row['tour']]['s_fahrer'];
|
|
$nt2[$key]['fname'] = $_SESSION['ma_all'][$row['fahrer']]['name'];
|
|
$nt2[$key]['id']=$row['id'];
|
|
$nt2[$key]['typ']=$row['typ'];
|
|
$nt2[$key]['smsstatus']=$row['smsstatus'];
|
|
$nt2[$key]['kz']=$_SESSION['car'][$row['auto']]['kz'];;
|
|
$nt2[$key]['smsid']=$row['smsid'];
|
|
$nt2[$key]['infotext']=$row['infotext'];
|
|
//--------------------------------------------------------------------------
|
|
if($stammfahrer==0) { $nt2[$key]['s_info'] = 1; } // gibt kein Stammfahrer
|
|
$test_sf = $GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE tag='".$xt."' AND monat='".$xm."' AND jahr='".$xj."' AND mid='".$stammfahrer."' ");
|
|
//echo'<pre>'; print_r($test_sf); echo'</pre>';
|
|
if($test_sf['num_rows'] > 0) {
|
|
if($_SESSION['pbz'][$test_sf['grund']]['nichtda']!=0) { $nt2[$key]['s_info'] = 2;
|
|
if($_SESSION['pbz'][$test_sf['grund']]['nichtda']==$row['typ']) { $nt2[$key]['s_info'] = 3; }
|
|
}
|
|
}
|
|
//-------- MA
|
|
if($row['fahrer'] == 0) {
|
|
$nt2[$key]['m_info'] = 3;
|
|
}else {
|
|
if($_SESSION['tour'][$row['tour']]['aktiv'] == 0) { $nt2[$key]['m_info'] = 1; }
|
|
}
|
|
if($nt2[$key]['s_info'] != 0) {
|
|
$nt2[$key]['m_info'] = 4;
|
|
if ($row['fahrer']==0) { $nt2[$key]['m_info'] = 3; }
|
|
$test_m = $GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE tag='".$xt."' AND monat='".$xm."' AND jahr='".$xj."' AND mid='".$row['fahrer']."'");
|
|
if($test_m['num_rows'] !=0) {
|
|
if($_SESSION['pbz'][$test_m['grund']]['nichtda']==1) { $nt2[$key]['m_info'] = 3; }
|
|
if($_SESSION['pbz'][$test_m['grund']]['nichtda'] >1) { $nt2[$key]['m_info'] = 2;
|
|
if($_SESSION['pbz'][$test_sf['grund']]['nichtda']==$row['typ']) { $nt2[$key]['m_info'] = 3; }
|
|
}
|
|
// test wo anders eingesetzt
|
|
}
|
|
}
|
|
//-------------------------- kurzer Fahrzeugcheck
|
|
// csinfo 1-keinStammCar * 2-nicht JB * 3-kein Fahrzeug/unklar
|
|
if($row['auto'] == 0) { $nt2[$key]['csinfo'] = 3; }
|
|
if($_SESSION['tour'][$row['tour']]['s_auto'] == 0) { $nt2[$key]['csinfo'] = 1; }
|
|
$test_c = $GLOBALS['mysql']->query_single("SELECT * FROM fplaner WHERE tag='".$xt."' AND monat='".$xm."' AND jahr='".$xj."' AND fid='".$row['auto']."'");
|
|
if($test_c['num_rows'] !=0) { $nt2[$key]['c_info'] = 3; }
|
|
if($nt2[$key]['csinfo']==0 && $_SESSION['car'][$row['auto']]['besitz']!=1) { $nt2[$key]['csinfo'] = 2; }
|
|
// c_info 1-keinStammCar * 2-doppelte Einsatzprüfung 3-rot doppelter Einsatz
|
|
//--------- doppelter Fahrzeug einsatz
|
|
if($row['auto'] !=99) {
|
|
$test_dc = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE tag='".$xt."' AND monat='".$xm."' AND jahr='".$xj."' AND auto='".$row['auto']."' AND fahrer !='".$row['fahrer']."' ");
|
|
if($test_dc['num_rows'] !=0) { $nt2[$key]['c_info'] = 3; }
|
|
}
|
|
|
|
//--------- Stammfahrzeug eingesetzt ?
|
|
if($nt2[$key]['c_info'] ==0) {
|
|
if($_SESSION['tour'][$row['tour']]['s_auto'] != $row['auto']) { $nt2[$key]['c_info'] = 2; }
|
|
}
|
|
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------- sicher unnötige
|
|
$nt2[$key]['fahrer_id']=$row['fahrer'];
|
|
$nt2[$key]['auto_id']=$row['auto'];
|
|
$nt2[$key]['kw']=$row['kw'];
|
|
$nt2[$key]['tid']=$row['tour'];
|
|
$nt2[$key]['tourid'] = $_SESSION['tour'][$row['tour']]['id']; // fraglich
|
|
$i=$row['typ'];
|
|
$t=$row['tour'];
|
|
//--------------------------------------------------------------------------
|
|
|
|
|
|
//------------- geschätzte km eintragen
|
|
if ($row['km']<1) {
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET km='".$_SESSION['tour'][$row['tour']]['km']."' WHERE id='".$row['id']."'");
|
|
//echo $_SESSION['tour'][$row['tour']]['km']."-";
|
|
|
|
|
|
}
|
|
//------------- kein Stammfahrer
|
|
$nt2[$key]['stamm_info']=0;
|
|
if($stammfahrer ==0) {
|
|
$nt2[$key]['stamm_info']=2;
|
|
$stamminfo="kein Stammfahrer";
|
|
}
|
|
//------------- Stammfahrer da
|
|
$test_sf = $GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE tag='".$xt."' AND monat='".$xm."' AND jahr='".$xj."' AND mid='".$stammfahrer."' ");
|
|
if($test_sf['num_rows'] > 0) {
|
|
$nt2[$key]['stamm_info']=1;
|
|
$maf1[$key]['fahrer'] = $_SESSION['ma_all'][$row['fahrer']]['name'];
|
|
$fahrertest = $_SESSION['ma_all'][$stammfahrer]['name'];
|
|
$pnichtda = $_SESSION['pbz'][$test_sf['grund']]['nichtda'];
|
|
$grundtext = $_SESSION['pbz'][$test_sf['grund']]['bez'];
|
|
if($pnichtda==$row['typ']) {
|
|
$stamminfo=$fahrertest." ".$grundtext;
|
|
}
|
|
if($pnichtda==1) {
|
|
$stamminfo=$fahrertest." ".$grundtext;
|
|
}
|
|
}
|
|
$nt2[$key]['stamminfo']=str_replace(" ","_",$stamminfo); // umwandlung für Tooltip
|
|
//------------- Mitarbeiter da
|
|
$test_ma = $GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE tag='".$xt."' AND monat='".$xm."' AND jahr='".$xj."' AND mid='".$row['fahrer']."' ");
|
|
if($test_ma['num_rows'] > 0) {
|
|
$pnichtda = $_SESSION['pbz'][$test_ma['grund']]['nichtda'];
|
|
if($pnichtda==$row['typ']) { $nt2[$key]['fahrer_ok']=0; }
|
|
else if($pnichtda==1) { $nt2[$key]['fahrer_ok']=0; }
|
|
else if($pnichtda==99) { $nt2[$key]['fahrer_ok']=3; }
|
|
else { $nt2[$key]['fahrer_ok']=2; }
|
|
} else {
|
|
$nt2[$key]['fahrer_ok']=1;
|
|
}
|
|
|
|
//-------------- Abnahmetour
|
|
$nt2[$key]['zusatz']=0;
|
|
if($row['tour']>90000) {
|
|
if($row['tour']<91000) { $nt2[$key]['zusatz']=1; } else { $nt2[$key]['zusatz']=2;
|
|
}
|
|
}
|
|
//nt1[$key]['n_update']= $_SESSION['ma_all'][$row['m_update']]['name'];
|
|
//nt1[$key]['var']=$_SESSION['ma_all'][$row['m_update']]['name']." am: ".$row['t_update'];
|
|
$nt2[$key]['m_update']=$row['m_update'];
|
|
$nt2[$key]['t_update']=$row['t_update'];
|
|
$key++;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$template->assign('nt2', $nt2);
|
|
//----------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
$template->assign('content', 'tpl/ajax/p_tdata.tpl');
|
|
?>
|