<?php session_start();
require('../cfg/cfg.php');
require('../cfg/res.php');
$pagina_descri='LISTA ITEM';
$pagina_nivel;
$pagina_tipo;

?>
<!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'];?> - Items </title>
<link rel="stylesheet" href="http://vcrxol.com/_css/comun.css" type="text/css" />

<style>
body{ font-size:12px;}
</style>
<script type="text/javascript" src="../js/jquery-1.11.1.js"></script>
<script type="text/javascript">
var intervalo=0;
var tiempo;


function llena_mitad(ordena,crit)
{
	document.getElementById('barra_azul').style.width=intervalo+'%';
	
	
	if(intervalo==50)
	{
		window.clearTimeout(tiempo);
		ordena_item(ordena,crit);
	}
	intervalo++;
	

}

function llena_full()
{
	document.getElementById('barra_azul').style.width=intervalo+'%';
	
	
	if(intervalo==100)
	{
		window.clearTimeout(tiempo);
		intervalo=0;
	}
	intervalo++;
	

}


function ordena_item()
{
	
	
		
		var lsub=document.getElementById('txt_lsub').value;
		var codigo=document.getElementById('txt_codigo').value;
		var descri=document.getElementById('txt_descri').value;
		var mrca=document.getElementById('txt_mrca').value;
		var mdlo=document.getElementById('txt_mdlo').value;
		var codigov=document.getElementById('txt_codigov').value;
		var numpart=document.getElementById('txt_numpart').value;
		
		
		
		$.ajax({
		cache:false,
		url:'vritemlist2.php',
		datatype: "text",
	    async:true,
		type:'POST',
		data:{lsub:lsub,codigo:codigo,descri:descri,mrca:mrca,mdlo:mdlo,codigov:codigov,numpart:numpart}, 
    	beforeSend: function(jqXHR, textStatus)
		{
	                  
		}, 
		
		success:function(dato, textStatus, jqXHR)
		{
			console.log('cargo');
			document.getElementById('lista_contenedor').innerHTML=dato;
			
		},
		error:function(jqXHR,textStatus,errorThrown )
		{
				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')
	        {
				    //activa();				    	
			}
		},
		timeout:300000
	});

}

function desactiva()
{
	var boton=document.getElementsByClassName('btn_titulo').length;
	for(i=0;i<boton;i++)
	{
		document.getElementsByClassName('btn_titulo').item(i).disabled=true;
	}
}

function activa()
{
	var boton=document.getElementsByClassName('btn_titulo').length;
	for(i=0;i<boton;i++)
	{
		document.getElementsByClassName('btn_titulo').item(i).disabled=false;
	}
}


function abrirventana(cod) 
{
    window.open("bcitem.php?idx="+cod, "codigo de barras", "directories=no, location=no, menubar=no, scrollbars=no, statusbar=no, tittlebar=no, width=150, height=200");
}

function abriretiqueta(cod) 
{
	var eti='0';
	if(document.getElementById('chkmrca').checked)
	{eti='1';}

	var itlla='0';
	if(document.getElementById('chktlla').checked)
	{itlla='1';}

	var ipvp1='0';
	if(document.getElementById('chkpvp1').checked)
	{ipvp1='1';}

	var lote=document.getElementById('txt_lote').value;
	if (ipvp1=='1'){lote='';}

	
	var urlx='lblbcgnya1.php?itemi='+cod+'&eti='+eti+'&itlla='+itlla+'&ipvp1='+ipvp1+'&lote='+lote;
    window.open(urlx, "codigo de barras", "directories=no, location=no, menubar=yes, scrollbars=yes, statusbar=yes, tittlebar=yes");
}


//window.onload=function(){tiempo=setInterval(function() {llena_mitad('codigo');}, 50);}
//window.onload=function(){ordena_item('codigo');};

</script>

</head>

<body style="padding:0px; margin:0px;">
<div style="height:5px; margin:-1px 0px 0px 0px; padding:0px;"><div id="barra_azul" style=" background:#06F; height:5px;"></div></div>
<div align="center" >

	<div align="center">
<?php include('../../_lib/cabecera2.php');?>
<table width="100%">
	<tr>
    	<td>
<table>	
    <tr align="center">
    	<td>Linea Sub</td>
    	<td><input type="text" class="txt_titulo" id="txt_lsub"    value=""  placeholder="lsub"   style="width:100%;"/></td>
    </tr>
    
    <tr>
    	<td>Codigo</td>
		<td><input type="text" class="txt_titulo" id="txt_codigo"  value="" placeholder="codigo"  style="width:100%;" /></td>
    </tr> 
    
    <tr>
    	<td>Descri</td>
		<td><input type="text" class="txt_titulo" id="txt_descri"  value="" placeholder="descri"  style="width:100%;" /></td>
    </tr>
</table>                
        </td>
        
        <td>
<table>
    <tr>
    	<td>Marca</td>    
        <td><input type="text" class="txt_titulo" id="txt_mrca"    value="" placeholder="mrca"    style="width:100%;" /></td>
    </tr>    
    <tr>
    	<td>Modelo</td>    
        <td><input type="text" class="txt_titulo" id="txt_mdlo"    value="" placeholder="mdlo"    style="width:100%;"/></td>
    </tr>    
    <tr>
    	<td>Codigov</td>          
        <td><input type="text" class="txt_titulo" id="txt_codigov" value="" placeholder="codigov" style="width:100%;" /></td>
    </tr>    
    <tr>
    	<td>Numpart</td>            
        <td><input type="text" class="txt_titulo" id="txt_numpart" value="" placeholder="numart" style="width:100%;" /></td>
    </tr>    



</table>                
        </td>

		<td>
<table>
    <tr>
    	<td>EAN13</td>            
        <td><input type="text" class="txt_titulo" id="txt_ean13"   value="" placeholder="ean13"   maxlength="13" size="13" style="width:100%;" /></td>
	</tr>
        <tr>
    	<td>PCP1</td>            
        <td><input type="text" class="txt_titulo" id="txt_pcp1"    value="" placeholder="pcp1"   maxlength="10" size="10" style="width:100%;" /></td>
	</tr>
        <tr>
    	<td>PVP1</td>            
        <td><input type="text" class="txt_titulo" id="txt_pvp1"    value="" placeholder="pvp1"    maxlength="10" size="10" style="width:100%;" /></td>
	</tr>
        <tr>
    	<td>DISP</td>            
        <td><input type="text" class="txt_titulo" id="txt_disp"    value="" placeholder="disp"    maxlength="10" size="10" style="width:100%;" /></td>
    </tr>    
   
</table>
        
        
        
        </td>
    	<td>
<table>	
	<tr><td><b>ETIQUETA</b></td></tr>
	<tr><td>Marca<input type="checkbox" id="chkmrca" checked="checked" /></td></tr>
	<tr><td>Talla<input type="checkbox" id="chktlla" checked="checked" /></td></tr>
	<tr><td>P.V.P<input type="checkbox" id="chkpvp1" checked="checked" /></td></tr>
    <tr>
    <td>Lote<input type="text" class="txt_titulo" id="txt_lote"  value="" placeholder="lote"  maxlength="10" size="10" style="width:100%;" /></td>
    </tr>    
</table>                
        </td>

	
	</tr>
</table>



<input type="button" value="Consultar" onclick="ordena_item();" />

	<div id="lista_contenedor"></div>


    
    
    
    
        
	</div>
</div>

</body>
</html>