<?php include 'connection.php';
session_start();
if (!isset($_SESSION['is_logged_in'])) {
    header("Location:login.php");
    die();
    }
date_default_timezone_set('Asia/Calcutta');
$today = date("d/m/Y");
$today1 = date("d/m");
$currentmonth = date(m);

?>
<?php 

$querylogin = "select * from customer_invoice_details where username = '". $_SESSION["LOGIN_NAME"]."' AND password = '".$_SESSION["EMPLOYEE_PASSWORD"]."'";
$resultlogin = mysql_query($querylogin,$conn);
while($row=mysql_fetch_array($resultlogin))
{
$customer_id = $row['customer_id'];
}
													   ?>	
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>WARPP ENGINEERS PVT. LTD.</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 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';?>


  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">    </section>
<? include('fy_dd.php');?>

    <!-- Main content -->
    <section class="content">
      <!-- Info boxes -->
      <div class="row">
        <div>
		



<!-- Details -->
 <? include('sahavas_dropdown_function.php');?>


<?php		
$query1 = "select * from  customer_master where customer_id = '". $_REQUEST["customer_id"]."' ";
//echo $query;
		                 $result1 = mysql_query($query1,$conn);
						 while($row=mysql_fetch_array($result1))
	                                              	{
													 $kind_attn = $row['kind_attn'];
													 $contact_no = $row['contact_no'];
													 $customer_name = $row['customer_name'];
													 $bemail = $row['bemail'];
													 $billing_address = $row['billing_address'];
													  }	
													   ?>	
	
			<div class="col-sm-12">
				<div class="filter-view">
					<div>		
<form name="empdetali" action="insert_dispatched_details.php" method="post">
<input type="hidden" name="customer_id01" value="<? echo $_REQUEST['customer_id01']?>" >
<input type="hidden" name="customer_id" value="<? echo $_REQUEST['customer_id']?>" >

<input type="hidden" name="inv_id" value="<? echo $_REQUEST['inv_id']?>" >

						<table class="table table-bordered">
														
							<div class="col-xs-12" style="background:#367FA9;">
							<h5 style="color:#FFFFFF"><span class="glyphicon glyphicon-list"></span>&nbsp;&nbsp;Update Serial No.</h5>					  </div>
								
							  
							  
						     <tr>
							  <td>	<? if(($_REQUEST['customer_id']!='') and is_numeric($_REQUEST['customer_id'])) { ?>
				<label for="exampleInputPassword1">Customer Name</label>
                  <input name="customer_id" type="hidden" value="<?php echo $_REQUEST['customer_id'];?>"/> 
				  <input name="customer_name" type="text" value="<?php echo $customer_name;?>" class="form-control"  readonly="readonly"/> 
				
				<? } else { ?>
                  <label for="exampleInputPassword1">Customer Name</label>
                  <input name="customer_id" type="text" value="" placeholder="Customer Name " id="customer_id" class="form-control"  autocomplete="off" required/> 
<div id="displaysale" class="oneway-roundtrip"></div> <? } ?>				   </td>
				              <td><label style="font-weight:normal; font-size:15px;">Kind Attn.</label>
                                  <input class="form-control" name="kind_attn" id="kind_attn" value="<? echo $kind_attn?>" required>                              </td>
				              <td><label style="font-weight:normal; font-size:15px;"> Mobile no. for Sms (10 digit no)</label>
                                  <input class="form-control" name="contact_no" id="contact_no" value="<? echo $contact_no?>" maxlength="10" required>                              </td>
				              <td><label style="font-weight:normal; font-size:15px;">Email for Mail</label>
                                  <input class="form-control" name="bemail" id="bemail" value="<? echo $bemail?>">                              </td>
								   <td><label style="font-weight:normal; font-size:15px;">Address</label>
                                     <textarea name="billing_address" class="form-control" id="billing_address"><? echo $billing_address?></textarea>                              </td>
						     </tr> 
						     
					
						<tr>
						
						<td colspan="5">
						
						<table class="table table-bordered" id="cntTable2">
							
								<tr bgcolor="#C5DFFA" >
								
								
									<td width="100px" height="28"valign="middle" nowrap="nowrap" >
									<div align="left" style="padding-left:5px;"><input type="checkbox" id="selectall" onClick="selectAll(this)" /> All</div></td>
									<td  height="28"valign="middle" nowrap="nowrap" >
									<div align="left" style="padding-left:5px;"><strong>Machine Name </strong></div></td>
									<td  height="28"valign="middle" nowrap="nowrap" >
									<div align="left" style="padding-left:5px;"><strong>Qty.</strong></div> </td>
									<td  height="28"valign="middle" nowrap="nowrap" >
									<div align="left" style="padding-left:5px;"><strong>Serial No.</strong></div> </td>
							</tr>
							</thead>
							<tbody>
							<?php 
$i=1;
  $query1 = "select * from dispatched_product_details where  customer_id = '".$_REQUEST['customer_id01']."' and serial_no_updated=''";

$result1 = mysql_query($query1,$conn);		
while($row=mysql_fetch_array($result1))
{
$product_category = $row['product_category'];

$inv_id = $row['inv_id'];
$machine_name = $row['machine_name'];
$qty = $row['qty'];
$dispatched_id = $row['dispatched_id'];
$serial_no = $row['serial_no'];

?>
<script language="JavaScript">
 function selectAll(source) {
  checkboxes = document.getElementsByName('check_list[]');
  for(var i in checkboxes)
   checkboxes[i].checked = source.checked;
 }
</script>

<script type="text/javascript">
$(document).ready(function () {
    $('#prod_check').click(function() {
      checked = $("input[type=checkbox]:checked").length;

      if(!checked) {
        alert("You must check at least one checkbox.");
        return false;
      }

    });
});

</script>
<script type="text/javascript">
$(document).ready(function(){
$("#name<?php echo $i?>").keyup(function() {
var name = $('#name<?php echo $i?>').val();
if(name=="")
{
$("#disp<?php echo $i?>").html("");
}
else
{
$.ajax({
type: "POST",
url: "user_check.php?dispatched_id=<?php echo $dispatched_id?>",
data: "name="+ name ,
success: function(html){
$("#disp<?php echo $i?>").html(html);
}
});
return false;
}
});
});
</script>	
							<tr>
							<td><div align="left" style="padding-left:5px;">
							<input type="checkbox" name="check_list[]" value="<? echo $dispatched_id ?>" />
							<input type="hidden" name="inv_id" value="<? echo $inv_id?><? echo $dispatched_id ?>"></div></td>
							<td><div align="left" style="padding-left:5px;"><?php echo $machine_name; ?></div></td>
							<td><div align="left" style="padding-left:5px;"><?php echo $qty; ?></div></td>
							<td><div align="left" style="padding-left:5px;"><input name="serial_no<? echo $dispatched_id?>" type="text" class="form-control" id="name<?php echo $i?>"/><div id="disp<?php echo $i?>"></div></div></td>
							</tr>
							<?php $i++;} ?>
							</tbody>
						</table>			</td></tr>
			<tr> <td colspan="5"><div align="right" class="col-sm-12">
						
	          				 <input type="submit" name="Submit" value="Save" class="btn bg-btn-save"  id="prod_check">
					</div></td></tr></table>
		  </form>
		<div>
			
		</div>
	</div>
</div>
    </div>
    <!-- /.content -->
  <!-- /.content-wrapper -->

    <? include'footer.php'; ?>


</body>
</html>
