<?php
include('../../includes/checkSession.php');
include('../../includes/con2pma3.php');
include('../includes/header_in.php');

$var = "";
$id="";
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'];
?>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="../popupjquery/general.css" type="text/css" media="screen" />
<script src="../cookiejs/jquery.cookie.js" type="text/javascript"></script>
<script src="../cookiejs/jquery.session.js" type="text/javascript"></script> 
<script src="../popupjquery/popup.js" type="text/javascript"></script>
<script src="../popupjquery/WBSEditpopup.js" type="text/javascript"></script>
<script src="../popupjquery/ITEMEditpopup.js" type="text/javascript"></script>
<script src="../popupjquery/ITEMIpopup.js" type="text/javascript"></script>
<link href='http://fonts.googleapis.com/css?family=Roboto:300|Ubuntu:500' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../Accordi/styles/demo.css" />
<link href="../Accordi/styles/font-awesome.min.css" rel="stylesheet">
<link href="../Accordi/styles/animate.css" rel="stylesheet">
<link href="../Accordi/styles/styles.css" rel="stylesheet">
<link href="../Accordi/icons/style.css" rel="stylesheet">
   <style>
       #toAdd {z-index:999;display: block; position: fixed;bottom: 13%;right: 8px;padding: 10px;}
   </style>
   <script>
       $(document).ready(function()
 {
 $("#toAdd").css("display", "none");
 $(window).scroll(function(){
 
 if($(window).scrollTop() > 0){
 
 $("#toAdd").fadeIn("slow");
 }
 else {
 $("#toAdd").fadeOut("slow");
 
}
 });
  });
 $("#toAdd").click(function(){
 
 event.preventDefault();
 
 $("html, body").animate({
 scrollTop:0
 },100);
 
});
</script>
<style>
    .displayblock{display:block !important}
    .fa-expand, .fa-compress{cursor:pointer !important}
    .accordion_search_container{margin-bottom:0px !important}
h2.acc_title_bar  {width:100%}
select{width:100% !important}
    table th {
    font-size: 12px !important;
    padding: 7px 0;
    border-right:1px solid white;
    padding-right: 2px !important;
     padding-left: 5px !important;
    color: #FFF !important;
    background: #3a70ab !important;
    background: -moz-linear-gradient(top, #5ba5cb 0%, #3a70ab 100%) !important;
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#5ba5cb), color-stop(100%, #3a70ab)) !important;
    background: -webkit-linear-gradient(top, #5ba5cb 0%, #3a70ab 100%) !important;
    background: -o-linear-gradient(top, #5ba5cb 0%, #3a70ab 100%) !important;
    background: -ms-linear-gradient(top, #5ba5cb 0%, #3a70ab 100%) !important;
    background: linear-gradient(to bottom, #5ba5cb 0%, #3a70ab 100%) !important;}
    #WBSEditpopupContact, #popupContact,#ITEMIpopupContact, #ITEMEditpopupContact{height: auto !important;}
     #WBSEditpopupContact table tr td, #popupContact table tr td,#ITEMIpopupContact table tr td, #ITEMEditpopupContact table tr td,ITEMEditpopupContact table tr td,
    #WBSEditpopupContact table tr th, #popupContact table tr th,#ITEMIpopupContact table tr th, #ITEMEditpopupContact table tr th,#ITEMEditpopupContact table tr th{padding:10px 10px !important; background:#fff !important; font-size:12px !important}
    
     #WBSEditpopupContact table tr, #popupContact table tr,#ITEMIpopupContact table tr, #ITEMEditpopupContact table tr,ITEMEditpopupContact table tr,
     #WBSEditpopupContact table tr, #popupContact,#ITEMIpopupContact table tr, #ITEMEditpopupContact table tr,#ITEMEditpopupContact table tr{border-bottom: 1px dotted #D3D3D3;}
    .label-td{width:35%; vertical-align: middle}
    .label-td{padding-left:0px !important; padding-right:0px !important}
    .value-td{width:68%}
    .action-td{width:2%}
    input[type="text"] {border: 1px solid #e4e4e4;padding:  6px;}
    select{padding: 0 0 0 6px;height:28px !important}
    .formfield{width:100%;   
    }
    .itemrow{background:rgb(242, 242, 255) !important;}
    .itemrow .icon-wbs-add, .itemrow .fa, .itemrow .icon-wbs-insert{color:#2b6893 !important}
    .icon-wbs-insert{font-size: 15px;
    margin-right: 4px;}
     #loader{position: fixed;
             display:none; z-index:999;
    background-color: #e4e4e4;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    text-align: center;
    opacity: 0.5;
    vertical-align: middle;}
    #loader img{margin-top:20%;}
    .icon-wbs-add{    margin-right: 3px !important;
    vertical-align: sub;
    font-size: 13px;}
    .fa-pencil-square-o{font-size: 14px !important;
    vertical-align: sub;
    font-weight: 500;}
    .fa-times{    font-size: 16px !important;
    vertical-align: middle;}
    .fa-times, .fa-pencil-square-o,.icon-wbs-add, .icon-wbs-insert{cursor:pointer}
	 .icon-wbs-insertA{cursor:pointer}

</style>

<script type="text/javascript">
$(document).ready(function() {
    var frm = $('#form1');
    frm.submit(function (ev) {
        $.ajax({
            type: frm.attr('method'),
            url: frm.attr('action'),
            data: frm.serialize(),
			//dataType:"html",
            success: function (data) {
				
			document.getElementById("loadWBStable").innerHTML = data;
			 $('#loader').hide();
			 LoadWlist(<?php echo $WID ; ?>);
                $(function () {

                    $("#default_accordion").bwlAccordion({
                        theme: 'theme-blue',
                        highlight_bg: 'red'
                    });

                });
				frm.clearForm();
	            }
				
        });

        ev.preventDefault();
    });
	  });

</script>

<script type="text/javascript">
$(document).ready(function() {
    var frm = $('#formwbs');
    frm.submit(function (ev) {
        $.ajax({
            type: frm.attr('method'),
            url: frm.attr('action'),
            data: frm.serialize(),
			//dataType:"html",
            success: function (data) {
				
			document.getElementById("loadWBStable").innerHTML = data;
			 $('#loader').hide();
			 LoadWlist(<?php echo $WID ; ?>);
                $(function () {

                    $("#default_accordion").bwlAccordion({
                        theme: 'theme-blue',
                        highlight_bg: 'red'
                    });

                });
				frm.clearForm();
	            }
				
        });

        ev.preventDefault();
    });
	  });

</script>
<script type="text/javascript">
    function LoadWlist(str2)
    { 
        if (str2 == "")
        {
			
            document.getElementById("PNodeI").innerHTML = "";
			document.getElementById("PNodeIP").innerHTML = "";
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttpw = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttpw = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttpw.onreadystatechange = function ()
        {
            if (xmlhttpw.readyState == 4 && xmlhttpw.status == 200)
            {
                document.getElementById("PNodeI").style.display = '';
				document.getElementById("PNodeIP").style.display = '';
//               $("#itemList").html(xmlhttp1.responseText);//
               BetterInnerHTML( document.getElementById("PNodeI"), xmlhttpw.responseText);
			   BetterInnerHTML( document.getElementById("PNodeIP"), xmlhttpw.responseText);
			   //alert(xmlhttpw.responseText);
//                document.getElementById("itemList").innerHTML = xmlhttp1.responseText;
            }
        }

        xmlhttpw.open("GET", "../../DB/03-scope/loadWBS-G.php?q=0&p=" + str2, true);
        xmlhttpw.send();

    }
</script>
<script type="text/javascript">
    function LoadItemList(str, str2)
    {
        if (str == "")
        {
            document.getElementById("itemList").innerHTML = "";
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("itemList").style.display = '';
//               $("#itemList").html(xmlhttp1.responseText);//
               BetterInnerHTML( document.getElementById("itemList"), xmlhttp1.responseText);
//                document.getElementById("itemList").innerHTML = xmlhttp1.responseText;
            }
        }

        xmlhttp1.open("GET", "../../DB/03-scope/LoadItemList.php?q=" + str + "&p=" + str2, true);
        xmlhttp1.send();

    }



    function LoadWBSG(str, str2, str3,event)
    {// alert(str3+"."+str2+"."+str);
        if (str == "")
        {
            document.getElementById("loadWBSbeforeForm").innerHTML = "";
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("loadWBSbeforeForm").style.display = '';
                document.getElementById("loadWBSbeforeForm").innerHTML = xmlhttp1.responseText;
            }
        }

        xmlhttp1.open("GET", "../../DB/03-scope/loadWBSbeforeForm.php?q=" + str + "&p=" + str2 + "&parent=" + str3, true);
        xmlhttp1.send();
        centerPopup();

        //load popup

        loadPopup();





        //CLOSING POPUP

        //Click the x event!

        $("#popupContactClose").click(function () {

            disablePopup();

        });

        //Click out event!

        $("#backgroundPopup").click(function () {

            disablePopup();

        });

        //Press Escape event!

        $(document).keypress(function (e) {

            if (e.keyCode == 27 && popupStatus == 1) {

                disablePopup();

            }

        });

      event.stopPropagation();
      //  event.preventDefault ? event.preventDefault() : event.returnValue = false;
    }


    function LoadWBStable(str, str2)
    { //alert (str+str2);
        //alert("sdf");
        $('#loader').show();
        if (str == "")
        {
//            document.getElementById("loadWBStable").innerHTML = "";
             $('#loadWBStable').html("");
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp21 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp21 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp21.onreadystatechange = function ()
        {
            if (xmlhttp21.readyState == 4 && xmlhttp21.status == 200)
            {
                document.getElementById("loadWBStable").style.display = ''; 
                document.getElementById("loadWBStable").innerHTML = xmlhttp21.responseText;
 $('#loader').hide();
                $(function () {

                    $("#default_accordion").bwlAccordion({
                        theme: 'theme-blue',
                        highlight_bg: 'red'
                    });

                });

            }
            else{
                $('#loader').hide();
            }
        }
      
        xmlhttp21.open("GET", "../../DB/03-scope/loadWBStable.php?WID=" + str + "&p=" + str2, true);
        xmlhttp21.send();

    }
//loadWBSEditform

    function LoadWBSEditForm(str, str2, event)
    {
        
      event.stopPropagation();
        if (str == "")
        {
        //    document.getElementById("loadWBSEditForm").innerHTML = "";
            $('#loadWBSEditForm').html("");
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("loadWBSEditForm").style.display = '';
               // document.getElementById("loadWBSEditForm").innerHTML = xmlhttp1.responseText;
                $('#loadWBSEditForm').html(xmlhttp1.responseText);

            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/loadWBSEditForm.php?EditW=" + str + "&WID=" + str2, true);
        xmlhttp1.send();

        WEcenterPopup();

        //load popup

        WEloadPopup();





        //CLOSING POPUP

        //Click the x event!

        $("#WEpopupContactClose").click(function () {

            WEdisablePopup();

        });

        //Click out event!

        $("#WEbackgroundPopup").click(function () {

            WEdisablePopup();

        });

        //Press Escape event!

        $(document).keypress(function (e) {

            if (e.keyCode == 27 && WEpopupStatus == 1) {

                WEdisablePopup();

            }

        });



    }


//loadITEMEditform

    function LoadITEMEditForm(str, str2, event)
    { //alert("i");
        event.stopPropagation();
        if (str == "")
        {
            document.getElementById("loadITEMEditForm").innerHTML = "";
           
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("loadITEMEditForm").style.display = '';
                document.getElementById("loadITEMEditForm").innerHTML = xmlhttp1.responseText;
                //BetterInnerHTML( document.getElementById("loadITEMEditForm"), xmlhttp1.responseText);
              //   $('#loadITEMEditForm').html(xmlhttp1.responseText);
            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/loadITEMEditForm.php?EditI=" + str + "&WID=" + str2, true);
        xmlhttp1.send();

        IEcenterPopup();

        //load popup

        IEloadPopup();





        //CLOSING POPUP

        //Click the x event!

        $("#IEpopupContactClose").click(function () {

            IEdisablePopup();

        });

        //Click out event!

        $("#IEbackgroundPopup").click(function () {

            IEdisablePopup();

        });

        //Press Escape event!

        $(document).keypress(function (e) {

            if (e.keyCode == 27 && IEpopupStatus == 1) {

                IEdisablePopup();

            }

        });



        
//event.preventDefault ? event.preventDefault() : event.returnValue = false;

    }

</script>

<script type="text/javascript">
    function PNodeLoadItem(str)
    {
        if (str == "")
        {
            document.getElementById("itemList1").innerHTML = "";
           // $('#itemList1').html("");
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {

                document.getElementById("itemList1").style.display = '';
             //  document.getElementById("itemList1").innerHTML = xmlhttp1.responseText;
             
                 $('#itemList1').html(xmlhttp1.responseText);

            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/LoadItemWBS.php?q=" + str, true);
        xmlhttp1.send();

    }


//loadITEMEditform
    /*
     function LoadITEMEditForm(str,str2)
     {
     if (str=="")
     {
     document.getElementById("loadITEMEditForm").innerHTML="";
     return;
     } 
     if (window.XMLHttpRequest)
     {// code for IE7+, Firefox, Chrome, Opera, Safari
     
     xmlhttp1=new XMLHttpRequest();
     }
     else
     {// code for IE6, IE5
     xmlhttp1=new ActiveXObject("Microsoft.XMLHTTP");
     }
     xmlhttp1.onreadystatechange=function()
     {
     if (xmlhttp1.readyState==4 && xmlhttp1.status==200)
     {
     document.getElementById("loadITEMEditForm").style.display='';
     document.getElementById("loadITEMEditForm").innerHTML=xmlhttp1.responseText;	
     }
     }
     xmlhttp1.open("GET","../DB/loadITEMEditForm.php?EditI="+str+"&WID="+str2,true);
     xmlhttp1.send();
     
     }
     
     */
//loadITEMInsertform

    function LoadIITEMForm(str, str2, event)
    { //alert("Item");
         event.stopPropagation();
        if (str == "")
        {
          //  document.getElementById("loadITEMIForm").innerHTML = "";
             $('#loadITEMIForm').html("");
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("loadITEMIForm").style.display = '';
              //  document.getElementById("loadITEMIForm").innerHTML = xmlhttp1.responseText;
                $('#loadITEMIForm').html(xmlhttp1.responseText);

            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/loadITEMIForm.php?WBSID=" + str + "&WID=" + str2, true);
        xmlhttp1.send();

        IIcenterPopup();

        //load popup

        IIloadPopup();





        //CLOSING POPUP

        //Click the x event!

        $("#IIpopupContactClose").click(function () {

            IIdisablePopup();

        });

        //Click out event!

        $("#IIbackgroundPopup").click(function () {

            IIdisablePopup();

        });

        //Press Escape event!

        $(document).keypress(function (e) {

            if (e.keyCode == 27 && IIpopupStatus == 1) {

                IIdisablePopup();

            }

        });

       
//event.preventDefault ? event.preventDefault() : event.returnValue = false;
    }



//loadSubITEMInsertform

    function LoadSIITEMForm(str, str3, str2, event)
    {
        if (str == "")
        {
          //  document.getElementById("loadITEMIForm").innerHTML = "";
            $('#loadITEMIForm').html("");
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("loadITEMIForm").style.display = '';
            //    document.getElementById("loadITEMIForm").innerHTML = xmlhttp1.responseText;
                 $('#loadITEMIForm').html(xmlhttp1.responseText);
            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/loadITEMIForm.php?WBSID=" + str + "&WID=" + str2 + "&pItem=" + str3, true);
        xmlhttp1.send();

        IIcenterPopup();

        //load popup

        IIloadPopup();





        //CLOSING POPUP

        //Click the x event!

        $("#IIpopupContactClose").click(function () {

            IIdisablePopup();

        });

        //Click out event!

        $("#IIbackgroundPopup").click(function () {

            IIdisablePopup();

        });

        //Press Escape event!

        $(document).keypress(function (e) {

            if (e.keyCode == 27 && IIpopupStatus == 1) {

                IIdisablePopup();

            }

        });

        event.stopPropagation();
//event.preventDefault ? event.preventDefault() : event.returnValue = false;

    }

</script>

<script type="text/javascript">
    function PNodeLoadItem(str)
    {
        if (str == "")
        {
            document.getElementById("itemList1").innerHTML = "";
            $('#itemList1').html("");
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {

                document.getElementById("itemList1").style.display = '';
            //    document.getElementById("itemList1").innerHTML = xmlhttp1.responseText;
                  $('#itemList1').html(xmlhttp1.responseText);

            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/LoadItemWBS.php?q=" + str, true);
        xmlhttp1.send();

    }

    function call_del_DB(str, str2,event)
    {

        var answer = confirm("This deleted information cannot be retrieved. Press OK to Delete.")
        if (!answer) {
            event.stopPropagation();
            return;
        }
        if (str == "")
        {
          //  document.getElementById("loadWBStable").innerHTML = "";
             $('#loadWBStable').html("");
            
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {

                document.getElementById("loadWBStable").style.display = '';
          document.getElementById("loadWBStable").innerHTML = xmlhttp1.responseText;
                // $('#loadWBStable').html(xmlhttp1.responseText);
                 LoadWlist(str2);
                $(function () {

                    $("#default_accordion").bwlAccordion({
                        theme: 'theme-blue',
                        highlight_bg: 'red'
                    });

                });
            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/GWBSDB-G.php?del=" + str + "&WID=" + str2, true);
        xmlhttp1.send();

    }


// call del item
    function call_del_IDB(str, str2,event)
    {

        var answer = confirm("This deleted information cannot be retrieved. Press OK to Delete.")
        if (!answer)
            return;
        if (str == "")
        {
          //  document.getElementById("loadWBStable").innerHTML = "";
            $('#loadWBStable').html("");
         
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {

                document.getElementById("loadWBStable").style.display = '';
              //  document.getElementById("loadWBStable").innerHTML = xmlhttp1.responseText;
                $('#loadWBStable').html(xmlhttp1.responseText);

                $(function () {

                    $("#default_accordion").bwlAccordion({
                        theme: 'theme-blue',
                        highlight_bg: 'red'
                    });

                });

            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/GWBSITEMDB-G.php?del=" + str + "&WID=" + str2, true);
        xmlhttp1.send();

    }

</script>

<script src="http://malsup.github.com/jquery.form.js"></script>

<script src="../Accordi/js/jquery.bwlaccordion.js"></script> 


<!--already-->



<style type="text/css">
    .fixed{display:none !important}
    div.FixedHeader_Cloned th,
    div.FixedHeader_Cloned td {
        background-color: white !important;
    }
    .first{
        display: none;
    }
    /*    .fixed{
            width: auto !important;
        }*/
    .dataTable, .FixedHeader_Header {width:100% !important}
    .dataTable thead i{
        margin-top: -5px;
    }
</style>

<style>
    .addon-label{width:13%}
    .addon-field{width:20%}
</style>


<div id="popupContact">
    <div id="loadWBSbeforeForm"></div>
</div>
<div id="backgroundPopup"></div>


<div id="WBSEditpopupContact">
    <div id="loadWBSEditForm"></div>
</div>
<div id="WEbackgroundPopup"></div>


<div id="ITEMEditpopupContact">
    <div id="loadITEMEditForm"></div>
</div>
<div id="IEbackgroundPopup"></div>

<div id="ITEMIpopupContact">
    <div id="loadITEMIForm"></div>
</div>
<div id="IIbackgroundPopup"></div>

 <a data-toggle="modal" data-target="#myModal" id="toAdd"><img src='../images/AddWBS.png' width='50' height='30'></a>

<section class="content">
    <div class="container">
        <div class="row">
            <div class="main-content">
                <h5>
<?php if (isset($_REQUEST["msg"])) { ?>
    <?php echo $_REQUEST["msg"]; ?>
<?php } ?>
                </h5>

                    <?php if ($uacc == "Full Control") { ?>
                        <?php if (!isset($_REQUEST['EditW'])) { ?>





                    <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">ADD WBS</h4>
        </div>
        <div class="modal-body">
         <form id="form1" name="form1" method="post" action="../../DB/03-scope/GWBSDB-G.php?WID=<?php echo $WID . $var ?>">
          <div class="add-formpage" style="display:block">
                           
                               
                                        <div class="formRow">
                                        
                                            <div class="col-md-4 " style="padding-right:0px;">
                                                <label>WBS Level Code* :</label></div>
                                            <div class="col-md-8" style="padding-left:0px;">
                                                <select class="" name="PNode" id="PNodeIP">
        <?php
        $result = mysql_query("SELECT * FROM globalwbs where companyID = '$id' && gwbslist_id='$WID' ORDER BY WBSIDA ASC,WBSIDA ASC,WBSIDB ASC,WBSIDC ASC,WBSIDD ASC,WBSIDE ASC");

        $count = 0;
		echo "<option value=''>ROOT</option>";
        //echo "<option value='0.0.0.0.0'>0.0.0.0.0 - ROOT</option>";

        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"];
            $WBSdes = $row["description"];


            $count ++;



            if ($WBSIDE == 0)
                echo "<option value='$WBSID'>" . $WBSIDA . "." . $WBSIDB . "." . $WBSIDC . "." . $WBSIDD . "." . $WBSIDE . " - " . $WBSdes . "</option>";
        }
        ?>
                                                </select> 
                                           </div>
                                           </div>
                                           <div class="formRow">
                                            
                                                 <div class="col-md-4" style="padding-right:0px;">
                                                <label>WBS Description* :</label></div>
                                            <div class="col-md-8" style="padding-left:0px;">
                                                <input class="a1" name="description" type="text" id="description" size="30" required="required" /> 
                                                
                                            </div>
                                          </div>
                                          

</div>

        </div>
        <div class="modal-footer">
          <div class="grid2 submit-btn save-bottom"> 
               <button type="submit" class="btn btn-success"><i class="fa fa-check-square"></i> </button>
          </div>
        </div>
         </form>
      </div>
      
    </div>
  </div>
  
  
  

                        <div class="add-formpage" style="display:block">
                            <form id="formwbs" name="formwbs" method="post" action="../../DB/03-scope/GWBSDB-G.php?WID=<?php echo $WID . $var ?>">
                                <fieldset>
                                    <div class="widget">
                                        <div class="whead">
                                            <h6>
                                                <i class="fa fa-plus-circle"></i>
                                                Add </h6>
                                            <strong><a href="javascript:void(0)" onClick="hideform()" class="teamclose"><i class="fa fa-times" title="Delete"></i></a></strong>

                                        </div>
                                        <div class="formRow"><div class="col-sm-12 col-md-6">
                                            <div class="col-sm-12 col-md-4 " style="padding-right:0px;">
                                                <label>WBS Level Code* :</label></div>
                                            <div class="col-sm-12 col-md-8" style="padding-left:0px;">
                                                <select class="" name="PNode" id="PNodeI">
        <?php
        $result = mysql_query("SELECT * FROM globalwbs where companyID = '$id' && gwbslist_id='$WID' ORDER BY WBSIDA ASC,WBSIDA ASC,WBSIDB ASC,WBSIDC ASC,WBSIDD ASC,WBSIDE ASC");

        $count = 0;
		echo "<option value=''>ROOT</option>";
        //echo "<option value='0.0.0.0.0'>0.0.0.0.0 - ROOT</option>";

        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"];
            $WBSdes = $row["description"];


            $count ++;



            if ($WBSIDE == 0)
                echo "<option value='$WBSID'>" . $WBSIDA . "." . $WBSIDB . "." . $WBSIDC . "." . $WBSIDD . "." . $WBSIDE . " - " . $WBSdes . "</option>";
        }
        ?>
                                                </select> </div>
                                           </div>
                                            <div class="col-sm-12 col-md-6">
                                                 <div class="col-sm-12 col-md-4" style="padding-right:0px;">
                                                <label>WBS Description* :</label></div>
                                            <div class="col-sm-12 col-md-8" style="padding-left:0px;">
                                                <input class="a1" name="description" type="text" id="description" size="30" required="required" /> </div>
                                                
                                            </div>
                                          
                                            
                                           
                                        </div>


                                        <div class="formRow">

                                           
                                            <!--<div class="col-sm-12 col-md-2" style="padding-right:0px;">
                                                <label>Notes (if any) :</label>
                                            </div>
                                            <div class="col-sm-12 col-md-10" style="padding-left:0px;">
                                                <textarea hidden="" name="writeupwbs" cols="165" rows="3" class="" style="width: 98%;margin-left: 5px;" id="writeupwbs" ></textarea>
                                            </div>-->
                                           
                                           
                                            <div class="grid2 submit-btn save-bottom"> 
                                                <button type="submit" class="btn btn-success"><i class="fa fa-check-square"></i> </button>
                                            </div>
                                        </div>
                                    </div>




                                    <div class="clear"></div>
                                    <div class="divider"><span></span></div>
                                </fieldset>  
                            </form>
                        </div>





                    </div>

        <?php
    }
}
?>



<?php
$resultWBSname = mysql_query("SELECT WBSList_code FROM wbslist where WBSList_id='$WID'");
$rowWBSname = mysql_fetch_array($resultWBSname, MYSQL_ASSOC);
?>
            <div class="table-subject">

                <!--  -->

                <div class="widget">
                    <div class="whead">
                        <h6 id="active-desciplines" >
                            <b>
                                <i class="fa fa-pie-chart"></i>
                                WBS/ Items/ Activities for <?php echo $rowWBSname['WBSList_code']; ?>
                            </b> 
                        </h6>
                        <span style="line-height: 35px;">

            <?php if ($uacc == "Full Control") { ?>
    <?php if (!isset($_REQUEST['Edit'])) { ?>
                                    <a onClick="showaddform()" style="cursor:pointer"  class="addform-btn " id=""><span class="icon-plus_box  bck"></span></a>
                                    <a onClick="hideform()" style="cursor:pointer" class="hideform-btn " id=""><span class="icon-minus_box  bck"></span></a>

    <?php } else {
        ?>
                                    <a onClick="showeditform()" style="cursor:pointer"  class="eform-btn " id=""><i class="fa fa-pencil-square-o green-icon"></i></a>
                                    <a onClick="hideeform()" style="cursor:pointer" class="hideeform-btn " id=""><span class="icon-minus_box  bck"></span></a>

        <?php }
    ?>
<?php } ?>
                    </div>
                    <div>
                        <!-- <div class="scroll"> --></div>
                </div>
            </div>


            <div id="loader"><img src="../includes/images/loader44.gif"></div>
            <div id="loadWBStable">
                <table style="width:100%">
  
<tr class="">
    <th width="4%" class="accordifth" style="padding-left:8px !important; text-align: center"><i id="openAll" class="fa fa-expand" title="Expand All"></i>&nbsp;<br>
<i id="closeAll" class="fa fa-compress" title="Collapse All"></i></th>
    <th width="10%" align="left" valign="top" bgcolor="#E2E2E2" class="a1" scope="col">Date Created<br />
      (yyyy.mm.dd)
      </th>
    <th width="8%" align="left" valign="top" bgcolor="#E2E2E2" class="a1" scope="col">Sort <br />
      Code </th>
    <th width="10%" align="left" valign="top" bgcolor="#E2E2E2" class="a1" scope="col">WBS/ WPCode/<br />
      Item Code</th>
    <th width="30%" align="left" valign="top" bgcolor="#E2E2E2" class="a1" scope="col">MWBS/ WBS/ WP<br />
      ITEM/ S-ITEM</th>
    <th width="22%" align="left" valign="top" bgcolor="#E2E2E2" class="a1" scope="col">Notes<br />
        (IF ANY)</th>
    <th width="15%" colspan="2" align="right" valign="top" bgcolor="#E2E2E2" class="a1" scope="col">Actions <br />
    </th>
    </tr>
    
    <tr>
    <td colspan="7">
    
    
    <div class="bwl_acc_container" id="default_accordion">
            
            <div class="accordion_search_container">
                <input type="text" class="accordion_search_input_box " value="" placeholder="Search ..." style="width:98%"/><span style="width:2%; float:right; height:38px; cursor:pointer" class="acc_search_btn search_icon"></span>
            </div> <!-- end .bwl_acc_container -->
            
            <div class="search_result_container"></div> <!-- end .search_result_container -->
            
            
            
<?php
$parent =0;
$WID=isset($_REQUEST['WID'])?$_REQUEST['WID']:0;
if(isset($_REQUEST['p']))
$id=$_REQUEST['p'];
include_once('../../includes/con2pma3.php');

//echo "df";	
//echo "SELECT * FROM globalwbs where gwbslist_id ='$WID' && companyID = '$id' && parent=0 ORDER BY WBSIDA ASC,WBSIDA ASC,WBSIDB ASC,WBSIDC ASC,WBSIDD ASC,WBSIDE ASC";
		
$result1 = mysql_query("SELECT * FROM globalwbs where gwbslist_id ='$WID' && companyID = '$id' && parent=0 ORDER BY WBSIDA ASC,WBSIDA ASC,WBSIDB ASC,WBSIDC ASC,WBSIDD ASC,WBSIDE ASC");
		//echo"load";
   		while($row1 = mysql_fetch_array($result1 , MYSQL_ASSOC))
  		{
  		
			$WBSIDA = $row1["WBSIDA"];
	  		$WBSIDB = $row1["WBSIDB"];
	  		$WBSIDC = $row1["WBSIDC"];
	  		$WBSIDD = $row1["WBSIDD"];
	  		$WBSIDE = $row1["WBSIDE"];
			$WBSID1 = $row1["WBSID"];
			
			
			
			?> <!--First level-->
            <section>
                 <h2  onclick="setcookiefunc('<?php echo $row1["WBSID"]; ?>')" class="acc_title_bar "><a class="ff" href="#" ></a> <table width="100%"><tr>
    <td align="left"  width="9%" scope="col" style="text-transform: uppercase; color: chartreuse; font-size:125% !important"><?php echo $row1["creationDate"]; ?></td>
    <td align="left"  width="8%" style="text-transform: uppercase; color: chartreuse; font-size:125% !important"><?php echo $row1["sortCode"]; ?></td>
    <td align="left"  width="9%" style="text-transform: uppercase; color: chartreuse; font-size:125% !important"><?php echo $WBSIDA.".".$WBSIDB.".".$WBSIDC.".".$WBSIDD.".".$WBSIDE; ?></td>
    <td align="left"  width="34%" style="text-transform: uppercase; color: chartreuse; font-size:125% !important" ><?php echo $row1["description"]; ?></td>
    <td align="left"  width="20%" style="text-transform: uppercase; color: chartreuse; font-size:125% !important"><?php echo $row1["writeupwbs"]; ?></td>
    <td colspan="2" align="right"  width="10%">
    <span onclick="LoadWBSG(<?php echo $row1["WBSID"]; ?>, <?php echo $WID ?>,<?php echo $parent?>,event); return false" ><span class="icon-wbs-insert" title="Add WBS"></span></span>
    <span onclick="LoadIITEMForm(<?php echo $row1["WBSID"]; ?>, <?php echo $WID ?>,event);" ><span class="icon-wbs-add" title="Add Item"></span></span>
    <span  onclick="LoadWBSEditForm(<?php echo $row1["WBSID"]; ?>, <?php echo $WID ?>,event); return false; " ><i class="fa fa-pencil-square-o" title="Edit"></i></span>
    <span  onclick="call_del_DB(<?php echo $row1["WBSID"]; ?>, <?php echo $WID ?>,event);" ><i class="fa fa-times" title="Delete"></i></span></td>
    </tr></table></h2>
                <div id="<?php echo 'd'.$row1['WBSID']?>" class=" acc_container " >
                    <div class="block">
                    <?php callWBSItem($WBSID1,$WBSIDA,$WBSIDB,$WBSIDC,$WBSIDD,$WBSIDE, $WID);?>
                    <!--second level-->
                    <?php
					 $result2 = mysql_query("SELECT * FROM globalwbs where gwbslist_id ='$WID' && companyID = '$id' && parent=$WBSID1 ORDER BY WBSIDA ASC,WBSIDA ASC,WBSIDB ASC,WBSIDC ASC,WBSIDD ASC,WBSIDE ASC");
                    while($row2 = mysql_fetch_array($result2 , MYSQL_ASSOC))
  		{
  		 
			$WBSIDA = $row2["WBSIDA"];
	  		$WBSIDB = $row2["WBSIDB"];
	  		$WBSIDC = $row2["WBSIDC"];
	  		$WBSIDD = $row2["WBSIDD"];
	  		$WBSIDE = $row2["WBSIDE"];
			$WBSID2 = $row2["WBSID"];
			
			
			?>
            <section>
                <h2 onclick="setcookiefunc('<?php echo $row2["WBSID"]; ?>')" class="acc_title_bar "><a class="ff" href="#"></a> <table width="100%"><tr>
    <td align="left"  width="9%" scope="col" style="text-transform: uppercase; color:  #62FF91; font-size:105% !important"><?php echo $row2["creationDate"]; ?></td>
    <td align="left"  width="8%" style="text-transform: uppercase; color:  #62FF91; font-size:105% !important"><?php echo $row2["sortCode"]; ?></td>
    <td align="left"  width="9%" style="text-transform: uppercase; color:  #62FF91; font-size:105% !important"><?php echo $WBSIDA.".".$WBSIDB.".".$WBSIDC.".".$WBSIDD.".".$WBSIDE; ?></td>
    <td align="left"  width="34%" style="text-transform: uppercase; color:  #62FF91; font-size:105% !important" ><?php echo $row2["description"]; ?></td>
    <td align="left"  width="20%" style="text-transform: uppercase; color:  #62FF91; font-size:105% !important"><?php echo $row2["writeupwbs"]; ?></td>
    <td colspan="2" align="right"  width="10%">
    <span onclick="LoadWBSG(<?php echo $row2["WBSID"]; ?>, <?php echo $WID ?>,<?php echo $WBSID1;?>,event);  return false" ><span class="icon-wbs-insert" title="Insert Before WBS"></span></span>
    <!--<span onclick="return false" data-toggle="modal" data-target="#myModal" class="icon-wbs-insertA" title="Insert After WBS"><i class="fa fa-tasks" aria-hidden="true" onclick="return false"></i></span>-->
    <span onclick="LoadIITEMForm(<?php echo $row2["WBSID"]; ?>, <?php echo $WID ?>, event); return false" ><span class="icon-wbs-add" title="Add Item"></span></span>
    <span  onclick="LoadWBSEditForm(<?php echo $row2["WBSID"]; ?>, <?php echo $WID ?>,event); return false" ><i class="fa fa-pencil-square-o" title="Edit"></i></span><span  onclick="call_del_DB(<?php echo $row2["WBSID"]; ?>, <?php echo $WID ?>,event);" ><i class="fa fa-times" title="Delete"></i></span></td>
    </tr></table></h2>
                                            <div id="<?php echo 'd'.$row2['WBSID']?>" class=" acc_container " >


                    <div class="block">
                    <?php callWBSItem($WBSID2,$WBSIDA,$WBSIDB,$WBSIDC,$WBSIDD,$WBSIDE, $WID);?>
                     <!--Third level-->
                    <?php
					 $result3 = mysql_query("SELECT * FROM globalwbs where gwbslist_id ='$WID' && companyID = '$id' && parent=$WBSID2 ORDER BY WBSIDA ASC,WBSIDA ASC,WBSIDB ASC,WBSIDC ASC,WBSIDD ASC,WBSIDE ASC");
                    while($row3 = mysql_fetch_array($result3 , MYSQL_ASSOC))
  		{
  		 
			$WBSIDA = $row3["WBSIDA"];
	  		$WBSIDB = $row3["WBSIDB"];
	  		$WBSIDC = $row3["WBSIDC"];
	  		$WBSIDD = $row3["WBSIDD"];
	  		$WBSIDE = $row3["WBSIDE"];
			$WBSID3 = $row3["WBSID"];
			
			
			?>
            <section>
               <h2 onclick="setcookiefunc('<?php echo $row3["WBSID"]; ?>')" class="acc_title_bar "><a class="ff" href="#"></a> <table width="100%"><tr>
                <!--<h2 onclick="setcookiefunc('<?php echo $row3["WBSID"]; ?>')" class="acc_title_bar"><a href="#"></a> <table width="100%"><tr>-->
    <td align="left"  width="9%" scope="col" style="color:  #8EF8AE; font-size:100% !important"><?php echo $row3["creationDate"]; ?></td>
    <td align="left"  width="8%" style="color:  #8EF8AE; font-size:100% !important"><?php echo $row3["sortCode"]; ?></td>
    <td align="left"  width="9%" style="color:  #8EF8AE; font-size:100% !important"><?php echo $WBSIDA.".".$WBSIDB.".".$WBSIDC.".".$WBSIDD.".".$WBSIDE; ?></td>
    <td align="left"  width="34%" style="color:  #8EF8AE; font-size:100% !important"><?php echo $row3["description"]; ?></td>
    <td align="left"  width="20%" style="color:  #8EF8AE; font-size:100% !important"><?php echo $row3["writeupwbs"]; ?></td>
    <td colspan="2" align="right"  width="10%">
    <span onclick="LoadWBSG(<?php echo $row3["WBSID"]; ?>, <?php echo $WID ?>,<?php echo $WBSID2;?>, event);  return false" ><span class="icon-wbs-insert" title="Add WBS"></span></span>
    <span onclick="LoadIITEMForm(<?php echo $row3["WBSID"]; ?>, <?php echo $WID ?>,event); return false" ><span class="icon-wbs-add" title="Add Item"></span></span>
    <span  onclick="LoadWBSEditForm(<?php echo $row3["WBSID"]; ?>, <?php echo $WID ?>,event); return false" ><i class="fa fa-pencil-square-o" title="Edit"></i></span><span  onclick="call_del_DB(<?php echo $row3["WBSID"]; ?>, <?php echo $WID ?>,event);" ><i class="fa fa-times" title="Delete"></i></span></td>
    </tr></table></h2>
                                       <div id="<?php echo 'd'.$row3['WBSID']?>" class="acc_container " >


                    <div class="block">
                    <?php callWBSItem($WBSID3,$WBSIDA,$WBSIDB,$WBSIDC,$WBSIDD,$WBSIDE, $WID);?>
                    <!--Fourth level-->
                    <?php
					 $result4 = mysql_query("SELECT * FROM globalwbs where gwbslist_id ='$WID' && companyID = '$id' && parent=$WBSID3 ORDER BY WBSIDA ASC,WBSIDA ASC,WBSIDB ASC,WBSIDC ASC,WBSIDD ASC,WBSIDE ASC");
                    while($row4 = mysql_fetch_array($result4 , MYSQL_ASSOC))
  		{
  		 
			$WBSIDA = $row4["WBSIDA"];
	  		$WBSIDB = $row4["WBSIDB"];
	  		$WBSIDC = $row4["WBSIDC"];
	  		$WBSIDD = $row4["WBSIDD"];
	  		$WBSIDE = $row4["WBSIDE"];
			$WBSID4 = $row4["WBSID"];
			
			
			?>
            <section>
              <h2 onclick="setcookiefunc('<?php echo $row4["WBSID"]; ?>')" class="acc_title_bar "><a class="ff" href="#"></a> <table width="100%"><tr>
    <td align="left"  width="9%" scope="col" style="color:   #BFF8D0; font-size:100% !important"><?php echo $row4["creationDate"]; ?></td>
    <td align="left"  width="8%" style="color:   #BFF8D0; font-size:100% !important"><?php echo $row4["sortCode"]; ?></td>
    <td align="left"  width="9%" style="color:   #BFF8D0; font-size:100% !important"><?php echo $WBSIDA.".".$WBSIDB.".".$WBSIDC.".".$WBSIDD.".".$WBSIDE; ?></td>
    <td align="left"  width="34%" style="color:   #BFF8D0; font-size:100% !important"><?php echo $row4["description"]; ?></td>
    <td align="left"  width="20%" style="color:   #BFF8D0; font-size:100% !important"><?php echo $row4["writeupwbs"]; ?></td>
    <td colspan="2" align="right"  width="10%">
    <span onclick="LoadWBSG(<?php echo $row4["WBSID"]; ?>, <?php echo $WID ?>,<?php echo $WBSID3;?>,event);  return false" ><span class="icon-wbs-insert" title="Add WBS"></span></span>
    <span onclick="LoadIITEMForm(<?php echo $row4["WBSID"]; ?>, <?php echo $WID ?>,event); return false" ><span class="icon-wbs-add" title="Add Item"></span></span>
    <span  onclick="LoadWBSEditForm(<?php echo $row4["WBSID"]; ?>, <?php echo $WID ?>,event); return false" ><i class="fa fa-pencil-square-o" title="Edit"></i></span><span  onclick="call_del_DB(<?php echo $row4["WBSID"]; ?>, <?php echo $WID ?>,event);" ><i class="fa fa-times" title="Delete"></i></span></td>
    </tr></table></h2>
            <div id="<?php echo 'd'.$row4['WBSID']?>" class=" acc_container " >
                    <div class="block">
                    <?php callWBSItem($WBSID4,$WBSIDA,$WBSIDB,$WBSIDC,$WBSIDD,$WBSIDE, $WID);?>
                    <!--Fifth level-->
                    <?php
					 $result5 = mysql_query("SELECT * FROM globalwbs where gwbslist_id ='$WID' && companyID = '$id' && parent=$WBSID4 ORDER BY WBSIDA ASC,WBSIDA ASC,WBSIDB ASC,WBSIDC ASC,WBSIDD ASC,WBSIDE ASC");
                    while($row5 = mysql_fetch_array($result5 , MYSQL_ASSOC))
  		{
  		 
			$WBSIDA = $row5["WBSIDA"];
	  		$WBSIDB = $row5["WBSIDB"];
	  		$WBSIDC = $row5["WBSIDC"];
	  		$WBSIDD = $row5["WBSIDD"];
	  		$WBSIDE = $row5["WBSIDE"];
			$WBSID5 = $row5["WBSID"];
			
			
			?>
            <section>
               <h2 onclick="setcookiefunc('<?php echo $row5["WBSID"]; ?>')" class="acc_title_bar "><a class="ff" href="#"></a> <table width="100%"><tr>
    <td align="left"  width="9%" scope="col" style="color:#E6F9EC; font-size:100% !important"><?php echo $row5["creationDate"]; ?></td>
    <td align="left"  width="8%" style="color:#E6F9EC; font-size:100% !important"><?php echo $row5["sortCode"]; ?></td>
    <td align="left"  width="9%" style="color:#E6F9EC; font-size:100% !important"><?php echo $WBSIDA.".".$WBSIDB.".".$WBSIDC.".".$WBSIDD.".".$WBSIDE; ?></td>
    <td align="left"  width="34%" style="color:#E6F9EC; font-size:100% !important"><?php echo $row5["description"]; ?></td>
    <td align="left"  width="20%" style="color:#E6F9EC; font-size:100% !important"><?php echo $row5["writeupwbs"]; ?></td>
    <td colspan="2" align="right"  width="10%">
    <span onclick="LoadWBSG(<?php echo $row5["WBSID"]; ?>, <?php echo $WID ?>,<?php echo $WBSID4;?>,event);  return false" ><span class="icon-wbs-insert" title="Add WBS"></span></span>
    <span onclick="LoadIITEMForm(<?php echo $row5["WBSID"]; ?>, <?php echo $WID ?>,event); return false" ><span class="icon-wbs-add" title="Add Item"></span></span>
    <span  onclick="LoadWBSEditForm(<?php echo $row5["WBSID"]; ?>, <?php echo $WID ?>,event); return false" ><i class="fa fa-pencil-square-o" title="Edit"></i></span><span  onclick="call_del_DB(<?php echo $row5["WBSID"]; ?>, <?php echo $WID ?>,event);" ><i class="fa fa-times" title="Delete"></i></span></td>
    </tr></table></h2>
                <div id="<?php echo 'd'.$row5['WBSID']?>" class=" acc_container " >
                    <div class="block">
                    <?php callWBSItem($WBSID5,$WBSIDA,$WBSIDB,$WBSIDC,$WBSIDD,$WBSIDE, $WID);?>
                    
                    
                    
                    </div>
                    </div>
             </section>
                    
                    <?php } // End of Fifth  level ?>
                    
                    
                    </div>
                    </div>
             </section>
                    
                    <?php } // End of Fourth  level ?>
                    
                    
                    
                    </div>
                    </div>
             </section>
                    
                    <?php } // End of third  level ?>
                    
                    
                    
                </div>
                    </div>
             </section>
                    
                    <?php } // End of second  level ?>
                   
                   
                  </div>
              </div>
             </section>
    
  
   <?php } // End of first level ?>
        
        </div></td>
    </tr>
    </table>
    <?php function callWBSItem($WBSID,$WBSIDA,$WBSIDB,$WBSIDC,$WBSIDD,$WBSIDE, $WID)
			{
			$cookiearrays = array();
$sess =array();
$sess = isset($_SESSION['acc_session'])?$_SESSION['acc_session']:"";
$strings ="[0000],";
if(is_array($sess)){
foreach($sess as $k=>$v){
     
     $strings .= '['.$v."],";
     $cookiearrays[$v] =  $v;

}
}

		 $result1 = mysql_query("SELECT * FROM globalitems where WBSID = '$WBSID' && itemParent = '0' ORDER BY itemID ASC");
		
   		while($row = mysql_fetch_array($result1 , MYSQL_ASSOC))
  		{
			?>
            <section>
               <h2 onclick="setcookiefunc('<?php echo $row["itemID"]; ?>')" class="acc_title_bar itemrow"><a class="ff" href="#"></a> <table width="100%"><tr >
    <td align="left" bgcolor="#F2F2FF" style="color:#000"  width="9%"><?php echo $row["dateCreated"]; ?></td>    
    
    <td align="left" bgcolor="#F2F2FF" style="color:#000"  width="8%">&nbsp;<?php echo $row["sortCode"]; ?></td>
    <td  width="9%" align="left" bgcolor="#F2F2FF" style="color:#000">
      <?php $items = $row["itemID"]; echo  $WBSIDA.".".$WBSIDB.".".$WBSIDC.".".$WBSIDD.".".$WBSIDE.".".$row["itemID"]; ?>
    </td>
    <td align="left" bgcolor="#F2F2FF" style="color:#000"  width="34%">&nbsp;&nbsp;<?php echo $row["description"]; ?></td>
    <td align="left"  width="30%" bgcolor="#F2F2FF" style="color:#000"><?php echo $row["writeupitem"]; ?></td>
    <td width="20%" align="right" bgcolor="#F2F2FF">
         <span onclick="LoadSIITEMForm(<?php echo $row["WBSID"]; ?>,<?php echo $row["itemID"]; ?>, <?php echo $WID ?>,event); return false" ><span class="icon-wbs-insert" title="Add WBS"></span></span>
        <span  onclick="LoadITEMEditForm(<?php echo $row["itemID"]; ?>,<?php echo $WID ?>,event); return false" ><i class="fa fa-pencil-square-o" title="Edit"></i></span>
    <span onclick="call_del_IDB(<?php echo $row["itemID"]; ?>,<?php echo $WID ?>,event);" ><i class="fa fa-times" title="Delete"></i></span></td>
  </tr></table></h2>
                <div id="<?php echo 'd'.$row['itemID']?>" class=" acc_container " >
                    <div class="block">
                    
<!--                    sub items 
-->                    
                    
           <?php
           
		   $result123 = mysql_query("SELECT * FROM globalitems where WBSID = '$WBSID' && itemParent = '$items' ORDER BY itemID ASC");
		
   		while($row1 = mysql_fetch_array($result123 , MYSQL_ASSOC))
  		{
		
  		?>
        
  <table width="100%"><tr class="a8">
    <td align="left" class="a8" scope="row"><?php echo $row1["dateCreated"]; ?></td>
    <td align="left" class="a8">&nbsp;&nbsp;<?php echo $row1["sortCode"]; ?></td>
    <td align="left" class="a8">&nbsp;&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" class="a8">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row1["description"]; ?></td>
    <td align="left" class="a8"><?php echo $row1["writeupitem"]; ?></td>
    <td align="right" class="a8">
    
   
    
    <td align="right" valign="top" class="a8">
         <span  onclick="LoadITEMEditForm(<?php echo $row1["itemID"]; ?>,<?php echo $WID ?>,event); return false" ><i class="fa fa-pencil-square-o" title="Edit"></i></span>
        <span onclick="call_del_IDB(<?php echo $row1["itemID"]; ?>,<?php echo $WID ?>,event);" ><i class="fa fa-times" title="Delete"></i></a></span></td>
  </tr></table>
  
  <?php }?>
                    
                    
                    
                    </div>
                    </div>
             </section>
		<?php }
			}
	?>
                
            </div>
            </section>

            <script>
                
//              

   $(function () {

                    $("#default_accordion").bwlAccordion({
                        theme: 'theme-blue',
                        highlight_bg: 'red'
                    });

                });
                var myAry = new Array();
                $.session.set('name', "");
                function setcookiefunc(id) {
                    $("#d" + id).removeClass('displayblock');
                    var storedAry = new Array();
                    storedAry = $.session.get('name') ? JSON.parse($.session.get('name')) : [];
                    //          storedAry = ['abs','sdc','ds'];
                    count = storedAry.length;

                    var s = "d" + id;
                    myAry[count] = id;

                    $.session.set('name', JSON.stringify(myAry));
                    $.post("setaccordisession.php", {"id": myAry});
                }
            </script>
            <div class="divider"><span></span></div>

            <!--  -->


        </div>
    </div>
  <script>  function showloader(){
      
        $(".action-td input").attr("src", '../images/loader.gif');
    }</script>
    <footer></footer>


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