private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { var row = gVProductos.GetRow(gVProductos.FocusedRowHandle) as Producto; if (row != null) { barButtonItem3.Caption = row.Nombre; barButtonItem1.Caption = string.Format("COD{0}:", row.IDProducto); pictureEdit1.Image = null; if (row.FotoProducto != null) { pictureEdit1.Image = TratadoImagen.Convertir_Bytes_Imagen(row.FotoProducto); } #region Auditoria Inventario var kardex1 = (new KardexBLL().Datos. Where(x => x.IDProducto == row.IDProducto)).Take(50).ToList(); gCAuditoriaInventario.DataSource = kardex1; #endregion #region Producto Historial gCMovimientoProducto.DataSource = new Ajustes().Movimiento(row.IDProducto); #endregion } }
private void xfAccesoUsuario_Load(object sender, EventArgs e) { p = new Repository <Parametros>(); var aux = p.GetAll().First(); txtSecuencial.EditValue = aux.NumFactura; txtIva.EditValue = aux.Iva; if (aux.Foto != null && aux.Foto.Length > 0) { pEFoto.Image = TratadoImagen.Convertir_Bytes_Imagen(aux.Foto); } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { var aux = p.GetAll().First(); try { if (!string.IsNullOrEmpty(txtNuevoSecuencial.Text) && Convert.ToInt16(txtNuevoSecuencial.Text) > 0) { aux.NumFactura = Convert.ToInt32(txtNuevoSecuencial.Text); } if (!string.IsNullOrEmpty(txtNuevoIva.Text) && Convert.ToInt16(txtNuevoIva.Text) > 0) { aux.Iva = Convert.ToInt32(txtNuevoIva.Text); } if (!string.IsNullOrEmpty(pEFoto.EditValue.ToString())) { aux.Foto = TratadoImagen.Convertir_Imagen_Bytes(pEFoto.Image); } else { aux.Foto = null; } if (!p.Update(aux)) { throw new Exception(p.Error); } for (int i = 0; i < 100; i++) { System.Threading.Thread.Sleep(30); progressBarControl1.EditValue = Convert.ToInt16(progressBarControl1.EditValue) + 1; } } catch (Exception ex) { backgroundWorker1.Dispose(); this.Hide(); XtraMessageBox.Show(ex.Message); this.Visible = true; } }
private void Carga() { txtCodigo.EditValue = producto_.IDProducto; chEstado.Checked = producto_.Estado == "A" ? true : false; txtExistencia1.EditValue = producto_.ExistenciaActual; txtDescripcion.EditValue = producto_.Nombre; txtCosto.EditValue = string.Empty; txtPrecioReal.EditValue = producto_.PCAnterior; txtPrecioVenta.EditValue = producto_.PVenta1; cbxIva.SelectedIndex = Convert.ToBoolean(producto_.Iva) ? 1 : 0; txtExistenciaMinima.EditValue = producto_.ExistenciaMinima; txtUtilidad.EditValue = string.Empty; txtCodigoRapido.EditValue = producto_.CodRapido; lookUnidadMedida.EditValue = producto_.IDMedidaMetrica; txtCodigoBarra.EditValue = producto_.CodBarra; lookCategoria.EditValue = producto_.IDGrupo; txtExistenciaActual.EditValue = producto_.ExistenciaActual; lookMarca.EditValue = producto_.IDMarca; //lookEUbicacion.EditValue = producto_.IDUbicacion; pEFoto.EditValue = string.Empty; chNotificar.Checked = false; dtFechaExpiracion.EditValue = string.Empty; chMostrarNotificacion.EditValue = false; //chHabilitar2.Checked = Convert.ToBoolean(producto_.StateMedida2); txtPrecio2.EditValue = producto_.PVenta2; //txtApartir2.EditValue = producto_.Equivalencia2; //txtPrecio2.Enabled = txtApartir2.Enabled = chHabilitar2.Checked; //chHabilitar3.Checked = Convert.ToBoolean(producto_.StateMedida3); txtPrecio3.EditValue = producto_.PVenta3; txtPrecio4.EditValue = producto_.PVenta4; //txtApartir3.EditValue = producto_.Equivalencia3; //txtPrecio3.Enabled = txtApartir3.Enabled = chHabilitar3.Checked; chNotificar.Checked = Convert.ToBoolean(producto_.Notificar); dtFechaExpiracion.EditValue = producto_.FechaExpiracion; dtFechaExpiracion.Enabled = chNotificar.Checked; chMostrarNotificacion.Checked = Convert.ToBoolean(producto_.MostraNotificar); if (producto_.FotoProducto != null && producto_.FotoProducto.Length > 0) { pEFoto.Image = TratadoImagen.Convertir_Bytes_Imagen(producto_.FotoProducto); } //buscamos todos los proveedores de ese producto try { var pro = new Repository <Proveedor>().Search(x => x.IDProducto == producto_.IDProducto); var prove = new List <Cliente>(); var repoPro = new Repository <Cliente>(); foreach (var row in pro) { var aux = repoPro.Find(x => x.IDCliente == row.IDCliente); prove.Add(aux); } gridControl1.DataSource = prove; } catch (Exception) { } }
private void Guardar() { try { if (string.IsNullOrEmpty(txtDescripcion.Text) && string.IsNullOrEmpty(txtDescripcion.Text.Trim())) { throw new Exception("Ingrese el detalle del producto para continuar"); } var prod = new Repository <Producto>(); Producto producto = prod.Find(x => x.IDProducto == producto_.IDProducto); producto.FechaSistema = DateTime.Now; producto.Estado = (chEstado.CheckState == CheckState.Checked) ? "A" : "E"; producto.NombreAnterior = producto.Nombre; producto.Nombre = txtDescripcion.Text; producto.EdNombre = true; producto.PVAnterior1 = producto.PVenta1; producto.PVenta1 = string.IsNullOrEmpty(txtPrecioVenta.Text) ? 0 : Convert.ToDecimal(txtPrecioVenta.Text); producto.Iva = (cbxIva.EditValue.Equals("No")) ? false : true; producto.Equivalencia1 = 1; producto.EdPVenta1 = true; producto.ExistenciaMinima = string.IsNullOrEmpty(txtExistenciaMinima.Text) ? 0 : Convert.ToInt32(txtExistenciaMinima.Text); producto.CodRapido = txtCodigoRapido.Text; //producto. producto.CodRapido = txtCodigoRapido.Text; producto.IDMedidaMetrica = (lookUnidadMedida.EditValue == null) ? 1 : Convert.ToInt32(lookUnidadMedida.EditValue); producto.CodBarra = txtCodigoBarra.Text; producto.IDGrupo = (lookCategoria.EditValue == null) ? 1 : Convert.ToInt32(lookCategoria.EditValue); if (string.IsNullOrEmpty(txtInventarioInicial.Text)) { producto.ExistenciaActual = Convert.ToInt16(txtExistenciaActual.Text); } else { var a1 = (string.IsNullOrEmpty(txtExistenciaActual.Text)) ? 0 : Convert.ToInt32(txtExistenciaActual.Text); var b1 = Convert.ToInt32(txtInventarioInicial.Text); producto.ExistenciaActual = a1 + b1; } producto.PCAnterior = string.IsNullOrEmpty(txtPrecioReal.Text) ? 0 : Convert.ToDecimal(txtPrecioReal.Text); producto.IDMarca = (lookMarca.EditValue == null) ? 1 : Convert.ToInt32(lookMarca.EditValue); //producto.IDUbicacion = (lookEUbicacion.EditValue == null) ? 1 : Convert.ToInt32(lookEUbicacion.EditValue); //codicion 1 producto.PVAnterior2 = producto.PVenta2; producto.PVenta2 = string.IsNullOrEmpty(txtPrecio2.Text) ? 0 : Convert.ToDecimal(txtPrecio2.Text); //producto.Equivalencia2 = string.IsNullOrEmpty(txtApartir2.Text) ? 0 : Convert.ToInt16(txtApartir2.Text); //producto.StateMedida2 = chHabilitar2.Checked; producto.EdPVenta2 = true; //condicion 2 producto.PVAnterior3 = producto.PVenta3; producto.PVenta3 = string.IsNullOrEmpty(txtPrecio3.Text) ? 0 : Convert.ToDecimal(txtPrecio3.Text); //producto.Equivalencia3 = string.IsNullOrEmpty(txtApartir3.Text) ? 0 : Convert.ToInt16(txtApartir3.Text); //producto.StateMedida3 = chHabilitar3.Checked; producto.EdPVenta3 = true; producto.PVenta4 = string.IsNullOrEmpty(txtPrecio4.Text) ? 0 : Convert.ToDecimal(txtPrecio4.Text); producto.Notificar = chNotificar.Checked; producto.FechaExpiracion = dtFechaExpiracion.DateTime; producto.MostraNotificar = chMostrarNotificacion.Checked; if (!string.IsNullOrEmpty(pEFoto.EditValue.ToString())) { producto.FotoProducto = TratadoImagen.Convertir_Imagen_Bytes(pEFoto.Image); } if (!prod.Update(producto)) { this.Hide(); XtraMessageBox.Show(prod.Error); this.Visible = true; } else { var kard = new Repository <Kardex>(); if (!string.IsNullOrEmpty(txtInventarioInicial.Text)) { var tmp1 = kard.GetAll(); int con1 = 0; if (tmp1 == null) { con1 = 1; } else { con1 = tmp1.Count + 1; } kard.Create(new Kardex { IDKardex = con1, IDProducto = producto.IDProducto, ProductoEntra = Convert.ToInt16(txtInventarioInicial.Text), ProductoEntraPrecio = 0, ProductoSale = 0, ProductoSalePrecio = 0, IVA = (producto.Iva != null) ? Convert.ToInt16(General.Iva) : 0, IDFactura = "I" + con1, Estado = "A", Fecha = DateTime.Now, FechaSistema = DateTime.Now, Equivalencia = Convert.ToInt16(txtInventarioInicial.Text), IdMedidaMetrica = producto.MedidaMetrica.IdMedidaMetrica, IDUbicacion = producto.IDUbicacion, Referencia = 0, Siclo = "R" }); } } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }
private void Guardar() { try { if (string.IsNullOrEmpty(txtDescripcion.Text) || string.IsNullOrEmpty(txtDescripcion.Text.Trim())) { throw new Exception("Ingrese la descripcion del producto, para poder continuar"); } var prod = new Repository <Producto>(); var tmp = prod.GetAll(); int rowMax = 0; if (tmp == null) { rowMax = 0; } else { rowMax = tmp.Count; } rowMax++; Producto producto = new Producto(); producto.IDProducto = rowMax; producto.Nombre = txtDescripcion.Text; producto.Iva = (cbxIva.EditValue.Equals("No")) ? false : true; producto.Equivalencia1 = 1; producto.Estado = "A"; producto.FechaSistema = DateTime.Now; //producto. producto.CodRapido = txtCodigoRapido.Text; producto.IDMedidaMetrica = (lookUnidadMedida.EditValue == null) ? 1 : Convert.ToInt32(lookUnidadMedida.EditValue); producto.IDGrupo = (lookCategoria.EditValue == null) ? 1 : Convert.ToInt32(lookCategoria.EditValue); producto.IDMarca = (lookMarca.EditValue == null) ? 1 : Convert.ToInt32(lookMarca.EditValue); //producto.IDUbicacion = (lookEUbicacion.EditValue == null) ? 1 : Convert.ToInt32(lookEUbicacion.EditValue); //codicion 1 //producto.Equivalencia2 = string.IsNullOrEmpty(txtApartir2.Text) ? 0 : Convert.ToInt16(txtApartir2.Text); //producto.StateMedida2 = chHabilitar2.Checked; //condicion 2 //producto.Equivalencia3 = string.IsNullOrEmpty(txtApartir3.Text) ? 0 : Convert.ToInt16(txtApartir3.Text); //producto.StateMedida3 = chHabilitar3.Checked; producto.ExistenciaMinima = string.IsNullOrEmpty(txtExistenciaMinima.Text) ? 0 : Convert.ToInt32(txtExistenciaMinima.Text); producto.ExistenciaActual = string.IsNullOrEmpty(txtInventarioInicial.Text) ? 0 : Convert.ToInt32(txtInventarioInicial.Text); producto.Notificar = chNotificar.Checked; producto.FechaExpiracion = dtFechaExpiracion.DateTime; producto.MostraNotificar = chMostrarNotificacion.Checked; //if (string.IsNullOrEmpty(txtInventarioInicial.Text)) //{ // producto.ExistenciaActual = Convert.ToInt16(txtExistenciaActual.Text); //} //else //{ // var a1 = (string.IsNullOrEmpty(txtExistenciaActual.Text)) ? 0 : Convert.ToInt32(txtExistenciaActual.Text); // var b1 = Convert.ToInt32(txtInventarioInicial.Text); // producto.ExistenciaActual = a1 + b1; //} producto.PVenta1 = string.IsNullOrEmpty(txtPrecioVenta.Text) ? 0 : Convert.ToDecimal(txtPrecioVenta.Text); producto.PVenta2 = string.IsNullOrEmpty(txtPrecio2.Text) ? 0 : Convert.ToDecimal(txtPrecio2.Text); producto.PVenta3 = string.IsNullOrEmpty(txtPrecio3.Text) ? 0 : Convert.ToDecimal(txtPrecio3.Text); producto.PVenta4 = string.IsNullOrEmpty(txtPrecio4.Text) ? 0 : Convert.ToDecimal(txtPrecio4.Text); producto.PCAnterior = string.IsNullOrEmpty(txtPrecioReal.Text) ? 0 : Convert.ToDecimal(txtPrecioReal.Text); if (pEFoto.Image != null) { producto.FotoProducto = TratadoImagen.Convertir_Imagen_Bytes(pEFoto.Image); } if (prod.Create(producto) == null) { XtraMessageBox.Show(prod.Error); } else { var kard = new Repository <Kardex>(); if (!string.IsNullOrEmpty(txtInventarioInicial.Text)) { var tmp1 = kard.GetAll(); int con1 = 0; if (tmp1 == null) { con1 = 1; } else { con1 = tmp1.Count + 1; } kard.Create(new Kardex { IDKardex = con1, IDProducto = producto.IDProducto, ProductoEntra = Convert.ToInt16(txtInventarioInicial.Text), ProductoEntraPrecio = string.IsNullOrEmpty(txtPrecioReal.Text)?0:Convert.ToDecimal(txtPrecioReal.Text), ProductoSale = 0, ProductoSalePrecio = 0, IVA = (producto.Iva != null) ? Convert.ToInt16(General.Iva) : 0, IDFactura = "I" + con1, Estado = "A", Fecha = DateTime.Now, FechaSistema = DateTime.Now, Equivalencia = Convert.ToInt16(txtInventarioInicial.Text), IdMedidaMetrica = producto.IDMedidaMetrica, Referencia = 0, IDUbicacion = producto.IDUbicacion, Siclo = "R" }); } var resp = aux.Lista; dt.DataSource = resp; this.unEvento(dt, resp.Count - 1); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }