Example #1
0
        public void txtCuenta_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter && txtCuenta.Text != "")
            {
                _Cuenta = new CuentaN(int.Parse(txtCuenta.Text));

                if (_Cuenta.Succed)
                {
                    txtNombreCuenta.Text = _Cuenta.Nombre;
                    
                }
                else
                {
                    txtCuenta.Text = "";
                    MessageBox.Show("La Cuenta ingresada no existe");
                }

                /* if (txtIdTipoMov.Text != "" && txtPuntoVenta.Text != "" && txtCuenta.Text != "" && ((txtNroComprobante.Text != "" && _TipoMovimiento.Numeracion == "M") || (txtNroComprobante.Text == "" && _TipoMovimiento.Numeracion == "A")))
                 {*/

                if (txtIdTipoMov.Text != "")
                {
                   
                    _Movimiento = new MovimientoN(int.Parse(txtIdTipoMov.Text), int.Parse(txtPuntoVenta.Text), int.Parse(txtNroComprobante.Text == "" ? "0" : txtNroComprobante.Text), int.Parse(txtCuenta.Text));
                    if (_Movimiento.Id != 0)
                    {
                        ClaveMov = _Movimiento.Id;
                        txtFechaComprobante.Text = _Movimiento.Fecha.ToShortDateString();
                        cmbCondicionPago.SelectedValue = _Movimiento.CondicionDePago;
                        txtFechaContabilizacion.Text = _Movimiento.FechaContabilizacion.ToShortDateString();
                        txtObservaciones.Text = _Movimiento.Observacion;
                        CambiarModoPantalla(Negocios.FuncionesGlobales.Globales.Modo.Consultar);
                        if (_Movimiento.ListarDetalles().Count > 0)
                        {
                            LlenarDTGV(_Movimiento.ListarDetalles());
                        }
                        _MovimientoActual = _Movimiento;
                        btnModificar.Enabled = false;
                        btnGrabar.Enabled = false;
                        btnAnular.Enabled = true;
                    }
                    else
                    {
                        btnAnular.Enabled = false;
                        CambiarModoPantalla(Negocios.FuncionesGlobales.Globales.Modo.Agregar);
                        if (_TipoMovimiento.Numeracion == "A")
                        {
                            txtNroComprobante.Text = "";
                        }
                    }
                }
                //}
            }
            else if (e.KeyCode == Keys.F3)
            {
                try
                {
                    List<CuentaN> Cuentas = Negocios.FuncionesGlobales.CuentaS.ListadoCuentas();
                    string[] cool = { "Id", "Nombre" };
                    txtCuenta.Parametros<CuentaN>(Keys.F3, cool, "Id", Cuentas, "Nombre");
                }
                catch (Exception E)
                {
                    MessageBox.Show(E.StackTrace);
                    throw;
                }
            }
        }