<?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);

?>

<? include('sahavas_dropdown_function.php');?>
<?php 

$query = "select * from users where username = '". $_SESSION["LOGIN_NAME"]."' AND password = '".$_SESSION["EMPLOYEE_PASSWORD"]."'";
//echo $query;
		                 $result = mysql_query($query,$conn);
						 while($row=mysql_fetch_array($result))
	                                              	{
													 $staff_name = $row['full_name'];
													  $full_name = $row['full_name'];
													  $avatar = $row['avatar'];
													  $department_name = $row['department_name'];
													  $staff_id  = $row['id'];
													  $username = $row['username'];
													  $our_company = $row['our_company'];
													  $designation = $row['designation'];
													  $sales_group = $row['sales_group'];
													  $head = $row['head'];
													  $region = $row['region'];
													  $district = $row['district'];
													  $email = $row['email'];
													  $mobile_no = $row['mobile_no'];
													  $staff_id_self  = $row['id'];
													  //echo $Branch;
													  }	
													   ?>	
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>THREESTAR - CRM</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">
  <!-- daterange picker -->
  <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker.css">
  <!-- bootstrap datepicker -->
  <link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
  <!-- iCheck for checkboxes and radio inputs -->
  <link rel="stylesheet" href="plugins/iCheck/all.css">
  <!-- Bootstrap Color Picker -->
  <link rel="stylesheet" href="plugins/colorpicker/bootstrap-colorpicker.min.css">
  <!-- Bootstrap time Picker -->
  <link rel="stylesheet" href="plugins/timepicker/bootstrap-timepicker.min.css">
  <!-- Select2 -->
  <link rel="stylesheet" href="plugins/select2/select2.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
 <link rel="stylesheet" href="public/css/default.css" type="text/css">
 <script src="jquery.min.js"></script>
<script src="jquery-ui.js"></script>


<link rel="stylesheet" href="jquery-ui.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">
$(document).ready(function(){
$("#name").keyup(function() {
var name = $('#name').val();
if(name=="")
{
$("#disp").html("");
}
else
{
$.ajax({
type: "POST",
url: "user_check_sub.php",
data: "name="+ name ,
success: function(html){
$("#disp").html(html);
}
});
return false;
}
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$("#name1").keyup(function() {
var name1 = $('#name1').val();
if(name1=="")
{
$("#disp1").html("");
}
else
{
$.ajax({
type: "POST",
url: "user_check_sub_id.php",
data: "name="+ name1 ,
success: function(html){
$("#disp1").html(html);
}
});
return false;
}
});
});
</script>		
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<? depat_check($department_name,$designation);?>
<!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
         <? 
	$sql = mysql_query("select * from customer_master where customer_id = '".$_REQUEST['customer_id']."' and id='".$_REQUEST['id']."'"); 
while($row = mysql_fetch_array($sql))
{
$customer_name = $row['customer_name'];

}?>	<? echo $customer_name  ?>
        <a href="view_account.php?customer_id=<? echo $_REQUEST['customer_id'];?>&&id=<? echo $_REQUEST['id'];?>" target="_parent">	
						<button type="button" class="btn bg-btn-new">
							<span class="glyphicon glyphicon-plus"></span>&nbsp;Back
						</button>
						</a>	
      </h1>
    
    </section>

    <!-- Main content -->
    <section class="content">
      <!-- Info boxes -->
        <div>
<form action="insert_other_sub_customer.php" method="post" name="myform">
<input type="hidden" value="<? echo $_REQUEST['customer_id'] ?>" name="customer_id">

	<input type="hidden" value="<? echo $_REQUEST['id'] ?>" name="id">
		
		<div>
			<div class="col-xs-12">
				<div class="col-xs-12" style="background:#3C8DBC;">
							<h5 style="color:#FFFFFF"><span class="glyphicon glyphicon-map-marker"></span>&nbsp; 3rd Party Information&nbsp; <? echo $customer_name  ?></h5>
					  </div>
												

						  	
						  	<table class="table table-bordered">
								<tbody>
									
									 <tr>
    <td colspan="7" width="85%"><h6><span class="glyphicon glyphicon-map-marker"></span>&nbsp;3rd Party Information&nbsp;</h6></td>
    
  </tr>
									</tbody>
						     	<tbody>
						        	<tr><td colspan="2">
						        			<div class="form-group">
												<label for="scity"><span class="glyphicon glyphicon-user"></span>&nbsp;Customer Name:&nbsp;</label>
												<input class="form-control" name="party_name"  type="text" id="name"><div id="disp"></div>
											</div>
						        		</td>
										<td>
						        			<div class="form-group">
												<label for="scity"><span class="glyphicon glyphicon-list"></span>&nbsp;Customer ID:&nbsp;</label>
												<input class="form-control" name="sub_customer_id"   type="text"id="name1"><div id="disp1"></div>
											</div>
						        		</td>
						        		<td >
						        			<div class="form-group">
												<label for="saddrl1"><span class="glyphicon glyphicon-map-marker"></span>&nbsp;Address:&nbsp;</label>
												<textarea class="form-control" rows="4" style="resize:vertical;" name="address" id="address" maxlength="250"></textarea>
											</div>
						        		</td>
						        		
						        		<td>
						        			<div class="form-group">
												<label for="scity"><span class="glyphicon glyphicon-phone"></span>&nbsp;Phone No:&nbsp;</label>
												<input class="form-control" name="phone_no" id="scity"  type="text">
											</div>
						        		</td>
										
						        		<td>
						        			<div class="form-group">
												<label for="semail"><span class="glyphicon glyphicon-envelope"></span>&nbsp;Email:&nbsp;</label>
												<input class="form-control" id="email" name="email"  type="email">
											</div>
						        		</td>
						        		<td> 
	          			<input type="submit" name="Submit" value="Save" class="btn bg-btn-save"/>
	          			</td>
						        	</tr>
						   		</tbody>
						  	</table>
							
							 
						</div>	
					</div>	</form>
			
			<div><?   
$qry9s = "select * from third_customer_master where customer_id='".$_REQUEST['customer_id']."' and id='".$_REQUEST['id']."' ";
$re9s = mysql_query($qry9s);
$num_rowss=mysql_num_rows($re9s);
if($num_rowss>='1') { 
?>
			<div  class="col-xs-12" id="squareboxcontent1" style="">
				<div class="search-list">
					<div class="search-header">
						<div class="col-xs-12" style="background:#3C8DBC;">
							<h5 style="color:#FFFFFF"><span class="glyphicon glyphicon-map-marker"></span>&nbsp; 3rd Party Information&nbsp;</h5>
					  </div>
						</div>
					<div>
						<div>
							
						  	
						  	<table class="table table-bordered">
								<tbody>
									<tr>
										<th class="left" colspan="7">3rd Party Information&nbsp; </th>
										
									</tr>
								</tbody>
						     	<tbody>
	<?   $qry9 = "select * from third_customer_master where customer_id='".$_REQUEST['customer_id']."' and id='".$_REQUEST['id']."' ";
$re9 = mysql_query($qry9);
while($row=mysql_fetch_array($re9))
		{  $sub_id=$row['sub_id'];
		
		$sub_customer_id=$row['sub_customer_id'];
		$party_name=$row['party_name'];
		$email=$row['email_id'];
		$address=$row['address'];
		$phone_no=$row['phone_no'];
		
		
		?>			<form action="update_other_sub_customer.php" method="post" name="myform">
				<input type="hidden" value="<? echo $_REQUEST['customer_id'] ?>" name="customer_id">

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

								
								<input type="hidden" name="sub_id" value="<? echo $sub_id?>">
								<input type="hidden" name="sub_customer_id" value="<? echo $sub_customer_id?>">
								
						        	<tr><td colspan="2">
						        			<div class="form-group">
												<label for="scity"><span class="glyphicon glyphicon-user"></span>&nbsp;Customer Name:&nbsp;</label>
												<input class="form-control" name="party_name" id="party_name"  type="text" value="<? echo $party_name;?>" readonly="readonly">
											</div>
						        		</td>
										<td>
						        			<div class="form-group">
												<label for="scity"><span class="glyphicon glyphicon-list"></span>&nbsp;Customer ID:&nbsp;</label>
												<input class="form-control" name="sub_customer_id" id="sub_customer_id"  type="text" value="<? echo $sub_customer_id?>" readonly="readonly"><br>
												ID : <? echo $sub_id?>
											</div>
						        		</td>
						        		<td >
						        			<div class="form-group">
												<label for="saddrl1"><span class="glyphicon glyphicon-map-marker"></span>&nbsp;Address:&nbsp;</label>
												<textarea class="form-control" rows="4" style="resize:vertical;" name="address" id="address" maxlength="250"><? echo $address?></textarea>
											</div>
						        		</td>
						        		
						        		<td>
						        			<div class="form-group">
												<label for="scity"><span class="glyphicon glyphicon-phone"></span>&nbsp;Phone No:&nbsp;</label>
												<input class="form-control" name="phone_no"  value="<? echo $phone_no ?>"  type="text">
											</div>
						        		</td>
										
						        		<td>
						        			<div class="form-group">
												<label for="semail"><span class="glyphicon glyphicon-envelope"></span>&nbsp;Email:&nbsp;</label>
												<input class="form-control" id="email" name="email" value="<? echo $email?>"  type="email">
											</div>
						        		</td>
						        		<td> 
	          			<input type="submit" name="Submit" value="Save" class="btn bg-btn-save"/>
	          			</td>
						        	</tr>
						        	</form>
										<? } ?>
						   		</tbody>
						  	</table>
							
							 
						</div>	
					</div>
				</div>
			</div>
			
			<? } ?>
		</div>
			
			
			
			
	
		<div class="row">
			<div class="col-sm-12">
				<div class="filter-header">
					<div class="col-sm-12 right">
						
	          			
          				
					
						 
					</div>
				</div>
			</div>
		</div>		 

</form>
	</div>
		
		</div>
    </section>
    <!-- /.content -->
  <!-- /.content-wrapper -->

   <? include'footer.php'; ?>


</body>
</html>
