242 lines
No EOL
10 KiB
PHP
242 lines
No EOL
10 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 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=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");
|
|
$firmatouren = $GLOBALS['mysql']->query("SELECT * FROM touren WHERE typ=19 and aktiv=1 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($row['rampe']==98) {
|
|
if($touranz==0) {
|
|
$pdf->Cell(20,4,utf8_decode($row['tag'].".".$row['monat'].".".$row['jahr']),'T','0','R','0');
|
|
$pdf->Cell(50,4,utf8_decode("kommissionieren"),'T','0','R','0');
|
|
$pdf->Cell(30,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(50,4,utf8_decode("kommissionieren"),'0','0','R','0');
|
|
$pdf->Cell(30,4,(sprintf("%01.2f",$toursumme))." Euro",'0','0','R','0');
|
|
}
|
|
} else {
|
|
if($touranz==0) {
|
|
$pdf->Cell(20,4,utf8_decode($row['tag'].".".$row['monat'].".".$row['jahr']),'T','0','R','0');
|
|
$pdf->Cell(50,4,utf8_decode("nicht produziert"),'T','0','R','0');
|
|
$pdf->Cell(30,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(50,4,utf8_decode("nicht produziert"),'0','0','R','0');
|
|
$pdf->Cell(30,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;
|
|
}
|
|
// -------------------------------- Aufschlag
|
|
if($row['rampe']==99) {
|
|
$toursumme=$toursumme+$aufpreis;
|
|
}
|
|
// -------------------------------- Tour anzeigen
|
|
if($touranz==0) {
|
|
$pdf->Cell(20,4,utf8_decode($row['tag'].".".$row['monat'].".".$row['jahr']),'T','0','R','0');
|
|
if($row['rampe']==99) { $pdf->Cell(25,4,utf8_decode("DH Halle"),'T','0','L','0'); }
|
|
else if($row['rampe']==91) { $pdf->Cell(25,4,utf8_decode("Tonev/Tochev"),'T','0','L','0'); }
|
|
else if($row['rampe']==92) { $pdf->Cell(25,4,utf8_decode("Tonev"),'T','0','L','0'); }
|
|
else if($row['rampe']==93) { $pdf->Cell(25,4,utf8_decode("Tonev"),'T','0','L','0'); }
|
|
else if($row['rampe']==77) { $pdf->Cell(25,4,utf8_decode("(30.04.2021)"),'T','0','L','0'); }
|
|
else {
|
|
$pdf->Cell(25,4,utf8_decode(" "),'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(20,4,utf8_decode($row['tag'].".".$row['monat'].".".$row['jahr']),'0','0','R','0');
|
|
if($row['rampe']==99) { $pdf->Cell(25,4,utf8_decode("DH Halle"),'0','0','L','0'); }
|
|
else if($row['rampe']==91) { $pdf->Cell(25,4,utf8_decode("Tonev/Tochev"),'0','0','L','0'); }
|
|
else if($row['rampe']==92) { $pdf->Cell(25,4,utf8_decode("Tonev"),'0','0','L','0'); }
|
|
else if($row['rampe']==93) { $pdf->Cell(25,4,utf8_decode("Tonev"),'0','0','L','0'); }
|
|
else if($row['rampe']==77) { $pdf->Cell(25,4,utf8_decode("(30.04.2021)"),'T','0','L','0'); }
|
|
else {
|
|
$pdf->Cell(25,4,utf8_decode(" "),'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');
|
|
}
|
|
$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 (Netto):",'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');
|
|
|