private void DGV_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            string msg = "";

            this.Text = msg;

            filaActual    = e.RowIndex;
            columnaActual = e.ColumnIndex;

            if (e.ColumnIndex == 0 || e.ColumnIndex == 1)
            {
                if (DGV.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
                {
                    var data = DGV.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                    Buscar(data);
                }
            }
            else
            {
                if (e.RowIndex == DGV.Rows.Count - 1)
                {
                    DataGridViewRow  row        = DGV.Rows[e.RowIndex];
                    DataGridViewCell codigoCta  = row.Cells[DGV.Columns["codigo"].Index];
                    DataGridViewCell montoDebe  = row.Cells[DGV.Columns["debe"].Index];
                    DataGridViewCell montoHaber = row.Cells[DGV.Columns["haber"].Index];
                    if (IsCtaOk(codigoCta) && IsMontoOk(montoDebe, montoHaber))
                    {
                        var item = new Detalle();
                        items.Add(item);
                        try
                        {
                            DGV.CurrentCell = DGV[0, e.RowIndex + 1];
                            ActualizarSaldos();
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
                else
                {
                    try
                    {
                        DGV.CurrentCell = DGV[0, e.RowIndex + 1];
                        ActualizarSaldos();
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
        private void DGV_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Home)
            {
                if (bs.Count > 0)
                {
                    bs.CurrencyManager.Position = 0;
                }
            }

            if (e.KeyData == Keys.End)
            {
                if (bs.Count > 0)
                {
                    bs.CurrencyManager.Position = bs.Count - 1;
                }
            }

            if (e.KeyData == Keys.Delete)
            {
                if (items.Count() > 1)
                {
                    var item = (Detalle)bs.Current;
                    items.Remove(item);
                }
                else
                {
                    items.Clear();
                    items.Add(new Detalle());
                }
            }

            if (e.KeyData == Keys.Down)
            {
                if (bs.CurrencyManager.Position == items.Count - 1)
                {
                    var              filaActual = bs.CurrencyManager.Position;
                    DataGridViewRow  row        = DGV.Rows[filaActual];
                    DataGridViewCell codigoCta  = row.Cells[DGV.Columns["codigo"].Index];
                    DataGridViewCell montoDebe  = row.Cells[DGV.Columns["debe"].Index];
                    DataGridViewCell montoHaber = row.Cells[DGV.Columns["haber"].Index];
                    if (IsCtaOk(codigoCta) && IsMontoOk(montoDebe, montoHaber))
                    {
                        var item = new Detalle();
                        items.Add(item);
                        DGV.CurrentCell = DGV[0, filaActual + 1];
                    }
                }
            }
        }
 private void CargarData(List <OOB.Contable.Asiento.Generar.FichaDetalle> list)
 {
     foreach (var it in list)
     {
         var itm = new Detalle()
         {
             Cta = new OOB.Contable.PlanCta.Ficha()
             {
                 Id         = it.IdCta,
                 Codigo     = it.CodigoCta,
                 Nombre     = it.DescripcionCta,
                 Naturaleza = it.Naturaleza,
             },
             Codigo      = it.CodigoCta,
             Descripcion = it.DescripcionCta,
             Debe        = it.MontoDebe,
             Haber       = it.MontoHaber
         };
         items.Add(itm);
     }
 }