private void gvDetalle_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { VwEntradaalmacendet itemSel = (VwEntradaalmacendet)gvDetalle.GetFocusedRow(); string nameColumn = e.Column.FieldName; switch (nameColumn) { case "Cantidadverificada": if (itemSel.Cantidadverificada > itemSel.Cantidad) { XtraMessageBox.Show("Cantidad a importar no es valida", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); itemSel.Cantidadverificada = 0m; } else { itemSel.Diferencia = (decimal)(itemSel.Cantidad - itemSel.Cantidadverificada); Entradaalmacendet entradaalmacendet = new Entradaalmacendet(); entradaalmacendet.Cantidadverificada = itemSel.Cantidadverificada; entradaalmacendet.Identradaalmacendet = itemSel.Identradaalmacendet; Service.ActualizarEntradaalmacendetCantidadVerificada(entradaalmacendet); } gvDetalle.RefreshData(); break; } }
private Entradaalmacendet AsignarEntradaAlmacenDetalle(VwCpcompradetimpentradaalmacen vwCpcompradetimpentradaalmacen) { Entradaalmacendet entradaalmacendetMnt = new Entradaalmacendet { Identradaalmacen = EntradaalmacenMntFrm.IdEntidadMnt, Numeroitem = vwCpcompradetimpentradaalmacen.Numeroitem, Idarticulo = vwCpcompradetimpentradaalmacen.Idarticulo, Idimpuesto = vwCpcompradetimpentradaalmacen.Idimpuesto, Idunidadmedida = vwCpcompradetimpentradaalmacen.Idunidadmedida, Especificacion = vwCpcompradetimpentradaalmacen.Especificacion, Cantidad = vwCpcompradetimpentradaalmacen.Cantidadaimportar, Preciounitario = vwCpcompradetimpentradaalmacen.Preciounitario, Importetotal = Math.Round(vwCpcompradetimpentradaalmacen.Cantidadaimportar * vwCpcompradetimpentradaalmacen.Preciounitarioneto, 2), Idproyecto = vwCpcompradetimpentradaalmacen.Idproyecto, Idarea = vwCpcompradetimpentradaalmacen.Idarea, Idcentrodecosto = vwCpcompradetimpentradaalmacen.Idcentrodecosto, Porcentajepercepcion = vwCpcompradetimpentradaalmacen.Porcentajepercepcion, Idtipoafectacionigv = vwCpcompradetimpentradaalmacen.Idtipoafectacionigv, Idcpcompradet = vwCpcompradetimpentradaalmacen.Idcpcompradet, Calcularitem = vwCpcompradetimpentradaalmacen.Calcularitem }; return(entradaalmacendetMnt); }
private void bmMntItems_ItemClick(object sender, ItemClickEventArgs e) { var subMenu = e.Item as BarSubItem; if (subMenu != null) { return; } switch (e.Item.Name) { case "btnImportar": if (!Validaciones()) { return; } if (EntradaalmacenMntFrm.IdEntidadMnt == 0) { if (!EntradaalmacenMntFrm.Validaciones()) { return; } string numeroDoc = string.Format("{0} {1}-{2}", EntradaalmacenMntFrm.iIdtipocp.Text.Trim(), EntradaalmacenMntFrm.rSerieentradaalmacen.Text.Trim(), EntradaalmacenMntFrm.rNumeroentradaalmacen.Text.Trim()); if (DialogResult.No == XtraMessageBox.Show(string.Format("¿Desea guardar el documento {0}?", numeroDoc), "Atención", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)) { return; } VwCpcompra vwCpcompraSel = (VwCpcompra)gvConsulta.GetFocusedRow(); //Asignar los controles de entrada a almacen desde la orden de compra seleccionada EntradaalmacenMntFrm.iIdtipomoneda.EditValue = vwCpcompraSel.Idtipomoneda; EntradaalmacenMntFrm.iIdtipomoneda.ReadOnly = true; EntradaalmacenMntFrm.iIncluyeimpuestoitems.EditValue = vwCpcompraSel.Incluyeimpuestoitems; EntradaalmacenMntFrm.iTipocambio.EditValue = vwCpcompraSel.Tipocambio; //Asignar la propiedad del documento de referencia EntradaalmacenMntFrm.EntradaalmacenMnt.Idcpcompra = vwCpcompraSel.Idcpcompra; if (EntradaalmacenMntFrm.Guardar()) { EntradaalmacenMntFrm.DeshabilitarModificacion(); } } if (EntradaalmacenMntFrm.IdEntidadMnt > 0) { foreach (var item in VwCpcompradetimpentradaalmacenList.Where(x => x.Itemseleccionado)) { Entradaalmacendet entradaalmacendetMnt = AsignarEntradaAlmacenDetalle(item); int identradaalmacendet = Service.SaveEntradaalmacendet(entradaalmacendetMnt); if (identradaalmacendet > 0) { //Verificar las ubicacion registradas por articulo long cantidadRefUbicaciones = Service.CountVwArticuloubicacion( x => x.Idarticulo == entradaalmacendetMnt.Idarticulo && x.Idalmacen == (int)iIdalmacen.EditValue); if (cantidadRefUbicaciones == 0) { //Insertar ubicacion por defecto Entradaalmacenubicacion entradaalmacenubicacion = new Entradaalmacenubicacion { Identradaalmacendet = identradaalmacendet, Idubicacion = AlmacenSel.Idubicaciondefecto, Cantidadarticulo = entradaalmacendetMnt.Cantidad }; Service.SaveEntradaalmacenubicacion(entradaalmacenubicacion); } else { //Insertar la ubicaciones del articulo del almacen seleccionado List <VwArticuloubicacion> vwArticuloubicacionList = Service.GetAllVwArticuloubicacion( x => x.Idarticulo == entradaalmacendetMnt.Idarticulo && x.Idalmacen == (int)iIdalmacen.EditValue); foreach (var vwArticuloubicacion in vwArticuloubicacionList) { Entradaalmacenubicacion entradaalmacenubicacion = new Entradaalmacenubicacion { Identradaalmacendet = identradaalmacendet, Idubicacion = vwArticuloubicacion.Idubicacion, Cantidadarticulo = entradaalmacendetMnt.Cantidad }; Service.SaveEntradaalmacenubicacion(entradaalmacenubicacion); } } } } EntradaalmacenMntFrm.CargarDetalle(); EntradaalmacenMntFrm.CargarDocumentoReferencia(); } DialogResult = DialogResult.OK; break; case "btnCancelarItem": DialogResult = DialogResult.Cancel; break; case "btnConsultar": if (!ValidacionDatosConsulta()) { return; } CargarDocumentosPendientes(); break; case "btnCerrar": DialogResult = DialogResult.Cancel; break; } }
private void bmMntItems_ItemClick(object sender, ItemClickEventArgs e) { var subMenu = e.Item as BarSubItem; if (subMenu != null) { return; } switch (e.Item.Name) { case "btnImportar": if (!Validaciones()) { return; } int sgtItem = 1; //var maxItem = VwOrdencompradetingresoimpList.OrderByDescending(t => t.Numeroitem).FirstOrDefault(); //sgtItem = maxItem == null ? 1 : maxItem.Numeroitem + 1; //if (maxItem != null) sgtItem = maxItem.Numeroitem; foreach (var item in VwOrdencompradetingresoimpList.Where(x => x.Itemseleccionado)) { Entradaalmacendet entradaalmacendet = new Entradaalmacendet(); entradaalmacendet.Identradaalmacen = IdEntidadMnt; entradaalmacendet.Numeroitem = sgtItem; entradaalmacendet.Idarticulo = item.Idarticulo; entradaalmacendet.Idimpuesto = item.Idimpuesto; entradaalmacendet.Idunidadmedida = item.Idunidadmedida; entradaalmacendet.Especificacion = item.Especificacion; entradaalmacendet.Cantidad = item.Cantidadaimportar; entradaalmacendet.Preciounitario = item.Preciounitarioneto; entradaalmacendet.Importetotal = item.Cantidadaimportar * item.Preciounitario; entradaalmacendet.Idordencompradet = item.Idordencompradet; TipoMnt = entradaalmacendet.Identradaalmacendet <= 0 ? TipoMantenimiento.Nuevo : TipoMantenimiento.Modificar; switch (TipoMnt) { case TipoMantenimiento.Nuevo: entradaalmacendet.Createdby = SessionApp.UsuarioSel.Idusuario; entradaalmacendet.Creationdate = DateTime.Now; break; case TipoMantenimiento.Modificar: entradaalmacendet.Modifiedby = SessionApp.UsuarioSel.Idusuario; entradaalmacendet.Lastmodified = DateTime.Now; break; } sgtItem++; Service.SaveEntradaalmacendet(entradaalmacendet); } DialogResult = DialogResult.OK; break; case "btnCancelarItem": DialogResult = DialogResult.Cancel; break; case "btnConsultar": ConsultarDocumentosPendientes(); break; case "btnCerrar": DialogResult = DialogResult.OK; break; } }
public void UpdateEntradaalmacendet(Entradaalmacendet entity) { EntradaalmacendetDao.Update(entity); }
public int SaveEntradaalmacendet(Entradaalmacendet entity) { return(EntradaalmacendetDao.Save(entity)); }
public void ActualizarEntradaalmacendetCantidadVerificada(Entradaalmacendet entradaalmacendet) { EntradaalmacendetDao.ActualizarEntradaalmacendetCantidadVerificada(entradaalmacendet); }