174 lines
7 KiB
PHP
174 lines
7 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);
|
|
require('lib/fpdf.php');
|
|
|
|
//--------------------------------
|
|
//-------------------- pdf starten
|
|
//--------------------------------
|
|
//-------------------- Variablenübergabe
|
|
$firma= $_GET['id'];
|
|
$tour = $_GET['tid'];
|
|
$monat= $_GET['monat'];
|
|
$jahr = $_GET['jahr'];
|
|
|
|
// Arrays
|
|
$a_fahrzg = $GLOBALS['a_fahrzg'];
|
|
$a_fahrer = $GLOBALS['a_fahrer'];
|
|
//--------------------------------
|
|
|
|
class PDF extends FPDF {
|
|
function Footer() {
|
|
$this->SetY(-15);
|
|
$this->SetFont('Helvetica','BI',8);
|
|
$this->SetFillColor(200,200,200);
|
|
$this->SetTextColor(0,0,0);
|
|
$this->Cell(65,4,'JB-Transport - Bautzner Str. 67 - 04347 Leipzig','0','0','L','1');
|
|
$this->SetFont('Helvetica','',6);
|
|
$this->Cell(60,4,'***** Interne Liste - NON Public *****','0','0','C','1');
|
|
$this->SetTextColor(80,80,80);
|
|
$this->Cell(65,4,'F.T. 2012/2022','0','0','R','1');
|
|
}
|
|
}
|
|
$pdf = new PDF('P','mm','A4');
|
|
$pdf->AddPage();
|
|
// blau (0,160,230)
|
|
// Orange (240,150, 0)
|
|
// grau (200,200,200)
|
|
$pdf->SetFillColor(255,255,255);
|
|
$pdf->SetFont('Helvetica','B',20);
|
|
$pdf->Image('template/images/jb_logo.png', 70, 5,150,27);
|
|
$pdf->SetFont('Helvetica','BI',24); $pdf->SetTextColor(0,160,230); $pdf->SetFillColor(255,255,255);
|
|
$pdf->Cell(65,8,"Monatsbericht",'0','1','L','0');
|
|
$pdf->SetFont('Helvetica','B',12); $pdf->SetTextColor(0,160,230); $pdf->SetFillColor(255,255,255);
|
|
$pdf->Cell(65,8,"Fahrer / Fahrzeugnachweis",'0','1','L','0');
|
|
|
|
$tdata = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$tour."'");
|
|
$tourm = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE monat='".$monat."' AND jahr='".$jahr."' AND tour='".$tdata['id']."'");
|
|
$tourmenge=$tourm['num_rows'];
|
|
$pdf->SetFont('Helvetica','B',12); $pdf->SetTextColor(240,150,0);
|
|
$pdf->Cell(40,6,utf8_decode($tdata['tour']),'0','0','L','0');
|
|
$pdf->SetFont('Helvetica','B',8); $pdf->SetTextColor(240,150,0);
|
|
$pdf->Cell(20,6,utf8_decode("( ".$tdata['tour2']." )"),'0','1','R','0');
|
|
$pdf->SetFont('Helvetica','B',8); $pdf->SetTextColor(240,150,0);
|
|
$pdf->Cell(60,6,utf8_decode($tdata['infotitel']),'0','1','L','0');
|
|
|
|
|
|
|
|
$pdf->Write(2,"\n");
|
|
|
|
$pdf->SetFont('Helvetica','B',6); $pdf->SetTextColor(160,160,160);
|
|
$pdf->Cell(62,6,('Abrechnungszeitraum:'),'0','0','L','0');
|
|
$pdf->Cell(62,6,('Gesamtmenge:'),'0','0','L','0');
|
|
$pdf->Cell(62,6,('Auftraggeber:'),'0','1','L','0');
|
|
|
|
|
|
|
|
$adr = $GLOBALS['mysql']->query_single("SELECT * FROM firmen WHERE id='".$firma."'");
|
|
$pdf->SetDrawColor(120,120,120);
|
|
$pdf->SetFont('Helvetica','B',8); $pdf->SetTextColor(120,120,120);
|
|
|
|
$pdf->Cell(62,4,utf8_decode('Abrechnungzeitraum'),'TLR','0','L','0');
|
|
$pdf->Cell(62,4,utf8_decode($tdata['tour']),'TLR','0','L','0');
|
|
$pdf->Cell(62,4,utf8_decode($adr['a1']),'TLR','1','L','0');
|
|
|
|
$pdf->Cell(62,4,utf8_decode('für'),'LR','0','L','0');
|
|
$pdf->Cell(62,4,utf8_decode($tdata['tour2']),'LR','0','L','0');
|
|
$pdf->Cell(62,4,utf8_decode($adr['a2']),'LR','1','L','0');
|
|
|
|
$pdf->Cell(62,4,('Monat: '.$monat),'LR','0','L','0');
|
|
$pdf->Cell(62,4,utf8_decode($tdata['infotitel']),'LR','0','L','0');
|
|
$pdf->Cell(62,4,utf8_decode($adr['a3']),'LR','1','L','0');
|
|
|
|
$pdf->Cell(62,4,('Jahr: '.$jahr),'BLR','0','L','0');
|
|
$pdf->Cell(62,4,("Gesamtenge: ".$tourmenge. "x"),'BLR','0','L','0');
|
|
$pdf->Cell(62,4,utf8_decode($adr['a4']),'BLR','1','L','0');
|
|
|
|
//---------- Ausgabedaten
|
|
$pdf->Write(3,"\n");
|
|
|
|
if($tourmenge==0) {
|
|
$pdf->SetFont('Helvetica','B',20); $pdf->SetTextColor(255,30,30);
|
|
$pdf->Cell(62,8,utf8_decode('keine Einträge vorhanden.'),'0','1','L','0');
|
|
} else {
|
|
if($tdata['typ']!=19) {
|
|
$pdf->SetFont('Helvetica','B',6); $pdf->SetTextColor(160,160,160);
|
|
$pdf->Cell(40,6,('Leistungsdatum:'),'0','0','L','0');
|
|
$pdf->Cell(60,6,('eingesetzter Fahrer/in:'),'0','0','L','0');
|
|
$pdf->Cell(40,6,('eingesetztes Fahrzeug:'),'0','0','L','0');
|
|
$pdf->Cell(25,6,('interne Buchungsnr.:'),'0','0','L','0');
|
|
$pdf->Cell(20,6,('interne S.-Nr.:'),'0','1','R','0');
|
|
|
|
$pdf->SetFont('Courier','B',10); $pdf->SetTextColor(0,0,0); $key=0;
|
|
$tourx = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE monat='".$monat."' AND jahr='".$jahr."' AND tour='".$tdata['id']."' ORDER BY time");
|
|
while($row = $tourx->fetch_assoc()) {
|
|
//------ tabellenhintergrund
|
|
if ($key % 2 != 0) {
|
|
$pdf->SetFillColor(255,255,255);
|
|
} else {
|
|
$pdf->SetFillColor(240,240,240);
|
|
}
|
|
//------ pdf ausgabe
|
|
if($row['tag']<10) { $tag="0".$row['tag']; } else { $tag=$row['tag'];}
|
|
if($row['monat']<10) { $mon="0".$row['monat']; } else { $mon=$row['monat'];}
|
|
$pdf->Cell(40,4,($tag.'.'.$mon.'.'.$row['jahr'])," ",'0','0','R','1');
|
|
|
|
$ma_id= array_search($row['fahrer'], array_column($a_fahrer, 'id'));
|
|
$pdf->Cell(60,4,utf8_decode($a_fahrer[$ma_id]['name']),'0','0','L','1');
|
|
|
|
$aa_id= array_search($row['auto'], array_column($a_fahrzg, 'id'));
|
|
$pdf->Cell(40,4,utf8_decode($a_fahrzg[$aa_id]['kz']),'0','0','L','1');
|
|
|
|
$pdf->Cell(25,4,utf8_decode($row['id']),'0','0','L','1');
|
|
$pdf->Cell(20,4,utf8_decode($row['smsid']),'0','1','R','1');
|
|
$key++;
|
|
}
|
|
} else {
|
|
$pdf->SetFont('Helvetica','B',6); $pdf->SetTextColor(160,160,160);
|
|
$pdf->Cell(30,6,('Leistungsdatum:'),'0','0','L','0');
|
|
$pdf->Cell(50,6,('eingesetzter Fahrer/in:'),'0','0','L','0');
|
|
$pdf->Cell(40,6,('eingesetztes Fahrzeug:'),'0','0','L','0');
|
|
$pdf->Cell(25,6,('interne Buchungsnr.:'),'0','0','L','0');
|
|
$pdf->Cell(20,6,('interne S.-Nr.:'),'0','0','L','0');
|
|
$pdf->Cell(20,6,('Gewicht:'),'0','1','R','0');
|
|
|
|
$pdf->SetFont('Courier','B',10); $pdf->SetTextColor(0,0,0); $key=0;
|
|
$tourx = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE monat='".$monat."' AND jahr='".$jahr."' AND tour='".$tdata['id']."' ORDER BY time");
|
|
while($row = $tourx->fetch_assoc()) {
|
|
//------ tabellenhintergrund
|
|
if ($key % 2 != 0) {
|
|
$pdf->SetFillColor(255,255,255);
|
|
} else {
|
|
$pdf->SetFillColor(240,240,240);
|
|
}
|
|
//------ pdf ausgabe
|
|
if($row['tag']<10) { $tag="0".$row['tag']; } else { $tag=$row['tag']; }
|
|
if($row['monat']<10) { $mon="0".$row['monat']; } else { $mon=$row['monat']; }
|
|
$pdf->Cell(30,4,($tag.'.'.$mon.'.'.$row['jahr'])," ",'0','0','R','1');
|
|
|
|
$ma_id= array_search($row['fahrer'], array_column($a_fahrer, 'id'));
|
|
$pdf->Cell(50,4,utf8_decode($a_fahrer[$ma_id]['name']),'0','0','L','1');
|
|
|
|
$aa_id= array_search($row['auto'], array_column($a_fahrzg, 'id'));
|
|
$pdf->Cell(40,4,utf8_decode($a_fahrzg[$aa_id]['kz']),'0','0','L','1');
|
|
|
|
$pdf->Cell(25,4,utf8_decode($row['id']),'0','0','L','1');
|
|
$pdf->Cell(20,4,utf8_decode($row['smsid']),'0','0','L','1');
|
|
$pdf->Cell(20,4,utf8_decode($row['gewicht']." kg"),'0','1','R','1');
|
|
$key++;
|
|
}
|
|
}
|
|
}
|
|
//---------
|
|
$pdf->Output('re_uebersicht_'.($datum).'.pdf','I');
|
|
exit();
|
|
|
|
//---------
|
|
$pdf->Output('re_uebersicht_'.($datum).'.pdf','I');
|