<?php require_once('../Connections/oprmConn.php'); if(isset($_POST['submit'])) {
$sdt = date("Y-m-d",strtotime($_POST['caeated_date']));
$d = date("Y-m-d");
$ud = $_REQUEST['user_id'];

$p = "UPDATE weby_users` SET `caeated_date` = '$sdt'  WHERE user_id = '$ud'";
mysql_select_db($database_oprmConn, $oprmConn);
$query_getProj = $p;
$getProj = mysql_query($query_getProj, $oprmConn) or die(mysql_error());
$l = "resources-view.php?user_id=$ud&msg=Joined Date Updated";
header("Location: $l");
}

?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$maxRows_getTimeSheet = 2;
$pageNum_getTimeSheet = 0;
if (isset($_GET['pageNum_getTimeSheet'])) {
  $pageNum_getTimeSheet = $_GET['pageNum_getTimeSheet'];
}
$startRow_getTimeSheet = $pageNum_getTimeSheet * $maxRows_getTimeSheet;

mysql_select_db($database_oprmConn, $oprmConn);
$query_getTimeSheet = "SELECT distinct weby_timesheets.timesheet_id, weby_timesheets.user_id, weby_timesheets.total_hrs, weby_timesheets.hr_rate, weby_timesheets.total_amount, weby_profiles.full_name, weby_profiles.contact_phone, weby_projects.project_name, weby_profiles.profile_pic, weby_profiles.job_title, weby_profiles.skill_set FROM weby_timesheets, weby_profiles, weby_projects, weby_users_projects WHERE weby_timesheets.user_id = weby_profiles.user_id  AND weby_projects.projetc_id = weby_timesheets.project_id and weby_profiles.user_id = weby_users_projects.user_id and weby_users_projects.project_id = weby_projects.projetc_id order by weby_timesheets.updated_date desc";
$query_limit_getTimeSheet = sprintf("%s LIMIT %d, %d", $query_getTimeSheet, $startRow_getTimeSheet, $maxRows_getTimeSheet);
$getTimeSheet = mysql_query($query_limit_getTimeSheet, $oprmConn) or die(mysql_error());
$row_getTimeSheet = mysql_fetch_assoc($getTimeSheet);

if (isset($_GET['totalRows_getTimeSheet'])) {
  $totalRows_getTimeSheet = $_GET['totalRows_getTimeSheet'];
} else {
  $all_getTimeSheet = mysql_query($query_getTimeSheet);
  $totalRows_getTimeSheet = mysql_num_rows($all_getTimeSheet);
}
$totalPages_getTimeSheet = ceil($totalRows_getTimeSheet/$maxRows_getTimeSheet)-1;


mysql_select_db($database_oprmConn, $oprmConn);
$query_getProf = "SELECT weby_profiles.*,weby_users.email_address, weby_users.status, weby_users.updated_date, weby_users.caeated_date as jdate FROM weby_profiles, weby_users WHERE weby_users.user_id = weby_profiles.user_id AND weby_profiles.user_id = '$_REQUEST[user_id]'";
$getProf = mysql_query($query_getProf, $oprmConn) or die(mysql_error());
$row_getProf = mysql_fetch_assoc($getProf);
$totalRows_getProf = mysql_num_rows($getProf);

mysql_select_db($database_oprmConn, $oprmConn);
$query_getProf1 = "SELECT * FROM weby_projects WHERE status='A'";
$getProf1 = mysql_query($query_getProf1, $oprmConn) or die(mysql_error());
$row_getProf1 = mysql_fetch_assoc($getProf1);
$totalRows_getProf1 = mysql_num_rows($getProf1);

mysql_select_db($database_oprmConn, $oprmConn);
$query_getCuPro = "SELECT weby_users_projects.project_id, weby_users_projects.status, weby_users_projects.created_by, weby_users_projects.created_date, weby_projects.project_name, weby_projects.project_description, weby_users_projects.user_id FROM weby_users_projects, weby_projects WHERE weby_projects.projetc_id = weby_users_projects.project_id AND weby_users_projects.user_id = '$_REQUEST[user_id]' AND weby_users_projects.status = 'A'";
$getCuPro = mysql_query($query_getCuPro, $oprmConn) or die(mysql_error());
$row_getCuPro = mysql_fetch_assoc($getCuPro);
$totalRows_getCuPro = mysql_num_rows($getCuPro);

mysql_select_db($database_oprmConn, $oprmConn);
$query_getDoclist = "SELECT distinct d.doc_id, d.profile_id, d.other_docs, weby_profiles.profile_id, weby_profiles.user_id, weby_users.user_id FROM otherdoc d, weby_profiles, weby_users WHERE weby_profiles.user_id = $_REQUEST[user_id] AND (d.profile_id = weby_profiles.profile_id AND d.status = 'A') group by d.doc_id";
//$query_getDoclist = "SELECT d.*, FROM otherdoc d WHERE (weby_profiles.profile_id = select profile_id FROM weby_profiles where user_id=$_REQUEST[user_id]) AND d.status = 'A'";

$getDoclist = mysql_query($query_getDoclist, $oprmConn) or die(mysql_error());
$row_getDoclist = mysql_fetch_assoc($getDoclist);
$totalRows_getDoclist = mysql_num_rows($getDoclist);

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Phalanx Consultancy - Tool-Admin- Resource View</title>
<link rel="stylesheet" href="../css/style.css" type="text/css">
    <!-- IE Fix for HTML5 Tags -->
    <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> 
	<![endif]-->
    <link rel="stylesheet" href="../css/style.css" type="text/css">
  <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
    <script>
$(function() {
	
   $( "#caeated_date" ).datepicker();
	
  
});
</script>
<script>
function validateForm() {
var cdate = document.getElementById('caeated_date').value;
if (cdate == "") {
       alert ("Join Date filled out");
	   return false;
    }
}
</script>
</head>

<body>


<!-- Wrapper Starts -->

<div id="wrapper">

    <?php  require_once('../includes/header.php'); ?>
    
<?php  require_once('../includes/tools-menu.php'); ?>
  <!-- Content Goes here -->

    
    <!-- Content Goes here -->
    <article class="inside_wrapper clear_fix">
    
    	<!-- Main Content Goes here -->
      <section class="main_content">
    		 <h1>Edit Joined Date</h1>
             
                <!--<div class="welcome_box">
                <div class="timesheet_type"><div class="welcome_txt arrow">Welcome Admin
            	<ul> <li><a href="index.php">Dashboard</a></li>
                <li><a href="timesheet-all.php">Time sheet</a></li>
                <li><a href="project-list.php">Projects</a></li>
            	<li><a href="resources-list.php">Resources</a></li>
            	<li><a href="profile.php">Profile</a></li>
                <li><a href="leave-list.php">Leave Manager</a></li>
                 <li><a href="reports.php">Records</a></li>
            	<li><a href="logout.php">Logout</a></li>
            	</ul>	
                </div>
                </div>	
             </div> -->
              <article class="resource_timesheet">
            <div class="admin_containerj">
           
            <div class="profile_img">
           <img src="/RM/images/<?php if(!empty($row_getProf['profile_pic']))echo $row_getProf['profile_pic']; else echo "black-img.jpg"; ?>" width="68" /></div>
           <div class="featured yellow"><h4><strong><?php echo $row_getProf['full_name']; ?>
          <span class="desig"><br>
              <?php echo $row_getProf['job_title']; ?></strong></h4></div>
           <span class="desig"> <p>  <?php echo $row_getProf['email_address']; ?> <br /><?php echo $row_getTimeSheet['contact_phone']; ?></p></span>
                  </div>
              <div class="clear-fix">&nbsp;</div>
              <div class="clear-fix">&nbsp;</div>
              <form method="post" action="#" id="submit_timesheet" onsubmit="return validateForm()">
              
              
                
                <!--<div class="field_item">
                	<label>Date:</label>
                    <input name="caeated_date" type="text" id="caeated_date" readonly="readonly" />
                </div>-->
                 <div class="field_item">
               	<label>Joined Date:</label>
                    <input name="caeated_date" type="text" id="caeated_date" readonly="readonly" value ="<?php echo date('m/d/Y', strtotime($row_getProf['jdate'])); ?>"/></div>
               
                
                <div class="action_items">
                    	<input name="submit" type="submit" class="save_btn" onclick="MM_validateForm('caeated_date','','R');return document.MM_returnValue" value="Save">
                        <input type="reset" value="Cancel" class="reset_btn" onclick="window.location.href='resources-view.php?user_id=<?php echo $row_getProf['user_id']; ?>'">
                </div>
              </form>
     	<div class="clear-fix">&nbsp;</div> 
            </article>
      </section>
    
    	<!-- Sidebar Goes here -->
      <aside class="sidebar">
          
            <?php include("timesheet.php"); ?>
           
        </aside>
    
    	 
    
     	<div class="clear-fix">&nbsp;</div> 
        
    </article>
    
  <div class="clear-fix">&nbsp;</div>
    <!-- Footer Goes here -->
   <?php  require_once('../includes/footer.php'); ?>
    
</div>
</body>
</html>

