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

201 lines
8.6 KiB
PHP

<?php
// UTF8 erzwingen
@setlocale(LC_CTYPE, 'de_DE.utf8', 'de_DE.UTF-8', 'en_US.utf8', 'en_US.UTF-8', 'en_GB.utf8', 'en_GB.UTF-8', 'de_AT.utf8', 'de_AT.UTF-8', 'de_CH.utf8', 'de_CH.UTF-8');
if( function_exists('mb_internal_encoding') )
{
mb_internal_encoding('utf-8');
}
header('Content-type: text/html; charset=utf-8');
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'); }
$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','L','1');
$this->Cell(30,4,'F. Teichert 2011-2014','1','0','L','1');
$this->SetFont('Helvetica','B',10);
$this->Cell(20,4,'Seite '.$this->PageNo().'/{nb}',1,1,'L',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("n", $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);
//- faz auslesen
$tourenlist15= $GLOBALS['mysql']->query("SELECT * FROM touren WHERE typ=15 and aktiv>0 and aktiv<99 and utyp<99"); $akey=0;
while($rowplz = $tourenlist15->fetch_assoc()) {
//echo'<pre>'; print_r($rowplz); echo'</pre>';
//---------------- 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();
$pdf->SetFillColor(255,255,255); $pdf->SetFont('Helvetica','',14);
$pdf->Cell(190,6,$rowplz['tour']." ".utf8_decode($rowplz['infotitel']),'1','1','L','1');
$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(80,4,"Zusatzinfos/Telefonnr.",'1','0','L','1');
$pdf->Cell(20,4,"zugestellt",'1','1','L','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 faz WHERE tag='".$tag."' and monat='".$monat."' and jahr='".$_GET['jahr']."' and plz='".$rowplz['tour2']."' and pause=0 order by strasse"); $key=0;
while($row = $a_tour->fetch_assoc()) {
// echo'<pre>'; print_r($row); echo'</pre>'; //// Testprint
if($key==14) {
$key=0;
$pdf->AddPage();
$pdf->AliasNbPages();
$pdf->SetFillColor(255,255,255); $pdf->SetFont('Helvetica','',14);
$pdf->Cell(190,6,$rowplz['tour']." ".$rowplz['infotitel'],'1','1','L','1');
$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(80,4,"Zusatzinfos/Telefonnr.",'1','0','L','1');
$pdf->Cell(20,4,"zugestellt",'1','1','L','1');
$pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0);
}
$pdf->SetFont('Helvetica','B',11);
$pdf->Cell(90,2,' ','0','1','L','0');
//--- 1. Zeile
$pdf->Cell(90,5,utf8_decode($row['name']),'LRT','0','L','1'); $pdf->Cell(80,5,utf8_decode($row['name3']),'LRT','0','L','1');
if($row['abo']>1) { $pdf->Cell(20,5,$row['abo']." Exempl.",'LRT','1','L','1'); } else { $pdf->Cell(20,5,' ','LRT','1','L','1'); }
//--- 2. Zeile
if($row['hnrz']!=0) {
$pdf->Cell(90,5,utf8_decode($row['strasse']." ".$row['hnr']."-".$row['hnrz']),'LR','0','L','1'); $pdf->Cell(80,5,utf8_decode($row['bemerkung']),'LR','0','L','1');
$pdf->Cell(20,5,' ','LR','1','L','1');
} else {
$pdf->Cell(90,5,utf8_decode($row['strasse']." ".$row['hnr'].$row['hnrz']),'LR','0','L','1'); $pdf->Cell(80,5,utf8_decode($row['bemerkung']),'LR','0','L','1');
$pdf->Cell(20,5,' ','LR','1','L','1');
}
//--- 3. Zeile
$pdf->Cell(90,5,utf8_decode("0".$row['plz']." ".$row['ort']."-".$row['ortsteil']),'LRB','0','L','1');
$pdf->SetFont('Helvetica','',11); $pdf->Cell(80,5,utf8_decode("Tel.: ".$row['telefon']),'LRB','0','L','1');
$pdf->Cell(20,5,' ','LRB','1','L','1');
$key++;
}
//--------------------------------
//-------------------- Pause / Unterbrechung
$p_tour = $GLOBALS['mysql']->query("SELECT * FROM faz WHERE tag='".$tag."' and monat='".$monat."' and jahr='".$_GET['jahr']."' and plz='".$rowplz['tour2']."' and pause>0");
while($rowp = $p_tour->fetch_assoc()) {
if($key==14) {
$key=0;
$pdf->AddPage();
$pdf->AliasNbPages();
$pdf->SetFillColor(255,255,255); $pdf->SetFont('Helvetica','',14);
$pdf->Cell(190,6,utf8_decode($rowplz['tour']." ".$rowplz['infotitel']),'1','1','L','1');
$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(80,4,"Zusatzinfos/Telefonnr.",'1','0','L','1');
$pdf->Cell(20,4,"zugestellt",'1','1','L','1');
$pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0);
}
$pdf->SetFont('Helvetica','',11);
$pdf->Cell(90,2,' ','0','1','L','0');
//--- 1. Zeile
$pdf->Cell(90,5," ",'LRT','0','L','1');
$pdf->Cell(80,5,utf8_decode($rowp['name']),'LRT','0','L','1');
$pdf->Cell(20,5,'XXXXXXX','LRT','1','L','1');
//--- 2. Zeile
$pdf->SetFont('Helvetica','B',11); $pdf->Cell(90,5,"Pause / Unterbrechung",'LR','0','L','1'); $pdf->SetFont('Helvetica','',11);
if($row['hnrz']!=0) {
$pdf->Cell(80,5,utf8_decode($rowp['strasse']." ".$rowp['hnr']."-".$rowp['hnrz']),'LR','0','L','1');
} else {
$pdf->Cell(80,5,utf8_decode($rowp['strasse']." ".$rowp['hnr'].$rowp['hnrz']),'LR','0','L','1');
}
$pdf->Cell(20,5,'XXXXXXX','LR','1','L','1');
//--- 3. Zeile
$pdf->Cell(90,5," ",'LRB','0','L','1');
$pdf->Cell(80,5,utf8_decode("0".$rowp['plz']." ".$rowp['ort']."-".$rowp['ortsteil']),'LRB','0','L','1'); $pdf->SetFont('Helvetica','',11);
$pdf->Cell(20,5,'XXXXXXX','LRB','1','L','1');
$key++;
}
$akey++;
}
//---------------------------------------
if ($_GET['icon'] ==0) { $pdf->Output('FAZ_Adressen_'.($kw_aktuell).".kw".'.pdf','I'); }
if ($_GET['icon'] ==1) { $pdf->Output('FAZ_Adressen_'.($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 ".($kw_aktuell).".kw.pdf";
$Dateiname = "FAZ_Adressen_".($kw_aktuell).".kw.pdf";
$DateinameMail = "FAZ_Adressen_".($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_".$kw_aktuell.".kw.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
}
?>