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

125 lines
4.8 KiB
PHP

<?php
// Melde alle PHP Fehler (siehe Changelog)
error_reporting(E_ALL); ini_set('display_errors', 0);
if ($_GET['kw'] > 0) { $kw_aktuell = $_GET['kw']; } else { $kw_aktuell = (int)date('W'); }
if ($_GET['jahr']>0) { $jahr_aktuell=$_GET['jahr']; } else { $jahr_aktuell = (int)date('Y'); }
if ($_GET['typ'] > 0) { $typ = $_GET['typ']; } else { $typ = 0; }
$timestamp_sonntag = strtotime("{$jahr_aktuell}-W{$kw_aktuell}-7");
$stag=date('d', $timestamp_sonntag); $smonat=date('m', $timestamp_sonntag); $sjahr=date('Y', $timestamp_sonntag);
$sasodatum=$stag.".".$smonat.".".$sjahr;
$datum=$stag.".".$smonat.".".$sjahr;
//--------------------------------------------------------------------------------------------------
require('lib/fpdf.php');
class PDF extends FPDF {
function Footer() {
$this->SetY(-15);
$this->SetFont('Helvetica','I',6);
$this->Cell(190,3,'JB-Transport.de - Bautzner Str. 67 - 04347 Leipzig ***** Interne Liste - NON Public ***** by. F. Teichert ©2012','1','0','C','1');
}
}
$pdf = new PDF('P','mm','A4');
$pdf->AddPage();
// blau (0,160,230)
// Orange (240,150, 0)
// grau (200,200,200)
$pdf->SetFont('Helvetica','B',16);
// $pdf->SetTextColor(0,160,230);
$pdf->SetFillColor(240,150,0);
$pdf->Cell(54,8,($kw_aktuell).".KW - ".($datum),'1','0','L','1');
$pdf->Write(8,"\n");
$pdf->SetFont('Helvetica','BI',14);
$pdf->SetFillColor(0,0,140);
$pdf->SetTextColor(240,150,0);
//$pdf->Cell(110,8,"Sachsen-Sonntag",'1','0','C','1');
$pdf->Image('template/images/saso.png',75, 6);
$pdf->Image('template/images/jb_logo2.png', 125, 7);
//-------------------------------------- SASO
$row_norm = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."' and typ=19");
$snorm=$row_norm['Norm'];
$pdf->Write(1,"\n");
$pdf->SetFont('Helvetica','BI',14);
$pdf->SetFillColor(0,0,140);
$pdf->SetTextColor(240,150,0);
$pdf->Cell(110,7,"Sachsen-Sonntag - ".$snorm."er Norm",'0','0','L','0');
$pdf->Write(9,"\n");
$pdf->SetFillColor(100,100,100);
$pdf->SetFont('Helvetica','BI',10);
$pdf->SetTextColor(255,255,255);
$pdf->Cell(30,6,"Tour",'1','0','L','1');
$pdf->Cell(50,6,"Bezeichnung",'1','0','L','1');
$pdf->Cell(45,6,"Fahrer",'1','0','L','1');
$pdf->Cell(22,6,"Stellzeit",'1','0','L','1');
$pdf->Cell(43,6,"Telefon",'1','0','L','1');
$pdf->Write(4,"\n");
$pdf->SetFillColor(255,255,255);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('');
$pdf->Write(4,"\n");
$pdf->SetFont('Helvetica','BI',10);
$pdf->SetFillColor(255,255,255);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('');
$key=0;
$saso_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."' and typ=19 ORDER BY zeit");
while($row = $saso_tour->fetch_assoc()) {
if($row['tour']<8000) { $pdf->SetFont('Helvetica','B',10); $pdf->Cell(190,3,(' '),'TB','1','C','1'); } else { $pdf->SetFont(''); }
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
$row_fahrerx = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$row['fahrer']."'");
$pdf->Cell(30,5,utf8_decode($row_tour['tour']),'1','0','L','1');
$pdf->Cell(50,5,utf8_decode($row_tour['infotitel']),'1','0','L','1');
$pdf->Cell(45,5,utf8_decode($row_fahrerx['name']),'1','0','L','1');
$pdf->Cell(22,5,utf8_decode($row['zeit']." Uhr"),'1','0','R','1');
$temptel=$row_fahrerx['handy'];
$temptel2 = substr($temptel, 3, 20);
$temptel3 = substr($temptel2, 0, 3);
$temptel4 = substr($temptel2, 3, 20);
$pdf->Cell(43,5,("0".$temptel3."-".$temptel4),'1','1','R','1');
$key++;
}
//---------------------------------------
if ($_GET['icon'] ==0) { $pdf->Output('SaSo_Rampe_'.($datum).'.pdf','I'); }
if ($_GET['icon'] ==1) { $pdf->Output('SaSo_Rampe_'.($datum).'.pdf','D'); }
if ($_GET['icon'] ==2) {
if (!class_exists("phpmailer")) {
require_once('lib/phpmailer/class.phpmailer.php');
}
// require('lib/phpmailer/phpmailer.inc.php');
$empfaenger = "dispo@jb-transport.de";
$betreff="SaSo-Rampenplan ".($datum).".pdf";
$Dateiname = "saso_".($datum).".pdf";
// $DateinameMail = "saso_Rampe_".($datum).".pdf";
require_once('lib/phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->SetLanguage('de', $mail->PluginDir . '/language/');
$mail->Body = "SaSo-Rampenplan ".$datum;
$mail->From = "dispo@jb-transport.de";
$mail->FromName = "dispo@jb-transport.de";
$mail->AddAddress("dispo@jb-transport.de");
$mail->AddAddress("r.melzig@web.de");
$mail->Subject = $betreff;
$doc = $pdf->Output('','S');
$mail->AddStringAttachment($doc,"SaSo_Rampe_".$datum.".pdf", 'base64', 'application/pdf'); //$Dateiname
$mail->Send();
echo $Dateiname.' wurde versendet an: '.$empfaenger;
?><meta http-equiv="refresh" content="2; URL=https://edv.jb-transport.de/index.php?s=linfo&mailok=1"><?php
}
?>