Пример #1
0
        private void Imprimir(object p, string p_2)
        {
            Business.Data.Laboratorio.Protocolo oProt = new Business.Data.Laboratorio.Protocolo();
            oProt = (Business.Data.Laboratorio.Protocolo)oProt.Get(typeof(Business.Data.Laboratorio.Protocolo), int.Parse(p.ToString()));

            oProt.GrabarAuditoriaProtocolo("Genera PDF Comprobante", int.Parse(Session["idUsuario"].ToString()));

            Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);

            oCon = (Configuracion)oCon.Get(typeof(Configuracion), "IdConfiguracion", 1);

            ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();

            encabezado1.Value = oCon.EncabezadoLinea1;

            ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();

            encabezado2.Value = oCon.EncabezadoLinea2;

            ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue();

            encabezado3.Value = oCon.EncabezadoLinea3;


            ParameterDiscreteValue tipoNumeracion = new ParameterDiscreteValue();

            tipoNumeracion.Value = oCon.TipoNumeracionProtocolo;



            oCr.Report.FileName = "../Informes/Protocolo.rpt";
            oCr.ReportDocument.SetDataSource(oProt.GetDataSet("Protocolo", "", oProt.IdTipoServicio.IdTipoServicio));

            oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
            oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
            oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
            oCr.ReportDocument.ParameterFields[3].CurrentValues.Add(tipoNumeracion);

            oCr.DataBind();
            if (p_2 == "I")
            {
                oCr.ReportDocument.PrintToPrinter(1, false, 0, 0);
            }
            else
            {
                MemoryStream oStream; // using System.IO
                oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(ExportFormatType.PortableDocFormat);
                Response.Clear();
                Response.Buffer      = true;
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", "attachment;filename=Protocolo.pdf");

                Response.BinaryWrite(oStream.ToArray());
                Response.End();
            }
        }
Пример #2
0
    ///<summary>
    ///功能:拉模式提取水晶报表
    ///个人主页:http://www.dzend.com/
    ///</summary>
    ///<param name="sender"></param>
    ///<param name="e"></param>
    ///
    public int view_report(CrystalReportViewer CrystalReportViewer1, string file_name, string report_sql)
    {
        // CrystalReport.rpt是水晶报表文件的名称;CrystalReportSource1是从工具箱加到页面上的水晶报表数据源对像。


        ExcuteDataTable(dt_report, report_sql, CommandType.Text);
        try
        {
            CrystalReportSource cs = new CrystalReportSource();
            cs.ReportDocument.Load(file_name);
            cs.ReportDocument.SetDataSource(dt_report);
            cs.DataBind();

            for (int i = 0; i < cs.ReportDocument.ParameterFields.Count; i++)
            {
                string ls_part = cs.ReportDocument.ParameterFields[i].Name;
            }

            CrystalReportViewer1.ReportSource = cs;
            CrystalReportViewer1.DataBind();

            return(1);
        }
        catch (Exception e)
        {
            return(-1);
        }
    }
Пример #3
0
        private void Imprimir(object p)
        {
            //Aca se deberá consultar los parametros para mostrar una hoja de trabajo u otra
            //this.CrystalReportSource1.Report.FileName = "HTrabajo2.rpt";
            string        informe = "../Informes/Turno.rpt";
            Configuracion oCon    = new Configuracion();              oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);

            ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();

            encabezado1.Value = oCon.EncabezadoLinea1;

            ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();

            encabezado2.Value = oCon.EncabezadoLinea2;

            ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue();

            encabezado3.Value = oCon.EncabezadoLinea3;

            Turno oTurno = new Turno();

            oTurno = (Turno)oTurno.Get(typeof(Turno), int.Parse(p.ToString()));


            oCr.Report.FileName = informe;
            oCr.ReportDocument.SetDataSource(oTurno.GetDataSet());
            oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
            oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
            oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
            oCr.DataBind();

            //if (rdbImprimir.Items[0].Selected == true)//imprimir
            //   oCr.ReportDocument.PrintToPrinter(1, false, 0,0);
            //else
            //{
            MemoryStream oStream; // using System.IO

            oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            Response.Clear();
            Response.Buffer      = true;
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", "attachment;filename=Turno.pdf");

            Response.BinaryWrite(oStream.ToArray());
            Response.End();
            //}
        }
Пример #4
0
        private void MostrarInforme(string tipo)
        {
            DataTable dt = new DataTable();

            dt = GetDataSet(GenerarListaProtocolos(), "pdf");

            if (dt.Rows.Count > 0)
            {
                //Aca se deberá consultar los parametros para mostrar una hoja de trabajo u otra
                //this.oCr.Report.FileName = "HTrabajo2.rpt";
                string        informe = "../Informes/Derivacion.rpt";
                Configuracion oCon    = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);

                ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();
                encabezado1.Value = oCon.EncabezadoLinea1;

                ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();
                encabezado2.Value = oCon.EncabezadoLinea2;

                ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue();
                encabezado3.Value = oCon.EncabezadoLinea3;


                //if (oCon.TipoHojaTrabajo == 0) informe = "HTrabajo.rpt";
                //if (oCon.TipoHojaTrabajo == 1) informe = "HTrabajo2.rpt";
                oCr.Report.FileName = informe;
                oCr.ReportDocument.SetDataSource(dt);
                oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
                oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
                oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
                oCr.DataBind();

                if (tipo == "Imprimir")//imprimir
                {
                    //oCr.ReportDocument.PrintOptions.PrinterName = oCon.NombreImpresora;
                    //oCr.ReportDocument.PrintToPrinter(1, false, 0, 0);
                }
                else
                {
                    oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Derivaciones.pdf");

                    //MemoryStream oStream; // using System.IO
                    //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                    //Response.Clear();
                    //Response.Buffer = true;
                    //Response.ContentType = "application/pdf";

                    //Response.AddHeader("Content-Disposition", "attachment;filename=Derivaciones.pdf");

                    //Response.BinaryWrite(oStream.ToArray());
                    ////    string popupImprimir = "<script language='JavaScript'> windows.print(); </script>";
                    ////Page.RegisterStartupScript("PopupScriptImprimir", popupImprimir);

                    //Response.End();
                }
            }
        }
Пример #5
0
        private void ImprimirAuditoria()
        {
            DataTable dtAuditoria = GetDataSetAuditoria();

            if (dtAuditoria.Columns.Count > 2)
            {
                Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);

                ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();
                encabezado1.Value = oCon.EncabezadoLinea1;

                ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();
                encabezado2.Value = oCon.EncabezadoLinea2;

                ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue();
                encabezado3.Value = oCon.EncabezadoLinea3;


                oCr.Report.FileName = "AuditoriaProtocolo.rpt";
                oCr.ReportDocument.SetDataSource(dtAuditoria);
                oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
                oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
                oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
                oCr.DataBind();

                oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Auditoria" + txtProtocolo.Text + ".pdf");


                //MemoryStream oStream; // using System.IO
                //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                //Response.Clear();
                //Response.Buffer = true;
                //Response.ContentType = "application/pdf";
                //Response.AddHeader("Content-Disposition", "attachment;filename=Auditoria" + txtProtocolo.Text + ".pdf");

                //Response.BinaryWrite(oStream.ToArray());
                //Response.End();
            }
            else
            {
                string popupScript = "<script language='JavaScript'> alert('No se encontraron datos para el numero de protocolo ingresado.'); </script>";
                Page.RegisterStartupScript("PopupScript", popupScript);
            }
        }
Пример #6
0
        private void MostrarPDF()
        {
            //DataTable dt = new DataTable();
            DataTable dt = getDatosEstadisticos("C");

            if (dt.Rows.Count > 0)
            {
                Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);

                ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();
                encabezado1.Value = oCon.EncabezadoLinea1;

                ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();
                encabezado2.Value = oCon.EncabezadoLinea2;

                ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue();
                encabezado3.Value = oCon.EncabezadoLinea3;

                ParameterDiscreteValue encabezado4 = new ParameterDiscreteValue();
                encabezado4.Value = "ASISTENCIAS DE TURNOS";

                oCr.Report.FileName = "Turno.rpt";



                ParameterDiscreteValue subTitulo = new ParameterDiscreteValue();
                subTitulo.Value = txtFechaDesde.Value + " - " + txtFechaHasta.Value;



                oCr.ReportDocument.SetDataSource(dt);
                oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
                oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
                oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
                oCr.ReportDocument.ParameterFields[3].CurrentValues.Add(encabezado4);
                oCr.ReportDocument.ParameterFields[4].CurrentValues.Add(subTitulo);

                oCr.DataBind();

                oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Estadistica_Turno.pdf");


                //MemoryStream oStream; // using System.IO
                //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                //Response.Clear();
                //Response.Buffer = true;
                //Response.ContentType = "application/pdf";
                //Response.AddHeader("Content-Disposition", "attachment;filename=Estadistica_Turno.pdf");

                //Response.BinaryWrite(oStream.ToArray());
                //Response.End();
            }
        }
Пример #7
0
    private void MakeReport(bool save = false)
    {
        string oonum  = "-";
        string oodate = "-";
        string propno = this.propno.ToString();
        string type;
        string pdfPath;

        if (save)
        {
            oonum  = txtoonum.Text;
            oodate = txtoodate.Text;
        }
        //string sql = "select * from cadre.ret_list where propno = " + propno + " order by empid";
        string sql = "select rownum as \"#\", '" + oonum + "' as onum, '" + oodate + "' as odate, a.* from " +
                     "(SELECT e.empid, " +
                     "firstname||' '|| decode(middlename, NULL, '', middlename||' ') || lastname AS name, " +
                     "to_char(e.dob,'dd/MM/YYYY') AS DOB,  md.desgtext as DESG,  ml.locname as LOC, " +
                     "to_char(rl.dor,'dd/MM/YYYY') as DOR, " +
                     "rp.type as reptype " +
                     "FROM cadre.ret_list rl, pshr.mast_loc ml, pshr.mast_desg md, pshr.empperso e, cadre.ret_proposals rp " +
                     "WHERE rl.empid = e.empid " +
                     "AND e.cloccode = ml.loccode " +
                     "AND e.cdesgcode = md.desgcode " +
                     "AND rl.propno = " + propno +
                     " AND rp.pno = rl.propno" +
                     " order by md.hecode,e.empid) a";

        OraDBConnection oraCn = new OraDBConnection();

        System.Data.DataSet ds = OraDBConnection.GetData(sql);

        //select report according to type (voluntary or supperannuation)
        type = ds.Tables[0].Rows[0]["reptype"].ToString();
        if (save)
        {
            pdfPath = Server.MapPath("office_orders\\" + oonum + "-BEG-3" + oodate + ".pdf");
        }
        else
        {
            pdfPath = Server.MapPath("office_orders\\preview_ret-" + propno + "-" + DateTime.Now.ToString("yyyyMMdd-HHmmssfff") + ".pdf");
        }

        CrystalReportSource CrystalReportSource1 = new CrystalReportSource();

        CrystalReportSource1.Report.FileName = Server.MapPath("Reports\\rpt_ret_vol.rpt");
        CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
        CrystalReportSource1.DataBind();
        CrystalReportSource1.ReportDocument.ExportToDisk(ExportFormatType.PortableDocFormat, pdfPath);
        CrystalReportSource1.Dispose();
        Utils.DownloadFile(pdfPath);
    }
Пример #8
0
        public MemoryStream imprimirConstancia(int idPaciente)
        {
            SysPaciente p = new SysPaciente(idPaciente);

            CrystalReportSource oCr = new CrystalReportSource();
            string informe          = "../Paciente/Reportes/certificadoSumar.rpt";

            DataTable dt = SPs.PnGetCertificadoSumar(p.NumeroDocumento.ToString()).GetDataSet().Tables[0];

            oCr.Report.FileName = informe;
            oCr.ReportDocument.SetDataSource(dt);
            oCr.DataBind();

            MemoryStream oStream;

            return(oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(ExportFormatType.PortableDocFormat));
        }
Пример #9
0
    public string get_report_condition(CrystalReportViewer CrystalReportViewer1, string file_name, System.Web.UI.HtmlControls.HtmlTable lb_table)
    {
        // CrystalReport.rpt是水晶报表文件的名称;CrystalReportSource1是从工具箱加到页面上的水晶报表数据源对像。

        string ls_conditon = "";

        try
        {
            CrystalReportSource cs = new CrystalReportSource();
            cs.ReportDocument.Load(file_name);
            cs.ReportDocument.SetDataSource(dt_report);
            cs.DataBind();


            for (int i = 0; i < cs.ReportDocument.ParameterFields.Count; i++)
            {
                //string ls_part .Name;
                ParameterField param = cs.ReportDocument.ParameterFields[i];

                HtmlTableRow tr = new HtmlTableRow();

                HtmlTableCell td1 = new HtmlTableCell();

                td1.InnerHtml = param.PromptText;

                tr.Cells.Add(td1);

                HtmlTableCell td2 = new HtmlTableCell();
                td2.InnerHtml = "<span> =</span>";
                tr.Cells.Add(td2);

                HtmlTableCell td3 = new HtmlTableCell();
                td3.InnerHtml = "<input type=\"text\" >";
                tr.Cells.Add(td3);

                lb_table.Rows.Add(tr);
            }
            return("1");
        }
        catch (Exception e)
        {
            return("-1");
        }
        return("0");
    }
Пример #10
0
        private void ImprimirReporte()
        {
            string        informe = "Produccion2.rpt";
            Configuracion oCon    = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);

            ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();

            encabezado1.Value = oCon.EncabezadoLinea1;

            ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();

            encabezado2.Value = oCon.EncabezadoLinea2;

            ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue();

            encabezado3.Value = oCon.EncabezadoLinea3;


            ParameterDiscreteValue rangeFechas = new ParameterDiscreteValue();

            rangeFechas.Value = txtFechaDesde.Value + " - " + txtFechaHasta.Value;



            oCr.Report.FileName = informe;
            oCr.ReportDocument.SetDataSource(GetDataSet());
            oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
            oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
            oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
            oCr.ReportDocument.ParameterFields[3].CurrentValues.Add(rangeFechas);
            oCr.DataBind();


            oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "ProduccionLaboratorio.pdf");
            //MemoryStream oStream; // using System.IO
            //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            //Response.Clear();
            //Response.Buffer = true;
            //Response.ContentType = "application/pdf";
            //Response.AddHeader("Content-Disposition", "attachment;filename=ProduccionLaboratorio.pdf");

            //Response.BinaryWrite(oStream.ToArray());
            //Response.End();
        }
Пример #11
0
        private void Imprimir(string p, string p_2)
        {
            Business.Data.Laboratorio.Protocolo oProt = new Business.Data.Laboratorio.Protocolo();
            oProt = (Business.Data.Laboratorio.Protocolo)oProt.Get(typeof(Business.Data.Laboratorio.Protocolo), int.Parse(p));

            oCr.Report.FileName = "../Informes/Protocolo.rpt";
            oCr.ReportDocument.SetDataSource(oProt.GetDataSet("Protocolo", "", oProt.IdTipoServicio.IdTipoServicio));
            oCr.DataBind();


            switch (p_2)
            {
            case "Pantalla":
            {
                CrystalReportViewer1.ReportSourceID = oCr.ID;
                CrystalReportViewer1.ReportSource   = oCr;
                Condiciones_del_visualizador();
            }
            break;

            case "I":
            { oCr.ReportDocument.PrintToPrinter(1, true, 1, 100); }
            break;

            case "PDF":
            {
                oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Protocolo.pdf");
                //        MemoryStream oStream; // using System.IO
                //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                //Response.Clear();
                //Response.Buffer = true;
                //Response.ContentType = "application/pdf";
                //Response.AddHeader("Content-Disposition", "attachment;filename=Protocolo.pdf");

                //Response.BinaryWrite(oStream.ToArray());
                //Response.End();
            }
            break;
            }
        }
Пример #12
0
        private void Imprimir()
        {
            string[] arr = Request["id"].ToString().Split((".").ToCharArray());

            ///Se descompone el id compuesto= idProtocolo + idEfector y se pasan como parametros
            string idProtocolo = arr[0].ToString();
            string idEfector   = arr[1].ToString();

            oCr.Report.FileName = "Resultado.rpt";
            oCr.ReportDocument.SetDataSource(GetDataResultados(idProtocolo, idEfector));
            oCr.DataBind();

            MemoryStream oStream; // using System.IO

            oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            Response.Clear();
            Response.Buffer      = true;
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", "attachment;filename=Resultado.pdf");

            Response.BinaryWrite(oStream.ToArray());
            Response.End();
        }
Пример #13
0
        private void ImprimirAuditoria()
        {
            Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);

            ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();

            encabezado1.Value = oCon.EncabezadoLinea1;

            ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();

            encabezado2.Value = oCon.EncabezadoLinea2;

            ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue();

            encabezado3.Value = oCon.EncabezadoLinea3;


            oCr.Report.FileName = "../Informes/AuditoriaProtocolo.rpt";
            oCr.ReportDocument.SetDataSource(GetDataSetAuditoria());
            oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
            oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
            oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
            oCr.DataBind();


            oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Auditoria.pdf");

            //MemoryStream oStream; // using System.IO
            //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            //Response.Clear();
            //Response.Buffer = true;
            //Response.ContentType = "application/pdf";
            //Response.AddHeader("Content-Disposition", "attachment;filename=Auditoria.pdf");

            //Response.BinaryWrite(oStream.ToArray());
            //Response.End();
        }
Пример #14
0
        private void MostrarInforme(string tipo)
        {
            if (tipo == "Nomenclador")
            {
                oCr.Report.FileName = "../Informes/ListaItem.rpt";
                oCr.ReportDocument.SetDataSource(LeerDatosNomenclador());
            }
            else
            {
                oCr.Report.FileName = "../Informes/ListaItemReducido.rpt";
                oCr.ReportDocument.SetDataSource(LeerDatos(tipo));
            }



            //this.CrystalReportSource1.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
            //this.CrystalReportSource1.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
            //this.CrystalReportSource1.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
            oCr.DataBind();

            //if (rdbImprimir.Items[0].Selected == true)//imprimir
            //    this.CrystalReportSource1.ReportDocument.PrintToPrinter(1, true, 1, 100);
            //else
            //{
            oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Listado.pdf");
            //MemoryStream oStream; // using System.IO
            //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            //Response.Clear();
            //Response.Buffer = true;
            //Response.ContentType = "application/pdf";
            //Response.AddHeader("Content-Disposition", "attachment;filename=Listado.pdf");

            //Response.BinaryWrite(oStream.ToArray());
            //Response.End();
            // }
        }
Пример #15
0
        protected void btnImprimirListadoDeVehiculos_Click(object sender, EventArgs e)
        {
            int idOrdenReparacion = SubSonic.Sugar.Web.QueryString <int>("idOrdenReparacion");
            AutOrdenReparacion oOrdenReparacion = new AutOrdenReparacion(idOrdenReparacion);

            { oCr.Report.FileName = "../Reportes/FormOrdenReparacion.rpt"; }

            oCr.CacheDuration = 0;
            oCr.EnableCaching = false;

            //SysUsuario oUsuario = new SysUsuario(int.Parse(Session["idUsuario"].ToString()));
            //int entidad = oUsuario.IdEfector;
            int entidad = SSOHelper.CurrentIdentity.IdEfector;


            AutEntidad oEntidad = new AutEntidad(entidad);
            int        zona     = oEntidad.IdZona;

            DataTable dt = SPs.AutpListOrdenReparacion(idOrdenReparacion.ToString()).GetDataSet().Tables[0];

            oCr.ReportDocument.SetDataSource(dt);

            oCr.DataBind();

            MemoryStream oStream; // using System.IO

            oStream         = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            Response.Buffer = true;
            Response.ClearContent();
            Response.ClearHeaders();
            Response.ContentType = "application/pdf";

            Response.AddHeader("Content-Disposition", "attachment;filename=ListadoDeVehiculos.pdf");
            Response.BinaryWrite(oStream.ToArray());
            Response.End();
        }
Пример #16
0
        private void MostrarInformePorResultado(string tipo)
        {
            DataTable dt = new DataTable();

            dt = GetDatosPorResultado();
            if (dt.Rows.Count > 0)
            {
                Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);

                ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();
                encabezado1.Value = oCon.EncabezadoLinea1;

                ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();
                encabezado2.Value = oCon.EncabezadoLinea2;

                ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue();
                encabezado3.Value = oCon.EncabezadoLinea3;


                ParameterDiscreteValue rangoFechas = new ParameterDiscreteValue();
                rangoFechas.Value = Request["fechaDesde"].ToString() + "  - " + Request["fechaHasta"].ToString();

                ;


                if (Request["tipo"].ToString() == "0")
                {
                    oCr.Report.FileName = "PorResultadoPredefinido.rpt";
                }
                if (Request["tipo"].ToString() == "1")
                {
                    oCr.Report.FileName = "PorResultadoNumerico.rpt";
                }

                oCr.ReportDocument.SetDataSource(dt);
                oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
                oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
                oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
                oCr.ReportDocument.ParameterFields[3].CurrentValues.Add(rangoFechas);
                oCr.DataBind();


                switch (tipo)
                {
                case "Pantalla":
                {
                    CrystalReportViewer1.ReportSourceID = oCr.ID;
                    CrystalReportViewer1.ReportSource   = oCr;
                    Condiciones_del_visualizador();
                }
                break;

                case "Imprimir":  oCr.ReportDocument.PrintToPrinter(1, false, 0, 0); break;

                case "PDF":
                {
                    MemoryStream oStream;         // using System.IO
                    oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                    Response.Clear();
                    Response.Buffer      = true;
                    Response.ContentType = "application/pdf";
                    Response.AddHeader("Content-Disposition", "attachment;filename=Estadistica.pdf");

                    Response.BinaryWrite(oStream.ToArray());
                    Response.End();
                }
                break;

                case "Excel":
                {
                    MemoryStream oStream;         // using System.IO
                    oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
                    Response.Clear();
                    Response.Buffer      = true;
                    Response.ContentType = "application/pdf";
                    Response.AddHeader("Content-Disposition", "attachment;filename=Estadistica.xls");

                    Response.BinaryWrite(oStream.ToArray());
                    Response.End();
                }
                break;
                }
            }
            else
            {
                Response.Redirect("SinDatos.aspx", false);
            }
        }
        private void InformePacientes(string p, string reporte)
        {
            string[] arr = p.ToString().Split(("~").ToCharArray());

            string m_analisis = arr[0].ToString();
            string m_sexo     = arr[1].ToString();

            Item oItem = new Item();

            oItem = (Item)oItem.Get(typeof(Item), int.Parse(m_analisis));

            if (reporte == "PDF")
            {
                Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);

                ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();
                encabezado1.Value = oCon.EncabezadoLinea1;

                ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();
                encabezado2.Value = oCon.EncabezadoLinea2;

                ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue();
                encabezado3.Value = oCon.EncabezadoLinea3;
                ////////////////////////////


                ParameterDiscreteValue titulo = new ParameterDiscreteValue();
                string s_unidad  = "";
                string s_valores = "REPORTE ESTADISTICO " + oItem.Descripcion;
                if (oItem.IdUnidadMedida > 0)
                {
                    UnidadMedida oUnidad = new UnidadMedida();
                    oUnidad  = (UnidadMedida)oUnidad.Get(typeof(UnidadMedida), oItem.IdUnidadMedida);
                    s_unidad = oUnidad.Nombre;
                }
                if (txtValorDesde.Text != "")
                {
                    s_valores += " - Valores de Desde : " + txtValorDesde.Text + " " + s_unidad;
                }
                if (txtValorHasta.Text != "")
                {
                    s_valores += " - Valores Hasta : " + txtValorHasta.Text + " " + s_unidad;
                }
                if (rdbPaciente.SelectedValue == "1")
                {
                    s_valores += " Pacientes Embarazadas";
                }

                titulo.Value = s_valores;

                ParameterDiscreteValue fechaDesde = new ParameterDiscreteValue();
                fechaDesde.Value = txtFechaDesde.Value;

                ParameterDiscreteValue fechaHasta = new ParameterDiscreteValue();
                fechaHasta.Value = txtFechaHasta.Value;


                oCr.Report.FileName = "Pacientes.rpt";
                oCr.ReportDocument.SetDataSource(GetDataPacientes(m_analisis, m_sexo.Substring(0, 1), txtValorDesde.Text, txtValorHasta.Text));
                oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
                oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
                oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
                oCr.ReportDocument.ParameterFields[3].CurrentValues.Add(titulo);
                oCr.ReportDocument.ParameterFields[4].CurrentValues.Add(fechaDesde);
                oCr.ReportDocument.ParameterFields[5].CurrentValues.Add(fechaHasta);
                oCr.DataBind();

                oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Pacientes.pdf");
                //MemoryStream oStream; // using System.IO
                //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                //Response.Clear();
                //Response.Buffer = true;
                //Response.ContentType = "application/pdf";
                //Response.AddHeader("Content-Disposition", "attachment;filename=Pacientes.pdf");

                //Response.BinaryWrite(oStream.ToArray());
                //Response.End();
            }
            if (reporte == "EXCEL")
            {
                StringBuilder  sb  = new StringBuilder();
                StringWriter   sw  = new StringWriter(sb);
                HtmlTextWriter htw = new HtmlTextWriter(sw);

                Page     page = new Page();
                HtmlForm form = new HtmlForm();
                GridView dg   = new GridView();
                dg.EnableViewState = false;
                dg.DataSource      = GetDataPacientes(m_analisis, m_sexo.Substring(0, 1), txtValorDesde.Text, txtValorHasta.Text);
                dg.DataBind();
                // Deshabilitar la validación de eventos, sólo asp.net 2
                page.EnableEventValidation = false;

                // Realiza las inicializaciones de la instancia de la clase Page que requieran los diseñadores RAD.
                page.DesignerInitialize();
                page.Controls.Add(form);
                form.Controls.Add(dg);
                page.RenderControl(htw);

                Response.Clear();
                Response.Buffer      = true;
                Response.ContentType = "application/vnd.ms-excel";
                Response.AddHeader("Content-Disposition", "attachment;filename=DetallePacientes.xls");
                Response.Charset         = "UTF-8";
                Response.ContentEncoding = Encoding.Default;
                Response.Write(sb.ToString());
                Response.End();
            }
        }
Пример #18
0
        private void Imprimir(object p)
        {
            HojaTrabajo oRegistro = new HojaTrabajo();

            oRegistro = (HojaTrabajo)oRegistro.Get(typeof(HojaTrabajo), int.Parse(p.ToString()));

            Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);

            ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();

            encabezado1.Value = oCon.EncabezadoLinea1;

            ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();

            encabezado2.Value = oCon.EncabezadoLinea2;

            ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue();

            encabezado3.Value = oCon.EncabezadoLinea3;

            ParameterDiscreteValue imprimirFechaHora = new ParameterDiscreteValue();

            imprimirFechaHora.Value = oRegistro.ImprimirFechaHora;

            string nombre_reporte = "";
            string m_reporte      = "Reporte.pdf";

            if (oRegistro.Formato == 0)
            {
                m_reporte = oRegistro.Codigo;
                switch (oRegistro.FormatoAncho)
                {
                //case 0:
                //    oCr.Report.FileName = "../iNFORMES/HojasdeTRabajo/HTrabajoProtocolo1.rpt"; break;
                //case 1: oCr.Report.FileName = "../iNFORMES/HojasdeTRabajo/HTrabajoProtocolo2.rpt"; break;
                //case 2: oCr.Report.FileName = "../iNFORMES/HojasdeTRabajo/HTrabajoProtocolo3.rpt"; break;

                case 0:
                {
                    if (oCon.TipoNumeracionProtocolo == 2)
                    {
                        nombre_reporte = "../iNFORMES/HojasdeTRabajo/HTrabajoProtocoloLetra1";
                    }
                    else
                    {
                        nombre_reporte = "../iNFORMES/HojasdeTRabajo/HTrabajoProtocolo1";
                    }
                }
                break;

                case 1:
                {
                    if (oCon.TipoNumeracionProtocolo == 2)
                    {
                        nombre_reporte = "../iNFORMES/HojasdeTRabajo/HTrabajoProtocoloLetra2";
                    }
                    else
                    {
                        nombre_reporte = "../iNFORMES/HojasdeTRabajo/HTrabajoProtocolo2";
                    }
                } break;

                case 2:
                {
                    if (oCon.TipoNumeracionProtocolo == 2)
                    {
                        nombre_reporte = "../iNFORMES/HojasdeTRabajo/HTrabajoProtocoloLetra3";
                    }
                    else
                    {
                        nombre_reporte = "../iNFORMES/HojasdeTRabajo/HTrabajoProtocolo3";
                    }
                } break;

                case 3:    //texto corto con numero de fila
                {
                    if (oCon.TipoNumeracionProtocolo == 2)
                    {
                        nombre_reporte = "../iNFORMES/HojasdeTRabajo/HTrabajoProtocoloLetra3";
                    }
                    else
                    {
                        nombre_reporte = "../iNFORMES/HojasdeTRabajo/HTrabajoProtocolo4";
                    }
                } break;
                }
            }
            //if (oRegistro.Formato == 1)
            //{
            //    m_reporte = oRegistro.Codigo ;

            //    switch (oRegistro.FormatoAncho)
            //    {
            //        case 0: oCr.Report.FileName = "../iNFORMES/HojasdeTrabajo/HTrabajoAnalisis1.rpt"; break;
            //        case 1: oCr.Report.FileName = "../iNFORMES/HojasdeTrabajo/HTrabajoAnalisis2.rpt"; break;
            //        case 2: oCr.Report.FileName = "../iNFORMES/HojasdeTrabajo/HTrabajoAnalisis3.rpt"; break;
            //    }

            //}

            if (oRegistro.IdArea.IdTipoServicio.IdTipoServicio == 3)  //microbiolgoia
            {
                nombre_reporte = nombre_reporte + "Microbiologia";
            }

            if (!oRegistro.TipoHoja) // 0: Horizontal
            {
                nombre_reporte = nombre_reporte + "Horizontal";
            }
            nombre_reporte = nombre_reporte + ".rpt";


            oCr.Report.FileName = nombre_reporte;
            oCr.ReportDocument.SetDataSource(oRegistro.GetDataSet_HojaTrabajoPreeliminar());

            //if (!oRegistro.TipoHoja) // 0: Horizontal
            //    oCr.ReportDocument.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
            //else //1: vertical
            //    oCr.ReportDocument.PrintOptions.PaperOrientation = PaperOrientation.Portrait;

            oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
            oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
            oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
            oCr.ReportDocument.ParameterFields[3].CurrentValues.Add(imprimirFechaHora);


            oCr.DataBind();

            oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, m_reporte + ".pdf");

            //MemoryStream oStream; // using System.IO
            //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            ////Response.CacheControl = "Private";
            //Response.Buffer = true;
            //Response.ClearContent();
            //Response.ClearHeaders();
            //Response.ContentType = "application/pdf";
            //Response.AddHeader("Content-Disposition", "attachment;filename=" + m_reporte + ".pdf");
            //Response.BinaryWrite(oStream.ToArray());
            //Response.End();
        }
Пример #19
0
        private void InformePacientes(string p, string reporte)
        {
            Utility oUtil = new Utility();

            string[] arr = p.ToString().Split(("~").ToCharArray());


            string m_analisis  = arr[0].ToString();
            string m_resultado = oUtil.RemoverSignosAcentos(arr[1].ToString());

            if (reporte == "PDF")
            {
                Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);

                ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();
                encabezado1.Value = oCon.EncabezadoLinea1;

                ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();
                encabezado2.Value = oCon.EncabezadoLinea2;

                ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue();
                encabezado3.Value = oCon.EncabezadoLinea3;
                ////////////////////////////


                ParameterDiscreteValue titulo = new ParameterDiscreteValue();
                titulo.Value = "INFORME DE PACIENTES ";

                if (rdbPaciente.SelectedValue == "1")
                {
                    titulo.Value = "INFORME DE PACIENTES EMBARAZADAS";
                }

                if (ddlGrupoEtareo.SelectedValue != "0")
                {
                    titulo.Value += " - Grupo Etareo: " + ddlGrupoEtareo.SelectedItem.Text;
                }
                if (ddlSexo.SelectedValue != "0")
                {
                    titulo.Value += " - Sexo: " + ddlSexo.SelectedItem.Text;
                }

                ParameterDiscreteValue fechaDesde = new ParameterDiscreteValue();
                fechaDesde.Value = txtFechaDesde.Value;

                ParameterDiscreteValue fechaHasta = new ParameterDiscreteValue();
                fechaHasta.Value = txtFechaHasta.Value;


                oCr.Report.FileName = "Pacientes.rpt";
                oCr.ReportDocument.SetDataSource(GetDataPacientes(m_analisis, m_resultado));
                oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
                oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
                oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
                oCr.ReportDocument.ParameterFields[3].CurrentValues.Add(titulo);
                oCr.ReportDocument.ParameterFields[4].CurrentValues.Add(fechaDesde);
                oCr.ReportDocument.ParameterFields[5].CurrentValues.Add(fechaHasta);
                oCr.DataBind();

                oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Pacientes.pdf");

                //MemoryStream oStream; // using System.IO
                //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                //Response.Clear();
                //Response.Buffer = true;
                //Response.ContentType = "application/pdf";
                //Response.AddHeader("Content-Disposition", "attachment;filename=Pacientes.pdf");

                //Response.BinaryWrite(oStream.ToArray());
                //Response.End();
            }
            if (reporte == "EXCEL")
            {
                StringBuilder  sb  = new StringBuilder();
                StringWriter   sw  = new StringWriter(sb);
                HtmlTextWriter htw = new HtmlTextWriter(sw);

                Page     page = new Page();
                HtmlForm form = new HtmlForm();
                GridView dg   = new GridView();
                dg.EnableViewState = false;
                dg.DataSource      = GetDataPacientes(m_analisis, m_resultado);
                dg.DataBind();
                // Deshabilitar la validación de eventos, sólo asp.net 2
                page.EnableEventValidation = false;

                // Realiza las inicializaciones de la instancia de la clase Page que requieran los diseñadores RAD.
                page.DesignerInitialize();
                page.Controls.Add(form);
                form.Controls.Add(dg);
                page.RenderControl(htw);

                Response.Clear();
                Response.Buffer      = true;
                Response.ContentType = "application/vnd.ms-excel";
                Response.AddHeader("Content-Disposition", "attachment;filename=DetallePacientes.xls");
                Response.Charset         = "UTF-8";
                Response.ContentEncoding = Encoding.Default;
                Response.Write(sb.ToString());
                Response.End();
            }
        }
Пример #20
0
        private void Imprimir(string tipo)
        {
            string m_lista = GenerarListaProtocolos();


            //Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);
            //oCon = (Configuracion)oCon.Get(typeof(Configuracion), "IdConfiguracion", 1);

            ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();


            ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();


            ParameterDiscreteValue encabezado3            = new ParameterDiscreteValue();
            ParameterDiscreteValue ImprimirHojasSeparadas = new ParameterDiscreteValue();


            ParameterDiscreteValue conLogo = new ParameterDiscreteValue();

            if (oCon.RutaLogo != "")
            {
                conLogo.Value = true;
            }
            else
            {
                conLogo.Value = false;
            }


            string parametroPaciente = "";



            string parametroProtocolo = "";



            ParameterDiscreteValue tipoNumeracion = new ParameterDiscreteValue();

            tipoNumeracion.Value = oCon.TipoNumeracionProtocolo;

            ///////Redefinir el tipo de firma electronica (Serían dos reportes distintos)
            ParameterDiscreteValue conPie = new ParameterDiscreteValue();


            //ParameterDiscreteValue soloAnalisisResultado = new ParameterDiscreteValue();
            //soloAnalisisResultado.Value = chkAnalisisResultados.Checked;


            if (Request["idTipoServicio"].ToString() != "3")//laboratorio o pesquisa
            {
                encabezado1.Value = oCon.EncabezadoLinea1;
                encabezado2.Value = oCon.EncabezadoLinea2;
                encabezado3.Value = oCon.EncabezadoLinea3;

                if (oCon.ResultadoEdad)
                {
                    parametroPaciente = "1";
                }
                else
                {
                    parametroPaciente = "0";
                }
                if (oCon.ResultadoFNacimiento)
                {
                    parametroPaciente += "1";
                }
                else
                {
                    parametroPaciente += "0";
                }
                if (oCon.ResultadoSexo)
                {
                    parametroPaciente += "1";
                }
                else
                {
                    parametroPaciente += "0";
                }
                if (oCon.ResultadoDNI)
                {
                    parametroPaciente += "1";
                }
                else
                {
                    parametroPaciente += "0";
                }
                if (oCon.ResultadoHC)
                {
                    parametroPaciente += "1";
                }
                else
                {
                    parametroPaciente += "0";
                }
                if (oCon.ResultadoDomicilio)
                {
                    parametroPaciente += "1";
                }
                else
                {
                    parametroPaciente += "0";
                }


                if (oCon.ResultadoNumeroRegistro)
                {
                    parametroProtocolo = "1";
                }
                else
                {
                    parametroProtocolo = "0";
                }
                if (oCon.ResultadoFechaEntrega)
                {
                    parametroProtocolo += "1";
                }
                else
                {
                    parametroProtocolo += "0";
                }
                if (oCon.ResultadoSector)
                {
                    parametroProtocolo += "1";
                }
                else
                {
                    parametroProtocolo += "0";
                }
                if (oCon.ResultadoSolicitante)
                {
                    parametroProtocolo += "1";
                }
                else
                {
                    parametroProtocolo += "0";
                }
                if (oCon.ResultadoOrigen)
                {
                    parametroProtocolo += "1";
                }
                else
                {
                    parametroProtocolo += "0";
                }
                if (oCon.ResultadoPrioridad)
                {
                    parametroProtocolo += "1";
                }
                else
                {
                    parametroProtocolo += "0";
                }

                conPie.Value = oCon.FirmaElectronicaLaboratorio.ToString();

                ImprimirHojasSeparadas.Value = oCon.TipoImpresionResultado;


                if (oCon.OrdenImpresionLaboratorio)
                {
                    if (oCon.TipoHojaImpresionResultado == "A4")
                    {
                        oCr.Report.FileName = "../Informes/ResultadoSinOrden.rpt";
                    }
                    else
                    {
                        oCr.Report.FileName = "../Informes/ResultadoSinOrdenA5.rpt";
                    }
                }
                else
                {
                    if (oCon.TipoHojaImpresionResultado == "A4")
                    {
                        oCr.Report.FileName = "../Informes/Resultado.rpt";
                    }
                    else
                    {
                        oCr.Report.FileName = "../Informes/ResultadoA5.rpt";
                    }
                }
            }


            if (Request["idTipoServicio"].ToString() == "3")//microbiologia
            {
                encabezado1.Value = oCon.EncabezadoLinea1Microbiologia;
                encabezado2.Value = oCon.EncabezadoLinea2Microbiologia;
                encabezado3.Value = oCon.EncabezadoLinea3Microbiologia;

                if (oCon.ResultadoEdadMicrobiologia)
                {
                    parametroPaciente = "1";
                }
                else
                {
                    parametroPaciente = "0";
                }
                if (oCon.ResultadoFNacimientoMicrobiologia)
                {
                    parametroPaciente += "1";
                }
                else
                {
                    parametroPaciente += "0";
                }
                if (oCon.ResultadoSexoMicrobiologia)
                {
                    parametroPaciente += "1";
                }
                else
                {
                    parametroPaciente += "0";
                }
                if (oCon.ResultadoDNIMicrobiologia)
                {
                    parametroPaciente += "1";
                }
                else
                {
                    parametroPaciente += "0";
                }
                if (oCon.ResultadoHCMicrobiologia)
                {
                    parametroPaciente += "1";
                }
                else
                {
                    parametroPaciente += "0";
                }
                if (oCon.ResultadoDomicilioMicrobiologia)
                {
                    parametroPaciente += "1";
                }
                else
                {
                    parametroPaciente += "0";
                }



                if (oCon.ResultadoNumeroRegistroMicrobiologia)
                {
                    parametroProtocolo = "1";
                }
                else
                {
                    parametroProtocolo = "0";
                }
                if (oCon.ResultadoFechaEntregaMicrobiologia)
                {
                    parametroProtocolo += "1";
                }
                else
                {
                    parametroProtocolo += "0";
                }
                if (oCon.ResultadoSectorMicrobiologia)
                {
                    parametroProtocolo += "1";
                }
                else
                {
                    parametroProtocolo += "0";
                }
                if (oCon.ResultadoSolicitanteMicrobiologia)
                {
                    parametroProtocolo += "1";
                }
                else
                {
                    parametroProtocolo += "0";
                }
                if (oCon.ResultadoOrigenMicrobiologia)
                {
                    parametroProtocolo += "1";
                }
                else
                {
                    parametroProtocolo += "0";
                }
                if (oCon.ResultadoPrioridadMicrobiologia)
                {
                    parametroProtocolo += "1";
                }
                else
                {
                    parametroProtocolo += "0";
                }

                conPie.Value = oCon.FirmaElectronicaMicrobiologia.ToString();


                ImprimirHojasSeparadas.Value = oCon.TipoImpresionResultadoMicrobiologia;
                if (oCon.TipoHojaImpresionResultadoMicrobiologia == "A4")
                {
                    oCr.Report.FileName = "../Informes/ResultadoMicrobiologia.rpt";
                }
                else
                {
                    oCr.Report.FileName = "../Informes/ResultadoMicrobiologiaA5.rpt";
                }
            }

            ParameterDiscreteValue datosPaciente = new ParameterDiscreteValue();

            datosPaciente.Value = parametroPaciente;

            ParameterDiscreteValue datosProtocolo = new ParameterDiscreteValue();

            datosProtocolo.Value = parametroProtocolo;


            oCr.ReportDocument.SetDataSource(GenerarSetDatos(m_lista, chkAnalisisResultados.Checked, chkAnalisisValidados.Checked));
            oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
            oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
            oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
            oCr.ReportDocument.ParameterFields[3].CurrentValues.Add(conLogo);
            oCr.ReportDocument.ParameterFields[4].CurrentValues.Add(datosPaciente);
            oCr.ReportDocument.ParameterFields[5].CurrentValues.Add(ImprimirHojasSeparadas);
            oCr.ReportDocument.ParameterFields[6].CurrentValues.Add(tipoNumeracion);
            oCr.ReportDocument.ParameterFields[7].CurrentValues.Add(conPie);
            oCr.ReportDocument.ParameterFields[8].CurrentValues.Add(datosProtocolo);


            oCr.DataBind();

            if (tipo != "PDF")
            {
                try
                {
                    Session["Impresora"] = ddlImpresora.SelectedValue;
                    oCr.ReportDocument.PrintOptions.PrinterName = ddlImpresora.SelectedValue;
                    oCr.ReportDocument.PrintToPrinter(1, false, 0, 0);
                }
                catch (Exception ex)
                {
                    string exception = "";
                    //while (ex != null)
                    //{
                    exception = ex.Message + "<br>";

                    //}
                    string popupScript = "<script language='JavaScript'> alert('No se pudo imprimir en la impresora " + Session["Impresora"].ToString() + ". Si el problema persiste consulte con soporte técnico." + exception + "'); </script>";
                    Page.RegisterStartupScript("PopupScript", popupScript);
                }
            }
            else
            {
                oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Resultados.pdf");
                //MemoryStream oStream; // using System.IO
                //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                //Response.Clear();
                //Response.Buffer = true;
                //Response.ContentType = "application/pdf";
                //Response.AddHeader("Content-Disposition", "attachment;filename=Resultados.pdf");

                //Response.BinaryWrite(oStream.ToArray());
                //Response.End();
            }
        }
Пример #21
0
        private void ExportarPDF()
        {
            DataTable dt = new DataTable();

            dt = LlenarDatos();
            if (dt.Rows.Count > 0)
            {
                Paciente oPaciente = new Paciente();
                oPaciente = (Paciente)oPaciente.Get(typeof(Paciente), int.Parse(Request["idPaciente"].ToString()));

                Item oItem = new Item();
                oItem = (Item)oItem.Get(typeof(Item), int.Parse(Request["idAnalisis"].ToString()));
                if (oItem.IdTipoResultado == 1)
                {
                    oCr.Report.FileName = "../Informes/HistoricoAnalisis.rpt";
                }
                else
                {
                    oCr.Report.FileName = "../Informes/HistoricoAnalisisNoNumerico.rpt";
                }

                Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);

                ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();
                encabezado1.Value = oCon.EncabezadoLinea1;

                ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();
                encabezado2.Value = oCon.EncabezadoLinea2;

                ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue();
                encabezado3.Value = oCon.EncabezadoLinea3;

                ParameterDiscreteValue encabezado4 = new ParameterDiscreteValue();
                encabezado4.Value = oItem.Descripcion;



                ParameterDiscreteValue encabezado5 = new ParameterDiscreteValue();
                encabezado5.Value = oPaciente.NumeroDocumento;

                ParameterDiscreteValue encabezado6 = new ParameterDiscreteValue();
                encabezado6.Value = oPaciente.Apellido + " " + oPaciente.Nombre;

                ParameterDiscreteValue encabezado7 = new ParameterDiscreteValue();
                encabezado7.Value = oPaciente.FechaNacimiento.ToShortDateString();

                ParameterDiscreteValue encabezado8 = new ParameterDiscreteValue();
                encabezado8.Value = oPaciente.getSexo();



                ParameterDiscreteValue subTitulo = new ParameterDiscreteValue();
                subTitulo.Value = "";


                oCr.ReportDocument.SetDataSource(dt);
                oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
                oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
                oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
                oCr.ReportDocument.ParameterFields[3].CurrentValues.Add(encabezado4);
                oCr.ReportDocument.ParameterFields[4].CurrentValues.Add(subTitulo);
                oCr.ReportDocument.ParameterFields[5].CurrentValues.Add(encabezado5);
                oCr.ReportDocument.ParameterFields[6].CurrentValues.Add(encabezado6);
                oCr.ReportDocument.ParameterFields[7].CurrentValues.Add(encabezado7);
                oCr.ReportDocument.ParameterFields[8].CurrentValues.Add(encabezado8);


                oCr.DataBind();
                oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Historial_Resultados.pdf");

                //MemoryStream oStream; // using System.IO
                //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                //Response.Clear();
                //Response.Buffer = true;
                //Response.ContentType = "application/pdf";
                //Response.AddHeader("Content-Disposition", "attachment;filename=Historial_Resultados.pdf");

                //Response.BinaryWrite(oStream.ToArray());
                //Response.End();
            }
            else
            {
                Response.Redirect("SinDatos.aspx", false);
            }
        }
Пример #22
0
        private void MostrarInformeGeneral(string tipo)
        {

            DataTable dt = new DataTable();
            dt = GetDatosEstadistica("S");
            if (dt.Rows.Count > 0)
            {
                Configuracion oCon = new Configuracion(); oCon = (Configuracion)oCon.Get(typeof(Configuracion), 1);

                ParameterDiscreteValue encabezado1 = new ParameterDiscreteValue();
                encabezado1.Value = oCon.EncabezadoLinea1;

                ParameterDiscreteValue encabezado2 = new ParameterDiscreteValue();
                encabezado2.Value = oCon.EncabezadoLinea2;

                ParameterDiscreteValue encabezado3 = new ParameterDiscreteValue();
                encabezado3.Value = oCon.EncabezadoLinea3;

                ParameterDiscreteValue encabezado4 = new ParameterDiscreteValue();

                oCr.Report.FileName = "General.rpt";
                switch (Request["tipo"].ToString())
                {
                    case "0": encabezado4.Value = "REPORTE POR AREAS"; break;
                    case "1": encabezado4.Value = "REPORTE POR ANALISIS"; break;
                    case "2": encabezado4.Value = "REPORTE POR MEDICO SOLICITANTE"; break;
                    case "3": encabezado4.Value = "REPORTE POR EFECTOR SOLICITANTE"; break;
                    case "4": encabezado4.Value = "REPORTE DE DERIVACIONES"; break;

                    case "5":
                        {
                            encabezado4.Value = "REPORTE RESUMIDO TOTALIZADO";
                            oCr.Report.FileName = "Resumido.rpt";
                        } break;
                    case "6": encabezado4.Value = "REPORTE DE DIAGNOSTICOS"; break;
                    case "7": encabezado4.Value = "PROTOCOLOS POR DIA"; break;
                    case "8": encabezado4.Value = "REPORTE POR SECTOR/SERVICIO"; break;
                    case "9": encabezado4.Value = "RANKING POR DIA DE LA SEMANA"; break;

                }
                ParameterDiscreteValue subTitulo = new ParameterDiscreteValue();
                subTitulo.Value = Request["fechaDesde"].ToString() + " - " + Request["fechaHasta"].ToString();

                ParameterDiscreteValue grafico1 = new ParameterDiscreteValue();                
                ParameterDiscreteValue grafico2 = new ParameterDiscreteValue();
                


                //if (Request["grafico"].ToString() == "1") grafico.Value = false;
                //else grafico.Value = true;

                string aux = "Agrupado por Origen";
                if (Request["Agrupado"].ToString() == "1") aux = "Agrupado por Prioridad";

                subTitulo.Value = Request["fechaDesde"].ToString() + " - " + Request["fechaHasta"].ToString() + " - " + aux;

                grafico1.Value = false;
                grafico2.Value = false;

                if (tipo == "Excel")
                {
                    grafico1.Value = false; grafico2.Value=false;
                }
                else /// pdf /imprimir
                {
                    if (Request["tipo"].ToString() == "5")
                    { grafico1.Value = true; grafico2.Value = true; }
                    else
                    { grafico1.Value = false; grafico2.Value = true; }
                    if ((Request["tipo"].ToString() == "7")|| (Request["tipo"].ToString() == "9"))
                    {
                        grafico1.Value = false;
                        grafico2.Value = false;
                    }
                }

                oCr.ReportDocument.SetDataSource(dt);
                oCr.ReportDocument.ParameterFields[0].CurrentValues.Add(encabezado1);
                oCr.ReportDocument.ParameterFields[1].CurrentValues.Add(encabezado2);
                oCr.ReportDocument.ParameterFields[2].CurrentValues.Add(encabezado3);
                oCr.ReportDocument.ParameterFields[3].CurrentValues.Add(encabezado4);
                oCr.ReportDocument.ParameterFields[4].CurrentValues.Add(subTitulo);
                oCr.ReportDocument.ParameterFields[5].CurrentValues.Add(grafico1);
                if (Request["tipo"]!="5")  oCr.ReportDocument.ParameterFields[6].CurrentValues.Add(grafico2);
                oCr.DataBind();



                switch (tipo)
                {
                    case "Pantalla":
                        {
                            //CrystalReportViewer1.ReportSourceID = oCr.ID;
                            //CrystalReportViewer1.ReportSource = oCr;
                            //Condiciones_del_visualizador();
                        }
                        break;
                    //case "Imprimir":
                    //    {
                            
                    //        oCr.ReportDocument.PrintOptions.PrinterName = oCon.NombreImpresora;
                    //        oCr.ReportDocument.PrintToPrinter(1, false, 0, 0);
                    //    } break;
                    case "PDF":
                        {
                            oCr.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Estadistica.pdf");
                            //MemoryStream oStream; // using System.IO
                            //oStream = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                            //Response.Clear();
                            //Response.Buffer = true;
                            //Response.ContentType = "application/pdf";
                            //Response.AddHeader("Content-Disposition", "attachment;filename=Estadistica.pdf");

                            //Response.BinaryWrite(oStream.ToArray());
                            //Response.End();
                        }
                        break;
                   
                }
            }
            else
                Response.Redirect("SinDatos.aspx?Desde=GeneralFiltro.aspx", false);
        }
Пример #23
0
        // -----------------------------------------------------------------------------------------------------------

        protected void btnImprimirListadoDeVehiculos_Click(object sender, EventArgs e)
        {
            if (chekReducido.Checked == false)

            {
                oCr.Report.FileName = "../Reportes/ListadoDeVehiculos.rpt";
            }
            else
            {
                oCr.Report.FileName = "../Reportes/ListadoDeVehiculosR.rpt";
            }

            //if (cboTipoListado.SelectedValue == "Radios")
            //{ oCr.Report.FileName = "../Reportes/ListadoDeVehiculosRadio.rpt"; }
            //else
            //    { oCr.Report.FileName = "../Reportes/ListadoDeVehiculosRadioR.rpt"; }

            oCr.CacheDuration = 0;
            oCr.EnableCaching = false;

            //SysUsuario oUsuario = new SysUsuario(int.Parse(Session["idUsuario"].ToString()));
            //int entidad = oUsuario.IdEfector;
            int entidad = SSOHelper.CurrentIdentity.IdEfector;

            AutEntidad oEntidad = new AutEntidad(entidad);
            int        zona     = oEntidad.IdZona;

            DataTable dt = SPs.AutListVehiculosDani(txtDominio.Text, ddlEfector.SelectedValue, ddlZona.SelectedValue, ddlMarca.SelectedValue, ddlModelo.SelectedValue, ddlTipo.SelectedValue).GetDataSet().Tables[0];

            oCr.ReportDocument.SetDataSource(dt);

            // 1 Centro de Salud
            // 2 Hospital
            // 3 Puesto Sanitario
            // 4 Zona Sanitaria
            // 5 SubSecretaria de Salud
            // 6 Otro

            //switch (oEntidad.IdTipoEntidad)
            //{
            //    case 1:
            //        DataTable listadoDeVehiculosCaso1 = SPs.AutListVehiculos(txtDominio.Text, ddlComienzaCon.SelectedValue, ddlTipo.SelectedValue, entidad.ToString(), zona.ToString(), ddlMarca.SelectedValue, ddlModelo.SelectedValue, oEntidad.IdEntidad, oEntidad.IdTipoEntidad, zona).GetDataSet().Tables[0];
            //        oCr.ReportDocument.SetDataSource(listadoDeVehiculosCaso1);
            //        break;
            //    case 2:
            //        DataTable listadoDeVehiculosCaso2 = SPs.AutListVehiculos(txtDominio.Text, ddlComienzaCon.SelectedValue, ddlTipo.SelectedValue, ddlEfector.SelectedValue, zona.ToString(), ddlMarca.SelectedValue, ddlModelo.SelectedValue, oEntidad.IdEntidad, oEntidad.IdTipoEntidad, zona).GetDataSet().Tables[0];
            //        oCr.ReportDocument.SetDataSource(listadoDeVehiculosCaso2);
            //        break;
            //    case 3:
            //        DataTable listadoDeVehiculosCaso3 = SPs.AutListVehiculos(txtDominio.Text, ddlComienzaCon.SelectedValue, ddlTipo.SelectedValue, entidad.ToString(), zona.ToString(), ddlMarca.SelectedValue, ddlModelo.SelectedValue, oEntidad.IdEntidad, oEntidad.IdTipoEntidad, zona).GetDataSet().Tables[0];
            //        oCr.ReportDocument.SetDataSource(listadoDeVehiculosCaso3);
            //        break;
            //    case 4:
            //        DataTable listadoDeVehiculosCaso4 = SPs.AutListVehiculos(txtDominio.Text, ddlComienzaCon.SelectedValue, ddlTipo.SelectedValue, ddlEfector.SelectedValue, zona.ToString(), ddlMarca.SelectedValue, ddlModelo.SelectedValue, oEntidad.IdEntidad, oEntidad.IdTipoEntidad, zona).GetDataSet().Tables[0];
            //        oCr.ReportDocument.SetDataSource(listadoDeVehiculosCaso4);
            //        break;
            //    case 5:
            //        DataTable listadoDeVehiculosCaso5 = SPs.AutListVehiculos(txtDominio.Text, ddlComienzaCon.SelectedValue, ddlTipo.SelectedValue, ddlEfector.SelectedValue, ddlZona.SelectedValue, ddlMarca.SelectedValue, ddlModelo.SelectedValue, oEntidad.IdEntidad, oEntidad.IdTipoEntidad, zona).GetDataSet().Tables[0];
            //        oCr.ReportDocument.SetDataSource(listadoDeVehiculosCaso5);
            //        break;
            //    case 6:
            //        // ,nota: No considero este caso, ya que no existe un usuario en (Sys_Usuarios) que tenga este valor (6).
            //        //        El valor es exclusivo de este sistema.
            //        break;
            //}

            // Hago "Bind" ...
            oCr.DataBind();

            MemoryStream oStream; // using System.IO

            oStream         = (MemoryStream)oCr.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            Response.Buffer = true;
            Response.ClearContent();
            Response.ClearHeaders();
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", "attachment;filename=ListadoDeVehiculos.pdf");
            Response.BinaryWrite(oStream.ToArray());
            Response.End();
        }