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

209 lines
No EOL
8.4 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=11");
$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 Sachsen-Sonntag ".($_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=1500;
$kg_grenze2=750;
$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 aktiv=1 and afirma=11 ORDER BY ID"); $touranz=0; $touranzahl=0;
while($rowt = $firmatouren->fetch_assoc()) {
//echo'<pre>'; print_r($rowt); echo'</pre>';
//--------------- neu 1. touren auslesen zu arbeitgeber , danach mit option die tourenliste
$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(45,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(45,4,utf8_decode(" "),'0','0','L','0');
}
//---------------------------------------------------------- nicht gefahren/ausgefallen
if($row['gewicht']==0) {
if($touranz==0) {
$pdf->Cell(20,4,utf8_decode($row['tag'].".".$row['monat'].".".$row['jahr']),'T','0','R','0');
$pdf->Cell(40,4,utf8_decode($row['gewicht']." kg"),'T','0','R','0');
$pdf->Cell(40,4,(sprintf("%01.2f",$toursumme))." Euro",'T','0','R','0');
} else {
$pdf->Cell(20,4,utf8_decode($row['tag'].".".$row['monat'].".".$row['jahr']),'0','0','R','0');
$pdf->Cell(40,4,utf8_decode($row['gewicht']." kg"),'0','0','R','0');
$pdf->Cell(40,4,(sprintf("%01.2f",$toursumme))." Euro",'0','0','R','0');
}
$touranz++;
}
//---------------------------------------------------------- Preisberechnung
else {
// -------------------------------- grundgewicht abziehen
$tempgewicht=$row['gewicht']-$kg_grenze1;
$toursumme=$preis_grund;
// restgewicht mehr als abnahme
if($tempgewicht>$kg_grenze1) { //---------------- 2. Auto
$tempgewicht=$tempgewicht-$kg_grenze1;
$toursumme=$toursumme+$preis_zweit;
}
if($tempgewicht>$kg_grenze1) { //---------------- 3. Auto
$tempgewicht=$tempgewicht-$kg_grenze1;
$toursumme=$toursumme+$preis_zweit;
}
if($tempgewicht>$kg_grenze1) { //---------------- 4. Auto
$tempgewicht=$tempgewicht-$kg_grenze1;
$toursumme=$toursumme+$preis_zweit;
}
if($tempgewicht>$kg_grenze1) { //---------------- 5. Auto
$tempgewicht=$tempgewicht-$kg_grenze1;
$toursumme=$toursumme+$preis_zweit;
}
if($tempgewicht>$kg_grenze1) { //---------------- 6. Auto
$tempgewicht=$tempgewicht-$kg_grenze1;
$toursumme=$toursumme+$preis_zweit;
}
if($tempgewicht>$kg_grenze1) { //---------------- 7. Auto
$tempgewicht=$tempgewicht-$kg_grenze1;
$toursumme=$toursumme+$preis_zweit;
}
if($tempgewicht>$kg_grenze1) { //---------------- 8. Auto
$tempgewicht=$tempgewicht-$kg_grenze1;
$toursumme=$toursumme+$preis_zweit;
}
if($tempgewicht>$kg_grenze2) { // keine Abnahme sonder volles Auto !!!!!!! Abnahme typ 2 über 50%
$tempgewicht=$tempgewicht-$kg_grenze1;
$toursumme=$toursumme+$preis_zweit;
}
// -------------------------------- Abnahme abziehen - 1/2 auto
if($tempgewicht>0) { // Abnahme
$tempgewicht=$tempgewicht-$kg_grenze2;
$toursumme=$toursumme+$preis_abnahme;
}
// -------------------------------- Tour anzeigen
if($touranz==0) {
$pdf->Cell(20,4,utf8_decode($row['tag'].".".$row['monat'].".".$row['jahr']),'T','0','R','0');
$pdf->Cell(40,4,utf8_decode($row['gewicht']." kg"),'T','0','R','0');
$pdf->Cell(40,4,(sprintf("%01.2f",$toursumme))." Euro",'T','0','R','0');
} else {
$pdf->Cell(20,4,utf8_decode($row['tag'].".".$row['monat'].".".$row['jahr']),'0','0','R','0');
$pdf->Cell(40,4,utf8_decode($row['gewicht']." kg"),'0','0','R','0');
$pdf->Cell(40,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');
}
$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;
}
//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('Abr_SaSo_'.($monat).'_'.($jahr).'.pdf','I');
exit();
//---------
$pdf->Output('Abr_SaSo__'.($monat).'_'.($jahr).'.pdf','I');