<?php
if(!isset($_SESSION)) session_start();
include('clases/clase.conexion.php');
include('funciones/variables.php');
include('funciones/funciones.php');
$var = VarServer("MYSQLI");
$obj = new clsConexion($var[0],$var[1],$var[2],$var[3],$var[4]);
?>
<HTML>
<HEAD>
<TITLE>LISTADO DE REPARTIDORES</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
td {
	font-family:Tahoma;
	font-size:11px;
	color:#727272;
}
a {
	text-decoration: underline;
	color:#727272;
}
a.1 {
	text-decoration: none;
	color: 000000;
}
.t11 {
	font-family: Tahoma;
	font-size: 11px;
	font-style: normal;
}
body  {margin:0px;padding:0px}
.style3 {font-size: 9px}
-->
</style>
<link rel="stylesheet" type="text/css" href="css/ajax_registro.css">
<link rel="stylesheet" type="text/css" href="forms/paginate1.css">
<link rel="stylesheet" type="text/css" href="css/paginate.css" />
<script language='javascript'>
function seleccionar(varCod, varNom, varDni, varCos, rcod, rnom, rdni, rcos) {
	var vcod1 = opener.document.getElementById(rcod);
	var vnom1 = opener.document.getElementById(rnom); 
	var vdni1 = opener.document.getElementById(rdni);
	var vcos1 = opener.document.getElementById(rcos);
	var existe="NO";
	var form = opener.document.getElementById('form');
	for (i=0;i<form.elements.length;i++) {
		var Campo = form.elements[i].name;		
		if(Campo.indexOf(rcod)==0 && form.elements[i].value==varCod) {
			existe="SI";	
			}		
		}
	if (existe=="SI") {
		alert("EL ARTICULO : " + varCod + "\n" + varNom + "\nYA ESTA AGREGADO, SELECCIONE OTRO POR FAVOR");
		}
	else {
		vcod1.value = varCod;
		vnom1.value = varNom; 
		vdni1.value = varDni;
		vcos1.value = varCos;
		window.close();
		}
  	}
</script>
<script type="text/javascript" src="js/tablesort.js"></script>
<script type="text/javascript" src="js/paginate.js"></script>
<script type="text/javascript" src="js/popcalendar.js"> </script>
<script type="text/javascript" src="js/funciones.js"></script>
<script type="text/javascript" src="js/wz_tooltip.js"></script>
<script type="text/javascript" src="js/tip_balloon.js"></script>
<!--[if IE]>
<style type="text/css">
ul.fdtablePaginater {display:inline-block;}
ul.fdtablePaginater {display:inline;}
ul.fdtablePaginater li {float:left;}
ul.fdtablePaginater {text-align:center;}
table { border-bottom:1px solid #C1DAD7; }
</style>
<![endif]-->
<script type="text/javascript" src="stmenu.js"></script>
<meta http-equiv="msthemecompatible" content="no" />
<link href="images/logo_siscomges_32x32.png" rel="shortcut icon" type="image/x-icon" />
<meta http-equiv="msthemecompatible" content="no" />
<link href="images/logo_siscomges_32x32.png" rel="shortcut icon" type="image/x-icon" />
</HEAD>
<meta http-equiv="msthemecompatible" content="no" />
<link href="images/logo_siscomges_32x32.png" rel="shortcut icon" type="image/x-icon" />
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<table cellpadding="0" cellspacing="0" border="0" style="height:100%; width:100% ">
                            <!--DWLayoutTable-->
                            <tr>
                              
<td width="750" align="center" valign="top">
<?php 
	$varTabla=array("id"=>"tabla", "name"=>"table", "tamano"=>"450", "clase"=>"FormTitulo", "titulo"=>"BUSQUEDA DE REPARTIDORES",
					"formu"=>array("id"=>"form1", "name"=>"form1", "metodo"=>"POST"),						
					"ocult"=>array(array("tipo"=>"oculto", "id"=>"ccod", "name"=>"ccod", "valor"=>$_GET["ccod"]),
								   array("tipo"=>"oculto", "id"=>"cnom", "name"=>"cnom", "valor"=>$_GET["ccod"])
								  ),
					"conte"=>array(array("titulo"=>"Codigo :", "clase1"=>"FormCampo1", "clase2"=>"interior", "tamano"=>"100",
										 "campo" =>array("tipo"=>"texto", "id"=>"cod", "name"=>"cod", "valor"=>$_POST["cod"], 
										 "alinear"=>"center", "ancho"=>"70")),								   
								   array("titulo"=>"Nombre :", "clase1"=>"FormCampo1", "clase2"=>"interior", 
										 "campo" =>array("tipo"=>"texto", "id"=>"nam", "name"=>"nam", "valor"=>$_POST["nam"], "ancho"=>"306")),
								   array("titulo"=>"Brevete :", "clase1"=>"FormCampo1", "clase2"=>"interior", 
										 "campo" =>array("tipo"=>"texto", "id"=>"dni", "name"=>"dni", "valor"=>$_POST["dni"], "ancho"=>"100"))
								   ),
				  	"boton"=>array(array("tipo"=>"submit", "id"=>"bcon", "name"=>"bcon", "ancho"=>"100", "texto"=>"Buscar ", "clase"=>"boton_buscar")
								   )
					);
	echo $obj->setTablaForm($varTabla);
	
	$sql = "call spQuery_Lista_Repartidor('$_POST[cod]', '$_POST[nam]', '$_POST[dni]');";
	
	$varTabla=array("id"=>"theTable", "name"=>"theTable", "tamano"=>"98%", "sql_cab"=>$sql,	"pages"=>20,
						"conte"=>array(array("titulo"=>"CREP",      "ancho"=>"40" , "alinear"=>"center", "clase"=>"sortable-numeric", "tipo"=>"texto"), 
									   array("titulo"=>"REPARTIDOR", "ancho"=>"350", "clase"  =>"sortable"),
									   array("titulo"=>"DNI",   "ancho"=>"50", "clase"  =>"sortable", "alinear"=>"center"),
									   array("titulo"=>"COSTO",     "ancho"=>"50",  "alinear"=>"right", "clase"=>"sortable-numeric")
									   ),
						"boton"=>array(array("tipo"=>"img", "id"=>"bbus", "name"=>"bbus", "img"=>"images/b_table_add.png", 
											 "toltip"=>array(array("valor"=>"HAGA CLICK PARA <b>SELECCIONAR</b> EL REGISTRO<br><b>"),
																 array("valor"=>0, "tipo"=>"INDEX"),
																 array("valor"=>" - "),
																 array("valor"=>1, "tipo"=>"INDEX"),
																 array("valor"=>"</b>")
												   				),
											 "click"=>array("funcion"=>"seleccionar",
															"param"=>array(array("valor"=>0, "tipo"=>"INDEX"),
																		   array("valor"=>1, "tipo"=>"INDEX"),
																		   array("valor"=>2, "tipo"=>"INDEX"),														   
																		   array("valor"=>3, "tipo"=>"INDEX"),
																		   array("valor"=>$_GET[rcod], "tipo"=>"TEXTO"),
																		   array("valor"=>$_GET[rnom], "tipo"=>"TEXTO"),
																		   array("valor"=>$_GET[rdni], "tipo"=>"TEXTO"),
																		   array("valor"=>$_GET[rcos], "tipo"=>"TEXTO")
																		  )
															)
											 
											)
									)
						);
		echo $obj->SetGridTabla($varTabla);
?>
</td>
	</tr>
  </table>


<!--  PopCalendar(tag name and id must match) Tags should not be enclosed in tags other than the html body tag. -->
<iframe width=174 height=189 name="gToday:normal:agenda.js" id="gToday:normal:agenda.js" src="HelloWorld/ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; top:-500px; left:-500px;"> </iframe>
</body>
</html>
<frameset rows="100,*" border=0 frameborder="0">
<frameset rows="100,*" border=0 frameborder="0">