<?php
header
("content-type: application/x-javascript; charset=TIS-620");
?>
<script src="getinfo.js"></script>
<?
include_once("../../class/clsConnection.php");
include_once(
"../../class/clsDB.php");
include_once 
"../global.php";
include_once 
"../class/clsPerson.php";
include_once 
"getPrefix.php";
include_once 
"../class/clsDocSendtoPsTmp.php";

$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oStmp=new DocSendToPsTmp($oC);
$oPS5 = new person($oC);

$q=$_GET["q"];
$del=$_GET["del"];
$DrsIDshow=$_GET["DrsIDshow"];
$DtPsID=$_GET["DtPsID"];
//$sendToPs=@$_GET["sendToPs"] or exit("No Info Selected"); 
$sendToPs=$_GET["sendToPs"];
$str2="";

    if(
$del!="1"){
        
//Get Info From Selection
        
if(isset($sendToPs)){
            foreach(
$sendToPs as $key){
                
$oStmp->SearchByPsIDDrsID($key,$DrsIDshow);
                if(
$oStmp->GetRecord()==0){
                    
$oStmp->AddNew();
                    
$oStmp->DtPsID=$oStmp->GetNextCode();
                    
$oStmp->DrsID=$DrsIDshow;
                    
$oStmp->PsID=$key;
                    
$oStmp->Save();
                }
            }    
        }
    }else{
            
$oStmp->SearchByDtPsID($DtPsID);
            
$oStmp->GetRecord();
            
$oStmp->Delete();
    }
    
    
$str2.="<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=".$GLOBALS['COLOR_BG_TD_16'].">";
    
$i=0;  $checkcountps=0;
    
$oStmp->SearchByDrsID($DrsIDshow);
    while(
$oStmp->GetRecord()){
            
$i++;
            
$oPS5->SearchByKey($oStmp->PsID); $oPS5->GetRecord(); 
            
$str2.="<tr><td width=\"83%\" height=22 bgcolor=".$GLOBALS["COLOR_BG_TD_16"].">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
            
$str2.=GetPrefix($oPS5->prefixId).$oPS5->fName."&nbsp;".$oPS5->lName;
            
$str2.="</td><td width=\"17%\" bgcolor=".$GLOBALS["COLOR_BG_TD_16"]." align=\"center\">";
            
$str2.="<img src=\"../picture/cancel.gif\" alt=\"ΕΊ\"  border=\"0\"  style=\"cursor:pointer;\"  onclick=\"ShowInfo2(".$oStmp->DtPsID.",".$DrsIDshow.")\"></td></tr>";
            
    } 
    if(
$i==0){  
            
$str2.="<tr><td  height=22 bgcolor=".$GLOBALS["COLOR_BG_TD_16"].">&nbsp;&nbsp;&nbsp;&nbsp;<strong>-</strong></td>";
            
$str2.="<td  height=22 bgcolor=".$GLOBALS["COLOR_BG_TD_16"]." >&nbsp;</td></tr>";
    }  
    
$str2.="</table>";
    
$checkcountps=$i
    echo 
$str2;



?>