<?php

include("kurs/datenbankanbindung.php"); // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php

$uid1=$_COOKIE["uid1"];





error_reporting (E_ALL);



define('FPDF_FONTPATH','font/');

require('as_utf_class.php');



$pdf= new utfFPDF();





$pagecount = $pdf->setSourceFile("praxisstellen.pdf");



$tplidx = $pdf->ImportPage(1);



$db = dbconnect();



$res = $db->query("SELECT mtknr, nachname, vorname, postrasse, poort, poplz FROM stud WHERE uid='$uid1'");

$row = $res->fetch_array();







$pdf->addPage();

$pdf->useTemplate($tplidx,0,0,0);

$pdf->SetFont('Arial', '', 11);

$pdf->SetY(26);

$pdf->SetX(24);

$pdf->Cell(0, 3, "Matrikelnr.: $row[mtknr]" , 0, 0, 'L');





$pdf->SetFont('Arial', '', 7);

$pdf->SetY(52);

$pdf->SetX(24);

$pdf->Cell(0, 3, "$row[vorname] $row[nachname]  -  $row[postrasse]  -  $row[poplz] $row[poort]", 0, 0, 'L');





$pdf->SetLineWidth(0.2);



// Linie zeichnen

$pdf->Line(23, 55, 100, 55); 





$query = "SELECT bezeichnung, bereich, str, plz, ort, sachbereich, DATE_FORMAT(beginn, '%d.%m.%Y') beginn, DATE_FORMAT(beginn, '%Y%m%d') beginnform, DATE_FORMAT(ende, '%d.%m.%Y') ende

	    FROM stan_antrag t1

	   WHERE t1.status = (

	                      SELECT MAX(t2.status)

	                        FROM stan_antrag t2

	                       WHERE t1.aendid = t2.aendid

	                     )

             AND t1.uid = '$uid1'

             AND (t1.zuweisung is NULL OR t1.zuweisung='Z')

           ORDER BY beginnform";

         

$result = $db->query ($query)

   or die ("Cannot execute query");

$ln_Y = 128;

while ($row1 = $result->fetch_array()){



$res2 = $db->query("SELECT bezeichnung FROM stan_stellenbereiche WHERE sbid='$row1[sachbereich]'");

$row2 = $res2->fetch_array();



$pdf->SetY($ln_Y);

$pdf->SetX(30);

$pdf->SetFont('Arial', '', 10);

$pdf->MultiCell(38, 3,"$row1[bezeichnung]\n$row1[str]\n$row1[plz] $row1[ort]", 0, 'L');



$pdf->SetY($ln_Y);

$pdf->SetX(70);

$pdf->SetFont('Arial', '', 10);

$pdf->MultiCell(39, 4,"$row1[bereich]", 0, 'L');



$pdf->SetY($ln_Y);

$pdf->SetX(110);

$pdf->SetFont('Arial', '', 10);

$pdf->MultiCell(39, 4,"$row2[bezeichnung]", 0, 'L');



$pdf->SetY($ln_Y);

$pdf->SetX(150);

$pdf->SetFont('Arial', '', 10);

$pdf->MultiCell(39, 4,"$row1[beginn] - $row1[ende]", 0, 'L');



$ln_Y = $ln_Y + '20'; // 20mm nach unten verschieben bei jedem durchlauf

}





$pdf->Output("newpdf.pdf","i");

$pdf->closeParsers();

?>