<?php include('../includes/con2pma3.php');
$var = "";
if(isset($_REQUEST['Check']))
{
	session_name("AdminSession");
	session_start();
	
	if (isset($_SESSION['loggedin']) && ($_SESSION['loggedin']==true))
	{
		$id = 0;
		$var = "&Check=1";
	}
	else
	header("location: ../Admin/index.php?msg=YOU ARE NOT LOGGED IN");
}
else
{	
	$id = $_SESSION['id'];
	$var = "";
	}
$WID = $_REQUEST['WID'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />

<link href="../includes/pma3fontstyles.css" rel="stylesheet" type="text/css" />
</head>

<body class="dblkl1">
<span class="lbrownlll7">Work Breakdown Structure<br />
Name: (<?php 
$resultWBSname = mysql_query("SELECT WBSList_code FROM wbslist where WBSList_id='$WID'");
$rowWBSname = mysql_fetch_array($resultWBSname , MYSQL_ASSOC); 
echo $rowWBSname['WBSList_code'];
		?> )</span><span class="ablks1"><br />
<br />
</span>
<table width="100%" border="0">
  <tr class="fbrownl7">
    <td width="8%" align="left" valign="top" bgcolor="#E2E2E2" scope="col">WBS<br />
    SortCode</td>
    <td width="12%" align="left" valign="top" bgcolor="#E2E2E2" scope="col">WBS <br />
      Level</td>
    <td width="39%" align="left" valign="top" bgcolor="#E2E2E2" scope="col">WBS <br />
      Description</td>
    <td width="41%" align="left" valign="top" bgcolor="#E2E2E2" scope="col">WBS <br />
      Notes</td>
    </tr>
   <?php
		 $result = mysql_query("SELECT * FROM globalwbs where gwbslist_id ='$WID' && companyID = '$id' ORDER BY WBSIDA ASC,WBSIDA ASC,WBSIDB ASC,WBSIDC ASC,WBSIDD ASC,WBSIDE ASC");
   		while($row = mysql_fetch_array($result , MYSQL_ASSOC))
  		{
			$WBSIDA = $row["WBSIDA"];
	  		$WBSIDB = $row["WBSIDB"];
	  		$WBSIDC = $row["WBSIDC"];
	  		$WBSIDD = $row["WBSIDD"];
	  		$WBSIDE = $row["WBSIDE"];
			$WBSID = $row["WBSID"];
		if($WBSIDB==0 && $WBSIDC==0 && $WBSIDD==0 && $WBSIDE==0)
		{
  		?>
  <tr class="lbrownlll7">
    <td align="left" valign="top" bgcolor="#F4F4F4" ><?php echo $row["sortCode"]; ?></td>
    <td align="left" valign="top" bgcolor="#F4F4F4" ><?php echo $WBSIDA.".".$WBSIDB.".".$WBSIDC.".".$WBSIDD.".".$WBSIDE; ?></td>
    <td align="left" valign="top" bgcolor="#F4F4F4" ><?php echo $row["description"]; ?></td>
    <td align="left" valign="top" bgcolor="#F4F4F4" class="egrayl1" ><?php echo $row["writeupwbs"]; ?></td>
    </tr>
     <?php
		} else if($WBSIDC==0 && $WBSIDD==0 && $WBSIDE==0)
		{
  ?>
  <tr class="lbrownlll7">
    <td align="left" valign="top" ><?php echo $row["sortCode"]; ?></td>
    <td align="left" valign="top" >&nbsp;&nbsp;<?php echo $WBSIDA.".".$WBSIDB.".".$WBSIDC.".".$WBSIDD.".".$WBSIDE; ?></td>
    <td align="left" valign="top" >&nbsp;&nbsp;<?php echo $row["description"]; ?></td>
    <td align="left" valign="top" class="egrayl1" ><?php echo $row["writeupwbs"]; ?></td>
    </tr>
    <?php } else
  if($WBSIDD==0 && $WBSIDE==0)
		{
  ?>
  <tr class="ibrownll7">
    <td align="left" valign="top" ><?php echo $row["sortCode"]; ?></td>
    <td align="left" valign="top" >&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $WBSIDA.".".$WBSIDB.".".$WBSIDC.".".$WBSIDD.".".$WBSIDE; ?></td>
    <td align="left" valign="top" >&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row["description"]; ?></td>
    <td align="left" valign="top" class="egrayl1"><?php echo $row["writeupwbs"]; ?></td>
    </tr>
     <?php	}
  else 
  if($WBSIDE==0)
		{?>
  <tr class="fbrownl7">
    <td align="left" valign="top" ><?php echo $row["sortCode"]; ?></td>
    <td align="left" valign="top" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $WBSIDA.".".$WBSIDB.".".$WBSIDC.".".$WBSIDD.".".$WBSIDE; ?></td>
    <td align="left" valign="top" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row["description"]; ?></td>
    <td align="left" valign="top" class="egrayl1"><?php echo $row["writeupwbs"]; ?></td>
    </tr>
    <?php } else 

  	{?>
  <tr class="cbrowns7">
    <td align="left" valign="top" ><?php echo $row["sortCode"]; ?></td>
    <td align="left" valign="top" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $WBSIDA.".".$WBSIDB.".".$WBSIDC.".".$WBSIDD.".".$WBSIDE; ?></td>
    <td align="left" valign="top" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row["description"]; ?></td>
    <td align="left" valign="top" class="egrayl1"><?php echo $row["writeupwbs"]; ?></td>
    </tr>
      <?php } ?>
       <?php
		 $result1 = mysql_query("SELECT * FROM globalitems where WBSID = '$WBSID' && itemParent = '0' ORDER BY itemID ASC");
   		while($row = mysql_fetch_array($result1 , MYSQL_ASSOC))
  		{
  		?>
  <tr class="dblkl7">
    <td align="left" valign="top" ><?php echo $row["sortCode"]; ?></td>
    <td align="left" valign="top" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php $items = $row["itemID"]; echo  $WBSIDA.".".$WBSIDB.".".$WBSIDC.".".$WBSIDD.".".$WBSIDE.".".$row["itemID"]; ?></td>
    <td align="left" valign="top" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row["description"]; ?></td>
    <td align="left" valign="top" class="egrayl1"><?php echo $row["writeupitem"]; ?></td>
    </tr>
     <?php
		 $result123 = mysql_query("SELECT * FROM globalitems where WBSID = '$WBSID' && itemParent = '$items' ORDER BY itemID ASC");
   		while($row1 = mysql_fetch_array($result123 , MYSQL_ASSOC))
  		{
  		?>
  <tr class="ablks2">
    <td align="left" valign="top" ><?php echo $row1["sortCode"]; ?></td>
    <td align="left" valign="top" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo  $WBSIDA.".".$WBSIDB.".".$WBSIDC.".".$WBSIDD.".".$WBSIDE.".".$row1["itemID"];?></td>
    <td align="left" valign="top" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row1["description"]; ?></td>
    <td align="left" valign="top" class="egrayl1"><?php echo $row1["writeupitem"]; ?></td>
    </tr>
    <?php }
		}
		} ?>
  

</table>
<br />
<span class="ablks1">pmAnywhere</span>.co
<?php include('../includes/footer.php');
