1 line
6.5 KiB
PHP
Executable File
1 line
6.5 KiB
PHP
Executable File
<?php
|
|
|
|
include("kurs/datenbankanbindung.php"); // fügt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
|
|
|
|
$user_admin=$_COOKIE["user_admin"];
|
|
|
|
$uid=$_GET["uid"];
|
|
|
|
$hist=$_GET["hist"];
|
|
|
|
|
|
|
|
#$saaid = "1234|4567|1478|2584|99988";
|
|
|
|
#$saaid=substr($saaid, 0, -1); // Letztes Zeichen (das |) entfernen
|
|
|
|
#$saaidx = preg_split("/\|/", $saaid);
|
|
|
|
#$uid='51665';
|
|
|
|
|
|
|
|
|
|
|
|
$db = dbconnect();
|
|
|
|
if(!isset($hist)){
|
|
|
|
$queryb = $db->query ("SELECT count(distinct qid) Anz
|
|
|
|
FROM stan_printqueue_antrag a, stan_antrag b, stud c
|
|
|
|
WHERE (a.saaid=b.saaid or a.uid=b.uid)
|
|
|
|
AND b.uid=c.uid
|
|
|
|
AND b.uid='$uid'
|
|
|
|
AND druckstatus ='N'");
|
|
|
|
$row_cur_uid_anz = $queryb->fetch_array();
|
|
|
|
}else{
|
|
|
|
$queryb = $db->query ("SELECT count(distinct qid) Anz
|
|
|
|
FROM stan_printqueue_hist a, stan_antrag b, stud c
|
|
|
|
WHERE (a.saaid=b.saaid or a.uid=b.uid)
|
|
|
|
AND b.uid=c.uid
|
|
|
|
AND b.uid='$uid'
|
|
|
|
AND druckstatus ='N'");
|
|
|
|
$row_cur_uid_anz = $queryb->fetch_array();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($row_cur_uid_anz[Anz] > 0){
|
|
|
|
|
|
|
|
define('FPDF_FONTPATH','font/');
|
|
|
|
require('prints/as_utf_class.php');
|
|
|
|
require_once("prints/table_def.inc");
|
|
|
|
|
|
|
|
$pdf= new utfFPDF();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$pagecount = $pdf->setSourceFile("anschreiben/blanko_ludwigsburg.pdf");
|
|
|
|
#$pagecount = $pdf->setSourceFile("anschreiben/aenderung_praxisstelle.pdf");
|
|
|
|
|
|
|
|
$tplidx = $pdf->ImportPage(1);
|
|
|
|
|
|
|
|
|
|
|
|
# Briefe an den Student werden nur einmal gedruckt. Dort sind alle Praxisstellen darauf
|
|
|
|
$lnzaehler1 = 0;
|
|
|
|
$lnzaehler2 = 0;
|
|
|
|
$lnzaehler3 = 0;
|
|
|
|
|
|
|
|
|
|
|
|
$db = dbconnect();
|
|
|
|
if(!isset($hist)){
|
|
|
|
$querya = "SELECT a.saaid, b.uid, a.zuweisung, vorname, nachname,a.qid
|
|
|
|
FROM stan_printqueue_antrag a, stan_antrag b, stud c
|
|
|
|
WHERE a.saaid=b.saaid
|
|
|
|
AND b.uid=c.uid
|
|
|
|
AND b.uid='$uid'
|
|
|
|
AND druckstatus ='N'
|
|
|
|
AND a.zuweisung != 'SOZ'
|
|
|
|
ORDER BY uid,sort_order";
|
|
|
|
$resulta = $db->query ($querya)
|
|
|
|
or die ("Cannot execute query1");
|
|
|
|
}else{
|
|
|
|
$querya = "SELECT a.saaid, b.uid, a.zuweisung, vorname, nachname,a.qid
|
|
|
|
FROM stan_printqueue_hist a, stan_antrag b, stud c
|
|
|
|
WHERE a.saaid=b.saaid
|
|
|
|
AND b.uid=c.uid
|
|
|
|
AND b.uid='$uid'
|
|
|
|
AND druckstatus ='N'
|
|
|
|
AND a.zuweisung != 'SOZ'
|
|
|
|
ORDER BY uid,sort_order";
|
|
|
|
$resulta = $db->query ($querya)
|
|
|
|
or die ("Cannot execute query1");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
while ($row_cur_uid = $resulta->fetch_array())
|
|
|
|
{
|
|
|
|
|
|
|
|
$resultakt = $db->query("SELECT saaid, aendid, status, zuweisung, uid
|
|
|
|
FROM stan_antrag
|
|
|
|
WHERE saaid ='$row_cur_uid[saaid]'
|
|
|
|
");
|
|
|
|
$row_akt = $resultakt->fetch_array(); // Prüfen ob schon Änderungsanträge vorhanden
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$res_alt = $db->query("SELECT saaid, aendid, status, zuweisung
|
|
|
|
FROM stan_antrag
|
|
|
|
WHERE saaid<'$row_cur_uid[saaid]'
|
|
|
|
AND aendid='$row_akt[aendid]'
|
|
|
|
AND zuweisung!='NA'
|
|
|
|
ORDER BY saaid DESC
|
|
|
|
LIMIT 1");
|
|
|
|
$row_alt = $res_alt->fetch_array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($lnzaehler1 < 1 AND $row_cur_uid[zuweisung] == 'EZS'){
|
|
|
|
$pdf->addPage();
|
|
|
|
$pdf->useTemplate($tplidx,0,0,0);
|
|
|
|
$pdf->SetAutoPageBreak(true, 10);
|
|
|
|
require("anschreiben/zuweisung_erstantrag_student.php");
|
|
|
|
$lnzaehler1 =1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($row_cur_uid[zuweisung] == 'EZP'){
|
|
|
|
$pdf->addPage();
|
|
|
|
$pdf->useTemplate($tplidx,0,0,0);
|
|
|
|
$pdf->SetAutoPageBreak(true, 10);
|
|
|
|
require("anschreiben/zuweisung_erstantrag_praxisstelle.php");
|
|
|
|
}
|
|
|
|
|
|
|
|
if($lnzaehler2 < 1 AND $row_cur_uid[zuweisung] == 'AES'){
|
|
|
|
$pdf->addPage();
|
|
|
|
$pdf->useTemplate($tplidx,0,0,0);
|
|
|
|
$pdf->SetAutoPageBreak(true, 10);
|
|
|
|
require("anschreiben/zuweisung_aenderung_student.php");
|
|
|
|
$lnzaehler2 =1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($row_cur_uid[zuweisung] == 'AEP'){
|
|
|
|
$pdf->addPage();
|
|
|
|
$pdf->useTemplate($tplidx,0,0,0);
|
|
|
|
$pdf->SetAutoPageBreak(true, 10);
|
|
|
|
require("anschreiben/zuweisung_aenderung_praxisstelle.php");
|
|
|
|
}
|
|
|
|
|
|
|
|
$datum = date("Y-m-d H:i:s",time());
|
|
|
|
|
|
|
|
|
|
|
|
# 15.01.2010: Wurde innerhalb while schleife gezogen, da sonst der update mit Druckstatus=G nicht mehr funktionieren würde
|
|
|
|
|
|
|
|
if(!isset($hist)){
|
|
|
|
$sql_queue = $db->query("UPDATE stan_printqueue_antrag SET druckstatus='G', datum='$datum' WHERE qid='$row_cur_uid[qid]'");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Standortzuweisung
|
|
|
|
if(!isset($hist)){
|
|
|
|
$querya = "SELECT a.block, c.uid, a.zuweisung, vorname, nachname,a.qid
|
|
|
|
FROM stan_printqueue_antrag a, stud c
|
|
|
|
WHERE a.uid=c.uid
|
|
|
|
AND c.uid='$uid'
|
|
|
|
AND druckstatus ='N'
|
|
|
|
AND a.zuweisung = 'SOZ'
|
|
|
|
ORDER BY uid,sort_order";
|
|
|
|
$resulta = $db->query ($querya)
|
|
|
|
or die ("Cannot execute query1");
|
|
|
|
}else{
|
|
|
|
$querya = "SELECT a.block, c.uid, a.zuweisung, vorname, nachname,a.qid
|
|
|
|
FROM stan_printqueue_hist a, stud c
|
|
|
|
WHERE a.uid=c.uid
|
|
|
|
AND c.uid='$uid'
|
|
|
|
AND druckstatus ='N'
|
|
|
|
AND a.zuweisung = 'SOZ'
|
|
|
|
ORDER BY uid,sort_order";
|
|
|
|
$resulta = $db->query ($querya)
|
|
|
|
or die ("Cannot execute query1");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
while ($row_cur_uid = $resulta->fetch_array())
|
|
|
|
{
|
|
|
|
|
|
|
|
if($lnzaehler3 < 1 AND $row_cur_uid[zuweisung] == 'SOZ'){
|
|
|
|
$pdf->addPage();
|
|
|
|
$pdf->useTemplate($tplidx,0,0,0);
|
|
|
|
$pdf->SetAutoPageBreak(true, 10);
|
|
|
|
require("anschreiben/zuweisung_ag_standort.php");
|
|
|
|
$lnzaehler3 = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
$datum = date("Y-m-d H:i:s",time());
|
|
|
|
|
|
|
|
|
|
|
|
# 15.01.2010: Wurde innerhalb while schleife gezogen, da sonst der update mit Druckstatus=G nicht mehr funktionieren würde
|
|
|
|
|
|
|
|
if(!isset($hist)){
|
|
|
|
$sql_queue = $db->query("UPDATE stan_printqueue_antrag SET druckstatus='G', datum='$datum' WHERE qid='$row_cur_uid[qid]'");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($hist)){
|
|
|
|
$sql_queue = $db->query("DELETE FROM stan_printqueue_hist WHERE admin='$user_admin'");
|
|
|
|
}
|
|
|
|
#exit;
|
|
|
|
$pdf->Output("zuweisung_$uid.pdf","i");
|
|
|
|
$pdf->closeParsers();
|
|
|
|
} //Endif($row_cur_uid_anz[Anz] > 0){
|
|
|
|
?>
|