Beispiel #1
0
        public override void PrintObject()
        {
            CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);
            bool        defecto           = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
            CompanyInfo empresa           = null;

            if (defecto)
            {
                empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
            }
            while (empresa == null)
            {
                moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                DialogResult result = form.ShowDialog();

                try
                {
                    if (result == DialogResult.OK)
                    {
                        empresa = form.Selected as CompanyInfo;
                    }
                }
                catch
                { empresa = null; }
            }

            Library.Instruction.Reports.Horario.ClasesRpt rpt = reportMng.GetDetailReport(_lista, empresa);
            rpt.SetParameterValue("Empresa", empresa.Name);
            if (empresa.Oid == 2)
            {
                ((CrystalDecisions.CrystalReports.Engine.TextObject)(rpt.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
            }
            ReportViewer.SetReport(rpt);
            ReportViewer.ShowDialog();
        }
Beispiel #2
0
        public override void PrintObject()
        {
            CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);

            ReportViewer.SetReport(reportMng.GetCalendarioFestivos(List, FInicio_DTP.Value, FFin_DTP.Value));
            ReportViewer.ShowDialog();
        }
Beispiel #3
0
        protected override void PrintAction()
        {
            switch (Clases_TC.SelectedTab.Name)
            {
            case "Teoricas_TP":
            {
                if (_entity.CTeoricas != null && _entity.CTeoricas.Count > 0)
                {
                    CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);
                    ReportViewer.SetReport(reportMng.GetDetailReport(_entity.CTeoricas));
                    ReportViewer.ShowDialog();
                }
            }
            break;

            case "Practicas_TP":
            {
                if (_entity.CPracticas != null && _entity.CPracticas.Count > 0)
                {
                    CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);
                    ReportViewer.SetReport(reportMng.GetDetailReport(_entity.CPracticas));
                    ReportViewer.ShowDialog();
                }
            }
            break;
            }
        }
Beispiel #4
0
 protected override void PrintAction()
 {
     if (_entity.CExtras != null && _entity.CExtras.Count > 0)
     {
         CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);
         ReportViewer.SetReport(reportMng.GetDetailReport(_entity.CExtras));
         ReportViewer.ShowDialog();
     }
 }
Beispiel #5
0
        private void Hojas_BT_Click(object sender, EventArgs e)
        {
            PrintSource seleccion = PrintSource.All;
            bool        alumno    = false;

            PartesPrintSelectForm form   = new PartesPrintSelectForm(seleccion);
            DialogResult          result = form.ShowDialog();

            if (result != DialogResult.Cancel)
            {
                if (form.Source == PrintSource.Selection)
                {
                    alumno = true;
                }
            }

            CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);

            AlumnoList lista = AlumnoList.GetListByPromocion(_entity.OidPromocion, false);

            foreach (ParteAsistenciaInfo item in _entity.Asistencias)
            {
                AlumnoList alumnos = null;
                SesionInfo sesion  = null;

                foreach (SesionInfo ses in _entity.Sesions)
                {
                    if (ses.Fecha.ToShortDateString() == item.Fecha.ToShortDateString() &&
                        ses.Hora.ToShortTimeString() == DateTime.Parse(item.HoraInicio).ToShortTimeString())
                    {
                        sesion = ses;
                        break;
                    }
                }

                alumnos = AlumnoList.CreateAlumnosList(lista, item.Alumno_Partes);

                if (item.Sesiones != string.Empty && alumnos.Count > 0)
                {
                    if (item.Tipo == 2 || sesion.OidClasePractica > 0)
                    {
                        ReportViewer.SetReport(reportMng.GetDetailPracticasReport(sesion, alumnos, item.NHoras,
                                                                                  _teoricas, /*ClasePracticaList.Merge(_practicas[1], _practicas[2])*/
                                                                                  ClasePracticaList.GetClasesPlanList(_entity.OidPlan), _extras, item.Texto, _entity.OidPromocion, alumno));
                    }
                    else
                    {
                        ReportViewer.SetReport(reportMng.GetDetailTeoricasReport(sesion, alumnos, item.NHoras,
                                                                                 _teoricas, ClasePracticaList.Merge(_practicas[1], _practicas[2]), _extras, item.Texto, _entity.OidPromocion, alumno));
                    }
                }

                ReportViewer.ShowDialog();
            }
        }
Beispiel #6
0
        public override void PrintObject()
        {
            PrintSource seleccion = PrintSource.All;
            bool        alumno    = false;

            HorarioPrintSelectForm form   = new HorarioPrintSelectForm(seleccion);
            DialogResult           result = form.ShowDialog();

            if (result != DialogResult.Cancel)
            {
                if (form.Source == PrintSource.Selection)
                {
                    alumno = true;
                }
                CronogramaReportMng      reportMng = new CronogramaReportMng(AppContext.ActiveSchema);
                Library.Reports.CRViewer viewer    = new Library.Reports.CRViewer();
                ModuloList modulos = ModuloList.GetList(false);
                viewer.SetReport(reportMng.GetHorarioReport(EntityInfo, alumno, _teoricas, _practicas, _extras, _profesores, modulos, _lista_sesiones, form.PrintTimestamp, form.Timestamp));
                viewer.ShowDialog();
            }
        }
        /// <summary>Imprime la lista del objetos
        /// <returns>void</returns>
        /// </summary>
        public override void PrintList()
        {
            ETipoImpresionCronograma tipo = ETipoImpresionCronograma.Lista;
            SelectEnumInputForm      form = new SelectEnumInputForm(true);

            form.SetDataSource(Library.Instruction.EnumText <ETipoImpresionCronograma> .GetList(false, false, false));
            form.ShowDialog(this);

            if (form.ActionResult == DialogResult.OK)
            {
                ComboBoxSource combo = form.Selected as ComboBoxSource;
                tipo = (ETipoImpresionCronograma)combo.Oid;
            }

            ClaseTeoricaList         teoricas        = ClaseTeoricaList.GetList();
            ClasePracticaList        practicas       = ClasePracticaList.GetList(false);
            List <ClasePracticaList> lista_practicas = new List <ClasePracticaList>();

            lista_practicas.Add(null);
            lista_practicas.Add(practicas);
            lista_practicas.Add(practicas);
            ModuloList modulos = ModuloList.GetList(false);

            CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);
            CronogramaRpt       report    = null;

            switch (FilterType)
            {
            case IFilterType.None:
                if (tipo == ETipoImpresionCronograma.Lista)
                {
                    bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
                    CompanyInfo empresa = null;

                    if (defecto)
                    {
                        empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
                    }
                    while (empresa == null)
                    {
                        moleQule.Face.Common.CompanySelectForm sform = new Common.CompanySelectForm(this);
                        DialogResult result = sform.ShowDialog();

                        try
                        {
                            if (result == DialogResult.OK)
                            {
                                empresa = form.Selected as CompanyInfo;
                            }
                        }
                        catch
                        { empresa = null; }
                    }

                    report = reportMng.GetCronogramaReport(_cronograma, empresa, modulos, teoricas, practicas, _sorted_list);

                    if (report != null)
                    {
                        report.SetParameterValue("Empresa", empresa.Name);
                        if (empresa.Oid == 2)
                        {
                            ((CrystalDecisions.CrystalReports.Engine.TextObject)(report.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                        }
                        ReportViewer.SetReport(report);
                        ReportViewer.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show(Resources.Messages.NO_DATA_REPORTS,
                                        moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    Dictionary <Horario, ListaSesiones> horarios = Cronograma.GetHorarios(_sorted_list, teoricas, practicas);

                    if (horarios.Count > 0)
                    {
                        PgMng.Reset(horarios.Count + 5, 1, Resources.Messages.LOADING_DATA, this);

                        try
                        {
                            InstructorList instructores = InstructorList.GetList(false);
                            PgMng.Grow();

                            //EntidadInfo entidad = EntidadInfo.Get(typeof(Promocion), true);
                            //Agente agente = null;

                            //PromocionInfo promocion = PromocionInfo.Get(_cronograma.OidPromocion, true);

                            //if (entidad.Agentes.GetItemByProperty("OidAgenteExt", promocion.Oid) != null)
                            //    agente = Agente.Get(typeof(Promocion), promocion);
                            //else
                            //{
                            //    agente = Agente.New();
                            //    agente.CopyFrom(entidad, promocion);
                            //    agente.Codigo = agente.GetCode();
                            //}

                            PgMng.Grow();

                            string       sFile = "C:\\cronograma.pdf";
                            FileStream   fs    = new FileStream(sFile, FileMode.Create, FileAccess.Write, FileShare.None);
                            Document     doc   = new Document();
                            PdfSmartCopy copy  = new PdfSmartCopy(doc, fs);

                            doc.Open();

                            foreach (KeyValuePair <Horario, ListaSesiones> item in horarios)
                            {
                                item.Key.OidPlan      = _cronograma.OidPlan;
                                item.Key.OidPromocion = _cronograma.OidPromocion;
                                HorarioRpt rpt    = reportMng.GetHorarioReport(item.Key.GetInfo(false), true, teoricas, lista_practicas, null, instructores, modulos, item.Value, false, DateTime.Now);
                                PdfReader  reader = new PdfReader(rpt.ExportToStream(ExportFormatType.PortableDocFormat));
                                copy.AddPage(copy.GetImportedPage(reader, 1));
                                rpt.Close();
                                rpt.Dispose();
                                PgMng.Grow();
                            }

                            doc.Close();

                            System.Diagnostics.Process process = new System.Diagnostics.Process();
                            process.StartInfo.FileName = sFile;
                            process.Start();
                            try
                            {
                                process.WaitForExit();
                            }
                            catch { }
                            PgMng.Grow();

                            //Documento documento = Documento.New();
                            //documento.Fecha = DateTime.Now;
                            //documento.FechaAlta = DateTime.Now;
                            //documento.Nombre = documento.Fecha.ToString("yyyyMMdd") + "_CRONOGRAMA";
                            //documento.Ruta = "C:\\";
                            //documento.Tipo = "PDF";


                            //AgenteDocumento agente_documento = agente.Documentos.NewItem(agente);
                            //agente_documento.OidDocumento = documento.Oid;

                            //agente.Save();
                        }
                        catch (Exception ex) { throw ex; }
                        finally { PgMng.FillUp(); }
                    }
                }
                break;

            case IFilterType.Filter:
                if (tipo == ETipoImpresionCronograma.Lista)
                {
                    bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
                    CompanyInfo empresa = null;

                    if (defecto)
                    {
                        empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
                    }
                    while (empresa == null)
                    {
                        moleQule.Face.Common.CompanySelectForm sform = new Common.CompanySelectForm(this);
                        DialogResult result = sform.ShowDialog();

                        try
                        {
                            if (result == DialogResult.OK)
                            {
                                empresa = form.Selected as CompanyInfo;
                            }
                        }
                        catch
                        { empresa = null; }
                    }

                    report = reportMng.GetCronogramaReport(_cronograma, empresa, modulos, teoricas, practicas, _filter_results);

                    if (report != null)
                    {
                        report.SetParameterValue("Empresa", empresa.Name);
                        if (empresa.Oid == 2)
                        {
                            ((CrystalDecisions.CrystalReports.Engine.TextObject)(report.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                        }
                        ReportViewer.SetReport(report);
                        ReportViewer.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show(Resources.Messages.NO_DATA_REPORTS,
                                        moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    Dictionary <Horario, ListaSesiones> horarios = Cronograma.GetHorarios(_filter_results, teoricas, practicas);

                    if (horarios.Count > 0)
                    {
                        PgMng.Reset(horarios.Count + 5, 1, Resources.Messages.LOADING_DATA, this);

                        try
                        {
                            InstructorList instructores = InstructorList.GetList(false);
                            PgMng.Grow();

                            //EntidadInfo entidad = EntidadInfo.Get(typeof(Promocion), true);
                            //Agente agente = null;

                            //PromocionInfo promocion = PromocionInfo.Get(_cronograma.OidPromocion, true);

                            //if (entidad.Agentes.GetItemByProperty("OidAgenteExt", promocion.Oid) != null)
                            //    agente = Agente.Get(typeof(Promocion), promocion);
                            //else
                            //{
                            //    agente = Agente.New();
                            //    agente.CopyFrom(entidad, promocion);
                            //    agente.Codigo = agente.GetCode();
                            //}

                            PgMng.Grow();

                            string       sFile = "C:\\cronograma.pdf";
                            FileStream   fs    = new FileStream(sFile, FileMode.Create, FileAccess.Write, FileShare.None);
                            Document     doc   = new Document();
                            PdfSmartCopy copy  = new PdfSmartCopy(doc, fs);

                            doc.Open();

                            foreach (KeyValuePair <Horario, ListaSesiones> item in horarios)
                            {
                                item.Key.OidPlan      = _cronograma.OidPlan;
                                item.Key.OidPromocion = _cronograma.OidPromocion;
                                HorarioRpt rpt    = reportMng.GetHorarioReport(item.Key.GetInfo(false), true, teoricas, lista_practicas, null, instructores, modulos, item.Value, false, DateTime.Now);
                                PdfReader  reader = new PdfReader(rpt.ExportToStream(ExportFormatType.PortableDocFormat));
                                copy.AddPage(copy.GetImportedPage(reader, 1));
                                rpt.Close();
                                rpt.Dispose();
                                PgMng.Grow();
                            }

                            doc.Close();

                            System.Diagnostics.Process process = new System.Diagnostics.Process();
                            process.StartInfo.FileName = sFile;
                            process.Start();
                            try
                            {
                                process.WaitForExit();
                            }
                            catch { }
                            PgMng.Grow();

                            //Documento documento = Documento.New();
                            //documento.Fecha = DateTime.Now;
                            //documento.FechaAlta = DateTime.Now;
                            //documento.Nombre = documento.Fecha.ToString("yyyyMMdd") + "_CRONOGRAMA";
                            //documento.Ruta = "C:\\";
                            //documento.Tipo = "PDF";


                            //AgenteDocumento agente_documento = agente.Documentos.NewItem(agente);
                            //agente_documento.OidDocumento = documento.Oid;

                            //agente.Save();
                        }
                        catch (Exception ex) { throw ex; }
                        finally { PgMng.FillUp(); }
                    }
                }
                break;
            }
        }
        private void GeneraCronogramaAction(bool comparativa, bool restantes = false)
        {
            if (!comparativa)
            {
                PgMng.Reset(10, 1, Resources.Messages.GENERANDO_CRONOGRAMA, this);

                try
                {
                    int total_dias = DoGeneraCronograma(false, DateTime.MaxValue, restantes);

                    if (_cronograma != null && _cronograma.Sesiones != null && _cronograma.Sesiones.Count > 0)
                    {
                        ClasesRestantesCronogramaMngForm cform = new ClasesRestantesCronogramaMngForm(true, this, _cronograma, total_dias);
                        cform.ShowDialog();
                    }
                }
                catch { }
                finally { PgMng.FillUp(); }
            }
            else
            {
                DateSelectForm form = new DateSelectForm(EntityInfo, true, this);
                form.ShowDialog();

                if (form.ActionResult == DialogResult.OK)
                {
                    PgMng.Reset(10, 1, Resources.Messages.GENERANDO_CRONOGRAMA, this);


                    try
                    {
                        DoGeneraCronograma(true, form.Fecha);

                        if (_cronograma != null && _cronograma.Sesiones != null && _cronograma.Sesiones.Count > 0)
                        {
                            CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);

                            List <RegistroResumenPlanDocente> teoricas = RegistroResumenPlanDocente.GetComparativaTeoricasCronogramaHorarios(_cronograma, form.Fecha);

                            if (teoricas.Count > 0)
                            {
                                ReportViewer.SetReport(reportMng.GetComparativaClases(EntityInfo, form.Fecha, teoricas));
                                ReportViewer.ShowDialog();
                            }

                            List <RegistroResumenPlanDocente> practicas1 = RegistroResumenPlanDocente.GetComparativaPracticasCronogramaHorarios(_cronograma, form.Fecha, 1);

                            if (practicas1.Count > 0)
                            {
                                ReportViewer.SetReport(reportMng.GetComparativaClases(EntityInfo, form.Fecha, practicas1, 1));
                                ReportViewer.ShowDialog();
                            }

                            List <RegistroResumenPlanDocente> practicas2 = RegistroResumenPlanDocente.GetComparativaPracticasCronogramaHorarios(_cronograma, form.Fecha, 2);

                            if (practicas2.Count > 0)
                            {
                                ReportViewer.SetReport(reportMng.GetComparativaClases(EntityInfo, form.Fecha, practicas2, 2));
                                ReportViewer.ShowDialog();
                            }
                        }
                    }
                    catch { }
                    finally { PgMng.FillUp(); }
                }
            }
        }
        protected override void PrintAction()
        {
            bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
            CompanyInfo empresa = null;

            if (defecto)
            {
                empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
            }
            while (empresa == null)
            {
                moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                DialogResult result = form.ShowDialog();

                try
                {
                    if (result == DialogResult.OK)
                    {
                        empresa = form.Selected as CompanyInfo;
                    }
                }
                catch
                { empresa = null; }
            }

            switch (Resumen_TC.SelectedTab.Name)
            {
            case "Teoricas_TP":
            {
                if (_lista_teoricas != null && _lista_teoricas.Count > 0)
                {
                    CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);
                    Library.Instruction.Reports.PlanEstudios.ResumenRpt rpt = reportMng.GetDetailReport(_lista_teoricas, empresa);
                    rpt.SetParameterValue("Empresa", empresa.Name);
                    if (empresa.Oid == 2)
                    {
                        ((CrystalDecisions.CrystalReports.Engine.TextObject)(rpt.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                    }
                    ReportViewer.ShowDialog();
                }
            }
            break;

            case "Practicas_TP":
            {
                if (_lista_practicas != null && _lista_practicas.Count > 0)
                {
                    CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);
                    Library.Instruction.Reports.PlanEstudios.ResumenRpt rpt = reportMng.GetDetailReport(_lista_practicas, empresa);
                    rpt.SetParameterValue("Empresa", empresa.Name);
                    if (empresa.Oid == 2)
                    {
                        ((CrystalDecisions.CrystalReports.Engine.TextObject)(rpt.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                    }
                    ReportViewer.SetReport(rpt);
                    ReportViewer.ShowDialog();
                }
            }
            break;
            }
        }