<?php
include('../../includes/checkSession.php');
include('../../includes/con2pma3.php');
$id= $company_id = $_SESSION['id'];
$expand_id=$_REQUEST['interface_plan_id'];
/*include('1-Quality-InspectionPlans2DB.php');*/
include("getname.php");
?>

<html><head><meta charset="utf-8"><title>pmAnywhere - Scope Module</title>
<link href="03-00Scope-Styles0.css" rel="stylesheet" type="text/css" />
    <script src="../includes/js/jquery.min.js"></script>
    <script src="../includes/js/betterinnerhtml.js"></script>
    <!--<script src="script-select-addressee.js"></script>-->
    <script>
        function loadProjectPhases(projectID){

            if (window.XMLHttpRequest)

            {// code for IE7+, Firefox, Chrome, Opera, Safari

                xmlhttp = new XMLHttpRequest();

            }

            else

            {// code for IE6, IE5

                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

            }

            xmlhttp.onreadystatechange = function()

            {

                if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                {
                    document.getElementById("input-phase2").innerHTML = xmlhttp.responseText;
                    loadProjectZones(projectID);
                }

            }

            xmlhttp.open("GET", "getProjectPhases1.php?projectID=" + projectID, true);

            xmlhttp.send();


        }

        function loadProjectZones(projectID) {
            if (window.XMLHttpRequest)

            {// code for IE7+, Firefox, Chrome, Opera, Safari

                xmlhttp = new XMLHttpRequest();

            }

            else

            {// code for IE6, IE5

                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

            }

            xmlhttp.onreadystatechange = function()

            {

                if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                {
                    document.getElementById("input-zone2").innerHTML = xmlhttp.responseText;
                }

            }

            xmlhttp.open("GET", "getProjectZones.php?projectID=" + projectID, true);

            xmlhttp.send();
        }

        function clientvendor(str,loadField) {

            if (str == "")
            {

                document.getElementById(loadField).innerHTML = "";

                return;

            }

            if (window.XMLHttpRequest)

            {// code for IE7+, Firefox, Chrome, Opera, Safari

                xmlhttp = new XMLHttpRequest();

            }

            else

            {// code for IE6, IE5

                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

            }

            xmlhttp.onreadystatechange = function()

            {

                if (xmlhttp.readyState == 4 && xmlhttp.status == 200)

                {


                    document.getElementById(loadField).style.display = '';
                    //BetterInnerHTML( document.getElementById("cv"), xmlhttp.responseText);

                    document.getElementById(loadField).innerHTML = xmlhttp.responseText;

                }

            }

            xmlhttp.open("GET", "client-vendor.php?q=" + str, true);

            xmlhttp.send();

        }

    </script>

    <script type="text/javascript">
        function loaddwgsuffix(str)
        {
            if (str == "")
            {
                document.getElementById("input-dwg2").innerHTML = "";
                return;
            }
            if (window.XMLHttpRequest)
            {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            }
            else
            {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function ()
            {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                {
                    document.getElementById("input-dwg2").style.display = '';
                    BetterInnerHTML(document.getElementById("input-dwg2"), xmlhttp.responseText);
                }
            }
            xmlhttp.open("GET", "load-dwg-suffix.php?q=" + str, true);
            xmlhttp.send();
        }

        function loaddwgsuffixedit(str,str2)
        {
            if (str == "")
            {
                document.getElementById("input-dwg2").innerHTML = "";
                return;
            }
            if (window.XMLHttpRequest)
            {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            }
            else
            {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function ()
            {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                {
                    document.getElementById("input-dwg2").style.display = '';
                    BetterInnerHTML(document.getElementById("input-dwg2"), xmlhttp.responseText);
                }
            }
            xmlhttp.open("GET", "load-dwg-suffix.php?q="+str+"&p="+str2, true);
            xmlhttp.send();
        }
    </script>
</head>
	<div><br></div>
	
<?php if ($uacc == "Full Control" || $uacc == "Consolidate" ) {

$result = mysql_query("SELECT * FROM interfaceinitiate LEFT JOIN projects ON interface_plan_pid=projectSerial where interface_plan_id='$expand_id'");
if(mysql_num_rows($result)){
    $rowD = mysql_fetch_array($result);
}
?>

<div style="overflow-x:auto;">
<div id="formdiv" >

<input id="interface_plan_id" name="interface_plan_id" type="hidden" value="<?php echo $row['id']; ?>">
  <fieldset>
<legend align="center">INTERFACE MANAGEMENT PLAN / RESPONSIBILITY MATRIX</legend>
<table name="entryform" align="center" class="table3" width="80%" border="0" cellpadding="0">
    <tr>
      <td align="left" valign="bottom"><strong>Project 1</strong></td>
      <td align="left" valign="bottom"><input type="text" name="fixfield2" id="fixfield2" readonly style="background-color:gainsboro" value="<?php echo $rowD['projectCode']; ?> - <?php echo $rowD['projectName']; ?>"></td>
		
      <td align="left" valign="bottom"><strong>Title</strong></td>
      <td align="left" valign="bottom"><input type="text"  name="fixfield2" id="fixfield2" readonly style="background-color:gainsboro" value="<?php echo $rowD['interface_title']; ?>"></td>
		
      <td align="left" valign="bottom"><strong>Stage</strong></td>
      <td align="left" valign="bottom"><input type="text" name="fixfield4" id="fixfield4" readonly style="background-color:gainsboro" value="<?php echo $rowD['interface_stage'];?>"></td>
    </tr>
</table>
	  
	  
	<?php     $editUrl = null;
    if(isset($_GET['Edit']) && !empty($_GET['Edit'])) {

        $company_id = $_SESSION['id'];
        $result2 = mysql_query("SELECT * FROM interfacedetails where interfacedet_id=".$_GET['Edit']);
        $rowEdit = mysql_fetch_array($result2, MYSQL_ASSOC);

        $editUrl = "?Edit=" . $_GET['Edit'];
    } ?>
  </fieldset>
</div>
</div>
	
<table width="100%">
  <tbody>
    <tr>
      <td align="right"><a href="03-InterfacePlan01-initiate01.php"><img src="img/deletecb.png" width="12" height="12" alt=""/></a></td>
    </tr>
  </tbody>
</table>

	        <?php
        $resultData = mysql_query("SELECT * FROM interfacedetails WHERE interfacedet_plan_id='$expand_id' AND interfacedet_status='1'");
            ?>
	
	
<table width="100%" class="table2" align="center" border="0" cellpadding="0">
  <tbody>
<tr bgcolor="#D8D8D8">
  <td colspan="15" align="left" valign="top" bgcolor="#E8E8E8"><strong>ACTIVE INTERFACES</strong></td>
  </tr>
<tr bgcolor="#D8D8D8">
  <td width="3%" align="left" valign="top" bgcolor="#E8E8E8"><strong>S<br>#</strong></td>
  <td width="10%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Description<br>(Constraint)</strong></td>
  <td width="5%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Project<br>1</strong></td>
  <td width="5%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Project<br>2</strong></td>
  <td width="5%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Interface<br>Discipline</strong></td>
  <td width="8%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Interface<br>DWG</strong></td>
      <td width="5%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Interface<br>Location</strong></td>
      <td width="5%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Priority<br>Level</strong></td>
      <td width="10%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Time/<br>Dates</strong></td>
      <td width="6%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Party<br>1</strong></td>
      <td width="6%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Party<br>2</strong></td>
      <td width="6%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Party<br>3</strong></td>
      <td width="6%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Interface<br>Responsibility</strong></td>
      <td width="6%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Overall<br>Responsibility</strong></td>
      <td width="13%" align="left" valign="top" bgcolor="#E8E8E8"><strong>Proposed <br>Actions</strong></td>
    </tr>
	  
        <?php
        $a = 1;
        while ($row2 = mysql_fetch_array($resultData, MYSQL_ASSOC)) {
        ?>
<tr>
  <td valign="top"><?php echo $a;//$row2['interfacedet_id']; ?></td>
<td valign="top"><strong><?php echo $row2['interfacedet_descr']; ?></strong><br><br>(<?php echo $row2['interfacedet_constr']; ?>)</td>
    <td valign="top"><?php
        $result = mysql_query("SELECT projectCode, projectName FROM projects where projectSerial='" . $row2['interfacedet_proj1'] . "'");
        if ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
            echo $row["projectCode"]/* . " - " . $row["projectName"]*/;
        }
        ?><br>
        <?php
        $result21 = mysql_query("SELECT  Phase_name FROM projectphases where Phase_id='" . $row2['interfacedet_phase1'] . "' ");
        if ($row = mysql_fetch_array($result21, MYSQL_ASSOC)) {
            echo $row['Phase_name'];
        }
        ?><br>
        <?php
        $result22 = mysql_query("SELECT  Zone_name FROM projectzones where   Zone_id='" . $row2['interfacedet_stage1'] . "'");
        if ($row22 = mysql_fetch_array($result22, MYSQL_ASSOC)) {
            echo $row22['Zone_name'];
        }
        ?></td>
<td valign="top">
    <?php
    $result = mysql_query("SELECT projectCode, projectName FROM projects where projectSerial='" . $row2['interfacedet_proj2'] . "'");
    if ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo $row["projectCode"]/* . " - " . $row["projectName"]*/;
    }
    ?><br>
    <?php
    $result21 = mysql_query("SELECT  Phase_name FROM projectphases where Phase_id='" . $row2['interfacedet_phase2'] . "' ");
    if ($row = mysql_fetch_array($result21, MYSQL_ASSOC)) {
        echo $row['Phase_name'];
    }
    ?><br>
    <?php
    $result22 = mysql_query("SELECT  Zone_name FROM projectzones where   Zone_id='" . $row2['interfacedet_stage2'] . "'");
    if ($row22 = mysql_fetch_array($result22, MYSQL_ASSOC)) {
        echo $row22['Zone_name'];
    }
    ?>
</td>
<td valign="top">
    <?php
    $result = mysql_query("SELECT discipline_name FROM discipline where discipline_id='".$row2['interfacedet_discipline']."'");
    if ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo  $row["discipline_name"];
    }
    ?>
   </td>
<td valign="top">
    <?php
    $QDWG = "SELECT dwgList_Title, dwg_suffix FROM scope_dwg WHERE dwgID='".$row2['interfacedet_dwg1']."'";
    $resultdwg = mysql_query($QDWG);
    if ($rowdwg = mysql_fetch_array($resultdwg, MYSQL_ASSOC)) {
         echo $rowdwg['dwgList_Title'];
    }
    ?>
<br>
  <?php
  $query = "SELECT id, sheet_no, rev_no, dwg_title, dwg_title2, range_no FROM scope_dwg_revisions WHERE id ='".$row2['interfacedet_dwg11']."'";
  $result = mysql_query($query);
      if($rew = mysql_fetch_object($result)){
          echo $rowdwg['dwg_suffix'] ." - ". $rew->range_no; ?> - <?php echo str_pad($rew->sheet_no, 3, '0', STR_PAD_LEFT) . " - " . str_pad($rew->rev_no, 3, '0', STR_PAD_LEFT); ?> - <?php echo $rew->dwg_title ?> - <?php echo $rew->dwg_title2;
      }
 ?> <br></td>
<td valign="top"><?php echo $row2['interfacedet_loc']; ?></td>
<td valign="top"><?php echo $row2['interfacedet_priority']; ?></td>
<td valign="top"><?php echo $row2['interfacedet_timedesc']; ?><br><br>  
  <?php echo $row2['interfacedet_start']; ?><br><?php echo $row2['interfacedet_end']; ?></td>
<td valign="top"><?php echo $row2['interfacedet_party1']; ?><br><?php echo getName($row2['interfacedet_party1'],$row2['interfacedet_party11']); ?></td>
<td valign="top"><?php echo $row2['interfacedet_party2']; ?><br><?php echo getName($row2['interfacedet_party2'],$row2['interfacedet_party22']); ?></td>
<td valign="top"><?php echo $row2['interfacedet_party3']; ?><br><?php echo getName($row2['interfacedet_party3'],$row2['interfacedet_party33']); ?></td>
<td valign="top"><?php echo $row2['interfacedet_resp1']; ?><br><?php echo getName($row2['interfacedet_resp1'],$row2['interfacedet_resp11']); ?></td>
<td valign="top"><?php //echo $row2['interfacedet_resp2']; ?><?php echo getName('Team',$row2['interfacedet_resp22']); ?></td>
<td valign="top"><?php echo $row2['interfacedet_action']; ?><br></td>
  </tr>
<tr>
  <td colspan="15" valign="top"><?php echo $row2['interfacedet_creationdate']; ?> :  <?php echo $row2['createdBy']; ?> - <?php echo $row2['interfacedet_remarks']; ?></td>
  </tr>
<?php $a++;} ?>  
  </tbody>
</table>
<p>
  <?php } ?>	
  <br>
  <br>
  <br>
</p>
<p>&nbsp; </p>


</body>
</html>

<?php include('../includes/footer.php'); ?>
