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'); } $isodate = sprintf("%02d", $_GET['kw']); $timestamp_sonntag = strtotime("{$_GET['jahr']}-W{$isodate}-7"); $tag=date("d", $timestamp_sonntag); $monat=date("n", $timestamp_sonntag); $datum=$tag.".".$monat.".".$_GET['jahr']; require('lib/fpdf.php'); class PDF extends FPDF { function Footer() { $this->SetY(-15); $this->SetFont('Helvetica','',8); $this->Cell(90,4,'JB-Transport.de - Bautzner Str. 67 - 04347 Leipzig','1','0','L','1'); $this->Cell(50,4,'***** Interne Liste - NON Public *****','1','0','C','1'); $this->Cell(32,4,'F. Teichert 2011-2014','1','0','C','1'); $this->SetFont('Helvetica','B',10); $this->Cell(23,4,'Seite '.$this->PageNo().'/{nb}','1','0','R','1'); } function Header() { $this->SetFont('Helvetica','B',20); // $pdf->SetTextColor(0,160,230); $this->SetFillColor(255,255,255); $this->SetTextColor(80,80,80); $this->Cell(22,12,' ','0','1','L','1'); $this->SetFont('Helvetica','',16); $isodate = sprintf("%02d", $_GET['kw']); $timestamp_sonntag = strtotime("{$_GET['jahr']}-W{$isodate}-7"); $tag=date("d", $timestamp_sonntag); $monat=date("m", $timestamp_sonntag); $this->Cell(160,8," ",'0','0','L','1'); $this->Cell(33,8,$tag.".".$monat.".".$_GET['jahr'],'0','1','L','1'); $this->SetFont('Helvetica','BI',20); $this->Image('template/images/faz_logo_sonntag_neu.png', 8, 7); // $row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$_GET['tid']."'"); // if($row_tour['utyp']==7) { $this->Image('Image77.png', 120, 7); } //---------------- muecke // else { $this->Image('template/images/jb_logo2.png', 125, 5); $this->Write(2,"\n"); } } // blau (0,160,230) // Orange (240,150, 0) // grau (200,200,200) $pdf = new PDF('P','mm','A4'); $pdf->AliasNbPages(); // $pdf->AddPage(); $pdf->SetAutoPageBreak(false); //---------------- Übersichtsseite $pdf->AddPage(); $pdf->Write(10,"\n"); $pdf->SetFont('Helvetica','',30); $pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0); $pdf->Cell(190,2,'FAZ-Tour 4: Leipzig-Ost','0','1','C','0'); $pdf->Write(10,"\n"); $gesamt=0; $tourenliste= $GLOBALS['mysql']->query("SELECT * FROM touren WHERE typ=15 and utyp=4"); $key=0; while($row = $tourenliste->fetch_assoc()) { //---------------- Datensätz = Adressen $ds = $GLOBALS['mysql']->query_single("SELECT * FROM fazs WHERE plz='".$row['tour3']."' and kw='".$_GET['kw']."' and jahr='".$_GET['jahr']."' and abo!=0"); $adressen=$ds['num_rows']; $tme = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE kw='".$_GET['kw']."' and jahr='".$_GET['jahr']."' and tour='".$row['tour2']."'"); $pdf->SetFont('Helvetica','',14); $pdf->Write(4,"\n"); $pdf->Cell(140,6,utf8_decode($row['tour']." ".$row['infotitel']),'B','0','L','0'); //$pdf->Cell( 50,6,utf8_decode($tme['num_rows']." Exemplare"),'B','1','R','0'); if($tme['exemplare']!=$adressen) { $pdf->Cell( 15,6,utf8_decode($adressen." Adr."),'B','0','R','0'); } else { $pdf->SetTextColor(180,180,180); $pdf->Cell( 15,6,utf8_decode($adressen." Adr."),'B','0','R','0'); $pdf->SetTextColor(0,0,0); } $pdf->Cell( 35,6,utf8_decode($tme['exemplare']." Exemplare"),'B','1','R','0'); $gesamt=$gesamt+$tme['exemplare']; $gadressen=$gadressen+$adressen; } $pdf->Cell( 50,30," ",'0','1','R','0'); $pdf->Cell(140,6,utf8_decode("Gesamtmenge:"),'B','0','L','0'); //$pdf->Cell( 50,6,utf8_decode($gesamt." Exemplare"),'B','1','R','0'); $pdf->Cell( 50,6,utf8_decode($gadressen." Adressen * ".$gesamt." Exemplare"),'B','1','R','0'); //---------------- ab und zu gänge $pdf->AddPage(); $pdf->Write(3,"\n"); $pdf->SetFont('Helvetica','',20); $pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0); $pdf->Cell(190,2,utf8_decode('FAZ-Tour 4: Leipzig-Ost Abgänge/Pause/Zugänge'),'0','1','C','0'); $pdf->Write(4,"\n"); $swzahl=0; //------------- Höhe 240 $tourenliste= $GLOBALS['mysql']->query("SELECT * FROM touren WHERE typ=15 and utyp=4"); $key=0; while($row = $tourenliste->fetch_assoc()) { if($swzahl>=320) { $pdf->AddPage(); $pdf->Write(3,"\n"); $pdf->SetFont('Helvetica','',20); $pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0); $pdf->Cell(190,2,utf8_decode('FAZ-Tour 4: Leipzig-Ost Abgänge/Pause/Zugänge '),'0','1','C','0'); $pdf->Write(4,"\n"); $swzahl=0; } $pdf->SetFillColor(220,220,220); $pdf->SetFont('Helvetica','B',10); $pdf->Cell(20,5,utf8_decode($row['tour']),'T','0','L','1'); $pdf->SetFont('Helvetica','B',10); $pdf->Cell(170,5,utf8_decode("Veränderungen für: ".$row['tour']." ".$row['infotitel']),'T','1','L','1'); $pdf->SetFillColor(255,255,255); $swzahl=$swzahl+10; //--------------------------------------------- Prüfung auf Veränderung $dtest=$GLOBALS['mysql']->query_single("SELECT * FROM fazv WHERE kw='".$_GET['kw']."' and jahr='".$_GET['jahr']."' and plz='".$row['tour3']."'"); if($dtest['num_rows']!=0) { //----------- Zugänge $dtestz=$GLOBALS['mysql']->query_single("SELECT * FROM fazv WHERE kw='".$_GET['kw']."' and jahr='".$_GET['jahr']."' and plz='".$row['tour3']."' and status in (1,43,47)"); if($dtestz['num_rows']!=0) { $data=$GLOBALS['mysql']->query("SELECT * FROM fazv WHERE kw='".$_GET['kw']."' and jahr='".$_GET['jahr']."' and plz='".$row['tour3']."' and status in (1,43,47)"); $pdf->SetFont('Helvetica','B',10); $pdf->Cell( 66,5,utf8_decode("Bitte beliefern Sie ab heute: "),'0','1','L','0'); $swzahl=$swzahl+5; while($rowa = $data->fetch_assoc()) { $pdf->SetFont('Helvetica','U',10); if($rowa['status']==43) { $pdf->Cell( 40,4,utf8_decode("Neuzugang"),'0','0','L','0'); } if($rowa['status']== 1) { $pdf->Cell( 40,4,utf8_decode("Unterbrechung Ende:"),'0','0','L','0'); } if($rowa['status']==47) { $pdf->Cell( 40,4,utf8_decode("Unterbrechung Ende:"),'0','0','L','0'); } $pdf->SetFont('Helvetica','',10); $pdf->Cell(140,4,utf8_decode($rowa['titel'].$rowa['name'].", ".$rowa['name2']." - ".$rowa['strasse']." ".$rowa['hnr'].$rowa['hnrz']." - ".$rowa['plz']." ".$rowa['ort']),'0','0','L','0'); $pdf->Cell( 10,4,utf8_decode($rowa['bemerkung']),'0','1','R','0'); $swzahl=$swzahl+8; } } //-----------Abgänge $dtesta=$GLOBALS['mysql']->query_single("SELECT * FROM fazv WHERE kw='".$_GET['kw']."' and jahr='".$_GET['jahr']."' and plz='".$row['tour3']."' and status in (21,41,46)"); if($dtesta['num_rows']!=0) { $pdf->SetFont('Helvetica','B',10); $pdf->Cell( 66,5,utf8_decode("Bitte beliefern Sie ab heute nicht mehr: "),'0','1','L','0'); $swzahl=$swzahl+5; $data=$GLOBALS['mysql']->query("SELECT * FROM fazv WHERE kw='".$_GET['kw']."' and jahr='".$_GET['jahr']."' and plz='".$row['tour3']."' and status in (21,41,46)"); while($rowa = $data->fetch_assoc()) { $pdf->SetFont('Helvetica','U',10); if($rowa['status']==21) { $pdf->Cell( 40,4,utf8_decode("Kündigung"),'0','0','L','0'); } if($rowa['status']==41) { $pdf->Cell( 40,4,utf8_decode("Unterbrechung Beginn"),'0','0','L','0'); } if($rowa['status']==46) { $pdf->Cell( 40,4,utf8_decode("Unterbrechung Beginn"),'0','0','L','0'); } $pdf->SetFont('Helvetica','',10); $pdf->Cell(140,4,utf8_decode($rowa['titel'].$rowa['name'].", ".$rowa['name2']." - ".$rowa['strasse']." ".$rowa['hnr'].$rowa['hnrz']." - ".$rowa['plz']." ".$rowa['ort']),'0','0','L','0'); $pdf->Cell( 10,4,utf8_decode($rowa['bemerkung']),'0','1','R','0'); $swzahl=$swzahl+8; } } //-----------Veränderungen / Adressänderungen $dtestv=$GLOBALS['mysql']->query_single("SELECT * FROM fazv WHERE kw='".$_GET['kw']."' and jahr='".$_GET['jahr']."' and plz='".$row['tour3']."' and status in (20,52)"); if($dtestv['num_rows']!=0) { $pdf->SetFont('Helvetica','B',10); $pdf->Cell( 66,5,utf8_decode("Bitte Änderung beachten: "),'0','1','L','0'); $swzahl=$swzahl+5; $data=$GLOBALS['mysql']->query("SELECT * FROM fazv WHERE kw='".$_GET['kw']."' and jahr='".$_GET['jahr']."' and plz='".$row['tour3']."' and status in (20,52)"); while($rowa = $data->fetch_assoc()) { $pdf->SetFont('Helvetica','U',10); if($rowa['status']==52) { $pdf->Cell( 40,4,utf8_decode("Adressänderung "),'0','0','L','0'); } if($rowa['status']==20) { $pdf->Cell( 40,4,utf8_decode("Sonstige Änderung"),'0','0','L','0'); } $pdf->SetFont('Helvetica','',10); $pdf->Cell(140,4,utf8_decode($rowa['titel'].$rowa['name'].", ".$rowa['name2']." - ".$rowa['strasse']." ".$rowa['hnr'].$rowa['hnrz']." - ".$rowa['plz']." ".$rowa['ort']),'0','0','L','0'); $pdf->Cell( 10,4,utf8_decode($rowa['bemerkung']),'0','1','R','0'); $swzahl=$swzahl+8; } } } else { $pdf->SetFont('Helvetica','B',10); $pdf->Cell(190,5,utf8_decode(" keine Veränderungen gemeldet."),'0','1','L','0'); $swzahl=$swzahl+5; } $pdf->SetFont('Helvetica','B',10); $pdf->Cell(190,4,utf8_decode(" "),'0','1','L','0'); $swzahl=$swzahl+5; } /* $pdf->Cell( 40,6,utf8_decode($rowa['titel'].$rowa['name'].", ".$rowa['name2']),'0','0','L','0'); $pdf->Cell( 40,6,utf8_decode($rowa['strasse']." ".$rowa['hnr'].$rowa['hnrz']),'0','0','L','0'); $pdf->Cell( 40,6,utf8_decode($rowa['plz']." ".$rowa['ort']),'0','1','L','0'); */ //------------------------------------------------------------------------- //- faz auslesen //--------------------- $tourenlist15= $GLOBALS['mysql']->query("SELECT * FROM touren WHERE typ=15 and utyp=4"); $akey=0; while($rowplz = $tourenlist15->fetch_assoc()) { //echo'
'; print_r($rowplz); echo'
'; //---------------- neue Seite $row_tour['tour']=0; $row_tour['infotitel']=0; // $row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE tour2='".$rowplz['tour2']."'"); $pdf->AddPage(); // $pdf->AliasNbPages(); $seitennummer=1; $pdf->SetFillColor(255,255,255); $pdf->SetFont('Helvetica','',14); $tm = $GLOBALS['mysql']->query_single("SELECT * FROM fazs WHERE kw='".$_GET['kw']."' and jahr='".$_GET['jahr']."' and plz='".$rowplz['tour3']."' and abo!=0"); $pdf->Cell(140,6,utf8_decode($rowplz['tour']." ".$rowplz['infotitel']),'LTB','0','L','1'); $pdf->SetTextColor(0,0,0); $pdf->Cell( 55,6,utf8_decode($tm['num_rows']." Exemplare"),'RTB','1','R','1'); $pdf->Cell(170,2,' ','0','1','L','0'); $pdf->SetFillColor(100,100,100); $pdf->SetTextColor(255,255,255); $pdf->SetFont('Helvetica','BI',10); $pdf->Cell(90,4,"Abonnent / Adresse",'1','0','L','1'); $pdf->Cell(82,4,"Zusatzinfos/Telefonnr.",'1','0','L','1'); $pdf->Cell(8,4,"St.",'1','0','C','1'); $pdf->Cell(15,4,"Info",'1','1','C','1'); $pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0); // $a_tour = $GLOBALS['mysql']->query("SELECT * FROM faz WHERE tag=15 and monat=1 and jahr=2017 and plz='".$rowplz['tour2']."' order by strasse"); $key=0; // $mitnull="0".$rowplz['tour2']; $a_tour = $GLOBALS['mysql']->query("SELECT * FROM fazs WHERE kw='".$_GET['kw']."' and jahr='".$_GET['jahr']."' and plz='".$rowplz['tour3']."' and abo!=0 order by strasse"); $key=0; while($row = $a_tour->fetch_assoc()) { // echo'
'; print_r($row); echo'
'; //// Testprint if($key==20) { $key=0; $pdf->AddPage(); $pdf->AliasNbPages(); $pdf->SetFillColor(255,255,255); $pdf->SetFont('Helvetica','',14); $pdf->Cell(140,6,utf8_decode($rowplz['tour']." ".$rowplz['infotitel']),'LTB','0','L','1'); $pdf->SetTextColor(0,0,0); $seitennummer++; $pdf->Cell( 55,6,"Seite: ".$seitennummer,'RTB','1','R','1'); $pdf->Cell(170,2,' ','0','1','L','0'); $pdf->SetFillColor(100,100,100); $pdf->SetTextColor(255,255,255); $pdf->SetFont('Helvetica','BI',10); $pdf->Cell(90,4,"Abonnent / Adresse",'1','0','L','1'); $pdf->Cell(82,4,"Zusatzinfos/Telefonnr.",'1','0','L','1'); $pdf->Cell( 8,4,"St.",'1','0','L','1'); $pdf->Cell(15,4,"Info",'1','1','C','1'); $pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0); } $pdf->Cell(170,1.5,' ','0','1','L','0'); //--- 1. Zeile - Name und Anschrift $pdf->SetFont('Helvetica','B',10); if($row['name3']!="") { $zeile1a=$row['titel'].$row['name'].", ".$row['name2']." ".$row['name4']." -".$row['name3']; } else { $zeile1a=$row['titel'].$row['name'].", ".$row['name2']." ".$row['name4']; } $pdf->Cell(90,5,utf8_decode($zeile1a),'LT','0','L','0'); //--------- zeile 1 rechter bereich //-------------- informationen für Zusteller $i_tour = $GLOBALS['mysql']->query_single("SELECT * FROM fazinfo WHERE abonr='".$row['auftragnr']."'"); if($i_tour['num_rows'] !=0) { if($i_tour['unbekannt'] ==1) { $pdf->SetFillColor(255,0,0); $pdf->Cell(82,5,utf8_decode($i_tour['info']),'RT','0','L','1'); } else { $pdf->SetFillColor(255,255,0); $pdf->Cell(82,5,utf8_decode($i_tour['info']),'RT','0','L','1'); } } else { $pdf->Cell(82,5," ",'RT','0','L','0'); } if($row['abo'] >1) { $pdf->SetFont('Helvetica','B',10); $pdf->SetFillColor(100,100,100); $pdf->SetTextColor(255,255,255); $pdf->Cell(8,5,$row['abo']." x",'LRT','0','C','1'); $pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0); } else { $pdf->SetFont('Helvetica','',10); $pdf->Cell(8,5,$row['abo']." x",'LRT','0','C','0'); $pdf->SetFont('Helvetica','B',10); } //$pdf->Cell(80,5,utf8_decode($row['name3']),'RT','0','L','0'); //--- 1. Zeile ganz hinten - Menge und Zustellbestätigung $pdf->SetFont('Helvetica','',7); $pdf->Cell(15,5," ",'LRT','1','R','0'); $pdf->SetFont('Helvetica','B',10); //--- 2. Zeile A $zeile2b=$row['strasse']." ".$row['hnr']." ".$row['hnrz'].", ".$row['plz']." ".$row['ort']; $pdf->Cell(90,5,utf8_decode($zeile2b),'LB','0','L','0'); //--- 2. Zeile B if(strlen($row['bemerkung'])==0) { $pdf->Cell(82,5," ",'RB','0','R','0'); } else { $pdf->SetFillColor(200,200,200); $pdf->Cell(82,5,utf8_decode($row['bemerkung']),'RB','0','R','1'); $pdf->SetFillColor(255,255,255); } if($row['abo'] >1) { $pdf->SetFont('Helvetica','B',10); $pdf->SetFillColor(100,100,100); $pdf->SetTextColor(255,255,255); $pdf->Cell(8,5,"FAZ",'LRB','0','C','1'); $pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0); } else { $pdf->SetFont('Helvetica','',10); $pdf->Cell(8,5,"FAZ",'LRB','0','C','0'); $pdf->SetFont('Helvetica','B',10); } $pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0); //--- 2. Zeile hinten - Menge und Zustellbestätigung //------------------------------------------------------------------ Ablageort in hellgrau $ablage_info = $GLOBALS['mysql']->query_single("SELECT * FROM fazs WHERE auftragnr='".$row['auftragnr']."' ORDER BY ID DESC Limit 1,1"); $pdf->SetTextColor(160,160,160); $pdf->SetFont('Helvetica','',8); $pdf->Cell(15,5,utf8_decode($ablage_info['meldung']),'LRB','1','C','0'); $pdf->SetTextColor(0,0,0); $pdf->SetFont('Helvetica','',10); $key++; } //-------------------------------- //-------------------- Pause / Unterbrechung $abfrage_tour = $GLOBALS['mysql']->query_single("SELECT * FROM fazs WHERE kw='".$_GET['kw']."' and jahr='".$_GET['jahr']."' and plz='".$rowplz['tour3']."' and abo=0"); if($abfrage_tour['num_rows'] != 0) { $u_tour = $GLOBALS['mysql']->query("SELECT * FROM fazs WHERE kw='".$_GET['kw']."' and jahr='".$_GET['jahr']."' and plz='".$rowplz['tour3']."' and abo=0"); unset ($row); while($row = $u_tour->fetch_assoc()) { if($key==20) { $key=0; $pdf->AddPage(); $pdf->AliasNbPages(); $seitennummer++; $pdf->SetFillColor(255,255,255); $pdf->SetFont('Helvetica','',14); $pdf->Cell(140,6,utf8_decode($rowplz['tour']." ".$rowplz['infotitel']),'LTB','0','L','1'); $pdf->SetTextColor(0,0,0); $pdf->Cell( 50,6,"Seite: ".$seitennummer,'RTB','1','R','1'); $pdf->Cell(170,2,' ','0','1','L','0'); $pdf->SetFillColor(100,100,100); $pdf->SetTextColor(255,255,255); $pdf->SetFont('Helvetica','BI',10); $pdf->Cell(90,4,"Abonnent / Adresse",'1','0','L','1'); $pdf->Cell(82,4,"Zusatzinfos/Telefonnr.",'1','0','L','1'); $pdf->Cell(23,4,"zugestellt",'1','1','L','1'); $pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0); } $pdf->SetFont('Helvetica','B',10); $pdf->Cell(170,1.5,' ','0','1','L','0'); //--- 1. Zeile - Name und Anschrift $pdf->SetTextColor(150,150,150); $zeile1a=$row['titel'].$row['name2'].", ".$row['name']." ".$row['name4']; $pdf->Cell(90,5,utf8_decode($zeile1a),'LT','0','L','0'); $pdf->Cell(82,5,utf8_decode($row['name3']),'RT','0','L','0'); //--- 1. Zeile hinten - Menge und Zustellbestätigung $pdf->SetFont('Helvetica','',10); $pdf->Cell( 8,5,"0 x",'LRT','0','C','0'); $pdf->SetFont('Helvetica','B',10); $pdf->Cell(15,5,"xxxxxx",'LRT','1','C','0'); //--- 2. Zeile A $zeile2b=$row['strasse']." ".$row['hnr']." ".$row['hnrz'].", ".$row['plz']." ".$row['ort']; $pdf->Cell(90,5,utf8_decode($zeile2b),'LB','0','L','0'); //--- 2. Zeile B $pdf->SetTextColor(0,0,0); $pauseinfo="Pause von: ".$row['pausevon']." bis ".$row['pausebis']; $pdf->Cell(82,5,utf8_decode($pauseinfo),'RB','0','R','1'); //--- 2. Zeile hinten - Menge und Zustellbestätigung $pdf->SetTextColor(150,150,150); $pdf->SetFont('Helvetica','',10); $pdf->Cell( 8,5,"FAZ",'LRB','0','C','0'); $pdf->SetFont('Helvetica','B',10); $pdf->Cell(15,5,"xxxxxx",'LRB','1','C','0'); $pdf->SetTextColor(0,0,0); $key++; } } $akey++; } //--------------------------------------- if ($_GET['icon'] ==0) { $pdf->Output('FAZ_Adressen_Ost_'.($kw_aktuell).".kw".'.pdf','I'); } if ($_GET['icon'] ==1) { $pdf->Output('FAZ_Adressen_Ost_'.($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="FAZ_Adressen_Ost ".($kw_aktuell).".kw.pdf"; $Dateiname = "FAZ_Adressen_Ost_".($kw_aktuell).".kw.pdf"; $DateinameMail = "FAZ_Adressen_Ost_".($kw_aktuell).".kw.pdf"; require_once('lib/phpmailer/class.phpmailer.php'); $mail = new PHPMailer(); $mail->SetLanguage('de', $mail->PluginDir . '/language/'); $mail->Body = "FAZ_Adressen ".$kw_aktuell.".kw"; $mail->From = "dispo@jb-transport.de"; $mail->FromName = "dispo@jb-transport.de"; $mail->AddAddress("dispo@jb-transport.de"); $mail->AddAddress("womo16@freenet.de"); $mail->AddAddress("sieber1602@gmail.com"); $mail->Subject = $betreff; $doc = $pdf->Output('','S'); $mail->AddStringAttachment($doc,"FAZ_Adressen_Ost_".$kw_aktuell.".kw.pdf", 'base64', 'application/pdf'); //$Dateiname $mail->Send(); echo $Dateiname.' wurde versendet an: '.$empfaenger; ?>