316 lines
14 KiB
PHP
316 lines
14 KiB
PHP
<?php
|
|
|
|
|
|
//echo "<pre>"; print_r($tour_check); echo "</pre>";
|
|
|
|
// 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'); }
|
|
|
|
|
|
require('lib/fpdf.php');
|
|
|
|
class PDF extends FPDF {
|
|
function Footer() {
|
|
$this->SetY(-15);
|
|
$this->SetFont('Helvetica','I',6);
|
|
$this->Cell(193,3,utf8_decode('JB-Transport.de - Bautzner Str. 67 - 04347 Leipzig ***** Interne Liste - NON Public ***** F. Teichert ©2020'),'1','0','C','1');
|
|
}
|
|
}
|
|
$pdf = new PDF('P','mm','A4');
|
|
$pdf->AddPage();
|
|
// blau (0,160,230)
|
|
// Orange (240,150, 0)
|
|
// grau (200,200,200)
|
|
|
|
$pdf->SetFont('Helvetica','B',20);
|
|
// $pdf->SetTextColor(0,160,230);
|
|
$pdf->SetFillColor(240,150,0);
|
|
$pdf->Image('template/images/jb_logo2.png', 10, 7);
|
|
$pdf->Image('template/images/faz_logo_sonntag_neu.png', 95, 3);
|
|
$pdf->Write(16,"\n");
|
|
|
|
//---------------------------------------- FAZ WEST TYP 1 -------------------------------------------------------------
|
|
$faztest_tour = $GLOBALS['mysql']->query("SELECT * FROM touren WHERE typ=15 and utyp=1"); $menge=0; $gmenge=0;
|
|
while($row = $faztest_tour->fetch_assoc()) {
|
|
$testa = $GLOBALS['mysql']->query("SELECT * FROM fazs WHERE plz='".$row['tour3']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
while($rowf = $testa->fetch_assoc()) {
|
|
$menge=$menge+$rowf['abo'];
|
|
}
|
|
}
|
|
$gmenge=$gmenge+$menge; // zusammenrechnen aller Touren
|
|
$pdf->SetFont('Helvetica','BI',14); $pdf->SetFillColor(240,150,0); $pdf->SetTextColor(0,0,140); unset ($tour_check);
|
|
$tour_check = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."' and typ=15 and utyp=1");
|
|
|
|
if($tour_check['num_rows'] != 0) {
|
|
$pdf->Cell(130,7,"FAZ Leipzig West am ".$tour_check['tag'].".".$tour_check['monat'].".".$tour_check['jahr']." ( ".$kw_aktuell.".KW )",'1','0','L','1');
|
|
$pdf->SetTextColor(0,0,140);
|
|
$pdf->Cell(63,7,$menge.' Exemplare','1','0','R','0');
|
|
$pdf->Write(4,"\n\n");
|
|
//--------------------------------- Tabellenkopf
|
|
$pdf->SetFillColor(100,100,100);
|
|
$pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->SetTextColor(255,255,255);
|
|
$pdf->Cell(22,5,"Tour",'1','0','L','1');
|
|
$pdf->Cell(70,5,"Bezeichnung",'1','0','L','1');
|
|
$pdf->Cell(30,5,"Exemplare",'1','0','L','1');
|
|
$pdf->Cell(40,5,"Fahrer",'1','0','L','1');
|
|
$pdf->Cell(22,5,"Fahrzeug",'1','0','L','1');
|
|
$pdf->Cell(9,5,"SMS",'1','1','C','1');
|
|
$pdf->Write(2,"\n");
|
|
$pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0);
|
|
$pdf->SetFont('');
|
|
$key=0;
|
|
$rs_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."' and typ=15 and utyp=1");
|
|
while($row = $rs_tour->fetch_assoc()) {
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
|
|
$stamma=$row_tour['s_auto']; $stammf=$row_tour['s_fahrer'];
|
|
|
|
$pdf->Cell(22,5,utf8_decode($row_tour['tour']),'1','0','L','1');
|
|
$pdf->Cell(70,5,utf8_decode($row_tour['infotitel']),'1','0','L','1');
|
|
$pdf->Cell(30,5,($row['exemplare']." Exemplare"),'1','0','R','1');
|
|
|
|
$row_fahrerx = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$row['fahrer']."'");
|
|
if ($stammf != $row['fahrer']) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(40,5,utf8_decode($row_fahrerx['name']),'1','0','L','1');
|
|
$pdf->SetFont('');
|
|
|
|
|
|
|
|
$row_autox = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'");
|
|
if($stamma != $row['auto']) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(22,5,($row_autox['kz']),'1','0','L','1');
|
|
$pdf->SetFont('');
|
|
if($row['smsid']>0) { $pdf->Cell(9,5,'OK','1','1','L','1'); }
|
|
else {$pdf->Cell(9,5,'---','1','1','L','1'); }
|
|
$pdf->SetFont('');
|
|
$key++;
|
|
}
|
|
}
|
|
$pdf->Write(2,"\n\n");
|
|
//---------------------------------------- FAZ Nord TYP 2 -------------------------------------------------------------
|
|
$faztest_tour = $GLOBALS['mysql']->query("SELECT * FROM touren WHERE typ=15 and utyp=2"); $menge=0;
|
|
while($row = $faztest_tour->fetch_assoc()) {
|
|
$testa = $GLOBALS['mysql']->query("SELECT * FROM fazs WHERE plz='".$row['tour3']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
while($rowf = $testa->fetch_assoc()) {
|
|
$menge=$menge+$rowf['abo'];
|
|
}
|
|
}
|
|
$gmenge=$gmenge+$menge; // zusammenrechnen aller Touren
|
|
$pdf->SetFont('Helvetica','BI',14); $pdf->SetFillColor(240,150,0); $pdf->SetTextColor(0,0,140); unset ($tour_check);
|
|
$tour_check = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."' and typ=15 and utyp=2");
|
|
|
|
if($tour_check['num_rows'] != 0) {
|
|
$pdf->Cell(130,7,"FAZ Leipzig Nord am ".$tour_check['tag'].".".$tour_check['monat'].".".$tour_check['jahr']." ( ".$kw_aktuell.".KW )",'1','0','L','1');
|
|
$pdf->SetTextColor(0,0,140);
|
|
$pdf->Cell(63,7,$menge.' Exemplare','1','0','R','0');
|
|
$pdf->Write(4,"\n\n");
|
|
//--------------------------------- Tabellenkopf
|
|
$pdf->SetFillColor(100,100,100);
|
|
$pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->SetTextColor(255,255,255);
|
|
$pdf->Cell(22,5,"Tour",'1','0','L','1');
|
|
$pdf->Cell(70,5,"Bezeichnung",'1','0','L','1');
|
|
$pdf->Cell(30,5,"Exemplare",'1','0','L','1');
|
|
$pdf->Cell(40,5,"Fahrer",'1','0','L','1');
|
|
$pdf->Cell(22,5,"Fahrzeug",'1','0','L','1');
|
|
$pdf->Cell(9,5,"SMS",'1','1','C','1');
|
|
$pdf->Write(2,"\n");
|
|
$pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0);
|
|
$pdf->SetFont('');
|
|
$key=0;
|
|
$rs_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."' and typ=15 and utyp=2");
|
|
while($row = $rs_tour->fetch_assoc()) {
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
|
|
$stamma=$row_tour['s_auto']; $stammf=$row_tour['s_fahrer'];
|
|
|
|
$pdf->Cell(22,5,utf8_decode($row_tour['tour']),'1','0','L','1');
|
|
$pdf->Cell(70,5,utf8_decode($row_tour['infotitel']),'1','0','L','1');
|
|
$pdf->Cell(30,5,($row['exemplare']." Exemplare"),'1','0','R','1');
|
|
|
|
$row_fahrerx = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$row['fahrer']."'");
|
|
if ($stammf != $row['fahrer']) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(40,5,utf8_decode($row_fahrerx['name']),'1','0','L','1');
|
|
$pdf->SetFont('');
|
|
|
|
|
|
|
|
$row_autox = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'");
|
|
if($stamma != $row['auto']) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(22,5,($row_autox['kz']),'1','0','L','1');
|
|
$pdf->SetFont('');
|
|
if($row['smsid']>0) { $pdf->Cell(9,5,'OK','1','1','L','1'); }
|
|
else {$pdf->Cell(9,5,'---','1','1','L','1'); }
|
|
$pdf->SetFont('');
|
|
$key++;
|
|
}
|
|
}
|
|
$pdf->Write(2,"\n\n");
|
|
//---------------------------------------- FAZ Süd TYP 3 -------------------------------------------------------------
|
|
$faztest_tour = $GLOBALS['mysql']->query("SELECT * FROM touren WHERE typ=15 and utyp=3"); $menge=0;
|
|
while($row = $faztest_tour->fetch_assoc()) {
|
|
$testa = $GLOBALS['mysql']->query("SELECT * FROM fazs WHERE plz='".$row['tour3']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
while($rowf = $testa->fetch_assoc()) {
|
|
$menge=$menge+$rowf['abo'];
|
|
}
|
|
}
|
|
$gmenge=$gmenge+$menge; // zusammenrechnen aller Touren
|
|
$pdf->SetFont('Helvetica','BI',14); $pdf->SetFillColor(240,150,0); $pdf->SetTextColor(0,0,140); unset ($tour_check);
|
|
$tour_check = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."' and typ=15 and utyp=3");
|
|
|
|
if($tour_check['num_rows'] != 0) {
|
|
$pdf->Cell(130,7,utf8_decode("FAZ Leipzig Süd am ".$tour_check['tag'].".".$tour_check['monat'].".".$tour_check['jahr']." ( ".$kw_aktuell.".KW )"),'1','0','L','1');
|
|
$pdf->SetTextColor(0,0,140);
|
|
$pdf->Cell(63,7,$menge.' Exemplare','1','0','R','0');
|
|
$pdf->Write(4,"\n\n");
|
|
//--------------------------------- Tabellenkopf
|
|
$pdf->SetFillColor(100,100,100);
|
|
$pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->SetTextColor(255,255,255);
|
|
$pdf->Cell(22,5,"Tour",'1','0','L','1');
|
|
$pdf->Cell(70,5,"Bezeichnung",'1','0','L','1');
|
|
$pdf->Cell(30,5,"Exemplare",'1','0','L','1');
|
|
$pdf->Cell(40,5,"Fahrer",'1','0','L','1');
|
|
$pdf->Cell(22,5,"Fahrzeug",'1','0','L','1');
|
|
$pdf->Cell(9,5,"SMS",'1','1','C','1');
|
|
$pdf->Write(2,"\n");
|
|
$pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0);
|
|
$pdf->SetFont('');
|
|
$key=0;
|
|
$rs_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."' and typ=15 and utyp=3");
|
|
while($row = $rs_tour->fetch_assoc()) {
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
|
|
$stamma=$row_tour['s_auto']; $stammf=$row_tour['s_fahrer'];
|
|
|
|
$pdf->Cell(22,5,utf8_decode($row_tour['tour']),'1','0','L','1');
|
|
$pdf->Cell(70,5,utf8_decode($row_tour['infotitel']),'1','0','L','1');
|
|
$pdf->Cell(30,5,($row['exemplare']." Exemplare"),'1','0','R','1');
|
|
|
|
$row_fahrerx = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$row['fahrer']."'");
|
|
if ($stammf != $row['fahrer']) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(40,5,utf8_decode($row_fahrerx['name']),'1','0','L','1');
|
|
$pdf->SetFont('');
|
|
|
|
|
|
|
|
$row_autox = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'");
|
|
if($stamma != $row['auto']) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(22,5,($row_autox['kz']),'1','0','L','1');
|
|
$pdf->SetFont('');
|
|
if($row['smsid']>0) { $pdf->Cell(9,5,'OK','1','1','L','1'); }
|
|
else {$pdf->Cell(9,5,'---','1','1','L','1'); }
|
|
$pdf->SetFont('');
|
|
$key++;
|
|
}
|
|
}
|
|
|
|
$pdf->Write(2,"\n\n");
|
|
//---------------------------------------- FAZ Ost TYP 4 -------------------------------------------------------------
|
|
$faztest_tour = $GLOBALS['mysql']->query("SELECT * FROM touren WHERE typ=15 and utyp=4"); $menge=0;
|
|
while($row = $faztest_tour->fetch_assoc()) {
|
|
$testa = $GLOBALS['mysql']->query("SELECT * FROM fazs WHERE plz='".$row['tour3']."' and kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."'");
|
|
while($rowf = $testa->fetch_assoc()) {
|
|
$menge=$menge+$rowf['abo'];
|
|
}
|
|
}
|
|
$gmenge=$gmenge+$menge; // zusammenrechnen aller Touren
|
|
$pdf->SetFont('Helvetica','BI',14); $pdf->SetFillColor(240,150,0); $pdf->SetTextColor(0,0,140); unset ($tour_check);
|
|
$tour_check = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."' and typ=15 and utyp=4");
|
|
|
|
if($tour_check['num_rows'] != 0) {
|
|
$pdf->Cell(130,7,utf8_decode("FAZ Leipzig Ost am ".$tour_check['tag'].".".$tour_check['monat'].".".$tour_check['jahr']." ( ".$kw_aktuell.".KW )"),'1','0','L','1');
|
|
$pdf->SetTextColor(0,0,140);
|
|
$pdf->Cell(63,7,$menge.' Exemplare','1','0','R','0');
|
|
$pdf->Write(4,"\n\n");
|
|
//--------------------------------- Tabellenkopf
|
|
$pdf->SetFillColor(100,100,100);
|
|
$pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->SetTextColor(255,255,255);
|
|
$pdf->Cell(22,5,"Tour",'1','0','L','1');
|
|
$pdf->Cell(70,5,"Bezeichnung",'1','0','L','1');
|
|
$pdf->Cell(30,5,"Exemplare",'1','0','L','1');
|
|
$pdf->Cell(40,5,"Fahrer",'1','0','L','1');
|
|
$pdf->Cell(22,5,"Fahrzeug",'1','0','L','1');
|
|
$pdf->Cell(9,5,"SMS",'1','1','C','1');
|
|
$pdf->Write(2,"\n");
|
|
$pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0);
|
|
$pdf->SetFont('');
|
|
$key=0;
|
|
$rs_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE kw='".$kw_aktuell."' and jahr='".$jahr_aktuell."' and typ=15 and utyp=4");
|
|
while($row = $rs_tour->fetch_assoc()) {
|
|
$row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
|
|
$stamma=$row_tour['s_auto']; $stammf=$row_tour['s_fahrer'];
|
|
|
|
$pdf->Cell(22,5,utf8_decode($row_tour['tour']),'1','0','L','1');
|
|
$pdf->Cell(70,5,utf8_decode($row_tour['infotitel']),'1','0','L','1');
|
|
$pdf->Cell(30,5,($row['exemplare']." Exemplare"),'1','0','R','1');
|
|
|
|
$row_fahrerx = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE id='".$row['fahrer']."'");
|
|
if ($stammf != $row['fahrer']) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(40,5,utf8_decode($row_fahrerx['name']),'1','0','L','1');
|
|
$pdf->SetFont('');
|
|
|
|
|
|
|
|
$row_autox = $GLOBALS['mysql']->query_single("SELECT * FROM fahrzeuge WHERE id='".$row['auto']."'");
|
|
if($stamma != $row['auto']) $pdf->SetFont('Helvetica','BI',10);
|
|
$pdf->Cell(22,5,($row_autox['kz']),'1','0','L','1');
|
|
$pdf->SetFont('');
|
|
if($row['smsid']>0) { $pdf->Cell(9,5,'OK','1','1','L','1'); }
|
|
else {$pdf->Cell(9,5,'---','1','1','L','1'); }
|
|
$pdf->SetFont('');
|
|
$key++;
|
|
}
|
|
}
|
|
|
|
$pdf->Write(4,"\n\n");
|
|
//---------------------------------------- FAZ ges. -------------------------------------------------------------
|
|
$pdf->Cell(130,7,' ','0','0','L','1');
|
|
$pdf->SetTextColor(0,0,140); $pdf->SetFont('Helvetica','BI',14);
|
|
$pdf->Cell(63,7,'ges. '.$gmenge.' Exemplare','1','0','R','0');
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------
|
|
|
|
if ($_GET['icon'] ==0) { $pdf->Output('FAZ-Einsatzplan_'.($kw_aktuell).'.kw.pdf','I'); }
|
|
if ($_GET['icon'] ==1) { $pdf->Output('FAZ-Einsatzplan_'.($datum).'.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-Einsatzplan-Einsatzplan ".($kw_aktuell).".kw.pdf";
|
|
$Dateiname = "FAZ-Einsatzplan_".($kw_aktuell).".kw.pdf";
|
|
$DateinameMail = "FAZ-Einsatzplan_".($kw_aktuell).".kw.pdf";
|
|
|
|
require_once('lib/phpmailer/class.phpmailer.php');
|
|
$mail = new PHPMailer();
|
|
$mail->SetLanguage('de', $mail->PluginDir . '/language/');
|
|
$mail->Body = "FAZ-Einsatzplan ".$kw_aktuell.".kw";
|
|
$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,"FAZ-Einsatzplan_".$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
|
|
}
|
|
|
|
?>
|