protected void GridView_Pagos_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e) { e.Cancel = true; string IdPago = e.EditingKeyValue.ToString(); CargarDatosPago(IdPago); GridView_Pagos.CancelEdit(); }
//CAMBIO EL COLOR DEL ENCABEZADO DE GRUPO DE LAS ASIGNACIONES ANULADAS protected void GridView_Pagos_HtmlRowPrepared(object sender, DevExpress.Web.ASPxGridViewTableRowEventArgs e) { if (e.RowType == DevExpress.Web.GridViewRowType.Group) { string Estado = GridView_Pagos.GetRowValues(e.VisibleIndex, "Estado").ToString(); if (Estado == "Anulada") { e.Row.BackColor = System.Drawing.Color.FromArgb(252, 184, 185); e.Row.ForeColor = System.Drawing.Color.DarkRed; } } }
protected void GridView_Pagos_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e) { try { string IdPago = e.EditingKeyValue.ToString().Split('|')[0]; Session["IdAsignacionPago"] = GridView_Pagos.GetRowValuesByKeyValue(e.EditingKeyValue, "IdAsignacion"); Session["IdPago"] = IdPago; Response.Redirect("RegistrarPago.aspx"); } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void GridView_Pagos_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e) { try { int IdPago = Convert.ToInt32(GridView_Pagos.GetRowValues(e.VisibleIndex, "IdPago")); Session["TicketImprimir"] = IdPago; //GenerarTicket(IdPago); PopupControl_Ticket.ShowOnPageLoad = true; //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msg", "printReport();", true); } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void BtnCobrar_Click(object sender, EventArgs e) { try { clsPagos Pago = new clsPagos(); if (ComboBox_MesPagar.Text == "") { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msg", "alert('Debe seleccionar el mes a pagar.');", true); return; } if (ComboBox_Moneda.Text == "") { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msg", "alert('Debe seleccionar la moneda.');", true); return; } //if (TextBox_Recibo.Text.Trim() == "") //{ // ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msg", "alert('Debe ingresar el Número de Recibo.');", true); // return; //} if (DateEdit_FechaRecibo.Text.Trim() == "") { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msg", "alert('Debe ingresar la Fecha del Recibo.');", true); return; } if (SpinEditMontoPagado.Text == "0" || SpinEditMontoPagado.Text == "") { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msg", "alert('Debe ingresar el valor pagado.');", true); return; } if (ComboBox_Moneda.Text == "Córdobas") { if (SpinEditTasaCambio.Text == "" || SpinEditTasaCambio.Text == "0.00") { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msg", "alert('Debe ingresar la Tasa de Cambio.');", true); return; } if (Convert.ToDouble(TextBox_TOTAL.Text) > Math.Round(Convert.ToDouble(SpinEditMontoPagado.Text) / Convert.ToDouble(SpinEditTasaCambio.Text), 2)) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msg", "alert('El monto pagado no puede ser menor que el total a pagar');", true); return; } } else { if (Convert.ToDouble(TextBox_TOTAL.Text) > Convert.ToDouble(SpinEditMontoPagado.Text)) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msg", "alert('El monto pagado no puede ser menor que el total a pagar');", true); return; } } Pago.IdPago = Convert.ToInt32(lblIdPago.Text.Trim()); Pago.IDAsignacion = Convert.ToInt32(lblIdAsignacion.Text.Trim()); Pago.MesPagado = ComboBox_MesPagar.Text.Trim(); Pago.NumeroRecibo = TextBox_Recibo.Text.Trim(); Pago.FechaRecibo = DateEdit_FechaRecibo.Date; Pago.Moneda = ComboBox_Moneda.Text; Pago.TasaCambio = Pago.Moneda == "Dólares" ? 0 : Convert.ToDouble(SpinEditTasaCambio.Value); Pago.MontoPago = Convert.ToDouble(TextBox_MontoCuota.Text.Trim()); Pago.Mora = Convert.ToDouble(TextBox_MoraMes.Text.Trim()); Pago.Interes = Convert.ToDouble(TextBox_Interés.Text.Trim()); Pago.TotalPagado = Convert.ToDouble(SpinEditMontoPagado.Value); Pago.Observaciones = TextBox_Observaciones.Text.Trim(); FG._NombreUsuario = HttpContext.Current.User.Identity.Name; string IdentityUser = FG.CrearIdentificadorUsuario(FG._NombreUsuario); string IdPago = Neg.AgregarActualizarPago(Pago, IdentityUser); string MsjSQL = FG.Obtener_MensajeSQL(IdentityUser); if (MsjSQL != "") { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msg", "alert('" + MsjSQL + "');", true); return; } else { GridView_Pagos.DataBind(); CargarDatosAsignacion(lblIdAsignacion.Text.Trim()); //PopupControl_Ticket.ShowOnPageLoad = true; Session["TicketImprimir"] = IdPago; //GenerarTicket(Convert.ToInt32(IdPago)); PopupControl_Ticket.ShowOnPageLoad = true; //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msg", "printReport();", true); lblIdPago.Text = "0"; LimpiarCampos("Detalle"); } } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }