Esempio n. 1
0
        protected void guardarEdicion(object sender, EventArgs e)
        {
            String campos = "";

            if (validarDatosNuevo(ref campos))
            {
                lblErrorClientes.Text = "";
                Hashtable padre = armarHashPadre();
                Hashtable hijo1 = existeHijo1() ? armarHashHijo1() : null;
                Hashtable hijo2 = existeHijo2() ? armarHashHijo2() : null;

                DictionaryEntry[] keys = new DictionaryEntry[3];
                keys[0] = new DictionaryEntry("mcli_codigo", String.Format("'{0}'", ViewState["codPadre"]));
                keys[1] = new DictionaryEntry("mcli_codigo", String.Format("'{0}'", ViewState["codHijo1"]));
                keys[2] = new DictionaryEntry("mcli_codigo", String.Format("'{0}'", ViewState["codHijo2"]));

                bool bien = ManejoClientesLogic.editarClientes(keys, padre, hijo1, hijo2);

                if (bien)
                {
                    guardarLogsCambios();
                    Utils.MostrarAlerta(Response, "Clientes Guardados!");
                }
                else
                {
                    Utils.MostrarAlerta(Response, "Ocurrió un error al guardar los datos. Revise los logs para más información");
                }
            }
            else
            {
                Utils.MostrarAlerta(Response, "Existen Errores en los datos ingresados, por favor revise");
                lblErrorClientes.Text = campos;
            }
        }
Esempio n. 2
0
        protected void guardarNuevo(object sender, EventArgs e)
        {
            String campos = "";

            if (validarDatosNuevo(ref campos))
            {
                lblErrorClientes.Text = "";
                Hashtable padre = armarHashPadre();
                Hashtable hijo1 = existeHijo1() ? armarHashHijo1() : null;
                Hashtable hijo2 = existeHijo2() ? armarHashHijo2() : null;

                bool bien = ManejoClientesLogic.guardarClientes(padre, hijo1, hijo2);

                if (bien)
                {
                    limpiarDatos();
                    Utils.MostrarAlerta(Response, "Clientes Guardados!");
                }
                Utils.MostrarAlerta(Response, "Ocurrió un error al guardar los datos. Revise los logs para más información");
            }
            else
            {
                Utils.MostrarAlerta(Response, "Existen Errores en los datos ingresados, por favor revise");
                lblErrorClientes.Text = campos;
            }
        }
Esempio n. 3
0
        private void solicitarNuevaTarjeta(string codCliente)
        {
            String sql = String.Format("update mviptarjeta set tvig_codigo = 'B' where tvig_codigo = 'V' and mcli_codigo='{0}'", codCliente);

            DBFunctions.NonQuery(sql);

            codCliente = String.Format("'{0}'", codCliente);
            ManejoClientesLogic.guardarTarjetaNueva(codCliente);
        }
Esempio n. 4
0
        private void construirFacturacion()
        {
            String errorFac = "";

            if (ManejoClientesLogic.validarClienteParaFacturacion(codCliente, ref errorFac) && !chkInactivo.Checked)
            {
                btnActivarFacturacion.Visible = true;
            }

            txtPtsPadre.Attributes.Add("style", "color:Green;font-size:Medium;font-weight:bold;");
            txtPtsHijo1.Attributes.Add("style", "color:Green;font-size:Medium;font-weight:bold;");
            txtPtsHijo2.Attributes.Add("style", "color:Green;font-size:Medium;font-weight:bold;");
        }
Esempio n. 5
0
        private void llenarClientes()
        {
            Hashtable[] clientes = ManejoClientesLogic.obtenerClientes(codCliente);

            cargarPadre(clientes[0]);
            if (clientes[1] != null)
            {
                cargarHijo1(clientes[1]);
            }
            if (clientes[2] != null)
            {
                cargarHijo2(clientes[2]);
            }
        }
Esempio n. 6
0
        private void agregarMensajeHabilitado()
        {
            String errorFac = "";

            if (ManejoClientesLogic.validarClienteParaFacturacion(codCliente, ref errorFac) && !chkInactivo.Checked)
            {
                lblHabilitadoFacturacion.Visible   = true;
                lblHabilitadoFacturacion.ForeColor = Color.Green;
                lblHabilitadoFacturacion.Text      = "Habilitado, agradezcale al cliente";
            }
            else
            {
                lblHabilitadoFacturacion.Visible   = true;
                lblHabilitadoFacturacion.ForeColor = Color.Red;
                lblHabilitadoFacturacion.Text      = "NO HABILITADO PARA TRANSACCIÓN";
                lblErrorFacturacion.Text           = errorFac;
            }
        }
Esempio n. 7
0
        protected void facturar(object sender, EventArgs e)
        {
            String campos = "";

            if (validarDatosFacturar(ref campos))
            {
                lblErrorFacturacion.Text = "";
                Hashtable factura = armarHashFactura();

                bool bien = ManejoClientesLogic.cupoHabilitado(codCliente, factura);

                if (bien)
                {
                    bien = ManejoClientesLogic.guardarFactura(factura);

                    if (bien)
                    {
                        long puntos = Convert.ToInt64(factura["mvfac_puntosacum"]);
                        ManejoClientesLogic.sumarPuntos(codCliente, puntos);

                        string facturada = imprimir(factura["mvfac_codigo"].ToString().Replace("'", ""));
                        String redirect  = String.Format("{0}?process=VIP.ManejoClientes&fwdOpt={1}&codCliente={2}&facturada={3}",
                                                         indexPage, fwdOpt, codCliente, facturada);

                        Response.Redirect(redirect);
                    }
                    else
                    {
                        Utils.MostrarAlerta(Response, "Ocurrió un error al guardar los datos. Revise los logs para más información");
                    }
                }
                else
                {
                    Utils.MostrarAlerta(Response, "El cliente no tiene cupo disponible");
                }
            }
            else
            {
                Utils.MostrarAlerta(Response, "Existen Errores en los datos ingresados, por favor revise");
                lblErrorFacturacion.Text = campos;
            }
        }
Esempio n. 8
0
        private Hashtable armarHashFactura()
        {
            Hashtable hash   = new Hashtable();
            double    valFac = Convert.ToDouble(txtValorFac.Text);

            hash.Add("mvfac_codigo", String.Format("'{0}'", txtCodFac.Text.Trim()));
            hash.Add("mcli_codigo", String.Format("'{0}'", lblCodProdPadre.Text));
            hash.Add("mcli_codigocliente", String.Format("'{0}'", codCliente));
            hash.Add("mvfac_nombrecliente", String.Format("'{0}'", ManejoClientesLogic.getNombreCliente(codCliente)));
            hash.Add("tvfac_codigo", String.Format("'{0}'", ddlTipoFac.SelectedValue));
            hash.Add("tvest_codigo", String.Format("'{0}'", "AD"));
            hash.Add("mvfac_valor", String.Format("{0}", valFac));
            hash.Add("mvfac_fechatrans", String.Format("'{0}'", DateTime.Now.ToString("yyyy-MM-dd")));
            hash.Add("mvfac_fechapago", String.Format("'{0}'", ManejoClientesLogic.calcularFechaPago(txtFechaCorte.Text, txtFechaPagoFac.Text, valFac)));
            hash.Add("mvfac_diasprorroga", String.Format("{0}", 0));
            hash.Add("mvfac_puntosacum", String.Format("{0}", ManejoClientesLogic.obtenerPuntosFactura(valFac)));
            hash.Add("mvfac_numaval", String.Format("'{0}'", txtAval.Text.Trim()));
            hash.Add("susu_codigo", ManejoClientesLogic.getCodUsuario());

            return(hash);
        }
Esempio n. 9
0
        protected void redimir(Object sender, DataGridCommandEventArgs e)
        {
            string codRedencion = ((DataBoundLiteralControl)e.Item.Cells[0].Controls[0]).Text;

            string sql     = String.Format("select mvite_codigo from mvipredencion where mred_consecutivo={0}", codRedencion);
            string codItem = DBFunctions.SingleData(sql);

            sql = String.Format("select COALESCE(mvsal_cantidad, 0) from mvipsaldoitem where mvite_codigo='{0}' and pvbod_codigo='{1}'", codItem, codBodega);
            string cant     = DBFunctions.SingleData(sql);
            int    cantidad = cant == null || cant == "" ? 0 : Convert.ToInt32(cant);

            if (cantidad <= 0)
            {
                Utils.MostrarAlerta(Response, "Este item no tiene existencias!");
            }
            else
            {
                cantidad--;
                sql = String.Format("update mvipsaldoitem set mvsal_cantidad={0} where mvite_codigo='{1}' and pvbod_codigo='{2}'"
                                    , cantidad
                                    , codItem
                                    , codBodega);

                DBFunctions.NonQuery(sql);

                int codUsuario = ManejoClientesLogic.getCodUsuario();
                sql = String.Format("update mvipredencion set tred_codigo='REDIM', susu_codigo={1}, mred_fecha='{2}' where mred_consecutivo={0}"
                                    , codRedencion
                                    , codUsuario
                                    , DateTime.Now.ToString("yyyy-MM-dd"));
                DBFunctions.NonQuery(sql);

                imprimir(sender, e);

                String redirect = String.Format("{0}?process=VIP.Redenciones&codCliente={1}&reporte={2}",
                                                indexPage, codCliente, ViewState["reporte"]);

                Response.Redirect(redirect);
            }
        }
Esempio n. 10
0
        private void cargarPadre(Hashtable table)
        {
            txtNomPadre.Text = table["MCLI_NOMBRE"].ToString();
            txtApePadre.Text = table["MCLI_APELLIDO"].ToString();
            ddlTipoAfilPadre.SelectedValue = table["TAFI_CODIGO"].ToString();
            txtSAP.Text           = table["MCLI_SAP"].ToString();
            txtCedPadre.Text      = table["MCLI_NIT"].ToString();
            lblCodProdPadre.Text  = table["MCLI_CODIGO"].ToString();
            txtFechaExpPadre.Text = ((DateTime)table["MCLI_FECHEXPE"]).ToString("yyyy-MM-dd");
            txtTelfPadre.Text     = table["MCLI_TELEFONO"].ToString();
            txtDirPadre.Text      = table["MCLI_DIRECCION"].ToString();
            txtCapEnd.Text        = table["MCLI_CAPENDEU"].ToString();
            txtCupoDai.Text       = table["MCLI_CUPOCLI"].ToString();
            txtFechaCorte.Text    = table["MCLI_DIACORTE"].ToString();
            txtFin.Text           = table["MCLI_FINANCIERA"].ToString();
            txtPtsPadre.Text      = table["MCLI_PUNTOS"].ToString();

            txtCupoUtil.Text       = ManejoClientesLogic.getCupoUtilizado(table["MCLI_CODIGO"].ToString());
            txtCupoDisponible.Text = (Convert.ToInt64(txtCupoDai.Text) - Convert.ToInt64(txtCupoUtil.Text)).ToString();

            chkInactivo.Checked = table["MCLI_INACTIVO"].ToString().Equals("SI") ? true : false;
        }