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

220 lines
No EOL
10 KiB
PHP

<?php
require('fpdf.php');
error_reporting(1);
//--------------------------------
//-------------------- Variablen -
//--------------------------------
$adr['a1']="Max Mustermann";
$adr['a2']="Musterverkaufstelle";
$adr['a3']="Musterstr. 123";
$adr['a4']="12345";
$adr['a5']="Musterstadt";
$renr="SR-10001";
$lagernr="PLX-0815";
$re_tag=2;
$re_monat=2;
$re_jahr=2015;
// 1. Demo-Datensatz
$adata['1']['pos']="1";
$adata['1']['Beschreibung1']="bunt,rund und hässlich";
$adata['1']['Beschreibung2']="stinkend verpackt in Papier";
$adata['1']['Beschreibung3']="bla bla";
$adata['1']['Beschreibung4']="";
$adata['1']['mwst']="19";
$adata['1']['menge']="4";
$adata['1']['epreis']="1.99";
// $adata['1']['gpreis']="1";
//--------------------------------
//-------------------- pdf starten
//--------------------------------
class PDF extends FPDF {
function Footer() { //Fusszeile(n)
$this->SetY(-20);
$this->SetFont('Helvetica','',8);
$this->Cell(7,2," ",'0','0','L','0');
$this->Cell(190,2," ",'T','1','0','0');
$this->Cell(7,3," ",'0','0','L','0');
$this->Cell(45,3,"JB-Transport",'0','0','0','0');
$this->Cell(45,3,"Tel.: 0178/579181",'0','0','0','0');
$this->Cell(50,3,"Volksbank Mittweida",'0','0','0','0');
$this->Cell(40,3,"USt-IdNr. ",'0','1','0','0');
$this->Cell(7,3," ",'0','0','L','0');
$this->Cell(45,3,"Inh. Sven Nestler",'0','0','0','0');
$this->Cell(45,3,"E-Mail: onlinedeals@online.de",'0','0','0','0');
$this->Cell(50,3,"BIC:GENODEF1MIW",'0','0','0','0');
$this->Cell(40,3,"222/466/00140G28/1",'0','1','0','0');
$this->Cell(7,3," ",'0','0','L','0');
$this->Cell(45,3,utf8_decode("Käthe- Kollwitz- Str. 34a"),'0','0','0','0');
$this->Cell(45,3," ",'0','0','0','0');
$this->Cell(50,3,"IBAN: DE04870961240197061596",'0','0','0','0');
$this->Cell(40,3,"Finanzamt Mittweida",'0','1','0','0');
$this->Cell(7,3," ",'0','0','L','0');
$this->Cell(45,3,"09661 Hainichen",'0','0','0','0');
$this->Cell(45,3," ",'0','0','0','0');
$this->Cell(50,3,"KTO Inh.: Sven Nestler",'0','0','0','0');
$this->Cell(40,3," ",'0','1','0','0');
}
}
$pdf = new PDF('P','mm','A4');
$pdf->AddPage();
$pdf->Image('Image5.png', 12,15,130,20);
$pdf->SetFont('Helvetica','U',7); $pdf->SetTextColor(0,0,0); $pdf->SetFillColor(255,255,255);
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,3,utf8_decode("JB-Transport - Bautzner Str. 67 - 04347 Leipzig"),'0','1','L','1');
$pdf->SetFont(''); $pdf->Cell(110,3," ",'0','1','L','1');
$pdf->SetFont('Helvetica','B',10); $pdf->SetTextColor(0,0,0); $pdf->SetFillColor(255,255,255);
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,5," ",'0','0','L','0'); $pdf->Cell(70,5,utf8_decode("JB-Transport & KFZ-Technik"),'0','1','R','1');
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,5," ",'0','0','L','0'); $pdf->Cell(70,5,utf8_decode("Bautzner Str. 67"),'0','1','R','1');
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,5," ",'0','0','L','0'); $pdf->Cell(70,5,utf8_decode("09661 Hainichen"),'0','1','R','1');
//$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,5," ",'0','0','L','1'); $pdf->Cell(70,5,utf8_decode(" "),'0','1','R','1');
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,5," ",'0','0','L','1'); $pdf->Cell(70,5,utf8_decode("Tel.: 037207/579181"),'0','1','R','1');
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,5," ",'0','0','L','1'); $pdf->Cell(70,5,utf8_decode("E-Mail: onlinedeals@online.de"),'0','1','R','1');
$pdf->Write(10,"\n\n");
$pdf->SetFont('Helvetica','U',7); $pdf->SetTextColor(0,0,0); $pdf->SetFillColor(255,255,255);
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,3,utf8_decode("JB-Transport - Bautzner Str. 67 - 04347 Leipzig"),'0','1','L','1');
$pdf->SetFont('Helvetica','B',10); $pdf->SetTextColor(0,0,0); $pdf->SetFillColor(255,255,255);
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,5,utf8_decode($adr['a1']),'0','0','L','0'); $pdf->Cell(70,5,utf8_decode("OnlineDeals Hainichen"),'0','1','R','1');
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,5,utf8_decode($adr['a2']),'0','0','L','0'); $pdf->Cell(70,5,utf8_decode("Käthe-Kollwitz-Str. 34a"),'0','1','R','1');
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,5,utf8_decode($adr['a3']),'0','0','L','0'); $pdf->Cell(70,5,utf8_decode("09661 Hainichen"),'0','1','R','1');
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,5,utf8_decode($adr['a4'])." ".($adr['a5']),'0','0','L','1'); $pdf->Cell(70,5,utf8_decode(" "),'0','1','R','1');
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,5," ",'0','0','L','1'); $pdf->Cell(70,5,utf8_decode("Tel.: 037207/579181"),'0','1','R','1');
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(110,5," ",'0','0','L','1'); $pdf->Cell(70,5,utf8_decode("E-Mail: onlinedeals@online.de"),'0','1','R','1');
$pdf->Write(8,"\n"); $pdf->SetFont('Helvetica','BI',20);
$pdf->Cell(7,5," ",'0','0','L','0');$pdf->Cell(110,8,"Storno-Rechnung",'0','1','L','1');
$pdf->Write(4,"\n");
$pdf->SetFont('Helvetica','B',10);
$pdf->Cell(7,5," ",'0','0','L','0'); $pdf->Cell(60,5,"Rechnung Nr.: ".($renr),'0','0','L','1');
$pdf->Cell(50,5,"Lager Nr.: ".($lagernr),'0','0','L','1');
$pdf->Cell(70,5,"Datum: ".(sprintf("%02d",$re_tag)).".".(sprintf("%02d",$re_monat)).".".($re_jahr),'0','1','R','1');
$pdf->Cell(8,5," ",'0','0','L','0');$pdf->Cell(178,5," ",'B','1','L','1');
$pdf->Cell(8,5," ",'0','0','L','0');$pdf->Cell(178,5," ",'0','1','L','1');
//- Tabellenkopf -
$pdf->SetFillColor(90,90,90); $pdf->SetTextColor(255,255,255); $pdf->SetFont('Helvetica','B',10);
$pdf->Cell(8,5," ",'0','0','L','0');
$pdf->Cell(10,5,"Pos",'1','0','L','1');
$pdf->Cell(70,5,"Artikelbeschreibung",'1','0','L','1');
$pdf->Cell(20,5,"MwSt.",'1','0','R','1');
$pdf->Cell(18,5,"Anzahl",'1','0','R','1');
$pdf->Cell(30,5,"Einzelpreis",'1','0','R','1');
$pdf->Cell(30,5,"Gesamtpreis",'1','1','R','1');
//- Tabelle -
$pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0,0,0); $pdf->SetFont('Helvetica','',10);
//------------------------------------------------------------------------------------------------- Schleife Anfang
if($adata['1']['Beschreibung2']!="") {
$pdf->Cell(8,5," ",'0','0','L','0');
$pdf->Cell(10,5,$adata['1']['pos'],'LR','0','L','0');
$pdf->Cell(70,5,utf8_decode($adata['1']['Beschreibung1']),'LR','0','L','0');
$pdf->Cell(20,5,$adata['1']['mwst']." %",'LR','0','R','0');
$pdf->Cell(18,5,$adata['1']['menge'],'LR','0','R','0');
$pdf->Cell(30,5,$adata['1']['epreis']." EUR",'LR','0','R','0');
/*** Preisberechnung ***/ $tmpgpreis=$adata['1']['menge']*$adata['1']['epreis']; $endpreis=$endpreis+$tmpgpreis;
$pdf->Cell(30,5,$tmpgpreis." EUR",'LR','1','R','0');
} else {
$pdf->Cell(8,5," ",'0','0','L','0');
$pdf->Cell(10,5,$adata['1']['pos'],'BRL','0','L','0');
$pdf->Cell(70,5,utf8_decode($adata['1']['Beschreibung1']),'BRL','0','L','0');
$pdf->Cell(20,5,$adata['1']['mwst']." %",'BRL','0','R','0');
$pdf->Cell(18,5,$adata['1']['menge'],'BRL','0','R','0');
$pdf->Cell(30,5,$adata['1']['epreis']." EUR",'BRL','0','R','0');
/*** Preisberechnung ***/ $tmpgpreis=$adata['1']['menge']*$adata['1']['epreis']; $endpreis=$endpreis+$tmpgpreis;
$pdf->Cell(30,5,$tmpgpreis." EUR",'BRL','1','R','0');
}
if($adata['1']['Beschreibung2']!="") {
if($adata['1']['Beschreibung3']!="") {
$pdf->Cell(8,5," ",'0','0','L','0');
$pdf->Cell(10,5," ",'LR','0','L','0');
$pdf->Cell(70,5,utf8_decode($adata['1']['Beschreibung2']),'LR','0','L','0');
$pdf->Cell(20,5," ",'LR','0','R','0');
$pdf->Cell(18,5," ",'LR','0','R','0');
$pdf->Cell(30,5," ",'LR','0','R','0');
$pdf->Cell(30,5," ",'LR','1','R','0');
} else {
$pdf->Cell(8,5," ",'0','0','L','0');
$pdf->Cell(10,5," ",'BRL','0','L','0');
$pdf->Cell(70,5,utf8_decode($adata['1']['Beschreibung2']),'BRL','0','L','0');
$pdf->Cell(20,5," ",'BRL','0','R','0');
$pdf->Cell(18,5," ",'BRL','0','R','0');
$pdf->Cell(30,5," ",'BRL','0','R','0');
$pdf->Cell(30,5," ",'BRL','1','R','0');
}
}
if($adata['1']['Beschreibung3']!="") {
if($adata['1']['Beschreibung4']!="") {
$pdf->Cell(8,5," ",'0','0','L','0');
$pdf->Cell(10,5," ",'RL','0','L','0');
$pdf->Cell(70,5,utf8_decode($adata['1']['Beschreibung3']),'RL','0','L','0');
$pdf->Cell(20,5," ",'RL','0','R','0');
$pdf->Cell(18,5," ",'RL','0','R','0');
$pdf->Cell(30,5," ",'RL','0','R','0');
$pdf->Cell(30,5," ",'RL','1','R','0');
} else {
$pdf->Cell(8,5," ",'0','0','L','0');
$pdf->Cell(10,5," ",'BRL','0','L','0');
$pdf->Cell(70,5,utf8_decode($adata['1']['Beschreibung3']),'BRL','0','L','0');
$pdf->Cell(20,5," ",'BRL','0','R','0');
$pdf->Cell(18,5," ",'BRL','0','R','0');
$pdf->Cell(30,5," ",'BRL','0','R','0');
$pdf->Cell(30,5," ",'BRL','1','R','0');
}
}
if($adata['1']['Beschreibung4']!="") {
$pdf->Cell(8,5," ",'0','0','L','0');
$pdf->Cell(10,5," ",'BRL','0','L','0');
$pdf->Cell(70,5,utf8_decode($adata['1']['Beschreibung4']),'BRL','0','L','0');
$pdf->Cell(20,5," ",'BRL','0','R','0');
$pdf->Cell(18,5," ",'BRL','0','R','0');
$pdf->Cell(30,5," ",'BRL','0','R','0');
$pdf->Cell(30,5," ",'BRL','1','R','0');
}
//gesamtsumme
// $pdf->Cell(25,8," ",'0','1','R','1');
$pdf->Cell(8,5," ",'0','0','L','0'); $pdf->Cell(178,4," ",'T','1','R','0');
$pdf->Cell(8,5," ",'0','0','L','0'); $pdf->Cell(178,4," ",'B','1','R','0');
$pdf->Cell(141,4," ",'0','1','L','0');
$pdf->Cell(151,4,"Zwischensumme:",'0','0','R','1'); $pdf->Cell(37,4,(sprintf("%01.2f",$firmapreis))." EUR",'0','1','R','1');
$steuer=$firmapreis*19/100;
$pdf->Cell(151,4,"zzgl. 19% MwSt.",'0','0','R','1'); $pdf->Cell(37,4,(sprintf("%01.2f",$steuer))." EUR",'0','1','R','1');
$betrag=$firmapreis+$steuer;
$pdf->Cell(151,4,"Gesamtbetrag:",'0','0','R','1'); $pdf->Cell(37,4,(sprintf("%01.2f",$betrag))." EUR",'0','1','R','1');
if($betrag>9999) {
$pdf->Cell(188,4,"===========",'0','1','R','1');
} else {
$pdf->Cell(188,4,"============",'0','1','R','1');
}
//---------
$pdf->Output('stornorechnung_'.($renr).'.pdf','I');
exit();
?>