function add($palabra, $iso8859 = false) { if (!$this->lex) { $this->lex = array(); $this->index = 0; } if ($iso8859) { $palabra = iso2utf($palabra); } if (isset($this->lex[$palabra]) and $this->lex[$palabra]) { return $this->lex[$palabra]; } $this->index = $this->index + 1; $this->lex[$palabra] = $this->index; return $this->index; }
function genComboPaises($selected = false) { $sql = "SELECT IdPais,NombrePais FROM ges_paises WHERE Eliminado=0 ORDER BY NombrePais ASC"; $res = query($sql); if (!$res) { return false; } $out = ''; while ($row = Row($res)) { $key = $row["IdPais"]; $value = $row["NombrePais"]; if (getParametro("PaisesLatin1")) { $value = iso2utf($value); //Puede necesitar una conversion, si la tabla de paises esta en Latin1 } $value_s = CleanParaWeb($value); if ($key != $selected) { $out .= "<option value='{$key}'>{$value_s}</option>"; } else { $out .= "<option selected value='{$key}'>{$value_s}</option>"; } } return $out; }
function getTextColor() { $lang = $this->getLang(); $IdColor = $this->get("IdColor"); $sql = "SELECT Color FROM ges_modelos WHERE IdIdioma='{$lang}' AND IdColor='{$IdColor}'"; $row = queryrow($sql, "Lee texto color"); if (!$row) { return false; } if (getParametro("ColoresLatin1")) { return iso2utf($row["Color"]); } else { return $row["Color"]; } }
function ListarAlmacen($referencia, $donde, $marcadotrans = false, $cb = false, $idbase = false, $soloLlenos = false, $obsoletos = false, $soloNS = false, $soloLote = false, $soloOferta = false, $reservados = false) { global $action, $tamPagina; $base = getSesionDato("BusquedaProdBase"); $ot = getTemplate("ListadoMonoProductoMultiAlmacen"); if (!$ot) { error(__FILE__ . __LINE__, "Info: template no encontrado"); return false; } //Extraemos datos $almacen = getSesionDato("Articulos"); $IdLocal = $donde ? $donde : ""; if ($referencia) { $id = genReferencia2IdProducto($referencia); $idbase = getProdBaseFromId($id); } $IdProducto = !$base ? getIdFromCodigoBarras($cb) : ""; if (!$IdLocal and !$IdProducto) { echo gas("Aviso", _("Sin resultados")); if (!$IdProducto) { setSesionDato("BusquedaReferencia", false); if (!$base) { setSesionDato("BusquedaCB", false); } //si no encontro nada, no se busca en esa ref } return false; } $indice = getSesionDato("PaginadorAlmacen"); $idalias = ""; $nombre = ""; if (isset($_SESSION["BusquedaNombre"]) and $_SESSION["BusquedaNombre"]) { $nombre = $_SESSION["BusquedaNombre"]; } if ($nombre) { $idalias = getLikeProductoAlias2Id($nombre, $IdIdioma = false); } $res = $almacen->ListadoModular($IdLocal, $IdProducto, $indice, $tamPagina, $idbase, $nombre, $soloLlenos, $obsoletos, $soloNS, $soloLote, $soloOferta, $idalias, $reservados); $haytrans = is_array($marcadotrans) and count($marcadotrans); $num = 0; $jsOut = ""; $jsLex = new jsLextable(); $jsOut .= jsLabel("comprar", _("Comprar")); $jsOut .= jsLabel("modificar", _("Modificar")); $jsOut .= jsLabel("referencia", _("Referencia")); $jsOut .= jsLabel("unid", _("Unid")); $jsOut .= jsLabel("pv", _("PV")); $jsOut .= jsLabel("seleccionar", _("Seleccionar")); $jsOut .= jsLabel("cuantasunidades", _("¿Cuántas unidades?"), false); $oldId = -1; while ($almacen->SiguienteArticulo()) { $num++; $transid = $almacen->get("Id"); $ref = $almacen->get("Referencia"); $cb = $almacen->get("CodigoBarras"); $nombre = $almacen->get("Nombre"); $nombre = getParametro("ProductosLatin1") ? iso2utf($nombre) : $nombre; $unidades = $almacen->get("Unidades"); $contenedor = $almacen->get("Contenedor"); $ucontenedor = $almacen->get("UnidadesPorContenedor"); $precio = $almacen->get("CostoUnitario"); $ident = $almacen->get("Identificacion"); $id = $almacen->get("IdProducto"); $iconos = $almacen->Iconos(); $talla = getIdTalla2Texto($almacen->get("IdTalla")); $lextalla = $jsLex->add($talla); $color = getIdColor2Texto($almacen->get("IdColor")); $lexcolor = $jsLex->add($color); $desc = $almacen->get("Descripcion"); $nombreLocal = getNombreLocalId($almacen->get("IdLocal")); $lexlocal = $jsLex->add($nombreLocal); $ManejaSerie = $almacen->get("Serie"); $statusns = $almacen->get("StatusNS"); $ventamenudeo = $almacen->get("VentaMenudeo"); $UnidadMedida = $almacen->get("UnidadMedida"); $fam = getIdFamilia2Texto($almacen->get("IdFamilia")); $sub = getIdSubFamilia2Texto($almacen->get("IdFamilia"), $almacen->get("IdSubFamilia")); $lexfam = $jsLex->add($fam); $lexsub = $jsLex->add($sub); $sel = ($haytrans and in_array($transid, $marcadotrans)) ? 1 : 0; $idBase = $almacen->get("IdProdBase"); $marca = getIdMarca2Texto($almacen->get("IdMarca")); $lab = getNombreLaboratorio(getIdLaboratorioFromIdProducto($id)); if ($idBase != $oldId) { $numlex = $jsLex->add($ident); $nombre = addslashes($nombre); $ref = addslashes($ref); $jsOut .= "cAH({$idBase},'{$nombre}','{$ref}','{$desc}',{$numlex},{$lexfam},{$lexsub},{$ManejaSerie},'{$UnidadMedida}','{$contenedor}',{$ucontenedor},'{$marca}','{$ventamenudeo}','{$lab}');\n"; } $jsOut .= "cA({$id},'{$iconos}','{$cb}',{$unidades},'{$precio}',{$sel},{$transid},{$lextalla},{$lexcolor},{$lexlocal},{$ManejaSerie},'{$UnidadMedida}','{$contenedor}',{$ucontenedor},'{$ventamenudeo}','{$statusns}');\n"; $oldId = $idBase; } $jsOut = $jsLex->jsDump() . $jsOut; $jsOut .= AutoOpen(); $paginador = $ot->jsPaginador($indice, $tamPagina, $num); $jsOut .= $paginador; $jsOut .= "cListAlmacen();"; $jsOut .= $paginador; echo "<center>"; echo jsBody($jsOut); echo "</center>"; }
} echo "<button label='" . $txtalla . "' oncommand='changeNuestroTallaje(\"" . $idtalla . "\",\"" . $txtalla . "\",opener);'/>"; } echo "<spacer flex='1'/>"; echo "<button label='" . _("Cerrar") . "' oncommand='window.close()'/>"; echo "<script>\n function changeNuestroTallaje(idtallaje,txt,padre) {\n padre.changeTallaje(idtallaje,txt);\n window.close(); \t\t\t\n }\n </script>"; echo "</groupbox>"; break; case "tallaje": echo "<groupbox flex='1'> <caption label='" . $txtDetalle . " :'/>"; $sql = "SELECT IdTallaje,Tallaje FROM ges_detallescategoria ORDER BY Tallaje ASC"; $res = query($sql); while ($row = Row($res)) { $txtalla = $row["Tallaje"]; if (getParametro("TallajeLatin1")) { $txtalla = iso2utf($txtalla); } echo "<button label='" . $txtalla . "' oncommand='UsaTallaje(" . $row["IdTallaje"] . "," . $idfamilia . ")'/>"; } echo "<spacer flex='1'/>"; echo "<button label='" . _("Cerrar") . "' oncommand='window.close()'/>"; echo "<script>\n function UsaTallaje(id,idfamilia){\t\t\n document.location.href = 'selmodelo.php?modo=talla&IdTallaje='+id+'&idfamilia='+idfamilia;\n }\n\n function changeTalla(me,val) {\n document.opener.changeTalla(me,val);\n }\n </script>"; echo "</groupbox>"; break; case "nuevatalla": $talla = CleanRealMysql(CleanText($_GET["talla"])); $tallaje = CleanID($_GET["IdTallaje"]); $sql = "SELECT IdTalla FROM ges_detalles WHERE IdFamilia={$idfamilia} AND IdTallaje = {$tallaje} AND Talla='{$talla}' "; $row = queryrow($sql); if (!isset($row["IdTalla"]) && $tallaje != 0) { $sql = "SELECT Max(IdTalla) as MaxTal FROM ges_detalles";