private void RestaurarDatosProducto_sesion() { EventoLlenarLista(); EventoLlenarListaProveedores(); Articulos oArticulo = new Articulos(); oArticulo = (Articulos)LeerVariableSesion("oArticulo"); if (oArticulo != null) { txtCodigo.Text = oArticulo.ArtCod.ToString(); txtDescripcion.Text = oArticulo.ArtDescripcion; txtStock.Text = oArticulo.ArtStock.ToString(); //txtStockMax.Text = drArticulo["artStockMax"].ToString(); //txtStockMin.Text = drArticulo["artStockMin"].ToString(); txtFecVencimiento.Text = oArticulo.ArtFecRegis.ToString(); txtCostoPromedio.Text = oArticulo.ArtCostoProm.ToString(); chkestado.Checked = oArticulo.Artestado; ListItem liElegido; //si DropDownList está visible if (ddlUnidadMedida.Items.Count > 0) { liElegido = ddlUnidadMedida.Items.FindByValue(oArticulo.UniCod.ToString()); ddlUnidadMedida.SelectedIndex = ddlUnidadMedida.Items.IndexOf(liElegido); } ListItem liElegidoProveedor; //si DropDownList está visible if (ddlProveedor.Items.Count > 0) { liElegidoProveedor = ddlProveedor.Items.FindByValue(oArticulo.PrvCod.ToString()); ddlProveedor.SelectedIndex = ddlProveedor.Items.IndexOf(liElegidoProveedor); } //CONSULTAR PRECIOS Y LOTES DEL PRODUCTO MostrarPreciosLotes(oArticulo.ArtCod); //pnlBusqueda.Visible = false; //pnlProductos.Visible = false; //pnlEditProductos.Visible = true; //pnlListaPrecios.Visible = true; //pnlDetallePrecio.Visible = false; //lblMensajes.Visible = false; } }
private void EventoModificarProducto() { EventoLlenarLista(); EventoLlenarListaProveedores(); int linProCodigo; linProCodigo = (int)LeerVariableSesion("proCodigo"); DataRow drArticulo; CArticulo objArticulo = new CArticulo(); drArticulo = objArticulo.fnDatosArticulo(linProCodigo); Articulos oArticulo = new Articulos(); clsArticulos lstArticulos = new clsArticulos(); oArticulo = lstArticulos.GetArticulo(linProCodigo); this.AgregarVariableSession("oArticulo", oArticulo); if (drArticulo != null) { txtCodigo.Text = drArticulo["artCod"].ToString(); txtDescripcion.Text = drArticulo["artDescripcion"].ToString(); //grabamos el stock del producto decimal ldeStockProducto = 0; if (drArticulo["artStock"] != null) ldeStockProducto = Convert.ToDecimal( drArticulo["artStock"]); txtStock.Text = ldeStockProducto.ToString(); this.AgregarVariableSession("stockProducto", ldeStockProducto); //txtStockMax.Text = drArticulo["artStockMax"].ToString(); //txtStockMin.Text = drArticulo["artStockMin"].ToString(); txtFecVencimiento.Text = drArticulo["artFecVen"].ToString(); txtCostoPromedio.Text = drArticulo["artCostoProm"].ToString(); txtPeso.Text = drArticulo["artPeso"].ToString(); chkestado.Checked = Convert.ToBoolean( drArticulo["artEstado"]); ListItem liElegido; //si DropDownList está visible if (ddlUnidadMedida.Items.Count > 0) { liElegido = ddlUnidadMedida.Items.FindByValue(drArticulo["UniCod"].ToString()); ddlUnidadMedida.SelectedIndex = ddlUnidadMedida.Items.IndexOf(liElegido); } ListItem liElegidoProveedor; //si DropDownList está visible if (ddlProveedor.Items.Count > 0) { liElegidoProveedor = ddlProveedor.Items.FindByValue(drArticulo["PrvCod"].ToString()); ddlProveedor.SelectedIndex = ddlProveedor.Items.IndexOf(liElegidoProveedor); } //CONSULTAR PRECIOS Y LOTES DEL PRODUCTO MostrarPreciosLotes(linProCodigo); //MODIFICAR , se guarda en variable cache AgregarVariableSession("operacion", 2); pnlBusqueda.Visible = false; pnlProductos.Visible = false; pnlEditProductos.Visible = true; pnlListaPrecios.Visible = true; pnlDetallePrecio.Visible = false; lblMensajes.Visible = false; btnNuevoPrecio.Visible = true; } }
private void GuardarDatosProducto_Sesion() { int linOperacion = (int)LeerVariableSesion("operacion"); Articulos oArticulo = new Articulos(); if (string.IsNullOrEmpty(txtCodigo.Text)) oArticulo.ArtCod = 0; else oArticulo.ArtCod = Convert.ToInt32(txtCodigo.Text); oArticulo.ArtDescripcion = txtDescripcion.Text.ToUpper(); oArticulo.ArtCostoProm = Convert.ToDecimal( txtCostoPromedio.Text); oArticulo.Artestado = chkestado.Checked; oArticulo.ArtStock = Convert.ToDecimal( txtStock.Text); //oArticulo.ArtStockMax = Convert.ToDecimal(txtStockMax.Text); //oArticulo.ArtStockMin = Convert.ToDecimal(txtStockMin.Text); oArticulo.ArtFecVen = DateTime.Parse(txtFecVencimiento.Text); if (linOperacion == 1) //NUEVO oArticulo.ArtFecRegis = DateTime.Today; oArticulo.UniCod = Convert.ToInt32(ddlUnidadMedida.SelectedItem.Value); if (ddlProveedor.Items.Count > 0) oArticulo.PrvCod = Convert.ToInt32(ddlProveedor.SelectedItem.Value); else oArticulo.PrvCod = 0; AgregarVariableSession("nuevoProducto", oArticulo); }
protected void lsbArticulos_SelectedIndexChanged(object sender, EventArgs e) { nTasIGV = double.Parse(lblTasIGV.Value); int ArtCod = 0; int PrvCod = 0; int LotNro = 0; double LprPrecio = 0.0; double LprDscto = 0.0; double nPrecio = 0.0; ArtCod = int.Parse(lsbArticulos.SelectedValue); PrvCod = int.Parse(ddlLaboratorios.SelectedValue); txtLotVenci.Text = ""; txtLotNro.Text = ""; txtLotStock.Text = "0"; clsArticulos lstArticulos = new clsArticulos(); clsListaPrecios lstPrecios = new clsListaPrecios(); clsLotesArt lstLotesArt = new clsLotesArt(); Articulos oArticulo = new Articulos(); ListaPrecios oPrecio = new ListaPrecios(); LotesArt oLoteArt = new LotesArt(); txtLotNro.Enabled = false; txtLotVenci.Enabled = false; txtLotStock.Enabled = false; txtArtDescuento.Enabled = true; oPrecio = lstPrecios.GetArticuloPrecio(ArtCod); oLoteArt = lstLotesArt.GetLoteArt(ArtCod); //oLoteArt.ListaPrecios.Articulos oArticulo = lstArticulos.GetArticulo(ArtCod); if (oArticulo != null) { txtArtCod.Text = oArticulo.ArtCod.ToString(); txtArtUniMed.Text = oArticulo.Unidades.UniDescripcion; txtStockFact.Text = oArticulo.ArtStockFac.ToString(); txtStockFis.Text = oArticulo.ArtStock.ToString(); hideStockLote.Value = lstLotesArt.GetLoteArtStock(ArtCod).ToString(); if (oLoteArt != null) { txtLotNro.Text = oLoteArt.LotNro.ToString(); txtLotStock.Text = oLoteArt.LotStock.ToString(); if (oLoteArt.LotFecVenci != null) txtLotVenci.Text = ((DateTime)oLoteArt.LotFecVenci).ToString("yyyy-MM-dd"); } if (oArticulo.ArtStock <= 0) txtStockFis.ForeColor = System.Drawing.Color.Red; else txtStockFis.ForeColor = System.Drawing.Color.Gray; txtArtPreUnitario.Text = lstPrecios.GetCostoPromedio(ArtCod, nTasIGV).ToString(); //if (oPrecio == null) // txtArtPreUnitario.Text = "0.0"; //else //{ // nPrecio = (double)oPrecio.LprPrecio; // var nDcto = Math.Round((nPrecio * (double)oPrecio.LprDscto / 100), 2); // nPrecio -= nDcto; // var nFlete = Math.Round(nPrecio / 100, 2); // nPrecio += nFlete; // var nIgv = Math.Round(nPrecio * nTasIGV, 2); // nPrecio += nIgv; // if (oArticulo.Proveedores.PrvGanancia != 0) // nPrecio = Math.Round((nPrecio * (double)oArticulo.Proveedores.PrvGanancia), 2); // txtArtPreUnitario.Text = nPrecio.ToString(); //} if (BuscarArticulo(oArticulo.ArtCod, ref LotNro, ref LprPrecio, ref LprDscto)) { txtArtDescuento.Enabled = false; txtArtDescuento.Text = LprDscto.ToString(); } else { txtArtDescuento.Enabled = true; txtArtDescuento.Text = "0"; } txtArtCant.Text = "1"; } else txtArtCant.Text = "0"; txtImpTotal.Text = "0.0"; lstArticulos = null; oArticulo = null; lstPrecios = null; oPrecio = null; CalcularTotalArticulo(); lsbArticulos.Focus(); }
protected void lsbArticulos_SelectedIndexChanged(object sender, EventArgs e) { int ArtCod = 0; int LotNro = 0; double LprPrecio = 0.0; double LprDscto = 0.0; if (lsbArticulos.SelectedValue != "") ArtCod = int.Parse(lsbArticulos.SelectedValue); clsArticulos lstArticulos = new clsArticulos(); clsListaPrecios lstPrecios = new clsListaPrecios(); clsLotesArt lstLotesArt = new clsLotesArt(); Articulos oArticulo = new Articulos(); ListaPrecios oPrecio = new ListaPrecios(); oPrecio = lstPrecios.GetArticuloPrecio(ArtCod); oArticulo = lstArticulos.GetArticulo(ArtCod); if (oArticulo != null) { txtArtCod.Text = oArticulo.ArtCod.ToString(); txtArtUniMed.Text = oArticulo.Unidades.UniDescripcion; txtStockFact.Text = oArticulo.ArtStockFac.ToString(); txtStockFis.Text = oArticulo.ArtStock.ToString(); txtArtDescuento.Text = (oArticulo.Proveedores.PrvDscto).ToString(); ddlTipDcto.SelectedValue = "%"; txtLotVenci.Text = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd"); ddlLaboratorios.SelectedValue = oArticulo.PrvCod.ToString(); hideStockLote.Value = lstLotesArt.GetLoteArtStock(ArtCod).ToString(); if (oArticulo.ArtStock <= 0) { txtStockFis.ForeColor = System.Drawing.Color.Red; } else { txtStockFis.ForeColor = System.Drawing.Color.Gray; } if (oPrecio == null) { txtArtPreUnitario.Text = "0.0"; } else { txtArtPreUnitario.Text = oPrecio.LprPrecio.ToString(); } if (BuscarArticulo(oArticulo.ArtCod, ref LotNro, ref LprPrecio, ref LprDscto)) { if (lblEstadoVenArticulo.Value == "NORMAL") txtArtPreUnitario.Enabled = false; else txtArtPreUnitario.Enabled = true; txtLotNro.Enabled = false; txtLotNro.Text = LotNro.ToString(); txtArtPreUnitario.Text = LprPrecio.ToString(); } else { txtArtPreUnitario.Enabled = true; txtLotNro.Enabled = true; LotNro = lstLotesArt.MaxLotNro(ArtCod); txtLotNro.Text = (LotNro + 1).ToString(); } if (lblEstadoVenArticulo.Value == "NORMAL") txtArtCant.Text = "1"; } else LimpiarCamposArticulos(); txtImpTotal.Text = "0.0"; lstArticulos = null; oArticulo = null; lstPrecios = null; oPrecio = null; lstLotesArt = null; CalcularTotalArticulo(); lsbArticulos.Focus(); }
/// <summary> /// Método desusado para agregar un nuevo objeto al EntitySet Articulos. Considere la posibilidad de usar el método .Add de la propiedad ObjectSet<T> asociada. /// </summary> public void AddToArticulos(Articulos articulos) { base.AddObject("Articulos", articulos); }
/// <summary> /// Crear un nuevo objeto Articulos. /// </summary> /// <param name="artCod">Valor inicial de la propiedad ArtCod.</param> /// <param name="artDescripcion">Valor inicial de la propiedad ArtDescripcion.</param> /// <param name="artStock">Valor inicial de la propiedad ArtStock.</param> /// <param name="artStockFac">Valor inicial de la propiedad ArtStockFac.</param> /// <param name="artestado">Valor inicial de la propiedad Artestado.</param> public static Articulos CreateArticulos(global::System.Int32 artCod, global::System.String artDescripcion, global::System.Decimal artStock, global::System.Decimal artStockFac, global::System.Boolean artestado) { Articulos articulos = new Articulos(); articulos.ArtCod = artCod; articulos.ArtDescripcion = artDescripcion; articulos.ArtStock = artStock; articulos.ArtStockFac = artStockFac; articulos.Artestado = artestado; return articulos; }
protected void lsbArticulos_SelectedIndexChanged(object sender, EventArgs e) { nTasIGV = double.Parse(lblTasIGV.Value); int ArtCod = 0; int PrvCod = 0; int LotNro = 0; double LprPrecio = 0.0; double LprDscto = 0.0; double nTipCam = g_nTipoCambio; //VARIABLES PARA TOMAR PRECIO SIN CALCULAR FLETE E IGV DateTime dLotFecRegis = DateTime.Today; int nLotNro; double nLprPrecio = 0.0; ArtCod = int.Parse(lsbArticulos.SelectedValue); PrvCod = int.Parse(ddlLaboratorios.SelectedValue); txtLotVenci.Text = ""; txtLotNro.Text = ""; txtLotStock.Text = "0"; clsArticulos lstArticulos = new clsArticulos(); clsLotesArt lstLotesArt = new clsLotesArt(); Articulos oArticulo = new Articulos(); LotesArt oLoteArt = new LotesArt(); txtLotNro.Enabled = false; txtLotVenci.Enabled = false; txtLotStock.Enabled = false; txtArtDescuento.Enabled = true; oLoteArt = lstLotesArt.GetLoteArt(ArtCod); if (oLoteArt != null) { nLotNro = oLoteArt.LotNro; if (oLoteArt.LotFecModi.HasValue) dLotFecRegis = oLoteArt.LotFecRegis.Value; if (oLoteArt.LotPrecioVen.HasValue) nLprPrecio = (double)oLoteArt.LotPrecioVen; } else nLotNro = 0; oArticulo = lstArticulos.GetArticulo(ArtCod); nLprPrecio = (double)oArticulo.ArtCostoProm; if (oArticulo != null) { txtArtCod.Text = oArticulo.ArtCod.ToString(); txtArtUniMed.Text = oArticulo.Unidades.UniDescripcion; txtStockFact.Text = oArticulo.ArtStockFac.ToString(); txtStockFis.Text = oArticulo.ArtStock.ToString(); hideStockLote.Value = lstLotesArt.GetLoteArtStock(ArtCod).ToString(); if (oLoteArt != null) { txtLotNro.Text = oLoteArt.LotNro.ToString(); txtLotStock.Text = oLoteArt.LotStock.ToString(); if (oLoteArt.LotFecVenci != null) txtLotVenci.Text = ((DateTime)oLoteArt.LotFecVenci).ToString("yyyy-MM-dd"); else txtLotVenci.Text = DateTime.Today.ToString("yyyy-MM-dd"); } if (oArticulo.ArtStock <= 0) txtStockFis.ForeColor = System.Drawing.Color.Red; else txtStockFis.ForeColor = System.Drawing.Color.Gray; //if (nLotNro == 1 && DateTime.Compare(dLotFecRegis, DateTime.Parse("2013-04-09")) == 0) // txtArtPreUnitario.Text = Math.Round(((nLprPrecio * (double)oArticulo.Proveedores.PrvGanancia) / nTipCam), 2).ToString(); //else // txtArtPreUnitario.Text = Math.Round((lstPrecios.GetCostoPromedio(ArtCod, nTasIGV) / nTipCam), 2).ToString(); /////Cambio hecho 06-06-2013 se desea q se muestre elprecio venta q se ve en el modulo almacen -articulos/// //////////silvia//////////////////////////////////////////////////////////////////////////////////////////// txtArtPreUnitario.Text = Math.Round(((nLprPrecio) / nTipCam), 2).ToString("0.00"); //////////////////////////////////////////////////////////////////////////////////////////////////////////// //txtArtPreUnitario.Text = Math.Round((lstPrecios.GetCostoPromedio(ArtCod, nTasIGV) / nTipCam), 2).ToString(); if (BuscarArticulo(oArticulo.ArtCod, ref LotNro, ref LprPrecio, ref LprDscto)) { txtArtDescuento.Enabled = false; txtArtDescuento.Text = LprDscto.ToString(); } else { txtArtDescuento.Enabled = true; txtArtDescuento.Text = "0"; } txtArtCant.Text = "1"; } else txtArtCant.Text = "0"; txtImpTotal.Text = "0.0"; lstArticulos = null; oArticulo = null; CalcularTotalArticulo(); lsbArticulos.Focus(); }