<?php
/*
Autor: Lic. Carlos Alberto Vaca Coronado
Version: 3.2.0
*/

session_name('portal_absa');session_start();if(!isset($_SESSION['usuario_p_prov_absa']) || trim($_SESSION['usuario_p_prov_absa']) == "" || trim(strtoupper($_SESSION["URL_PORTAL"]."admin.php")) != trim(strtoupper($_SERVER['HTTP_REFERER']))){?><script>window.location.href="<?=$_SESSION["URL_PORTAL"]."index.php"?>"</script><?exit;}
	
if(strtoupper(trim($_SESSION['usuario_p_prov_absa'])) != "ADMIN"){
	$q="select distinct c.rfc_cliente as rfc_cliente,nombre_cliente from clienteweb c, usuariosweb u, proveedores p where (c.rfc_cliente=p.rfc and rfc_receptor='".$_SESSION['RFC_RECEPTOR_PORTAL']."') and  c.rfc_cliente=u.rfc_cliente  and u.esProv='SI'";
}else{
	$q="select distinct c.rfc_cliente as rfc_cliente,nombre_cliente from clienteweb c, usuariosweb u where c.rfc_cliente=u.rfc_cliente  and u.esProv='SI'";
}
$_SESSION['grid_select']='grid_cliente';

?>

<script>
var query="<?=$q?>";
$j_6(document).ready(function(){
	$j_6().gridJQGrid({
	php: 'grids/provGrid.php',
	headerNames: ',rfc_cliente,nombre_cliente',
	sortname: 'rfc_cliente,nombre_cliente',
	idGrid: 'grid_cliente',
	idPagina: 'pagina_cliente',
	optionsCol: 'img1|width: 45, search: false, sortable:false, frozen: true;'+
				'rfc_cliente|width: 100, frozen: true;'+
				'nombre_cliente|width: 590',
	hiddenCol: '',
	ignoreColNamesExcel: '0',
	sheetName: 'Proveedores / Receptores',
	urlDatos: 'grids/provDatosGrid.php',
	div: 'cuerpo',
	width: $j_6('#cuerpo').width(),
    height: 'auto',
	rowNum: 20,
	query: query,
	optionsForm: 	'rfc_cliente|true||type="hidden";;'+
					'nombre_cliente||Raz�n Social *|class=":required" onBlur="toUpper(this);valField(\\\'grids/validaAJAX.php\\\',\\\'duplicado\\\',\\\'clienteweb\\\',this,\\\'[WHERE-FORM]\\\',\\\'dif\\\'); return false;"',
	captionForm: 'Datos de Proveedor',
	tabla: 'clienteweb',
	reloadGridAfterSave: 'grids/prov.php',
	captionConfirm: '',
	widthConfirm: 300,
	heightConfirm: 100,
	widthForm: 800,
	heightForm: 500,
	fileForm: 'configUsuarios.php',
	edit: true,
	add: true,
	del: false,
	formName: 'form_prov'
	});
});
</script>