Exemple #1
0
        public int updPreciosProdcuto(ProductoListaPrecio productoListaPrecio)
        {
            sp_Pedidos spRequestPedidos = new sp_Pedidos();
            DataDB     data             = new DataDB("SIVEDIBDEntities");

            StoreProcedure SP = spRequestPedidos.updPreciosProdcuto("SPR_UPD_CONDICION_PRODUCTO", productoListaPrecio);
            int            codigoProductoLista = data.ExecuteInsert(SP, "PO_NRESULT");

            return(codigoProductoLista);
        }
Exemple #2
0
        public int iuListaPreciosProducto(ProductoListaPrecio productoListaPrecio)
        {
            sp_Pedidos spRequestPedidos = new sp_Pedidos();
            DataDB     data             = new DataDB("SIVEDIBDEntities");

            StoreProcedure SP = spRequestPedidos.iuListaPreciosProducto("SPR_IU_PROD_LISTA_PRECIO", productoListaPrecio);
            int            codigoProductoLista = data.ExecuteInsert(SP, "PO_NRESULT");

            return(codigoProductoLista);
        }
        private void asignaProductos()
        {
            if (validaCampos())
            {
                prbPorcentajeCalculo.Value   = 0;
                prbPorcentajeCalculo.Minimum = 0;
                string strResultado;

                foreach (var item in chkListaProductos.CheckedItems)
                {
                    this.Refresh();
                    ProductoListaPrecio productoListaPrecio = new ProductoListaPrecio();
                    prbPorcentajeCalculo.Maximum = chkListaProductos.CheckedItems.Count;
                    prbPorcentajeCalculo.Value   = prbPorcentajeCalculo.Value + 1;
                    lblPercent.Text = Convert.ToInt32(prbPorcentajeCalculo.Value * 100 / (double)prbPorcentajeCalculo.Maximum) + "%";
                    var DatosProducto = ServicioGeneral.getProductos(5, 0, string.Empty, Convert.ToInt32(((ProductoCodigoVenta)item).CODIGO_VENTA));

                    productoListaPrecio.APLICA_SUPERA_MONTO_MIN = false;
                    productoListaPrecio.CODIGO_LISTA_PRECIOS    = Convert.ToInt32(cboListaPrecios.SelectedValue);
                    productoListaPrecio.CODIGO_PRODUCTO_LISTA   = 0;
                    productoListaPrecio.COSTO_PRODUCTO          = 0;
                    productoListaPrecio.ESFALTANTE_ANUNCIADO    = false;
                    productoListaPrecio.ES_ACCESORIO            = false;
                    productoListaPrecio.LIMITE_VENTA            = 999;
                    productoListaPrecio.CODIGO_VENTA            = Convert.ToInt32(((ProductoCodigoVenta)item).CODIGO_VENTA);
                    productoListaPrecio.PERMITE_DIGITAR         = false;
                    productoListaPrecio.PRECIO_LISTA            = 1;
                    productoListaPrecio.PUNTOS             = DatosProducto.FirstOrDefault().PUNTOS;
                    productoListaPrecio.SE_APLICA_ESCALA   = false;
                    productoListaPrecio.SUMA_LLEGAR_ESCALA = false;
                    productoListaPrecio.SUMA_NETO          = true;
                    productoListaPrecio.SUMA_VALOR_PUBLICO = false;

                    strResultado = Convert.ToString(ServicePedidos.iuListaPreciosProducto(productoListaPrecio));
                }

                for (int idx = 1; idx <= this.chkListaProductos.Items.Count - 1; idx++)
                {
                    this.chkListaProductos.SetItemCheckState(idx, CheckState.Unchecked);
                }

                MessageBox.Show("Productos asignados a la Lista de precios exitosamente", "Asignación", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                prbPorcentajeCalculo.Value   = 0;
                prbPorcentajeCalculo.Minimum = 0;
                lblPercent.Text = null;
                llenarGrillaProdLista();
                cargaProductos();
            }
        }
        private void CargaInformacion()
        {
            try
            {
                pbrCarga.Value   = 0;
                pbrCarga.Minimum = 0;
                this.Cursor      = Cursors.Default;
                pbrCarga.Maximum = dt.Rows.Count;

                for (var i = 0; i <= dt.Rows.Count - 1; i++)
                {
                    ProductoListaPrecio productoListaPrecio = new ProductoListaPrecio();
                    pbrCarga.Refresh();
                    pbrCarga.Value          = pbrCarga.Value + 1;
                    lblPorcentajeCarga.Text = Convert.ToInt32(pbrCarga.Value * 100 / (double)pbrCarga.Maximum) + "%";

                    DataRow row = dt.Rows[i];

                    productoListaPrecio.CODIGO_PRODUCTO_LISTA   = Convert.ToInt32(row[0]);
                    productoListaPrecio.PRECIO_LISTA            = Convert.ToDecimal(row[4]);
                    productoListaPrecio.LIMITE_VENTA            = Convert.ToInt32(row[5]);
                    productoListaPrecio.ES_PRINCIPAL            = row[6].ToString() == "1" ? true : false;
                    productoListaPrecio.PERMITE_DIGITAR         = row[7].ToString() == "1" ? true : false;
                    productoListaPrecio.SUMA_VALOR_PUBLICO      = row[8].ToString() == "1" ? true : false;
                    productoListaPrecio.SUMA_LLEGAR_ESCALA      = row[9].ToString() == "1" ? true : false;
                    productoListaPrecio.SE_APLICA_ESCALA        = row[10].ToString() == "1" ? true : false;
                    productoListaPrecio.APLICA_SUPERA_MONTO_MIN = row[11].ToString() == "1" ? true : false;
                    productoListaPrecio.SUMA_NETO            = row[12].ToString() == "1" ? true : false;
                    productoListaPrecio.ES_ACCESORIO         = row[13].ToString() == "1" ? true : false;
                    productoListaPrecio.PORCENTAJE_IVA       = Convert.ToDecimal(row[14]);
                    productoListaPrecio.COSTO_PRODUCTO       = Convert.ToDecimal(row[15]);
                    productoListaPrecio.PUNTOS               = Convert.ToInt32(row[16]);
                    productoListaPrecio.ESFALTANTE_ANUNCIADO = row[17].ToString() == "1" ? true : false;
                    productoListaPrecio.TIPO_PRODUCTO        = "STANDARD";
                    productoListaPrecio.PRECIO_CATALOGO      = Convert.ToDecimal(row[18]);
                    ServicePedidos.updPreciosProdcuto(productoListaPrecio);
                }
                MessageBox.Show("Archivo cargado exitosamente", "Carga de Información", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                lblPorcentajeCarga.Text = null;
                pbrCarga.Value          = 0;
                pbrCarga.Minimum        = 0;
                pbrCarga.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
Exemple #5
0
        public StoreProcedure updPreciosProdcuto(string spName, ProductoListaPrecio productoListaPrecio)
        {
            StoreProcedure storeProcedure = new StoreProcedure();

            storeProcedure.Nombre     = spName;
            storeProcedure.Parametros = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@PI_NCODIGO_PRODUCTO_LISTA",
                    SqlDbType     = System.Data.SqlDbType.Int,
                    Value         = productoListaPrecio.CODIGO_PRODUCTO_LISTA
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_NPRECIO_LISTA",
                    SqlDbType     = System.Data.SqlDbType.Decimal,
                    Value         = productoListaPrecio.PRECIO_LISTA
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_NLIMITE_VENTA",
                    SqlDbType     = System.Data.SqlDbType.Int,
                    Value         = productoListaPrecio.LIMITE_VENTA
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_OPERMITE_DIGITAR",
                    SqlDbType     = System.Data.SqlDbType.Bit,
                    Value         = productoListaPrecio.PERMITE_DIGITAR
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_OSUMA_VALOR_PUBLICO",
                    SqlDbType     = System.Data.SqlDbType.Bit,
                    Value         = productoListaPrecio.SUMA_VALOR_PUBLICO
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_OSUMA_LLEGAR_ESCALA",
                    SqlDbType     = System.Data.SqlDbType.Bit,
                    Value         = productoListaPrecio.SUMA_LLEGAR_ESCALA
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_OSE_APLICA_ESCALA",
                    SqlDbType     = System.Data.SqlDbType.Bit,
                    Value         = productoListaPrecio.SE_APLICA_ESCALA
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_OAPLICA_SUPERA_MONTO_MIN",
                    SqlDbType     = System.Data.SqlDbType.Bit,
                    Value         = productoListaPrecio.APLICA_SUPERA_MONTO_MIN
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_OES_ACCESORIO",
                    SqlDbType     = System.Data.SqlDbType.Bit,
                    Value         = productoListaPrecio.ES_ACCESORIO
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_NCOSTO_PRODUCTO",
                    SqlDbType     = System.Data.SqlDbType.Decimal,
                    Value         = productoListaPrecio.COSTO_PRODUCTO
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_OESFALTANTE_ANUNCIADO",
                    SqlDbType     = System.Data.SqlDbType.Bit,
                    Value         = productoListaPrecio.ESFALTANTE_ANUNCIADO
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_OESPRINCIPAL",
                    SqlDbType     = System.Data.SqlDbType.Bit,
                    Value         = productoListaPrecio.ES_PRINCIPAL
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_PORCENTAJEIVA",
                    SqlDbType     = System.Data.SqlDbType.Decimal,
                    Value         = productoListaPrecio.PORCENTAJE_IVA
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_CTIPO_PRODCUTO",
                    SqlDbType     = System.Data.SqlDbType.VarChar,
                    Value         = productoListaPrecio.TIPO_PRODUCTO
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_OSUMA_NETO",
                    SqlDbType     = System.Data.SqlDbType.Bit,
                    Value         = productoListaPrecio.SUMA_NETO
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_NPUNTO_PREMIO",
                    SqlDbType     = System.Data.SqlDbType.Int,
                    Value         = productoListaPrecio.PUNTOS
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_NPRECIO_CATALOGO",
                    SqlDbType     = System.Data.SqlDbType.Decimal,
                    Value         = productoListaPrecio.PRECIO_CATALOGO
                },
                new SqlParameter()
                {
                    ParameterName = "@PO_NRESULT",
                    SqlDbType     = System.Data.SqlDbType.Int,
                    Direction     = System.Data.ParameterDirection.Output,
                    Value         = productoListaPrecio.CODIGO_PRODUCTO_LISTA
                }
            };

            return(storeProcedure);
        }
Exemple #6
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            if (validaCampos())
            {
                try
                {
                    string strResult;
                    double iva = Convert.ToInt32(txtIvaProducto.Text);
                    ProductoListaPrecio productoListaPrecio = new ProductoListaPrecio();
                    productoListaPrecio.CODIGO_PRODUCTO_LISTA = clsConnection.intCodigoProducto;
                    productoListaPrecio.PRECIO_LISTA          = Convert.ToDecimal(txtPrecioVenta.Text);
                    productoListaPrecio.PRECIO_CATALOGO       = Convert.ToDecimal(txtPrecioVenta.Text);
                    productoListaPrecio.LIMITE_VENTA          = Convert.ToInt32(txtLimiteVenta.Text);
                    productoListaPrecio.COSTO_PRODUCTO        = Convert.ToDecimal(txtCostoProd.Text);
                    productoListaPrecio.PORCENTAJE_IVA        = Convert.ToDecimal(iva / 100);
                    productoListaPrecio.TIPO_PRODUCTO         = Convert.ToString(cboTipoProducto.SelectedValue);
                    productoListaPrecio.PUNTOS = Convert.ToInt32(txtPuntosOtorga.Text);
                    if (rdbSiPrincipal.Checked)
                    {
                        productoListaPrecio.ES_PRINCIPAL = true;
                    }
                    else if (rdbNoPrincipal.Checked)
                    {
                        productoListaPrecio.ES_PRINCIPAL = false;
                    }

                    if (rdbSidigita.Checked)
                    {
                        productoListaPrecio.PERMITE_DIGITAR = true;
                    }
                    else if (rdbNoDigita.Checked)
                    {
                        productoListaPrecio.PERMITE_DIGITAR = false;
                    }

                    if (rdbSiValorPublico.Checked)
                    {
                        productoListaPrecio.SUMA_VALOR_PUBLICO = true;
                    }
                    else if (rdbNoValorPublico.Checked)
                    {
                        productoListaPrecio.SUMA_VALOR_PUBLICO = false;
                    }

                    if (rdbSiLlegaEscala.Checked)
                    {
                        productoListaPrecio.SUMA_LLEGAR_ESCALA = true;
                    }
                    else if (rdbNoLlegaEscala.Checked)
                    {
                        productoListaPrecio.SUMA_LLEGAR_ESCALA = false;
                    }

                    if (rdbSiNeto.Checked)
                    {
                        productoListaPrecio.SUMA_NETO = true;
                    }
                    else if (rdbNoNeto.Checked)
                    {
                        productoListaPrecio.SUMA_NETO = false;
                    }

                    if (rdbSiAplicaEscala.Checked)
                    {
                        productoListaPrecio.SE_APLICA_ESCALA = true;
                    }
                    else if (rdbNoAplicaEscala.Checked)
                    {
                        productoListaPrecio.SE_APLICA_ESCALA = false;
                    }

                    if (rdbSiMontoMinimo.Checked)
                    {
                        productoListaPrecio.APLICA_SUPERA_MONTO_MIN = true;
                    }
                    else if (rdbNoMontoMinimo.Checked)
                    {
                        productoListaPrecio.APLICA_SUPERA_MONTO_MIN = false;
                    }

                    if (rdbSiAccesorio.Checked)
                    {
                        productoListaPrecio.ES_ACCESORIO = true;
                    }
                    else if (rdbNoAccesorio.Checked)
                    {
                        productoListaPrecio.ES_ACCESORIO = false;
                    }

                    if (rdbSiFaltante.Checked)
                    {
                        productoListaPrecio.ESFALTANTE_ANUNCIADO = true;
                    }
                    else if (rdbNoFaltante.Checked)
                    {
                        productoListaPrecio.ESFALTANTE_ANUNCIADO = false;
                    }
                    strResult = Convert.ToString(ServicePedidos.updPreciosProdcuto(productoListaPrecio));

                    if (Information.IsNumeric(strResult))
                    {
                        if (Convert.ToInt32(strResult) == 1)
                        {
                            MessageBox.Show("Registro Actualizado exitosamente", "Actualización", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Error al grabar en la Base de Datos, contacte al Administrador del Sistema", "Error BD", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error al generar archivo", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
        }