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(); }
private void btnEliminarGasto_Click(object sender, EventArgs e) { if (Grilla.CurrentRow == null) { MessageBox.Show("Debe seleccionar un registro para continuar", Clases.cMensaje.Mensaje()); return; } Clases.cFunciones fun = new Clases.cFunciones(); Int32 CodCategoriaGasto = Convert.ToInt32(Grilla.CurrentRow.Cells[0].Value); double Importe = fun.ToDouble(Grilla.CurrentRow.Cells[2].Value.ToString()); Clases.cGasto gasto = new Clases.cGasto(); gasto.BorrarGastoxCategoria(Convert.ToInt32(txtCodStock.Text), CodCategoriaGasto); Clases.cMovimiento mov = new Clases.cMovimiento(); DateTime Fecha = Convert.ToDateTime(txtFecha.Text); mov.RegistrarMovimiento(-1, Principal.CodUsuarioLogueado, Importe, 0, 0, -1 * Importe, 0, Fecha); CargarGrilla(); }
private void btnEliminar_Click(object sender, EventArgs e) { if (Grilla.CurrentRow == null) { MessageBox.Show("Debe seleccionar un costo ", Clases.cMensaje.Mensaje()); return; } txtCodCosto.Text = Grilla.CurrentRow.Cells[0].Value.ToString(); if (txtCodCosto.Text == "") { } var resul = MessageBox.Show("Confirma eliminar el costo", Clases.cMensaje.Mensaje(), MessageBoxButtons.YesNo, MessageBoxIcon.Question); Double Importe = 0; string sImporte = ""; if (resul == DialogResult.Yes) { //busco el importe a borrar sImporte = ""; for (int i = 0; i < Grilla.Rows.Count - 1; i++) { if (Grilla.Rows[i].Cells[0].Value.ToString() == txtCodCosto.Text) { sImporte = Grilla.Rows[i].Cells[4].Value.ToString(); } } } Clases.cFunciones fun = new Clases.cFunciones(); if (sImporte != "") { Importe = fun.ToDouble(sImporte); } Clases.cCosto costo = new Clases.cCosto(); Int32 CodCosto = Convert.ToInt32(txtCodCosto.Text); costo.BorrarCosto(CodCosto); DateTime Fecha = Convert.ToDateTime(txtFecha.Text); Clases.cMovimiento mov = new Clases.cMovimiento(); mov.RegistrarMovimiento(-1, Principal.CodUsuarioLogueado, (Importe), 0, 0, (-1) * Importe, 0, Fecha); CargarCostoxstock(Convert.ToInt32(txtCodStock.Text)); }
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); } }
private void btnAnular_Click(object sender, EventArgs e) { Clases.cFunciones fun = new Clases.cFunciones(); if (Grilla.CurrentRow == null) { MessageBox.Show("Debe Seleccionar un cheque para continuar ", Clases.cMensaje.Mensaje()); return; } if (Grilla.Rows.Count < 2) { MessageBox.Show("Debe Seleccionar una prenda para continuar ", Clases.cMensaje.Mensaje()); return; } 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; } string NroCheque = Grilla.CurrentRow.Cells[1].Value.ToString(); Double Importe = fun.ToDouble(Grilla.CurrentRow.Cells[2].Value.ToString()); Int32 CodVenta = Convert.ToInt32(Grilla.CurrentRow.Cells[0].Value.ToString()); Clases.cCheque Cheque = new Clases.cCheque(); Cheque.AnularCobroCheque(CodVenta, NroCheque); DateTime Fecha = Convert.ToDateTime(txtFecha.Text); Clases.cMovimiento mov = new Clases.cMovimiento(); mov.RegistrarMovimiento(CodVenta, Principal.CodUsuarioLogueado, (-1) * Importe, 0, 0, 0, 0, Fecha); MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje()); CargarGrilla(); }