private void modificarprecioToolStripMenuItem_Click(object sender, EventArgs e) { if (mListaEppDetalleOrigen.Count > 0) { int xposition = 0; frmRegEppDetalleEdit movDetalle = new frmRegEppDetalleEdit(); movDetalle.IdEpp = Convert.ToInt32(gvEppDetalle.GetFocusedRowCellValue("IdEpp")); movDetalle.IdEppDetalle = Convert.ToInt32(gvEppDetalle.GetFocusedRowCellValue("IdEppDetalle")); movDetalle.intCorrelativo = Convert.ToInt32(gvEppDetalle.GetFocusedRowCellValue("Item")); movDetalle.IdEquipo = Convert.ToInt32(gvEppDetalle.GetFocusedRowCellValue("IdEquipo")); movDetalle.txtCodigo.Text = gvEppDetalle.GetFocusedRowCellValue("Codigo").ToString(); movDetalle.txtDescEquipo.Text = gvEppDetalle.GetFocusedRowCellValue("DescEquipo").ToString(); movDetalle.deFechaVencimiento.EditValue = gvEppDetalle.GetFocusedRowCellValue("FechaVencimiento").ToString(); movDetalle.txtCantidad.EditValue = Convert.ToInt32(gvEppDetalle.GetFocusedRowCellValue("Cantidad")); movDetalle.txtPrecio.EditValue = Convert.ToDecimal(gvEppDetalle.GetFocusedRowCellValue("Precio")); movDetalle.txtTotal.EditValue = Convert.ToDecimal(gvEppDetalle.GetFocusedRowCellValue("Total")); movDetalle.cboTipoEntrega.EditValue = Convert.ToInt32(gvEppDetalle.GetFocusedRowCellValue("IdTipoEntrega")); if (movDetalle.ShowDialog() == DialogResult.OK) { xposition = gvEppDetalle.FocusedRowHandle; if (movDetalle.oBE != null) { gvEppDetalle.SetRowCellValue(xposition, "IdEmpresa", movDetalle.oBE.IdEmpresa); gvEppDetalle.SetRowCellValue(xposition, "IdEpp", movDetalle.oBE.IdEpp); gvEppDetalle.SetRowCellValue(xposition, "IdEppDetalle", movDetalle.oBE.IdEppDetalle); gvEppDetalle.SetRowCellValue(xposition, "Item", movDetalle.oBE.Item); gvEppDetalle.SetRowCellValue(xposition, "IdEquipo", movDetalle.oBE.IdEquipo); gvEppDetalle.SetRowCellValue(xposition, "Codigo", movDetalle.oBE.Codigo); gvEppDetalle.SetRowCellValue(xposition, "DescEquipo", movDetalle.oBE.DescEquipo); gvEppDetalle.SetRowCellValue(xposition, "FechaVencimiento", movDetalle.oBE.FechaVencimiento); gvEppDetalle.SetRowCellValue(xposition, "Cantidad", movDetalle.oBE.Cantidad); gvEppDetalle.SetRowCellValue(xposition, "Precio", movDetalle.oBE.Precio); gvEppDetalle.SetRowCellValue(xposition, "Total", movDetalle.oBE.Total); gvEppDetalle.SetRowCellValue(xposition, "IdTipoEntrega", movDetalle.oBE.IdTipoEntrega); gvEppDetalle.SetRowCellValue(xposition, "DescTipoEntrega", movDetalle.oBE.DescTipoEntrega); if (pOperacion == Operacion.Modificar && Convert.ToDecimal(gvEppDetalle.GetFocusedRowCellValue("TipoOper")) == Convert.ToInt32(Operacion.Nuevo)) { gvEppDetalle.SetRowCellValue(xposition, "TipoOper", Convert.ToInt32(Operacion.Nuevo)); } else { gvEppDetalle.SetRowCellValue(xposition, "TipoOper", Convert.ToInt32(Operacion.Modificar)); } gvEppDetalle.UpdateCurrentRow(); bNuevo = movDetalle.bNuevo; AttachSummaryEPP(); btnNuevo.Focus(); } } } }
private void nuevoToolStripMenuItem_Click(object sender, EventArgs e) { try { if (intIdSolicitudEpp == 0) { XtraMessageBox.Show("Debe Seleccionar una Solicitud.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (intIdPersona == 0) { XtraMessageBox.Show("Debe Seleccionar un Responsable.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } frmRegEppDetalleEdit movDetalle = new frmRegEppDetalleEdit(); int i = 0; if (mListaEppDetalleOrigen.Count > 0) { i = mListaEppDetalleOrigen.Max(ob => Convert.ToInt32(ob.Item)); } movDetalle.intCorrelativo = Convert.ToInt32(i) + 1; if (movDetalle.ShowDialog() == DialogResult.OK) { if (movDetalle.oBE != null) { if (mListaEppDetalleOrigen.Count == 0) { gvEppDetalle.AddNewRow(); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "IdEmpresa", intIdEmpresa); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "IdEpp", movDetalle.oBE.IdEpp); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "IdEppDetalle", movDetalle.oBE.IdEppDetalle); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "Item", movDetalle.oBE.Item); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "IdEquipo", movDetalle.oBE.IdEquipo); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "Codigo", movDetalle.oBE.Codigo); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "DescEquipo", movDetalle.oBE.DescEquipo); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "FechaVencimiento", movDetalle.oBE.FechaVencimiento); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "Cantidad", movDetalle.oBE.Cantidad); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "Precio", movDetalle.oBE.Precio); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "Total", movDetalle.oBE.Total); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "IdTipoEntrega", movDetalle.oBE.IdTipoEntrega); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "DescTipoEntrega", movDetalle.oBE.DescTipoEntrega); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "IdKardex", 0); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "TipoOper", Convert.ToInt32(Operacion.Nuevo)); gvEppDetalle.UpdateCurrentRow(); bNuevo = movDetalle.bNuevo; AttachSummaryEPP(); btnNuevo.Focus(); return; } if (mListaEppDetalleOrigen.Count > 0) { var Buscar = mListaEppDetalleOrigen.Where(oB => oB.IdEquipo == movDetalle.oBE.IdEquipo).ToList(); if (Buscar.Count > 0) { XtraMessageBox.Show("El código de producto ya existe", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } gvEppDetalle.AddNewRow(); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "IdEmpresa", intIdEmpresa); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "IdEpp", movDetalle.oBE.IdEpp); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "IdEppDetalle", movDetalle.oBE.IdEppDetalle); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "Item", movDetalle.oBE.Item); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "IdEquipo", movDetalle.oBE.IdEquipo); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "Codigo", movDetalle.oBE.Codigo); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "DescEquipo", movDetalle.oBE.DescEquipo); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "FechaVencimiento", movDetalle.oBE.FechaVencimiento); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "Cantidad", movDetalle.oBE.Cantidad); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "Precio", movDetalle.oBE.Precio); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "Total", movDetalle.oBE.Total); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "IdTipoEntrega", movDetalle.oBE.IdTipoEntrega); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "DescTipoEntrega", movDetalle.oBE.DescTipoEntrega); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "IdKardex", 0); gvEppDetalle.SetRowCellValue(gvEppDetalle.FocusedRowHandle, "TipoOper", Convert.ToInt32(Operacion.Nuevo)); gvEppDetalle.UpdateCurrentRow(); bNuevo = movDetalle.bNuevo; AttachSummaryEPP(); btnNuevo.Focus(); } } } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }