

<script>
if (window.history.replaceState) { // verificamos disponibilidad
    window.history.replaceState(null, null, window.location.href);
}

/*
//$('.auto-save').savy('load') --> can be used without callback
$('.auto-save').savy('load',function(){
  console.log("All data from savy are loaded");
});
*/
function dstry(){
 ///
}
function msg(txt){
 alert(txt);

}

cashState(myCaja)
              function cashState(caja){
                var sql = "select * from apertura_caja where caja='"+caja+"' order by id desc limit 1";
                _enviar("../php/traer_datos.php",{sql:sql})
                .done( function( data ){
                  var rs = JSON.parse(data);
                  estadoCaja = rs.data[0].estado;

                   $("#lb-caja3").html(myCaja+"("+estadoCaja+")");
                })
              }


function noti(tipo,mensaje,titulo){
    toastr.options = {
      "closeButton": false,
      "debug": false,
      "newestOnTop": false,
      "progressBar": true,
      "positionClass": "toast-bottom-right",
      "preventDuplicates": false,
      "onclick": null,
      "showDuration": "300",
      "hideDuration": "1000",
      "timeOut": "5000",
      "extendedTimeOut": "1000",
      "showEasing": "swing",
      "hideEasing": "linear",
      "showMethod": "fadeIn",
      "hideMethod": "fadeOut"
    }
    toastr[tipo](mensaje,titulo);
    
}

$(".form-control").attr("autocomplete", "off");


if(isMobile()){
/////
}


function isMobile(){
    return (
        (navigator.userAgent.match(/Android/i)) ||
        (navigator.userAgent.match(/webOS/i)) ||
        (navigator.userAgent.match(/iPhone/i)) ||
        (navigator.userAgent.match(/iPod/i)) ||
        (navigator.userAgent.match(/iPad/i)) ||
        (navigator.userAgent.match(/BlackBerry/i))
    );
}

//$(document).ready(function() { var table = $('table').DataTable( { lengthChange: false, buttons: true } ); table.buttons().container() .insertBefore( '#example_filter' ); } );
  
</script>
<!---Modal autenticar-->
<div class="modal" id="modalAutenticar" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <span class="modal-title text-success h4" id="exampleModalLabel"><i class="fa fa-w fa-edit"></i> Introduzca las credenciales</span>
        <button class="close" type="button" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">×</span>
        </button>
      </div>
      <div class="modal-body">
		<b>Nombre de usuario</b>
        <input class="form-control mb-2 bolder" placeholder="" type="text" id="txt-auth-user">
		
		<b>Clave</b>
        <input class="form-control mb-2 bolder" placeholder="" type="password" id="txt-auth-pass">
		 
      </div>
      <div class="modal-footer">
		<a class="btn btn-success" onClick="auth_user2()"> <i class="fa fa-w fa-home"></i> Validar</a>
        <a class="btn btn-default" data-dismiss="modal"> <i class="fa fa-w fa-home"></i> Cancelar</a>
      </div>
    </div>
  </div>
</div>


<!---Modal autenticar-->
<div class="modal" id="modalAutenticar2" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <span class="modal-title text-success h4" id="exampleModalLabel"><i class="fa fa-w fa-edit"></i> Introduzca las credenciales</span>
        <button class="close" type="button" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">×</span>
        </button>
      </div>
      <div class="modal-body">
    <b>Nombre de usuario</b>
        <input class="form-control mb-2 bolder" placeholder="" type="text" id="txt-auth-user2">
    
    <b>Clave</b>
        <input class="form-control mb-2 bolder" placeholder="" type="password" id="txt-auth-pass2">
     
      </div>
      <div class="modal-footer">
    <a class="btn btn-success" onClick="auth_user3()"> <i class="fa fa-w fa-home"></i> Validar</a>
        <a class="btn btn-default" data-dismiss="modal"> <i class="fa fa-w fa-home"></i> Cancelar</a>
      </div>
    </div>
  </div>
</div>

<!---Modal autenticar-->
<div class="modal" id="modalAutenticar3" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <span class="modal-title text-success h4" id="exampleModalLabel"><i class="fa fa-w fa-edit"></i> Introduzca las credenciales</span>
        <button class="close" type="button" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">×</span>
        </button>
      </div>
      <div class="modal-body">
    <b>Nombre de usuario</b>
        <input class="form-control mb-2 bolder" placeholder="" type="text" id="txt-auth-user3">
    
    <b>Clave</b>
        <input class="form-control mb-2 bolder" placeholder="" type="password" id="txt-auth-pass3">
     
      </div>
      <div class="modal-footer">
    <a class="btn btn-success" onClick="auth_user4()"> <i class="fa fa-w fa-home"></i> Validar</a>
        <a class="btn btn-default" data-dismiss="modal"> <i class="fa fa-w fa-home"></i> Cancelar</a>
      </div>
    </div>
  </div>
</div>

<script>
function auth_user(){
	
	$("#modalAutenticar").modal('show')
	$("#txt-auth-user").focus().select()
	
}
var funct;
function modalAuth00(f){
  funct = f;
  $("#modalAutenticar3").modal('show')
  $("#txt-auth-user3").focus().select()
  
}

function auth_user2(){
	var el = $("#txt-auth-el").val();
	var param = "nombre="+$("#txt-auth-user").val()+"&pass="+$("#txt-auth-pass").val();
				$.get("../auth_user.php?"+param, function(data,st){
					if(st=="success"){
						if(data>0){
								///
								$("#txt-precio").prop("disabled", false);
								$("#modalAutenticar").modal('hide')
								$("#txt-precio").focus().select()
						}else{
							alert("No tiene acceso para esta operacion")
							return
						}
					}
				})
}


function auth_user_cancelar_venta(){
  
  $("#modalAutenticar2").modal('show')
  $("#txt-auth-user2").focus().select()
  
}
function auth_user3(){
  var el = $("#txt-auth-el").val();
  var param = "nombre="+$("#txt-auth-user2").val()+"&pass="+$("#txt-auth-pass2").val();
        $.get("../auth_user.php?"+param, function(data,st){
          if(st=="success"){
            if(data>0){
               
                $("#modalAutenticar2").modal('hide')
               cancelar2()
            }else{
              alert("No tiene acceso para esta operacion")
              return
            }
          }
        })
}



function auth_user4(){
  
  var param = "nombre="+$("#txt-auth-user3").val()+"&pass="+$("#txt-auth-pass3").val();
        $.get("../auth_user.php?"+param, function(data,st){
          if(st=="success"){
            if(data>0){
               
                $("#modalAutenticar3").modal('hide')
               validAuth="Ok"
                funct();
                validAuth=""
            }else{
              alert("No tiene acceso para esta operacion")
              validAuth=""
             
              return
            }
          }
        })
}

setTimeout(function(){
	$(".table").addClass("table-hover");
	$(".table").addClass("table-stripped");
	///$(".table").addClass("table-bordered");
	
  ///$(".btn").removeClass("btn");

},3000);
</script>
<?php
$hoy = @date('yyyy-dd-mm');
@mysql_close($con);
?>

