<?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() {
   $("#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> 
function sum() 
{ 
var z = document.getElementById("fee").value; 
var q = document.getElementById("adv").value; 
document.getElementById("balance").value =((z*1)-(q*1));  
} 
</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) -->
                <section class="content-header">
                    <h1>
                       Task Updations</br>
                    </h1>
					 <div class="col-lg-6">  
	  
  <button class="btn btn-success btn-lg" type="submit"><a href="yentry.php">&nbsp;<font color="white">View&nbsp;&nbsp;&nbsp;</font></a></button>&nbsp;&nbsp;&nbsp;&nbsp;
   <button class="btn btn-danger btn-lg" type="submit"><a href="entry.php"><font color="white">&nbsp;Add&nbsp;&nbsp;&nbsp;</font></a></button>&nbsp;&nbsp;&nbsp;&nbsp;
<?php $id=$_REQUEST['id'];?>
 
<?php
$qry=mysqli_query($conn, "select * from task where id=$id");
$row=mysqli_fetch_array($qry);
?>
			</section>		

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

                    <!-- Main row -->
                    <div class="row">
                        <!-- Left col -->
 
   <section class="col-lg-6 connectedSortable"> 
                            <!-- Box (with bar chart) -->
                            <div class="box box-danger" id="loading-example">
                                <div class="box-header">
                                 
                                    <i class="fa fa-cloud"></i>

                                    <h3 class="box-title">For Issue : <?php echo $row['desc']; ?></h3>
                                </div><!-- /.box-header -->
					
                                <div class="box-body no-padding">
                                    <div class="row">
                                      
                                            <!-- bar chart -->
											 <div class="col-lg-12">
   <div class="col-lg-6"> 
<form name="form8" class="form-horizontal" method="post" action="" enctype="multipart/form-data">

  <div class="form-group has-success has-feedback">
    <label for="inputPassword3">Company Name</label>
	 <input type="hidden" class="form-control" id="inputPassword3" readonly name="desc" value="<?php echo $row['desc']; ?>">
        <input type="text" class="form-control" id="inputPassword3" readonly name="cname" value="<?php echo $row['cname']; ?>">
  </div>
  <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Issue Type</label>
      <input type="text" class="form-control" id="inputPassword3" readonly name="type" value="<?php echo $row['type']; ?>" placeholder="Name">

  </div>    
    <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Task to</label>
      <input type="text" class="form-control" id="inputPassword3" name="stafft" value="<?php echo $row['staff']; ?>" placeholder="Name">

  </div>   
    <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Work Finished Status</label>
      <input type="text"    class="form-control" id="inputPassword3" name="new" value="1" placeholder="Name">
 
  </div>   
   </div>
   <div class="col-lg-6"> 
    <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Estimation Date</label>
      <input type="text" class="form-control" id="inputPassword3" readonly name="edate" value="<?php echo $row['edate']; ?>" placeholder="Name">

  </div>  
  <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Work Finishing Date</label>
      <input type="text"  class="form-control" id="inputPassword3" name="fdate" value="" placeholder="">
  </div>
  <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Work Finishing Remark</label>
      <textarea type="text"  class="form-control" id="inputPassword3" name="remark" value="" placeholder=""></textarea>
  </div> 
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-3">
      <button type="submit"  name="s1" class="btn btn-success btn-lg btn-block">Save</button>
	  
    </div>
  </div> 
  </div></div>

                               <!-- /.box-body -->
                           <!-- /.box-footer -->
                            </div><!-- /.box -->        
                            
                            <!-- Custom tabs (Charts with tabs)-->
                        

                      

                        </section>
						 <section class="col-lg-6 connectedSortable"> 
                            <!-- Box (with bar chart) -->
                            <div class="box box-danger" id="loading-example">
                                <div class="box-header">
                                 
                                    <i class="fa fa-cloud"></i>

                                   
                                </div><!-- /.box-header -->
					
                                <div class="box-body no-padding">
                                    <div class="row">
                                      
                                            <!-- bar chart -->
											 <div class="col-lg-12">
   <div class="col-lg-6"> 



   
    </div>
	 <div class="col-lg-6"> 
   
    
   
   </div>
  </div>
  
  </div>
</div>
                        </section><!-- /.Left col -->
                        <!-- right col (We are only adding the ID to make the widgets sortable)-->
</div>	
		  
<?php
							if(isset($_POST['s1']))
							{
								extract($_POST);
								$tdy = date("d-m-Y");
							//	$pno = $pno;
								$cname = $cname;
								$desc= $desc;
								$type = $type;
								$update=mysqli_query($conn, "UPDATE `task` SET `new`='$new',`staff`='$stafft',`fdate`='$fdate',`remark`='$remark' WHERE id='$id' ");
								if($update)
								{
									$qry3=mysqli_query($conn, "select * from soft where cname='$cname'");
                                     $row3 = mysqli_fetch_array($qry3);
  $email_to = $row3['email'];
 
    $email_subject = "Debugging in".$type;
 
   
 
    $first_name = $type; // required
 
    $last_name = $desc; // required
 
    $email_from = 'support@infossel.com'; // required
 
    $telephone = $fdate; // not required
	 $telephone2 = $stafft; // not required
 
    $comments = $remark; // required
 
     
 
    $error_message = "";
 
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
 
  if(!preg_match($email_exp,$email_from)) {
 
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
 
  }
 
    $string_exp = "/^[A-Za-z .'-]+$/";
 
    $email_message = "INFOSSEL SOFT SOLUTIONS Bug Clearning Report.\n\n";
 
     
 
    function clean_string($string) {
 
      $bad = array("content-type","bcc:","to:","cc:","href");
 
      return str_replace($bad,"",$string);
 
    }
 
     
 
    $email_message .= "Issue Type: ".clean_string($first_name)."\n";
 
    $email_message .= "About Issue : ".clean_string($last_name)."\n";
 
 
    $email_message .= "Cleared On: ".clean_string($telephone)."\n";
	  $email_message .= "Cleared By: ".clean_string($telephone2)."\n";
 
    $email_message .= "Remark: ".clean_string($comments)."\n";
 
     
 
     
 
// create email headers
 
$headers = 'From: '.$email_from."\r\n".
 
'Reply-To: '.$email_from."\r\n" .
 
'X-Mailer: PHP/' . phpversion();
 
@mail($email_to, $email_subject, $email_message, $headers);  
 

		echo "Updated Successfully";
								
								}
								else
								{
									echo "Failure";
								}
							}
?>
		</div>
		
		</form>
</div>
</div></div>
</section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->


        <!-- jQuery 2.0.2 -->
       <?php include "layouts/footer.php"; ?>

    </body>
</html>