private void GrillaCuotas_CellClick(object sender, DataGridViewCellEventArgs e) { string Cuota = GrillaCuotas.CurrentRow.Cells[1].Value.ToString(); string Importe = GrillaCuotas.CurrentRow.Cells[3].Value.ToString(); string ImportePagado = GrillaCuotas.CurrentRow.Cells[5].Value.ToString(); string Fecha = GrillaCuotas.CurrentRow.Cells[2].Value.ToString(); string CodGrupo = GrillaCuotas.CurrentRow.Cells[0].Value.ToString(); GetPunitorio(Convert.ToInt32(CodGrupo), Convert.ToInt32(Cuota)); Clases.cFunciones fun = new Clases.cFunciones(); if (Cuota != "") { txtCuota.Text = Cuota; txtImporte.Text = Importe; txtImportePagado.Text = ImportePagado; txtFecha.Text = Fecha; if (txtImporte.Text != "") { //string xx = trdo.Rows[0]["Importe"].ToString().Replace (",",".").ToString(); txtImporte.Text = fun.TransformarEntero(Importe); txtImporte.Text = fun.FormatoEnteroMiles(txtImporte.Text); txtCodGrupo.Text = CodGrupo.ToString(); if (txtImportePagado.Text != "") { btnAnular.Enabled = true; btnPagarSaldo.Visible = true; // txtImportePagado.ReadOnly = true; btnGrabar.Enabled = false; txtImportePagado.Text = fun.TransformarEntero(txtImportePagado.Text); txtImportePagado.Text = fun.FormatoEnteroMiles(txtImportePagado.Text); txtSaldo.Text = (fun.ToDouble(txtImporte.Text) - fun.ToDouble(txtImportePagado.Text)).ToString(); } else { btnPagarSaldo.Visible = false; txtSaldo.Text = ""; btnAnular.Enabled = false; btnGrabar.Enabled = true; // txtImportePagado.ReadOnly = false; } } //obtengo la deuda total Clases.cCuotasAnteriores objCuota = new Clases.cCuotasAnteriores(); txtTotalDeuda.Text = objCuota.GetSaldoDeudaCuotas(Convert.ToInt32(CodGrupo)).ToString(); if (txtTotalDeuda.Text != "") { txtTotalDeuda.Text = fun.TransformarEntero(txtTotalDeuda.Text); txtTotalDeuda.Text = fun.FormatoEnteroMiles(txtTotalDeuda.Text); } } }
private void btnGrabar_Click(object sender, EventArgs e) { if (txtCuota.Text == "") { MessageBox.Show("Debe ingresar una cuota para continuar.", Clases.cMensaje.Mensaje()); return; } if (txtImportePagado.Text == "") { MessageBox.Show("Debe ingresar un monto de la cuota.", Clases.cMensaje.Mensaje()); return; } Clases.cFunciones fun = new Clases.cFunciones(); double Importe = fun.ToDouble(txtImporte.Text); double ImportePagado = fun.ToDouble(txtImportePagado.Text); Int32 CodUsuario = Principal.CodUsuarioLogueado; if (ImportePagado > Importe) { MessageBox.Show("El importe a abonar es superior al valor de la cuota", Clases.cMensaje.Mensaje()); return; } if (ImportePagado < Importe) { var result = MessageBox.Show("El importe abonado es inferior al valor de la cuota, Confirma Pago de la cuota?", Clases.cMensaje.Mensaje(), MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the no button was pressed ... if (result == DialogResult.No) { return; } } Int32 CodGrupo = Convert.ToInt32(txtCodGrupo.Text); Int32 Cuota = Convert.ToInt32(txtCuota.Text); DateTime FechaPago = Convert.ToDateTime(txtFecha.Text); double Saldo = Importe - ImportePagado; Double Punitorio = 0; if (txtPunitorio.Text != "") { Punitorio = fun.ToDouble(txtPunitorio.Text); } Clases.cCuotasAnteriores objCuota = new Clases.cCuotasAnteriores(); if (objCuota.GrabarCuota(CodGrupo, Cuota, FechaPago, ImportePagado, Saldo, CodUsuario, txtPatente.Text, Punitorio)) { MessageBox.Show("Cuota grabada correctamente.", Clases.cMensaje.Mensaje()); CargarPlandeCuotas(Convert.ToInt32(CodGrupo)); txtTotalDeuda.Text = objCuota.GetSaldoDeudaCuotas(Convert.ToInt32(CodGrupo)).ToString(); if (txtTotalDeuda.Text != "") { txtTotalDeuda.Text = fun.TransformarEntero(txtTotalDeuda.Text); txtTotalDeuda.Text = fun.FormatoEnteroMiles(txtTotalDeuda.Text); } } else { MessageBox.Show("Hubo un error en el proceso de grabación.", Clases.cMensaje.Mensaje()); } }