private void btnAdd_Click(object sender, EventArgs e)
        {
            int accountQuantity =
                (from em in entities.countables_accounts
                 where em.allow_transaction == true && em.state == true
                 select em).Count();

            int currencyQuantity = entities.currencies_types.Count(em => em.state == true);

            if (accountQuantity > 1 && currencyQuantity > 0)
            {
                EntradaContable entradaContable = EntradaContable.getInstance();
                entradaContable.ShowDialog(this);
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                if (accountQuantity < 2)
                {
                    sb.Append("- No hay suficientes cuentas activas que permitan transacciones\n");
                }

                if (currencyQuantity < 1)
                {
                    sb.Append("- No hay tipos de monedas activas\n");
                }

                MessageBox.Show(
                    "No se puede agregar entradas.\n\n" + sb.ToString(),
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
            }
        }
        public static EntradaContable getInstance()
        {
            if (instance == null)
            {
                instance = new EntradaContable();
            }

            return(instance);
        }
        private void btnDetails_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = null;

            if (dgvPlacements.SelectedRows.Count == 1)
            {
                row = dgvPlacements.SelectedRows[0];
            }
            else if (dgvPlacements.SelectedCells.Count == 1)
            {
                int i = dgvPlacements.SelectedCells[0].RowIndex;
                row = dgvPlacements.Rows[i];
            }
            else
            {
                MessageBox.Show(
                    "Debe seleccionar solo 1 asiento a visualizar",
                    "Información",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information
                    );
            }

            if (row != null)
            {
                EntradaContable tipoCuenta = EntradaContable.getInstance();
                int             id         = Int32.Parse(row.Cells[0].Value.ToString());
                placements      placement  = (from em in entities.placements
                                              where em.id == id
                                              select em).First();

                tipoCuenta.setEntradaContable(placement, true);
                tipoCuenta.Show();
                tipoCuenta.Focus();
            }
        }
 private void EntradaContable_FormClosed(object sender, FormClosedEventArgs e)
 {
     instance = null;
 }