Ejemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            ReportePorTema rpt = new ReportePorTema();

            rpt.Site = this.Site;
            return(rpt);
        }
Ejemplo n.º 2
0
        private ImpreInforme _GenerarReporte(string _TipoImpre)
        {
            progressBar1.Visible = false;
            progressBar1.Value   = 0;

            DateTime hoy = DateTime.Now;

            if (TB_AñoDesde.Text.Replace("/", "").Trim() == "")
            {
                TB_AñoDesde.Text = "01/06/" + ((hoy.Month < 6) ? (hoy.Year - 1).ToString() : hoy.ToString("yyyy"));
            }
            else
            {
                hoy = DateTime.ParseExact(TB_AñoDesde.Text, "dd/MM/yyyy", new DateTimeFormatInfo());
            }

            if (TB_AñoHasta.Text.Replace("/", "").Trim() == "")
            {
                TB_AñoHasta.Text = "31/05/" + ((hoy.Month >= 6) ? (hoy.Year + 1).ToString() : hoy.ToString("yyyy"));
            }

            if (TB_AñoDesde.Text.Replace(" ", "").Length < 10 || TB_AñoHasta.Text.Replace(" ", "").Length < 10)
            {
                return(null);
            }

            Helper.PurgarOrdFechaCursadas();
            Helper._ReprocesoCursosProgramadosYNoProgramados(TB_AñoDesde.Text, TB_AñoHasta.Text, "1", "9999");

            string FechaDesde = Helper.OrdenarFecha(TB_AñoDesde.Text); // + "0101";
            string FechaHasta = Helper.OrdenarFecha(TB_AñoHasta.Text); // + "1231";

            int Tipo = CB_Tipo.SelectedIndex;

            /*
             * Preparamos las condiciones extras en caso de ser necesario.
             */
            string WCondicionesExtras = "";

            if (txtCurso.Text.Trim() != "")
            {
                WCondicionesExtras += " AND C.Curso = '" + txtCurso.Text + "'";
            }

            if (txtLegajo.Text.Trim() != "")
            {
                WCondicionesExtras += " AND C.Legajo = '" + txtLegajo.Text + "'";
            }

            if (cmbSector.SelectedIndex > 0)
            {
                DataRowView r = (DataRowView)cmbSector.SelectedItem;

                if (r != null)
                {
                    WCondicionesExtras += " AND L.Sector = '" + r["Codigo"] + "'";
                }
            }

            switch (Tipo)
            {
            case 1:

                dtInforme = Cur.ListarInformeCons(FechaDesde, FechaHasta, 0, 0, WCondicionesExtras);
                break;

            case 2:

                dtInforme = Cur.ListarInformeCons(FechaDesde, FechaHasta, 1, 1, WCondicionesExtras);
                break;

            case 0:

                dtInforme = Cur.ListarInformeCons(FechaDesde, FechaHasta, 0, 9999, WCondicionesExtras);
                break;
            }

            progressBar1.Visible = false;

            ReportDocument rpt = null;

            if (rbPorLegajo.Checked)
            {
                rpt = new Reporte();
            }
            if (rbPorSector.Checked)
            {
                rpt = new ReportePorSector();
            }
            if (rbPorTema.Checked)
            {
                rpt = new ReportePorTema();
            }

            ImpreInforme Impre = new ImpreInforme(dtInforme, _TipoImpre, rpt);

            return(Impre);
        }