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

129 lines
4.9 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 Footer() {
$this->SetY(-15);
$this->SetFont('Helvetica','B',8);
//$this->Cell(190,3,' ','T','0','C','1');
$this->SetFillColor(180,180,180); $this->SetTextColor(255,255,255);
$this->Cell(90,5,'JB-Transport.de - Bautzner Str. 67 - 04347 Leipzig','0','0','L','1');
$this->SetFont('Helvetica','',6);
$this->Cell(80,5,'***** Interne Liste - NON Public *****','0','0','C','1');
$this->SetFont('Helvetica','',6); $this->SetTextColor(210,210,210);
$this->Cell(20,5,'by.F.T.2021','0','1','R','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(20,"\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('');
$adr = $GLOBALS['mysql']->query_single("SELECT * FROM firmen WHERE id='".$firma."'");
$pdf->SetFont('Helvetica','B',10); $pdf->SetTextColor(0,0,0); $pdf->SetFillColor(255,255,255);
$pdf->Cell(110,5,utf8_decode($adr['a1']),'0','1','L','0');
$pdf->Cell(110,5,utf8_decode($adr['a2']),'0','1','L','0');
$pdf->Cell(110,5,utf8_decode($adr['a3']),'0','1','L','0');
$pdf->Cell(110,5,utf8_decode($adr['a4']),'0','1','L','1');
$pdf->Write(8,"\n");
$pdf->SetFont('Helvetica','BI',16);
$pdf->Cell(110,8,"Anlage zur Rechnung / Einzelnachweis ".($monat)."/".($jahr),'0','1','L','1');
$pdf->SetFont('');
$pdf->Write(4,"\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; $abnahmepreis=0;
$firmatouren = $GLOBALS['mysql']->query("SELECT * FROM touren WHERE afirma='".$firma."' ORDER BY typ,tour");
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++;
//-----
$tourx = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE monat='".$monat."' AND jahr='".$jahr."' AND tour='".$rowfirma['id']."' ORDER BY tag"); $key=0;
//auswertung pro tour
while($row2 = $tourx->fetch_assoc()) {
$tourmenge++;
$tourpreis=$tourpreis+$rowfirma['preis'];
$firmapreis=$firmapreis+$rowfirma['preis'];
}
//------ 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');
$pdf->Cell(20,4,($tourmenge)." x",'0','0','R','1');
$pdf->Cell(30,4,(sprintf("%01.2f",$rowfirma['preis']))." Euro",'0','0','R','1');
$pdf->Cell(30,4,(sprintf("%01.2f",$tourpreis))." Euro",'0','1','R','1');
}
$tourpreis=0; $tourmenge=0;
}
//gesamtsumme
// $pdf->Cell(25,8," ",'0','1','R','1');
$pdf->Cell(195,4," ",'0','1','R','1');
if($firmapreis<9999) {
$pdf->Cell(195,4,"------------",'0','1','R','1');
} else {
$pdf->Cell(195,4,"-------------",'0','1','R','1');
}
$pdf->Cell(108,4," ",'0','0','L','1');
$pdf->Cell(50,4,"Nettosumme:",'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($firmapreis<9999) {
$pdf->Cell(195,4,"============",'0','1','R','1');
} else {
$pdf->Cell(195,4,"=============",'0','1','R','1');
}
//---------
$pdf->Output('Einzelnachweis_'.$adr['a1'].'_'.$datum.'pdf','I');
exit();
//---------
$pdf->Output('Einzelnachweis_'.$adr['a1'].'_'.$datum.'pdf','I');