private void ObtenerReporte(bool forzarBD) { if (ViewState["listar"] == null || forzarBD) { ReportBC r = new ReportBC(); DateTime desde = Convert.ToDateTime(txt_desde.Text); DateTime hasta = Convert.ToDateTime(txt_hasta.Text); int prov_id = Convert.ToInt32(ddl_local.SelectedValue); int site_id = Convert.ToInt32(ddl_site.SelectedValue); int soli_id = 0; if (!string.IsNullOrEmpty(txt_nroViaje.Text)) { soli_id = Convert.ToInt32(txt_nroViaje.Text); } string placa = txt_placa.Text; string nro_flota = txt_nroFlota.Text; ViewState["listar"] = r.CargarDevoluciones(desde, hasta, prov_id, soli_id, placa, nro_flota, site_id); } DataView dw = new DataView((DataTable)this.ViewState["listar"]); if (this.ViewState["sortExpresion"] != null && this.ViewState["sortExpresion"].ToString() != "") { dw.Sort = (String)this.ViewState["sortExpresion"]; } this.gv_listar.DataSource = dw.ToTable(); this.gv_listar.DataBind(); }
protected void generaPDF(object sender, EventArgs e) { ReportBC r = new ReportBC(); DataTable dt = r.CargarPreEntradaDT(Convert.ToInt32(this.hf_id.Value)); DataColumn codigobarras = new DataColumn("DOC_IMPRESION"); codigobarras.DataType = typeof(byte[]); dt.Columns.Add(codigobarras); Barcode_BC barcode = new Barcode_BC("code128", 005, dt.Rows[0]["DOC_INGRESO_BARRAS"].ToString()); dt.Columns["DOC_IMPRESION"].ReadOnly = false; // dt.Columns["DOC_IMPRESION"].DataType = typeof(System.Drawing.Image); dt.Rows[0]["DOC_IMPRESION"] = barcode.Byte; DataColumn codigobarras2 = new DataColumn("DOC_PATENTE"); codigobarras2.DataType = typeof(byte[]); dt.Columns.Add(codigobarras2); Barcode_BC barcode2 = new Barcode_BC("CODE_39", 003, dt.Rows[0]["TRAI_PLACA"].ToString().ToUpper()); // dt.Rows[0]["TRAI_PLACA"].ToString().ToUpper()); dt.Columns["DOC_PATENTE"].ReadOnly = false; // dt.Columns["DOC_IMPRESION"].DataType = typeof(System.Drawing.Image); dt.Rows[0]["DOC_PATENTE"] = barcode2.Byte; ReportDataSource dataSource = new ReportDataSource("DataSet1", dt); this.limpiarTodo(); // barcode.Symbology = KeepAutomation.Barcode.Symbology.Code11; // barcode.CodeToEncode = row.ProductID.ToString(); // barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png; this.ReportViewer1.LocalReport.DataSources.Clear(); this.ReportViewer1.LocalReport.DataSources.Add(dataSource); Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; //Word byte[] bytes = this.ReportViewer1.LocalReport.Render( "PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings); //byte[] renderedBytes = this.ReportViewer1.LocalReport.Render("PDF"); this.Response.Clear(); this.Response.ContentType = mimeType; this.Response.AddHeader("content-disposition", string.Format("attachment; filename=Doc_PreIngreso_{0}{1}{2}", this.txt_buscarDoc.Text, '.', extension)); this.Response.BinaryWrite(bytes); this.Response.End(); }
private void ObtenerReporte() { ReportBC r = new ReportBC(); DateTime desde = Convert.ToDateTime(this.txt_desde.Text); DateTime hasta = Convert.ToDateTime(this.txt_hasta.Text); DataTable dt = r.OttawaXMov(desde, hasta, this.ddl_buscarSite.SelectedValue); this.ViewState["listar"] = dt; this.gv_listar.DataSource = dt; this.gv_listar.DataBind(); }
private void ObtenerReporte() { ReportBC r = new ReportBC(); DateTime desde = Convert.ToDateTime(this.txt_desde.Text); DateTime hasta = Convert.ToDateTime(this.txt_hasta.Text); DataTable dt = r.Historia_bloqueos(desde, hasta); this.ViewState["listar"] = dt; this.gv_listar.DataSource = dt; this.gv_listar.DataBind(); }
protected void gv_listar_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "VER") { int id = Convert.ToInt32(e.CommandArgument); lbl_modalDetalleTitulo.Text = string.Format("Detalle Solicitud N°{0}", id); ReportBC r = new ReportBC(); gv_detalle.DataSource = r.CargarSolicitudesCargaDetalle(id); gv_detalle.DataBind(); utils.AbrirModal(this, "modalDetalle"); } }
protected void generaPDF(object sender, EventArgs e) { ReportBC r = new ReportBC(); DataTable dt = r.CargarPreEntradaDT(Convert.ToInt32(hf_id.Value)); DataColumn codigobarras = new DataColumn("DOC_IMPRESION"); codigobarras.DataType = typeof(byte[]); dt.Columns.Add(codigobarras); Barcode_BC barcode = new Barcode_BC("code128", 005, dt.Rows[0]["DOC_INGRESO_BARRAS"].ToString()); dt.Columns["DOC_IMPRESION"].ReadOnly = false; dt.Rows[0]["DOC_IMPRESION"] = barcode.Byte; DataColumn codigobarras2 = new DataColumn("DOC_PATENTE"); codigobarras2.DataType = typeof(byte[]); dt.Columns.Add(codigobarras2); Barcode_BC barcode2 = new Barcode_BC("CODE_39", 003, dt.Rows[0]["TRAI_PLACA"].ToString().ToUpper()); dt.Columns["DOC_PATENTE"].ReadOnly = false; dt.Rows[0]["DOC_PATENTE"] = barcode2.Byte; ReportDataSource dataSource = new ReportDataSource("DataSet1", dt); limpiarTodo(); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(dataSource); Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; //Word byte[] bytes = ReportViewer1.LocalReport.Render( "PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings); Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", "attachment; filename=Doc_PreIngreso_" + txt_buscarDoc.Text + '.' + extension); Response.BinaryWrite(bytes); Response.End(); }
private void ObtenerReporte() { ReportBC r = new ReportBC(); int site_id = Convert.ToInt32(this.ddl_buscarSite.SelectedValue); int moti_id = Convert.ToInt32(this.ddl_moti.SelectedValue); int usua_id = Convert.ToInt32(this.ddl_usuario.SelectedValue); int remo_id = Convert.ToInt32(this.ddl_remo.SelectedValue); DateTime desde = Convert.ToDateTime(this.txt_desde.Text); DateTime hasta = Convert.ToDateTime(this.txt_hasta.Text); DataTable dt = r.Ottawa(site_id, remo_id, moti_id, usua_id, null, desde, hasta); DataTable mostrar = new DataTable(); mostrar.Columns.Add("Hora"); for (DateTime fecha = desde; fecha <= hasta; fecha = fecha.AddDays(1.0)) { mostrar.Columns.Add(fecha.ToShortDateString()); } for (int hora = 0; hora < 24; hora++) { string[] fila = new string[mostrar.Columns.Count]; fila[0] = new DateTime().AddHours(hora).ToShortTimeString(); for (int cont = 1; cont < mostrar.Columns.Count; cont++) { DateTime fh = Convert.ToDateTime(mostrar.Columns[cont].ColumnName).AddHours(hora); //fila[cont] = "-"; int cant = 0; for (int x = 2; x < dt.Columns.Count - 1; x++) { string[] strcol = dt.Columns[x].ColumnName.Split("#".ToCharArray()); DateTime fh2 = Convert.ToDateTime(strcol[0]).AddHours(Convert.ToInt32(strcol[1])); if (fh2 == fh) { foreach (DataRow dr in dt.Rows) { cant += Convert.ToInt32(dr[x]); } } } fila[cont] = cant.ToString(); } mostrar.Rows.Add(fila); } this.ViewState["listar"] = mostrar; this.gv_listar.DataSource = mostrar; this.gv_listar.DataBind(); }
private void ObtenerUltEstados(bool forzarBD) { if (this.ViewState["listar"] == null || forzarBD) { TrailerBC trailer = new TrailerBC(); if (!string.IsNullOrEmpty(this.txt_nroFlota.Text) || !string.IsNullOrEmpty(this.txt_placa.Text)) { if (!string.IsNullOrEmpty(this.txt_nroFlota.Text)) { trailer = trailer.obtenerXNro(this.txt_nroFlota.Text); } else if (utils.patentevalida(this.txt_placa.Text) == true) { trailer = trailer.obtenerXPlaca(this.txt_placa.Text); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Patente Invalida.');", true); return; } if (trailer.ID != 0) { ReportBC r = new ReportBC(); int site_id = Convert.ToInt32(this.ddl_site.SelectedValue); DateTime desde = Convert.ToDateTime(this.txt_desde.Text); DateTime hasta = Convert.ToDateTime(this.txt_hasta.Text); this.ViewState["listar"] = r.TrailerUltEstado(site_id, trailer.ID, desde, hasta); } } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Debe seleccionar un trailer');", true); return; } } DataView dw = new DataView((DataTable)this.ViewState["listar"]); if (this.ViewState["sortExpresion"] != null && this.ViewState["sortExpresion"].ToString() != "") { dw.Sort = (String)this.ViewState["sortExpresion"]; } this.gv_listar.DataSource = dw; this.gv_listar.DataBind(); }
private void ObtenerReporte(bool forzarBD) { if (this.ViewState["listar"] == null || forzarBD) { DateTime desde = Convert.ToDateTime(this.txt_desde.Text); DateTime hasta = Convert.ToDateTime(this.txt_hasta.Text); ReportBC r = new ReportBC(); this.ViewState["listar"] = r.CargarSalidasLoAguirre(desde, hasta); } DataView dw = new DataView((DataTable)this.ViewState["listar"]); if (this.ViewState["sortExpresion"] != null && this.ViewState["sortExpresion"].ToString() != "") { dw.Sort = (String)this.ViewState["sortExpresion"]; } this.gv_listar.DataSource = dw.ToTable(); this.gv_listar.DataBind(); }
private void ObtenerReporte(bool forzarBD) { if (this.ViewState["listar"] == null || forzarBD) { int site_id = Convert.ToInt32(this.ddl_site.SelectedValue); DateTime desde = Convert.ToDateTime(this.txt_desde.Text); DateTime hasta = Convert.ToDateTime(this.txt_hasta.Text); ReportBC r = new ReportBC(); this.ViewState["listar"] = r.Cargaryardtag(site_id, desde, hasta, txt_placa.Text); } DataView dw = new DataView((DataTable)this.ViewState["listar"]); if (this.ViewState["sortExpresion"] != null && this.ViewState["sortExpresion"].ToString() != "") { dw.Sort = (String)this.ViewState["sortExpresion"]; } this.gv_listar.DataSource = dw.ToTable(); this.gv_listar.DataBind(); }
private void ObtenerReporte() { int site_id = Convert.ToInt32(ddl_site.SelectedValue); DateTime desde = Convert.ToDateTime(txt_desde.Text); DateTime hasta = Convert.ToDateTime(txt_hasta.Text); DataTable dt = new ReportBC().Reporte_KPIHist(site_id, desde, hasta); string tiempo_promedio_anden_carga = dt.Rows[0]["TIEMPO_PROMEDIO_ANDEN_CARGA"].ToString(); string tiempo_max_anden_carga = dt.Rows[0]["TIEMPO_MAXIMO_ANDEN_CARGA"].ToString(); string tiempo_min_anden_carga = dt.Rows[0]["TIEMPO_MINIMO_ANDEN_CARGA"].ToString(); string tiempo_promedio_anden_descarga = dt.Rows[0]["TIEMPO_PROMEDIO_ANDEN_DESCARGA"].ToString(); string tiempo_max_anden_descarga = dt.Rows[0]["TIEMPO_MAXIMO_ANDEN_DESCARGA"].ToString(); string tiempo_min_anden_descarga = dt.Rows[0]["TIEMPO_MINIMO_ANDEN_DESCARGA"].ToString(); lbl_tiempoPromedioCarga.Text = tiempo_promedio_anden_carga.ToString(); lbl_tiempoMaxCarga.Text = tiempo_max_anden_carga.ToString(); lbl_tiempoMinCarga.Text = tiempo_min_anden_carga.ToString(); lbl_tiempoPromedioDescarga.Text = tiempo_promedio_anden_descarga.ToString(); lbl_tiempoMaxDescarga.Text = tiempo_max_anden_descarga.ToString(); lbl_tiempoMinDescarga.Text = tiempo_min_anden_descarga.ToString(); }
private void ObtenerReporte() { int site_id = Convert.ToInt32(ddl_site.SelectedValue); DataTable dt = new ReportBC().Reporte_KPI(site_id); int trailer_total = Convert.ToInt32(dt.Rows[0]["TRAILER_TOTAL"]); int trailer_vacios = Convert.ToInt32(dt.Rows[0]["TRAILER_VACIOS"]); int trailer_cargados = Convert.ToInt32(dt.Rows[0]["TRAILER_CARGADOS"]); int andenes_vacios = Convert.ToInt32(dt.Rows[0]["ANDENES_VACIOS"]); int andenes_ocupados = Convert.ToInt32(dt.Rows[0]["ANDENES_OCUPADOS"]); string tiempo_promedio_anden_carga = dt.Rows[0]["TIEMPO_PROMEDIO_ANDEN_CARGA"].ToString(); string tiempo_max_anden_carga = dt.Rows[0]["TIEMPO_MAXIMO_ANDEN_CARGA"].ToString(); string tiempo_min_anden_carga = dt.Rows[0]["TIEMPO_MINIMO_ANDEN_CARGA"].ToString(); string tiempo_promedio_anden_descarga = dt.Rows[0]["TIEMPO_PROMEDIO_ANDEN_DESCARGA"].ToString(); string tiempo_max_anden_descarga = dt.Rows[0]["TIEMPO_MAXIMO_ANDEN_DESCARGA"].ToString(); string tiempo_min_anden_descarga = dt.Rows[0]["TIEMPO_MINIMO_ANDEN_DESCARGA"].ToString(); string tiempo_estacionamiento = dt.Rows[0]["TIEMPO_ESTACIONAMIENTO"].ToString(); string cantidad_estacionamiento = dt.Rows[0]["cantidad_estacionamiento"].ToString(); string cantidad_anden_cargado = dt.Rows[0]["cantidad_anden_cargado"].ToString(); string cantidad_anden_descargado = dt.Rows[0]["cantidad_anden_vacio"].ToString(); string script = string.Format("cargaGauge({1},{0});", andenes_ocupados, andenes_vacios); string cantidad_estacionamiento_cargado = dt.Rows[0]["cantidad_estacionamiento_cargado"].ToString(); string cantidad_estacionamiento_vacio = dt.Rows[0]["cantidad_estacionamiento_vacio"].ToString(); lbl_trailerVacio.Text = trailer_vacios.ToString(); lbl_trailerCargado.Text = trailer_cargados.ToString(); lbl_tiempoPromedioCarga.Text = tiempo_promedio_anden_carga.ToString(); lbl_tiempoMaxCarga.Text = tiempo_max_anden_carga.ToString(); lbl_tiempoMinCarga.Text = tiempo_min_anden_carga.ToString(); lbl_tiempoPromedioDescarga.Text = tiempo_promedio_anden_descarga.ToString(); lbl_tiempoMaxDescarga.Text = tiempo_max_anden_descarga.ToString(); lbl_tiempoMinDescarga.Text = tiempo_min_anden_descarga.ToString(); lbl_tiempoPromedioEstacionamiento.Text = tiempo_estacionamiento.ToString(); lbl_cantidadEstacionamiento.Text = cantidad_estacionamiento.ToString(); lbl_cantidad_cargado.Text = cantidad_anden_cargado; lbl_cantidad_vacio.Text = cantidad_anden_descargado; lbl_cantidadEstacionamiento_cargado.Text = cantidad_estacionamiento_cargado; lbl_cantidadEstacionamiento_vacio.Text = cantidad_estacionamiento_vacio; lbl_andenesLibres.Text = andenes_vacios.ToString(); lbl_andenesOcupados.Text = andenes_ocupados.ToString(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "gauge", script, true); }
private void ObtenerReporte(bool forzarBD) { if (ViewState["listar"] == null || forzarBD) { ReportBC r = new ReportBC(); DateTime desde = Convert.ToDateTime(txt_desde.Text); DateTime hasta = Convert.ToDateTime(txt_hasta.Text); string placa = txt_placa.Text; int site_id = Convert.ToInt32(ddl_site.SelectedValue); int play_id = Convert.ToInt32(ddl_playa.SelectedValue); ViewState["listar"] = r.CargarSolicitudesDescarga(desde, hasta, placa, site_id, play_id); } DataView dw = new DataView((DataTable)this.ViewState["listar"]); if (this.ViewState["sortExpresion"] != null && this.ViewState["sortExpresion"].ToString() != "") { dw.Sort = (String)this.ViewState["sortExpresion"]; } this.gv_listar.DataSource = dw.ToTable(); this.gv_listar.DataBind(); }
private void ObtenerReporte(bool forzarBD) { if (ViewState["lista"] == null || forzarBD) { ReportBC report = new ReportBC(); string trai_placa = txt_buscarPlaca.Text; string trai_nro = txt_buscarNro.Text; int site_id = Convert.ToInt32(ddl_site.SelectedValue); int trti_id = Convert.ToInt32(ddl_buscarTipo.SelectedValue); int tran_id = Convert.ToInt32(ddl_buscarTransportista.SelectedValue); ViewState["lista"] = (chk_buscarInterno.Checked) ? report.Reporte_TrailerGPS(false, trai_placa, trai_nro, trti_id, tran_id, site_id) : report.Reporte_TrailerGPS(trai_placa, trai_nro, trti_id, tran_id, site_id); } DataView dw = new DataView((DataTable)ViewState["lista"]); if (ViewState["sortExpresion"] != null && ViewState["sortExpresion"].ToString() != "") { dw.Sort = (String)ViewState["sortExpresion"]; } gv_listar.DataSource = dw; gv_listar.DataBind(); }
protected void btn_pdf_click(object sender, EventArgs e) { PreRutaBC gd = new PreRutaBC(); String mimeType = ""; try { // DataTable excel = gd.CrearEnvio(hseleccionado.Value.ToString(), user.USUA_ID, chk_archivar.Checked); // ViewState["lista"] = excel; // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "exp", "exportar();", true); if (hseleccionado.Value == "") { utils.ShowMessage(this, "Seleccione al menos un viaje", "error", false); return; } this.pnlReport.Visible = true; ReportBC report = new ReportBC(); // VIAJEBC v = new VIAJEBC().ObtenerXID(Convert.ToInt32(this.tbidviajed.Text)); List <int> ids = hseleccionado.Value.ToString().Split(',').Select(int.Parse).ToList(); string zip = GenerateFileNamezipPDF("hr_", ".zip"); int contador = 0; if (ids.Count == 1) { try { // DataTable excel = gd.CrearEnvio(hseleccionado.Value.ToString(), user.USUA_ID, chk_archivar.Checked); // ViewState["lista"] = excel; // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "exp", "exportar();", true); this.pnlReport.Visible = true; DataTable datos = report.obrenerReporteDespachoViaje(ids[0].ToString()); ReportDataSource dataSource = new ReportDataSource("Datos", datos); this.ReportViewer1.LocalReport.DataSources.Clear(); this.ReportViewer1.LocalReport.DataSources.Add(dataSource); Warning[] warnings; string[] streamids; string encoding; string extension; //Word byte[] bytes = this.ReportViewer1.LocalReport.Render( "PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings); //byte[] renderedBytes = this.ReportViewer1.LocalReport.Render("PDF"); this.Response.Clear(); this.Response.ContentType = mimeType; this.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}{1}{2}", datos.Rows[0]["numero"].ToString(), '.', extension)); this.Response.BinaryWrite(bytes); this.Response.End(); } catch (Exception ex) { utils.ShowMessage(this, ex.Message, "error", false); } finally { ObtenerRutas(true); } } else { while (contador < ids.Count) { DataTable datos = report.obrenerReporteDespachoViaje(ids[contador].ToString()); ReportDataSource dataSource = new ReportDataSource("Datos", datos); this.ReportViewer1.LocalReport.DataSources.Clear(); this.ReportViewer1.LocalReport.DataSources.Add(dataSource); Warning[] warnings; string[] streamids; string encoding; string extension; //Word byte[] bytes = this.ReportViewer1.LocalReport.Render( "PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings); //byte[] renderedBytes = this.ReportViewer1.LocalReport.Render("PDF"); Stream stream = new MemoryStream(bytes); UtilsWeb.AddStreamToZip(zip, stream, GenerateFileNamezipPDF("hr_" + datos.Rows[0]["numero"].ToString(), ".pdf")); contador = contador + 1; } //this.Response.Clear(); //this.Response.ContentType = mimeType; //this.Response.AddHeader("content-disposition", string.Format("attachment; filename=Hoja_Ruta_{0}{1}{2}", 'a', '.', extension)); //this.Response.BinaryWrite(bytes); //this.Response.End(); Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", "attachment; filename=" + "descarga_multiple.zip"); Response.BinaryWrite(File.ReadAllBytes(zip)); // File.Delete(Server.MapPath("./cargadefotos/Output.zip")); File.Delete(zip); Response.End(); } } catch (Exception ex) { utils.ShowMessage(this, ex.Message, "error", false); } finally { ObtenerRutas(true); } }