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'); } require('lib/fpdf.php'); class PDF extends FPDF { function Footer() { $this->SetTextColor(255,255,255); $this->SetFillColor(100,100,100); $this->SetY(-15); $this->SetFont('Helvetica','I',6); $this->Cell(190,3,'JB-Transport.de - Bautzner Str. 67 - 04347 Leipzig ***** Interne Liste - NON Public ***** F. Teichert 2011-2014','1','0','C','1'); } function Header() { $this->SetFont('Helvetica','B',20); // $pdf->SetTextColor(0,160,230); $this->Image('template/images/logo-lvz-post-2014.jpg', 10, 7); $this->SetFont('Helvetica','BI',20); $this->Image('template/images/jb_logo2.png', 125, 7); $this->Write(16,"\n"); } } $pdf = new PDF('P','mm','A4'); $pdf->AddPage(); // blau (0,160,230) // Orange (240,150, 0) // grau (200,200,200) $offset = date('w', mktime(0,0,0,1,1,$_GET['jahr'])); $offset = ($offset < 5) ? 1-$offset : 8-$offset; $monday = mktime(0,0,0,1,1+$offset,$_GET['jahr']); $monday = mktime(0,0,0,1,1+$offset,$_GET['jahr']); $tmp1=strtotime('+' . ($_GET['kw'] - 1) .'weeks', $monday); $tagx[0] = date("d.m.Y",$tmp1); $tmp2=strtotime("+1 day", $tmp1); $tagx[1] = date("d.m.Y",$tmp2); $tmp3=strtotime("+1 day", $tmp2); $tagx[2] = date("d.m.Y",$tmp3); $tmp4=strtotime("+1 day", $tmp3); $tagx[3] = date("d.m.Y",$tmp4); $tmp5=strtotime("+1 day", $tmp4); $tagx[4] = date("d.m.Y",$tmp5); $tmp6=strtotime("+1 day", $tmp5); $tagx[5] = date("d.m.Y",$tmp6); $tmp7=strtotime("+1 day", $tmp6); $tagx[6] = date("d.m.Y",$tmp7); $pdf->SetTextColor(8,88,161); $pdf->SetFont('Helvetica','B',16); $infodatum=$_GET['kw'].". Kalenderwoche $wochen ( $tagx[0] - $tagx[6] )"; $pdf->Cell(80,6,'Leipzig Post "AG-Tour"','0','0','L','0'); $pdf->SetTextColor(0,0,0); $pdf->SetFont('Helvetica','BI',12); $pdf->Cell(110,5,$infodatum,'0','1','R','0'); //---------------------------------------------------------------------------------------------------------------- Montag $rtag= date("d",$tmp1); $rmonat=date("m",$tmp1); $rjahr= date("Y",$tmp1); $pdf->Write(2,"\n"); $pdf->SetFillColor(100,100,100); $pdf->SetTextColor(100,100,100); $pdf->SetFont('Helvetica','B',12); $pdf->Cell(65,5,"Montag den ".($tagx[0]),'0','1','L','0'); $pdf->SetTextColor(255,255,255); $zahl=0; $key=0; //------------------------------------- Tabellenbeschreibung $pdf->SetFont('Helvetica','BI',8); $pdf->Cell(20,4,"Tour",'1','0','L','1'); $pdf->Cell(20,4,"Startzeit",'1','0','L','1'); $pdf->Cell(45,4,"Fahrer",'1','0','L','1'); $pdf->Cell(25,4,"Fahrzeug",'1','0','L','1'); $pdf->Cell(65,4,"Infotext",'1','0','L','1'); $pdf->Cell(15,4,"SMS",'1','1','L','1'); $pdf->SetTextColor(0,0,0); $pdf->SetFont('Helvetica','',10); //------------------------------------- $pin_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE tag='".$rtag."' and monat='".$rmonat."' and jahr='".$rjahr."' and typ=5"); while($row = $pin_tour->fetch_assoc()) { $row_touren = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'"); $pdf->Cell(20,5,($row_touren['tour']),'1','0','R','0'); $pdf->Cell(20,5,($row['zeit']." Uhr"),'1','0','R','0'); $stamma=$row_touren['s_auto']; $stammf=$row_touren['s_fahrer']; $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','0'); $pdf->SetFont('Helvetica','',10); if ($row['gewicht']>1799) $pdf->SetFont('Helvetica','BI',10); $pdf->SetFont('Helvetica','',10); $row_autox = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'"); if($stamma != $row['auto']) $pdf->SetFont('Helvetica','BI',10); $pdf->Cell(25,5,($row_autox['kz']),'1','0','L','0'); $pdf->SetFont(''); $pdf->Cell(65,5,($row['infotext']),'1','0','L','0'); $pdf->Cell(15,5,($row['smsid']),'1','1','L','0'); $pdf->SetFont(''); $key++; } //---------------------------------------------------------------------------------------------------------------- Dienstag $rtag= date("d",$tmp2); $rmonat=date("m",$tmp2); $rjahr= date("Y",$tmp2); $pdf->Write(2,"\n"); $pdf->SetFillColor(100,100,100); $pdf->SetTextColor(100,100,100); $pdf->SetFont('Helvetica','B',12); $pdf->Cell(65,5,"Dienstag den ".($tagx[1]),'0','1','L','0'); $pdf->SetTextColor(255,255,255); $zahl=0; $key=0; //------------------------------------- Tabellenbeschreibung $pdf->SetFont('Helvetica','BI',8); $pdf->Cell(20,4,"Tour",'1','0','L','1'); $pdf->Cell(20,4,"Startzeit",'1','0','L','1'); $pdf->Cell(45,4,"Fahrer",'1','0','L','1'); $pdf->Cell(25,4,"Fahrzeug",'1','0','L','1'); $pdf->Cell(65,4,"Infotext",'1','0','L','1'); $pdf->Cell(15,4,"SMS",'1','1','L','1'); $pdf->SetTextColor(0,0,0); $pdf->SetFont('Helvetica','',10); //------------------------------------- $pin_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE tag='".$rtag."' and monat='".$rmonat."' and jahr='".$rjahr."' and typ=5"); while($row = $pin_tour->fetch_assoc()) { $row_touren = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'"); $pdf->Cell(20,5,($row_touren['tour']),'1','0','R','0'); $pdf->Cell(20,5,($row['zeit']." Uhr"),'1','0','R','0'); $stamma=$row_touren['s_auto']; $stammf=$row_touren['s_fahrer']; $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','0'); $pdf->SetFont(''); if ($row['gewicht']>1799) $pdf->SetFont('Helvetica','BI',10); $pdf->SetFont('Helvetica','',10); $row_autox = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'"); if($stamma != $row['auto']) $pdf->SetFont('Helvetica','BI',10); $pdf->Cell(25,5,($row_autox['kz']),'1','0','L','0'); $pdf->SetFont('Helvetica','',10); $pdf->Cell(65,5,($row['infotext']),'1','0','L','0'); $pdf->Cell(15,5,($row['smsid']),'1','1','L','0'); $pdf->SetFont(''); $key++; } //---------------------------------------------------------------------------------------------------------------- Mittwoch $rtag= date("d",$tmp3); $rmonat=date("m",$tmp3); $rjahr= date("Y",$tmp3); $pdf->Write(2,"\n"); $pdf->SetFillColor(100,100,100); $pdf->SetTextColor(100,100,100); $pdf->SetFont('Helvetica','B',12); $pdf->Cell(65,5,"Mittwoch den ".($tagx[2]),'0','1','L','0'); $pdf->SetTextColor(255,255,255); $zahl=0; $key=0; //------------------------------------- Tabellenbeschreibung $pdf->SetFont('Helvetica','BI',8); $pdf->Cell(20,4,"Tour",'1','0','L','1'); $pdf->Cell(20,4,"Startzeit",'1','0','L','1'); $pdf->Cell(45,4,"Fahrer",'1','0','L','1'); $pdf->Cell(25,4,"Fahrzeug",'1','0','L','1'); $pdf->Cell(65,4,"Infotext",'1','0','L','1'); $pdf->Cell(15,4,"SMS",'1','1','L','1'); $pdf->SetTextColor(0,0,0); $pdf->SetFont('Helvetica','',10); //------------------------------------- $pin_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE tag='".$rtag."' and monat='".$rmonat."' and jahr='".$rjahr."' and typ=5"); while($row = $pin_tour->fetch_assoc()) { $row_touren = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'"); $pdf->Cell(20,5,($row_touren['tour']),'1','0','R','0'); $pdf->Cell(20,5,($row['zeit']." Uhr"),'1','0','R','0'); $stamma=$row_touren['s_auto']; $stammf=$row_touren['s_fahrer']; $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','0'); $pdf->SetFont('Helvetica','',10); if ($row['gewicht']>1799) $pdf->SetFont('Helvetica','BI',10); $pdf->SetFont('Helvetica','',10); $row_autox = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'"); if($stamma != $row['auto']) $pdf->SetFont('Helvetica','BI',10); $pdf->Cell(25,5,($row_autox['kz']),'1','0','L','0'); $pdf->SetFont(''); $pdf->Cell(65,5,($row['infotext']),'1','0','L','0'); $pdf->Cell(15,5,($row['smsid']),'1','1','L','0'); $pdf->SetFont(''); $key++; } //---------------------------------------------------------------------------------------------------------------- Donnerstag $rtag= date("d",$tmp4); $rmonat=date("m",$tmp4); $rjahr= date("Y",$tmp4); $pdf->Write(2,"\n"); $pdf->SetFillColor(100,100,100); $pdf->SetTextColor(100,100,100); $pdf->SetFont('Helvetica','B',12); $pdf->Cell(65,5,"Donnerstag den ".($tagx[3]),'0','1','L','0'); $pdf->SetTextColor(255,255,255); $zahl=0; $key=0; //------------------------------------- Tabellenbeschreibung $pdf->SetFont('Helvetica','BI',8); $pdf->Cell(20,4,"Tour",'1','0','L','1'); $pdf->Cell(20,4,"Startzeit",'1','0','L','1'); $pdf->Cell(45,4,"Fahrer",'1','0','L','1'); $pdf->Cell(25,4,"Fahrzeug",'1','0','L','1'); $pdf->Cell(65,4,"Infotext",'1','0','L','1'); $pdf->Cell(15,4,"SMS",'1','1','L','1'); $pdf->SetTextColor(0,0,0); $pdf->SetFont('Helvetica','',10); //------------------------------------- $pin_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE tag='".$rtag."' and monat='".$rmonat."' and jahr='".$rjahr."' and typ=5"); while($row = $pin_tour->fetch_assoc()) { $row_touren = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'"); $pdf->Cell(20,5,($row_touren['tour']),'1','0','R','0'); $pdf->Cell(20,5,($row['zeit']." Uhr"),'1','0','R','0'); $stamma=$row_touren['s_auto']; $stammf=$row_touren['s_fahrer']; $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','0'); $pdf->SetFont('Helvetica','',10); if ($row['gewicht']>1799) $pdf->SetFont('Helvetica','BI',10); $pdf->SetFont('Helvetica','',10); $row_autox = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'"); if($stamma != $row['auto']) $pdf->SetFont('Helvetica','BI',10); $pdf->Cell(25,5,($row_autox['kz']),'1','0','L','0'); $pdf->SetFont(''); $pdf->Cell(65,5,($row['infotext']),'1','0','L','0'); $pdf->Cell(15,5,($row['smsid']),'1','1','L','0'); $pdf->SetFont(''); $key++; } //---------------------------------------------------------------------------------------------------------------- Freitag $rtag= date("d",$tmp5); $rmonat=date("m",$tmp5); $rjahr= date("Y",$tmp5); $pdf->Write(2,"\n"); $pdf->SetFillColor(100,100,100); $pdf->SetTextColor(100,100,100); $pdf->SetFont('Helvetica','B',12); $pdf->Cell(65,5,"Freitag den ".($tagx[4]),'0','1','L','0'); $pdf->SetTextColor(255,255,255); $zahl=0; $key=0; //------------------------------------- Tabellenbeschreibung $pdf->SetFont('Helvetica','BI',8); $pdf->Cell(20,4,"Tour",'1','0','L','1'); $pdf->Cell(20,4,"Startzeit",'1','0','L','1'); $pdf->Cell(45,4,"Fahrer",'1','0','L','1'); $pdf->Cell(25,4,"Fahrzeug",'1','0','L','1'); $pdf->Cell(65,4,"Infotext",'1','0','L','1'); $pdf->Cell(15,4,"SMS",'1','1','L','1'); $pdf->SetTextColor(0,0,0); $pdf->SetFont('Helvetica','',10); //------------------------------------- $pin_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE tag='".$rtag."' and monat='".$rmonat."' and jahr='".$rjahr."' and typ=5"); while($row = $pin_tour->fetch_assoc()) { $row_touren = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'"); $pdf->Cell(20,5,($row_touren['tour']),'1','0','R','0'); $pdf->Cell(20,5,($row['zeit']." Uhr"),'1','0','R','0'); $stamma=$row_touren['s_auto']; $stammf=$row_touren['s_fahrer']; $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','0'); $pdf->SetFont('Helvetica','',10); if ($row['gewicht']>1799) $pdf->SetFont('Helvetica','BI',10); $pdf->SetFont('Helvetica','',10); $row_autox = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'"); if($stamma != $row['auto']) $pdf->SetFont('Helvetica','BI',10); $pdf->Cell(25,5,($row_autox['kz']),'1','0','L','0'); $pdf->SetFont(''); $pdf->Cell(65,5,($row['infotext']),'1','0','L','0'); $pdf->Cell(15,5,($row['smsid']),'1','1','L','0'); $pdf->SetFont(''); $key++; } //--------------------------------------- //---------------------------------------------------------------------------------------------------------------- Samstag $rtag= date("d",$tmp6); $rmonat=date("m",$tmp6); $rjahr= date("Y",$tmp6); $pdf->Write(2,"\n"); $pdf->SetFillColor(100,100,100); $pdf->SetTextColor(100,100,100); $pdf->SetFont('Helvetica','B',12); $pdf->Cell(65,5,"Samstag den ".($tagx[5]),'0','1','L','0'); $pdf->SetTextColor(255,255,255); $zahl=0; $key=0; //------------------------------------- Tabellenbeschreibung $pdf->SetFont('Helvetica','BI',8); $pdf->Cell(20,4,"Tour",'1','0','L','1'); $pdf->Cell(20,4,"Startzeit",'1','0','L','1'); $pdf->Cell(45,4,"Fahrer",'1','0','L','1'); $pdf->Cell(25,4,"Fahrzeug",'1','0','L','1'); $pdf->Cell(65,4,"Infotext",'1','0','L','1'); $pdf->Cell(15,4,"SMS",'1','1','L','1'); $pdf->SetTextColor(0,0,0); $pdf->SetFont('Helvetica','',10); //------------------------------------- $pin_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE tag='".$rtag."' and monat='".$rmonat."' and jahr='".$rjahr."' and typ=5"); while($row = $pin_tour->fetch_assoc()) { $row_touren = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'"); $pdf->Cell(20,5,($row_touren['tour']),'1','0','R','0'); $pdf->Cell(20,5,($row['zeit']." Uhr"),'1','0','R','0'); $stamma=$row_touren['s_auto']; $stammf=$row_touren['s_fahrer']; $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','0'); $pdf->SetFont('Helvetica','',10); if ($row['gewicht']>1799) $pdf->SetFont('Helvetica','BI',10); $pdf->SetFont('Helvetica','',10); $row_autox = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'"); if($stamma != $row['auto']) $pdf->SetFont('Helvetica','BI',10); $pdf->Cell(25,5,($row_autox['kz']),'1','0','L','0'); $pdf->SetFont(''); $pdf->Cell(65,5,($row['infotext']),'1','0','L','0'); $pdf->Cell(15,5,($row['smsid']),'1','1','L','0'); $pdf->SetFont(''); $key++; } //--------------------------------------- if ($_GET['icon'] ==0) { $pdf->Output('PIN_AG_'.($kw_aktuell).".kw".'.pdf','I'); } if ($_GET['icon'] ==1) { $pdf->Output('PIN_AG_'.($kw_aktuell).".kw".'.pdf','D'); } if ($_GET['icon'] ==2) { if (!class_exists("phpmailer")) { require_once('lib/phpmailer/class.phpmailer.php'); } $empfaenger = "dispo@jb-transport.de"; $betreff="PIN_AG-Einsatzplan ".($kw_aktuell).".kw.pdf"; $Dateiname = "PIN_AG_".($kw_aktuell).".kw.pdf"; $DateinameMail = "PIN_AG_".($kw_aktuell).".kw.pdf"; require_once('lib/phpmailer/class.phpmailer.php'); $mail = new PHPMailer(); $mail->SetLanguage('de', $mail->PluginDir . '/language/'); $mail->Body = "PIN_AG-Einsatzplan ".$kw_aktuell.".kw"; $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,"PIN_AG_".$kw_aktuell.".kw.pdf", 'base64', 'application/pdf'); //$Dateiname $mail->Send(); echo $Dateiname.' wurde versendet an: '.$empfaenger; ?>