protected void Button1_Click(object sender, EventArgs e) { if (Convert.ToInt64(this.txtMontoParcial.Text) <= 0L) { this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('Debe ingresar un monto superior a cero');</script>"); this.txtMontoParcial.Text = ""; } else { DataTable table2; DataTable table = Consulta.ProductoJuicio(this.hiddidcobranza.Value.ToString()); string str = ""; string str2 = ""; if ((table.Rows.Count > 0) && (table != null)) { str = table.Rows[0]["id_producto"].ToString(); str2 = table.Rows[0]["tipocobranza"].ToString(); } if (str2 == "P") { table2 = null; table2 = ConsultasEspecificas.ValidaPagoParcial(this.hiddidcobranza.Value.ToString()); if ((table2.Rows.Count <= 0) || (table2 == null)) { this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('No existen letras a cancelar, por lo tanto no se puede abonar parcialmente');</script>"); return; } } if (str2 == "J") { switch (str) { case "1": table2 = null; table2 = ConsultasEspecificas.ValidaPagoParcialMutuo(this.hiddidcobranza.Value.ToString()); if ((table2.Rows.Count <= 0) || (table2 == null)) { this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('No existen letras a cancelar, por lo tanto no se puede abonar parcialmente');</script>"); return; } break; case "2": table2 = null; table2 = ConsultasEspecificas.ValidaPagoParcialPagare(this.hiddidcobranza.Value.ToString()); if ((table2.Rows.Count <= 0) || (table2 == null)) { this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('No existen letras a cancelar, por lo tanto no se puede abonar parcialmente');</script>"); return; } break; case "3": table2 = null; table2 = ConsultasEspecificas.ValidaPagoParcialDocujuicio(this.hiddidcobranza.Value.ToString()); if ((table2.Rows.Count <= 0) || (table2 == null)) { this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('No existen letras a cancelar, por lo tanto no se puede abonar parcialmente');</script>"); return; } break; } } Transaccion.InsertaAbonoParcial( this.hiddidcobranza.Value, "N", ALCSA.FWK.Web.Control.ExtraerValorComoDecimal(txtMontoParcial), Session["Usuario"].ToString()); string str3 = "AbonoParcial.aspx?Codigo=" + this.hiddidcobranza.Value.ToString(); this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('Abono parcial ingresado correctamente');location.href='" + str3.ToString() + "';</script>"); } }
protected void btnGuardar_Click(object sender, EventArgs e) { if (!ValidarCampos()) { return; } string strIndicadorAbono = string.Empty; int intIdAbono = 0; decimal decMontoAbono = ALCSA.FWK.Web.Control.ExtraerValorComoDecimal(txtMontoAbono); decimal decTotalParcial = ALCSA.FWK.Web.Control.ExtraerValorComoDecimal(txtTotalParcial); decimal decSaldoAbono = Decimal.Zero; if (decTotalParcial > Decimal.Zero && decMontoAbono > Decimal.Zero) { strIndicadorAbono = "C"; decSaldoAbono = decTotalParcial - decMontoAbono; } DateTime datFechaMinima = new DateTime(1900, 1, 1); DateTime datFechaUltimoPago = BuscarFechaUltimoCheque(); DataTable objAbono = Transaccion.InsertaAbono( this.hiddidcobranza.Value, ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtFecha, datFechaMinima).ToString("yyyyMMdd"), this.txtMontoAbono.Text, ALCSA.FWK.Web.Control.ExtraerValorComoEntero(ConceptoAbono).ToString(), ALCSA.FWK.Web.Control.ExtraerValorComoEntero(ddlFormaPago).ToString(), ALCSA.FWK.Web.Control.ExtraerValorComoEntero(banco).ToString(), datFechaUltimoPago.ToString("yyyyMMdd"), string.Empty, this.txtObservacion.Text, txtGirador.Enabled ? this.txtGirador.Text.Trim() : string.Empty, this.txtBoletaHonorarios.Text, string.Empty, ALCSA.FWK.Web.Control.ExtraerValorComoEntero(ddlNumeroCheques).ToString(), "1", this.Session["Usuario"].ToString(), this.TipoComprobante.SelectedValue, ALCSA.FWK.Web.Control.ExtraerValorComoEntero(ddlNumeroCheques) > 1 ? "S" : string.Empty, Consulta.Codigo_cuota_colegio(), txtGirador.Enabled ? txtnomgirador.Text.Trim() : string.Empty ); if (objAbono != null && objAbono.Rows.Count > 0) { intIdAbono = ALCSA.FWK.Texto.ConvertirTextoEnEntero(objAbono.Rows[0][0].ToString()); } if (strIndicadorAbono == "C") { Transaccion.UpdateAbonoParcialEstado(hiddidcobranza.Value.ToString(), intIdAbono.ToString()); } if (decSaldoAbono > Decimal.Zero) { Transaccion.InsertaAbonoParcial( hiddidcobranza.Value, "E", decSaldoAbono, Session["Usuario"].ToString() ); } DataTable objProductoJuicio = Consulta.ProductoJuicio(this.hiddidcobranza.Value.ToString()); string str7 = ""; string str8 = ""; if (objProductoJuicio != null && objProductoJuicio.Rows.Count > 0) { str7 = objProductoJuicio.Rows[0]["id_producto"].ToString(); str8 = objProductoJuicio.Rows[0]["tipocobranza"].ToString(); } if (str8 == "P") { this.marcarletrapagada(); } if (str8 == "J") { switch (str7) { case "1": this.marcarletrapagadamutuo(); break; case "2": this.marcarletrapagadadocupagare(); break; case "3": this.marcarletrapagadadocujuicio(); break; } } Transaccion.UpdateGastos(hiddidcobranza.Value); try { this.GuardarDesglose( intIdAbono.ToString(), hiddidcobranza.Value, txtGastos.Text ); } catch (Exception) { } GuardarCheques(intIdAbono); ClientScript.RegisterClientScriptBlock( typeof(Page), "alerta", string.Format("<script>alert('Datos guardados correctamente');location.href='pagoAbono.aspx?Codigo={0}';</script>", this.hiddidcobranza.Value)); }