"") { $adresszusatz = $bill[adresszusatz]."\n"; } else { $adresszusatz = ""; } $select_f = mysql_db_query($db_name_vvw,"select * from vvw_contacts where contact_id = '$_REQUEST[contact_id]' "); $contact = mysql_fetch_array($select_f); if(isset($vat)) { $vat = $vat; } else { $vat = $contact[brutto_netto]; } if(empty($vat)) { $vat = 'b'; } $firma = $contact[firma]; if($contact[nachname] || $contact[vorname]) { $kundeansprechpartner = $contact[vorname]." ".$contact[nachname]."\n"; } else { $kundeansprechpartner = ""; } $bill_adresszusatz = $contact[adresszusatz]; $strasse = $contact[strasse]; $plz = $contact[plz]; $ort = $contact[ort]; $land = $contact[land]; $contact_id = $bill[contact_id]; $ustid = $contact[ustid]; //if($bill[adresszusatz] <> "") { $adresszusatz = $bill[adresszusatz]."\n"; } else { $adresszusatz = ""; } $datum = $bill[datum]; $dt = explode("-", $datum); $scheedatum = $dt[2].".".$dt[1].".".$dt[0]; $year = $dt[0]; $bill_id = $bill[bill_id]; $freitext = $bill[freitext]; $lieferanschrift = $bill[lieferanschrift]; $produkt = $bill[produkt]; $zahlart = $bill[zahlart]; $netto = $bill[netto]; $mwst = $bill[mwst]; $brutto = $bill[brutto]; $bearbeiter = $bill[bearbeiter]; // rechnungsempfänger auswählen $adresszusatz = str_replace("trasse","traße",$adresszusatz); // anschriftdaten aus dem kundenstamm if($firma <> "") { $bill_cnee .= $firma."\n"; } if($bill_adresszusatz <> "") { $bill_cnee .= $bill_adresszusatz."\n"; } if($kundeansprechpartner <> "") { $bill_cnee .= $kundeansprechpartner.""; } $bill_cnee .= $strasse."\n"; $bill_cnee .= $plz." ".$ort; if($land != "Deutschland") { $bill_cnee .= "\n".$land; } $euro = iconv('UTF-8', 'windows-1252', "€"); // betreff $subject = iconv('UTF-8', 'windows-1252', 'Folgend finden Sie eine Liste aller offenen Rechnungen:'); // initiate FPDI $pdf = new FPDI(); // add a page $pdf->AddPage("P", "A4"); $pdf->setSourceFile('/home/rostrdbn/admin.rostroth.de/pages/rechnungen/layout/templates/r2.pdf'); // import page 1 $tplIdx = $pdf->importPage(1); // use the imported page and place it at position 10,10 with a width of 100 mm $pdf->useTemplate($tplIdx, 0, 0, 210); $pdf->AddFont('Opensans-regular', '', 'Opensans-regular.php'); $pdf->AddFont('Opensans-bold', '', 'Opensans-bold.php'); // now write some text above the imported page $pdf->SetFont('Opensans-regular', '', '9'); $pdf->SetTextColor(000, 0, 0); $pdf->SetXY(28, 53); /* ADRESSAT Breite 180mm, Höhe 10mm $string = Text schreiben 1 = mit Rahmen zeichnen L = Text linkbündig 1 = mit Füllung */ $pdf->MultiCell( 100, 5, $bill_cnee , 0, 'L', 0); $pdf->Ln(0); // rechnungsspalte $pdf->SetFont('Opensans-bold', '', '24'); $pdf->SetXY(28, 90.5); $pdf->Write(0, 'OFFENE POSTEN'); $pdf->SetFont('Opensans-regular', '', '8'); $pdf->SetXY(140, 88.5); $pdf->Write(0, 'Kunden-Nummer: '.$_REQUEST['contact_id']); $pdf->SetFont('Opensans-bold', '', '8'); $pdf->SetXY(158, 88.5); $pdf->Write(0, $kundeoderid); $pdf->SetFont('Opensans-regular', '', '8'); $pdf->SetXY(140, 92); $pdf->Write(0, 'Datum: '. date("d.m.Y")); $pdf->SetFont('Opensans-bold', '', '8'); $pdf->SetXY(158, 92); $pdf->Write(0, $scheedatum); $pdf->SetFont('Opensans-regular', '', '9'); $pdf->SetXY(28, 99); $pdf->Write(0, $subject); $pdf->SetFont('Opensans-regular', '', '6'); $pdf->SetXY(28, 104); $pdf->Cell(15,5,'RECHNUNG.','0','','C'); $pdf->Cell(3,5,'','0','','L'); $pdf->Cell(80,5,"STICHWORT",'0'); $pdf->Cell(10,5,"RECHNUNGSDATUM",'0','','R'); $pdf->Cell(20,5,"MAHNSTUFE",'0','','R'); $pdf->Cell(5,5,"",'0','','R'); $pdf->Cell(20,5,"NETTO",'0','','R'); $pdf->Cell(20,5,"BRUTTO",'0','','R'); $pdf->Ln(5); $pdf->SetDrawColor(0, 0, 0); $pdf->SetLineWidth(0.2); $pdf->Line(29, 108, 202.7, 108); $pdf->SetFont('Opensans-regular', '', '8'); $gesamtpreis = 0; $x = "28"; $y = "108"; $get_pos1 = mysql_db_query($db_name_vvw,"select * from rr_bills where contact_id = '$_REQUEST[contact_id]' and status != 'PAID' order by datum DESC"); while($get_pos = mysql_fetch_array($get_pos1)) { $gesamtpreis = $gesamtpreis+$get_pos['brutto']; if($get_pos['status'] == "BILLED") { $mahnstufe = "0"; } if($get_pos['status'] == "REMINDED1") { $mahnstufe = "1"; } if($get_pos['status'] == "REMINDED2") { $mahnstufe = "2"; } if($get_pos['status'] == "INKASSO") { $mahnstufe = "3"; } if(isset($oink)) { $diff = $oink-$y; } if($oink > $y) { $diff = $oink-$y; } $y = $y+$diff+2; $pdf->SetXY($x, $y+1); //anzahl $pdf->MultiCell(15, 1, "R".$get_pos['bill_id'], 0, C,0); //beschreibung $pdf->SetXY($x + 18, $y); $pdf->MultiCell(98, 3, $get_pos['stichwort'], 0,L,0); $oink = $pdf->GetY(); // ust satz $pdf->SetXY($x + 79, $y); $pdf->MultiCell(30, 3, date("d.m.Y", strtotime($get_pos['datum'])), 0,C,0); //einzelpreis brutto $pdf->SetXY($x + 97, $y); $pdf->MultiCell(24, 3, $mahnstufe, 0,R,0); // NETTO $pdf->SetXY($x + 129, $y); $pdf->MultiCell(24, 3, $get_pos['netto']." ".$euro, 0,R,0); // BRUTTO $pdf->SetXY($x + 149, $y); $pdf->MultiCell(24, 3, $get_pos['brutto']." ".$euro, 0,R,0); $oink2 = $pdf->GetY(); unset($mahnstufe); } if($oink > $y) { $diff = $oink-$y; } $y = $y+$diff-2; $pdf->SetDrawColor(0, 0, 0); $pdf->SetLineWidth(0.2); $y = $y+4; $pdf->Line(29, $y, 202.7, $y); //// //echo $y; if($y > 250 && $addpageexit != "1") { $pdf->AddPage(); //page break. $x = 28; $y = 100; $template = '/home/rostrdbn/admin.rostroth.de/pages/rechnungen/layout/templates/'.$bill[produkt].'.pdf'; if (file_exists($template)) { $pdf->setSourceFile('/home/rostrdbn/admin.rostroth.de/pages/rechnungen/layout/templates/'.$bill[produkt].'.pdf'); } else{ $pdf->setSourceFile('/home/rostrdbn/admin.rostroth.de/pages/rechnungen/layout/templates/r2.pdf'); } // import page 1 $tplIdx = $pdf->importPage(1); // use the imported page and place it at position 10,10 with a width of 100 mm $pdf->useTemplate($tplIdx, 0, 0, 210); $addpageexit = 1; } ///// if($vat == "n") { $pdf->SetFont('Opensans-bold', '', '8'); $y = $y+2; $pdf->SetXY($x + 113, $y); $pdf->MultiCell(40, 3, "Gesamt offen brutto:", 0,R,0); $oink = $pdf->GetY(); //gesamtpreis NETTO $pdf->SetXY($x + 149, $y); $pdf->MultiCell(24, 3, number_format($gesamtpreis, 2, ',', '')." ".$euro, 0,R,0); } //$pdf->Output('/home/rostrdbn/admin.rostroth.de/rechnungen/RE'.$bill[bill_id].'.pdf','F'); $pdf->Output('OP_Kunde: #'.$contact['contact_id'].'.pdf','I'); ?>