jb-data.de/scripts/a_lohnlauf.php
2025-08-11 22:23:30 +02:00

56 lines
No EOL
2.1 KiB
PHP

<?php
$_SESSION['m1']=6; $_SESSION['m2']=1;
// error_reporting(E_ALL);
// ini_set('display_errors', 1);
// echo "<pre>";
// print_r($tour_id);
// echo "</pre>";
$tjahr = (int)date('Y'); $tmonat = (int)date('m');
if($tmonat==1) { $monat=12; $jahr=$tjahr-1;} else { $monat=$tmonat-1; $jahr=$tjahr;}
$ds=0;
$madaten = $GLOBALS['mysql']->query("SELECT * FROM mitarbeiter");
while($row_ma = $madaten->fetch_assoc()) {
$ma_id= $row_ma['id'];
$ma_tk= $row_ma['tarif'];
$inc_typ1= $row_ma['inc_typ1'];
$inc_typ2= $row_ma['inc_typ2'];
$inc_tour1= $row_ma['inc_tour1'];
$inc_tour2= $row_ma['inc_tour2'];
$tdaten = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE monat='".$monat."' AND jahr='".$jahr."' AND fahrer='".$ma_id."'");
while($row_td = $tdaten->fetch_assoc()) {
$tour_id=$row_td['id'];
$leer=$row_td['tarif'];
$tmpd = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row_td['tour']."'");
//---------- bug
$GLOBALS['mysql']->insert("UPDATE tourenliste SET utyp='".$tmpd['utyp']."' WHERE id='".$tour_id."'");
//---------- bug ende
if ($ma_tk==0) { $tourlohn=$tmpd['tarif0']; }
if ($ma_tk==1) { $tourlohn=$tmpd['tarif1']; }
if ($ma_tk==2) { $tourlohn=$tmpd['tarif2']; }
if ($ma_tk==3) { $tourlohn=$tmpd['tarif3']; }
if ($ma_tk==4) { $tourlohn=$tmpd['tarif4']; }
$tourh=$tmpd['tarifh'];
if ($inc_typ1 ==$row_td['typ']) { $tourlohn=0; }
if ($inc_typ2 ==$row_td['typ']) { $tourlohn=0; }
if ($inc_tour1==$row_td['tour']) { $tourlohn=0; }
if ($inc_tour2==$row_td['tour']) { $tourlohn=0; }
$GLOBALS['mysql']->insert("UPDATE tourenliste SET tarif='".$tourlohn."' WHERE id='".$tour_id."'");
$GLOBALS['mysql']->insert("UPDATE tourenliste SET tarifh='".$tourh."' WHERE id='".$tour_id."'");
$ds++;
}
}
$mitarbeiterlist = $GLOBALS['mysql']->query_array("SELECT * FROM mitarbeiter WHERE aktiv>0 AND typ<90 ORDER BY name");
$template->assign('mitarbeiterlist', $mitarbeiterlist);
$template->assign('monat', $monat);
$template->assign('jahr', $jahr);
$template->assign('ds', $ds);
$template->assign('content', 'tpl/a_lohn.tpl'); //_list
?>