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

92 lines
No EOL
3.5 KiB
PHP

<?php
require('lib/fpdf.php');
error_reporting(E_ALL);
error_reporting(0);
$isodate = sprintf("%02d", $_GET['kw']);
$temp = strtotime("{$_GET['jahr']}-W{$isodate}-7");
$stag=(int)date('d', $temp);
$smonat=(int)date('m', $temp);
$sjahr=(int)date('y', $temp);
$sasodatum=$stag.".".$smonat.".".$sjahr;
// echo "<pre>"; print_r($saso_tour); echo "</pre>";
//----------------------------
class PDF extends FPDF {
function Header() {
$isodate = sprintf("%02d", $_GET['kw']);
$temp = strtotime("{$_GET['jahr']}-W{$isodate}-7");
$stag=(int)date('d', $temp);
$smonat=(int)date('m', $temp);
$sjahr=(int)date('y', $temp);
$sasodatum=$stag.".".$smonat.".".$sjahr;
// $this->SetY(-15);
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$_GET['tour']."'");
$tour_info = $GLOBALS['mysql']->query_single("SELECT * FROM tourenplan WHERE tag='".$stag."' and monat='".$smonat."' and jahr='".$sjahr."' and tour='".$_GET['tour']."'");
$this->Image('template/images/saso.png',70, 5);
$this->Image('template/images/jb_logo2.png', 125, 7);
$this->SetFont('Helvetica','B',32);
$this->Cell(24,8,($row_tour['tour']),'0','1','L','0');
$this->SetFont('Helvetica','B',16);
$this->Cell(24,8,($stag.".".$smonat.".20".$sjahr." - Norm: ".$tour_info['norm']),'0','0','L','0');
// tour_info
$this->Write(20,"\n");
}
function Footer() {
$this->SetY(-15);
$this->SetFont('Helvetica','I',8);
$this->Cell(190,5,'Zustellservice Heinicke GmbH - Handelsplatz 4 - 04319 Leipzig *** ZSH - interne Liste - Nach Gebrauch vernichten *** F. T.2014','1','0','C','0');
}
}
$pdf = new PDF('P','mm','A4');
$pdf->AddPage();
// blau (0,160,230)
// Orange (240,150, 0)
// grau (200,200,200)
//---------- Kopf ---------------------
//$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',16);
// $pdf->SetFillColor(0,0,140);
// $pdf->SetTextColor(240,150,0);
//$pdf->Cell(110,8,"Sachsen-Sonntag",'1','0','C','1');
$pdf->SetFillColor(80,80,80); $pdf->SetTextColor(255,255,255); $pdf->SetFont('Helvetica','B',10);
$pdf->Cell(120,6,("Anlieferung / Adresse"),'0','0','L','1');
$pdf->Cell(60,6,("Vollpakete-Spitze / Typ"),'0','1','R','1');
$pdf->Cell(60,2,(" "),'0','1','R','0');
$key=0; $abl=0;
$saso_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenplan WHERE tag='".$stag."' and monat='".$smonat."' and jahr='".$sjahr."' and tour='".$_GET['tour']."'");
while($row = $saso_tour->fetch_assoc()) {
//echo "<pre>"; print_r($row); echo "</pre>";
$pdf->SetFont('Helvetica','B',14);
$pdf->SetTextColor(0,0,0);
$pdf->SetFillColor(255,255,255);
$vp=floor($row['exemplare']/$row['norm']);
$spitze=$row['exemplare']-($vp*$row['norm']);
$pdf->SetFont('Helvetica','B',14); $pdf->Cell(120,6,($row['adresse']),'0','0','L','1');
$pdf->Cell(45,6,($vp." -"),'0','0','R','1');
$pdf->Cell(7,6,($spitze),'0','0','R','1');
$pdf->Cell(8,6,($row['typ']),'0','1','R','1');
$pdf->SetFont('Helvetica','B',10); $pdf->Cell(120,6,($row['info']),'B','0','L','1');
$pdf->SetFont('Helvetica','',10); $pdf->Cell(60,6,("Bereich: ".$row['bereich']),'B','1','R','1');
$pdf->Cell(24,2,' ','0','1','L','0');
$key++;
}
$pdf->Output('Einsatzplan_Nachts_'.($vdatum).'.pdf','I');
?>