157 lines
6.6 KiB
PHP
157 lines
6.6 KiB
PHP
<?php
|
|
require('lib/fpdf.php');
|
|
$jahr_aktuell = (int)date('Y');
|
|
$kw_aktuell = (int)date('W');
|
|
|
|
class PDF extends FPDF {
|
|
function Footer() {
|
|
$this->SetY(-15);
|
|
$this->SetFont('Helvetica','I',6);
|
|
$this->Cell(275,3,'JB-Transport.de - Bautzner Str. 67 - 04347 Leipzig ***** Interne Liste - NON Public ***** by. F. Teichert ©2012','1','0','C','1');
|
|
}
|
|
}
|
|
$pdf = new PDF('L','mm','A4');
|
|
$pdf->AddPage();
|
|
// blau (0,160,230)
|
|
// Orange (240,150, 0)
|
|
// grau (200,200,200)
|
|
|
|
$pdf->SetFont('Helvetica','B',20);
|
|
// $pdf->SetTextColor(0,160,230);
|
|
$pdf->SetFillColor(240,150,0);
|
|
$pdf->Cell(24,8,($kw_aktuell).".KW",'1','0','L','1');
|
|
$pdf->Write(8,"\n");
|
|
$pdf->SetFont('Helvetica','BI',20);
|
|
$pdf->SetFillColor(0,0,140);
|
|
$pdf->SetTextColor(240,150,0);
|
|
$pdf->Cell(180,8,"Leipziger Rundschau",'1','0','C','1');
|
|
$pdf->Image('template/images/Image3.png', 205, 7);
|
|
|
|
$pdf->Write(8,"\n\n");
|
|
$pdf->SetFillColor(100,100,100);
|
|
$pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->SetTextColor(255,255,255);
|
|
$pdf->Cell(20,5,"Datum",'1','0','L','1');
|
|
$pdf->Cell(20,5,"Tour",'1','0','L','1');
|
|
$pdf->Cell(60,5,"Bezeichnung",'1','0','L','1');
|
|
$pdf->Cell(45,5,"Fahrer",'1','0','L','1');
|
|
$pdf->Cell(25,5,"Pakete",'1','0','L','1');
|
|
$pdf->Cell(20,5,"Gewicht",'1','0','L','1');
|
|
$pdf->Cell(22,5,"Norm",'1','0','L','1');
|
|
$pdf->Cell(20,5,"Stellzeit",'1','0','L','1');
|
|
$pdf->Cell(28,5,"Fahrzeug",'1','0','L','1');
|
|
$pdf->Cell(15,5,"SMS",'1','0','L','1');
|
|
$pdf->Write(8,"\n");
|
|
$pdf->SetFillColor(255,255,255);
|
|
$pdf->SetTextColor(0,0,0);
|
|
$pdf->SetFont('');
|
|
$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()) {
|
|
$datum=$row['tag'].".".$row['monat'].".".$row['jahr'];
|
|
$pdf->Cell(20,5,($datum),'1','0','R','1');
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
|
|
$stamma=$row_tour['s_auto']; $stammf=$row_tour['s_fahrer'];
|
|
$pdf->Cell(20,5,($row_tour['tour']),'1','0','L','1');
|
|
$pdf->Cell(60,5,($row_tour['infotitel']),'1','0','L','1');
|
|
$row_fahrerx = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$row['fahrer']."'");
|
|
if ($stammf != $row['fahrer']) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(45,5,($row_fahrerx['name']),'1','0','L','1');
|
|
$pdf->SetFont('');
|
|
$pak=ceil($row['Pakete']);
|
|
$pdf->Cell(25,5,($pak." Pakete"),'1','0','R','1');
|
|
if ($row['gewicht']>1799) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(20,5,($row['gewicht']." kg"),'1','0','R','1');
|
|
$pdf->SetFont('');
|
|
$pdf->Cell(22,5,($row['Norm'])."er Norm",'1','0','R','1');
|
|
$pdf->Cell(20,5,($row['zeit']." Uhr"),'1','0','R','1');
|
|
$row_autox = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'");
|
|
if($stamma != $row['auto']) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(28,5,($row_autox['kz']),'1','0','L','1');
|
|
$pdf->SetFont('');
|
|
$pdf->Cell(15,5,'Status','1','1','L','1');
|
|
$pdf->SetFont('');
|
|
$key++;
|
|
}
|
|
$pdf->Write(8,"\n\n");
|
|
$pdf->SetFont('Helvetica','BI',20);
|
|
$pdf->SetFillColor(0,0,140);
|
|
$pdf->SetTextColor(240,150,0);
|
|
$pdf->Cell(275,8,"LVZ - Marktplatz",'1','0','C','1');
|
|
$pdf->Write(8,"\n\n");
|
|
$pdf->SetFillColor(100,100,100);
|
|
$pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->SetTextColor(255,255,255);
|
|
$pdf->Cell(20,5,"Datum",'1','0','L','1');
|
|
$pdf->Cell(20,5,"Tour",'1','0','L','1');
|
|
$pdf->Cell(60,5,"Bezeichnung",'1','0','L','1');
|
|
$pdf->Cell(45,5,"Fahrer",'1','0','L','1');
|
|
$pdf->Cell(25,5,"Pakete",'1','0','L','1');
|
|
$pdf->Cell(20,5,"Gewicht",'1','0','L','1');
|
|
$pdf->Cell(22,5,"Norm",'1','0','L','1');
|
|
$pdf->Cell(20,5,"Stellzeit",'1','0','L','1');
|
|
$pdf->Cell(28,5,"Fahrzeug",'1','0','L','1');
|
|
$pdf->Cell(15,5,"SMS",'1','0','L','1');
|
|
$pdf->Write(8,"\n");
|
|
$pdf->SetFillColor(255,255,255);
|
|
$pdf->SetTextColor(0,0,0);
|
|
$pdf->SetFont('');
|
|
$rs_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."' and typ=10");
|
|
while($row = $rs_tour->fetch_assoc()) {
|
|
$datum=$row['tag'].".".$row['monat'].".".$row['jahr'];
|
|
$pdf->Cell(20,5,($datum),'1','0','R','1');
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
|
|
$stamma=$row_tour['s_auto']; $stammf=$row_tour['s_fahrer'];
|
|
$pdf->Cell(20,5,($row_tour['tour']),'1','0','L','1');
|
|
$pdf->Cell(60,5,($row_tour['infotitel']),'1','0','L','1');
|
|
$row_fahrerx = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$row['fahrer']."'");
|
|
if ($stammf != $row['fahrer']) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(45,5,($row_fahrerx['name']),'1','0','L','1');
|
|
$pdf->SetFont('');
|
|
$pak=ceil($row['Pakete']);
|
|
$pdf->Cell(25,5,($pak." Pakete"),'1','0','R','1');
|
|
if ($row['gewicht']>1799) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(20,5,($row['gewicht']." kg"),'1','0','R','1');
|
|
$pdf->SetFont('');
|
|
$pdf->Cell(22,5,($row['Norm'])."er Norm",'1','0','R','1');
|
|
$pdf->Cell(20,5,($row['zeit']." Uhr"),'1','0','R','1');
|
|
$row_autox = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'");
|
|
if($stamma != $row['auto']) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(28,5,($row_autox['kz']),'1','0','L','1');
|
|
$pdf->SetFont('');
|
|
$pdf->Cell(15,5,'Status','1','1','L','1');
|
|
$pdf->SetFont('');
|
|
$key++;
|
|
}
|
|
|
|
//---------------------------------------
|
|
|
|
if ($_GET['icon'] ==0) { $pdf->Output('Rundschau_'.($datum).'.pdf','I'); }
|
|
if ($_GET['icon'] ==1) { $pdf->Output('Rundschau_'.($datum).'.pdf','D'); }
|
|
if ($_GET['icon'] ==2) {
|
|
|
|
if (!class_exists("phpmailer")) {
|
|
require_once('lib/phpmailer/class.phpmailer.php');
|
|
}
|
|
$empfaenger = "dispo@jb-transport.de";
|
|
$betreff="Rundschau-Einsatzplan ".($datum).".pdf";
|
|
$Dateiname = "Rundschau_".($datum).".pdf";
|
|
$DateinameMail = "Rundschau_".($datum).".pdf";
|
|
|
|
require_once('lib/phpmailer/class.phpmailer.php');
|
|
$mail = new PHPMailer();
|
|
$mail->SetLanguage('de', $mail->PluginDir . '/language/');
|
|
$mail->Body = "Rundschau-Einsatzplan fuer den ".$datum;
|
|
$mail->From = "dispo@jb-transport.de";
|
|
$mail->FromName = "dispo@jb-transport.de";
|
|
$mail->AddAddress("dispo@jb-transport.de");
|
|
$mail->Subject = $betreff;
|
|
$doc = $pdf->Output('','S');
|
|
$mail->AddStringAttachment($doc,"Rundschau_".$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
|
|
}
|
|
|
|
?>
|