<!-- PANEL ADMINISTRATIVO -->	
        <script src="js/jquery.min.js"></script>  
           <script src="js/bootstrap.min_busqueda.js"></script> 				
<div class="contentpanel">
 <?php 
 		include 'mensajes.php';
 if($_GET['proceso']=='1NS3RT'){
				$rif=$_POST['tipo_documento'].''.$_POST['rif']; 
				$chequear_datos=mysql_query("Select * from   tabla_clintes_xls where rif='$rif' and eliminar='0'",$link);
				$chequear=mysql_fetch_row($chequear_datos);
				if($chequear[0]!="")
					{
					echo'
                        <div class="alert alert-warning fade in">
                            <i class="fa-fw fa fa-warning"></i>
                                <strong>Advertencia !</strong> Datos ya registrados en la base de datos.
                        </div>
						';
					}   
				else 
					{ 
					mysql_query("INSERT INTO tabla_clintes_xls (rif,descripcion,direccion,estatus) VALUES ('".$rif."','".$_POST['descripcion']."','".$_POST['direccion']."','0')",$link);
					//mysql_query("INSERT INTO tabla_clintes_xls (rif,tipo_documento,n_documento,descripcion,direccion,estatus) VALUES ('".$rif."','".$_POST['tipo_documento']."','".$rif."','".$_POST['descripcion']."','".$_POST['direccion']."','0')",$link);
					echo'
                        <div class="alert alert-success fade in">
                            <i class="fa-fw fa fa-check"></i>
                               <strong>Exelente !</strong> Muchas gracias datos registrados.
                        </div>
					';
					} 
 } 

		if($_GET['proceso']=="3DIT4R"){
			$id_control=strip_tags($_GET['token']);

				mysql_query("UPDATE  tabla_clintes_xls SET rif='".$_POST['rif']."',descripcion='".$_POST['descripcion']."',direccion='".$_POST['direccion']."' where  id='$id_control'",$link);
				//echo "update $tabla_control set $campo='$value' where  id='$id_control'";
			 
			 echo'
                <div class="alert alert-success fade in">
                    <i class="fa-fw fa fa-success"></i>
                        <strong>Enhorabuena !</strong>Los Datos fueron editados 
                </div>
			';
		}	
		
		if($_GET['proceso']=="D3L3T3"){
			$id_control=$_GET['token'];
			mysql_query("update $tabla_control set eliminar='1'  where  id='$id_control'",$link);
					echo'
                        <div class="alert alert-warning fade in">
                            <i class="fa-fw fa fa-warning"></i>
                               <strong>Advertencia !</strong> El registro fue eleminado de la Base de Datos.
                        </div>	
					';
		}
		if($_GET['proceso']=='C0N5ULT4R'){
			$id_control=bindec($_GET['token']);
			$consultar_sql=mysql_query("select * from  $tabla_control where id='$id_control'",$link);
			$ver_consultar_sql=mysql_fetch_array($consultar_sql);
			//echo "select * from  $tabla_control where id='$id_control'";
		}
			if($_GET['proceso']=="ESTATUS_CLIENTES"){
			$id_control=$_GET['token'];
			$estatus=$_GET['estatus'];
	
				mysql_query("update tabla_clintes_xls set estatus='$estatus'  where  id='$id_control'",$link);
			 echo'
                <div class="alert alert-success fade in">
                    <i class="fa-fw fa fa-success"></i>
                        <strong>Enhorabuena !</strong>Los Datos fueron editados 
                </div>
			';
	
			}		
		
 ?>
<div class="row row-stat">
	<div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <div class="panel-btns">
                    <a href="#" class="panel-minimize tooltips" data-toggle="tooltip" title="Minimize Panel"><i class="fa fa-minus"></i></a>
                    <a href="#" class="panel-close tooltips" data-toggle="tooltip" title="Close Panel"><i class="fa fa-times"></i></a>
                </div>
                <h4 class="panel-title"><?php echo $ver_cpanel_sub_menu['titulo']; ?></h4>
                <p><?php echo $ver_cpanel_sub_menu['descripcion']; ?>.</p>
            </div>
            <div class="panel-body nopadding">

				<div class="col-md-12">
				

                    <div class="table-responsive"><br>
						<!--BOTONES DE EXPORTACION-->

						<div class="pull-left">
							<div class="btn-group">
                                <button class="btn btn-default btn-sm " type="button"><i class="fa fa-print mr5"></i> Imprimir</button>
								<a href='' TARGET="_BLANK"  class="btn btn-default btn-sm " type="submit" id="export_data" name='export_data'><i class="fa fa-file-excel-o mr5"></i> Descargar XLS</a>
								<!-- <button class="btn btn-default btn-sm " type="button"><i class="fa fa-file-pdf-o mr5"></i> Descargar PDF</button>-->
							</div>
						</div>
						<!--BOTONES DE EXPORTACION-->	
						
						<!--BOTONES DE AGREGAR-->						
						<div class="pull-right">
						    <div class="btn-group">
                                <button class="btn btn-success btn-sm " type="button" data-toggle="modal" data-target=".bs-example-modal-lg"><i class="fa  fa-plus-square mr5"></i> AGREGAR CLIENTES</button>
                            </div>
						</div>
									<br>
						<br>
						<br>
						<div class="input-group mb15 has-warning">
                            <span class="input-group-addon"><b>BUSCAR</b></span>
                            <input type="text" autofocus="autofocus" placeholder="Buscar clientes" id="search" class="form-control" />
                        </div>				
			
							<table id="employee_table" class="table table-striped table-bordered responsive">
                                <thead class="">
                                    <tr>
                                        <th>COD</th>
                                        <th WIDTH="10%">Rif Cliente</th>
                                        <th WIDTH="30%">Razon social</th>
                                        <th>Direccion</th>
                                        <th>Opcion</th>
                                    </tr>
                                </thead>
								
                                <tbody>
								<?php
									$consultar_sql_ver=mysql_query("select * from  $tabla_control where eliminar='0' ORDER BY id DESC ",$link);
									while($ver_consultar_sql_ver=mysql_fetch_array($consultar_sql_ver)){
										$id_control_edit=$ver_consultar_sql_ver['id']; 
										
									if($_GET['proceso']=='C0N5ULT4R' and $_GET['token']=="$id_control_edit"){ ?>
										<form action="<?php echo $url_global.'&proceso=3DIT4R&token='.$id_control_edit; ?>" method="POST" class="form-bordered" name='formulario'>
						
									
									<?php } ?>
                        

						<tr>
									    <td>
											<?php
									
													echo $ver_consultar_sql_ver['id'];
													
											 ?>
										</td>
                                        <td>
											<?php
												if($_GET['proceso']=='C0N5ULT4R' and $_GET['token']=="$id_control_edit"){
													echo '<input name="rif" value="'.$ver_consultar_sql_ver['rif'].'" class="form-control" type="text"  required="required" />';
												} else {
													echo $ver_consultar_sql_ver['rif'];
												}	
											 ?>
										</td>
										<td>
											<?php
												if($_GET['proceso']=='C0N5ULT4R' and $_GET['token']=="$id_control_edit"){
													echo '<input name="descripcion" value="'.$ver_consultar_sql_ver['descripcion'].'" class="form-control" type="text"  required="required" />';
												} else {
													echo $ver_consultar_sql_ver['descripcion'];
												}	
											 ?>
										</td>
										<td>
											<?php
												if($_GET['proceso']=='C0N5ULT4R' and $_GET['token']=="$id_control_edit"){
													echo '<input name="direccion"  value="'.$ver_consultar_sql_ver['direccion'].'" class="form-control" type="text"  required="required" />';
												} else {
													echo $ver_consultar_sql_ver['direccion'];
												}	
											 ?>
										</td>								
                                        <td>
										<?php if($_GET['proceso']=='C0N5ULT4R' and $_GET['token']=="$id_control_edit"){ ?>
											<button type="submit" name="submit" value='Guardar' class="btn btn-success btn-sm"> <i class="fa fa-floppy-o ml5"></i></button>	
										<?php } else { ?>
											<a href="<?php echo $url_global;?>&proceso=C0N5ULT4R&token=<?php echo $ver_consultar_sql_ver['id']; ?>"   title="Editar"  class=" btn-primary btn-sm" ><i class="fa fa-pencil"></i></a>
											<a href="<?php echo $url_global;?>&proceso=D3L3T3&token=<?php echo $ver_consultar_sql_ver['id']; ?>"   title="Eliminar"  class=" btn-danger btn-sm" ><i class="fa fa-trash-o"></i></a>
										<?php }	?>
										<?php if($ver_consultar_sql_ver['estatus']==1) {?>
												<a href="<?php echo $url_global;?>&proceso=ESTATUS_CLIENTES&token=<?php echo $ver_consultar_sql_ver['id']; ?>&estatus=0"   title="ACTIVAR"  class="btn-warning btn-sm" ><i class="fa fa-ban"></i></a>
										 <?php } else { ?>	
											    <a href="<?php echo $url_global;?>&proceso=ESTATUS_CLIENTES&token=<?php echo $ver_consultar_sql_ver['id']; ?>&estatus=1"   title="BLOQUEAR"  class="btn-success btn-sm" ><i class="fa fa-check"></i></a>
										 <?php } ?>
										</td>
                                    </tr> 
									<?php if($_GET['proceso']=='C0N5ULT4R' and $_GET['token']=="$id_control_edit"){ ?>
										</form>
									<?php } ?>									
									<?php }  ?>
                                </tbody>
                            </table>
							 <script>  
								  $(document).ready(function(){  
									   $('#search').keyup(function(){  
											search_table($(this).val());  
									   });  
									   function search_table(value){  
											$('#employee_table tr').each(function(){  
												 var found = 'false';  
												 $(this).each(function(){  
													  if($(this).text().toLowerCase().indexOf(value.toLowerCase()) >= 0)  
													  {  
														   found = 'true';  
													  }  
												 });  
												 if(found == 'true')  
												 {  
													  $(this).show();  
												 }  
												 else  
												 {  
													  $(this).hide();  
												 }  
											});  
									   }  
								  });  
							 </script> 
					</div>
                </div>								
            </div>     
            </div>
        </div>
	</div>
</div>
<!--MODAL -->
    <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog">
            <div class="modal-dialog modal-lg">
              <div class="modal-content">
                  <div class="modal-header">
                      <button aria-hidden="true" data-dismiss="modal" class="close" type="button">&times;</button>
                      <h4 class="modal-title"><?php echo $ver_cpanel_sub_menu['titulo']; ?></h4>
                  </div>
				  <div class="panel-heading">
                      <p><?php echo $ver_cpanel_sub_menu['descripcion']; ?>.</p>
                  </div>
                  <div class="modal-body">
				  <!-- CONTROL DEL FORMULARIO -->
				  <form action="<?php echo $url_global.'&proceso=1NS3RT'?>" method="POST" class="form-bordered" name='formulario'>
												<div class="col-sm-4">
												     <select id="tipo_documento" name='tipo_documento'  class='form-control' required="required" onChange='cargarsolicitud_todos(this.id)'>
														<option value='' >TIPO DE DOCUMENTO</option>
														<option value="V">Venezolano</option>
														<option value="J">Juridico</option>
														<option value="G">Gobierno</option>
														<option value="E">Extranjero</option>
													</select>
												</div>
                                                <div class="col-sm-4">
													<input	class='form-control'
															type='number' 
															name='rif' 
															id='rif'
															autocomplete="off"
															autofocus="autofocus"
															required="required"
															title='Campo requerido, no dejar en blanco'
															value=''
															min='999'
															placeholder='RIF del cliente'
															onChange="javascript:this.value=this.value.toUpperCase();"
													/>
												</div>
												<div class="col-sm-4">
													<input	class='form-control'
															type='text' 
															name='descripcion' 
															id='descripcion'
															autocomplete="off"
															autofocus="autofocus"
															required="required"
															title='Campo requerido, no dejar en blanco'
															value=''
															placeholder='Razon Social'
															onChange="javascript:this.value=this.value.toUpperCase();"
													/>
												</div>
												<div class="col-sm-4">													
													<input	class='form-control' 
															type='text' 
															name='direccion' 
															id='direccion'
															autocomplete="off"
															autofocus="autofocus"
															required="required"
															title='Campo requerido, no dejar en blanco'
															value=''
															placeholder='Direccion'
															onChange="javascript:this.value=this.value.toUpperCase();"
													/>
							                    </div>
									
<input type="hidden" name='estatus' id='estatus'  value='0'>
									<br>
												<br>
												<br>
										<div class="pull-right">
											<button type="submit" name="submit" value='Guardar' class="btn btn-success btn-sm">GUARDAR <i class="fa fa-floppy-o ml5"></i></button>
										</div>
							</form>  
				  
				  <!-- CONTROL DEL FORMULARIO -->
				  			<br>
												<br>
												<br>
				  </div>
              </div>
            </div>
        </div>
    </div>