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

212 lines
9.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
$kw= $_GET['kw'];
//$monat= $_GET['monat'];
$jahr = $_GET['jahr'];
//--------------------------------
class PDF extends FPDF {
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 ©2012','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',12);
$pdf->Image('jb_logo.png', 0, 5,230,30);
$pdf->Write(16,"\n\n");
$pdf->SetFont('Helvetica','BU',7); $pdf->SetTextColor(0,0,0); $pdf->SetFillColor(255,255,255);
$pdf->Cell(110,3,"JB-Transport - Bautzner Str. 76 - 04347 Leipzig",'0','1','L','1');
$pdf->SetFont('');
$pdf->Cell(110,3," ",'0','1','L','1');
//$adr = $GLOBALS['mysql']->query_single("SELECT * FROM firmen WHERE id='".$firma."'");
$adr = $GLOBALS['mysql']->query_single("SELECT * FROM firmen WHERE id=1");
$pdf->SetFont('Helvetica','B',10); $pdf->SetTextColor(0,0,0); $pdf->SetFillColor(255,255,255);
$pdf->Cell(110,4,utf8_decode($adr['a1']),'0','1','L','0');
$pdf->Cell(110,4,utf8_decode($adr['a2']),'0','1','L','0');
$pdf->Cell(110,4,utf8_decode($adr['a3']),'0','1','L','0');
$pdf->Cell(110,4,utf8_decode($adr['a4']),'0','1','L','1');
$pdf->Write(4,"\n");
$pdf->SetFont('Helvetica','BI',16);
$pdf->Cell(110,8,"Wochenbericht ".($kw)."/".($jahr),'0','1','L','1');
$pdf->SetFont('');
$pdf->Write(2,"\n");
$pdf->SetFont('Courier','B',10); $pdf->SetFont('');
//--------------- neu 1. touren auslesen zu arbeitgeber , danach mit option die tourenliste
$keyfirma=0; $keytour=0; $firmapreis=0; $tourmenge=0;
$abnahme=0;
$kg_grenze1=1400;
$kg_grenze2=700;
$preis_grund=100;
$preis_abnahme=65;
$preis_zweit=100;
$tempgewicht=0;
// $firmatouren = $GLOBALS['mysql']->query("SELECT * FROM touren WHERE afirma='".$firma."' ORDER BY typ");
$firmatouren = $GLOBALS['mysql']->query("SELECT * FROM touren WHERE typ=19 and id<20000 ORDER BY ID");
while($rowfirma = $firmatouren->fetch_assoc()) {
// $tour1[$keytour]['id']=$rowfirma['id'];
// $tour1[$keytour]['tour']=$rowfirma['tour'];
// $tour1[$keytour]['infotitel']=$rowfirma['infotitel'];
// $tour1[$keytour]['preis']=$rowfirma['preis'];
unset($row2); unset($tourx); $tourmenge=0;
$keytour++;
//-----
// $key=0;
//$tourq = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE kw='".$kw."' AND jahr='".$jahr."' AND tour='".$rowfirma['id']."' ORDER BY time");
$tourq = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE kw='".$kw."' AND jahr='".$jahr."' AND tour='".$rowfirma['id']."'");
//auswertung pro tour
//while($row2 = $tourq->fetch_assoc()) {
if($tourq['gewicht']>0) {
$tempgewicht=$tourq['gewicht']-$kg_grenze1;
//---------------------------------------------------------- Grundpreis
$pdf->SetFont('Courier','B',10);
$pdf->Cell(25,4,utf8_decode($tourq['tag'].".".$tourq['monat'].".".$tourq['jahr']),'0','0','L','1');
$pdf->Cell(20,4,utf8_decode($rowfirma['tour']),'0','0','L','1');
//$pdf->Cell(40,4,utf8_decode("(".$rowfirma['infotitel'].")"),'0','0','L','1');
$pdf->SetFont('Courier','',10);
$pdf->Cell(20,4,utf8_decode("(".$tourq['gewicht']." kg)"),'0','0','R','1');
$pdf->SetFont('Courier','B',10);
$pdf->Cell(70,4,utf8_decode("Grundpreis"),'0','0','L','1');
$pdf->Cell(30,4,(sprintf("%01.2f",$preis_grund))." Euro",'0','0','R','1');
$pdf->Cell(30,4,(sprintf("%01.2f",$preis_grund))." Euro",'0','1','R','1');
$firmapreis=$firmapreis+$preis_grund;
if($tempgewicht>$kg_grenze1) { // 2. Fahrzeug
$tempgewicht=$tempgewicht-$kg_grenze1; //------------ 1500kg abziehen
$pdf->SetFont('Courier','B',10);
$pdf->Cell(25,4,utf8_decode($tourq['tag'].".".$tourq['monat'].".".$tourq['jahr']),'0','0','L','1');
$pdf->Cell(20,4,utf8_decode($rowfirma['tour']),'0','0','L','1');
//$pdf->Cell(40,4,utf8_decode("(".$rowfirma['infotitel'].")"),'0','0','L','1');
$pdf->SetFont('Courier','',10);
$pdf->Cell(20,4,utf8_decode("(".$tourq['gewicht']." kg)"),'0','0','R','1');
$pdf->SetFont('Courier','B',10);
$pdf->Cell(70,4,utf8_decode("2. Fahrzeug"),'0','0','L','1');
$pdf->Cell(30,4,(sprintf("%01.2f",$preis_grund))." Euro",'0','0','R','1');
$pdf->Cell(30,4,(sprintf("%01.2f",$preis_grund))." Euro",'0','1','R','1');
$firmapreis=$firmapreis+$preis_grund;
}
if($tempgewicht>$kg_grenze1) { // 3. Fahrzeug
$tempgewicht=$tempgewicht-$kg_grenze1; //------------ 1500kg abziehen
$pdf->SetFont('Courier','B',10); $pdf->SetFont('');
$pdf->Cell(25,4,utf8_decode($tourq['tag'].".".$tourq['monat'].".".$tourq['jahr']),'0','0','L','1');
$pdf->Cell(15,4,utf8_decode($rowfirma['tour']),'0','0','L','1');
//$pdf->Cell(40,4,utf8_decode("(".$rowfirma['infotitel'].")"),'0','0','L','1');
$pdf->Cell(20,4,utf8_decode(" (".$tourq['gewicht']." kg )"),'0','0','R','1');
$pdf->Cell(70,4,utf8_decode("3. Fahrzeug"),'0','0','L','1');
//$pdf->Cell(20,4,($tourmenge)." ",'0','0','R','1');
$pdf->Cell(30,4,"a. ".(sprintf("%01.2f",$preis_grund))." Euro",'0','0','R','1');
$pdf->Cell(30,4,(sprintf("%01.2f",$preis_grund))." Euro",'0','1','R','1');
$firmapreis=$firmapreis+$preis_grund;
}
if($tempgewicht>$kg_grenze1) { // 4. Fahrzeug
$tempgewicht=$tempgewicht-$kg_grenze1; //------------ 1500kg abziehen
$pdf->SetFont('Courier','B',10); $pdf->SetFont('');
$pdf->Cell(25,4,utf8_decode($tourq['tag'].".".$tourq['monat'].".".$tourq['jahr']),'0','0','L','1');
$pdf->Cell(15,4,utf8_decode($rowfirma['tour']),'0','0','L','1');
$pdf->Cell(20,4,utf8_decode(" (".$tourq['gewicht']." kg )"),'0','0','R','1');
$pdf->Cell(70,4,utf8_decode("4. Fahrzeug"),'0','0','L','1');
$pdf->Cell(30,4,(sprintf("%01.2f",$preis_grund))." Euro",'0','0','R','1');
$pdf->Cell(30,4,(sprintf("%01.2f",$preis_grund))." Euro",'0','1','R','1');
$firmapreis=$firmapreis+$preis_grund;
}
//---------------------------------------------------------------------
//------------------------------------------------------------- Abnahme
//---------------------------------------------------------------------
if($tempgewicht>0 && $tempgewicht<$kg_grenze2) { // Abnahme
$tempgewicht=$tempgewicht-$kg_grenze2; //------------ 750kg abziehen
$pdf->SetFont('Courier','B',10);
$pdf->Cell(25,4,utf8_decode($tourq['tag'].".".$tourq['monat'].".".$tourq['jahr']),'0','0','L','1');
$pdf->Cell(20,4,utf8_decode($rowfirma['tour']),'0','0','L','1');
$pdf->SetFont('Courier','',10);
$pdf->Cell(20,4,utf8_decode("(".$tourq['gewicht']." kg)"),'0','0','R','1');
$pdf->SetFont('Courier','B',10);
$pdf->Cell(70,4,utf8_decode("Gewichtsabnahme"),'0','0','L','1');
//$pdf->Cell(20,4,($tourmenge)." ",'0','0','R','1');
$pdf->Cell(30,4,(sprintf("%01.2f",$preis_abnahme))." Euro",'0','0','R','1');
$pdf->Cell(30,4,(sprintf("%01.2f",$preis_abnahme))." Euro",'0','1','R','1');
$firmapreis=$firmapreis+$preis_abnahme;
}
}
//}
//------ pdf ausgabe
if($tourmenge>0) {
$pdf->SetFont('Courier','B',10); $pdf->SetFont('');
$pdf->Cell(28,4,utf8_decode($rowfirma['tour']),'0','0','L','1');
$pdf->Cell(87,4,utf8_decode($rowfirma['infotitel']),'0','0','L','1');
if($rowfirma['retyp']==4) {
$pdf->Cell(20,4," ",'0','0','R','1');
$pdf->Cell(30,4," ",'0','0','R','1');
} else {
$pdf->Cell(20,4,($tourmenge)." ",'0','0','R','1');
$pdf->Cell(30,4,"a. ".(sprintf("%01.2f",$rowfirma['preis']))." Euro",'0','0','R','1');
}
$pdf->Cell(30,4,(sprintf("%01.2f",$tourpreis))." Euro",'0','1','R','1');
if($abnahme>0) {
$pdf->Cell(28,4,utf8_decode("A-".$rowfirma['tour']),'0','0','L','1');
$pdf->Cell(87,4,utf8_decode("zusätzliches Fahrzeug"),'0','0','L','1');
$halbesache=$rowfirma['preis']/2; $abnahmepreis=$halbesache*$abnahme;
$pdf->Cell(20,4,($abnahme)." ",'0','0','R','1');
$pdf->Cell(30,4,(sprintf("%01.2f",$halbesache))." Euro",'0','0','R','1');
$pdf->Cell(30,4,(sprintf("%01.2f",$abnahmepreis))." Euro",'0','1','R','1');
$abnahme=0;
}
}
$tourpreis=0; $tourmenge=0;
}
//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->Cell(50,4,"Zwischensumme:",'0','0','R','1');
$pdf->Cell(37,4,(sprintf("%01.2f",$firmapreis))." Euro",'0','1','R','1');
$steuer=$firmapreis*19/100;
$pdf->Cell(108,4," ",'0','0','L','1');
$pdf->Cell(50,4,"+19% MwSt.",'0','0','R','1');
$pdf->Cell(37,4,(sprintf("%01.2f",$steuer))." Euro",'0','1','R','1');
$betrag=$firmapreis+$steuer;
$pdf->Cell(108,4," ",'0','0','L','1');
$pdf->Cell(50,4,"Gesamtbetrag:",'0','0','R','1');
$pdf->Cell(37,4,(sprintf("%01.2f",$betrag))." Euro",'0','1','R','1');
if($betrag>9999) {
$pdf->Cell(195,4,"===========",'0','1','R','1');
} else {
$pdf->Cell(195,4,"============",'0','1','R','1');
}
//---------
$pdf->Output('rechnung_'.($datum).'.pdf','I');
exit();
//---------
$pdf->Output('rechnung_'.($datum).'.pdf','I');