87 lines
No EOL
2.6 KiB
PHP
87 lines
No EOL
2.6 KiB
PHP
<?php
|
|
//echo "<pre>"; print_r($_POST); echo "</pre>";
|
|
|
|
if(isset($_GET['a']))
|
|
$action=$_GET['a'];
|
|
else
|
|
$action='load_free_urlaub';
|
|
switch($action):
|
|
|
|
case 'user_save';
|
|
$GLOBALS['mysql']->insert("UPDATE touren SET s_fahrer='".$_POST['user']."'WHERE id='".$_POST['tourID']."'");
|
|
$back['success'] = true;
|
|
$temp1=$GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$_POST['user']."'");
|
|
$back['lastnote']="Stammfahrer: ".$temp1['name']." geändert.";
|
|
$back['alt'] = 5;
|
|
echo json_encode($back);
|
|
|
|
break;
|
|
|
|
case 'car_save';
|
|
$GLOBALS['mysql']->insert("UPDATE touren SET s_auto='".$_POST['car']."'WHERE id='".$_POST['tourID']."'");
|
|
$back['success'] = true;
|
|
$back['lastnote']="Stammfahrzeug geändert.";
|
|
$back['alt'] = 5;
|
|
echo json_encode($back);
|
|
|
|
break;
|
|
|
|
case 'info_save';
|
|
$GLOBALS['mysql']->insert("UPDATE planer SET info='".$_POST['info']."'WHERE id='".$_POST['tourID']."'");
|
|
$back['success'] = true;
|
|
$back['lastnote']="Information: ".$_POST['info']." hinzugefügt.";
|
|
$back['alt'] = 5;
|
|
echo json_encode($back);
|
|
|
|
break;
|
|
|
|
case 'date_save';
|
|
$GLOBALS['mysql']->insert("UPDATE touren SET aktiv='".$_POST['istC']."' WHERE id='".$_POST['id']."'");
|
|
$back['success'] = true;
|
|
$back['alt'] = 5;
|
|
echo json_encode($back);
|
|
|
|
break;
|
|
|
|
case 'tdate_save';
|
|
if($_POST['istC']==0) {
|
|
echo $_POST['istC'];
|
|
$GLOBALS['mysql']->query("DELETE FROM tourenliste WHERE tour='".$_POST['tid']."' AND tag='".$_POST['tag']."' AND monat='".$_POST['monat']."' AND jahr='".$_POST['jahr']."'");
|
|
} else {
|
|
$tmpitour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$_POST['tid']."'");
|
|
$kw=date("W",mktime(0,0,0,$_POST['monat'],$_POST['tag'],$_POST['jahr']));
|
|
$GLOBALS['mysql']->insert("INSERT INTO tourenliste (tour,kw,tag,monat,jahr,typ,utyp,auto,fahrer)
|
|
VALUES(
|
|
'".$_POST['tid']."',
|
|
'".$kw."',
|
|
'".$_POST['tag']."',
|
|
'".$_POST['monat']."',
|
|
'".$_POST['jahr']."',
|
|
'".$tmpitour['typ']."',
|
|
'".$tmpitour['utyp']."',
|
|
'".$tmpitour['s_auto']."',
|
|
'".$tmpitour['s_fahrer']."')
|
|
");
|
|
echo "save";
|
|
}
|
|
|
|
$back['success'] = true;
|
|
$back['alt'] = 5;
|
|
echo json_encode($back);
|
|
|
|
break;
|
|
|
|
case 'load_free_urlaub';
|
|
default:
|
|
|
|
//--------------------- freier Urlaub aktuelles Jahr
|
|
$temp1=$GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$_POST['maID']."'");
|
|
$temp2=$GLOBALS['mysql']->query_single("SELECT * FROM planer WHERE mid='".$_POST['maID']."' and jahr='".$_POST['jahr']."' and grund=4 ");
|
|
$temp3=$temp1['urlaubprojahr']-$temp2['num_rows'];
|
|
$temp4="Resturlaub ".$_POST['jahr'].": ".$temp3." Tag(e)";
|
|
echo json_encode($temp4);
|
|
// echo $temp4;
|
|
|
|
endswitch;
|
|
|
|
?>
|