Esempio n. 1
0
        private void btnAgregarGasto_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (txtFecha.Text == "")
            {
                MessageBox.Show("Debe ingresar una fecha para continuar.", Clases.cMensaje.Mensaje());
                return;
            }

            if (fun.ValidarFecha(txtFecha.Text) == false)
            {
                MessageBox.Show("La fecha ingresada es incorrecta.", Clases.cMensaje.Mensaje());
                return;
            }

            if (txtCodStock.Text == "")
            {
                MessageBox.Show("Debe ingresar un auto para continuar", Clases.cMensaje.Mensaje());
                return;
            }
            Int32 CodCategoriaGasto = Convert.ToInt32(CmbCategoriaGasto.SelectedValue.ToString());

            Clases.cGasto gasto    = new Clases.cGasto();
            string        Nombre   = gasto.GetGastoxCodigo(Convert.ToInt32(CodCategoriaGasto));
            string        sImporte = txtImporteGasto.Text;
            DateTime      Fecha    = Convert.ToDateTime(txtFecha.Text);

            //Clases.cFunciones fun = new Clases.cFunciones();
            double Importe = fun.ToDouble(sImporte);

            gasto.InsertarGasto(Convert.ToInt32(txtCodStock.Text), CodCategoriaGasto, Importe, DateTime.Now);
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimiento(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, Importe, 0, Fecha);
            CargarGrilla();
        }
Esempio n. 2
0
        private void GrabarGastos()
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            Int32             CodCategoriaGasto = 0;
            double            Importe           = 0;
            Int32             CodStock          = Convert.ToInt32(txtCodStock.Text);

            Clases.cGasto      gasto = new Clases.cGasto();
            Clases.cMovimiento mov   = new Clases.cMovimiento();
            gasto.BorrarGastoxCodStock(CodStock);
            DateTime Fecha = Convert.ToDateTime(txtFecha.Text);

            for (int i = 0; i < Grilla.Rows.Count - 1; i++)
            {
                CodCategoriaGasto = Convert.ToInt32(Grilla.Rows[i].Cells[0].Value.ToString());
                Importe           = fun.ToDouble(Grilla.Rows[i].Cells[2].Value.ToString());
                CodCategoriaGasto = Convert.ToInt32(Grilla.Rows[i].Cells[0].Value.ToString());
                gasto.InsertarGasto(CodStock, CodCategoriaGasto, Importe, DateTime.Now);
                mov.RegistrarMovimiento(-1, Principal.CodUsuarioLogueado, (-1) * Importe, 0, 0, Importe, 0, Fecha);
            }
        }