protected void Button2_Click(object sender, EventArgs e) { string cadenaHtml = ""; string cadenaHtml1 = ""; string cadenaHtml2 = ""; //'-----CADENA ESPACIO cadenaHtml = cadenaHtml + "<br></br>"; //'-----CADENA NRO 01 COMBOS SELECCIONADOS cadenaHtml1 = cadenaHtml1 + "<table border='1'><tr>"; cadenaHtml1 = cadenaHtml1 + "<td colspan='8' align='center'>"; cadenaHtml1 = cadenaHtml1 + "<h3>INFORME EFECTIVIDAD OPERATIVA CAMBIO MEDIDOR</h3>"; cadenaHtml1 = cadenaHtml1 + "</td>"; cadenaHtml1 = cadenaHtml1 + "</tr></table>"; cadenaHtml1 = cadenaHtml1 + "<br></br>"; cadenaHtml1 = cadenaHtml1 + "<br></br>"; cadenaHtml1 = cadenaHtml1 + "<table border='1'>"; cadenaHtml1 = cadenaHtml1 + "<tr>"; cadenaHtml1 = cadenaHtml1 + "<td>TIPO PROCESO:</td>"; cadenaHtml1 = cadenaHtml1 + "<td align='right'>" + ddlProceso.SelectedItem.Text + "</td>"; cadenaHtml1 = cadenaHtml1 + "</tr>"; cadenaHtml1 = cadenaHtml1 + "<tr>"; cadenaHtml1 = cadenaHtml1 + "<td>FECHA INICIAL:</td>"; cadenaHtml1 = cadenaHtml1 + "<td align='right'>" + txtDesde.Text + "</td>"; cadenaHtml1 = cadenaHtml1 + "</tr>"; cadenaHtml1 = cadenaHtml1 + "<tr>"; cadenaHtml1 = cadenaHtml1 + "<td>FECHA FINAL:</td>"; cadenaHtml1 = cadenaHtml1 + "<td align='right'>" + txtHasta.Text + "</td>"; cadenaHtml1 = cadenaHtml1 + "</tr>"; cadenaHtml1 = cadenaHtml1 + "<tr>"; cadenaHtml1 = cadenaHtml1 + "<td>REGION:</td>"; cadenaHtml1 = cadenaHtml1 + "<td align='right'>" + ddRegion.SelectedItem.Text + "</td>"; cadenaHtml1 = cadenaHtml1 + "</tr>"; cadenaHtml1 = cadenaHtml1 + "<tr>"; cadenaHtml1 = cadenaHtml1 + "<td>ZONA:</td>"; cadenaHtml1 = cadenaHtml1 + "<td align='right'>" + ddZona.SelectedItem.Text + "</td>"; cadenaHtml1 = cadenaHtml1 + "</tr>"; cadenaHtml1 = cadenaHtml1 + "<tr>"; cadenaHtml1 = cadenaHtml1 + "<td>LOCALIDAD:</td>"; cadenaHtml1 = cadenaHtml1 + "<td align='right'>" + ddLocalidad.SelectedItem.Text + "</td>"; cadenaHtml1 = cadenaHtml1 + "</tr>"; cadenaHtml1 = cadenaHtml1 + "<tr>"; cadenaHtml1 = cadenaHtml1 + "<td>TRABAJADOR:</td>"; cadenaHtml1 = cadenaHtml1 + "<td align='right'>" + ddlTrabajador.SelectedItem.Text + "</td>"; cadenaHtml1 = cadenaHtml1 + "</tr>"; cadenaHtml1 = cadenaHtml1 + "<tr>"; cadenaHtml1 = cadenaHtml1 + "<td>CONTRATISTA:</td>"; cadenaHtml1 = cadenaHtml1 + "<td align='right'>" + combo_contratista.SelectedItem.Text + "</td>"; cadenaHtml1 = cadenaHtml1 + "</tr>"; cadenaHtml1 = cadenaHtml1 + "</table>"; cadenaHtml1 = cadenaHtml1 + "<br></br>"; cadenaHtml1 = cadenaHtml1 + "<br></br>"; cadenaHtml2 = cadenaHtml2 + "<table border='1'>"; cadenaHtml2 = cadenaHtml2 + "<tr>"; cadenaHtml2 = cadenaHtml2 + "<td align='center'>DETALLE</td>"; cadenaHtml2 = cadenaHtml2 + "<td align='center'>CANTIDAD</td>"; cadenaHtml2 = cadenaHtml2 + "<td align='center'>PORCENTAJE</td>"; cadenaHtml2 = cadenaHtml2 + "</tr>"; cadenaHtml2 = cadenaHtml2 + "<tr>"; cadenaHtml2 = cadenaHtml2 + "<td>Total Ordenes de Cambio:</td>"; cadenaHtml2 = cadenaHtml2 + "<td align='left'>" + txt_total.Text + "</td>"; cadenaHtml2 = cadenaHtml2 + "</tr>"; cadenaHtml2 = cadenaHtml2 + "<tr>"; cadenaHtml2 = cadenaHtml2 + "<td>Total Ordenes de Cambio Visitadas:</td>"; cadenaHtml2 = cadenaHtml2 + "<td align='left'>" + txt_cant_leidas.Text + "</td>"; cadenaHtml2 = cadenaHtml2 + "<td align='left'>" + txt_leidas.Text + " %</td>"; cadenaHtml2 = cadenaHtml2 + "</tr>"; cadenaHtml2 = cadenaHtml2 + "<tr>"; cadenaHtml2 = cadenaHtml2 + "<td>Total Ordenes de Cambio por Visitar:</td>"; cadenaHtml2 = cadenaHtml2 + "<td align='left'>" + txt_cant_pendientes.Text + "</td>"; cadenaHtml2 = cadenaHtml2 + "<td align='left'>" + txt_pendientes.Text + " %</td>"; cadenaHtml2 = cadenaHtml2 + "</tr>"; cadenaHtml2 = cadenaHtml2 + "<tr>"; cadenaHtml2 = cadenaHtml2 + "<td>Total Cambios Efectivos:</td>"; cadenaHtml2 = cadenaHtml2 + "<td align='left'>" + txt_cant_efectivas.Text + "</td>"; cadenaHtml2 = cadenaHtml2 + "<td align='left'>" + txt_efectivos.Text + " %</td>"; cadenaHtml2 = cadenaHtml2 + "</tr>"; cadenaHtml2 = cadenaHtml2 + "<tr>"; cadenaHtml2 = cadenaHtml2 + "<td>Total Cambios Improcedentes:</td>"; cadenaHtml2 = cadenaHtml2 + "<td align='left'>" + txt_cant_improcedentes.Text + "</td>"; cadenaHtml2 = cadenaHtml2 + "<td align='left'>" + txt_sin_lecturas.Text + " %</td>"; cadenaHtml2 = cadenaHtml2 + "</tr>"; cadenaHtml2 = cadenaHtml2 + "</table>"; Response.Clear(); Response.Buffer = true; Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", "attachment;filename=InformeEfectividadOperativaCambioMedidor.xls"); Response.Charset = "UTF-8"; Response.ContentEncoding = System.Text.Encoding.Default; Response.Write(cadenaHtml1); System.IO.StringWriter tw1 = new System.IO.StringWriter(); System.IO.StringWriter tw2 = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw1 = new System.Web.UI.HtmlTextWriter(tw1); System.Web.UI.HtmlTextWriter hw2 = new System.Web.UI.HtmlTextWriter(tw2); GrillaEfectividadLector.RenderControl(hw1); GrillaEfectividad_lector_impro.RenderControl(hw2); Response.Write(tw1.ToString()); Response.Write(cadenaHtml); //'ESPACIO Response.Write(tw2.ToString()); Response.Write(cadenaHtml); //'ESPACIO Response.Write(cadenaHtml); //'ESPACIO Response.Write(cadenaHtml2); //'ESPACIO Response.End(); GrillaEfectividadLector.AllowPaging = true; GrillaEfectividad_lector_impro.AllowPaging = true; }
public void Carga_Efectivas() { String rutaXml = Server.MapPath("./sessiones/") + "usuario_" + Session.SessionID + ".xml"; PRO.recSession(rutaXml, "RUT_EMPRESA"); String rutRegion = PRO.recSession(rutaXml, "RUT_EMPRESA"); OracleConnection objConexion = new OracleConnection(conexion_cliente_oracle); OracleDataAdapter objComando; DataTable dtOrdenes = new DataTable(); objComando = new OracleDataAdapter("REPORTE_EFEC_MED.CARGA_EFECTIVAS", objConexion); PRO.agrega_parametro_sp(objComando, "o_cursor", OracleType.Cursor, ParameterDirection.Output, ""); PRO.agrega_parametro_sp(objComando, "i_rut_empresa", OracleType.NVarChar, ParameterDirection.Input, rutRegion); PRO.agrega_parametro_sp(objComando, "i_id_zona", OracleType.Number, ParameterDirection.Input, ddZona.SelectedValue); PRO.agrega_parametro_sp(objComando, "i_id_region", OracleType.Number, ParameterDirection.Input, ddRegion.SelectedValue); PRO.agrega_parametro_sp(objComando, "i_id_localidad", OracleType.Number, ParameterDirection.Input, ddLocalidad.SelectedValue); PRO.agrega_parametro_sp(objComando, "i_cod_instalador", OracleType.Number, ParameterDirection.Input, ddlTrabajador.SelectedValue); PRO.agrega_parametro_sp(objComando, "i_id_contratista", OracleType.Number, ParameterDirection.Input, combo_contratista.SelectedValue); PRO.agrega_parametro_sp(objComando, "i_id_tipo_proceso", OracleType.Number, ParameterDirection.Input, ddlProceso.SelectedValue); PRO.agrega_parametro_sp(objComando, "i_FECHA_INICIO", OracleType.NVarChar, ParameterDirection.Input, txtDesde.Text); PRO.agrega_parametro_sp(objComando, "i_FECHA_FIN", OracleType.NVarChar, ParameterDirection.Input, txtHasta.Text); objComando.SelectCommand.CommandType = CommandType.StoredProcedure; objConexion.Open(); objComando.Fill(dtOrdenes); objConexion.Close(); objConexion.Dispose(); DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("CLAVE", typeof(Int32))); dt.Columns.Add(new DataColumn("DESCRIPCION", typeof(String))); dt.Columns.Add(new DataColumn("CANTIDAD", typeof(String))); dt.Columns.Add(new DataColumn("PORCENTAJE", typeof(String))); //dt.Columns.Add(new DataColumn("TOTAL", typeof(String))); DataRow dr; int total = 0; foreach (DataRow drOrdenItem in dtOrdenes.Rows) { dr = dt.NewRow(); dr["CLAVE"] = drOrdenItem["CLAVE"].ToString(); dr["DESCRIPCION"] = drOrdenItem["DESCRIPCION"].ToString(); dr["CANTIDAD"] = drOrdenItem["CANTIDAD"].ToString(); dr["PORCENTAJE"] = drOrdenItem["PORCENTAJE"].ToString(); // dr["TOTAL"] = drOrdenItem["TOTAL"].ToString(); dt.Rows.Add(dr); total = total + 1; } if (dtOrdenes.Rows.Count > 1) { EFECTIVAS.Visible = true; } DataView MydataView; MydataView = new DataView(dt); GrillaEfectividadLector.DataSource = MydataView; GrillaEfectividadLector.DataBind(); int c; for (c = 0; c < GrillaEfectividadLector.Rows.Count; c++) { GrillaEfectividadLector.Rows[c].BackColor = System.Drawing.Color.LightGreen; } }