<?php include "layouts/menu.php"; ?>
		<script type="text/javascript">
	  $(function() {
   $("#datepicker").datepicker({ dateFormat: 'dd-mm-yy' });
  });
</script>
   
<script type="text/javascript">
function zp(n){
return n<10?("0"+n):n;
}
function insertDate(t,format){
var now=new Date();
var DD=zp(now.getDate());
var MM=zp(now.getMonth()+1);
var YYYY=now.getFullYear();
format=format.replace(/DD/,DD);
format=format.replace(/MM/,MM);
format=format.replace(/YYYY/,YYYY);
t.value=format;
}
</script>

		   <script>
	function autocomplet() {
	var min_length = 0; // min caracters to display the autocomplete
	var keyword = $('#did').val();
	if (keyword.length >= min_length) {
		$.ajax({
			url: 'ajax_refreshentry.php',
			type: 'POST',
			data: {keyword:keyword},
			success:function(data){
				$('#country_list_id').show();
				$('#country_list_id').html(data);
			}
		});
	} else {
		$('#country_list_id').hide();
	}
}

// set_item : this function will be executed when we select an item
function set_item(item) {
	// change input value
	$('#did').val(item);
	// hide proposition list
	$('#country_list_id').hide();
}
	</script>

    <script>
  $(function() {
   $("#datepicker1").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
    <script>
  $(function() {
   $("#datepicker2").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
      <script>
  $(function() {
   $("#datepicker8").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
    <script>
  $(function() {
   $("#datepicker9").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
   <script type="text/javascript">
function CollapseForm()
{
// Two places to customize:

// Specify the id of the form.
var IDofForm = "form1";

// Specify the id of the div containing the form.
var IDofDivWithForm = "demo";

// This line submits the form. (If Ajax processed, call Ajax function, instead.)
document.getElementById(IDofForm).submit();

// This line collapses the form.
document.getElementById(IDofDivWithForm).style.display = "none";
}
</script>
     
    <?php include "layouts/menu1.php"; ?>
            <!-- Right side column. Contains the navbar and content of the page -->
           <div class="right_col" role="main">
                <!-- Content Header (Page header) -->
            
                    <?php
					$new = 0;
						$qry=mysqli_query($conn, "select * from task where staff='$staff' AND new='$new' ORDER BY edate ASC");
						$n=mysqli_num_rows($qry);
						if($n==0)
						{
							echo "Nothing To Display";
						}
						else
						
					{ 
						?>
               <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Enquiry <small>Details</small></h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                      <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                        <ul class="dropdown-menu" role="menu">
                          <li><a href="#">Settings 1</a>
                          </li>
                          <li><a href="#">Settings 2</a>
                          </li>
                        </ul>
                      </li>
                      <li><a class="close-link"><i class="fa fa-close"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <p class="text-muted font-13 m-b-30">
                       </p>
                    <table id="datatable" id="datatable-buttons" class="table table-striped table-bordered">
                                        <thead>
                                            <tr>
                                                <th>S.no</th>
                                                <th>Name</th>
                                                <th colspan="2">E-Date</th>
						<th>Issue Type</th>
						<th>Description</th>
						<th>Assigned to</th>
						<th>Finished By</th>
						<th>0/1</th>
						<th>Remark</th>
						<th>Finish Date</th>
						 <th>Edit(Assign)</th>	
 										</tr>
                                        </thead>
									   <tbody>	<?php $tg = 0;
					while($row2=mysqli_fetch_array($qry))
						{ $tg++; $eed = $row2['edate']; $tdy = date("d-m-Y");
					$tdy2 = date ("d-m-Y", strtotime("-1 day", strtotime($tdy)));
$tdy3 = date ("d-m-Y", strtotime("-2 day", strtotime($tdy)));
$tdy4 =date ("d-m-Y", strtotime("-3 day", strtotime($tdy)));
$tdy5 =date ("d-m-Y", strtotime("-4 day", strtotime($tdy)));
$tdy6 =date ("d-m-Y", strtotime("-5 day", strtotime($tdy)));
$tdy7 =date ("d-m-Y", strtotime("-6 day", strtotime($tdy)));
					if(($tdy == $eed) OR ($tdy2 == $eed) OR ($tdy3 == $eed)) {
					?>
                                     
                                           <tr>
                                           <td><font color="red"><b><?php echo $tg;?></b></font></td>
                                               <td><font color="red"><b><?php echo $row2['cname'];?></b></font></td>
						<td colspan="2"><font color="red"><b><?php echo $row2['edate']; ?></b></font></td>
						<td><font color="red"><b><?php echo $row2['type']; ?></b></font></td>
						<td><font color="red"><b><?php echo $row2['desc']; ?></b></font></td>
		
						<td><font color="red"><b><?php echo $row2['staff'];?></b></font></td>
						<td><font color="red"><b><?php echo $row2['by'];?></b></font></td>
						
						<td><font color="red"><b><?php echo $row2['new'];?></b></font></td>
						<td><font color="red"><b><?php echo $row2['remark'];?></b></font></td>
						<td><font color="red"><b><?php echo $row2['fdate'];?></b></font></td>
						<td><a href="utask.php?id=<?php echo $row2['id'];?>">Edit(Assign)</a></td>
					  </tr>
                                         
					<?php }
					elseif(($tdy4 == $eed) OR ($tdy5 == $eed) OR ($tdy6 == $eed) OR ($tdy7 == $eed)) {
					?>
                                    
                                           <tr>
                                           <td><font color="orange"><b><?php echo $tg;?></b></font></td>
                                               <td><font color="orange"><b><?php echo $row2['cname'];?></b></font></td>
						<td><font color="orange"><b><?php echo $row2['edate']; ?></b></font></td>
						<td><font color="orange"><b><?php echo $row2['type']; ?></b></font></td>
						<td><font color="orange"><b><?php echo $row2['desc']; ?></b></font></td>
		
						<td><font color="orange"><b><?php echo $row2['staff'];?></b></font></td>
						<td><font color="orange"><b><?php echo $row2['by'];?></b></font></td>
						
						<td><font color="orange"><b><?php echo $row2['new'];?></b></font></td>
						<td><font color="orange"><b><?php echo $row2['remark'];?></b></font></td>
						<td><font color="orange"><b><?php echo $row2['fdate'];?></b></font></td>
						<td><a href="utask.php?id=<?php echo $row2['id'];?>">Edit(Assign)</a></td>
					  </tr>
                                          
					<?php }
					
				else {
					?>
                                    
                                           <tr>
                                           <td><?php echo $tg;?></td>
                                               <td><?php echo $row2['cname'];?></td>
						<td><?php echo $row2['edate']; ?></td>
						<td><?php echo $row2['type']; ?></td>
						<td><?php echo $row2['desc']; ?></td>
		
						<td><?php echo $row2['staff'];?></td>
						<td><?php echo $row2['by'];?></td>
						
						<td><?php echo $row2['new'];?></td>
						<td><?php echo $row2['remark'];?></td>
						<td><?php echo $row2['fdate'];?></td>
						<td><a href="utask.php?id=<?php echo $row2['id'];?>">Edit(Assign)</a></td>
					  </tr>
                                    
					<?php }
						}
					}
				
					?></tbody>
					                    
      </table>
                  </div>
                </div>
              </div>

             

            </div>
          </div>
        </div>
        <!-- /page content -->



  <?php include "layouts/footer.php"; ?>

  </body>
</html>