<?php session_start();
require('../cfg/cfg.php');
require('../cfg/res.php');

$xacceso=0;
if (mb_stristr('sist',$_SESSION['user_vcrx_tipo'])){$xacceso=1;}
if ($xacceso==0){echo '<font size="8" color="red"><b>';die('No tiene acceso a Actualizar DB ' );}	


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $empr_nombre.'-'.$_SESSION['user_vcrx_id'];?> - Actualiazr MySql</title>
<link rel="stylesheet" href="http://vcrxol.com/_css/comun.css" type="text/css" />
<link rel="stylesheet" href="../css/comun2.css" type="text/css" />
<script type="text/javascript" src="../js/jquery-1.11.1.js"></script>
<script type="text/javascript">
<?php include('../../_js/busca_maes3.js');?>
<?php include('../../_js/busca_ficha.js');?>
<?php include('../../_js/fecha_format.js');?>


	
function _fecha(e,idfec)
{
//if(e.keyCode==9 || e.keyCode==13)
	if(e.keyCode==13)
	{
		var fn=document.getElementById(idfec).value;
		fn=fecha_format(fn);
		document.getElementById(idfec).value=fn;
	}
}
	
	
function docu_key(e)
{
		var docux=document.getElementById('docu').value;
		
		if(docux=='' || docux==' ')
		{
			return false;
		}
	
		if(e.keyCode==13)
		{
			docu_();	
		}
		
}
function docu_()
{
// 	busca_maes2('docu',document.getElementById('docu').value,'docu','docu_descri','');
}

function updsql2(tipoupd)
{
	var error='ext_error';
// 	var docu=document.getElementById('docu').value;
// 	var fini=document.getElementById('fini').value;
// 	var ffin=document.getElementById('ffin').value;
// 	var nini=document.getElementById('nini').value;
// 	var nfin=document.getElementById('nfin').value;
		$.ajax({
		cache:false,
		url:'vrupdsql2.php',
		datatype: "text",
	    async:false,
		type:'POST',
		data:{tipoupd:tipoupd}, 
    	beforeSend: function(jqXHR, textStatus)
		{
	                  
		}, 
		
		success:function(dato, textStatus, jqXHR)
		{
			console.log(dato);
		},
		error:function(jqXHR,textStatus,errorThrown )
		{
           if(document.getElementById(error))
		   {
				
				document.getElementById(error).innerHTML='';
				if (jqXHR.status === 0) {
				document.getElementById(error).innerHTML='Not connect: Verify Network.';
				} else if (jqXHR.status == 404) {
				document.getElementById(error).innerHTML='Requested page not found [404]';
				} else if (jqXHR.status == 500) {
				document.getElementById(error).innerHTML='Internal Server Error [500].';
				} else if (exception === 'parsererror') {
				document.getElementById(error).innerHTML='Requested JSON parse failed.';
				} else if (exception === 'timeout') {
				document.getElementById(error).innerHTML='Servidor no Responde';
				} else if (exception === 'abort') {
				document.getElementById(error).innerHTML='Ajax request aborted.';
				} else {
				document.getElementById(error).innerHTML='Uncaught Error: ' + jqXHR.responseText;
				}
		   }
		   else
		   {
			
				if (jqXHR.status === 0) {
	              console.log('Not connect: Verify Network.');
		           } else if (jqXHR.status == 404) {
	               console.log('Requested page not found [404]');
		           } else if (jqXHR.status == 500) {
	               console.log('Internal Server Error [500].');
		           } else if (exception === 'parsererror') {
	               console.log('Requested JSON parse failed.');
		           } else if (exception === 'timeout') {
	               alert('Servidor no Responde');
		           } else if (exception === 'abort') {
	               console.log('Ajax request aborted.');
		           } else {
	               console.log('Uncaught Error: ' + jqXHR.responseText);
           			}
			
			}
		   

		}, 
		complete:function(jqXHR, textStatus)
    	{
			if(textStatus==='success')
	        {
				
    	    	
			}
		},
		timeout:300000
	});

}



</script>

</head>

<body>
<div align="center" >
	<div align="left" style="">
<table>
	<tr>
    	<td>
			<a href="http://<?php echo $empr_codigo;?>.vcrxol.com/main/" title="INICIO" ><img src="http://vcrxol.com/_logo/logo<?php echo $empr_codigo;?>1.png" width="190"/></a>		</td>
        <td>
	        <div id="titulo" align="left" style="width:100%;">ACTUALIZAR MYSQL DB</div>
        </td>
    </tr>
</table>

<table>
<tr>
	<td><?php $pcaption='Maestros';  $ponclick="updsql2(0);" ;include('vrbutton.php'); ?></td>	
	<td><?php $pcaption='Transacciones';  $ponclick="updsql2(1);" ;include('vrbutton.php'); ?></td>
	<td><?php $pcaption='Vistas Maestros';  $ponclick="updsql2(3);" ;include('vrbutton.php'); ?></td>
	<td><?php $pcaption='Vistas Transacciones';  $ponclick="updsql2(4);" ;include('vrbutton.php'); ?></td>

<!-- 	<td ><input type="button" onclick="updsql2(0);" value="Maestros" class="btn" /></td> -->
<!-- 	<td ><input type="button" onclick="updsql2(1);" value="Transacciones" class="btn" /></td> -->
<!-- 	<td ><input type="button" onclick="updsql2(2);" value="Detalles" class="btn" /></td> -->
<!-- 	<td ><input type="button" onclick="updsql2(3);" value="Vistas Maestros" class="btn" /></td> -->
<!-- 	<td ><input type="button" onclick="updsql2(4);" value="Vistas Transacciones" class="btn" /></td> -->
</tr>
</table>


<div id="ext_error"></div>
<div id="ext_list"></div>
</div>
</div>
</body>
</html>