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

207 lines
No EOL
7.5 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'];
$monat= $_GET['monat'];
$jahr = $_GET['jahr'];
//--------------------------------
class PDF extends FPDF {
function Header() {
// blau (0,160,230)
// Orange (240,150, 0)
// grau (200,200,200)
$this->SetFont('Helvetica','B',20);
$this->Image('template/images/jb_logo2.png', 120, 7);
$adr = $GLOBALS['mysql']->query_single("SELECT * FROM firmen WHERE id=1");
$this->SetFont('Helvetica','B',10); $this->SetTextColor(0,0,0); $this->SetFillColor(255,255,255);
$this->Cell(110,5,utf8_decode($adr['a1']." ".$adr['a2']),'0','1','L','0');
//$this->Cell(110,5,utf8_decode($adr['a2']),'0','1','L','0');
$this->Cell(110,5,utf8_decode($adr['a3']),'0','1','L','0');
$this->Cell(110,5,utf8_decode($adr['a4']),'0','1','L','1');
$this->SetFont('Helvetica','B',12);
$this->SetTextColor(0,160,230); $this->SetFillColor(240,150,0);
$this->Cell(110,8,"Monatsbericht MPV (Marktbelege) ".($_GET['monat'])." / ".($_GET['jahr']),'0','0','L','0');
$this->SetFont(''); $this->SetFont('Helvetica','B',10); $this->SetTextColor(0,0,0);
$this->Cell(80,4,'Seite '.$this->PageNo(),'0','0','R','0');
$this->Write(8,"\n");
}
function Footer() {
$this->SetY(-15);
$this->SetFont('Helvetica','I',6);
$this->Cell(190,3,'JB-Transport.de - Bautzner Str. 67 - 04347 Leipzig ***** Interne Liste - NON Public ***** by. F. Teichert 2011-2019','1','0','C','1');
}
}
$pdf = new PDF('P','mm','A4');
$pdf->AddPage();
$pdf->SetFont('Courier','B',10); $pdf->SetFont(''); $pdf->SetFillColor(255,255,255);
//--------------- neu 1. touren auslesen zu arbeitgeber , danach mit option die tourenliste
$keyfirma=0; $keytour=0; $firmapreis=0; $tourmenge=0; $abnahme=0; $abnahmepreis=0;
$abnahme=0;
$kg_grenze1=1400;
$kg_grenze2=700;
$preis_grund=100;
$preis_abnahme=65;
$preis_zweit=100;
$tempgewicht=0;
$aufpreis=30;
// $firmatouren = $GLOBALS['mysql']->query("SELECT * FROM touren WHERE afirma='".$firma."' ORDER BY typ");
//-----------------------------------------
//-----------------------------------------
//-----------------------------------------
//---------------------- Marktbelege
$firmampreis=0;
$pdf->Write(2,"\n");
$toursumme=0;
$firmatouren = $GLOBALS['mysql']->query("SELECT * FROM touren WHERE typ=12 ORDER BY ID"); $touranz=0; $touranzahl=0;
while($rowt = $firmatouren->fetch_assoc()) {
$tourq = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE monat='".$monat."' AND jahr='".$jahr."' AND tour='".$rowt['id']."'");
$touranzahl=$tourq['num_rows'];
unset($tourx); $tourmenge=0;
$keytour++; $key=0;
$tourx = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE monat='".$monat."' AND jahr='".$jahr."' AND tour='".$rowt['id']."' ORDER BY time");
while($row = $tourx->fetch_assoc()) {
if($touranz==0) {
//---------------------------------------------------------- Tour anzeigen
$pdf->SetFont('Courier','B',10);
$pdf->Cell(20,4,utf8_decode($rowt['tour']),'T','0','L','0'); // Tour
$pdf->SetFont('Courier','',10);
$pdf->Cell(60,4,utf8_decode($rowt['infotitel']),'T','0','L','0');
}
else {
$pdf->SetFont('Courier','',10);
$pdf->Cell(20,4,utf8_decode(" "),'0','0','L','0'); // Tour
$pdf->Cell(60,4,utf8_decode(" "),'0','0','L','0');
}
//----------------------------------------------------------
$toursumme=$rowt['preis'];
if($touranz==0) {
$pdf->Cell(30,4,utf8_decode($row['tag'].".".$row['monat'].".".$row['jahr']),'T','0','R','0');
$pdf->Cell(25,4,utf8_decode($row['gewicht']." kg"),'T','0','R','0');
$pdf->Cell(30,4,(sprintf("%01.2f",$toursumme))." Euro",'T','0','R','0');
} else {
$pdf->Cell(30,4,utf8_decode($row['tag'].".".$row['monat'].".".$row['jahr']),'0','0','R','0');
$pdf->Cell(25,4,utf8_decode($row['gewicht']." kg"),'0','0','R','0');
$pdf->Cell(30,4,(sprintf("%01.2f",$toursumme))." Euro",'0','0','R','0');
}
// -------------------------------- preissammlung
$touranz++;
$typsumme=$typsumme+$toursumme;
$firmapreis=$firmapreis+$toursumme;
if($touranzahl==$touranz) {
if($touranz==1) {
$pdf->Cell(30,4,(sprintf("%01.2f",$typsumme))." Euro",'T','1','R','0');
} else {
$pdf->Cell(30,4,(sprintf("%01.2f",$typsumme))." Euro",'0','1','R','0');
}
$firmampreis=$firmampreis+$typsumme;
$typsumme=0;
} else {
if($touranz==1) {
$pdf->Cell(30,4,utf8_decode(" "),'T','1','R','0');
} else {
$pdf->Cell(30,4,utf8_decode(" "),'0','1','R','0');
}
}
$toursumme=0;$tempgewicht=0;
} $touranz=0;
}
/*
$tourm = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE monat='".$monat."' AND jahr='".$jahr."' AND typ=13 ORDER BY tour");
while($row = $tourm->fetch_assoc()) {
$touri = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'");
if ($lasttour!=$row['tour']) {
$pdf->SetFont('Courier','B',10); $pdf->Cell(65,4,' ','B','0','L','0');
$pdf->SetFont('Courier','',10); $pdf->Cell(20,4,' ','B','0','R','0');
$pdf->Cell(40,4,' ','B','0','R','0');
$pdf->Cell(40,4,' ','B','0','R','0');
$pdf->Cell(30,4,(sprintf("%01.2f",$toursumme))." Euro",'B','1','R','0');
$toursumme=0;
}
$pdf->SetFont('Courier','B',10);
$pdf->Cell(65,4,utf8_decode($touri['tour2']),'0','0','L','0');
$pdf->SetFont('Courier','',10);
$pdf->Cell(20,4,utf8_decode($row['tag'].".".$row['monat'].".".$row['jahr']),'0','0','R','0');
$pdf->Cell(40,4,(" "),'0','0','R','0');
$pdf->Cell(40,4,(sprintf("%01.2f",$touri['preis']))." Euro",'0','0','R','0');
$pdf->Cell(30,4,' ','0','1','R','0');
$lasttour=$row['tour'];
$toursumme=$toursumme+$touri['preis'];
$firmapreis=$firmapreis+$touri['preis'];
$firmampreis=$firmampreis+$touri['preis'];
}
*/
//zwischensumme Kaufland
$pdf->Cell(195,4," ",'0','1','R','1');
$pdf->Cell(195,4,"--------------",'0','1','R','1');
$pdf->Cell(108,4," ",'0','0','L','1');
$pdf->SetFont('Courier','B',10);
$pdf->Cell(50,4,"Zwischensumme Marktbelege (Netto):",'0','0','R','1');
$pdf->Cell(37,4,(sprintf("%01.2f",$firmampreis))." Euro",'0','1','R','1');
$pdf->SetFont('Courier','',10);
//-----------------------------------------
$pdf->Write(4,"\n");
$pdf->Cell(195,4,(" "),'B','1','R','1');
$pdf->Write(4,"\n");
//gesamtsumme
// $pdf->Cell(25,8," ",'0','1','R','1');
$pdf->Cell(195,4," ",'0','1','R','1');
//$pdf->Cell(195,4,"--------------",'0','1','R','1');
$pdf->Cell(108,4," ",'0','0','L','1');
$pdf->SetFont('Courier','B',10);
$pdf->Cell(50,4,"Zwischensumme (Netto):",'0','0','R','1');
$pdf->Cell(37,4,(sprintf("%01.2f",$firmapreis))." Euro",'0','1','R','1');
$pdf->SetFont('Courier','',10);
//-----------------------------------------
$pdf->Output('Abr_Marktbelege_'.($monat).'_'.($jahr).'.pdf','I');
exit();
//---------
$pdf->Output('Abr_Marktbelege_'.($monat).'_'.($jahr).'.pdf','I');