<?php
function ver_doc1($docu_tipo,$docu_enti)
{
session_start();
require('lista_car.php');
	
require('../cfg/cfg.php');
require('../cfg/res.php');	
// include('../_cfg/config.php');
include('php_gene1.php');
include('php_session.php');
	
mysql_query("SET NAMES 'utf8'");

$usertipo=$_SESSION['user_vcrx_tipo'];

$empr_guia=r_fiel('empr',$cfg_empr,'guia');
  
$xacceso=0;
$sql_acce='select * from usrdoc1 where docu like "'.trim($docu_tipo).'%" and cons="1" and (user="'.$_SESSION['user_vcrx_id'].'" or codigo ="'.$_SESSION['user_vcrx_id'].'") ';
// $res_acce=mysql_query($sql_acce,$link_vcrx);

$docuacce=$docu_tipo;  
include('php_useracce.php');
  
// $sql_acce ='select * from acce12 ';
// $sql_acce.='where numero="'.$user_codigo.'"  ';
// $sql_acce.='and docum like "'.$docu_tipo.'%" ';
// $sql_acce.='order by docum ';
// $res_acce=mysql_query($sql_acce,$link_vcrx);

// $user_nuev=@mysql_result($res_acce,0,'nuev');
// $user_cons=@mysql_result($res_acce,0,'cons');
// $user_modi=@mysql_result($res_acce,0,'modi');
// $user_anul=@mysql_result($res_acce,0,'anul');
// $user_elim=@mysql_result($res_acce,0,'elim');
  
// if (mysql_num_rows($res_acce)!=0){$xacceso=1;}
$xacceso=$user_cons;
if (mb_stristr('sist.supe',$usertipo)){$xacceso=1;}
if (mb_stristr('clie',$usertipo) and mb_stristr('PC.FC',substr($docu_tipo,0,2))){$xacceso=1;}
if (mb_stristr('prov',$usertipo) and mb_stristr('FP.RP',substr($docu_tipo,0,2))){$xacceso=1;}
if ($xacceso==0){echo '<font size="8" color="red"><b>';die('No tiene acceso a consultar :'.$docu_tipo );}	

$xaccesom=0;
  
$sql_acce='select * from usrdoc1 where docu like "'.trim($docu_tipo).'%" and modi="1" and user="'.$_SESSION['user_vcrx_id'].'" ';
// $res_acce=mysql_query($sql_acce,$link_vcrx);
// if (mysql_num_rows($res_acce)!=0){$xaccesom=1;}
  
$xaccesom=$user_modi;	
if (mb_stristr('sist.',$usertipo)){$xaccesom=1;}
		
	
	
$xcelec="FC.NC.GR.RP";
$sql_docu='select *from docu0 where docu_codigo like "'.$docu_tipo.'%"';
//echo explain_sql($sql_docu);
$res_docu=mysql_query($sql_docu,$link_vcrx);

$descri_docu='';
$tabla='';
if (mysql_num_rows($res_docu)!=0)
{
$descri_docu=mysql_result($res_docu,0,'docu_descri');
$tabla=strtolower(mysql_result($res_docu,0,'docu_tabla'));
}



if (mb_stristr('CXCO.CXPA',$docu_tipo))
{
	$tabla=strtolower($docu_tipo);
}


if (mb_stristr('clie.prov',substr($usertipo,0,4)))
{
	if (substr($docu_tipo,0,1)=='O')
	{$tabla='clie';}
	
	if (substr($docu_tipo,0,1)=='F')
	{$tabla='vtas';}

	if (substr($docu_tipo,0,3)=='CXP')
	{$tabla='cxco';}
	
	if (substr($docu_tipo,0,3)=='CXC')
	{$tabla='cxpa';}
}

$sql_drtr='select * from user0 where user_codigo= "'.$_SESSION['user_vcrx_id'].'"';
$res_drtr=mysql_query($sql_drtr,$link_vcrx);
$user_ced1=mysql_result($res_drtr,0,'user_cedula');

$sql_drtr='select * from enti0 where left(user_codigo,10) like "'.substr($user_ced1,0,10).'%" order by enti_drtr desc';
$res_drtr=mysql_query($sql_drtr,$link_vcrx);
$drtr=@mysql_result($res_drtr,0,'enti_drtr');

  
// $sql_drtr='select *from drtr0 where left(enti_codigo,10) like "'.$user_ced1.'%"';
// $res_drtr=mysql_query($sql_drtr,$link_vcrx);
// $drtr=0;
// if (mb_stristr('gnya.leie',substr($_SESSION['user_vcrx_empr'],0,4)))
// {
// 	if (mysql_num_rows($res_drtr)!=0)
// 	{$drtr=1;}
// }

if (mb_stristr('admi.supe.sist',substr($usertipo,0,4)))
{
//$drtr=0;
}

if (mb_stristr('clie.prov',substr($usertipo,0,4)))
{$docu_enti='M';}
//echo $drtr;

?>
<script type="text/javascript">

<?php include('../../_js/busca_maes3.js');?>
<?php include('../../_js/lista_maes3.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 mpedido_d(indxd,tabla)
{
	for(i=0;i<=document.getElementsByClassName('pdc_t1').length-1;i++)
	{
		document.getElementsByClassName('pdc_t1').item(i).style.background='none';
		document.getElementsByName('btn_ped_c').item(i).disabled=true;
		document.getElementsByName('btn_ped_c').item(i).style.cursor='progress';
	}
	document.getElementById(indxd).style.background='#eee';
	document.getElementById('mpedido_d').innerHTML='<img src="../img/loader.gif" width="40" />';
	document.body.style.cursor='progress';
	$.ajax({
		url:'../lib/verdoc2.php',
		type:'POST',
		data:{indx:indxd,tabla:tabla},
		success: function(dato)
		{
			document.getElementById('mpedido_d').innerHTML='';
			document.getElementById('mpedido_d').innerHTML=dato;
			document.body.style.cursor='auto';
			for(i=0;i<=document.getElementsByClassName('pdc_t1').length-1;i++)
			{
				document.getElementsByName('btn_ped_c').item(i).disabled=false;
				document.getElementsByName('btn_ped_c').item(i).style.cursor='auto';
			}
		}			
	});
// 	eval(document.getElementById('mpedido_d').innerHTML);
}


function modideta(docu,idnum,c,d)
{
	
	for(i=0;i<=document.getElementsByClassName('pdc_t1').length-1;i++)
	{
		document.getElementsByClassName('pdc_t1').item(i).style.background='none';
		document.getElementsByName('btn_ped_c').item(i).disabled=true;
		document.getElementsByName('btn_ped_c').item(i).style.cursor='progress';
	}

	document.getElementById(idnum).style.background='#eee';
	//document.getElementById('modideta').innerHTML='<img src="../img/loader.gif" width="40" />';
	//document.body.style.cursor='progress';

	$.ajax({
		cache:false,
		url:'../lib/vrnewreg10.php',
		datatype: "text",
	    async:false,
		type:'POST',
		data:{docu:docu,idnumx:idnum},
    	beforeSend: function(jqXHR, textStatus)
		{
		}, 
		success:function(dato, textStatus, jqXHR)
		{
			//console.log(dato);
			//document.getElementById('mpedido_d').innerHTML='';
			document.getElementById('mpedido_d').innerHTML=dato;
			//document.body.style.cursor='auto';
			//for(i=0;i<=document.getElementsByClassName('pdc_t1').length-1;i++)
			//{
			//	document.getElementsByName('btn_ped_c').item(i).disabled=false;
			//	document.getElementsByName('btn_ped_c').item(i).style.cursor='auto';
			//}



		},
		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') {
               //console.log('Time out error.');
			   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:60000
	});
}


function status_ox(docu,id,idt,stox)
{
	if (stox=='O'){msgconfir='Desea Anular la Transaccion ?'}
	if (stox=='X'){msgconfir='Desea Eliminar la Transaccion ?'}
	
	if (confirm(msgconfir)) 
	{
		if(document.getElementById('e_pedido'))
		{document.getElementById('e_pedido').disabled=false;}

		if(document.getElementById('a_pedido'))
		{document.getElementById('a_pedido').disabled=false;}

		$.ajax({
			url:'../lib/vranula.php',
			type:'POST',
			data:{docu:docu,id:id,idt:idt,stox:stox},
			success: function(dato)
			{
				console.log(dato);
				window.location.reload();
				alert(dato);
			},
			error: function(objeto)
			{console.log(objeto);}
		});
	}
}


function copia_docu(docu,idnum)
{
// 	{msgconfir='Desea COPIAR '+docu+'-+' ?'}
	
// 	if (confirm(msgconfir)) 
	{
  aa=php_func('clon_docu('+docu+','+idnum+')');
  alert('OK');
  }  
}
  

function status_nuevo(docu,id,idt,stox)
{
	if (stox=='-')
	{msgconfir='Desea Reactivar STATUS ?'}
	
	if (confirm(msgconfir)) 
	{
		document.getElementById('e_pedido').disabled=false;
		$.ajax({
			url:'../lib/vrstatnew.php',
			type:'POST',
			data:{docu:docu,id:id,idt:idt,stox:stox},
			success: function(dato)
			{
				console.log(dato);
				window.location.reload();
				//alert('Pedido Eliminado');
			},
			error: function(objeto)
			{
				console.log(objeto);
			}
		});
		document.getElementById('e_pedido').disabled=true;
	}
}




function redireccionar() 
{
var fstat=document.getElementById('fstat').value;

var fdocu='';
if(document.getElementById('fdocu'))
{fdocu=document.getElementById('fdocu').value;}

var fzsub='';
if(document.getElementById('fzsub'))
{fzsub=document.getElementById('fzsub').value;}

var fptov='';
if(document.getElementById('fptov'))
{ fptov=document.getElementById('fptov').value;}

var fbode='';
if(document.getElementById('fbode'))
{fbode=document.getElementById('fbode').value;}

var fenti=document.getElementById('fenti').value;
var fdrtr=document.getElementById('fdrtr').value;
var fcontra=document.getElementById('fcontra').value;
var fecha_ini=document.getElementById('fecha_ini').value;
var fecha_fin=document.getElementById('fecha_fin').value;

var fvhcl=document.getElementById('fvhcl').value;
	
var fnum1=document.getElementById('fnum1').value;
var fnum2=document.getElementById('fnum2').value;
var total_min=document.getElementById('total_min').value;
var total_max=document.getElementById('total_max').value;

//pagina="?opt=<?php echo $_GET['opt']?>&tipo=<?php echo $_GET['tipo']?>" +"&fecha_ini="+fecha_ini+"&fecha_fin="+fecha_fin;

pagina="?opt=<?php echo $_GET['opt']?>" 
+"&tipo=<?php echo $_GET['tipo']?>" 
+"&enti=<?php echo $_GET['enti']?>" 
+"&fstat="+fstat
+"&fptov="+fptov 
+"&fdocu="+fdocu 
+"&fzsub="+fzsub 
+"&fenti="+fenti 
+"&fvhcl="+fvhcl
+"&fnum1="+fnum1
+"&fnum2="+fnum2
+"&fecha_ini="+fecha_ini 
+"&fecha_fin="+fecha_fin 
+"&total_min="+total_min 
+"&total_max="+total_max
+"&fcontra="+fcontra
+"&fbode="+fbode
+"&fdrtr="+fdrtr ;

//	if (confirm(pagina)) {};


location.href=pagina;
} 



function imprimirlista() 
{
var fstat=document.getElementById('fstat').value;
var fdocu='';
if(document.getElementById('fdocu'))
{fdocu=document.getElementById('fdocu').value;}
var fptov='';
if(document.getElementById('fptov'))
{fptov=document.getElementById('fptov').value;}
var fzsub='';
if(document.getElementById('fzsub'))
{fzsub=document.getElementById('fzsub').value;}
var fenti=document.getElementById('fenti').value;
var fvhcl=document.getElementById('fvhcl').value;
var fdrtr=document.getElementById('fdrtr').value;
var fcontra=document.getElementById('fcontra').value;
var fnum1=document.getElementById('fnum1').value;
var fnum2=document.getElementById('fnum2').value;
var fecha_ini=document.getElementById('fecha_ini').value;
var fecha_fin=document.getElementById('fecha_fin').value;
var total_min=document.getElementById('total_min').value;
var total_max=document.getElementById('total_max').value;


pagina="../lib/impr_list1.php?"
+"&docu=<?php echo $_GET['tipo']?>" 
+"&enti=<?php echo $_GET['enti']?>" 
+"&fstat="+fstat
+"&fzsub="+fzsub
+"&fdocu="+fdocu
+"&fptov="+fptov
+"&fenti="+fenti 
+"&fvhcl="+fvhcl
+"&fnum1="+fnum1 
+"&fnum2="+fnum2 
+"&fecha_ini="+fecha_ini 
+"&fecha_fin="+fecha_fin 
+"&total_min="+total_min 
+"&total_max="+total_max
+"&fcontra="+fcontra
+"&fdrtr="+fdrtr ;

window.open(pagina);
// window.print(pagina);
} 


//		url:'../lib/vrcexml1.php',
//		url:'../lib/vrcemail1.php',

function cemail(facdocu,facidnu,facid)
{
	$.ajax({
		cache:false,
		url:'../lib/vrcexml1.php',
		datatype: "text",
	    async:false,
		type:'POST',
		data:{facdocu:facdocu,facidnu:facidnu},
    	beforeSend: function(jqXHR, textStatus)
		{
			
		}, 
		
		success:function(dato, textStatus, jqXHR)
		{
		//console.log(dato);
// 		pagina="../lib/celectop1.php?"
		pagina="../print1.php?"
		+"&prnt=1"
		+"&docu=FC10" 
		+"&idnum="+dato 
		+"&formato=1";
		//window.open(pagina);

			dato=dato.trim();
			if(dato!='0')
			{
				//console.log(dato.trim());
				//alert('Ocurrio un error al Facturar');
				//return false;
			}
			
		},
		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') {
               //console.log('Time out error.');
			   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:60000
	});

	
	





}





function facturar(facdocu,facidnu,facid)
{
// 	console.log(facdocu);
// 	console.log(facidnu);
	$.ajax({
		cache:false,
		url:'../lib/fact_docu.php',
		datatype: "text",
	  async:false,
		type:'POST',
		data:{facdocu:facdocu,facidnu:facidnu},
    	beforeSend: function(jqXHR, textStatus)
		{	}, 
		success:function(dato, textStatus, jqXHR)
		{
      
      console.log(dato);
// 		pagina="../lib/celectop1.php?"
		pagina="../print1.php?"
		+"&prnt=1"
		+"&docu=FC10" 
		+"&idnum="+dato 
		+"&formato=1";
		window.open(pagina);

			dato=dato.trim();
			if(dato!='0')
			{
				//console.log(dato.trim());
				//alert('Ocurrio un error al Facturar');
				//return false;
			}
			
		},
		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') {
               //console.log('Time out error.');
			   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:60000
	});



}


function factdrtr(facdocu,facidnu,facid)
{
	$.ajax({
		cache:false,
		url:'../lib/fact_drtr.php',
		datatype: "text",
	    async:false,
		type:'POST',
		data:{facdocu:facdocu,facidnu:facidnu},
    	beforeSend: function(jqXHR, textStatus)
		{
			
		}, 
		
		success:function(dato, textStatus, jqXHR)
		{
		//console.log(dato);
// 		pagina="../lib/celectop1.php?"
		pagina="../print1.php?"
		+"&prnt=1"
		+"&docu=NV13" 
		+"&idnum="+dato 
		+"&formato=1";
		window.open(pagina);

			dato=dato.trim();
			if(dato!='0')
			{
				//console.log(dato.trim());
				//alert('Ocurrio un error al Facturar');
				//return false;
			}
			
		},
		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') {
               //console.log('Time out error.');
			   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:60000
	});

	
	





}





function cobrar(cobdocu,cobidnu,cobid)
{
	
	document.getElementById('status'+cobidnu).innerHTML='C';
	/*
	if(confirm('Realizar cobro en Efectivo?'))
	{
	$.ajax({
		cache:false,
		url:'../lib/cobro1.php',
		datatype: "text",
	    async:false,
		type:'POST',
		data:{cobdocu:cobdocu,cobidnu:cobidnu}, 
    	beforeSend: function(jqXHR, textStatus)
		{
	
		}, 
		
		success:function(dato, textStatus, jqXHR)
		{
			console.log(dato);
			document.getElementById('status'+cobidnu).innerHTML='C';
		},
		error:function(jqXHR,textStatus,errorThrown )
		{
           if (jqXHR.status === 0) {
              alert('Sin conexion: Verifique Red.');
           } 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') {
               //console.log('Time out error.');
			   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:30000
	});
	}*/

}
function confirmadk(docucor,idxconfir,idconfir,acticonfir)
{
	
	var accion='';
	if(acticonfir=='C')
	{
		
		document.getElementById('status'+idxconfir).innerHTML='A';
		accion='A'
//++++++

	$.ajax({
		cache:false,
		url:'../lib/vrdk2dc0.php',
		datatype: "text",
	    async:false,
		type:'POST',
		data:{idxnoti:idxconfir},
    	beforeSend: function(jqXHR, textStatus)
		{
			
		}, 
		
		success:function(dato, textStatus, jqXHR)
		{
			dato=dato.trim();
			if(dato!='0')
			{
				console.log(dato.trim());
				alert('Ocurrio un error al Registrar');
				return false;
			}
			
		},
		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') {
               //console.log('Time out error.');
			   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:60000
	});

//++++++		
		
		
		
	}
	
	if(acticonfir=='R')
	{
		
		document.getElementById('status'+idxconfir).innerHTML='R';
		accion='R'
	}
	
	document.getElementById('i_confirmadk'+idxconfir).style.display='none';
	document.getElementById('i_rechazadk'+idxconfir).style.display='none';
	$.ajax({
		cache:false,
		url:'../lib/dcnotifica4.php',
		datatype: "text",
	    async:false,
		type:'POST',
		data:{idxnoti:idxconfir,accion:accion},
    	beforeSend: function(jqXHR, textStatus)
		{
			
		}, 
		
		success:function(dato, textStatus, jqXHR)
		{
			dato=dato.trim();
			if(dato!='0')
			{
				console.log(dato.trim());
				alert('Ocurrio un error al Eliminar');
				return false;
			}
			
		},
		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') {
               //console.log('Time out error.');
			   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:60000
	});

//++++++ test

/*

*/
//++++++


	
	
}
	
function numbloq(e,e2)
{
	var xnumbloq=document.getElementById(e2).value.toUpperCase();
	var	xvnum='0123456789';
	var	xnum='';
	var xcar='';
		for (i=0; i<xnumbloq.length;i++)
			{
				xcar=xnumbloq.substring(i,i+1);	
				if (xvnum.indexOf(xcar)>=0){xnum+=xcar;}
			}
		 	document.getElementById(e2).value=xnum;
}

function valbloq(e,e2)
{
	var xnumbloq=document.getElementById(e2).value.toUpperCase();
	var	xvnum='0123456789.-';
	var	xnum='';
	var xcar='';
		for (i=0; i<xnumbloq.length;i++)
			{
				xcar=xnumbloq.substring(i,i+1);	
				if (xvnum.indexOf(xcar)>=0){xnum+=xcar;}
				if (xcar=='.'){xvnum=xvnum.replace('.','');}
				if (xcar=='-'){xvnum=xvnum.replace('-','');}
			}
		 	document.getElementById(e2).value=xnum;
}
	
	
<?php require('../../_js/deledeta.js');?>

</script>
<div align="center" style="padding:5px;">


<?php
$xfstat='';
$xfzsub='';
$xfdocu='';
$xfptov='';
$xfenti='';
$xfvhcl='';  
$xfdrtr='';
$xfbode='';
$xfcontra='';
$xfnum1=000000000;
$xfnum2=999999999;
//$xfecha1=jdtojulian(juliantojd(date('m'),date('d'),date('Y'))-30);

$fecha1 = date('Y-m-j');
$nuevafecha = strtotime ( '-1 month' , strtotime ( $fecha1 ) ) ;
$xfecha1 = date ( 'Y-m-j' , $nuevafecha );
$xfecha2 = date('Y-m-d');
$xtotal1=0;
$xtotal2=999999999.99;
// $xnumero1='0';
// $xnumero2='999999999';
$sql_ped ='update '.$tabla.'1 set status="-" ';
$sql_ped.='where (status="" or status is null)';
$sql_ped.=' and fecha>="'.$xfecha1.'"';
$sql_ped.=' and fecha<="'.$xfecha2.'"';
$res_ped=mysql_query($sql_ped,$link_vcrx);
  
//   echo $sql_ped;
//   echo mysql_error()

$sql_ped='select * from '.$tabla.'11 where docu like "'.$docu_tipo.'%"';

if (substr($docu_tipo,0,2)=='CX')
{$sql_ped='select *from '.$tabla.'11 where docu!=""';}


if(isset($_GET['fstat']) && !empty($_GET['fstat']))
{
	$sql_ped.=' and  (status like "'.$_GET['fstat'].'" ) ';
	$xfstat=$_GET['fstat'];
}


if(isset($_GET['fdocu']) && !empty($_GET['fdocu']))
{
	$sql_ped.=' and  (docu like "'.$_GET['fdocu'].'%" ) ';
	$xfdocu=$_GET['fdocu'];
}

if(isset($_GET['fzsub']) && !empty($_GET['fzsub']))
{
	$sql_ped.=' and  (zsub like "'.$_GET['fzsub'].'%" ) ';
	$xfzsub=$_GET['fzsub'];
}

if(isset($_GET['fptov']) && !empty($_GET['fptov']))
{
	$sql_ped.=' and  (ptov like "'.$_GET['fptov'].'" or ptov_descri like "%'.$_GET['fptov'].'%" or ptoe like "'.$_GET['fptov'].'%" ) ';
	$xfptov=$_GET['fptov'];
}


if(isset($_GET['fenti']) && !empty($_GET['fenti']))
{
	$sql_ped.=' and  (enti like "'.trim($_GET['fenti']).'%" or enti_descri like "%'.trim($_GET['fenti']).'%") ';
	$xfenti=$_GET['fenti'];
}

if(isset($_GET['fvhcl']) && !empty($_GET['fvhcl']))
{
  if(mb_stristr('rcsa.tgck',substr($_SESSION['user_vcrx_empr'],0,4)))
  {$sql_ped.=' and (idnum1 in(select idnum2 from '.$tabla.'2 where vhcl  like "'.trim($_GET['fvhcl']).'%"))';}
	$xfenti=$_GET['fvhcl'];
}



if(isset($_GET['fnum1']) && !empty($_GET['fnum1']) && isset($_GET['fnum2']) && !empty($_GET['fnum2']))
{
	$xfnum1=$_GET['fnum1'];
	$xfnum2=$_GET['fnum2'];
	if($xfnum2==0){$xfnum2=999999999;}
	$sql_ped.=' and  abs(numero)>="'.$xfnum1.'" and abs(numero)<="'.$xfnum2.'"';
}
else
{
	$sql_ped.=' and  numero BETWEEN "'.$xfnum1.'" and "'.$xfnum2.'"';
}


if(isset($_GET['fecha_ini']) && !empty($_GET['fecha_ini']) && isset($_GET['fecha_fin']) && !empty($_GET['fecha_fin']))
{
	$sql_ped.=' and  fecha BETWEEN "'.$_GET['fecha_ini'].'" and "'.$_GET['fecha_fin'].'"';
	$xfecha1=$_GET['fecha_ini'];
	$xfecha2=$_GET['fecha_fin'];
}
else
{
	$sql_ped.=' and  fecha BETWEEN "'.$xfecha1.'" and "'.$xfecha2.'"';
}

//if(isset($_GET['total_min']) && !empty($_GET['total_min']) && isset($_GET['total_max']) && !empty($_GET['total_max']))

if(isset($_GET['total_min'])  && isset($_GET['total_max']) && !empty($_GET['total_max']))
{
// 	$sql_ped.=' and  abs(total) BETWEEN '.$_GET['total_min'].' and '.$_GET['total_max'].' ';
	$xtotal1=$_GET['total_min'];
	$xtotal2=$_GET['total_max'];
	if(empty($xtotal1)){$xtotal1=0;}
	if(empty($xtotal2)){$xtotal2=999999999999;}
	if($xtotal1!=0)
	{$sql_ped.=' and abs(total) >='.$xtotal1.' and abs(total) <= '.$xtotal2.' ';}
	else
	{$sql_ped.=' and ((abs(total) >='.$xtotal1.' and abs(total) <= '.$xtotal2.') or total is null)';}
}
else
{
	$sql_ped.=' and  abs(total) BETWEEN '.$xtotal1.' and '.$xtotal2.' ';
}


if(isset($_GET['fcontra']) && !empty($_GET['fcontra']))
{
	$sql_ped.=' and  (contrato like "%'.$_GET['fcontra'].'%")';
	$xfcontra=$_GET['fcontra'];
}

if(isset($_GET['fdrtr']) && !empty($_GET['fdrtr']))
{
	$sql_ped.=' and  (drtr like "'.$_GET['fdrtr'].'%")';
	$xfdrtr=$_GET['fdrtr'];
}
if(isset($_GET['fbode']) && !empty($_GET['fbode']))
{
	$sql_ped.=' and  (bode like "'.$_GET['fbode'].'%")';
	$xfbode=$_GET['fbode'];
}
	
// echo $sql_ped;


//echo 'MIS PEDIDOS';
if ($docu_enti=='M')
{
	if ($drtr==0)
	{$sql_ped.=' and (left(enti,10) like "' .$_SESSION['user_vcrx_id'].'%")';}
	else
	{$sql_ped.=' and (left(enti,10) like "'.$_SESSION['user_vcrx_id'].'%" or left(drtr,10) like "'.$_SESSION['user_vcrx_id'].'%")';}
}


// $xorder=' order by fecha desc, idnum1 desc';
$xorder=' order by fecha desc, ptoe,numero desc';

if (mb_stristr('RC.RP',$docu_tipo))
{$xorder=' order by fecha desc, numero desc, enti, idnum1 desc';}

if(mb_stristr('caja.bcos.cjte',$tabla))
{$xorder=' order by fecha desc, caja, ctab, numero desc, enti, idnum1 desc';}

$sql_ped.=$xorder;
  
if($tabla=='retc')  
{upl_claves2('07',$xfecha1,$xfecha2);}
  
if (mb_stristr('FP',$docu_tipo))
{upl_claves2('01',$xfecha1,$xfecha2);}
  
if (mb_stristr('NP',$docu_tipo))
{upl_claves2('04',$xfecha1,$xfecha2);}
  
  
// echo $sql_ped;

// echo explain_sql($sql_ped);

?>
<!-- <script type="text/javascript" src="http://vcrxol.com/_js/js_gene1.js<?php echo $jsver?>"></script> -->
<link rel="stylesheet" type="text/css" href="http://vcrxol.com/_lib/vrgets.css">  

<div style=" max-height:100px; overflow-y:scroll; margin-top:5px;">
<table id="tabla_filtros" width="100%" border="0" cellspacing="0" cellpadding="2" style="border-collapse:collapse;font-size:12px; border:#000000 solid 1px;">
<tr align="left" valign="top">

<th>
<table><caption>FECHAS</caption>	
	<tr>
		<?php $pcaption='inicial';  $pidtxt='fecha_ini'; $pdefa=$xfecha1; $pobj=3; include('vrgetfec.php'); ?>
</tr>
	<tr>
		<?php $pcaption='final';  $pidtxt='fecha_fin'; $pdefa=$xfecha2; $pobj=3; include('vrgetfec.php'); ?>
</tr>
	</table>
	
</th>

<th style ="border-left:solid 1px;">
	<table><caption>NUMEROS</caption>	
	<tr>
		<?php $pcaption='Desde';  $pidtxt='fnum1'; $pdefa=$xfnum1; $pobj=3; include('vrgetnum.php'); ?>
</tr>
	<tr>
		<?php $pcaption='Hasta';  $pidtxt='fnum2'; $pdefa=$xfnum2; $pobj=3; include('vrgetnum.php'); ?>
</tr>
	</table>
</th>

	
	
<th style ="border-left:solid 1px;">
<table><caption>TOTALES</caption>	
	<tr>
		<?php $pcaption='Minimo';  $pidtxt='total_min'; $pdefa=$xtotal1;  include('vrgetval.php'); ?>
</tr>
	<tr>
		<?php $pcaption='Maximo';  $pidtxt='total_max'; $pdefa=$xtotal2;  include('vrgetval.php'); ?>
</tr>
	</table>
</th>


<th style ="border-left:solid 1px;">
<!-- FILTROS -->
</th>
<th>
<table><caption>FILTROS</caption>	
	<tr>
		<?php $pcaption='Documento';  $ptabla='docu'; $pidtxt='fdocu'; $pdefa=$xfdocu; $pnotob=1; include('vrgetcod.php'); ?>
	</tr>
	<?php if(mb_stristr('vtas',$tabla)){?>
	<tr>
		<?php $pcaption='Pto.Vta.';  $ptabla='ptov'; $pidtxt='fptov'; $pdefa=$xfptov; $pnotob=1; include('vrgetcod.php'); ?>
	</tr>
	<?php } ?>
</table>
</th>
<th>	
<table>

	<tr>
		<?php $pcaption='Entidad';  $ptabla='enti'; $pidtxt='fenti'; $pdefa=$xfenti; $pnotob=1; include('vrgetcod.php'); ?>
	</tr>
	
	<?php if(mb_stristr('vtas.clie',$tabla)){?>
	<tr>
		<?php $pcaption='Zona';  $ptabla='zsub'; $pidtxt='fzsub'; $pdefa=$xfzsub; $pnotob=1; include('vrgetcod.php'); ?>
	</tr>
	<?php } ?>

	<?php if(mb_stristr('caja',$tabla)){?>
	<tr>
		<?php $pcaption='CAJA';  $ptabla='caja'; $pidtxt='fcaja'; $pdefa=$xfcaja;  include('vrgetcod.php'); ?>
	</tr>
	<?php } ?>
	
	<?php if(mb_stristr('bcos',$tabla)){?>
	<tr>
		<?php $pcaption='Cta.Banc.';  $ptabla='ctab'; $pidtxt='fctab'; $pdefa=$xfctab;  include('vrgetcod.php'); ?>
	</tr>
	<?php } ?>
	
	<?php if(mb_stristr('comp.prov',$tabla)){?>
	<tr>
		<?php $pcaption='Tipo';  $ptabla='tpro'; $pidtxt='ftpro'; $pdefa=$xftpro; include('vrgetcod.php'); ?>
	</tr>
	<?php } ?>

	<?php if(mb_stristr('inve.prod',$tabla)){?>
	<tr>
		<?php $pcaption='Bodega';  $ptabla='bode'; $pidtxt='fbode'; $pdefa=$xfbode; include('vrgetcod.php'); ?>
	</tr>
	<?php } ?>


	</table>	
    <?php
    switch($tabla)
    {
   	case "inve":
    ?>  
	<?php
	break;

	case "vtas":
    ?>  
	<div align="right">
    <?php
	    break;

		case "clie":
    ?>  
	<div align="right">
    <?php
	    break;
    	case "comp":
    ?>  
	<div align="right">
    <?php
    	    break;
    	case "prov":
    ?>  
	<div align="right">
    <?php
    	    break;
    	case "nomi":
    ?>  
	<div align="right">
    <?php
	    break;

    	default;
    ?>  
	<div align="right">
<!-- 	    <span>Entidad</span>  -->

    <?php } ?>  
</div>
</th>



<th>
<?php $pcaption='Status';  $ptabla='stat'; $pidtxt='fstat'; $pdefa=$xfstat; $pnotob=1; include('vrgetcod.php'); ?>
</th>


<th style ="border-left:solid 1px;"> 
<table>
	<tr style="
			<?php if(mb_stristr('gnya.leie',substr($_SESSION['user_vcrx_empr'],0,4))
		  			&& mb_stristr('admi.supe.sist',substr($usertipo,0,4))
							){}else{echo 'display:none;';}?>">
						 
		<?php $pcaption='Director';  $ptabla='enti'; $pidtxt='fdrtr';  $pdefa=$xfdrtr; $pnotob=1; include('vrgetcod.php'); ?>
	</tr>

	<tr style="
			<?php if(mb_stristr('rcsa',substr($_SESSION['user_vcrx_empr'],0,4))
		  			&& mb_stristr('admi.supe.sist',substr($usertipo,0,4))
							){}else{echo 'display:none;';}?>">
						 
		<?php $pcaption='Siniestro';  $ptabla='sntr'; $pidtxt='fsntr'; $pdefa=$xfdrtr; include('vrgetcod.php'); ?>
	</tr>
	<tr style="
			<?php if(mb_stristr('rcsa.tgck',substr($_SESSION['user_vcrx_empr'],0,4))
		  			&& mb_stristr('admi.supe.sist',substr($usertipo,0,4))
							){}else{echo 'display:none;';}?>">
						 
		<?php $pcaption='Vehiculo';  $ptabla='vhcl'; $pidtxt='fvhcl'; $pdefa=$xfdrtr; include('vrgetcod.php'); ?>
	</tr>
	<tr style="
			<?php if(mb_stristr('demo',substr($_SESSION['user_vcrx_empr'],0,4))
		  			&& mb_stristr('admi.supe.sist',substr($usertipo,0,4))
							){}else{echo 'display:none;';}?>">
						 
		<?php $pcaption='Contenedor';  $ptabla='cntn'; $pidtxt='fcntn'; include('vrgetcod.php'); ?>
	</tr>
	<tr style="display:none;">
		<td>
		<?php if(mb_stristr('FP.RC',substr($docu_tipo,0,2))){?>
		<?php $pcaption='Subir XML'; $pidtxt='cexml';  $paccept=".XML"; $ponclick="_uplcexml('".$pidtxt."','','');" ;include('vrgetfil.php'); ?>
		<?php } ?>
		</td>
	</tr>
</table>
</th>
		
<?php
if (mb_stristr('gnya.leie',substr($_SESSION['user_vcrx_empr'],0,4)) && mb_stristr('admi.supe.sist',substr($usertipo,0,4)) )
{
?>
<th style ="border-left:solid 1px;">
<!-- 	<div align="right">
	<span>Director</span> <input type="text" id="fdrtr" placeholder="c.i." size="10" value="<?php echo $xfdrtr;?>" /> 
	</div> -->
	</th>
<?php
}
else
{
?>
	<th>
	<div>
<!-- 	<input type="hidden" id="fdrtr" value=""> -->
	</div>
	</th>
<?php
}
?>

<?php
if (mb_stristr('tcor.vrfa',substr($_SESSION['user_vcrx_empr'],0,4)) && mb_stristr('admi.supe.sist',substr($usertipo,0,4)) )
{
?>
<th style ="border-left:solid 1px;">
	<div align="right">
	<span>Contrato</span> <input type="text" id="fcontra" placeholder="123456789" size="10" value="<?php echo $xfcontra;?>" /> 
	</div>
	</th>
<?php
}
else
{
?>
	<th>
	<div>
	<input type="hidden" id="fcontra" value="">
	</div>
	</th>
<?php
}
?>

<th align="center" style ="border-left:solid 1px;">
<?php $pcaption='Consultar';  $ponclick="redireccionar();" ;include('vrbutton.php'); ?>
<!-- <div>
<input type="button" value="Consultar" onclick="redireccionar();"  />
</div> -->
<br>
<?php $pcaption='Imprimir';  $ponclick="imprimirlista();" ;include('vrbutton.php'); ?>

</th>

</tr>
</table>

<table id="tabla_filtrom" width="100%" border="0" cellspacing="0" cellpadding="2" style="border-collapse:collapse;font-size:12px; border:#000000 solid 1px;<?php if ($accesom==0){echo 'display:none;';}?>">
<tr>
<td>
<!-- 	MODIF	 -->
</td>	
</tr>
</table>		
</div>

<hr/>

<?php
$res_ped=mysql_query($sql_ped,$link_vcrx);
// echo explain_sql($sql_ped);
if(mysql_num_rows($res_ped)!=0)
{
$docu=mysql_result($res_ped,0,'docu');
$res_ped=mysql_query($sql_ped,$link_vcrx);
?> 

<div style=" max-height:300px; overflow-y:scroll; margin-top:5px;">

<table id="tabla_cab_ped" width="100%" border="0" cellspacing="0" cellpadding="2" style="border-collapse:collapse;font-size:12px; border:#000000 solid 1px;">
	
    <tr style="border-bottom:#000000 solid 2px; ">
    <th></th>
    <th></th>
    <th></th>
    <th></th>

    <?php
    switch($tabla)
    {
    	case "vtas":
    ?>  
	    <th>CLIENTE</th>
    <?php
	    break;
    	case "clie":
    ?>  
	    <th>CLIENTE</th>
    <?php
	    break;
    	case "comp":
    ?>  
	    <th>PROVEEDOR</th>
    <?php
    	    break;
    	case "prov":
    ?>  
	    <th>PROVEEDOR</th>
    <?php
    	    break;
    	case "nomi":
    ?>  
	    <th>EMPLEADO</th>
    <?php
    	    break;
    	case "cont":
    ?>  
	    <th>CONCEPTO</th>
	    <th>DOCU</th>
    <?php
	    break;
    	default;
    ?>  
	    <th>ENTIDAD</th>
    <?php
    	
    }
    ?>  
  
    <th>NUMERO</th>
    <th>FECHA</th>
    <?php
    if(mb_stristr('vtas.clie.carr.comp.prov.clte',$tabla))
    {
    ?>
    <th>CANT</th>
    <th>SUBT</th>
    <th>DSCTO</th>
    <th>
    	<?php if(mb_stristr('tcor',substr($_SESSION['user_vcrx_empr'],0,4))){echo '<span>ICE/</span><span>IVA</span>';}else{echo 'IVA';} ?>
    </th>
    
    <th>TOTAL</th>
    <?php } ?>

    <?php
    if(mb_stristr('comp',$tabla))
    {
    ?>
    <th><span title="SUSTENTO DEL COMPROBANTE">SC</span></th>
    <th><span title="FORMA DE PAGO">FP</span></th>
    <th><span title="AUTORIZACION">AUT</span></th>
    <?php } ?>

    <?php
    if(mb_stristr('caja.cjte',$tabla))
    {
    ?>
    <th>CAJA </th>
    <th>CANT</th>
    <?php } ?>


    <?php
    if(mb_stristr('.bcos.',$tabla))
    {
    ?>
    <th>BANCO</th>
    <th>CANT</th>
    <?php } ?>




    <?php
    if(mb_stristr('retc.retp',$tabla))
    {
    ?>
    <th>CAIR</th>
    <th>B.RTA</th>
    <th>%</th>
    <th>R.RTA</th>
    <th>B.IVA</th>
    <th>%</th>
    <th>R.IVA</th>
    <th>TOTAL</th>
    <?php } ?>



    <?php
    if(mb_stristr('inve.prod',$tabla))
    {
    ?>
    <th>BODEGA</th>
				<?php if (substr($docu_tipo,0,1)=='I'){	?>
				<th>DESDE</th>
				<?php }else{?>
				<th>PARA</th>
				<?php } ?>
    <th>CANT</th>
    <?php } ?>

    <?php
    if(mb_stristr('cxco.cxpa',$tabla))
    {
    ?>
    <th>VENCE</th>
    <th>VALOR</th>
    <th>ABONO</th>
    <th>SALDO</th>
    <?php } ?>

    <?php
    if(mb_stristr('cont',$tabla))
    {
    ?>
    <th>DEBITOS</th>
    <th>CREDITOS</th>
    <th>DIFEREN.</th>
    <?php } ?>
		


    <th>ST</th>

    <th>
    	<?php if(mb_stristr('gnya.leie',substr($_SESSION['user_vcrx_empr'],0,4))
    	&& mb_stristr('vtas.clie',$tabla)
    	&& ($drtr==1 || mb_stristr('admi.supe.sist',substr($usertipo,0,4))))
    	{echo 'Comi';} ?>

    	<?php if(mb_stristr('tcor',substr($_SESSION['user_vcrx_empr'],0,4))
    	&& mb_stristr('vtas.clie',$tabla))
    	{echo 'Contrato';} ?>

    </th>
    <th></th>
    <th></th>
    </tr>


	<?php
	$filax=1;
	while($r_ped=mysql_fetch_assoc($res_ped))
	{
	?>
	<tr class="pdc_t1" id="<?php echo $r_ped['idnum1']; ?>" align="center" style=" <?php if($filax==3){echo 'border-bottom:dotted 1px #000;';$filax=1;}else{$filax++;} ?>" >
		<td>
    <?php if (mb_stristr($xcelec,substr($r_ped['docu'],0,2))) { ?>


		<?php if (mb_stristr('admi.sist.clie.prov',substr($usertipo,0,4))) { ?>
		<?php if ($r_ped['claveacc']!="" and 1==2) { ?>
    <input type="image" id="id_xml1<?php echo $r_ped['idnum1'];?>" src="http://vcrxol.com/_img/ico_xml1.png" width="20" name="btn_ped_c" title="Descargar XML  <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>" onclick="downxml1('<?php echo $r_ped['docu']; ?>','<?php echo $r_ped['idnum1'];?>',this.id);"  />
    <?php } ?> 
		<?php } ?> 

		<?php } ?> 
		</td>

		<td>
		<?php if (mb_stristr('demo',substr($_SESSION['user_vcrx_empr'],0,4)))	{ ?>
<!-- 			<a href="../lib/celectop1xls.php?docu=<?php echo $r_ped['docu']; ?>&idnum=<?php echo $r_ped['idnum1']; ?>&formato=1" target="_blank"><img src="../img/xls.png" width="20"  title="Documento:<?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"  /></a> -->
		<?php } ?>


			
			
			
			
<!-- 		<a href="../lib/celectop1.php?docu=<?php echo $r_ped['docu']; ?>&idnum=<?php echo $r_ped['idnum1']; ?>&formato=1" target="_blank"><img src="../img/print2.png" width="20"  title="Documento:<?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"  /></a> -->

		<a href="../print1.php?prnt=1&docu=<?php echo $r_ped['docu']; ?>&idnum=<?php echo $r_ped['idnum1']; ?>&formato=1" target="_blank">
			<img src="../img/print2.png" width="20"  title="Documento:<?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"  /></a> 


		<?php	if (mb_stristr('sist.supe',substr($usertipo,0,4))){ ?>
		<?php	if(mb_stristr('vtas.comp.nomi.inve.caja.bcos.afij.retp.retc',$tabla)){ ?>
<!--     <a href="../lib/celectop1.php?docu=<?php echo $r_ped['docu']; ?>&idnum=<?php echo $r_ped['idnum1']; ?>&formato=3" target="_blank"><img src="../img/print2.png" width="20"  title="Diario:<?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"  /></a> -->
		<a href="../print1.php?prnt=1&docu=<?php echo $r_ped['docu']; ?>&idnum=<?php echo $r_ped['idnum1']; ?>&formato=3" target="_blank"><img src="../img/print2.png" width="20"  title="Diario:<?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"  /></a> 
		<?php } ?>
		<?php } ?>
		</td>

		<td>
    <input type="image" onclick="mpedido_d('<?php echo $r_ped['idnum1']; ?>','<?php echo $tabla;?>');" src="../img/hpedido.png" width="20" class="btn_ped_c" name="btn_ped_c" title="Ver Detalle  <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"/>
    </td>
		
			

<td>
    <?php
    if (mb_stristr($xcelec,substr($r_ped['docu'],0,2)))
    {if (mb_stristr('admi.sist',substr($usertipo,0,4)))
    {if ($r_ped['enti_email']!="")
    { ?>
<!--     <input type="image" id="id_cemail<?php echo $r_ped['idnum1'];?>" src="http://vcrxol.com/_img/ico_cemail.png" width="20" name="btn_ped_c" title="Enviar e-mail  <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>-<?php echo $r_ped['enti_email'];?>" onclick="if(confirm('Enviar e-mail a  <?php echo $enti_descri;?>-<?php echo $r_ped['enti_email'];?>'))cemail('<?php echo $r_ped['docu']; ?>','<?php echo $r_ped['idnum1'];?>',this.id);"  /> -->
    <?php }}}  ?> 


</td>

<?php
    $enti_descri=$r_ped['enti_descri'];
    $enti_razsoc=$r_ped['enti_razsoc'];
    if($enti_descri=='' and $enti_razsoc=='')    
    {
     get_ruc1($r_ped['enti']);
     get_ced1($r_ped['enti']); 
    }
?>    
    
    
	<?php
    if(mb_stristr('cont',$tabla))
	{
	?>
    <td align="left" style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;">
		<?php echo '<span title="'.$enti_descri.'">'.$r_ped['concepto'].'</span>';?>
    </td>
    <td align="center" style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;">
		<?php echo '<span title="'.$r_ped['docu_descri'].'">'.$r_ped['docu'].'</span>';?>
    </td>
	<?php } else { ?>
    <td align="left" style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;">
		<?php echo '<span title="'.$r_ped['enti'].'">'.$enti_descri.'</span>';?>
    </td>
	<?php } ?>
		
		
		
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" onclick="mpedido_d('<?php echo $r_ped['idnum1']; ?>','<?php echo $tabla;?>');">
		<?php 
// 		echo '<span title="'.$r_ped['docu_descri'].'-'.$r_ped['ptonumero'].' : '.$r_ped['idnum1'].'">'.$r_ped['numero'].'</span>';
    if(mb_stristr('cont',$tabla))
			{echo '<span title="'.$r_ped['docu_descri'].'-'.$r_ped['ptonumero'].' : '.$r_ped['idnum1'].'">'.$r_ped['numero'].'</span>';}
    if(mb_stristr('guia',$tabla))
			{echo '<span title="'.$r_ped['docu_descri'].'-'.$r_ped['ptonumero'].' : '.$r_ped['idnum1'].'">'.$r_ped['numero'].'</span>';}
    if(mb_stristr('vtas.clie.carr.comp.prov.clte',$tabla))
			{echo '<span title="'.$r_ped['docu_descri'].'-'.$r_ped['ptonumero'].' : '.$r_ped['idnum1'].'">'.$r_ped['ptonumero'].'</span>';}
    if(mb_stristr('inve.prod',$tabla))
			{echo '<span title="'.$r_ped['docu_descri'].'-'.$r_ped['ptonumero'].' : '.$r_ped['idnum1'].'">'.$r_ped['docu'].'-'.$r_ped['numero'].'</span>';}
    if(mb_stristr('caja.bcos.cjte',$tabla))
			{echo '<span title="'.$r_ped['docu_descri'].'-'.$r_ped['ptonumero'].' : '.$r_ped['idnum1'].'">'.$r_ped['docu'].'-'.$r_ped['numero'].'</span>';}
    if(mb_stristr('retp.retc',$tabla))
			{echo '<span title="'.$r_ped['docu_descri'].'-'.$r_ped['ptonumero'].' : '.$r_ped['idnum1'].'">'.$r_ped['docu'].'-'.$r_ped['numero'].'</span>';}
		?>
    </td>
    <td>
	<?php echo '<span title="Fecha Reg : '.date_format(date_create($r_ped['idate']),'d/M/y H:m').'">'.$r_ped['fechadmy'].'</span>';?>
    </td>



    <?php
    if(mb_stristr('vtas.clie.carr.comp.prov.clte',$tabla))
    {
    ?>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
    	<?php echo number_format($r_ped['tcant'],2);?>
    </td>
    <td align="right">
    	<?php echo number_format($r_ped['tsubt'],2).'';?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
	<?php echo '<span title="'.number_format($r_ped['pdcto'],2).'%">'.number_format($r_ped['tdcto'],2).'</span>';?>
    </td>
    <td align="right">
	<?php
	if($r_ped['tice']!=0){echo '<span title="'.number_format($r_ped['pice'],2).'%">'.number_format($r_ped['tice'],2).' /</span> '; } 
	else{}
	echo '<span title="'.number_format($r_ped['piva'],2).'%">'.number_format($r_ped['tiva'],2).'</span>';
	?>
    </td>
    <td style="border-left:#000000 solid 1px;" align="right">
    	<?php echo number_format($r_ped['total'],2);?>
    	
    </td>

    <?php
    }
    ?>

    <?php
    if(mb_stristr('comp',$tabla))
    {
      $atrz=$r_ped['atrz'].$r_ped['autornum'];
    ?>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="center">
      <span title="<?php echo  $r_ped['suco_descri'];?>">
    	<?php echo $r_ped['suco'];?>
      </span>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="center">
      <span title="<?php echo  $r_ped['fpag_descri'];?>">
    	<?php echo $r_ped['fpag'];?>
      </span>
    </td>
    <td align="center">
      <span title="<?php echo  $atrz;?>">
    	<?php 
      if ($r_ped['autornum']!="")
      {echo 'E';}
      else
      {if ($r_ped['atrz']!=""){echo 'P';}else{echo '_';}}
      ?>
      </span>
    </td>

    <?php
    }
    ?>


    <?php
    if(mb_stristr('caja.bcos.cjte',$tabla))
    {
    ?>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="center">
	<?php
	if($r_ped['caja']!=""){echo '<span title="'.$r_ped['caja'].'">'.$r_ped['caja_descri'].' </span> '; } 
	if($r_ped['ctab']!=""){echo '<span title="'.$r_ped['ctab'].'">'.$r_ped['ctab_descri'].' </span> '; } 
	?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
    	<?php echo number_format(abs($r_ped['tcant']),2);?>
    </td>
    <?php
    }
    ?>

    <?php
    if(mb_stristr('retc.retp',$tabla))
    {
    ?>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="center">
	<?php echo '<span title="'.$r_ped['cair_descri'].'">'.$r_ped['cair'].'</span>';?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
	<?php echo '<span title="'.$r_ped['brta'].'">'.number_format($r_ped['brta'],2).'</span>';?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="center">
	<?php echo '<i><span title="'.$r_ped['prta'].'">'.number_format($r_ped['prta'],2).'</span>';?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
	<?php echo '<span title="'.$r_ped['rrta'].'">'.number_format($r_ped['rrta'],2).'</span>';?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
	<?php echo '<span title="'.$r_ped['biva'].'">'.number_format($r_ped['biva'],2).'</span>';?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="center">
	<?php echo '<i><span title="'.$r_ped['piva'].'">'.number_format($r_ped['piva'],2).'</span>';?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
	<?php echo '<span title="'.$r_ped['riva'].'">'.number_format($r_ped['riva'],2).'</span>';?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
	<?php echo '<span title="'.abs($r_ped['total']).'">'.number_format(abs($r_ped['total']),2).'</span>';?>
    </td>
    <?php } ?>



    <?php
    if(mb_stristr('inve.prod',$tabla))
    {
    ?>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="center">
    	<?php echo $r_ped['bode'];?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="center">
    	<?php echo $r_ped['tobode'];?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
    	<?php echo number_format($r_ped['tcant'],2);?>
    </td>
    <?php } ?>

    <?php
    if(mb_stristr('cxco.cxpa',$tabla))
    {
    ?>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="center">
    <?php if($r_ped['saldo']>=1 && $r_ped['vence']<date('Y-m-d')) {echo '<font color="red">';} ?> <?php echo $r_ped['vencedmy'];?>
    </td>
    
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
    	<?php echo number_format($r_ped['total'],2);?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
    	<?php echo number_format($r_ped['abono'],2);?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
    	<?php echo number_format($r_ped['saldo'],2);?>
    </td>


    <?php } ?>

    <?php
    if(mb_stristr('cont',$tabla))
    {
    ?>
    
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
    	<?php echo number_format($r_ped['tdebito'],2);?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
    	<?php echo number_format($r_ped['tcredito'],2);?>
    </td>
    <td style="border-left:#000000 solid 1px; border-right:#000000 solid 1px;" align="right">
		<?php if($r_ped['diferencia']<0){echo '<font color="red">';} ?>
    	<?php echo number_format($r_ped['diferencia'],2);?>
    </td>

    <?php } ?>




    
    <td style="border-left:#000000 solid 1px;">
	<?php echo '<span id="status'.$r_ped['idnum1'].'" title="'.$r_ped['stat_descri'].'">'.$r_ped['status'].'</span>';?>
    	
    </td>

	<td style="border-left:#000000 solid 1px;" align="right">
   
	<?php
	if (mb_stristr('gnya.leie',substr($_SESSION['user_vcrx_empr'],0,4)) && mb_stristr('vtas.clie',$tabla) )
	{
	if (($drtr==1 && mb_stristr($r_ped['enti'].'-'.$r_ped['drtr'],$_SESSION['user_vcrx_id'])) ||  (mb_stristr('admi.sist',substr($usertipo,0,4))))
	{
	?>
	<?php echo '<span title="'.number_format($r_ped['comi'],2).'%">'.number_format($r_ped['tcomi'],2).'</span>';?>
	<?php }} ?>

	<?php
	if (mb_stristr('tcor',substr($_SESSION['user_vcrx_empr'],0,4)) && mb_stristr('vtas.clie',$tabla) )
	{
	?>
	<?php echo '<span>'.$r_ped['zsub'].'/'.$r_ped['contrato'].'</span>';?>
	<?php } ?>

	</td>

<?php
$xfec1 = date('Y-m-j');
//$xfec1 = strtotime ( '-10 day' , strtotime ( $xfec1 ) ) ;
$xfec1 = strtotime ( '-30 day' , strtotime ( $xfec1 ) ) ;
if (mb_stristr('clie',$tabla))
{}
//$xfec1 = date ( 'Y-m-j', $xfec1);
//$xfec2= date ( 'Y-m-j' , strtotime($r_ped['idate']) );

$xfec1= date ( 'Y-m-d', $xfec1);
$xfec2= date ( 'Y-m-d' , strtotime($r_ped['idate']) );
$xstat = $r_ped['status'];
 $xmodif = 0;
if ($xaccesom==1)
{
if ($xfec2>=$xfec1 && $xstat=="-"){$xmodif=1;}
if (mb_stristr('caja.bcos.cxjte',$tabla)){$xmodif=1;}
}
if (mb_stristr('vtas',$tabla)){$xmodif=0;}
if(mb_stristr('DK',substr($r_ped['docu'],0,2))){$xmodif=0;}

?>
    
    <td align="center" style="border-left:#000000 solid 1px;">
  <?php if(!mb_stristr('OoXx',$r_ped['status'])	 and mb_stristr('admi.supe.sist',substr($usertipo,0,4)) ){	?>
			
				<?php //if(!mb_stristr('RF',$r_ped['status']) && mb_stristr('clie',$tabla) && mb_stristr('OP1',substr($r_ped['docu'],0,3)))	{	
					if(!mb_stristr('RF',$r_ped['status']) && mb_stristr('clie.inve.carr',$tabla) && mb_stristr('.PF1.PC1.EB1.LCL.',substr($r_ped['docu'],0,3)))	{
				?>
	       	<input type="image" id="id_factura<?php echo $r_ped['idnum1'];?>" src="http://vcrxol.com/_img/ico_factura.png" width="25" 
                 title="Facturar <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"     onclick="if(confirm('Desea Facturar ?<?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>'))facturar('<?php echo $r_ped['docu'];?>','<?php echo $r_ped['idnum1'];?>',this.id,'F');"  />
        <?php } ?>

	    	<?php	if(mb_stristr('FC',substr($r_ped['docu'],0,2)) && mb_stristr('vtas',$tabla) )	{		?>
		    <?php	if (mb_stristr('gnya',substr($_SESSION['user_vcrx_empr'],0,4)) )	{	?>
				<?php if(!mb_stristr('FCROX',$r_ped['status']))	{	?>
		    <?php if($r_ped['drtr']!="")	{	?>
				   	<input type="image" id="id_factdrtr<?php echo $r_ped['idnum1'];?>" src="http://vcrxol.com/_img/ico_cxcdir.png" width="25" title="Facturar a Director <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"     onclick="if(confirm('Cobrar a Director ? <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>'))factdrtr('<?php echo $r_ped['docu'];?>','<?php echo $r_ped['idnum1'];?>',this.id,'F');"  />
		  	<?php } ?>
				<?php } ?>
				<?php } ?>
       	<?php } ?>

	    	<?php if(mb_stristr('DK',substr($r_ped['docu'],0,2)) && mb_stristr('cjte',$tabla)){		?>
	    	<?php if(!mb_stristr('ANROX',$r_ped['status']))	{	?>
	       	<input type="image" id="i_confirmadk<?php echo $r_ped['idnum1'];?>" src="http://vcrxol.com/_img/ico_aprobar.png" width="25" title="Confirmar <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"     onclick="if(confirm('Desea Confirmar ? <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>'))confirmadk('<?php echo $docu;?>','<?php echo $r_ped['idnum1'];?>',this.id,'C');"  />
	       	<input type="image" id="i_rechazadk<?php echo $r_ped['idnum1'];?>" src="http://vcrxol.com/_img/ico_rechazar.png" width="25" title="Rechazar<?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"     onclick="if(confirm('Desea Rechazar ? <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>'))confirmadk('<?php echo $docu;?>','<?php echo $r_ped['idnum1'];?>',this.id,'R');"  />
				<?php } ?>
				<?php } ?>



	    	<?php if(mb_stristr('FC.NV',substr($r_ped['docu'],0,2)) && mb_stristr('vtas.cxco',$tabla)){	?>
                <a target="_blank" href="../lib/vrcobro0.php?docu=<?php echo $r_ped['docu'];?>&idnum=<?php echo $r_ped['idnum1'];?>&numero=0" title="Cobrar <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>">
                <img src="http://vcrxol.com/_img/ico_cash.png" /></a>
				<?php } ?>

	    	<?php if(mb_stristr('FP.AP',substr($r_ped['docu'],0,2)) && mb_stristr('comp.cxpa',$tabla)){	?>
                <a target="_blank" href="../lib/vrpago0.php?docu=<?php echo $r_ped['docu'];?>&idnum=<?php echo $r_ped['idnum1'];?>&numero=0" title="Pagar <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>">
                <img src="http://vcrxol.com/_img/ico_pagar.png" /></a>
				<?php } ?>

			
			
	   		<?php if ($xmodif==1)	{?>
	       	<input type="image" id="modideta" src="http://vcrxol.com/_img/ico_modify.png" width="25" title="Modificar Det.<?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"  onclick="modideta('<?php echo $docu;?>','<?php echo $r_ped['idnum1'];?>','','O');"  />
	       <?php } ?>
	
     <?php } ?>
    </td>    

    <td>
	    	<?php if(mb_stristr('FC.NV.EB',substr($r_ped['docu'],0,2)) && mb_stristr('vtas.inve',$tabla) and $empr_guia==1){	?>
				<?php
							$pcaption='GUIA PARA: '.$r_ped['docu'].'-'.$r_ped['numero']; 
							$pabrev='G';
							$ponclick='{if(confirm("VER GUIA PARA :'.$r_ped['docu'].'-'.$r_ped['numero'].' ")){window.open("../lib/vrguia0.php?docu='.$r_ped['docu'].'&idnum='.$r_ped['idnum1'].'&numero=0","_blank")}}';
 							include('vrbutton.php');
				?>
				<?php } ?>
    </td>
    
    
    <td align="center" style="border-left:#000000 solid 1px;">
    	<?php if (!mb_stristr('CXCO.CXPA',$docu_tipo)) {	?>
    	<?php if(!mb_stristr('CFROX',$r_ped['status']))	{	?>
	    <?php if(!(mb_stristr('DK',substr($r_ped['docu'],0,2)) && mb_stristr('A',$r_ped['status'])))	{	?>
	       	<input type="image" id="a_pedido" src="http://vcrxol.com/_img/ico_anula.png" width="25" title="Anular <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"  onclick="status_ox('<?php echo $docu;?>','<?php echo $r_ped['idnum1'];?>','','O');"  />
      <?php } ?>
      <?php } ?>
					<?php if(mb_stristr('Oo',$r_ped['status']))	{ ?>
							<input type="image" id="e_pedido" src="http://vcrxol.com/_img/ico_elimina.png" width="25" title="Eliminar <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"  onclick="status_ox('<?php echo $docu;?>','<?php echo $r_ped['idnum1'];?>','','X');"  />
					<?php } ?>
			<?php } ?>

			<?php if(mb_stristr('RF',$r_ped['status']) && mb_stristr('clie',$tabla) && mb_stristr('PC1',substr($r_ped['docu'],0,3) ))	{	?>

			<?php		
			$xfec1r = date('Y-m-j');
			$xfec1r = strtotime ( '-3 day' , strtotime ( $xfec1r ) ) ;
			$xfec1r = date ( 'Y-m-j', $xfec1r);
			?>

		<?php if ($xfec2>=$xfec1r)	{	?>
       	<input type="image" id="n_pedido<?php echo $r_ped['idnum1'];?>" src="http://vcrxol.com/_img/ico_statusnew.png" width="25"
               title="Reactivar <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>"  onclick="status_nuevo('<?php echo $docu;?>','<?php echo $r_ped['idnum1'];?>','','-');"  />
		<?php } ?>
        	
    <?php } ?>
					<?php if(mb_stristr('cont',$tabla))	{ ?>
							<input type="image" id="c_pedido" src="http://vcrxol.com/_img/ico_copiar.png" width="25" 
                     title="Copiar <?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>" 
                     onclick="if(confirm('Desea Copiar ?<?php echo $r_ped['docu'];?>-<?php echo $r_ped['numero'];?>'))copia_docu('<?php echo $docu;?>','<?php echo $r_ped['idnum1'];?>');"  />
       	<?php } ?>
      
    </td>    

    <td>
		<?php	//if (mb_stristr('FC.OP.PF.GR.NC.RP.RO',substr($r_ped['docu'],0,2))) ?>
      
    <?php
      if(mb_stristr('vtas.clie.retp.guia.role.prov',$tabla))
      {
      $pidtxt='btnmail'.$r_ped['idnum1']; $pcaption='@:'.$r_ped['emailfec']; $psize=10;
      $ptitle='Enviar Mail '.$r_ped['docu'].'-'.$r_ped['ptonumero'];
      //$ponclick="{if(confirm('Enviar Mail ".$r_ped['docu'].'-'.$r_ped['ptonumero']."?')){php_func('mail_ce(".$r_ped['claveacc'].")');}}";
      $ponclick="{if(confirm('Enviar Mail ".$r_ped['docu'].'-'.$r_ped['ptonumero']."?')){php_func('mail_docu(".$r_ped['docu'].",".$r_ped['idnum1'].")');}}";
      include('vrbutton.php');
      }
    ?>
	  </td>

    <td>
    <?php
      if(mb_stristr('.PF1.',substr($r_ped['docu'],0,3)) )
      {
        if($empr_codigo=='ecgl' or $_SESSION['user_vcrx_empr']=='ecgl')
        {
          if(!mb_stristr('ROXF',$r_ped['status']))
          {
            $pidtxt='f_orden'.$r_ped['idnum1'];  $pcaption='O/P'; $psize=$xfontsize; $psize=10;
            $ptitle='Generar O/P '.$r_ped['docu'].'-'.$r_ped['ptonumero'];
//             $ponclick="if(confirm('Generar Orden ?')){php_func('ecgl_clie2prod(".$r_ped['idnum1'].")');window.location.reload()};";
            $ponclick="if(confirm('Generar Orden ?')){php_func('ecgl_clie2prod(".$r_ped['idnum1'].")');};";
            include('vrbutton.php'); 
          }else{
            $sql_prod='select * from prod1 where idfrom="'.$r_ped['idnum1'].'" and mdfrom="clie"';
            $res_prod=mysql_query($sql_prod,$link_vcrx);
            if(mysql_num_rows($res_prod)!=0)
            {
              $pidtxt='f_orden'.$r_ped['idnum1'];  $pcaption='O/P:'.mysql_result($res_prod,0,'numero'); $psize=$xfontsize; $psize=10;
              $ptitle=''.mysql_result($res_prod,0,'docu').'-'.mysql_result($res_prod,0,'numero');
              
              $ponclick='{window.open("../print1.php?&prnt=1&docu='.mysql_result($res_prod,0,'docu').'&idnum='.mysql_result($res_prod,0,'idnum1').'&formato=1")}';
              include('vrbutton.php'); 
            }
          }
        }
      }
    ?>
    </td>
   

    
    
    
    
<!-- 	<td> -->
	<?php //$pidtxt='puni_'.$idcont; $plong=10; $pobj=1; include('vrgetval.php');?>
<!-- 	</td> -->

    
    
    </tr>

	<?php } ?>
</table>
</div>
<?php	
}
else
{
echo '<h2>NO EXISTEN TRANSACCIONES</h2>';
}
?>

<?php	
?>


<div id="mpedido_d" style="padding-top:10px; "></div>
</div>

	
<?php  } ?>