<?php

include ($PATH . 'globals/globals.php');

$adminAct = $_REQUEST['adminAct']; 

$editID = $_REQUEST['editID']; 
$query = 'SELECT p.*, ps.*, c.*, pt.*, sp.*, sc.clientName AS supportProvider FROM projects AS p LEFT JOIN projectStatus AS ps ON (p.projectStatus = ps.pstatID) LEFT JOIN clients AS c on (p.clientID = c.clientID) LEFT JOIN projectType AS pt ON (p.projectType = pt.ptypeID) LEFT JOIN supportPlans sp ON (c.clientSupport = sp.supportID) LEFT JOIN clients sc ON (sp.supportParentClient = sc.clientID) WHERE p.projectID=' . $editID; 
$result = $con->query($query);
		
while ($row=$result->fetch_array(MYSQLI_ASSOC)) {
	$op = 'pay';
	$projectID = $row['projectID'];
	$projectName = $row['projectName'];
	$projectDesc = $row['projectDesc'];
	$projectClient = $row['clientName'];
	$projectStatus = $row['pstatDesc'];
	$projectStart = $row['projectStart'];
	$projectTargetComp = $row['projectTargetComp'];
	$projectTimeEstimate = $row['projectTimeEstimate'];
	$supportPlan = ((!empty($row['supportName'])) ? '<a class="tooltip" title="'. $row['supportDesc'] .'">'. $row['supportName']. ' ('. $row['supportProvider'] .')</a>' : '<span style="color: red"><strong>NONE</strong></span>');
	$projectRate = $row['projectRate'];
	$subBtn = 'Save Changes';
	$modalTitle = '<h2>Apply Time to: '. $projectName . '</h2>';
}

include('list/project-time.php'); 
	
if ($hoursTotal == $hoursBillable)
	$hoursTotal = '<span class="timeExact">'. $hoursTotal .'<span>';
elseif ($hoursTotal > $hoursBillable)
	$hoursTotal = '<span class="timeOver">'. $hoursTotal .'<span>';
else
	$hoursTotal = '<span class="timeUnder">'. $hoursTotal .'<span>';

$outstandingAmount = $projectAmount-$hoursBillable;

$tasks = getTasks($projectID,$taskID,$con);

include('form/project-time.php'); 	 

?>