Example #1
0
function MensajesHeadersHoy($IdUltimo = 0)
{
    //SELECT CURRENT_DATE
    //$IdLocal = getSesionDato("IdTienda");
    $IdLocal = getSesionDato("IdTiendaDependiente");
    $IdUsuario = getSesionDato("IdUsuario");
    $esParaNosotros = "IdLocalRestriccion=0 OR (IdLocalRestriccion = '{$IdLocal}')";
    $esParaMi = "IdUsuarioRestriccion=0 OR (IdUsuarioRestriccion = '{$IdUsuario}')";
    if ($IdUltimo > 0) {
        $ultimoCondicion = " AND IdMensaje > '{$IdUltimo}' ";
    } else {
        $ultimoCondicion = "";
    }
    //Fecha > CURRENT_DATE
    $esFecha = "UNIX_TIMESTAMP(Fecha ) > UNIX_TIMESTAMP() - 86400*DiasCaduca";
    $sql = "SELECT IdMensaje, Titulo, Status FROM ges_mensajes WHERE ( {$esFecha} )\n\t\tAND ({$esParaNosotros}) \n\t\tAND ({$esParaMi}) {$ultimoCondicion} ORDER BY Fecha ASC";
    //Usando el tipo CONVERSOR, que evita que aparezca en el log demasiadas entradas molestas de este.
    $res = query($sql, "CONVERSOR");
    if ($res) {
        $text = "";
        while ($row = Row($res)) {
            $IdMensaje = $row["IdMensaje"];
            $Titulo = $row["Titulo"];
            $Status = $row["Status"];
            $text .= $IdMensaje . "'" . $Titulo . "'" . $Status . "\n";
        }
    } else {
        return "error";
    }
    return $text;
}
Example #2
0
function OpcionesBusqueda($retorno)
{
    global $action;
    $ot = getTemplate("xulBusquedaAvanzada");
    if (!$ot) {
        error(__FILE__ . __LINE__, "Info: template no encontrado");
        return false;
    }
    $idprov = getSesionDato("FiltraProv");
    $idmarca = getSesionDato("FiltraMarca");
    $idcolor = getSesionDato("FiltraColor");
    $idtalla = getSesionDato("FiltraTalla");
    $idfamilia = getSesionDato("FiltraFamilia");
    $ot->fijar("action", $action);
    $ot->fijar("pagRetorno", $retorno);
    $ot->fijar("comboProveedores", genXulComboProveedores($idprov));
    $ot->fijar("comboMarcas", genXulComboMarcas($idmarca));
    $ot->fijar("comboFamilias", genXulComboMarcas($idfamilia));
    //echo q($idcolor,"color a mostrar en template");
    //echo q(intval($idcolor),"intval color a mostrar en template");
    if (intval($idcolor) >= 0) {
        $ot->fijar("comboColores", genXulComboColores($idcolor));
    } else {
        $ot->fijar("comboColores", genXulComboColores("ninguno"));
    }
    $ot->fijar("comboTallas", genXulComboTallas($idtalla));
    echo $ot->Output();
}
Example #3
0
 function TrasladoBrutal($Motivo)
 {
     $IdComprobante = $this->_IdComprobante;
     $IdPedido = $this->_IdPedido;
     $linea = 0;
     $totalimporte = 0;
     $Origen = $this->_origen;
     $Destino = $this->_destino;
     $igv = getSesionDato("IGV");
     $marcadotrans = getSesionDato("CarritoTrans");
     $Trans = getSesionDato("CarritoMover");
     $aSeries = getSesionDato("CarritoMoverSeries");
     $almacenes = new almacenes();
     $articulo = new articulo();
     foreach ($marcadotrans as $idarticulo) {
         $oProducto = new producto();
         $articulo->Load($idarticulo);
         $oProducto->Load($articulo->get("IdProducto"));
         $cantidad = 0;
         $idproducto = $articulo->get("IdProducto");
         $precio = round($Trans['Precio' . $idarticulo], 2);
         $costo = round($Trans['Costo' . $idarticulo], 2);
         $mSeleccion = $Trans[$idarticulo];
         $aSeleccion = explode("~", $mSeleccion);
         $esSerie = $aSeries[$idarticulo] ? true : false;
         foreach ($aSeleccion as $Pedido) {
             $aPedido = explode(":", $Pedido);
             $IdPedidoDet = $aPedido[0];
             //Kardex
             $cantidad = $aPedido[1];
             $LoteVence = isset($aPedido[3]) ? $aPedido[3] : 0;
             $totalimporte += $precio * $cantidad;
             $existencias = $almacenes->obtenerExistenciasKardex($idproducto, $Origen);
             //Control
             if ($existencias < $cantidad) {
                 return;
             }
             //Ventas
             $IdComprobanteDet = registrarDetalleTrasladoSalida($idproducto, $cantidad, $costo, $precio, $IdComprobante, $IdPedidoDet, $esSerie, $LoteVence);
             //Compras
             $nwIdPedidoDet = registrarDetalleTrasladoEntrada($IdPedido, $idproducto, $LoteVence, $cantidad, $costo, $precio, $esSerie);
             //Numeros de Series
             registrarTrasladoSeries($Origen, $Destino, $IdPedido, $nwIdPedidoDet, $IdPedidoDet, $idarticulo, $idproducto, $IdComprobante);
             //Kardex
             registrarTrasladoKardexFifo($Origen, $idproducto, $IdPedidoDet, $IdComprobanteDet, $costo, $cantidad, $existencias, $Motivo);
             //Kadex costo almacen
             $almacenes->actualizarCosto($idproducto, $Origen);
             //Kadex resumen almacen
             actualizaResumenKardex($idproducto, $Origen);
         }
     }
     //Importes Compras & Ventas
     registrarImportesTraslado($totalimporte, $IdComprobante, $IdPedido, $Motivo);
 }
Example #4
0
 function Listado($lang, $min = 0)
 {
     if (!$lang) {
         $lang = getSesionDato("IdLenguajeDefecto");
     }
     $sql = "SELECT\t\t\n\t\tges_albaranes_traspaso.*\t\t\n\t\tFROM\n\t\tges_albaranes_traspaso \t\t\n\t\tWHERE\n\t\tges_albaranes_traspaso.Eliminado = 0\n\t\t";
     $res = $this->queryPagina($sql, $min, 10);
     if (!$res) {
         $this->Error(__FILE__ . __LINE__, "Info: fallo el listado");
     }
     return $res;
 }
Example #5
0
function ListaFormaDeUnidades()
{
    //FormaListaCompraCantidades
    global $action;
    $oProducto = new producto();
    $ot = getTemplate("PopupCarritoCompra");
    if (!$ot) {
        error(__FILE__ . __LINE__, "Info: template no encontrado");
        return false;
    }
    $ot->resetSeries(array("IdProducto", "Referencia", "Nombre", "tBorrar", "tEditar", "tSeleccion", "vUnidades"));
    $tamPagina = $ot->getPagina();
    $indice = getSesionDato("PaginadorSeleccionCompras2");
    $carrito = getSesionDato("CarritoMover");
    //echo q($carrito,"Carrito Cantidades");
    $costescarrito = getSesionDato("CarroCostesMover");
    $quitar = _("Quitar");
    $ot->fijar("tTitulo", _("Carrito para Traslado"));
    //$ot->fijar("comboAlmacenes",getSesionDato("ComboAlmacenes"));
    $ot->fijar("comboAlmacenes", genComboAlmacenes(getParametro("AlmacenCentral")));
    $salta = 0;
    $num = 0;
    foreach ($carrito as $key => $value) {
        $salta++;
        if ($num <= $tamPagina and $salta >= $indice) {
            $num++;
            if ($oProducto->Load($key)) {
                $referencia = $oProducto->getReferencia();
                $nombre = $oProducto->getNombre();
            } else {
                $referencia = "";
                $nombre = "";
            }
            $ot->fijarSerie("vReferencia", $referencia);
            $ot->fijarSerie("vNombre", $nombre);
            $ot->fijarSerie("tBorrar", $quitar);
            $ot->fijarSerie("vUnidades", $value);
            $ot->fijarSerie("vPrecio", $costescarrito[$key]);
            $ot->fijarSerie("IdProducto", $oProducto->getId());
        }
    }
    if (!$salta) {
        $ot->fijar("aviso", gas("aviso", _("Carrito vacío")));
        $ot->eliminaSeccion("haydatos");
    } else {
        $ot->fijar("aviso");
        $ot->confirmaSeccion("haydatos");
    }
    $ot->paginador($indice, false, $num);
    $ot->fijar("action", $action);
    $ot->terminaSerie();
    echo $ot->Output();
}
Example #6
0
function VolcarGeneracionJSParaProductos($nombre = false, $referencia = false, $cb = false)
{
    $nombre_up = CleanRealMysql(strtoupper($nombre));
    $referencia_s = CleanRealMysql(strtoupper(trim($referencia)));
    $cb_s = CleanRealMysql($cb);
    $IdLocalActivo = getSesionDato("IdTiendaDependiente");
    $filtro = $nombre ? " AND UPPER(ges_productos_idioma.Descripcion) LIKE '%{$nombre_up}%' " : "";
    $filtro .= $referencia ? " AND  ges_productos.Referencia LIKE '%{$referencia_s}%' " : "";
    $filtro .= $cb ? " AND ges_productos.CodigoBarras = '{$cb_s}' " : "";
    $filtro .= " AND  ges_almacenes.Unidades = 0 ";
    $jsOut = getProductosSyncAlmacen(array(), $IdLocalActivo, $filtro, false);
    return $jsOut;
}
Example #7
0
function AccionesTrasAlta()
{
    global $action;
    $ot = getTemplate("AccionesTrasAltaPopup");
    if (!$ot) {
        error(__FILE__ . __LINE__, "Info: template busqueda no encontrado");
        return false;
    }
    $IdProducto = getSesionDato("UltimaAltaProducto");
    $ot->fijar("IdProducto", $IdProducto);
    //$ot->fijar("tEnviar" , _("Enviar"));
    $ot->fijar("action", $action);
    echo $ot->Output();
}
Example #8
0
function AgnadirCodigoCarritoAlmacen($xid, $local)
{
    $id = getIdFromAlmacen($xid, $local);
    if (!$id) {
        return false;
    }
    $rkardex = getResumenKardex2Articulo($id);
    $igv = getSesionDato("IGV");
    $aPedido = split("~", $rkardex);
    $cPedido = split(":", $aPedido[1]);
    $costo = $aPedido[0];
    $xid = $cPedido[0];
    $precio = round($costo * ($igv + 100) / 100, 2);
    $u = $xid . ':1:' . $precio;
    AgnadirCarritoTraspaso($id, $u);
    return true;
}
Example #9
0
function getTemplate($nombre)
{
    //ATENCION: esta funcion cogera el template de la sesion!!
    //TODO: cargar todas al hacer login, y recuperarlas aqui desde la SESION
    $ot = getSesionDato("Template_{$nombre}");
    if ($ot) {
        //error(0,"retorna $ot");
        return unserialize($ot);
    }
    $ot = new template();
    if ($ot->LoadByName($nombre)) {
        $_SESSION["Template_{$nombre}"] = serialize($ot);
        return $ot;
    }
    echo "Error: No encontrado template '<a href='modtemplates.php?modo=alta'>{$nombre}<br>'";
    //http://www.casaruralvirtual.com/misc/9gestion/
    return false;
}
Example #10
0
function genListadoCruzadoAsArray($IdProducto, $IdTallaje = false, $IdLang = false)
{
    $IdProducto = CleanID($IdProducto);
    $IdTallaje = CleanID($IdTallaje);
    $out = "";
    //Cadena de salida
    if (!$IdLang) {
        $IdLang = getSesionDato("IdLenguajeDefecto");
    }
    $sql = "SELECT Referencia, IdTallaje FROM ges_productos WHERE IdProducto='{$IdProducto}' AND Eliminado='0'";
    $row = queryrow($sql);
    if (!$row) {
        return false;
    }
    $tReferencia = CleanRealMysql($row["Referencia"]);
    if (!$IdTallaje) {
        $IdTallaje = $row["IdTallaje"];
    }
    if (!$IdTallaje) {
        $IdTallaje = 2;
    }
    //gracefull degradation
    $sql = "SELECT  ges_locales.NombreComercial,ges_modelos.Color,\n\t\tges_detalles.Talla, SUM(ges_almacenes.Unidades) as TotalUnidades FROM ges_almacenes INNER\n\t\tJOIN ges_locales ON ges_almacenes.IdLocal = ges_locales.IdLocal INNER\n\t\tJOIN ges_productos ON ges_almacenes.IdProducto =\n\t\tges_productos.IdProducto INNER JOIN ges_modelos ON\n\t\tges_productos.IdColor = ges_modelos.IdColor INNER JOIN ges_detalles ON\n\t\tges_productos.IdTalla = ges_detalles.IdTalla\n\t\tWHERE\n\t\tges_productos.Referencia = '{$tReferencia}'\n\t\tAND ges_modelos.IdIdioma = 1\n\t\tAND ges_locales.Eliminado = 0\n\t\tGROUP BY ges_almacenes.IdLocal, ges_productos.IdColor, ges_productos.IdTalla\n\t\tORDER BY ges_almacenes.IdLocal, ges_productos.IdColor";
    $data = array();
    $colores = array();
    $tallas = array();
    $locales = array();
    $tallasTallaje = array();
    $listaColores = array();
    $res = query($sql, "Generando Listado Cruzado");
    while ($row = Row($res)) {
        $color = $row["Color"];
        $talla = $row["Talla"];
        $nombre = $row["NombreComercial"];
        $unidades = CleanInt($row["TotalUnidades"]);
        $colores[$color] = 1;
        $tallas[$talla] = 1;
        $locales[$nombre] = 1;
        $num = 0;
        //echo "Adding... c:$color,t:$talla,n:$nombre,u:$unidades<br>";
        $data[$color][$talla][$nombre] = $unidades;
    }
    $sql = "SELECT Talla,SizeOrden FROM ges_detalles WHERE IdTallaje= '{$IdTallaje}' AND IdIdioma='{$IdLang}' AND Eliminado='0'" . "\t ORDER BY SizeOrden ASC, Talla ASC";
    $res = query($sql);
    $numtallas = 0;
    while ($row = Row($res)) {
        $orden = intval($row["SizeOrden"]);
        $talla = $row["Talla"];
        $posicion = GetOrdenVacio($tallasTallaje, $orden);
        $tallasTallaje[$posicion] = $talla;
        $numtallas++;
    }
    //$out .= "<table class='forma'>";
    //$out .= "<tr><td class='nombre'>".$tReferencia."</td>";
    $out_nombretabla = $tReferencia;
    $out_tallas = array();
    $out_tallas["talla_0"] = "{$tReferencia}/Tienda";
    $out_tallas["talla_1"] = "C o l o r";
    $num = 2;
    foreach ($tallasTallaje as $k => $v) {
        $out_tallas["talla_{$num}"] = $v;
        $num++;
    }
    $out_base = array();
    $out_rows = array();
    $numrow = 0;
    $out_filas = array();
    $out_bloques = array();
    foreach ($locales as $l => $v2) {
        $out_base["nombre"] = $l;
        $out_bloques[] = $l;
        foreach ($colores as $c => $v1) {
            $row = array();
            $row[] = $l;
            $row[] = $c;
            foreach ($tallasTallaje as $k2 => $t) {
                if (isset($data[$c][$t][$l])) {
                    $u = $data[$c][$t][$l];
                } else {
                    $u = "";
                }
                //$out .= "<td class='unidades' align='center'>" . $u . "</td>";
                $row[] = $u;
            }
            $out_rows[] = $row;
            //$out .= "</tr>";
        }
    }
    //$out .= "</table>";
    $out_final = array();
    $out_final["heads"] = $out_tallas;
    $out_final["rows"] = $out_rows;
    $out_final["numheads"] = count($out_tallas);
    //$out_final["rowheads"] = $out_filas;
    $out_final["nombretabla"] = $out_nombretabla;
    //$out_final["bloques"] = $out_bloques;
    return $out_final;
}
Example #11
0
$totalbruto = $totalbruto * 100 / ($IGV + 100);
//$totalbruto=round($totalbruto * 100) / 100;
//TOTALIGV
$totaligv = $totalneto - $totalneto_sinigv;
$totaligv = round($totaligv * 100) / 100;
//TOTAL DESCUENTO
$totaldescuento = $totalbruto - $totalneto_sinigv;
$totaldescuento = round($totaldescuento * 100) / 100;
//FORMAT
$totalbruto = number_format($totalbruto, 2);
$totaldescuento = number_format($totaldescuento, 2);
$totalneto_sinigv = number_format($totalneto_sinigv, 2);
$totaligv = number_format($totaligv, 2);
$totalneto = number_format($totalneto, 2);
$pdf->Cell(30, 4, $totalbruto, 1, 0, 'R', 1);
$pdf->Cell(36, 4, $totaldescuento, 1, 0, 'R', 1);
$pdf->Cell(36, 4, $totalneto_sinigv, 1, 0, 'R', 1);
$pdf->Cell(36, 4, $totaligv, 1, 0, 'R', 1);
//### TOTAL NETO
$pdf->Cell(50, 4, number_format($lafila["TotalImporte"], 2), 1, 0, 'R', 1);
$pdf->Ln(4);
//$impo=sprintf("%01.2f", $impo);
@mysql_free_result($resultado);
@mysql_free_result($query);
@mysql_free_result($resultado2);
@mysql_free_result($query3);
$name = "FACTURA-" . getSesionDato("TipoVentaTPV") . "-LOCAL-" . $IdLocal . "-NRO-" . $nroFactura . ".pdf";
$pdf->Output($name, '');
?>
 
Example #12
0
            $vEFECTIVO = $value;
        }
    }
}
?>

var vBONO     = parseInt(<?php 
echo intval($vBONO);
?>
,10);
var vEFECTIVO = parseInt(<?php 
echo intval($vEFECTIVO);
?>
,10);
var vIGV      = <?php 
echo getSesionDato("IGV");
?>
;
var esPopup   = <?php 
echo $esPopup;
?>
;

function generadorCargado(){
	//Indica que funciones como aU() estan disponibles
	return typeof aU=="function";	
}

function generadorCargadoPromociones(){
	//Indica que funciones como tPL() estan disponibles
	return typeof tPL=="function";	
Example #13
0
	break;

        case 119 : 
	parent.selTipoPresupuesto(1);
	parent.id("buscapedido").focus(); 
	break;

        case 120 : 
	parent.VerVentas();
	break;

    }
}


var Local = new Object();
Local.IdLocalActivo = '<?php 
echo CleanID(getSesionDato("IdTiendaDependiente"));
?>
';

setTimeout("onLoadFormulario()",300);


//]]></script>




</window>
Example #14
0
function registrarTrasladoSeries($origen, $destino, $IdPedido, $nwIdPedidoDet, $IdPedidoDet, $idarticulo, $IdProducto, $IdComprobante)
{
    $aSeries = getSesionDato("CarritoMoverSeries");
    $esSerie = $aSeries[$idarticulo] ? false : true;
    //Control
    if ($esSerie) {
        return;
    }
    $mSeries = !$esSerie ? $aSeries[$idarticulo] : '';
    $seriesxPedido = explode("~", $mSeries);
    $Series = '';
    $srt = false;
    $vernseries = array();
    foreach ($seriesxPedido as $nsPedido) {
        $aPedido = explode(":", $nsPedido);
        if ($IdPedidoDet == $aPedido[0]) {
            $Series = $aPedido[1];
        }
    }
    $aSeries = explode(",", $Series);
    $nSeries = count($aSeries);
    $SerieVence = getGarantiaPedidoDet($IdPedidoDet, $IdProducto);
    $xset = "OperacionSalida='TrasLocal',Estado='Salida',Disponible=0,";
    for ($i = 0; $i < $nSeries; $i++) {
        $Serie = $aSeries[$i];
        //Ventas
        registrarSalidaNumeroSerie($IdProducto, $IdComprobante, $Serie, $IdPedidoDet, $xset);
        //Compras
        registrarNumeroSerieExtra($IdProducto, $nwIdPedidoDet, $Serie, $SerieVence, 'Pedido', 'TrasLocal', '0');
    }
    //Valida Series
    validaSeriePedidoDet($IdProducto, $nwIdPedidoDet);
}
Example #15
0
 $poblacion = isset($_POST["Localidad"]) ? CleanText($_POST["Localidad"]) : '';
 $direccion = CleanText($_POST["Direccion"]);
 $cp = CleanCP($_POST["CP"]);
 $email = CleanEmail($_POST["Email"]);
 $telefono1 = CleanTelefono($_POST["Telefono1"]);
 $telefono2 = isset($_POST["Telefono2"]) ? CleanTelefono($_POST["Telefono2"]) : '';
 $contacto = isset($_POST["Contacto"]) ? CleanText($_POST["Contacto"]) : '';
 $cargo = isset($_POST["Pago"]) ? CleanText($_POST["Cargo"]) : '';
 $cuentabancaria = isset($_POST["CuentaBancaria"]) ? CleanCC($_POST["CuentaBancaria"]) : '';
 $numero = CleanText($_POST["NumeroFiscal"]);
 $comentario = CleanText($_POST["Comentarios"]);
 $tipocliente = CleanText($_POST["TipoCliente"]);
 $IdModPagoHabitual = isset($_POST["IdModPagoHabitual"]) ? CleanID($_POST["IdModPagoHabitual"]) : '';
 $idpais = isset($_POST["IdPais"]) ? CleanID($_POST["IdPais"]) : '';
 $paginaweb = isset($_POST["PaginaWeb"]) ? CleanUrl($_POST["PaginaWeb"]) : '';
 $IdLocal = CleanID(getSesionDato("IdTienda"));
 $FechaNacimiento = CleanText($_POST["FechaNacimiento"]);
 $datehoy = date("Y-m-d");
 $FechaNacimiento = $FechaNacimiento >= $datehoy ? '0000-00-00' : $FechaNacimiento;
 if ($tipocliente != 'Particular') {
     $FechaNacimiento = '0000-00-00';
 }
 if ($FechaNacimiento == '1899-11-30') {
     $FechaNacimiento = '0000-00-00';
 }
 $id = CrearCliente($comercial, $legal, $direccion, $poblacion, $cp, $email, $telefono1, $telefono2, $contacto, $cargo, $cuentabancaria, $numero, $comentario, $tipocliente, $idpais, $paginaweb, $IdLocal, $FechaNacimiento);
 if ($id) {
     echo "{$id}";
 } else {
     echo "0";
 }
<?php

define('FPDF_FONTPATH', 'font/');
require 'mysql_table.php';
include "comunesexp.php";
include "../funciones/fechas.php";
include "../../tool.php";
$IdLocal = getSesionDato("IdTienda");
$Moneda = getSesionDato("Moneda");
setlocale(LC_ALL, "es_ES");
if (!isset($IdLocal)) {
    echo "<script>parent.location.href='../logout.php';</script>";
}
$operador = $_SESSION["NombreUsuario"];
$nombrelegal = getNombreLegalLocalId($IdLocal);
$poblacion = getPoblacionLocalId($IdLocal);
$producto = $_GET["xproduct"];
$idprod = CleanID($_GET["xid"]);
$unidad = CleanText($_GET["unidad"]);
$exist = CleanText($_GET["exist"]);
$cprom = CleanText($_GET["cpromedio"]);
$ctotal = CleanText($_GET["ctotal"]);
$xlocal = CleanID($_GET["xlocal"]);
$sql = "SELECT ges_almacenes.StockMin, ges_locales.NombreComercial as local " . "FROM ges_almacenes inner join ges_locales ON ges_almacenes.IdLocal = " . "ges_locales.IdLocal where ges_almacenes.IdProducto = '{$idprod}' " . "AND ges_almacenes.IdLocal = '{$xlocal}'";
$res = query($sql);
$row = Row($res);
$local = utf8_decode($row["local"]);
$eminima = $row["StockMin"];
//PDF ESTRUCTURA
$pdf = new PDF('L', 'mm', 'A4');
$pdf->Open();
Example #17
0
function getPromocionesSyncAlmacen($IdLocalActivo)
{
    $xlocal = $IdLocalActivo ? "0," . $IdLocalActivo : 0;
    $TipoVenta = getSesionDato("TipoVentaTPV");
    $sql = " select IdPromocion,IdPromocionCliente,Descripcion, " . "        Estado,Modalidad,MontoCompraActual, " . "        Tipo,IdLocal,CBProducto0, " . "        CBProducto1,Descuento,Bono,Prioridad, " . "        CONCAT(DATE_FORMAT(FechaFin,'%d/%m/%Y %H:%i'),'~',FechaFin) AS FechaFin" . " from   ges_promociones " . " where  Estado    = 'Ejecucion' " . " and    Eliminado = 0 " . " and    TipoVenta = '" . $TipoVenta . "'" . " and    IdLocal   in (" . $xlocal . ") " . " order  by MontoCompraActual asc";
    $res = query($sql);
    if (!$res) {
        return false;
    }
    $out = '';
    $zsrt = 'tPL(';
    $xsrt = ',';
    while ($row = Row($res)) {
        //Estado...
        if (verificarEstadoPromocion($row) == 'Finalizado') {
            continue;
        }
        $out .= $zsrt;
        $out .= $row["IdPromocion"] . $xsrt;
        $out .= $row["IdPromocionCliente"] . $xsrt;
        $out .= "'" . $row["Descripcion"] . "'" . $xsrt;
        $out .= "'" . $row["Modalidad"] . "'" . $xsrt;
        $out .= $row["MontoCompraActual"] . $xsrt;
        $out .= "'" . $row["Tipo"] . "'" . $xsrt;
        $out .= $row["IdLocal"] . $xsrt;
        $out .= $row["CBProducto0"] . $xsrt;
        $out .= $row["CBProducto1"] . $xsrt;
        $out .= $row["Descuento"] . $xsrt;
        $out .= $row["Bono"] . $xsrt;
        $out .= $row["Prioridad"] . ");";
    }
    return $out;
}
Example #18
0
function getModeloDetalle2txt()
{
    $atxt = array();
    switch (getSesionDato("GlobalGiroNegocio")) {
        case "BTCA":
            array_push($atxt, 'BTCA');
            array_push($atxt, 'Presentación ó Modelo');
            array_push($atxt, 'Concentración ó Detalle');
            array_push($atxt, 'Principio activo');
            array_push($atxt, 'Registro Sanitario');
            break;
        case "BTQE":
            array_push($atxt, 'BTQE');
            array_push($atxt, 'Color ó Modelo');
            array_push($atxt, 'Talla ó Detalle');
            array_push($atxt, 'Etiqueta');
            array_push($atxt, 'Referencia Fabr.');
            break;
        default:
            array_push($atxt, 'PINF');
            array_push($atxt, 'Modelo');
            array_push($atxt, 'Detalle');
            array_push($atxt, 'Etiqueta');
            array_push($atxt, 'Referencia Fabr.');
            break;
    }
    return $atxt;
}
Example #19
0
 function Crea()
 {
     $this->Init();
     $this->regeneraCodigos();
     $this->setNombre(_("Nuevo producto"));
     $this->setPrecioVenta(0);
     $this->setPrecioOnline(0);
     $this->set("Costo", 0, FORCE);
     $fam = getFirstNotNull("ges_familias", "IdFamilia");
     $this->set("IdFamilia", $fam, FORCE);
     $this->set("IdSubFamilia", getSubFamiliaAleatoria($fam), FORCE);
     $this->set("IdProvHab", getFirstNotNull("ges_proveedores", "IdProveedor"), FORCE);
     $this->set("IdLabHab", getFirstNotNull("ges_laboratorios", "IdLaboratorio"), FORCE);
     $this->set("IdMarca", getFirstNotNull("ges_marcas", "IdMarca"), FORCE);
     $this->set("IdContenedor", getFirstNotNull("ges_contenedores", "IdContenedor"), FORCE);
     $this->set("IdProductoAlias0", getFirstNotNull("ges_productos_alias", "IdProductoAlias"), FORCE);
     $this->set("IdProductoAlias1", getFirstNotNull("ges_productos_alias", "IdProductoAlias"), FORCE);
     $this->set("IdTallaje", TALLAJE_VARIOS, FORCE);
     $this->set("IdTalla", TALLAJE_VARIOS_TALLA, FORCE);
     $oAlmacen = getSesionDato("AlmacenCentral");
     if ($oAlmacen) {
         //$this->set("");
         $this->set("TipoImpuesto", getTipoImpuesto(), FORCE);
         $this->set("Impuesto", getValorImpuestoDefectoCentral(), FORCE);
     }
     //$this->set("IdProvHab",
 }
Example #20
0
<?php

include "../../tool.php";
if (!getSesionDato("IdTienda")) {
    session_write_close();
    //header("Location: #");
    exit;
}
$IdLocal = getSesionDato("IdTienda");
$locales = getLocalesPrecios($IdLocal);
include "xulcomprasborrador.php";
?>


Example #21
0
function FormularioEditarArticulo($id)
{
    global $action;
    $ot = getTemplate("FormEditarArticulo");
    if (!$ot) {
        error(__FILE__ . __LINE__, "Error: template busqueda no encontrado");
        return false;
    }
    $articulo = new articulo();
    $oProducto = new producto();
    if (!$articulo->Load($id)) {
        error(__FILE__ . __LINE__, "Error: no puedo modificar ese producto");
        return false;
    }
    $oProducto->Load($articulo->get("IdProducto"));
    $igv = getSesionDato("IGV");
    $local = $_SESSION["LocalMostrado"];
    $idProducto = $articulo->get("Id");
    $CostoUnitario = $articulo->get("CostoUnitario");
    $PVD = $articulo->get("PrecioVenta");
    $PVDD = $articulo->get("PVDDescontado");
    $IGVD = round($PVD / (1 + $igv / 100) * ($igv / 100) * 100) / 100;
    $MUD = round(($PVD - $IGVD - $CostoUnitario) * 100) / 100;
    $PVC = $articulo->get("PrecioVentaCorporativo");
    $PVCD = $articulo->get("PVCDescontado");
    $IGVC = round($PVC / (1 + $igv / 100) * ($igv / 100) * 100) / 100;
    $MUC = round(($PVC - $IGVC - $CostoUnitario) * 100) / 100;
    $disponible = $articulo->is("Disponible") ? "checked" : "";
    $dispOnline = $articulo->is("DisponibleOnline") ? "checked" : "";
    $obsoleto = $oProducto->get("Obsoleto") ? "checked" : "";
    $esLote = $oProducto->get("Lote");
    $esVence = $oProducto->get("FechaVencimiento");
    $esSerie = $oProducto->get("Serie");
    $oferta = $articulo->is("Oferta") ? "checked" : "";
    $stockilimitado = $articulo->is("StockIlimitado") ? "checked" : "";
    $esIlimitado = $esSerie ? 'none' : 'table-row';
    $esIlimitado = $esLote ? 'none' : $esIlimitado;
    $esIlimitado = $esVence ? 'none' : $esIlimitado;
    $existencias = $articulo->get("Unidades");
    $stockunidades = $existencias;
    $producto = getDatosProductosExtra($articulo->get("IdProducto"), 'nombretodos');
    $nombre = $producto["Nombre"];
    $esMenudeo = $producto["Menudeo"];
    $unidad = $producto["Und"];
    $unidxemp = $producto["UndxEmp"];
    $empaque = $producto["Empaque"];
    $resmenudeo = $esMenudeo ? "  ( " . $stockunidades . " " . $unidad . " a " . $unidxemp . $unidad . "x" . $empaque . " )" : "";
    $disponibleunid = $articulo->get("DisponibleUnidades");
    $reservadaunid = $disponibleunid > 0 ? $existencias - $disponibleunid : 0;
    $resto = $esMenudeo ? $existencias % $unidxemp : 0;
    $empaques = $esMenudeo ? ($existencias - $resto) / $unidxemp : 0;
    $existencias = $esMenudeo ? $empaques . " " . $empaque . " + " . $resto : $existencias;
    $disponibleunid = $disponibleunid > 0 ? $disponibleunid : $stockunidades;
    $txtMoDet = getModeloDetalle2txt();
    $txtModelo = $txtMoDet[1];
    $txtDetalle = $txtMoDet[2];
    $txtalias = $txtMoDet[3];
    $txtref = $txtMoDet[4];
    $ot->fijar("tTituloAux", _("Otras tiendas"));
    $ot->fijar("tIgualar", _("Todas las tiendas el mismo precio"));
    $ot->fijar("tMotivo", _("Motivo mod. existencias"));
    $ot->fijar("tTitulo", _("Modificar existencias"));
    $ot->fijar("vRefProvHab", $articulo->get("RefProvHab"));
    $ot->fijar("tRefProvHab", $txtref);
    $ot->fijar("vPresentacion", $oProducto->getTextColor());
    $ot->fijar("tPresentacion", $txtModelo);
    $ot->fijar("vProductoAlias0", getIdProductoAlias2Texto($articulo->get("IdProductoAlias0")));
    $ot->fijar("tProductoAlias0", $txtalias);
    $ot->fijar("vProductoAlias1", getIdProductoAlias2Texto($articulo->get("IdProductoAlias1")));
    $ot->fijar("tProductoAlias1", $txtalias);
    $ot->fijar("vSubPresentacion", $oProducto->getTextTalla());
    $ot->fijar("tSubPresentacion", $txtDetalle);
    $ot->fijar("vReferencia", $articulo->get("Referencia"));
    $ot->fijar("tReferencia", _("Referencia"));
    $ot->fijar("vDescripcion", $nombre);
    $ot->fijar("tDescripcion", _("Nombre"));
    $ot->fijar("vUnidades", $existencias);
    $ot->fijar("tUnidades", _("Stock"));
    $ot->fijar("mUnidad", $resmenudeo);
    $ot->fijar("vIGV", $igv);
    $ot->fijar("tIGV", "IGV");
    $ot->fijar("vCostoUnitario", round($articulo->get("CostoUnitario") * 100) / 100);
    $ot->fijar("tCostoUnitario", _("CU"));
    $ot->fijar("vCostoUnitarioC", round($articulo->get("CostoUnitario") * 100) / 100);
    $ot->fijar("tCostoUnitarioC", _("CU"));
    $ot->fijar("vMUD", $MUD);
    $ot->fijar("tMUD", _("MU"));
    $ot->fijar("vIGVD", $IGVD);
    $ot->fijar("tIGVD", _("IGV"));
    $ot->fijar("vPVD", $PVD);
    $ot->fijar("tPVD", _("PVP"));
    $ot->fijar("vPVDD", $PVDD);
    $ot->fijar("tPVDD", _("PVPD"));
    $ot->fijar("vMUC", $MUC);
    $ot->fijar("tMUC", _("MU"));
    $ot->fijar("vIGVC", $IGVC);
    $ot->fijar("tIGVC", _("IGV"));
    $ot->fijar("vPVC", $PVC);
    $ot->fijar("tPVC", _("PVC"));
    $ot->fijar("vPVCD", $PVCD);
    $ot->fijar("tPVCD", _("PVCD"));
    $ot->fijar("tTipoImpuesto", _("Impuesto"));
    $ot->fijar("vTipoImpuesto", $articulo->get("TipoImpuesto"));
    $ot->fijar("vImpuesto", $articulo->get("Impuesto"));
    $ot->fijar("vStockMin", $articulo->get("StockMin"));
    $ot->fijar("vStockUnidades", $stockunidades);
    $ot->fijar("tOfertaUnidades", _("Unidades en Oferta "));
    $ot->fijar("vOfertaUnidades", $articulo->get("OfertaUnidades"));
    $ot->fijar("tPrecioVentaOferta", _("Precio de Oferta"));
    $ot->fijar("vPrecioVentaOferta", $articulo->get("PrecioVentaOferta"));
    $ot->fijar("tDisponibleUnidades", _("Unidades Disponibles"));
    $ot->fijar("vDisponibleUnidades", $disponibleunid);
    $ot->fijar("tUnidad", $unidad);
    $ot->fijar("tUnidadesReservadas", _("Unidades Reservadas"));
    $ot->fijar("vUnidadesReservadas", $reservadaunid);
    $ot->fijar("cDisponible", $disponible);
    $ot->fijar("cDisponibleOnline", $dispOnline);
    $ot->fijar("cOferta", $oferta);
    $ot->fijar("cStockIlimitado", $stockilimitado);
    $ot->fijar("esStockIlimitado", $esIlimitado);
    $ot->fijar("tDisponible", _("Disponible"));
    $ot->fijar("tDisponibleOnline", _("Disponible Online"));
    $ot->fijar("tObsoleto", _("Obsoleto"));
    $ot->fijar("cObsoleto", $obsoleto);
    $ot->fijar("tOferta", _("En oferta"));
    $ot->fijar("tStockIlimitado", _("Stock ilimitado"));
    $ot->fijar("tStockMin", _("Stock minimo"));
    $ot->fijar("action", $action);
    $ot->fijar("vId", $articulo->get("Id"));
    echo $ot->Output();
}
Example #22
0
function AgnadirCarritoClientes($id)
{
    $actual = getSesionDato("CarritoCliente");
    if (!is_array($actual)) {
        $actual = array();
    }
    if (!in_array($id, $actual)) {
        array_push($actual, $id);
    }
    $_SESSION["CarritoCliente"] = $actual;
}
Example #23
0
    </hbox>
  </groupbox>

  <iframe id="webarea" src="about:blank" flex='1'/>
  <script><![CDATA[

var esTPV = <?php 
echo intval($esTPV);
?>
;
var IdLocalActual = <?php 
echo intval(getSesionDato("IdTienda"));
?>
;
var esTPVOP  = "<?php 
echo getSesionDato("TipoVentaTPV");
?>
";
function id(nombre) { return document.getElementById(nombre); };

function ActivarCambioListado(xval){
  id("btnListado").setAttribute("disabled",xval);
}

function CambiaListado() {
        ActivarCambioListado(true);
	setTimeout("ActivarCambioListado(false)",5000);
	var idlista 	= id("esListas").value;

	if(!idlista || idlista == 0) return;
Example #24
0
//####################################  IMPORTE FINAL DESGLOZADO
$pdf->SetFillColor(255, 255, 255);
$pdf->SetTextColor(0);
$pdf->SetDrawColor(255, 255, 255);
$pdf->SetLineWidth(0.2);
$pdf->SetFont('Arial', 'B', 8);
$pdf->Ln(4);
$pdf->SetFillColor(255, 255, 255);
$pdf->SetTextColor(0);
$pdf->SetDrawColor(255, 255, 255);
$pdf->SetLineWidth(0.2);
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(1);
//########### HALLAMOS TOTALES
$pdf->Cell(20, 4, "", 1, 0, 'R', 1);
$pdf->Cell(40, 4, "", 1, 0, 'R', 1);
$pdf->Cell(40, 4, "", 1, 0, 'R', 1);
$pdf->Cell(38, 4, "", 1, 0, 'R', 1);
$pdf->Cell(40, 4, $lafila["TotalImporte"], 1, 0, 'R', 1);
$pdf->Ln(4);
//$impo=sprintf("%01.2f", $impo);
@mysql_free_result($resultado);
@mysql_free_result($query);
@mysql_free_result($resultado2);
@mysql_free_result($query3);
//#### NOMBRE DEL FICHERO
$name = "BOLETA-" . getSesionDato("TipoVentaTPV") . "-LOCAL-" . $IdLocal . "-NRO-" . $nroBoleta . ".pdf";
$pdf->Output($name, '');
?>
 
Example #25
0
function genComboTallas($selected = false)
{
    $IdIdioma = getSesionDato("IdLenguajeDefecto");
    $sql = "SELECT IdTalla,Talla FROM ges_detalles  WHERE Eliminado=0 AND IdIdioma = '{$IdIdioma}' ORDER BY Talla ASC";
    $res = query($sql);
    if (!$res) {
        return false;
    }
    $out = '';
    while ($row = Row($res)) {
        $key = $row["IdTalla"];
        $value = $row["Talla"];
        if ($key != $selected) {
            $out .= "<option value='{$key}'>{$value}</option>";
        } else {
            $out .= "<option selected value='{$key}'>{$value}</option>";
        }
    }
    return $out;
}
Example #26
0
  enviar["IdAlias1"] = 0;

  var MITALLAJEDEFECTO = '<?php 
echo TALLAJE_DEFECTO;
?>
';//Si no se especifica tallaje, prepopula para un tallaje concreto x defecto
  var cImpuesto    = <?php 
echo getSesionDato("IGV");
?>
;
  var cIdLocal     = <?php 
echo getSesionDato("IdTienda");
?>
;
  var cUtilidad    = <?php 
echo getSesionDato("MargenUtilidad");
?>
;
  var cModo        = <?php 
echo "'" . $modo . "'";
?>
;
  var esInventario = (cModo=='altainventario')? true:false;
  var aProducto    = Array();
  var MUGR         = <?php 
echo $MUGR;
?>
;
  var DSTOGR       = <?php 
echo $DSTOGR;
?>
Example #27
0
function EjecutarTicket($idDependiente, $entregado, $IdLocal, $IdCliente, $modoTicket, $entregaEfectivo, $entregaBono, $entregaTarjeta, $cambio, $modoTPV, $IdPresupuesto)
{
    global $TotalImporte;
    global $ImporteNeto;
    global $IvaImporte;
    global $carrito, $UltimaInsercion;
    global $trabajos;
    switch ($modoTicket) {
        case "preventa":
            //Lo que sea
            $ImportePendiente = intval((abs($TotalImporte) - abs($entregado)) * 100) / 100.0;
            if ($ImportePendiente < 0) {
                //Se entrego mas de lo que se dio
                $ImportePendiente = 0;
            }
            break;
        case "mproducto":
            //Normalmente la totalidad del coste
            $ImportePendiente = abs(intval((abs($TotalImporte) - abs($entregado)) * 100) / 100.0);
            break;
        case "interno":
            $ImportePendiente = 0;
            break;
        default:
            $modoTicket = "tipoError:" + CleanRealMysql(CleanParaWeb($modoTicket));
            $ImportePendiente = abs(intval((abs($TotalImporte) - abs($entregado)) * 100) / 100.0);
            break;
    }
    $IdLocal = CleanID($IdLocal);
    $ImporteNeto = $TotalImporte - $IvaImporte;
    $IGV = getSesionDato("IGV");
    $textDoc = $modoTicket == "preventa" ? "Preventa" : "";
    //Npresupuesto & SPresupuesto
    $IdArqueoCaja = GetArqueoActivoExtra($IdLocal);
    //Obtenemos la seie del id arqueo caja
    $codDocumento = explode("-", NroComprobantePreVentaMax($IdLocal, $textDoc, $IdArqueoCaja));
    $sreDocumento = $codDocumento[0] != $IdArqueoCaja ? $IdArqueoCaja : $codDocumento[0];
    $nroDocumento = $codDocumento[0] != $IdArqueoCaja ? 1 : $codDocumento[1];
    $TipoVenta = getSesionDato("TipoVentaTPV");
    //PreVenta...
    $esquema = " IdLocal, IdUsuario," . " NPresupuesto, TipoPresupuesto," . " TipoVentaOperacion, FechaPresupuesto," . " ImporteNeto, ImporteImpuesto," . " Impuesto, TotalImporte, " . " Status, IdCliente, ModoTPV, Serie ";
    $datos = " '{$IdLocal}', '{$idDependiente}'," . " '{$nroDocumento}', '{$textDoc}'," . " '{$TipoVenta}', NOW()," . " '{$ImporteNeto}', '{$IvaImporte}'," . " '{$IGV}', '{$TotalImporte}'," . " 'Pendiente', '{$IdCliente}', '{$modoTPV}','{$sreDocumento}'";
    $sql = "INSERT INTO ges_presupuestos (" . $esquema . ")" . "VALUES (" . $datos . ")";
    $res = query($sql, "Creando Pre venta ({$nroDocumento})");
    if ($res) {
        //Comprobantes...
        $IdComprobante = $UltimaInsercion;
        //Detalles...
        foreach ($carrito as $fila) {
            $fila->AltaPedidos($IdComprobante);
        }
    }
    //Presupuesto...
    if ($IdPresupuesto != '0') {
        setIdCPPresupuesto($IdPresupuesto, $IdComprobante);
    }
    //Numero Pre-Venta...
    return $nroDocumento;
}
Example #28
0
 function ApilaProductoTodos($oProducto, $unidades = 0)
 {
     $id = $oProducto->getId();
     //error(0,"Infodebug: id $id,".serialize($oProducto));
     error(__FILE__ . __LINE__, "Infor: Precio aqui es " . $oProducto->getPrecioVenta());
     $listaTiendas = getSesionDato("ArrayTiendas");
     foreach ($listaTiendas as $tienda) {
         $this->ApilaProducto($oProducto, $tienda, $unidades);
     }
 }
Example #29
0
<?php

include "../../tool.php";
if (!getSesionDato("IdTienda")) {
    session_write_close();
    //header("Location: #");
    exit;
}
$IdLocal = getSesionDato("IdTienda");
$locales = getLocalesPrecios($IdLocal);
$esBTCA = getSesionDato("GlobalGiroNegocio") == "BTCA" ? true : false;
$modo = CleanText($_GET["modo"]);
switch ($modo) {
    case "verProductoInformacion":
        $Indicaciones = $esBTCA ? "Indicaciones" : "Propiedades Distintivas";
        $Dosificacion = $esBTCA ? "Dosificación" : "Modo de Uso";
        $CtraIndicacion = $esBTCA ? "Contra Indicaciones" : "Advertencias";
        $Interaccion = $esBTCA ? "Interacciones" : "Compatibilidad";
        include "xulproductoinfo.php";
        break;
    case "GuardaProductoInformacion":
        $IdProducto = CleanID($_POST["xidp"]);
        $Indicacion = CleanText($_POST["xind"]);
        $CtraIndicacion = CleanText($_POST["xcind"]);
        $Interaccion = CleanText($_POST["xint"]);
        $Dosificacion = CleanText($_POST["xdos"]);
        $oProdInfo = new productoinformacion();
        $IdProductoInfo = $oProdInfo->getIdProductoInformacion($IdProducto);
        $opcion = $IdProductoInfo ? "Modificar" : "Crear";
        echo $id = CrearProductoInformacion($IdProducto, $Indicacion, $CtraIndicacion, $Interaccion, $Dosificacion, $opcion, $IdProductoInfo);
        exit;
Example #30
0
            //Hace que si quien ha logueado es dependiente, se lo ponga por defecto
            $sesname = getSesionDato("NombreUsuario");
            if ($sesname == $nombre and $nombre) {
                $IdDependienteDefecto = $IdUsuario;
                $NombreDependienteDefecto = $nombre;
                //error(__FILE__ . __LINE__ ,"Info: OK '$sesname'=='$nombre'");
            } else {
                //error(__FILE__ . __LINE__ ,"Info: '$sesname'!='$nombre'");
            }
            $dependientes[$nombre] = $IdUsuario;
            //error(__LINE__,"Info: entro id '$IdUsuario', nombre '$nombre'");
            $numDependientes = $numDependientes + 1;
        }
    }
}
if (getSesionDato("NombreUsuario") != $NombreDependienteDefecto or !$NombreDependienteDefecto) {
    $usuarioActivoNoEsDependiente = 1;
    error(__FILE__ . __LINE__, "Info: '{$sesname}'!='{$nombre}'");
} else {
    $usuarioActivoNoEsDependiente = '';
}
$out = "";
$t = 0;
foreach ($dependientes as $nombre => $IdUsuario) {
    $check = $sesname == $nombre ? 'true' : 'false';
    //error(__LINE__ , "Info: salio n $nombre, id $IdUsuario");
    $out .= "<menuitem id='dep_" . $t . "' image='chrome://mozapps/skin/profile/Zprofileicon.gif' type='radio' name='radio' label='{$nombre}' value='{$IdUsuario}' checked='{$check}' />\n";
    $t++;
}
$generadorDeDependientes = $out;
//--------------------------------------------------