<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="themes/jquery/css/themes/default/jquery.mobile-1.4.5.min.css">
	<link rel="stylesheet" href="themes/home/css/fonts/font-awesome.min.css">
    <link rel="stylesheet" href="themes/home/css/ui-box.css">
    <link rel="stylesheet" href="themes/home/css/ui-base.css">
    <link rel="stylesheet" href="themes/home/css/ui-color.css">
    <link rel="stylesheet" href="themes/home/css/icon.css">
    <link rel="stylesheet" href="themes/home/css/control.css">
    <link rel="stylesheet" href="themes/home/css/main.css">
	<script src="themes/jquery/js/jquery.js"></script>
	<script src="themes/jquery/js/jquery.mobile-1.4.5.min.js"></script>
</head>
<body class="um-vp c-wh " ontouchstart>
	<div data-role="page" data-quicklinks="true" class="ub ub-ver ">
      <div data-role="header" id="header" data-position="fixed" data-fullscreen="true" data-tap-toggle="false" >
	  <div class="uh bc-text-head ub bc-head">
                <div class="nav-btn" id="nav-left" onClick="javascript:window.location='index.php?ac=<?php echo $ac;?>&fileurl=plugin&type=<?php echo $type;?>'">
                    <div class="fa fa-angle-left fa-2x"></div>
                </div>
                <h1 class="ut ub-f1 ulev-3 ut-s tx-c" tabindex="0">任务跟踪</h1>
				
                <div class="nav-btn nav-bt" id="nav-right">
				
                    <!--<div class="ub-img icon-edit umw2 umh4"></div> -->
				
                </div>
				
       </div>
	  
</div>
		<!-- /header -->
  <div data-role="content" id="content">
				
				<div class="ub ub-ver">
				
					
					<div class="uinn-a6 sc-text  ulev-app1">
						<?php echo trim($row['title']);?>
					</div>
					<div class="ub ub-ver uinn-a1 ub-f1">
						<div class="uba bc-border c-wh">
							<ul class="ubb ub bc-border bc-text ub-ac uinn-a9">
								<li class="uw-infor ut-s sc-text  umar-r-infor ulev-app1">
									完成进度
								</li>
								<li class="ub-f1 ulev-app1">
								<?php
								  $nums = $db->result("SELECT COUNT(*) AS nums FROM ".DB_TABLEPRE."duty_user  WHERE dutyid='".$row['id']."'");
								  $key1 = $db->fetch_one_array("SELECT sum(progress) as progress FROM ".DB_TABLEPRE."duty_log WHERE dutyid='".$row['id']."'");
								 
								 $progress=$key1["progress"]/$nums;
								 $progress=explode('.',$progress);
								 if($progress[1]!=''){
									 $ps= $progress[0].'.'.substr($progress[1], 0, 2);
								 }else{
									 $ps=  $progress[0];
								 }
								  ?>
									<input type="range" name="slider-2" id="slider-2" value="<?php echo $ps;?>" min="0" max="100" data-highlight="true">
								</li>
							</ul>
							<ul class="ubb ub bc-border bc-text ub-ac uinn-a9">
								<li class="uw-infor ut-s sc-text  umar-r-infor ulev-app1">
									任务编号
								</li>
								<li class="ub-f1 ulev-app1">
									<?php echo trim($row['number']);?>
								</li>
							</ul>
							<ul class="ubb ub bc-border bc-text ub-ac uinn-a9">
								<li class="uw-infor ut-s sc-text  umar-r-infor ulev-app1">
									任务周期
								</li>
								<li class="ub-f1 ulev-app1">
									<?php echo $row['startdate'];?>到<?php echo $row['enddate'];?>
								</li>
							</ul>
							<ul class="ubb ub bc-border bc-text ub-ac uinn-a9">
								<li class="uw-infor ut-s sc-text  umar-r-infor ulev-app1">
									附件文档
								</li>
								<li class="ub-f1 ulev-app1">
									<? if($row['appendix']!=''){?>
										有附件
										<? }else{?>
										无附件
										<? }?>
								</li>
							</ul>
							<ul class="ubb ub bc-border bc-text ub-ac uinn-a9">
								<li class="uw-infor ut-s sc-text  umar-r-infor ulev-app1">
									分配人
								</li>
								<li class="ub-f1 ulev-app1">
									<?php echo get_realname($row['uid']);?>
								</li>
							</ul>
							<ul class="ubb ub bc-border bc-text ub-ac uinn-a9">
								<li class="uw-infor ut-s sc-text  umar-r-infor ulev-app1">
									分配时间
								</li>
								<li class="ub-f1 ulev-app1">
									<?php echo trim($row['date']);?>
								</li>
							</ul>
							
							<ul class=" ub bc-text ub-ac uinn-a9">
								<li class="uw-infor ut-s sc-text  umar-r-infor ulev-app1">
									备注
								</li>
								<li class="ub-f1 ulev-app1">
									<?php echo $row['note'];?>
								</li>
							</ul>
							
						</div>
					</div>
			<div class="ui-body ui-body-a ui-corner-all" style="margin-left:9px; margin-right:9px;">
	          <p><?php echo $row['content'];?></p>
	      </div>
			<?php if($row['uid']==$_USER->id){?>
				 <ul data-role="listview" data-inset="true" data-divider-theme="a" data-count-theme="a" data-theme="b" style="margin-left:9px; margin-right:9px;">    <li data-role="list-divider">执行人信息</li>
				 <?php
				$sql = "SELECT * FROM ".DB_TABLEPRE."duty_user WHERE dutyid='".$row['id']."' order by id desc";
				$result = $db->fetch_all($sql);
				foreach ($result as $user) {
				$key1 = $db->fetch_one_array("SELECT sum(progress) as progress FROM ".DB_TABLEPRE."duty_log WHERE dutyid='".$row['id']."' and duid='".$user['id']."' ");
				 //echo $key1["progress"]."%";
				?>

				    <li><a href="#" onClick="javascript:window.location='index.php?ac=<?php echo $ac;?>&fileurl=plugin&type=<?php echo $row['dkey'];?>&do=user_views&dutyid=<?php echo $row['id'];?>&id=<?php echo $user['id'];?>'" data-theme="a"><?php echo get_realname($user['user'])?> <span class="ui-li-count">
					<?php
					if($key1["progress"]!=0){
					echo $key1["progress"].'%';
					}
					?>
					</span></a></li>
				 
				 <?php 
				 }?>
				 </ul>
				 <?php
				 }else{?>
				 <ul data-role="listview" data-inset="true" data-divider-theme="a" data-count-theme="a" data-theme="b">    <li data-role="list-divider">我的执行信息</li>
				 <?php
				$sql = "SELECT * FROM ".DB_TABLEPRE."duty_user WHERE dutyid='".$row['id']."' and user='".$_USER->id."' order by id desc";
				$result = $db->fetch_all($sql);
				foreach ($result as $user) {
				$key1 = $db->fetch_one_array("SELECT sum(progress) as progress FROM ".DB_TABLEPRE."duty_log WHERE dutyid='".$row['id']."' and duid='".$user['id']."' ");
				 //echo $key1["progress"]."%";
				?>

				    <li><a href="#" onClick="javascript:window.location='index.php?ac=<?php echo $ac;?>&fileurl=plugin&type=<?php echo $row['dkey'];?>&do=user_views&dutyid=<?php echo $row['id'];?>&id=<?php echo $user['id'];?>'" data-theme="a"><?php echo get_realname($user['user'])?> <span class="ui-li-count">
					<?php
					if($key1["progress"]!=0){
					echo $key1["progress"].'%';
					}
					?>
					</span></a></li>
				 
				 <?php 
				 }?>
				 </ul>
				 <?php
				 }?>
			
					
			</div>

		</div>
  </div>


	</div><!-- /page -->
 <script type="text/javascript"> 
    window.onload = function(){ 
        var heg=document.getElementById("header").offsetHeight;
		var content=document.getElementById("content"); 
		content.style.cssText="margin-top:"+heg+"px;";
    }
</script> 
</body>
</html>
