<?php include 'connection.php';
session_start();
if (!isset($_SESSION['is_logged_in'])) {
    header("Location:login.php");
    die();
    }

?>

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Warpp Engineers</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
  <!-- jvectormap -->
  <link rel="stylesheet" href="../plugins/jvectormap/jquery-jvectormap-1.2.2.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../dist/css/AdminLTE.min.css">
  <link rel="stylesheet" href="../dist/css/skins/_all-skins.min.css">
  <style>
  table {
  border: 1px solid #ccc;
  border-collapse: collapse;
  margin: 0;
  padding: 0;
  table-layout: fixed;
}
table caption {
  font-size: 1.2em;
  margin: .5em 0 .75em;
}
table tr {
  
  border: 1px solid #ddd;
  padding: .35em;
}
table th,
table td {
  padding: .625em;
  
}
table th {
  font-size: .9em;
  letter-spacing: .0em;
  text-transform: uppercase;
}
@media screen and (max-width: 600px) {
  table {
    border: 0;
  }
  table caption {
    font-size: 1.8em;
  }
  table thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }
  table tr {
    border-bottom: 3px solid #ddd;
    display: block;
    margin-bottom: .625em;
  }
  table td {
    border-bottom: 1px solid #ddd;
    display: block;
    font-size: .9em;
    
  }
  table td:before {
    /*
    * aria-label has no advantage, it won't be read inside a table
    content: attr(aria-label);
    */
    content: attr(data-label);
    float: left;
    font-weight: bold;
    text-transform: uppercase;
  }
  table td:last-child {
    border-bottom: 0;
  }
}

</style>	
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
											   
<script type="text/javascript" src="../jquery.min.js"></script>
   <script src="../jquery-ui.js"></script>
   <link rel="stylesheet" href="../jquery-ui.css">
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
  <?php include 'header.php';?>
<?php		
$query1 = "select * from customer_invoice_details where inv_id = '". $_REQUEST["inv_id"]."' ";
$result1 = mysql_query($query1,$conn);
while($row=mysql_fetch_array($result1))
{
$inv_no = $row['inv_no'];
$inv_date = $row['inv_date'];
$customer_name = $row['customer_name'];
}	
?>	


  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        Update
        <small>Serial No.</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="index.php"><i class="fa fa-dashboard"></i> Home</a></li>
      </ol>
    </section>
    <!-- Main content -->
    <section class="content">
      <!-- Info boxes -->
      <div class="row">
        <div>
		
	
			
			<div class="col-sm-6">
				<div class="box box-success">
            <div class="box-header with-border">
						 <table class="table table-bordered">
			  <thead>
                <tr>
                  <th scope="col">INV No.</th>
                  <th scope="col">INV Date</th>
                 
				 
				  
				  
				 
                </tr>
				</thead>
  <tbody> <tr>
                  <td><div align="left"  style="padding-left:3px; padding-right:3px;"><?php echo $inv_no ?></div></td>
                  <td><div align="left"  style="padding-left:3px; padding-right:3px;"><?php echo $inv_date?></div></td>
                 
                </tr>
			   </tbody>
              </table>
			  <br>
			  
			  <table class="table table-striped table-bordered table-hover">
			  <thead>
                <tr>
                  <th scope="col">Machine Name</th>
                  <th scope="col">Qty.</th>
				 
				 
				
                </tr>
				</thead>
  <tbody>
  <?php 
					
	 $query2c = "select * from dispatched_product_details where customer_id = '".$_REQUEST['customer_id'] ."' and dispatched_id = '".$_REQUEST['dispatched_id']."'";
	 $result2c = mysql_query($query2c,$conn);
	 while($row=mysql_fetch_array($result2c))
	                                              	{
													
													$machine_name = $row['machine_name'];
													$qty = $row['qty'];
													}
													?>
  <tr>
                  <td><div align="left" style="padding:3px;"><? echo $machine_name?> </div></td>
				  <td><div align="left" style="padding:3px;"><? echo $qty; ?></div></td>
				  </tr>
				  </tbody></table>
			  
			  </div></div></div>
			  
			  <div class="col-sm-6">
				<div class="box box-success">
            <div class="box-header with-border">
						<form name="qtndetails1" id="qtndetails1" action="insert_serial_no.php" method="post">
						<input type="hidden" name="dispatched_id" value="<? echo $_REQUEST['dispatched_id']; ?>" />
						
						<script type="text/javascript">
$(document).ready(function(){
$("#name").keyup(function() {
var name = $('#name').val();
if(name=="")
{
$("#disp").html("");
}
else
{
$.ajax({
type: "POST",
url: "user_check.php?dispatched_id=<?php echo $_REQUEST['dispatched_id']?>",
data: "name="+ name ,
success: function(html){
$("#disp").html(html);
}
});
return false;
}
});
});
</script>	
		  <input type="hidden" name="customer_id" value="<? echo $_REQUEST['customer_id']; ?>" />
		   <input type="hidden" name="inv_id" value="<? echo $_REQUEST['inv_id']; ?>" />
		 
			 <input type="hidden" name="customer_name" value="<? echo $customer_name; ?>" />
						 <table class="table table-bordered">
			  <div class="form-group has-feedback">
			   <label style="font-weight:normal; font-size:15px;">Serial No.</label>
				 <input class="form-control" name="serial_no" id="name"><div id="disp"></div> </div>
        <div class="form-group has-feedback"><label style="font-weight:normal; font-size:15px;">Date</label>
			<input type="text" class="datepicker_des form-control" value="<? echo $today_dash;?>" id="update_date" name="update_date">
<script>$( ".datepicker_des").datepicker({
  inline: true,
 
  nextText: '&rarr;',
  prevText: '&larr;',
  showOtherMonths: true,
  changeMonth: true,
        changeYear: true,
  dateFormat: 'dd-mm-yy',
  dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
      showAnim: "slide"
 });</script></div>
    <div align="right" class="col-sm-12">
						
	          				 <input type="submit" name="Submit" value="Save" class="btn bg-btn-save">
	          				
          				
					
						 
					</div>
			</form>
			
			
			
						
					</div>
				</div>
			</div>
			
			</div>
			
		</div>
	
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  

  <!-- Control Sidebar -->
       <? include'footer.php'; ?>

</body>
</html>
