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

175 lines
7.6 KiB
PHP

<?php
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'); }
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");
}
}
$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);
$rtag= date("d",$tmp1);
$monat=intval($_GET['monat']);
$jahr=intval($_GET['jahr']);
//------------------------------------- AG 04
$pdf = new PDF('P','mm','A4');
$pdf->AddPage();
// blau (0,160,230)
// Orange (240,150, 0)
// grau (200,200,200)
$pdf->SetFillColor(100,100,100); $pdf->SetTextColor(100,100,100); $pdf->SetFont('Helvetica','B',16);
$pdf->Cell(65,5,"AG-04 Paletten ".($monat)."/".($jahr),'0','1','L','0'); $pdf->SetTextColor(255,255,255);
$pdf->Cell(65,5," ",'0','1','L','0'); $pdf->SetTextColor(255,255,255);
//------------------------------------- Tabellenbeschreibung
$pdf->SetFont('Helvetica','BI',8);
$pdf->Cell(20,4,"Datum",'1','0','L','1');
$pdf->Cell(20,4,"Menge",'1','0','L','1');
$pdf->Cell(50,4,"Fahrer",'1','0','L','1');
$pdf->Cell(100,4,"Infotext",'1','1','L','1');
$pdf->SetTextColor(0,0,0); $pdf->SetFont('Helvetica','',10);
$summe=0;
//-------------------------------------
$pin_tour = $GLOBALS['mysql']->query("SELECT * FROM paletten WHERE monat='".$monat."' and jahr='".$jahr."' and tour=504 ORDER BY tag"); $key=0;
while($row = $pin_tour->fetch_assoc()) { //echo "<pre>"; print_r($row); echo "</pre>"; echo $rjahr;
$pdf->Cell(20,5,($row['tag']).".".($row['monat']).".".($row['jahr']),'1','0','L','0');
$pdf->Cell(20,5,($row['menge']),'1','0','R','0'); $summe=$summe+$row['menge'];
$row_fahrerx = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$row['mid']."'");
$pdf->Cell(50,5,($row_fahrerx['name']),'1','0','L','0');
$pdf->Cell(100,5,($row['info']),'1','1','L','0');
$pdf->SetFont('');
$key++;
}
$pdf->SetFillColor(200,200,200);
$pdf->Cell(20,5,"ges.: ".($row['monat']).".".($row['jahr']),'1','0','L','1');
$pdf->Cell(20,5,($summe),'1','1','R','1');
//-------------------------------------
//------------------------------------- AG 12
//$pdf = new PDF('P','mm','A4');
$pdf->AddPage();
// blau (0,160,230)
// Orange (240,150, 0)
// grau (200,200,200)
$pdf->SetFillColor(100,100,100); $pdf->SetTextColor(100,100,100); $pdf->SetFont('Helvetica','B',16);
$pdf->Cell(65,5,"AG-12 Paletten ".($monat)."/".($jahr),'0','1','L','0'); $pdf->SetTextColor(255,255,255);
$pdf->Cell(65,5," ",'0','1','L','0'); $pdf->SetTextColor(255,255,255);
//------------------------------------- Tabellenbeschreibung
$pdf->SetFont('Helvetica','BI',8);
$pdf->Cell(20,4,"Datum",'1','0','L','1');
$pdf->Cell(20,4,"Menge",'1','0','L','1');
$pdf->Cell(50,4,"Fahrer",'1','0','L','1');
$pdf->Cell(100,4,"Infotext",'1','1','L','1');
$pdf->SetTextColor(0,0,0); $pdf->SetFont('Helvetica','',10);
$summe=0;
//-------------------------------------
$pin_tour = $GLOBALS['mysql']->query("SELECT * FROM paletten WHERE monat='".$monat."' and jahr='".$jahr."' and tour=512 ORDER BY tag"); $key=0;
while($row = $pin_tour->fetch_assoc()) { //echo "<pre>"; print_r($row); echo "</pre>"; echo $rjahr;
$pdf->Cell(20,5,($row['tag']).".".($row['monat']).".".($row['jahr']),'1','0','L','0');
$pdf->Cell(20,5,($row['menge']),'1','0','R','0'); $summe=$summe+$row['menge'];
$row_fahrerx = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$row['mid']."'");
$pdf->Cell(50,5,($row_fahrerx['name']),'1','0','L','0');
$pdf->Cell(100,5,($row['info']),'1','1','L','0');
$pdf->SetFont('');
$key++;
}
$pdf->SetFillColor(200,200,200);
$pdf->Cell(20,5,"ges.: ".($row['monat']).".".($row['jahr']),'1','0','L','1');
$pdf->Cell(20,5,($summe),'1','1','R','1');
//------------------------------------- //-------------------------------------
//------------------------------------- AG 14
//$pdf = new PDF('P','mm','A4');
$pdf->AddPage();
// blau (0,160,230)
// Orange (240,150, 0)
// grau (200,200,200)
$pdf->SetFillColor(100,100,100); $pdf->SetTextColor(100,100,100); $pdf->SetFont('Helvetica','B',16);
$pdf->Cell(65,5,"AG-14 Paletten ".($monat)."/".($jahr),'0','1','L','0'); $pdf->SetTextColor(255,255,255);
$pdf->Cell(65,5," ",'0','1','L','0'); $pdf->SetTextColor(255,255,255);
//------------------------------------- Tabellenbeschreibung
$pdf->SetFont('Helvetica','BI',8);
$pdf->Cell(20,4,"Datum",'1','0','L','1');
$pdf->Cell(20,4,"Menge",'1','0','L','1');
$pdf->Cell(50,4,"Fahrer",'1','0','L','1');
$pdf->Cell(100,4,"Infotext",'1','1','L','1');
$pdf->SetTextColor(0,0,0); $pdf->SetFont('Helvetica','',10);
$summe=0;
//-------------------------------------
$pin_tour = $GLOBALS['mysql']->query("SELECT * FROM paletten WHERE monat='".$monat."' and jahr='".$jahr."' and tour=514 ORDER BY tag"); $key=0;
while($row = $pin_tour->fetch_assoc()) { //echo "<pre>"; print_r($row); echo "</pre>"; echo $rjahr;
$pdf->Cell(20,5,($row['tag']).".".($row['monat']).".".($row['jahr']),'1','0','L','0');
$pdf->Cell(20,5,($row['menge']),'1','0','R','0'); $summe=$summe+$row['menge'];
$row_fahrerx = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$row['mid']."'");
$pdf->Cell(50,5,($row_fahrerx['name']),'1','0','L','0');
$pdf->Cell(100,5,($row['info']),'1','1','L','0');
$pdf->SetFont('');
$key++;
}
$pdf->SetFillColor(200,200,200);
$pdf->Cell(20,5,"ges.: ".($row['monat']).".".($row['jahr']),'1','0','L','1');
$pdf->Cell(20,5,($summe),'1','1','R','1');
//------------------------------------- //-------------------------------------
//---------------------------------------
if ($_GET['icon'] ==0) { $pdf->Output('PIN_AG_'.($monat)." ".($jahr).'.pdf','I'); }
if ($_GET['icon'] ==1) { $pdf->Output('PIN_AG_'.($monat)." ".($jahr).'.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-Paletten ".($monat)." ".($jahr).".pdf";
$Dateiname = "PIN_PAL_".($monat)." ".($jahr).".pdf";
$DateinameMail = "PIN_PAL_".($monat)." ".($jahr).".pdf";
require_once('lib/phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->SetLanguage('de', $mail->PluginDir . '/language/');
$mail->Body = "PIN_AG-Paletten ".($monat)." ".($jahr);
$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_PAL_".($monat)." ".($monat).".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
}
?>