<?php include('../../includes/checkSession.php'); ?>
<option value="">Select</option>
<?php
include('../../includes/con2pma3.php');
$id = $_SESSION['id'];
$q=$_GET["q"];
if ("Associate"==$q)
{
?>

          <?php

	  $result = mysql_query("SELECT AScode, AScontact, ASserial FROM associates where companySerial = '$id' AND ASstatus = '1' ORDER BY AScode, AScontact");
		
   		while($row = mysql_fetch_array($result , MYSQL_ASSOC))
  		{
			$aidd = $row["ASserial"];
  		 echo "<option value='$aidd'>".$row["AScode"]." - ".$row["AScontact"]."</option>";
		}		

}
else if ("Consultant"==$q)

{

	  $result = mysql_query("SELECT conContactName, conCode, conSerial FROM consultants where companySerial = '$id' AND conStatus='1' ORDER BY conCode, conContactName");
		
   		while($row = mysql_fetch_array($result , MYSQL_ASSOC))
  		{
			$cidd = $row["conSerial"];
  		 echo "<option value='$cidd'>".$row["conCode"]." - ".$row["conContactName"]."</option>";
		}		

}
else if ("Client"==$q)

{

	  	$result = mysql_query("SELECT clientContactName, clientCode, clientSerial FROM client where companySerial = '$id' AND clientStatus='1' ORDER BY clientCode, clientContactName");
		
   		while($row = mysql_fetch_array($result , MYSQL_ASSOC))
  		{
			$cidd = $row["clientSerial"];
  		 echo "<option value='$cidd'>".$row["clientCode"]." - ".$row["clientContactName"]."</option>";
		}		
}

else if("Vendor"==$q)

{
    $result = mysql_query("SELECT resSerial, resCatCode, resSubCatCode, resName, vendFname, vendLname FROM resources, resourcecategory, resourcesubcategory where resources.companyID='$id' AND resources.resStatus='1' AND resourcecategory.resCatSerial=resources.rescatID AND  resourcesubcategory.resSubCatSerial=resources.ressubcatID AND resourcecategory.resCatCode = 'VEN' ORDER BY resCatCode, resSubCatCode, resName, vendFname, vendLname");
	
    	while($row = mysql_fetch_array($result , MYSQL_ASSOC))
  		{
			$s = $row['resSerial'];
  		 echo "<option value='$s'>".$row["resCatCode"]." - ".$row["resSubCatCode"]." - ".$row["resName"]. " - " . $row['vendFname']. " - " . $row['vendLname']."</option>";
		}
	}
else if("Team"==$q)
{
    $result2 = mysql_query("SELECT internal_personnel_id,internal_personnel_firstName,internal_personnel_lastName,abbreviation FROM internal_personnel,company where internal_personnel.internal_personnel_company_id = '$id' AND internal_personnel.internal_personnel_status=1 AND internal_personnel.internal_personnel_company_id=company.serial order by abbreviation, internal_personnel_firstName, internal_personnel_lastName");		
   		while($row2 = mysql_fetch_array($result2 , MYSQL_ASSOC))
  		{
			?>
			<option value="<?php echo $row2['internal_personnel_id']; ?>"> <?php echo  $row2["abbreviation"] . " - " . $row2["internal_personnel_firstName"]. " " . $row2["internal_personnel_lastName"];?></option>
            <?php 
		}
}
?>