<?php
date_default_timezone_set("America/Mexico_City");
session_start();
include('conexion.php');
//include('my$sql_Valida_permiso.php');	
function FechaFormateada($FechaStamp)
{
	$ano = date('Y',$FechaStamp); //<-- Año
	$mes = date('m',$FechaStamp); //<-- número de mes (01-31)
	$dia = date('d',$FechaStamp); //<-- Día del mes (1-31)
	$dialetra = date('w',$FechaStamp);  //Día de la semana(0-7)
	switch($dialetra)
	{
		case 0: $dialetra="Domingo"; break;
		case 1: $dialetra="Lunes"; break;
		case 2: $dialetra="Martes"; break;
		case 3: $dialetra="Miércoles"; break;
		case 4: $dialetra="Jueves"; break;
		case 5: $dialetra="Viernes"; break;
		case 6: $dialetra="Sábado"; break;
	}
	switch($mes) 
	{
		case '01': $mesletra="Enero"; break;
		case '02': $mesletra="Febrero"; break;
		case '03': $mesletra="Marzo"; break;
		case '04': $mesletra="Abril"; break;
		case '05': $mesletra="Mayo"; break;
		case '06': $mesletra="Junio"; break;
		case '07': $mesletra="Julio"; break;
		case '08': $mesletra="Agosto"; break;
		case '09': $mesletra="Septiembre"; break;
		case '10': $mesletra="Octubre"; break;
		case '11': $mesletra="Noviembre"; break;
		case '12': $mesletra="Diciembre"; break;
	}    
	return "$dialetra, $dia de $mesletra de $ano";
}
if (isset($_SESSION['id_usuario']))
{
?>
<HTML>
<head>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="shortcut icon" href="images/Sysmental.jpg" type="image/jpeg"/>
	<title>Flotillas</title>
	<link href="css/bootstrap.min.css" rel="stylesheet">
	<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
	<script src="//code.jquery.com/jquery-1.10.2.js"></script>
	<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
		
	<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
	<!--alert-->
	<script src = "sweetalert-master/dist/sweetalert.min.js" ></script>  
	<link rel = "stylesheet" type = "text/css" href = "sweetalert-master/dist/sweetalert.css" >
	<input type="hidden" name="vartime" id="vartime" value="t">
<script type="text/javascript" src="js/funciones.js"></script>
	
</head>
<style>
fieldset.scheduler-border {
    border: 1px groove #ddd !important;
    padding-top: 0px;
    padding-right: 10px;
    padding-bottom: 10px;
    padding-left: 10px;
    margin: 0 0 1em 0 !important;
    -webkit-box-shadow:  0px 0px 0px 0px #000;
            box-shadow:  0px 0px 0px 0px #000;
}

    legend.scheduler-border {
        font-size: 1em !important;
        font-weight: bold !important;
        text-align: left !important;
        width:auto;     		
        border-bottom:none;
    }
	
	#popup {
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
		height: 100%;
    z-index: 1001;
}

.content-popup {
    margin:0px auto;
    margin-top:120px;
    position:relative;
    padding:10px;
    width:100%;
	height: 100%;
    min-height:250px;
    border-radius:4px;
    background-color:#FFFFFF;
    box-shadow: 0 2px 5px #000;
}

.content-popup h2 {
    color:#48484B;
    border-bottom: 1px solid #48484B;
    margin-top: 0;
    padding-bottom: 4px;
}

.popup-overlay {
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 999;
    display:none;
    background-color: #777777;
    cursor: pointer;
    opacity: 0.7;
}

.close {
    position: absolute;
    right: 15px;
}
		@media screen and (max-width: 600px) {
       table {
           width:100%;
       }
       thead {
           display: none;
       }
       tr:nth-of-type(2n) {
           background-color: inherit;
       }
       tr td:first-child {
           background: #f0f0f0;
           font-weight:bold;
           font-size:1.3em;
       }
       tbody td {
           display: block;
           /*text-align:center;*/
       }
       tbody td:before {
           content: attr(data-th);
           display: block;
           /*text-align:center;*/
       }
			
			#popup {
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
				height: auto;
    z-index: 1001;
}

.content-popup {
    margin:0px auto;
    margin-top:120px;
    position:relative;
    padding:10px;
    width:300px;
    min-height:250px;
    border-radius:4px;
    background-color:#FFFFFF;
    box-shadow: 0 2px 5px #666666;
}

.content-popup h2 {
    color:#48484B;
    border-bottom: 1px solid #48484B;
    margin-top: 0;
    padding-bottom: 4px;
}

.popup-overlay {
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 999;
    display:none;
    background-color: #777777;
    cursor: pointer;
    opacity: 0.7;
}

.close {
    position: absolute;
    right: 15px;
}
}
.botonesdina {
    position: fixed;
	top: 0; 
    min-height: 120px;
    width: 100%;
    text-align: center;
    word-wrap: break-word;
   overflow-x:auto;
}
	.contenedor {
	width: 95%;
	max-width:1000px;
	margin:auto;
}
 
.contenedor p {
	margin-bottom:40px;
}
 
 
.menu-fixed {
	position:fixed;
	z-index:1000;
	top:0;
	/*max-width:1000px;*/
	left:35%;
	width:100%;
	/*box-shadow:0px 4px 3px rgba(0,0,0,.5);*/
}
	th {
    text-align: center;
}
</style>

<body>
	<nav class="navbar navbar-default">
	  <div class="container-fluid">
		<div class="navbar-header">
		  <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
			<span class="sr-only">Toggle navigation</span>
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
		  </button>
		  <img  src="images/Logo.jpg" width="130" align="left" style="border:outset" />	
		</div>
		<center style="width:auto;align:center;" valign="center">					
			<H1 style="color:white;font-weight: bold;">FLOTILLAS</H1>
		</center>
		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
		  <ul class="nav navbar-nav">
			<li><a style="font-weight: bold;font-size:20;" href="catalogo_vehiculos.php">Vehiculos</a></li>
			  <li ><a id="transac" style="font-weight: bold;font-size:20;display:<?php if($_SESSION['transacciones']==1){echo 'block';}else{ echo 'none';}?>" href="catalogo_transacciones.php">Transacciones</a></li> 
		  <li ><a id="fact" style="font-weight: bold;font-size:20;display:<?php if($_SESSION['facturas']==1){echo 'block';}else{ echo 'none';}?>" href="catalogo_facturas.php">Facturas</a></li> 
			<li><a style="font-weight: bold;font-size:20;" href="catalogo_consumos.php">Reportes</a></li>
			   
		  </ul>      
		  <ul class="nav navbar-nav navbar-right">
			<li><a style="font-weight: bold;font-size:20;pointer-events: none;cursor: default;color:white;" ><?php echo $_SESSION['id_usuario'];?></a></li>
			<li><a style="font-weight: bold;font-size:20;" href="logout.php">Salir</a></li>
		  </ul>
		</div>
	  </div>
	</nav>
	
	
		
	<div id="divTransacciones">
		<table align="center" style="background-color:transparent;">
		<tr>
			<td>
				<center style="width:900px;align:center;background-color:transparent;" valign="center" id="Contenedor">
					<div class="panel panel-success" style="background-color:transparent;height:auto;width:900px;" >
						<div class="panel-heading" style="height:40px;">Transacciones&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php $fecha = time();  echo FechaFormateada($fecha). "  "; ?>
						
						</div>
						<div class="panel-body" >
							
							<table style="width:auto;">
								
								<div class="contenedor">
								<tr style="height:30px;" class="menu">
								
			
								<td style="width:150px;font-weight: bold;" ><input type="button" onclick="window.location.reload()" class="btn btn-default" value="Limpiar"></td>
									<td></td>
									<td></td>
									<td align="left" width="97px"><input type="button" onclick="cargatransacciones()" class="btn btn-default" value="Consultar"></td>
									<td align="right">
										<input type="button" onclick="detalles(1)" class="btn btn-default" value="Detalle"> 
										<input type="button" onclick="reporte_transacciones(1)" class="btn btn-default" value="Reporte PDF">
										<input type="button" onclick="reporte_transacciones(2)" class="btn btn-default" value="Reporte XLS">
									</td>
								</tr>
									</table>
								
								<table style="width:auto;" align="left">
									</div>
								<tr style="height:30px;">
									<td style="font-weight: bold;">Cliente</td>
									<td><?php echo $_SESSION['id_cliente'];?></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>	
								<tr style="height:30px;">
									<td style="font-weight: bold;">Razon Social</td>
									<td><?php echo $_SESSION['razon_social'];?></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr style="height:30px;">
									<td style="width:150px;font-weight: bold;">Saldo</td>
									<td><?php echo number_format($_SESSION['saldo'],2,'.',',');?></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>	
								<tr style="height:30px;">
									<td>Vehiculo</td>
									<td><input type="hidden" id="idvehiculo" name="idvehiculo" disabled><input type="text" id="descvehiculo" name="descvehiculo" disabled><input type="button" id="btnvehiculo" name="btnvehiculo" onClick="clo(1)" value="..."><input type="text" name="departamento" id="departamento" placeholder="Departamento" onKeyUp="limpia_vehiculo()" style="text-align: left;width: 200px;"></td>
									<td></td>
									<td></td>
									
										<td></td>
								</tr>
								
								<tr style="height:30px;">
									<td><input type="checkbox" name="checkestatus" id="chkTurno">Fecha Contable: </td>
									<td><input type="text" id="txtFechaContableIni" name="turnoini" class="numeros" style="text-align: right;width: 205px;" placeholder="Inicial" disabled>  <input type="text" id="txtFechaContableFin" name="turnofin" class="numeros" style="text-align: right;width: 205px;" placeholder="Final" disabled></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
							<tr style="height:30px;">
									<td><input type="checkbox" name="fechaini" onChange="activar(1)" id="fechaini" >Fecha de Registro:</td>
									<td><input type="text" id="txtFechaRegistroIni" name="turnoini" class="numeros" style="text-align: right;width: 205px;" placeholder="Inicial" disabled>  <input type="text" id="txtFechaRegistroFin" name="turnofin" class="numeros" style="text-align: right;width: 205px;" placeholder="Final" disabled></td>
									<td align="right"> </td>
									<td align="right"> </td>
									<td ></td>
								</tr>
								<tr style="height:30px;">
									<td align="left"><input type="checkbox" name="checkestatus" id="serie"> Serie</td>
									<td align="left">  <input type="text" name="serietxt" id="seriet" disabled>&nbsp;&nbsp;<input type="checkbox" name="checkestatus" id="facturado"> Facturado</td>
									<td></td>
									<td ></td>
									<td ></td>
								</tr>
								<tr style="height:30px;">
									<td align="left"><input type="checkbox" name="checkestatus" id="folio"> Folio</td>
									<td align="left"> <input type="text" name="foliotxt" id="foliot" class="numeros"disabled>&nbsp;&nbsp;<input type="checkbox" name="checkestatus" id="nofacturado"> No Facturado</td>
									<td> </td>
									<td align="right"> </td>
									<td ></td>
								</tr>
								<tr style="height:30px;">
									<td align="left"><input type="checkbox" name="checkestatus" id="adeudo"> Adeudo </td>
									<td ><input type="text" name="adeudotxt" class="numeros" id="adeudot" disabled>&nbsp;&nbsp;<input type="checkbox" name="checkestatus" id="limit" checked> Limite</td>
									<td align="right">  </td>
									<td ></td>
									<td ></td>
								</tr>
								
								</table>
							<table style="width:auto;" align="right" >
								<tr style="height:30px;">
									<td><br></td>
								</tr>
								<tr style="height:30px;">
									
									<td>Productos</td>
								</tr>
								<tr style="height:10px;">
									
									</tr>
									
									
									<?php
 										$sql ="select id_producto, nombre from productos ";
										$sql .="where clase= 1 and id_producto in( ";
										$sql .="select distinct(id_producto) from gaslight.mangueras) ";
										$sql .= "order by id_producto ";
 										
 										mysqli_query($iden,'SET NAMES utf8');


										$resultado = $iden->query($sql); 
 										
 									?>
									<tr style="height:10px;" >	
										
									<?php
 									$con=0;
 									while($fila = $resultado->fetch_array()) 
									{	 
										if($con>0)
										{
											
										}
 										echo '<td><input type="checkbox" name="productos" id="'.$fila['id_producto'].'" checked> '.$fila['nombre'].'</td></tr>';
									
										$con++;
									}
										?>
								
								
							</table>
							
						</div>	
						
					</div>
					
				</center> 	
			</td>
		</tr>
		<tr>		
			<td align="right">
						
			</td>
		</tr>	
	</table>
<div align="center">
<div id="myDiv2" align="center"></div>
	<br>
	<table align="right">
					<tr>
					<td>
						<img width="150px;" src="images/GasLight System.jpg"></img>
					</td>
					</tr>
				</table>
</div>
	<div id="popup" style="display: none;">
    <div class="content-popup">
	
        <div class="close"><a href="#" id="close"><input type="button" class="btn btn-default" value="Cerrar"></a></div>
		<br>
		<div>
           <h2 id="tituloventana"><font color="#000000"></h2>
         
        </div>
		
		<div id="loader" style="position: absolute;	text-align: center;	top: 55px;	width: 100%;display:none;"></div>
	<div class="outer_div" ></div>
			<div id="myDiv" align="center"></div>
			
    </div>
</div>
	
	<div style="display:none">
	<input style="display:none" type="button" id="btnagregar" type="hidden"/>
	<input style="display:none" type="button" id="btneditar" type="hidden"/>
	</div>
	</div>	
	
	
</body>
<?php 
}	
else
{
header('location: inicio.php');
}
?>

<script>
	$( function() {
	$( "#txtFechaRegistroIni" ).datepicker(
    	{
    		dateFormat: 'dd-mm-yy',
    		monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio',
            'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'
        	],
        	dayNames: ['Domingo', 'Lunes', 'Martes', 'Mi&eacute;rcoles', 'Jueves', 'Viernes', 'S&aacute;bado'],
        dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mi&eacute;', 'Juv', 'Vie', 'S&aacute;b'],
        dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'S&aacute;']

    	});
	$( "#txtFechaRegistroFin" ).datepicker(
    	{
    		dateFormat: 'dd-mm-yy',
    		monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio',
            'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'
        	],
        	dayNames: ['Domingo', 'Lunes', 'Martes', 'Mi&eacute;rcoles', 'Jueves', 'Viernes', 'S&aacute;bado'],
        dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mi&eacute;', 'Juv', 'Vie', 'S&aacute;b'],
        dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'S&aacute;']

    	});
    $( "#txtFechaContableIni" ).datepicker(
    	{
    		dateFormat: 'dd-mm-yy',
    		monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio',
            'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'
        	],
        	dayNames: ['Domingo', 'Lunes', 'Martes', 'Mi&eacute;rcoles', 'Jueves', 'Viernes', 'S&aacute;bado'],
        dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mi&eacute;', 'Juv', 'Vie', 'S&aacute;b'],
        dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'S&aacute;']

    	});
    $( "#txtFechaContableFin" ).datepicker({
    		dateFormat: 'dd-mm-yy',
    		monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio',
            'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'
        	],
        	dayNames: ['Domingo', 'Lunes', 'Martes', 'Mi&eacute;rcoles', 'Jueves', 'Viernes', 'S&aacute;bado'],
        dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mi&eacute;', 'Juv', 'Vie', 'S&aacute;b'],
        dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'S&aacute;']

    	});
  } );
</script>
</html>
