private void btnAnular_Click(object sender, EventArgs e) { if (Grilla.CurrentRow.Cells[8].Value.ToString() == "") { MessageBox.Show("Debe seleccionar una cobranza para continuar", Clases.cMensaje.Mensaje()); return; } if (txtCodCobranza.Text =="") { MessageBox.Show ("Debe ingresar una cobranza",Clases.cMensaje.Mensaje ()); return; } Int32 CodCobranza = Convert.ToInt32 (txtCodCobranza.Text); Clases.cFunciones fun = new Clases.cFunciones (); double Importe = fun.ToDouble(Grilla.CurrentRow.Cells[8].Value.ToString()); Clases.cCobranza cob = new Clases.cCobranza(); cob.AnularCobranza(CodCobranza); string Descripcion = "ANULACION DE COBRANZA " + txtPatente.Text; Clases.cPunitorioCobranza objPun = new Clases.cPunitorioCobranza(); Double Punitorio = objPun.GetImportePunitorio(CodCobranza); objPun.BorrarPunitorio(CodCobranza); // Importe = Importe + Punitorio; Clases.cMovimiento mov = new Clases.cMovimiento(); mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, 0, 0, Convert.ToDateTime(txtFecha.Text), Descripcion); //anulo punitorio Descripcion = "ANULACION DE PUNITORIO " + txtPatente.Text; mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Punitorio , 0, 0, 0, 0, Convert.ToDateTime(txtFecha.Text), Descripcion); CargarGrilla(); MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje()); }
private void Grilla_CellClick(object sender, DataGridViewCellEventArgs e) { Clases.cFunciones fun = new Clases.cFunciones(); if (Grilla.CurrentRow == null) { return; } txtImporte.Text = Grilla.CurrentRow.Cells[2].Value.ToString(); txtTope.Text = Grilla.CurrentRow.Cells[2].Value.ToString(); string Saldo = Grilla.CurrentRow.Cells[9].Value.ToString(); txtCodCobranza.Text = Grilla.CurrentRow.Cells[0].Value.ToString(); Int32 CodCobranza = Convert.ToInt32(Grilla.CurrentRow.Cells[0].Value.ToString()); Clases.cPunitorioCobranza objPun = new Clases.cPunitorioCobranza(); Double Punitorio = objPun.GetImportePunitorio(CodCobranza); txtPunitorio.Text = Punitorio.ToString(); if (Punitorio > 0) { txtPunitorio.Text = fun.FormatoEnteroMiles(txtPunitorio.Text); } else { txtPunitorio.Text = "0"; } if (Saldo.Trim() == "") { Saldo = txtImporte.Text; } if (Grilla.CurrentRow.Cells[4].Value.ToString() == "") { btnAnular.Enabled = false; btnGrabar.Enabled = true; btnPagarSaldo.Visible = false; } else { btnAnular.Enabled = true; btnGrabar.Enabled = false; btnPagarSaldo.Visible = true; } txtSaldo.Text = Saldo; }