Image('logo.png',20,10,80); $this->Ln(2); $this->SetFont('Arial','B',7); $this->Cell(10); // Zeile 1 $this->Cell(50,10,'',0,0,'L'); $this->Cell(50); $this->SetFont('Arial','',8); $this->Cell(78,10,'Helingerstr. 10',0,0,'R'); // Zeile 2 $this->Ln(3); $this->Cell(10); $this->SetFont('Arial','',8); $this->Cell(50,10,'',0,0,'L'); $this->Cell(50); $this->Cell(78,10,'87480 Weitnau',0,0,'R'); // Leerzeile $this->Ln(3); $this->Cell(10); $this->SetFont('Arial','B',8); $this->Cell(50,10,'',0,0,'L'); $this->Cell(50); $this->SetFont('Arial','',7); $this->Cell(78,10,'',0,0,'L'); $this->Ln(3); $this->Cell(10); $this->SetFont('Arial','B',7); $this->Cell(50,10,'',0,0,'L'); $this->Cell(50); $this->SetFont('Arial','',8); $this->Cell(78,10,'Tel. 08378-9329031',0,0,'R'); $this->Ln(3); $this->Cell(10); $this->SetFont('Arial','B',7); $this->Cell(50,10,'',0,0,'L'); $this->Cell(50); $this->SetFont('Arial','',8); $this->Cell(78,10,'Fax. 08378-9329032',0,0,'R'); // Mailadresse $this->Ln(5); $this->Cell(10); $this->SetFont('Arial','',8); $this->Cell(50,10,'',0,0,'L'); $this->Cell(50); $this->Cell(78,10,'mail@officexmedia.com',0,0,'R'); $this->Ln(3); $this->Cell(10); $this->SetFont('Arial','',8); $this->Cell(50,10,'',0,0,'L'); $this->Cell(50); $this->Cell(78,10,'www.officexmedia.com',0,0,'R'); } //Page footer function Footer() { global $text_lang; //Position at 1.5 cm from bottom $this->SetY(-45); //Arial italic 8 $this->SetFont('Arial','',7); $this->Cell(10); $this->MultiCell(175,3,$text_lang,0,'J',0); $this->Ln(2); // Roter Strich $this->SetFillColor(192,0,0); $this->Cell(11); $this->Cell(175,1,'',0,0,'L','1'); $this->Ln(2); /* $this->SetDrawColor(192,0,0); $this->Line(21,265,193,265); */ // Verweis auf AGBS $this->Cell(10); $this->Cell(40,10,'Es gelten unsere Allgemeinen Geschäftsbedingungen in der derzeit aktuellen Fassung (www.officexmedia.com/agb)',0,0,'L','0'); //Page number $this->Ln(5); $this->Cell(10); $this->Cell(40,10,'officeXmedia GmbH',0,0,'L'); $this->Cell(5); $this->Cell(40,10,'Tel: 08378-9329031',0,0,'L'); $this->Cell(5); $this->Cell(40,10,'Bankverbindung',0,0,'L'); $this->Cell(5); $this->Cell(40,10,'Amtsgericht Kempten',0,0,'L'); $this->Ln(3); $this->Cell(10); $this->Cell(40,10,'Geschäftsführer',0,0,'L'); $this->Cell(5); $this->Cell(40,10,'Fax: 083789329032',0,0,'L'); $this->Cell(5); $this->Cell(40,10,'Sparkasse Allgäu',0,0,'L'); $this->Cell(5); $this->Cell(40,10,'HRB 8679',0,0,'L'); $this->Ln(3); $this->Cell(10); $this->Cell(40,10,'Holger Neuner &',0,0,'L'); $this->Cell(5); $this->Cell(40,10,'Support: 0700-77555000',0,0,'L'); $this->Cell(5); $this->Cell(40,10,'BLZ 733 500 00',0,0,'L'); $this->Cell(5); $this->Cell(40,10,'Steuernummer 127/134/30178',0,0,'L'); $this->Ln(3); $this->Cell(10); $this->Cell(40,10,'Ingo Hofer',0,0,'L'); $this->Cell(5); $this->Cell(40,10,'info@officexmedia.com',0,0,'L'); $this->Cell(5); $this->Cell(40,10,'Konto 610 488 041',0,0,'L'); $this->Cell(5); $this->Cell(40,10,'',0,0,'L'); } } /* Die Klasse ansich */ $pdf=new PDF(); $pdf->Open(); $pdf->AliasNbPages(); $pdf->AddPage(); // ************************ // Auslesen der Kundendaten // ************************ $query_kunde = "SELECT * FROM kunden WHERE kunde_id='$kunde_id'"; $result_kunde = mysql_query($query_kunde); while ($row=mysql_fetch_array($result_kunde)) { $kunde_firma = $row['kunde_firma']; $kunde_anrede = $row['kunde_anrede']; $kunde_vorname = $row['kunde_vorname']; $kunde_name = $row['kunde_name']; $kunde_adresse = $row['kunde_adresse']; $kunde_plz = $row['kunde_plz']; $kunde_ort = $row['kunde_ort']; } // Betreffzeile $rechnung_rechnungsnummer="RECHNUNG NR. $rechnungsnummer"; $rechnung_rechnungsdatum="Rechnungsdatum: $datum_rechnung"; $rechnung_kundennummer="Kundennummer: $empfaenger_kundennummer"; // einzelne Adressezeile $pdf->Ln(13); $pdf->SetFont('Arial','',6); $pdf->Cell(10); $pdf->Cell(60,10,'officeXmedia GmbH , Helingerstr.10, 87480 Weitnau',0,0); $pdf->Line(21,51,99,51); $pdf->SetFont('Arial','B',12); $pdf->Cell(45); $pdf->Cell(73,10,$rechnung_rechnungsnummer,0,0,R); // Anzeige der Empfaenger Adresse $pdf->Ln(7); $pdf->SetFont('Arial','B',8); $pdf->Cell(10); $pdf->Cell(60,10,$kunde_firma,0,0); $pdf->Cell(45); $pdf->Cell(73,10,$rechnung_rechnungsdatum,0,0,R); $kunde_vorname_name="$kunde_vorname $kunde_name"; $pdf->Ln(3); $pdf->Cell(10); $pdf->Cell(60,10,$kunde_vorname_name,0,0); $pdf->Cell(45); $pdf->Cell(73,10,$rechnung_kundennummer,0,0,R); $pdf->Ln(3); $pdf->Cell(10); $pdf->Cell(60,10,$kunde_adresse,0,0); $pdf->Cell(45); $pdf->SetFont('Arial','I',8); $pdf->Cell(73,10,'(Bitte immer angeben)',0,0,R); $kunde_plz_ort="$kunde_plz $kunde_ort"; $pdf->Ln(5); $pdf->SetFont('Arial','B',9); $pdf->Cell(10); $pdf->Cell(60,10,$kunde_plz_ort,0,0); $kunde_anredezeile="Sehr geehrte(r) $kunde_anrede $kunde_name,"; // Anrede des Kunden $pdf->Ln(20); $pdf->SetFont('Arial','',8); $pdf->Cell(10); $pdf->Cell(60,10,$kunde_anredezeile,0,0); $pdf->Ln(6); $pdf->Cell(10); $pdf->Cell(60,10,'wir bedanken uns für Ihren Auftrag/Bestellung und erlauben uns folgendes zu berechnen:',0,0); $pdf->Ln(10); // Zeilenüberschrift Tabelle $pdf->SetFillColor(200,200,200); $pdf->SetFont('Arial','B',7); $pdf->Cell(10); $pdf->Cell(7,5,'Pos',0,0,'L',1); $pdf->Cell(1); $pdf->Cell(10,5,'Menge',0,0,'L',1); $pdf->Cell(1); $pdf->Cell(15,5,'Einheit',0,0,'L',1); $pdf->Cell(1); $pdf->Cell(85,5,'Beschreibung',0,0,'L',1); $pdf->Cell(1); $pdf->Cell(10,5,'MwSt.',0,0,'L',1); $pdf->Cell(1); $pdf->Cell(20,5,'Einzelpreis in €',0,0,'R',1); $pdf->Cell(1); $pdf->Cell(21,5,'Gesamtpreis in €',0,0,'R',1); // ******************************* // Beginn Tabellarische Auflistung // ******************************* // Beginn der Auflistung $pdf->Ln(10); $query_2 = "SELECT * FROM faktura_positionen WHERE faktura_id='$faktura_id' ORDER BY pos ASC"; $result_2 = mysql_query($query_2); // Definieren der x und y Achse $ya="99"; $count_zeile = 0; while ($row=mysql_fetch_array($result_2)) { if($count_zeile=="9") { $count_zeile = 0; $pdf->AddPage(); $ya=50; $pdf->SetX(10); $pdf->SetY(62); } $count=$count+1; $count_zeile = $count_zeile+1; $ya=$ya+12; $pos = $row['pos']; $menge = $row['menge']; $einheit = $row['einheit']; $beschreibung = $row['beschreibung']; $preis = $row['preis']; $preis = number_format($preis,2, ",", "."); $mwst = $row['mwst']; $betrag = $row['betrag']; $betrag = number_format($betrag,2, ",", "."); $pdf->SetFillColor(210,210,210); $pdf->SetFont('Arial','',7); $pdf->Cell(10); $pdf->Cell(7,5,$pos,0,0,'L',1); $pdf->Cell(1); $pdf->Cell(10,5,$menge,0,0,'L',1); $pdf->Cell(1); $pdf->Cell(15,5,$einheit,0,0,'L',1); $pdf->Cell(1); $pdf->MultiCell(85,5,$beschreibung,0,'L',1); $pdf->SetY($ya); $pdf->SetX(140); $pdf->Cell(1); $pdf->Cell(10,5,$mwst,0,0,'L',1); $pdf->Cell(1); $pdf->Cell(20,5,$preis,0,0,'R',1); $pdf->Cell(1); $pdf->Cell(21,5,$betrag,0,0,'R',1); $pdf->Ln(12); } // ************************************** // Auslesen der Mwst und des Gesambetrages // ************************************** /* Auslesen Summe der Beträge mit MwST 7 % */ $query_mwst_7 = "SELECT betrag, SUM(betrag) AS betrag_mwst_7 FROM faktura_positionen WHERE faktura_id='$faktura_id' AND mwst='7' GROUP BY faktura_id"; $result_mwst_7 = mysql_query($query_mwst_7); while ($row=mysql_fetch_array($result_mwst_7)) { $betrag_mwst_7=$row['betrag_mwst_7']; $betrag_mwst_7_inkl = $betrag_mwst_7*1.07; $betrag_mwst_7_enthalten = $betrag_mwst_7_inkl-$betrag_mwst_7; $betrag_mwst_7_enthalten = number_format($betrag_mwst_7_enthalten,2,",","."); $betrag_mwst_7_enthalten = "$betrag_mwst_7_enthalten €"; } /* Auslesen Summe der Beträge mit MwST 16 % */ $query_mwst_16 = "SELECT betrag, SUM(betrag) AS betrag_mwst_16 FROM faktura_positionen WHERE faktura_id='$faktura_id' AND mwst='16' GROUP BY faktura_id"; $result_mwst_16 = mysql_query($query_mwst_16); while ($row=mysql_fetch_array($result_mwst_16)) { $betrag_mwst_16=$row['betrag_mwst_16']; $betrag_mwst_16_inkl = $betrag_mwst_16*1.16; $betrag_mwst_16_enthalten = $betrag_mwst_16_inkl - $betrag_mwst_16; $betrag_mwst_16_enthalten = number_format($betrag_mwst_16_enthalten,2,",","."); $betrag_mwst_16_enthalten = "$betrag_mwst_16_enthalten €"; } /* Auslesen Gesamtbetrag netto */ $query_betrag_netto = "SELECT betrag, SUM(betrag) AS betrag_netto FROM faktura_positionen WHERE faktura_id='$faktura_id' GROUP BY faktura_id"; $query_betrag_netto = mysql_query($query_betrag_netto); while ($row=mysql_fetch_array($query_betrag_netto)) { $betrag_netto = $row['betrag_netto']; $betrag_netto = number_format($betrag_netto,2,",","."); $betrag_netto = "$betrag_netto €"; } /* Auslesen Gesamtbetrag brutto */ $query_betrag_brutto = "SELECT betrag_brutto, SUM(betrag_brutto) AS betrag_brutto FROM faktura_positionen WHERE faktura_id='$faktura_id' GROUP BY faktura_id"; $query_betrag_brutto = mysql_query($query_betrag_brutto); while ($row=mysql_fetch_array($query_betrag_brutto)) { $betrag_brutto = $row['betrag_brutto']; $betrag_brutto = number_format($betrag_brutto,2,",","."); $betrag_brutto = "$betrag_brutto €"; } $pdf->SetFillColor(240,240,240); $pdf->SetFont('Arial','B',7); $pdf->Cell(10); $pdf->Cell(7); $pdf->Cell(1); $pdf->Cell(10); $pdf->Cell(1); $pdf->Cell(50,5,'',0,0,'L',0); $pdf->Cell(1); $pdf->Cell(60,5,'',0,0,'L',0); $pdf->Cell(1); $pdf->Cell(20); $pdf->Cell(1); $pdf->Cell(21,5,'',0,0,'R',0); $pdf->Ln(6); $pdf->SetFillColor(240,240,240); $pdf->SetFont('Arial','',7); $pdf->Cell(10); $pdf->Cell(7); $pdf->Cell(1); $pdf->Cell(10); $pdf->Cell(1); $pdf->Cell(50,5,'Nettobetrag',0,0,'L',0); $pdf->Cell(1); $pdf->Cell(60,5,'',0,0,'L',0); $pdf->Cell(1); $pdf->Cell(20); $pdf->Cell(1); $pdf->Cell(21,5,$betrag_netto,0,0,'R',1); $pdf->Ln(6); $pdf->SetFillColor(240,240,240); $pdf->SetFont('Arial','',7); $pdf->Cell(10); $pdf->Cell(7); $pdf->Cell(1); $pdf->Cell(10); $pdf->Cell(1); $pdf->Cell(50,5,'zzgl. 7 % Mehrwertsteuer',0,0,'L',0); $pdf->Cell(1); $pdf->Cell(60,5,'',0,0,'L',0); $pdf->Cell(1); $pdf->Cell(20); $pdf->Cell(1); $pdf->Cell(21,5,$betrag_mwst_7_enthalten,0,0,'R',1); $pdf->Ln(6); $pdf->SetFillColor(240,240,240); $pdf->SetFont('Arial','',7); $pdf->Cell(10); $pdf->Cell(7); $pdf->Cell(1); $pdf->Cell(10); $pdf->Cell(1); $pdf->Cell(50,5,'zzgl. 16 % Mehrwertsteuer',0,0,'L',0); $pdf->Cell(1); $pdf->Cell(60,5,'',0,0,'L',0); $pdf->Cell(1); $pdf->Cell(20); $pdf->Cell(1); $pdf->Cell(21,5,$betrag_mwst_16_enthalten,0,0,'R',1); $pdf->Ln(6); $pdf->SetFillColor(240,240,240); $pdf->SetFont('Arial','B',8); $pdf->Cell(10); $pdf->Cell(7); $pdf->Cell(1); $pdf->Cell(10); $pdf->Cell(1); $pdf->Cell(50,5,'Gesamtbetrag brutto',0,0,'L',0); $pdf->Cell(1); $pdf->Cell(60,5,'',0,0,'L',0); $pdf->Cell(1); $pdf->Cell(20); $pdf->Cell(1); $pdf->Cell(21,5,$betrag_brutto,0,0,'R',1); // Faelligkeitsdatum $pdf->Ln(10); $pdf->SetFillColor(240,240,240); $pdf->SetFont('Arial','',8); $pdf->Cell(10); $pdf->Cell(7); $pdf->Cell(1); $pdf->Cell(10); $pdf->Cell(1); $pdf->Cell(50,5,$rechnung_faelligkeit,0,0,'L',0); $pdf->Ln(15); $pdf->SetFont('Arial','B',8); $pdf->Cell(10); $pdf->Cell(7); $pdf->Cell(1); $pdf->Cell(10); $pdf->Cell(1); $pdf->Cell(100,5,$text_kurz,0,0,'L',0); // Ausgabe der gesamten Datei $pdf->Output(); // Ende Schleife } ?>