
<!doctype html>
<html class="no-js" lang="">

<head>
<?php error_reporting(0); ?>
    <!-- meta -->
    <meta charset="utf-8">
    <meta name="description" content="Flat, Clean, Responsive, application admin template built with bootstrap 3">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
    <!-- /meta -->

    <title>Carbon Blue</title>

    <!-- page level plugin styles -->
    <link rel="stylesheet" href="plugins/responsive-tables/theme.css">
    <!-- /page level plugin styles -->

    <!-- core styles -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/font-awesome.css">
    <link rel="stylesheet" href="css/themify-icons.css">
    <link rel="stylesheet" href="css/animate.min.css">
    <!-- /core styles -->

    <!-- template styles -->
    <link rel="stylesheet" href="css/skins/palette.css">
    <link rel="stylesheet" href="css/fonts/font.css">
    <link rel="stylesheet" href="css/main.css">
    <!-- template styles -->

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- load modernizer -->
    <script src="plugins/modernizr.js"></script>
	

	<link rel="stylesheet" href="awesomplete-gh-pages/awesomplete.css" />
<script src="awesomplete-gh-pages/awesomplete.js" async></script>
	
	<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
	
	<link rel="stylesheet" type="text/css" media="all" href="date/jsDatePick_ltr.min.css" />
	<script type="text/javascript" src="date/jsDatePick.min.1.3.js"></script>
	
	 

  
		   <?php	 
		
		
	$cookie_name = "user_ws";
	
if(!isset($_COOKIE[$cookie_name])) {
   // echo "Cookie named '" . $cookie_name . "' is not set!";
	header('Location: sign-in.php');
	exit;
} else {
    //echo "Cookie '" . $cookie_name . "' is set!<br>";
    //echo "Value is: " . $_COOKIE[$cookie_name];
}
?>

  
							   <?php
									
										 $_gp_id =  $_COOKIE[$cookie_name];
								
									$con = mysql_connect('localhost', 'root', 'Boom95z') or die(mysql_error());
									mysql_select_db('orion9', $con);
								
									$result = mysql_query("select company_name from general_people where gp_id=" . $_gp_id);
									while($row = mysql_fetch_array($result))
									{    
										$company_name = $row['company_name']; 
									}
									
									
									
				$filterbox = $_POST['filterbox'];
			 
				$qryAdd = " 1=1 ";
				
				if ($filterbox != "")
				{
					$qryAdd = " UPPER(text) like '%" . strtoupper($filterbox) . "%'";
				}
				 
				
				//$result1 = mysql_query("SELECT a.*,b.PID from records a, process b where a.status='COMPLETE' and  a.RID = b.RID and b.stage='LEAD'");
				 $result1 = mysql_query("select a.stage, a.pid,
					(select text from content_val g where a.pid=g.pid and g.fid=74) as 'Project Name',
					(select g1.representative from content_val g, internal_people g1 where a.pid=g.pid and g1.int_id = g.text and g.fid=84) as 'Project Manager',	
					(select text from content_val g where  a.pid=g.pid and g.fid=78) as 'Organisation'
						from process a
						where a.discard is null and (exists (select 1 from content_val dd where dd.fid=251 and dd.pid=a.pid and dd.text=" . $_gp_id .")) " . 
						" and (exists (select 1 from content_val mm where  a.pid=mm.pid and mm.text in ('PRE-INSTALL','INSTALLATION','POST-INSTALL') and mm.fid=176)) and						
((exists (select 1 from content_val h where " . $qryAdd . " and h.pid=a.pid and h.fid=78))
or (exists (select 1 from content_val i where " . $qryAdd . " and i.pid=a.pid and i.fid=74)))"
				 );

				 
				 
									
									$n = $_GET['n'];
				 $v = $_GET['v'];
				 $inpid = $_GET['inpid'];
				 $showFile = $_GET['showFile'];	
									
									
									
									$showThis = false; 
				if ($v == '1')
				{
					$showThis = true; 
				}	
				 
				 
									?>
							   
 
</head>

<!-- body -->

<body>

 							  
    <div class="app">
        <!-- top header -->
        
 
 
  

<header class="header header-fixed navbar" style="background-color:#59b2ff;">

            <div class="brand" style="background-color:#ccc;"><center>
                <!-- toggle offscreen menu -->
          
                <a href="home.php?x=ocNvi07amIHwp7J6Zfr3fIvqLNE4h0UFdHbvHiF31nAqujxtzZxPI2ftQUx7VrN89YEQhkUiHvJbOhFogceYftr5oZckrZsAY6rf" class="navbar-brand">
                    <img src="unnamed.png"  alt="">
                     
                </a> </center>
            </div>

            <ul class="nav navbar-nav">
                <li class="hidden-xs"> 
                     
                </li> 
            </ul> 
            <ul class="nav navbar-nav navbar-right"> 
                <li class="off-right">
                    <a href="javascript:;" data-toggle="dropdown">
                        
                         <span class="hidden-xs ml10" style='font-family:calibri;'><?php echo $company_name;?></span>
                        <i class="ti-angle-down ti-caret hidden-xs"></i>
                    </a>
                    <ul class="dropdown-menu animated fadeInRight">
                     
                        <li>
                            
							 <a href="log_ws_out.php" onclick="">Logout</a>
                        </li>
                    </ul>
                </li>
            </ul>
        </header>
        <!-- /top header -->

        <section class="layout">
            <!-- sidebar menu -->
           <aside style='display:none;' class="sidebar offscreen-left" style="border-right:solid 1px #ccc;">
                <!-- main navigation -->
                <nav class="main-navigation" data-height="auto" data-size="6px" data-distance="0" data-rail-visible="true" data-wheel-step="10">
                    <br/>
                    <ul class="nav">
                        <!-- dashboard -->
                        <li style="background-color:#008362; font-family:calibri;  color:white; border-bottom:solid 1px white;">
                            <a href="home.php" onclick="checkChangesSideBar('home.php','ocNvi07amIHwp7J6Zfr3fIvqLNE4h0UFdHbvHiF31nAqujxtzZxPI2ftQUx7VrN89YEQhkUiHvJbOhFogceYftr5oZckrZsAY6rf')">
                              
                                <span style="color:white;"><i class="fa fa-rocket" style='font-size:15px;' aria-hidden="true"></i> PROJECTS</span>
                            </a>
                        </li>  
						   <li style="background-color:#438dcc;  font-family:calibri;  color:white; border-bottom:solid 1px white;">
                             <a href="contacts.php" >
                              
                                <span style="color:white;"><i class="fa fa-user" style='font-size:15px;' aria-hidden="true"></i> CONTACTS</span>
                            </a>
							<ul class="sub-menu" style="display: block;">
                                <li class="active">
                                    
									<a href="internal-contacts.php">
                                        <span>Internal Contacts</span>
                                    </a>
									<a href="contacts.php">
                                        <span>External Contacts</span>
                                    </a>
                                </li>
                             
                            </ul>
                        </li> 
						 <li style="background-color:#438dcc; font-family:calibri;   color:white; border-bottom:solid 1px white;">
                            <?php

if (date('D') == 'Sun')
	$lastSunday = date('d-m-Y');
else
	$lastSunday = date('d-m-Y', strtotime('last Sunday'));

?>



							<a href="timesheet.php?periodA=<?php echo $lastSunday; ?>">
                              
                                <span style="color:white;"><i class="fa fa-clock-o" style='font-size:15px;' aria-hidden="true"></i> TIMESHEETS</span>
                            </a>
                        </li> 
						 
						 <li style="background-color:#438dcc;   font-family:calibri;  color:white; border-bottom:solid 1px white;">
                           <a href="report-module.php">
                              
                                <span style="color:white;"><i class="fa fa-table" style='font-size:15px;' aria-hidden="true"></i> REPORTS</span>
                            </a>
                        </li>
                        <!-- /dashboard -->
     
                    </ul> 
                </nav>
            </aside>
            <!-- /sidebar menu -->

            <!-- main content -->
            <section class="main-content">

                <!-- content wrapper -->
                <div class="content-wrap">

								
				<br/>
				<br/><br/><br/><br/>
				
				
				
				 
				
				
                    <!-- inner content wrapper -->
                    <div class="wrapper">
					
					                        <section class="panel">
                            <!--<header class="panel-heading" style="background-color:#15acdc; color:white;">Home</header>-->
                            <div class="panel-body" style='padding:0px;'>
							
							 
							   
							   
							 
							   
							   
							   
							   <!-- search -->
							   
							   	<div id="searchNow1" style="background-color:white; border: solid 1px #e8e8e8;;">
							 	<div id="ggg" style="background-color:white;  padding:20px; padding-top:3px; ">
							<form class="form-inline" id="searchNow" name="searchNow" action="home.php?x=ocNvi07amIHwp7J6Zfr3fIvqLNE4h0UFdHbvHiF31nAqujxtzZxPI2ftQUx7VrN89YEQhkUiHvJbOhFogceYftr5oZckrZsAY6rf" method="POST">
										
									
								<div style='height:10px;'></div>
									 
									  
		 
		<!--<div style='background-color:#ccc; font-family:calibri;padding:2px;color:white;'><center>PROJECT DETAILS</center></div>-->
					
					
<div id="sResults" class="table-responsive" style='display:<?php if ($showThis) echo 'none';?>;'>
								
						 
								
								
								<!--<small><a href="project-view.php?pid=<?php echo $pid;?>"><i class="fa fa-caret-left" aria-hidden="true"></i> back to <i>project view</i></a></small>
								-->
								
								<div align='right'>
								 <a href="wholesaler-home.php" class="btn btn-info" style='background-color:#59b2ff; border:solid 1px #59b2ff;'>Home</a>  <a href="wholesaler-managed-projects.php" class="btn btn-info" style='background-color:#ccc; border:solid 1px #ccc;'>Projects I'm Managing</a>
								</div>
								
								<b>Hi <?php echo ucwords($company_name);?>, Welcome to the Carbon Blue Client Portal</b>
								
								<div style='height:3px;'></div>
								<div class="row" id='b1'>
									<div class="col-md-6">
										<br><span style="font-size:25px; font-family:calibri;"><u><?php echo $totalResults;?></u> My Projects</span>
									</div>
									<div class="col-md-6">
									 </div>
								</div>
								
								<script>
								function saveStatus(req_id)
								{
									var val = document.getElementById('mas_' + req_id).value;
									
									
									var xmlhttpv = new XMLHttpRequest();
									xmlhttpv.onreadystatechange = function() {
										if (xmlhttpv.readyState == 4 && xmlhttpv.status == 200) {
											//document.getElementById("lPerson").innerHTML = xmlhttp.responseText;
											var response = xmlhttpv.responseText; 
											alert(response);
										}
									};
									xmlhttpv.open("GET", "saveStatus.php?req_id=" + req_id + "&val=" + val, true);
									xmlhttpv.send();
									
								}
								
								</script>
								
								<br>
                                    <table class="table table-bordered table-striped" style="font-size:15px; font-family:calibri;" id='b2'>
                                        <thead>
                                            <tr>
												<!--<th>PID</th>-->
												<th>Stage</th> 
                                                <th>Project Name</th> 
                                                <th>Organisation</th>  
												<th>Project Manager</th>  
												<th></th>
                                            </tr>
                                        </thead> 
                                        <tbody> 
									
										 <?php
											while($row = mysql_fetch_array($result1))
											{	  
												$pidAA = $row['pid'];
												$stage = $row['stage'];
                                                $pn = $row['Project Name'];
												$pm = $row['Project Manager'];
												$org = $row['Organisation'];  
                                                 
												echo "<tr>";
												echo "<td>";
												echo $stage;
												echo "</td>";
												echo "<td>";
												echo $pn;
												echo "</td>";
												echo "<td>";
												echo $org;
												echo "</td>";
												echo "<td>";
												echo $pm;
												echo "</td>";
												echo "<td>";
												echo "<a class='btn btn-info' style='width:100%;' href='wholesaler-home.php?n=1&x=" . $x . "&v=1&inpid=" . $pidAA . "'>VIEW</a>";
												echo "</td>"; 
												echo "</tr>";
											}	
																		 
											  
										?>
										
                                        </tbody>
                                    </table>
                                </div>

			 					<!-- ......................... -->
	 
	 <div  class="table-responsive" id="dDetails" style="display:<?php if (!$showThis) echo 'none';?>;">
								
								<a href="wholesaler-home.php"><small>< Back to Home</small></a>
								<br/><br/>
								
								<?php
								
								
								$result2 = mysql_query("select stage from process where pid=" . $inpid);
								
								$thisSt = "";
					 while($row = mysql_fetch_array($result2))
											{	  
												$thisSt = $row['stage'];
												
											}
								$sFid = "";

									if (strtoupper($thisSt) == "PROJECT")
										$sFid = "176";
									
									if (strtoupper($thisSt) == "OPPORTUNITY")
										$sFid = "174";
									
									if (strtoupper($thisSt) == "LEAD")
										$sFid = "173";
									$thisStat = "";		
									$result2 = mysql_query("select text from content_val where pid=" . $inpid . " and fid=" . $sFid);		
											 while($row = mysql_fetch_array($result2))
											{	  
												$thisStat = $row['text'];
												
											}
								
									 $result2 = mysql_query("select a.*, c.label, b.fid, b.text from process a, content_val b, content c where a.pid = b.pid and b.fid=c.fid and a.pid=" . $inpid . " and b.fid in (78,74,84,62,53,45,79,64,72,65,67,68,71,70,63,69) order by a.stage, form, orderof asc");
		 
		 $result2b = mysql_query("select a.*, c.label, b.fid, b.text, d.company_name from process a, content_val b, content c, general_people d where d.gp_id = b.text and a.pid = b.pid and b.fid=c.fid and a.pid=" . $inpid . " and b.fid in (251) order by a.stage, form, orderof asc");
		 
								
					$result3 = 	mysql_query("select representative,email,mobile from internal_people where int_id=" . 
					"(select g.TEXT from content_val g, internal_people g1 where g.pid = " . $inpid . " and g1.int_id = g.text and g.fid=84)"	
					);
					
					
					$result4 = 	mysql_query("select a.docu_id,a.doc_title, DATE_FORMAT(a.date_uploaded,'%d-%m-%Y') as 'datef',a.uploaded_by, b.representative from 
					wholesaler_documents a, internal_people b where a.uploaded_by = b.int_id and a.pid=" . $inpid	
					);
				 
				 			?>
								
								<div class='row'>
							      <div class='col-md-6'>
                                    <table class="table table-bordered table-striped" style="font-size:12px;">
                                       <tr><th style='background-color:#59b2ff;color:white;' colspan='2'>PROJECT DETAILS</th></tr>
									  
                                        <tbody>
                                            
											 
											<tr><td width='280px'><b>Stage</b></td>
												<td><?php echo $thisSt;?></td></tr>
												
												<tr><td width='280px'><b>Status</b></td>
												<td><?php echo $thisStat;?></td></tr>

											<?php
											 
											 
											 while($row = mysql_fetch_array($result2))
											{	  
												$lbl = $row['label'];
												$vl = $row['text']; 
                                                 
												echo "<tr>";
												echo "<td width='280px'><b>";
												echo $lbl;
												echo "</b></td>";
												echo "<td>";
												echo $vl;
												echo "</td>";
												echo "</tr>";
											}	
												 
											 while($row = mysql_fetch_array($result2b))
											{	  
												$lbl = $row['label'];
												$vl = $row['company_name']; 
                                                 
												echo "<tr>";
												echo "<td width='280px'><b>";
												echo $lbl;
												echo "</b></td>";
												echo "<td>";
												echo $vl;
												echo "</td>";
												echo "</tr>";
											}		

 while($row = mysql_fetch_array($result3))
											{	  
												$email = $row['email'];
												$pm = $row['representative']; 
												$mobile = $row['mobile']; 
                                                 
												echo "<tr><td width='280px'><b>Project Manager</b></td><td>" . $pm . "</td></tr>";
												echo "<tr><td width='280px'><b>Email</b></td><td>" . $email . "</td></tr>";
												echo "<tr><td width='280px'><b>Mobile</b></td><td>" . $mobile . "</td></tr>";
											}							 
											 											
											 
											 ?>
											 
											 
											 
                                        </tbody>
                                    </table>
                                </div> 
								<div class='col-md-6'>
								  <table class="table table-bordered table-striped" style="font-size:12px;">
								    <tr><th style='background-color:#59b2ff;color:white;' >PURCHASE ORDER</th>
									<th style='background-color:#59b2ff;color:white;' >DATE UPLOADED</th>
									<th style='background-color:#59b2ff;color:white;' >UPLOADED BY</th>
									</tr>
								   <?php
								   while($row = mysql_fetch_array($result4))
											{	  
												$docu_id = $row['docu_id'];
												$doc_title = $row['doc_title']; 
												$date_uploaded = $row['datef'];
												$representative = $row['representative'];
                                                 
												echo "<tr>";
												echo "<td width='280px'><b>";
												echo "<a href='ws_docs/" . $doc_title . "' target='blank'>" . $doc_title  . "</a>";
												echo "</b></td>";
												echo "<td>";
												echo $date_uploaded;
												echo "</td>";
												echo "<td>";
												echo $representative;
												echo "</td>";
												echo "</tr>";
											}	
											
											
									?>		
								  </table>
								</div>
								 
								</div>
								
								</div>
								
																
								 
								 
								 
	                    </section>
					
					
			 
					
					<input type="hidden" value="">
                    </div>
                    <!-- /inner content wrapper -->

                </div>
                <!-- /content wrapper -->
                <a class="exit-offscreen"></a>
            </section>
            <!-- /main content -->
        </section>

    </div>
    <!-- core scripts -->
    <script src="plugins/jquery-1.11.1.min.js"></script>
    <script src="bootstrap/js/bootstrap.js"></script>
    <script src="plugins/jquery.slimscroll.min.js"></script>
    <script src="plugins/jquery.easing.min.js"></script>
    <script src="plugins/appear/jquery.appear.js"></script>
    <script src="plugins/jquery.placeholder.js"></script>
    <!-- /core scripts -->

    <!-- page level scripts -->
    <script src="plugins/responsive-tables/responsive-tables.js"></script>
    <!-- /page level scripts -->

    <!-- template scripts -->
    <script src="js/offscreen.js"></script>
    <script src="js/main.js"></script>
    <!-- /template scripts -->

    <!-- page script -->
    <!-- /page script -->

	
	
</body>
<!-- /body --> 
</html>
