require('distribuidores/Campos.inc'); require('distribuidores/Conectar.inc'); ?> //----------------------------- // FUNCIONES DEL PROGRAMA //----------------------------- function ProvinciadelaZona($Zona) { $sql = "Select provincia_ID, zona_ID, zona_nombre from zonas where zona_ID = '".$Zona."'"; $rsZona = mysql_query($sql); $reg=mysql_fetch_array($rsZona); return $reg['provincia_ID']; } function EnArreglo($arreglo,$id) { $result = false; while (list($key, $value) = each ($arreglo) ) { //echo $id."-"."\n"; if ($id == $value) { $result = true; } } return $result; } function OpcionesQuery() { Global $Provincia; Global $Zona; $rsProv = mysql_query("Select provincia_ID, provincia_nombre from provincias order by provincia_nombre"); if (isset($Provincia)) $where = "where provincia_ID = ".$Provincia; $sql = "Select provincia_ID, zona_ID, zona_nombre from zonas ".$where." order by zona_nombre "; // echo $sql; //exit; $rsZona = mysql_query($sql); CampoComboRsGenera("Provincia","Provincia",$rsProv,$Provincia,'provincia_ID','provincia_nombre',0,0,1,"'return submitForms()'"); CampoComboRsGenera("Zona","Zona",$rsZona,$Zona,'zona_ID','zona_nombre',0,0,1); QueryGenera(); } function Paginar() { Global $offset; Global $orden; Global $limit; Global $numrows; print "
"; //echo "off->" .$offset ." lim-> ".$limit; if ($offset>1) { // bypass PREV link if offset is 0 $prevoffset=$offset-$limit; print "<< \n"; } // calculate number of pages needing links $pages=intval($numrows/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) { // has remainder so add one page $pages++; } for ($i=1;$i<=$pages;$i++) { // loop thru $newoffset=$limit*($i-1); print "$i | \n"; } // check to see if last page if (!(($offset/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $newoffset=$offset+$limit; print ">>\n"; } print "
"; } function MuestraRegistro($reg,$el_i) { global $select; if (($el_i % 2 ) == '0') $colorfila = "#eeeeee"; else $colorfila = "#ffffff"; FilaInicio($colorfila); DatoEnlaceGenera($reg["distr_nombre"],"ContactoActualiza.php3?distr_ID=".$reg["distr_ID"]); DatoGenera($reg["distr_tel"]); DatoGenera($reg["distr_cel"]); DatoEnlaceGenera($reg["distr_email"], "mailto:".$reg["distr_email"]); FilaFinal(); } //------------------ // CUERPO PRINCIPAL //------------------ if (isset($borrar) ) while (list($key, $value) = each ($HTTP_POST_VARS["aSeleccion"]) ) Borrarlead($value); if (isset($mover) ) while (list($key, $value) = each ($HTTP_POST_VARS["aSeleccion"]) ) Moverlead($value); if (!isset($orden) ) $orden = "distr_nombre"; $where = " distr_ID > '0' "; $sql = "select distribuidores.* , distr_zonas.* from distribuidores,distr_zonas where distribuidores.distr_ID = distr_zonas.distr_ID and distr_zonas.zona_ID = '".$Zona."'"; //-- Preparo informacion - recorset segun condiciones recibidas -- $rs = mysql_query($sql); $limit = 100; $numresults=mysql_query($sql); $numrows=mysql_num_rows($numresults); // next determine if offset has been passed to script, if not use 0 if (empty($offset)) { $offset=0; } $sql .= " order by ".$orden ." limit $offset,$limit "; $rs = mysql_query($sql); $titulo = "Dónde consultar para adquirir nuestros productos ?"; include('distribuidores/inicio.inc'); //echo "$titulo
"; FormInicio($PHP_SELF,"query","post"); TablaInicio('','','Query'); OpcionesQuery(); TablaFinal(); FormFinal(); echo "| ".$reg['distr_nombre']." Representante Zonal | ";
echo "
|---|
";
// echo "".$reg['distr_nombre']."Representante Zonal"; echo "Tel.: ".$reg["distr_tel"]." "; echo "Cel.: ".$reg["distr_cel"]." "; // echo "E-mail: ".$reg["distr_email"]." "; echo " |
";
echo "
|