Example #1
0
 /// <summary>
 /// Crea un nuevo movimiento
 /// </summary>
 /// <param name="p_IdArticulo"></param>
 /// <param name="p_PrecioUnit"></param>
 /// <param name="p_Movimiento"></param>
 /// <param name="p_Cantidad"></param>
 public DetalleMovimientoN(int p_IdArticulo, decimal p_PrecioUnit, MovimientoN p_Movimiento, int p_Cantidad)
 {
     this.Cantidad        = p_Cantidad;
     this.ClaveMov        = p_Movimiento.Id;
     this.PrecioUnitario  = p_PrecioUnit;
     this.IdArticulo      = p_IdArticulo;
     this.ImporteSubtotal = p_Cantidad * p_PrecioUnit;
     _Movimiento          = p_Movimiento;
 }
Example #2
0
 /// <summary>
 /// Crea nuevo movimiento en consulta
 /// </summary>
 /// <param name="p_id"></param>
 /// <param name="p_clavemov"></param>
 /// <param name="p_idart"></param>
 /// <param name="p_cantidad"></param>
 /// <param name="p_preciounitario"></param>
 /// <param name="p_importesubtotal"></param>
 public DetalleMovimientoN(int p_id, int p_clavemov, int p_idart, int p_cantidad, decimal p_preciounitario, decimal p_importesubtotal, MovimientoN MOVIMIENTO)
 {
     this.Id              = p_id;
     this.Cantidad        = p_cantidad;
     this.ClaveMov        = p_clavemov;
     this.IdArticulo      = p_idart;
     this.PrecioUnitario  = p_preciounitario;
     this.ImporteSubtotal = p_importesubtotal;
     _Movimiento          = MOVIMIENTO;
 }
Example #3
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;
                }
            }
        }
Example #4
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {

            if (dgvDetalle.Rows.Count != 0)
            {

                int _IdTipoMovimiento = int.Parse(txtIdTipoMov.Text);
                int _PuntoVenta = int.Parse(txtPuntoVenta.Text);
                int _NroMovimiento = int.Parse(txtNroComprobante.Text == "" ? "0" : txtNroComprobante.Text);
                DateTime _Fecha = Convert.ToDateTime(txtFechaComprobante.Text);
                decimal _ImporteNeto = decimal.Parse(txtImporteNeto.Text);
                decimal _ImporteIVA = decimal.Parse(txtImporteIVA.Text);
                int _IdCuenta = int.Parse(txtCuenta.Text);
                string _Observacion = txtObservaciones.Text;
                string _CAE = "nulaso";
                DateTime _FechaVencimientoCAE = DateTime.Now;
                DateTime _FechaContabilizacion = DateTime.Parse(txtFechaContabilizacion.Text);
                int _IdCondicionPago = int.Parse(cmbCondicionPago.SelectedValue.ToString());

                MovimientoN t_MVN = new MovimientoN(_IdTipoMovimiento, _PuntoVenta, _NroMovimiento, _Fecha, _ImporteNeto, _ImporteIVA, _IdCuenta, _Observacion, _CAE, _FechaVencimientoCAE, _FechaContabilizacion, _IdCondicionPago);

                if (t_MVN.Guardar() == true)
                {
                    for (int a = 0; a < dgvDetalle.Rows.Count; a++)
                    {
                        DataGridViewRow _DR = dgvDetalle.Rows[a];



                        int _idArt = int.Parse(_DR.Cells[colIdArticulo.Index].Value.ToString());
                        decimal _Importe = decimal.Parse(_DR.Cells[colPrecioUnitario.Index].Value.ToString());
                        int _cantidad = int.Parse(_DR.Cells[colCantidad.Index].Value.ToString());
                        decimal __importeSubTotal = decimal.Parse(_DR.Cells[colSubTotal.Index].Value.ToString());

                        t_MVN.AgregarDetalle((Entidades.DetalleMovimientoE)new Negocios.DetalleMovimientoN(_idArt, _Importe, t_MVN, _cantidad));
                        _Movimiento = t_MVN;


                    }
                    if (t_MVN.GuardarDetalles() == true)
                    {
                        MessageBox.Show("Movimiento almacenado con éxito");

                    }
                    else
                    {
                        MessageBox.Show("Problema al guardar el movimiento");
                    }

                    LimpiarPantalla();
                    CambiarModoPantalla(Negocios.FuncionesGlobales.Globales.Modo.Inicial);
                }


            }
            else
            {
                MessageBox.Show("Debe insertar un detalle en el movimiento");
                ttAyuda.Show("Inserte un articulo por medio de este boton...", btnNuevo, 2000);
            }
        }