protected void btn_excel_cheques_Click(object sender, EventArgs e) { Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=SOPRODI_1_" + DateTime.Now.ToShortDateString() + ".xls"); Response.Charset = ""; // If you want the option to open the Excel file without saving than // comment out the line below Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); G_DETALLE_CHEQUES_CARTERA.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.End(); }
protected void btn_detalle_2_Click(object sender, EventArgs e) { if (chk_gestionado.Checked) { cont_filas = 0; sum_dolar = 0; sum_pesos = 0; DataTable auss = ReporteRNegocio.facturas_gestionadas(CB_DIAS_ELEGIDOS.SelectedValue.ToString()); int columnas = auss.Columns.Count; total_filas = auss.Rows.Count; DataRow row; if (total_filas > 0) { row = auss.NewRow(); for (int i = 0; i < columnas; i++) { try { row[i] = ""; } catch { row[i] = 0; } } auss.Rows.Add(row); G_DETALLE_ESTIMADOS_FACTURAS.DataSource = auss; G_DETALLE_ESTIMADOS_FACTURAS.DataBind(); } else { G_DETALLE_ESTIMADOS_FACTURAS.DataSource = auss; G_DETALLE_ESTIMADOS_FACTURAS.DataBind(); } cont_filas = 0; sum_dolar = 0; sum_pesos = 0; DataTable auss2 = ReporteRNegocio.cheques_por_cobrar(CB_DIAS_ELEGIDOS.SelectedValue.ToString()); int columnas2 = auss2.Columns.Count; total_filas = auss2.Rows.Count; DataRow row2; if (total_filas > 0) { row2 = auss2.NewRow(); for (int i = 0; i < columnas2; i++) { try { row2[i] = ""; } catch { row2[i] = 0; } } auss2.Rows.Add(row2); G_DETALLE_CHEQUES_CARTERA.DataSource = auss2; G_DETALLE_CHEQUES_CARTERA.DataBind(); } else { G_DETALLE_CHEQUES_CARTERA.DataSource = auss2; G_DETALLE_CHEQUES_CARTERA.DataBind(); } ScriptManager.RegisterStartupScript(Page, this.GetType(), "mant_AN2", "<script language='javascript'>$('#ContentPlaceHolder_Contenido_tabla_html2').html('');</script>", false); div_facturas.Visible = true; div_cheques.Visible = true; } else { cont_filas = 0; sum_dolar = 0; sum_pesos = 0; DataTable auss1 = ReporteRNegocio.facturas_solomon(CB_DIAS_ELEGIDOS.SelectedValue.ToString()); int columnas1 = auss1.Columns.Count; total_filas = auss1.Rows.Count; DataRow row1; if (total_filas > 0) { row1 = auss1.NewRow(); for (int i = 0; i < columnas1; i++) { try { row1[i] = ""; } catch { row1[i] = 0; } } auss1.Rows.Add(row1); G_DETALLE_ESTIMADOS_FACTURAS.DataSource = auss1; G_DETALLE_ESTIMADOS_FACTURAS.DataBind(); } else { G_DETALLE_ESTIMADOS_FACTURAS.DataSource = auss1; G_DETALLE_ESTIMADOS_FACTURAS.DataBind(); } cont_filas = 0; sum_dolar = 0; sum_pesos = 0; DataTable auss2 = ReporteRNegocio.cheques_por_cobrar(CB_DIAS_ELEGIDOS.SelectedValue.ToString()); int columnas2 = auss2.Columns.Count; total_filas = auss2.Rows.Count; DataRow row2; if (total_filas > 0) { row2 = auss2.NewRow(); for (int i = 0; i < columnas2; i++) { try { row2[i] = ""; } catch { row2[i] = 0; } } auss2.Rows.Add(row2); G_DETALLE_CHEQUES_CARTERA.DataSource = auss2; G_DETALLE_CHEQUES_CARTERA.DataBind(); } else { G_DETALLE_CHEQUES_CARTERA.DataSource = auss2; G_DETALLE_CHEQUES_CARTERA.DataBind(); } ScriptManager.RegisterStartupScript(Page, this.GetType(), "mant_AN2", "<script language='javascript'>$('#tabla_html2').html('');</script>", false); div_facturas.Visible = true; div_cheques.Visible = true; } }