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

121 lines
5.6 KiB
PHP

<?php
ini_set('display_errors', 1);
$timestamp_sonntag = strtotime("{$_GET['jahr']}-W{$_GET['kw']}-7");
$tag=(int)date("d", $timestamp_sonntag);
$monat=(int)date("m", $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);
$timestamp_sonntag = strtotime("{$_GET['jahr']}-W{$_GET['kw']}-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']==91) {$this->Image('template/images/Image77.png', 120, 7); } //---------------- muecke
else { $this->Image('template/images/jb_logo2.png', 120, 7); } //----------------jb logo
$this->Write(2,"\n");
$this->SetFillColor(255,255,255); $this->SetFont('Helvetica','',14);
$this->Cell(190,6,utf8_decode($row_tour['tour']." ".$row_tour['infotitel']),'1','1','L','1');
$this->SetFillColor(100,100,100); $this->SetTextColor(255,255,255); $this->SetFont('Helvetica','BI',10);
$this->Cell(90,4,"Abonnent / Adresse",'1','0','L','1');
$this->Cell(80,4,"Zusatzinfos/Telefonnr.",'1','0','L','1');
$this->Cell(20,4,"zugestellt",'1','1','L','1');
$this->SetFillColor(255,255,255); $this->SetTextColor(0,0,0);
}
}
//$pdf=new PDF_AutoPrint(); $pdf->Open();
$pdf = new PDF('P','mm','A4');
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetAutoPageBreak(false);
// blau (0,160,230)
// Orange (240,150, 0)
// grau (200,200,200)
$key=0;
$pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0);
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$_GET['tid']."'");
$row_tour3 = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$_GET['tid']."'");
$a_tour = $GLOBALS['mysql']->query("SELECT * FROM faz WHERE tag='".$tag."' and monat='".$monat."' and jahr='".$_GET['jahr']."' and plz='".$row_tour3['tour2']."' and pause=0 and umleitung=0 order by strasse");
while($row = $a_tour->fetch_assoc()) { echo "<pre>"; print_r($row); echo "</pre>";
if($key==14) {
$key=0;
$pdf->AddPage();
}
$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
$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,"Tel.: ".$row['telefon'],'LRB','0','L','1');
$pdf->Cell(20,5,' ','LRB','1','L','1');
$key++;
}
//--------------------
$abfrage_tour = $GLOBALS['mysql']->query_single("SELECT * FROM faz WHERE tag='".$tag."' and monat='".$monat."' and jahr='".$_GET['jahr']."' and plz='".$row_tour['tour2']."' and pause=1 OR umleitung=1");
if($abfrage_tour['num_rows'] != 0) {
$u_tour = $GLOBALS['mysql']->query("SELECT * FROM faz WHERE tag='".$tag."' and monat='".$monat."' and jahr='".$_GET['jahr']."' and plz='".$row_tour3['tour2']."' and pause=1 OR umleitung=1");
unset ($row);
while($row = $u_tour->fetch_assoc()) {
if($key==14) {
$key=0;
$pdf->AddPage();
}
// echo "<pre>"; print_r($row); echo "</pre>";
$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,($row['name']),'LRT','0','L','1');
$pdf->Cell(20,5,'XXXXXXX','LRT','1','L','1');
//--- 2. Zeile
if($row['pause']>0) { $pdf->SetFont('Helvetica','B',11); $pdf->Cell(90,5,"Pause / Unterbrechung",'LR','0','L','1'); $pdf->SetFont('Helvetica','',11); }
if($row['umleitung']>0) { $pdf->SetFont('Helvetica','B',11); $pdf->Cell(90,5,"Umleitung Postfach/Urlaubsort",'LR','0','L','1'); $pdf->SetFont('Helvetica','',11); }
$pdf->Cell(80,5,utf8_decode($row['strasse']." ".$row['hnr'].$row['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".$row['plz']." ".$row['ort']."-".$row['ortsteil']),'LRB','0','L','1'); $pdf->SetFont('Helvetica','',11);
$pdf->Cell(20,5,'XXXXXXX','LRB','1','L','1');
$key++;
}
}
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('FAZ'.($row_tour3['tour2']).'_'.($datum).'.pdf','I');
?>