<?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("zustimmung.pdf");



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



$db = dbconnect();



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

$row_hs = $res_hs->fetch_array();





$query = "SELECT t1.dst_id

               , t1.vert_bereich

               , DATE_FORMAT(t1.beginn, '%d.%m.%Y') beginn

               , DATE_FORMAT(t1.beginn, '%Y%m%d') beginnform

               , DATE_FORMAT(t1.ende, '%d.%m.%Y') ende

               , t1.abteilung

            FROM stan_antrag t1

           WHERE t1.status = (

                               SELECT MAX(t2.status)

                                 FROM stan_antrag t2

                                WHERE t1.aendid = t2.aendid

                                  AND t2.status !='2' #hinzugefügt am 10.06.2009, weil Status 2 angezeigt wurde

                              )

              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");



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





$res4 = $db->query("SELECT bez, ort, str, plz FROM stan_dienststellen WHERE dst_id='$row1[dst_id]'");

$row4 = $res4->fetch_array();

if($row4[bez] != ''){

  $dst_bez = $row4[bez]." ".$row4[name];

  $ort = $row4[ort];

  $str = $row4[str];

  $plz = $row4[plz];

}else{

  $res5 = $db->query("SELECT bez, ort, str, plz FROM stan_dienststellen_tmp WHERE dst_id='$row1[dst_id]'");

  $row5 = $res5->fetch_array();

  $dst_bez = $row5[bez]." ".$row5[name];

  $ort = $row5[ort];

  $str = $row5[str];

  $plz = $row5[plz];

}



$res2 = $db->query("SELECT bezeichnung FROM stan_vertiefungsbereich WHERE vbid='$row1[vert_bereich]'");

$row2 = $res2->fetch_array();





$pdf->addPage();

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

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

$pdf->SetY(60);

$pdf->SetX(24);

$pdf->Cell(0, 3, "$row_hs[vorname] $row_hs[nachname]", 0, 0, 'L');





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

$pdf->SetY(65);

$pdf->SetX(24);

$pdf->Cell(0, 3, "$row_hs[postrasse]", 0, 0, 'L');





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

$pdf->SetY(74);

$pdf->SetX(24);

$pdf->Cell(0, 3, "$row_hs[poplz] $row_hs[poort]", 0, 0, 'L');





$pdf->SetY(135);

$pdf->SetX(24);

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

$pdf->MultiCell(160, 4,"$dst_bez", 0, 'L');



$pdf->SetY(140);

$pdf->SetX(24);

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

$pdf->MultiCell(160, 4,"$str", 0, 'L');



$pdf->SetY(145);

$pdf->SetX(24);

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

$pdf->MultiCell(160, 4,"$plz $ort", 0, 'L');





$pdf->SetY(157);

$pdf->SetX(24);

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

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





$pdf->SetY(170);

$pdf->SetX(24);

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

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





$pdf->SetY(184);

$pdf->SetX(24);

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

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





$pdf->SetY(197);

$pdf->SetX(24);

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

$pdf->MultiCell(160, 5,"Wir stimmen der Zuweisung von $row_hs[vorname] $row_hs[nachname] im Rahmen der praktischen Ausbildung im gehobenen nichttechnischen Verwaltungsdienst gem. § 23 AprOVw gD zu:", 0, 'L');

/*

$pdf->SetY(220);

$pdf->SetX(24);

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

$pdf->MultiCell(160, 3,"im gehobenen nichttechnischen Verwaltungsdienst gem.", 0, 'L');





$pdf->SetY(225);

$pdf->SetX(24);

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

$pdf->MultiCell(160, 3,"§ 17 Abs. 1 AprOVw gD zu:", 0, 'L');

*/





}





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

$pdf->closeParsers();

?>