138 lines
6.5 KiB
PHP
138 lines
6.5 KiB
PHP
<?
|
|
$_SESSION['m1']=3; $_SESSION['m2']=5;
|
|
// error_reporting(E_ALL);
|
|
// ini_set('display_errors', 1);
|
|
|
|
|
|
if($_SESSION['benutzer']==12) { $planer="T. Muerbe"; }
|
|
else if($_SESSION['benutzer']==13) { $planer="Anett"; }
|
|
else if($_SESSION['benutzer']==18) { $planer="Joerg Basse"; }
|
|
else if($_SESSION['benutzer']==44) { $planer="I. Steinmacher"; }
|
|
else $planer="Frank";
|
|
|
|
$temp = strtotime("next monday");
|
|
//$temp = strtotime("+1 week");
|
|
$jahr_aktuell = (int)date('Y', $temp);
|
|
$kw_aktuell = (int)date('W', $temp);
|
|
|
|
//----------------------------------------------- Normplan speichern
|
|
if(isset($_POST['npsave'])) {
|
|
$tmp = $GLOBALS['mysql']->query("SELECT * FROM touren WHERE typ=7");
|
|
while($row = $tmp->fetch_assoc()) {
|
|
if($row['utyp']==1) {
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET Norm='".$_POST['rsnorm1']."',logid='".time()."' WHERE tour='".$row['id']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
}
|
|
if($row['utyp']==2) {
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET Norm='".$_POST['rsnorm2']."',logid='".time()."' WHERE tour='".$row['id']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
}
|
|
if($row['utyp']==3) {
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET Norm='".$_POST['rsnorm3']."',logid='".time()."' WHERE tour='".$row['id']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
}
|
|
if($row['utyp']==4) {
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET Norm='".$_POST['rsnorm4']."',logid='".time()."' WHERE tour='".$row['id']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
}
|
|
}
|
|
$success[]='Der Rundschau-Normplan wurde geändert.'; $template->assign('success', $success);
|
|
}
|
|
//---------------------- Erscheinungstag speichern
|
|
elseif(isset($_POST['datesave'])) {
|
|
$tmp = $GLOBALS['mysql']->query("SELECT * FROM touren WHERE typ=7");
|
|
while($row = $tmp->fetch_assoc()) {
|
|
if($row['utyp']==1) {
|
|
$teilen = explode(".",$_POST['datumland']);
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET tag='".$teilen[0]."' WHERE tour='".$row['id']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET monat='".$teilen[1]."' WHERE tour='".$row['id']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET jahr='".$teilen[2]."',logid='".time()."' WHERE tour='".$row['id']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
} else {
|
|
$teilen = explode(".",$_POST['datumstadt']);
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET tag='".$teilen[0]."' WHERE tour='".$row['id']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET monat='".$teilen[1]."' WHERE tour='".$row['id']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET jahr='".$teilen[2]."',logid='".time()."' WHERE tour='".$row['id']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
}
|
|
}
|
|
$success[]='Der Rundschau-Abholtag wurde geändert.'; $template->assign('success', $success);
|
|
}
|
|
|
|
//------------------------ speicherbutten
|
|
elseif(isset($_POST['datasave'])) {
|
|
foreach($_POST['list'] as $row) {
|
|
// echo $row['tid'].' <- ID<br>'.$row['infotext'].' <- Infotext<br>'.$row['Fahrer'].' <- Fahrer<br>'.$row['Fahrzeug'].' <- Fahrzeug<br><br><br>';
|
|
$GLOBALS['mysql']->insert("UPDATE tourenliste SET exemplare='".$row['exemplare']."',zeit='".$row['szeit']."',gewicht='".$row['gewicht']."',gewicht4='".$row['gewicht4']."',logid='".time()."' WHERE id='".$row['tid']."'");
|
|
}
|
|
$success[]='Alle Touren wurden geändert.'; $template->assign('success', $success);
|
|
}
|
|
|
|
//--------------------- auslesen
|
|
|
|
$key=0;
|
|
$rs_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."' and typ=7");
|
|
while($row = $rs_tour->fetch_assoc()) {
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
|
|
|
|
if($row_tour['utyp']==1) {
|
|
$wochentag=date('l',mktime(0,0,0,$row['monat'],$row['tag'],$row['jahr']));
|
|
$taginfo1=$GLOBALS['core']->translateDate($wochentag);
|
|
$datumland=$row['tag'].".".$row['monat'].".".$row['jahr'];
|
|
} else {
|
|
$wochentag=date('l',mktime(0,0,0,$row['monat'],$row['tag'],$row['jahr']));
|
|
$taginfo2=$GLOBALS['core']->translateDate($wochentag);
|
|
$datumstadt=$row['tag'].".".$row['monat'].".".$row['jahr'];
|
|
}
|
|
|
|
$rs_tour2[$key]['tour']=$row_tour['tour'];
|
|
$rs_tour2[$key]['id']=$row['id'];
|
|
if($row['exemplare']==0) { $menge=$row_tour['exemplare']; } else { $menge=$row['exemplare'];}
|
|
$rs_tour2[$key]['tid']=$key;
|
|
$rs_tour2[$key]['exemplare']=$menge;
|
|
$rs_tour2[$key]['zeit']=$row['zeit'];
|
|
$rs_tour2[$key]['gewicht']=$row['gewicht'];
|
|
$rs_tour2[$key]['gewicht4']=$row['gewicht4'];
|
|
$rs_tour2[$key]['norm']=$row['Norm'];
|
|
if($row['Pakete']>0) {
|
|
$pak=$row['Pakete'];
|
|
$rs_tour2[$key]['pakete'] = ceil($pak);
|
|
} else {
|
|
$norm=$row['Norm'];
|
|
if ($norm>0) {
|
|
$pak=$menge/$norm;
|
|
$rs_tour2[$key]['pakete'] = ceil($pak);
|
|
$rs_tour2[$key]['norm']=$row['Norm'];
|
|
}
|
|
}
|
|
// $rs_tour2[$key]['infotext']=$row['infotext'];
|
|
$key++;
|
|
}
|
|
|
|
$rsnorm1=0;$rsnorm2=0;$rsnorm3=0;$rsnorm4=0;
|
|
//--------------- Norm auslesen
|
|
$tmp = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."' and typ=7");
|
|
while($row = $tmp->fetch_assoc()) {
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
|
|
if($row_tour['utyp']==1) { $rsnorm1= $row['Norm']; }
|
|
if($row_tour['utyp']==2) { $rsnorm2= $row['Norm']; }
|
|
if($row_tour['utyp']==3) { $rsnorm3= $row['Norm']; }
|
|
if($row_tour['utyp']==4) { $rsnorm4= $row['Norm']; }
|
|
}
|
|
|
|
$kw_alt = (int)date('W',time()-604800);
|
|
$jahr_alt = (int)date('y',time()-604800);
|
|
$last = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE kw='".$kw_alt."' and jahr='".$jahr_alt."' and typ=7");
|
|
|
|
|
|
|
|
$template->assign('rsnorm1', $rsnorm1);
|
|
$template->assign('rsnorm2', $rsnorm2);
|
|
$template->assign('rsnorm3', $rsnorm3);
|
|
$template->assign('rsnorm4', $rsnorm4);
|
|
|
|
|
|
$template->assign('datumstadt',$datumstadt);
|
|
$template->assign('datumland', $datumland);
|
|
$template->assign('kw_alt', $kw_alt);
|
|
$template->assign('jahr_alt', $jahr_alt);
|
|
$template->assign('jahr_aktuell', $jahr_aktuell);
|
|
$template->assign('kw_aktuell', $kw_aktuell);
|
|
$template->assign('rs_tour2', $rs_tour2);
|
|
|
|
$template->assign('content', 'tpl/irundschau.tpl');
|
|
?>
|