예제 #1
0
        private VistaPrevia _PrepararReporte()
        {
            // Actualizamos los datos de Personas y horas realizadas.
            Helper.ActualizarCantidadPersonasHoras(txtAno.Text);

            VistaPrevia frm = new VistaPrevia();

            frm.CargarReporte(new PlanCapacitacionAnual(), "{CronogramaII.Ano} = " + txtAno.Text + " AND {CronogramaII.Curso} = {Curso.Codigo}");
            return(frm);
        }
예제 #2
0
        private VistaPrevia _PrepararVistaPrevia()
        {
            Helper.ActualizarCantidadPersonasHoras(txtAno.Text);
            Helper.ActualizarTipoCursada();

            CursosPendientesPorSector reporte = _PrepararReporte();

            VistaPrevia frm = new VistaPrevia();

            frm.CargarReporte(reporte);
            return(frm);
        }
예제 #3
0
        private void BT_Imprimir_Click(object sender, EventArgs e)
        {
            try
            {
                if (TB_Desde.Text == "")
                {
                    throw new Exception("Se debe ingresar el tema desde el que desea comenzar la busqueda");
                }

                if (TB_Hasta.Text == "")
                {
                    throw new Exception("Se debe ingresar el tema hasta el que desea realizar la busqueda");
                }

                if (CB_Tipo.Text == "")
                {
                    throw new Exception("Se debe elegir un tipo");
                }

                int Desd;
                int.TryParse(TB_Desde.Text, out Desd);
                int Hast;
                int.TryParse(TB_Hasta.Text, out Hast);
                int Año;
                //int.TryParse(TB_AñoDesde.Text, out Año);
                int AñoDesde = int.Parse(Helper.OrdenarFecha(txtAnioDesde.Text));
                int AñoHasta = int.Parse(Helper.OrdenarFecha(txtAnioHasta.Text));

                Helper.ActualizarCantidadPersonasHoras(txtAnioDesde.Text.Substring(6, 4));
                Helper.ActualizarCantidadPersonasHoras(txtAnioHasta.Text.Substring(6, 4));

                //dtInforme = C.ListarCursoporTema(Desd, Hast, AñoDesde, AñoHasta);
                dtInforme = C.ListarCursoNoRealizadosporTema(Desd, Hast, AñoDesde, AñoHasta, checkBox1.Checked);

                Tipo = "Imprimir";

                ImpreInforme Impre = new ImpreInforme(dtInforme, Tipo);
                Impre.ShowDialog();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        private void BT_Imprimir_Click(object sender, EventArgs e)
        {
            try
            {
                if (TB_TemaDesde.Text == "")
                {
                    throw new Exception("Se debe ingresar el Tema desde el cual comenzar la busqueda");
                }

                if (TB_TemaHasta.Text == "")
                {
                    throw new Exception("Se debe ingresar el Tema hasta el cual terminar la busqueda");
                }

                int TemaDesde = 0;

                int.TryParse(TB_TemaDesde.Text, out TemaDesde);

                int TemaHasta = 0;

                int.TryParse(TB_TemaHasta.Text, out TemaHasta);

                string WAnioDesde = Helper.OrdenarFecha(txtAnioDesde.Text);
                string WAnioHasta = Helper.OrdenarFecha(txtAnioHasta.Text);

                Helper.ActualizarCantidadPersonasHoras(WAnioDesde, WAnioHasta);

                dtInforme = C.CronogramaHoras(WAnioDesde, WAnioHasta, TemaDesde, TemaHasta);

                Tipo = "Impresion";

                ImpreInforme Impre = new ImpreInforme(dtInforme, Tipo);
                Impre.ShowDialog();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #5
0
        private void _PresentarReportePorTema(string _Tipo)
        {
            try
            {
                int Desd;
                int.TryParse(TB_Desde.Text, out Desd);
                int Hast;
                int.TryParse(TB_Hasta.Text, out Hast);

                Helper.PurgarOrdFechaCursadas();

                int AñoDesde = int.Parse(Helper.OrdenarFecha(txtAnioDesde.Text));
                int AñoHasta = int.Parse(Helper.OrdenarFecha(txtAnioHasta.Text));

                Helper.ActualizarCantidadPersonasHoras(txtAnioDesde.Text.Substring(6, 4));

                string WTipoCursada = "";

                if (rbProgramados.Checked)
                {
                    WTipoCursada = "0";
                }
                else if (rbNoProgramados.Checked)
                {
                    WTipoCursada = "1";
                }

                dtInforme = C.ListarCursoporTema(Desd, Hast, AñoDesde, AñoHasta, WTipoCursada);

                CursosRealizadosporTemas.ImpreInforme Impre = new CursosRealizadosporTemas.ImpreInforme(dtInforme, _Tipo);
                Impre.WindowState = FormWindowState.Maximized;
                Impre.Show();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #6
0
        private VistaPrevia _GenerarReporte()
        {
            if (txtAnio.Text.Trim() == "" || txtAnio.Text.Trim().Length < 4)
            {
                throw new Exception("No se ha cargado un Año válido de consulta.");
            }

            if (txtCurso.Text.Trim() != "")
            {
                DataRow WCurso = (new Curso())._BuscarCurso(txtCurso.Text, "Codigo");

                if (WCurso == null)
                {
                    throw new Exception("No se ha cargado un Curso válido de consulta.");
                }
            }

            if (txtLegajo.Text.Trim() != "")
            {
                DataTable WLegajo = (new Legajo())._BuscarLegajo(txtLegajo.Text, "Codigo");

                if (WLegajo.Rows.Count == 0)
                {
                    throw new Exception("No se ha cargado un Legajo válido de consulta.");
                }
            }

            /*
             * Recalculamos los datos a imprimir.
             */
            Helper.ActualizarCantidadPersonasHoras("01/06/" + txtAnio.Text, "31/05/" + (int.Parse(txtAnio.Text) + 1));
            Helper.ActualizarHorasRealizadas(txtAnio.Text);

            string WFormula = "{Cronograma.Ano}=" + txtAnio.Text +
                              " AND {Legajo.Renglon} = 1 ";

            if (txtCurso.Text.Trim() != "" && rbPorCurso.Checked)
            {
                WFormula += " AND {Cronograma.Curso} = " + txtCurso.Text + "";
            }

            if (txtLegajo.Text.Trim() != "")
            {
                WFormula += " AND {Legajo.Codigo} = " + txtLegajo.Text + "";
            }

            if (cmbTipo.SelectedIndex == 1 && rbPorCurso.Checked)
            {
                WFormula += " AND {Cronograma.Realizado} >= {Tema.Horas}";
            }

            if (cmbTipo.SelectedIndex == 2 && rbPorCurso.Checked)
            {
                WFormula += " AND {Cronograma.Realizado} < {Tema.Horas}";
            }

            if (cmbSector.SelectedIndex > 0 && txtLegajo.Text.Trim() == "")
            {
                DataRowView r = (DataRowView)cmbSector.SelectedItem;

                if (r != null)
                {
                    WFormula += " And {Legajo.Sector} = " + r["Codigo"];
                }
            }

            VistaPrevia frm = new VistaPrevia();

            ReportDocument rpt = rbPorCurso.Checked ? (ReportDocument) new ReporteInformeHorasRealizadasyProgramadasPorCurso() : new ReporteInformeHorasRealizadasyProgramadasPorLegajo();

            if (rbPorLegajo.Checked)
            {
                double[] Totales = _TraerTotalPersonas();

                rpt.SetParameterValue("TotalPersonas", Totales[0]);
                rpt.SetParameterValue("HorasTotales", Totales[1]);
                rpt.SetParameterValue("RealizadosTotales", Totales[2]);
                rpt.SetParameterValue("Todos", cmbTipo.SelectedIndex == 0);
                rpt.SetParameterValue("SoloCumplidos", cmbTipo.SelectedIndex == 1);
                rpt.SetParameterValue("SoloPendientes", cmbTipo.SelectedIndex == 2);
            }

            frm.CargarReporte(rpt, WFormula);

            return(frm);
        }