<!-- PANEL ADMINISTRATIVO -->	
<?php 
	include'conex_recreo.php';
	
	
	
	$consultar_sql_ver_sumax3=mysql_query("select SUM(monto_factura),SUM(monto_dolares),eliminar,fecha_factura,id,SUM(peso_factura) from  tabla_factura_xls	 where eliminar='0' and fecha_factura='$fecha_actualxls' ORDER BY id DESC ",$link);
	$ver_consultar_sql_ver_sumax3=mysql_fetch_array($consultar_sql_ver_sumax3);
	$recreo=mysql_query("select SUM(peso_factura),fecha_factura from  tabla_factura_xls_2 where eliminar='0' and fecha_factura='$fecha_actualxls' and estatus='0' ",$link);
	$ver_recreo=mysql_fetch_array($recreo);
	$peso_rc=$ver_recreo['SUM(peso_factura)'];
	$peso_total=$peso_rc+$ver_consultar_sql_ver_sumax3['SUM(peso_factura)'];	

	
	
?>
<script src="js/jquery.min.js"></script>  
<script src="js/bootstrap.min_busqueda.js"></script> 
 <style type="text/css">
.Fields {
	background-color: #fff700;
	border: 2px solid #ee0000;
	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
	font-size: 50px;
}
.Fieldss {
	background-color: #00ff80;
	border: 2px solid #ee0000;
	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
	font-size: 50px;
}
</style>
<div class="contentpanel">

<?php

if($_GET['proceso']=="1NS3RT_vehiculos"){
				$placa=strip_tags($_POST['placa']);
				$cedula_chofer=strip_tags($_POST['cedula_chofer']);
				$nombre_chofer=strip_tags($_POST['nombre_chofer']);
				$descripcion_vehiculo=strip_tags($_POST['descripcion_vehiculo']);
				$cat_vehiculos=strip_tags($_POST['cat_vehiculos']);
				$chequear_datos=mysql_query("Select * from  tabla_vehiculos_xls where placa='$placa' 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_vehiculos_xls (placa,cedula_chofer,nombre_chofer,descripcion_vehiculo,cat_vehiculos) VALUES ('".$placa."','".$cedula_chofer."','".$nombre_chofer."','".$descripcion_vehiculo."','".$cat_vehiculos."')",$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']=="cargar_facturas"){
				$token=strip_tags($_GET['token']);
				$n_factura=strip_tags($_GET['n_factura']);
				$peso=strip_tags($_GET['peso']);
				$cod_cliente=strip_tags($_GET['cod_cliente']);
				$cod_vehiculo_peso=strip_tags($_GET['codgox']);
				$estatus='0';
	
				$chequear_datos=mysql_query("Select * from  tabla_vehiculos_peso_fact where n_factura='$n_factura' 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 '.$n_factura.'
                        </div>
						';
					}   
				else 
					{ 
					mysql_query("INSERT INTO  tabla_vehiculos_peso_fact (cod_vehiculo_peso,token,n_factura,peso,cod_cliente,estatus) VALUES ('".$cod_vehiculo_peso."','".$token."','".$n_factura."','".$peso."','".$cod_cliente."','".$estatus."')",$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']=="1NS3RT_vehiculos_peso_inicial"){
				$cod_vehiculo=strip_tags($_POST['cod_vehiculo']);
				$peso_inicial=strip_tags($_POST['peso_inicial']);
				$hora_inicial=date('h:i:s A');
				$chequear_datos=mysql_query("Select * from  tabla_vehiculos_peso_xls where fecha_registro='$fecha_actualxls' and cod_vehiculo='".$cod_vehiculo."' and eliminar='0' and estatus='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 
					{ 
					$consultar_vh=mysql_query("select * from tabla_vehiculos_xls where id='$cod_vehiculo' and eliminar='0' ",$link);
					$vh_registrado=mysql_fetch_array($consultar_vh);
					$placa=$vh_registrado['placa'];
					mysql_query("INSERT INTO tabla_vehiculos_peso_xls (fecha_registro,placa,cod_vehiculo,peso_inicial,hora_inicial,operador1) VALUES ('".$fecha_actualxls."','".$placa."','".$cod_vehiculo."','".$peso_inicial."','".$hora_inicial."','".$codigo."')",$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']=="D3L3T3"){
			$id_control=$_GET['token'];
			mysql_query("update tabla_vehiculos_xls 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']=="peso_salida"){
			$id_control=$_GET['token'];
			$peso_final=$_POST['peso_final'];
			$hora_final=date('h:i:s A');
			//mysql_query("update tabla_vehiculos_peso_xls set peso_final='$peso_final',hora_final='$hora_final',estatus='1'  where  id='$id_control'",$link);
			mysql_query("update tabla_vehiculos_peso_xls set peso_final='$peso_final',hora_final='$hora_final' where  id='$id_control'",$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']=="D3L3T3_peso_v"){
			$id_control=$_GET['token'];
			mysql_query("update tabla_vehiculos_peso_xls 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>	
					';
		}
		
//CHEQUEO DE SUMA PESO		
if($_GET['proceso']=="consultar_peso"){
	$checkbox = $_POST['suma_peso'];
	$cod_vehiculos_peso_xls=$_POST['cod_vehiculos_peso_xls'];
	$peso_salida=$_POST['peso_salida'];
	$placa=strip_tags($_POST['placa']);
	$suma = 0;
		if(count($checkbox) > 0){ 
			foreach($checkbox as $valor){
				//$suma += $valor;
				//$valor;
				$valor_x = explode("-", $valor);
				$n_factura=$valor_x[0];
				$peso_fact=$valor_x[1];
				$suma += $peso_fact;
				$chequear_datos=mysql_query("Select * from  tabla_vehiculos_peso_xls where id='$cod_vehiculos_peso_xls'",$link);
				$chequear=mysql_fetch_row($chequear_datos);
				$chequear[3];
					if($chequear[3]==""){
						mysql_query("update tabla_vehiculos_peso_xls set placa='$placa',n_factura='$n_factura',peso_final='$peso_salida',peso_factura='$suma',hora_final='$fecha_ingreso',fecha_hora_salida='$fecha_actualxls',estatus='1'  where  id='$cod_vehiculos_peso_xls'",$link);
					} else {
						$n_facturax=$chequear[3].'-'.$n_factura;
						mysql_query("update tabla_vehiculos_peso_xls set n_factura='$n_facturax',peso_factura='$suma' where  id='$cod_vehiculos_peso_xls'",$link);
					}
			}
		}
}

?>
<div class="row">
		<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="row row-stat">
				<br>
						<div class="col-md-4">
                                <div class="panel panel-info-alt">
                                    <div class="panel-heading noborder">
                                        <div class="panel-btns">
                                            <a href="#" class="panel-close tooltips" data-toggle="tooltip" title="Close Panel"><i class="fa fa-times"></i></a>
                                        </div>
                                        <div class="panel-icon"><i class="fa fa-check-square-o"></i></div>
                                        <div class="media-body">
                                            <h5 class="md-title nomargin">RC</h5>
                                            <h1 class="mt5"><?php echo  number_format($peso_rc, 2, '.','').' Kg.'; ?></h1>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="panel panel-info-alt">
                                    <div class="panel-heading noborder ">
                                        <div class="panel-btns">
                                            <a href="#" class="panel-close tooltips" data-toggle="tooltip" title="Close Panel"><i class="fa fa-times"></i></a>
                                        </div>
                                        <div class="panel-icon"><i class="fa fa-check-square"></i></div>
                                        <div class="media-body">
                                            <h5 class="md-title nomargin">AM</h5>
                                            <h1 class="mt5"> <?php echo  number_format($ver_consultar_sql_ver_sumax3['SUM(peso_factura)'], 2, '.','').' Kg.'; ?></h1>
                                        </div>
									</div>
                                </div>
                            </div>
							<div class="col-md-4">
                                <div class="panel panel-dark  noborder">
                                    <div class="panel-heading noborder">
                                        <div class="panel-btns">
                                            <a href="#" class="panel-close tooltips" data-toggle="tooltip" title="Close Panel"><i class="fa fa-times"></i></a>
                                        </div>
                                        <div class="panel-icon"><i class="fa fa-refresh"></i></div>
                                        <div class="media-body">
                                            <h5 class="md-title nomargin">TOTAL KG. </h5>
                                          <h1 class="mt5"> <?php echo  number_format($peso_total, 2, '.','').' Kg' ; ?></h1>
                                        </div>
                                    </div>
                                </div>
                            </div>							
            </div>		
<!-- FIN TOTALIZAR -->				
			</div>
						<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 VEHICULOS</button>
                                <button class="btn btn-primary btn-sm " type="button" data-toggle="modal" data-target=".bs-example-modal-lg-pesov"><i class="fa  fa-car mr5"></i> PESO DE ENTRADA </button>
								<!--<button class="btn btn-warning btn-sm " type="button" data-toggle="modal" data-target=".bs-example-modal-lg-pesosalida"><i class="fa  fa-car mr5"></i> PESO DE SALIDA </button>-->
						   </div>
						</div>				
			
		</div>
</div>
	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-default">
				<div class="panel-body nopadding">
					<div class="input-group mb15 has-warning">
                            <span class="input-group-addon"><b>BUSCAR</b></span>
                            <input type="text"  placeholder="Buscar cliente..." id="search" class="form-control" />
                    </div>
				<div class="alert alert-danger">
                    <strong>Informacion..!</strong> La romana de salida tiene una toleracia de 10 Klg.
               </div>					
				<table id="employee_table" class="table table-striped table-bordered responsive">
                                <thead class="">
                                    <tr>
                                        <th>PLACA</th>
                                        <th>VEHICULO</th>
                                        <th>FACTURAS</th>
                                        <th>PESO DE ENTRADA</th>
                                        <th>PESO FACT.</th>
                                        <th>PESO DE SALIDA</th>
                                        <th>ENTRADA | SALIDA</th>
                                        <th>OPCIONES</th>
                                    </tr>
                                </thead>
								
                                <tbody>
								<?php
										$consulta_rubro_x1=mysql_query("select * from  tabla_vehiculos_peso_xls where eliminar=0  and fecha_registro='$fecha_actualxls' and estatus='0'",$link);
										while($ver_consulta_rubro_x1=mysql_fetch_array($consulta_rubro_x1)){ 
											$codgox=$ver_consulta_rubro_x1['id'];
											$vehiculo=$ver_consulta_rubro_x1['cod_vehiculo'];
											$consultar_sql_verxs=mysql_query("select * from   tabla_vehiculos_xls where id='".$vehiculo."' and eliminar='0'  ",$link);
											$ver_consultar_sql_ver_xx1=mysql_fetch_array($consultar_sql_verxs);
											
											$control_id_consulta=mysql_query("select SUM(peso),cod_vehiculo_peso from  tabla_vehiculos_peso_fact where eliminar='0' and cod_vehiculo_peso='".$codgox."'",$link);
											$ver_control=mysql_fetch_array($control_id_consulta);	
											$peso_total=$ver_consulta_rubro_x1['peso_inicial']+$ver_control['SUM(peso)'];	
											$peso_final=$ver_consulta_rubro_x1['peso_final']+10;
									 ?>
								
                                    <tr>
                                        <td><?php echo $ver_consultar_sql_ver_xx1['placa']; ?></td>
                                        <td><?php echo $ver_consultar_sql_ver_xx1['nombre_chofer']; ?></td>
                                        <td><?php 
											$control_id_consultaX=mysql_query("select * from  tabla_vehiculos_peso_fact where eliminar='0' and cod_vehiculo_peso='".$codgox."'",$link);
											while($ver_controlX=mysql_fetch_array($control_id_consultaX)){
												echo "".$ver_controlX['n_factura']."<br>";
											}	?>
										</td>
                                        <td><?php echo number_format($ver_consulta_rubro_x1['peso_inicial'], 2, '.',''); ?> Kg.</td>
                                        <td style="background-color:#93ff61;" ><?php echo number_format($ver_control['SUM(peso)'], 2, '.',''); ?> Kg.</td>
                                        <td><?php echo number_format($ver_consulta_rubro_x1['peso_final'], 2, '.',''); ?> Kg.</td>
                                        <td><?php echo $ver_consulta_rubro_x1['hora_inicial']; ?> | <?php echo $ver_consulta_rubro_x1['hora_final']; ?></td>
                                        <td>
											<a href='cpanel.php?control_menu=procesos&condicion=romana&codgox=<?php echo $codgox;?>&paso=true&placa=<?php echo $ver_consultar_sql_ver_xx1['placa']; ?>' class='btn-success btn-sm'  >FACTURAS</a> |
											<a href='' target="_blank"  class='btn-primary btn-sm' data-toggle="modal" data-target=".bs-example-modal-lg-peso_salida-<?php echo $codgox; ?>">PESO SALIDA</a> |
										<?php if ($peso_total<=$peso_final){?>	
											<a href='pdf/reporte_amanacu/tikect_romana.php?&codgox=<?php echo $codgox;?>' target="_blank"  class='btn-warning btn-sm'>IMPRIMIR</a> 
										<?php } else { ?>
												<a href='' target="_blank"  class='btn-dark btn-sm'>EN ESPERA</a> 
										<?php } ?>
										</td>
										
                                    </tr> 
										<?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>
			<script>  
								  $(document).ready(function(){  
									   $('#search2').keyup(function(){  
											search_table($(this).val());  
									   });  
									   function search_table(value){  
											$('#employee_table2 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 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']; ?> | Registro de vehiculos</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_vehiculos'?>" method="POST" class="form-bordered" name='formulario'>

                                                <div class="col-sm-4">
													<input	class='form-control'
															type='text' 
															name='placa' 
															id='placa'
															autocomplete="off"
															required="required"
															title='Campo requerido, no dejar en blanco'
															value=''
															pattern="[A-Za-z0-9]{4,8}"
															placeholder='Placa del vehiculo'
															onChange="javascript:this.value=this.value.toUpperCase();"
													/>
												</div>
												<div class="col-sm-4">
													<input	class='form-control '
															type='number' 
															name='cedula_chofer' 
															id='cedula_chofer'
															autocomplete="off"
															required="required"
															title='Campo requerido, no dejar en blanco'
															value=''
															min="999"
															placeholder='Cedula del chofer'
													/>
												</div>
												<div class="col-sm-4">													
													<input	class='form-control' 
															type='text' 
															name='nombre_chofer' 
															id='nombre_chofer'
															autocomplete="off"
															required="required"
															title='Campo requerido, no dejar en blanco'
															value=''
															placeholder='Nombre del chofer'
															onChange="javascript:this.value=this.value.toUpperCase();"
													/>
							                    </div>	
												<div class="col-sm-4">													
													<input	class='form-control' 
															type='text' 
															name='descripcion_vehiculo' 
															id='descripcion_vehiculo'
															autocomplete="off"
															required="required"
															title='Campo requerido, no dejar en blanco'
															value=''
															placeholder='Descripcion de vehiculo'
															onChange="javascript:this.value=this.value.toUpperCase();"

													/>
							                    </div>
                              					<div class="col-sm-4">
												      <select id="select-search-hide"  name='cat_vehiculos'  class='form-control' required="required">
														<option value='' >CATEGORIA DE VEHICULOS</option>
													<?php	$consulta_rubro_x1=mysql_query("select * from tabla_vehiculos_cat_xls where eliminar=0",$link);
															while($ver_consulta_rubro_x1=mysql_fetch_array($consulta_rubro_x1)){ 
													?>
															<option value="<?php echo $ver_consulta_rubro_x1['id']; ?>"><?php echo $ver_consulta_rubro_x1['nombre']; ?></option>
													<?php  } ?>
													</select>
												</div>												
												<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>
				  			
<table  class="table table-striped table-bordered responsive">
                                <thead class="">
                                    <tr>
                                        <th>Placa</th>
                                        <th>Cedula del chofer</th>
                                        <th>Nombre del chofer</th>
                                        <th>Descripcion</th>
                                        <th>Opcion</th>
                                    </tr>
                                </thead>
                                <tbody>	
								<?php
									$consultar_sql_verxs=mysql_query("select * from   tabla_vehiculos_xls where eliminar='0' ORDER BY id DESC  ",$link);
									while($ver_consultar_sql_ver_xx1=mysql_fetch_array($consultar_sql_verxs)){
										?>								
									<tr>
											<td><?php echo $ver_consultar_sql_ver_xx1['placa']; ?></td>		
											<td><?php echo $ver_consultar_sql_ver_xx1['cedula_chofer']; ?></td>		
											<td><?php echo $ver_consultar_sql_ver_xx1['nombre_chofer']; ?></td>		
											<td><?php echo $ver_consultar_sql_ver_xx1['descripcion_vehiculo']; ?></td>		
											<td>
												<a href="<?php echo $url_global;?>&proceso=D3L3T3&token=<?php echo $ver_consultar_sql_ver_xx1['id']; ?>"   title="Eliminar"  class=" btn-danger btn-sm" ><i class="fa fa-trash-o"></i></a>
											</td>
									</tr>
								<?php } ?>
                                </tbody>			  
                               </table>							
							
							
							
												<br>
												<br>
				  </div>
              </div>
            </div>
        </div>							 
							 
<div class="modal fade bs-example-modal-lg-pesov" 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']; ?> | Pesos de vehiculos de entrada <?php echo $fecha_actualxls; ?></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_vehiculos_peso_inicial'?>" method="POST" class="form-bordered" name='formulario'>

                                               
                              					<div class="col-sm-12 ">
												      <select id="select-search-hide"  name='cod_vehiculo'  class='form-control' required="required">
														<option value='' >VEHICULOS REGISTRADOS</option>
													<?php	$consulta_rubro_x1=mysql_query("select * from  tabla_vehiculos_xls where eliminar=0  ORDER BY placa ASC",$link);
															while($ver_consulta_rubro_x1=mysql_fetch_array($consulta_rubro_x1)){ 
													?>
															<option value="<?php echo $ver_consulta_rubro_x1['id']; ?>"><?php echo $ver_consulta_rubro_x1['placa']; ?> - <?php echo $ver_consulta_rubro_x1['descripcion_vehiculo']; ?> - <?php echo $ver_consulta_rubro_x1['nombre_chofer']; ?></option>
													<?php  } ?>
													</select>
												</div><br><br><br>
												<div class="col-sm-12 has-error">
													<input	class="form-control Fieldss"
															type='number' 
															name='peso_inicial' 
															id='peso_inicial'
															autocomplete="off"
															required="required"
															title='Campo requerido, no dejar en blanco'
															value=''
															min="999"
															step="any"
															placeholder='P. de entrada'
													/>
												</div>	
																								
												<br>
												<br>
												<br>	<br>
												<br>
												<br>
										<div class="pull-right">
											<button type="submit" name="submit" value='Guardar' class="btn btn-primary btn-sm">GUARDAR <i class="fa fa-floppy-o ml5"></i></button>
										</div>
							</form>  
				  
				  <!-- CONTROL DEL FORMULARIO -->
				  			<br>
				  			<br>
				  			
<table  class="table table-striped table-bordered responsive">
                                <thead class="">
                                    <tr>
                                        <th>Fecha de entrada</th>
                                        <th>Vehiculo</th>
                                        <th>Peso de entrada</th>
                                        <th>Opcion</th>
                                    </tr>
                                </thead>
                                <tbody>	
								<?php
									$pconsultar_sql_verxs=mysql_query("select * from   tabla_vehiculos_peso_xls where eliminar='0' and fecha_registro='$fecha_actualxls' ORDER BY id DESC  LIMIT 50 ",$link);
									while($ver_consultar_sql_ver_xx1p=mysql_fetch_array($pconsultar_sql_verxs)){
										$vehiculo=$ver_consultar_sql_ver_xx1p['cod_vehiculo'];
										$consultar_sql_verxs=mysql_query("select * from   tabla_vehiculos_xls where id='".$vehiculo."' and eliminar='0'  ",$link);
										$ver_consultar_sql_ver_xx1=mysql_fetch_array($consultar_sql_verxs);
										?>								
									<tr>
											<td><?php echo $ver_consultar_sql_ver_xx1p['hora_inicial']; ?></td>		
											<td><?php echo $ver_consultar_sql_ver_xx1['placa']; ?> -  <?php echo $ver_consultar_sql_ver_xx1['nombre_chofer']; ?> - <?php echo $ver_consultar_sql_ver_xx1['descripcion_vehiculo']; ?></td>		
											<td><?php echo number_format($ver_consultar_sql_ver_xx1p['peso_inicial'], 2, ',',''); ?> Kg. </td>		
											<td>
												<a href="<?php echo $url_global;?>&proceso=D3L3T3_peso_v&token=<?php echo $ver_consultar_sql_ver_xx1p['id']; ?>"   title="Eliminar"  class=" btn-danger btn-sm" ><i class="fa fa-trash-o"></i></a>
											</td>
									</tr>
								<?php } ?>
                                </tbody>			  
                               </table>							
							
							
							
												<br>
												<br>
				  </div>
              </div>
            </div>
        </div>
		
<!-- FCATURA -->
<?php
  if($_GET['paso']=='true'){
	  $codgox=$_GET['codgox'];
?>

 <div class="locked">
            <div class="modal-dialog modal-lg">
              <div class="modal-content">
                  <div class="modal-header">
                      <a href='cpanel.php?control_menu=procesos&condicion=romana'><button aria-hidden="true" data-dismiss="modal" class="close" type="button">&times;</button></a>
                      <h4 class="modal-title"><?php echo $ver_cpanel_sub_menu['titulo']; ?> | Cargar facturas </h4>
                  </div>
				  <div class="panel-heading">
                      <p><?php echo $ver_cpanel_sub_menu['descripcion']; ?>.</p>
                  </div>
                  <div class="modal-body">
				  <!-- CONTROL DEL FORMULARIO -->
					<div class="input-group mb15 has-warning">
                            <span class="input-group-addon"><b>BUSCAR</b></span>
                            <input type="text" autofocus="autofocus" placeholder="Buscar cliente..." id="search_fact-<?php echo $codgox; ?>" class="form-control" />
                    </div>	
 <b>PLACA DEL VEHICULO: <?php echo $_GET['placa'];?></b><br>					
<table id="employee_table_fact-<?php echo $codgox; ?>"  class="table table-striped table-bordered responsive" border='1' >
                                <thead class="">
                                    <tr>
                                       <!-- <th>FECHA</th>-->
                                        <th>RIF</th>
                                        <th>CLIENTE</th>
                                        <th>DUCUMENTO</th>
                                        <th>PESO</th>
                                        <!--<th>VEHICULO</th>-->
                                        <th></th>
                                    </tr>
                                </thead>
								
                                <tbody>
<?php 								
	$consultar_sql_recreo=mysql_query("select SUM(peso_factura),fecha_factura,cod_cliente,descripcion,n_factura from  tabla_factura_xls_2 where estatus='0' and eliminar='0' and fecha_factura='$fecha_actualxls' GROUP BY n_factura ORDER BY id DESC",$link);
	while($ver_recreo=mysql_fetch_array($consultar_sql_recreo)){
	$id_control=$ver_recreo['n_factura'];	
	$cod_cliente=$ver_recreo['cod_cliente'];	
	$n_factura='RC-'.$ver_recreo['n_factura'];
	$crear_token=$ver_recreo['n_factura'].$fecha_ingreso;
	$token=MD5($crear_token);
	
		$control_id_consulta=mysql_query("select * from   tabla_vehiculos_peso_fact where eliminar='0' and n_factura='".$n_factura."'",$link);
		$ver_control=mysql_fetch_array($control_id_consulta);
		$n_factura_peso=$ver_control['n_factura'];
		if($n_factura!=$n_factura_peso){
?>									
								    <tr>
                                        <!--<td><?php echo $ver_recreo['fecha_factura']; ?></td>
                                        <td>RC</td>-->
                                        <td><?php echo $cod_cliente; ?></td>
                                        <td><?php echo $ver_recreo['descripcion']; ?></td>
                                        <td> RC-<?php echo str_pad($ver_recreo['n_factura'], 8, "0", STR_PAD_LEFT); ?></td>
										<input type="hidden" name="n_factura[]"  value="RC-<?php echo $ver_recreo['n_factura']; ?>">
                                        <td><?php echo number_format($ver_recreo['SUM(peso_factura)'], 2, ',',''); ?></td>
                                        <!--<td>VEHICULO</td>
											<td><button title="Eliminar"  class=" btn-primary btn-xs" data-toggle="modal" data-toggle="modal" data-target="#myModal-<?php echo $id_control; ?>"> <i class="fa fa-car ml5"></i> PESAR </button></td>
										-->
										<td><a href='cpanel.php?control_menu=procesos&condicion=romana&token=<?php echo $token; ?>&n_factura=RC-<?php echo $ver_recreo['n_factura']; ?>&peso=<?php echo $ver_recreo['SUM(peso_factura)']; ?>&cod_cliente=<?php echo $cod_cliente; ?>&codgox=<?php echo $codgox; ?>&paso=true&proceso=cargar_facturas'  class='btn-primary btn-sm' >CARGAR</a></td>
									</tr>
<?php } ?>	
<?php } ?>	
<?php 								
	$consultar_sql_amanacu=mysql_query("select * from tabla_factura_xls where estatus='0' and eliminar='0' and fecha_factura='$fecha_actualxls' ",$link);
	while($ver_amanacu=mysql_fetch_array($consultar_sql_amanacu)){	
	$id_control='x1-'.$ver_amanacu['id'];
	$n_factura='MA-'.$ver_amanacu['n_factura'];
	$crear_token=$n_factura.$fecha_ingreso;
	$token=MD5($crear_token);
	
		$consultar_sql_clientex=mysql_query("select * from  tabla_clintes_xls where eliminar='0' and id='".$ver_amanacu['cod_cliente']."'",$link);
		$ver_consultar_sql_clientex=mysql_fetch_array($consultar_sql_clientex);
		
		
		$control_id_consulta=mysql_query("select * from   tabla_vehiculos_peso_fact where eliminar='0' and n_factura='".$n_factura."'",$link);
		$ver_control=mysql_fetch_array($control_id_consulta);
		$n_factura_peso=$ver_control['n_factura'];
	if($n_factura!=$n_factura_peso){
?>									
								    <tr>
                                        <!--<td><?php echo $ver_amanacu['fecha_factura']; ?></td>
                                        <td>AMANACU</td>-->
                                        <td><?php echo $ver_consultar_sql_clientex['rif']; ?></td>
                                        <td><?php echo $ver_consultar_sql_clientex['descripcion']; ?></td>
                                        <td><a href='pdf/reporte_amanacu/factura_dolares_reimprimir.php?n_facturax=<?php echo $ver_amanacu['n_factura']; ?>&cod_cliente=<?php echo $ver_amanacu['cod_cliente']; ?>&token=<?php echo $ver_amanacu['token']; ?>&usuario=<?php echo $codigo; ?>&fecha_registro=<?php echo $ver_amanacu['fecha_factura']; ?>' target="_blank" >MA-<?php echo str_pad($ver_amanacu['n_factura'], 8, "0", STR_PAD_LEFT); ?></a></td>
										<input type="hidden" name="n_factura[]"  value="AM-<?php echo $ver_amanacu['n_factura']; ?>">
										<td><?php echo number_format($ver_amanacu['peso_factura'], 2, ',',''); ?> </td>
                                        <!--<td>VEHICULO</td>-->
										<td><a href='cpanel.php?control_menu=procesos&condicion=romana&token=<?php echo $token; ?>&n_factura=MA-<?php echo $ver_amanacu['n_factura']; ?>&peso=<?php echo $ver_amanacu['peso_factura']; ?>&cod_cliente=<?php echo $ver_consultar_sql_clientex['rif']; ?>&codgox=<?php echo $codgox; ?>&paso=true&proceso=cargar_facturas&accion=true'   class='btn-primary btn-sm'>CARGAR</a></td>
                                    </tr>
<?php } ?>									
<?php } ?>									
                                </tbody>
                            </table>  				  

				  </div>
              </div>
            </div>
        </div>		
<script>  
								  $(document).ready(function(){  
									   $('#search_fact-<?php echo $codgox; ?>').keyup(function(){  
											search_table($(this).val());  
									   });  
									   function search_table(value){  
											$('#employee_table_fact-<?php echo $codgox; ?> 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>		
		
<?php } ?>		
					

<?php
	$consulta_rubro_x1=mysql_query("select * from  tabla_vehiculos_peso_xls where eliminar=0  and fecha_registro='$fecha_actualxls' and estatus='0'",$link);
	while($ver_consulta_rubro_x1=mysql_fetch_array($consulta_rubro_x1)){ 
		$codgox=$ver_consulta_rubro_x1['id'];
?>
<div class="modal fade bs-example-modal-lg-peso_salida-<?php echo $codgox; ?>" 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']; ?> | Peso de salida </h4>
                  </div>
				  <div class="panel-heading">
                      <p><?php echo $ver_cpanel_sub_menu['descripcion']; ?>.</p>
                  </div>
                  <div class="modal-body">
				  <!-- CONTROL DEL FORMULARIO -->
				   <b>PLACA DEL VEHICULO: : <?php echo $ver_consulta_rubro_x1['placa'];?></b><br><br><br>
					<form action="<?php echo $url_global.'&proceso=peso_salida&token='.$codgox ?>" method="POST" class="form-bordered" name='formulario'>
                 

												<div class="col-sm-12 has-error">
													<input	class="form-control Fields"
															type='number' 
															name='peso_final' 
															id='peso_final'
															autocomplete="off"
															required="required"
															title='Campo requerido, no dejar en blanco'
															value=''
															min="999"
															step="any"
															placeholder='Peso de salida'
													/>
												</div>	
																								
												<br>
												<br>
												<br>	<br>
												<br>
												<br>
										
										<div class="pull-right">
											<button type="submit" name="submit" value='Guardar' class="btn btn-primary btn-sm">GUARDAR <i class="fa fa-floppy-o ml5"></i></button>
										</div>
										<br>
												<br>
												<br>
												<br>
							</form>				  
				  

				  </div>
              </div>
            </div>
        </div>		

		
<?php } ?>	