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 static void MyClassInitialize(TestContext testContext)
        {
            System.Diagnostics.Process.Start(@"xcopy", @"""P:\\dotNet\Cattle\code\\moleQule.Application\\Library\\Asm\Test"" "".\\Asm"" /Y /R /I");

            try { AppController.Instance.Init("7.5.23.2"); }
            catch { }

            SettingsMng.Instance.SetLANServer("localhost");

            if (AppContext.Principal != null)
            {
                AppContext.Principal.Logout();
            }

            Principal.Login("Admin", "iQi_1998");

            Assert.IsTrue(AppContext.User.IsAuthenticated);

            //Carga del schema
            long oidSchema = SettingsMng.Instance.GetDefaultSchema();

            Assert.AreNotEqual(oidSchema, 0);

            CompanyInfo company = CompanyInfo.Get(oidSchema);

            Assert.AreNotEqual(company.Oid, 0);
            Assert.IsTrue(AppContext.User.CanAccessSchema(company.Oid));

            AppContext.Principal.ChangeUserSchema(company);
        }
        protected override void PrintFaltasAsistencia()
        {
            InformesReportMng reportMng = new InformesReportMng(AppContext.ActiveSchema);

            FaltasByAlumnoRpt report = null;

            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; }
            }

            string promos = string.Empty;

            foreach (Alumno_Promocion ap in _entity.Promociones)
            {
                promos += ap.Promocion + "; ";
            }

            FaltaAlumnoList list = FaltaAlumnoList.GetListByAlumno(false, _entity.Oid);

            report = reportMng.GetDetailReport(empresa, EntityInfo.GetPrintObject(), promos, list);

            if (report != null)
            {
                report.SetParameterValue("Empresa", empresa.Name);
                report.SetParameterValue("Alumno", _entity.Nombre + "  " + _entity.Apellidos);
                report.SetParameterValue("Promocion", promos);
                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);
            }
        }
Beispiel #4
0
        /// <summary>Imprime la lista del objetos
        /// <returns>void</returns>
        /// </summary>
        public override void PrintList()
        {
            PromocionReportMng reportMng = new PromocionReportMng(AppContext.ActiveSchema);

            ClasesPracticasImpartidasRpt report = null;

            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 (FilterType)
            {
            case IFilterType.None:
                report = reportMng.GetDetailImpartidasReport(empresa, _promocion, _sorted_list);
                break;

            case IFilterType.Filter:
                report = reportMng.GetDetailImpartidasReport(empresa, _promocion, _filter_results);
                break;
            }

            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);
            }
        }
Beispiel #5
0
        public override void LoadSchema(ISchemaInfo schema)
        {
            base.LoadSchema(schema);

            //Company currency configuration
            CompanyInfo company = CompanyInfo.Get(AppContext.ActiveSchema.Oid, false);

            company.SetCurrency();
        }
        public AlbaranRecibidoRpt GetDetailRpt(InputDeliveryInfo item, FormatConfFacturaAlbaranReport conf)
        {
            if (item == null)
            {
                return(null);
            }

            AlbaranRecibidoRpt doc = new AlbaranRecibidoRpt();

            List <InputDeliveryLinePrint> conceptos = new List <InputDeliveryLinePrint>();
            List <InputDeliveryPrint>     pList     = new List <InputDeliveryPrint>();

            foreach (InputDeliveryLineInfo cfi in item.ConceptoAlbaranes)
            {
                conceptos.Add(cfi.GetPrintObject());
            }

            //Si no existen conceptos, no tiene sentido un informe detallado. Además, falla en Crystal Reports
            if (conceptos.Count <= 0)
            {
                return(null);
            }

            pList.Add(item.GetPrintObject());

            ProductList productos = ProductList.GetList(false);

            foreach (InputDeliveryLinePrint cfp in conceptos)
            {
                if (cfp.OidProducto == 0)
                {
                    continue;
                }
                ProductInfo prod = productos.GetItem(cfp.OidProducto);
                if (prod != null)
                {
                    if (prod.AyudaKilo > 0)
                    {
                        cfp.Concepto += " *";
                    }
                }
            }

            doc.Subreports["ConceptosRpt"].SetDataSource(conceptos);

            doc.SetDataSource(pList);
            CompanyInfo empresa = CompanyInfo.Get(Schema.Oid);

            doc.SetParameterValue("nombreEmpresa", empresa.Name);
            doc.SetParameterValue("dirEmpresa", empresa.Direccion);
            doc.SetParameterValue("CIFEmpresa", empresa.VatNumber);
            doc.SetParameterValue("nota", (conf.nota != null) ? conf.nota : string.Empty);

            return(doc);
        }
        protected override void ResumenPreguntasAction()
        {
            if (_entity.MemoPreguntas == string.Empty)
            {
                return;
            }

            ExamenReportMng reportMng = new ExamenReportMng(AppContext.ActiveSchema);

            string lista = _entity.MemoPreguntas.Replace(';', ',');

            lista = lista.Substring(0, lista.Length - 1);
            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; }
            }

            ISchemaInfo schema = AppContext.ActiveSchema;

            try
            {
                schema = empresa as ISchemaInfo;
                if (schema == null)
                {
                    schema = AppContext.ActiveSchema;
                }
            }
            catch
            {
            }

            ReportViewer.SetReport(reportMng.GetDetailResumenExamenReport(EntityInfo,
                                                                          PreguntaList.GetListaExamen(lista),
                                                                          null,
                                                                          empresa));
            ReportViewer.ShowDialog();
        }
        protected override void PrintAction()
        {
            if (_modulo == null || _promociones.Count == 0)
            {
                return;
            }

            PgMng.Reset(3, 1, Face.Resources.Messages.RETRIEVING_DATA, this);

            Alumno_PromocionList list = Alumno_PromocionList.GetListaAdmitidos(_modulo.Oid, FechaExamen_DTP.Value, _promociones, false);

            PgMng.Grow(Face.Resources.Messages.BUILDING_REPORT);

            AlumnoReportMng reportMng = new AlumnoReportMng(AppContext.ActiveSchema, string.Empty);

            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; }
            }

            AlumnosAdmitidosExamenRpt rpt = reportMng.GetAlumnosAdmitidosReport(list, _modulo, empresa);

            PgMng.FillUp();

            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);
            }
            ShowReport(rpt);

            _action_result = DialogResult.Ignore;
        }
        public ReportClass GetDetailReport(OutputDeliveryInfo item, FormatConfFacturaAlbaranReport conf)
        {
            if (item == null)
            {
                return(null);
            }

            List <OutputDeliveryLinePrint> conceptos = new List <OutputDeliveryLinePrint>();
            List <OutputDeliveryPrint>     pList     = new List <OutputDeliveryPrint>();

            foreach (OutputDeliveryLineInfo cfi in item.Conceptos)
            {
                conceptos.Add(OutputDeliveryLinePrint.New(cfi));
            }

            //Si no existen conceptos, no tiene sentido un informe detallado. Además, falla en Crystal Reports
            if (conceptos.Count <= 0)
            {
                return(null);
            }

            pList.Add(item.GetPrintObject());

            ReportClass doc = null;

            try
            {
                doc = GetReportFromName("Delivery", "OutputDeliveryRpt");
            }
            catch
            {
                doc = new OutputDeliveryRpt();
            }

            doc.SetDataSource(pList);
            doc.Subreports["LinesClientCopy"].SetDataSource(conceptos);
            //doc.Subreports["LinesCompanyCopy"].SetDataSource(conceptos);

            CompanyInfo empresa = CompanyInfo.Get(Schema.Oid);

            doc.SetParameterValue("nombreEmpresa", empresa.Name);
            doc.SetParameterValue("dirEmpresa", empresa.Direccion);
            doc.SetParameterValue("CIFEmpresa", empresa.VatNumber);
            doc.SetParameterValue("nota", conf.nota);
            doc.SetParameterValue("CPEmpresa", empresa.CodPostal);
            doc.SetParameterValue("municipioEmpresa", empresa.Municipio);
            doc.SetParameterValue("TlfEmpresa", empresa.Telefonos);
            doc.SetParameterValue("WebEmpresa", empresa.Url);

            return(doc);
        }
        public ReportClass GetWorkDelivery(OutputDeliveryInfo item, ExpedientInfo work)
        {
            if (item == null)
            {
                return(null);
            }

            List <OutputDeliveryLinePrint> conceptos = new List <OutputDeliveryLinePrint>();
            List <OutputDeliveryPrint>     pList     = new List <OutputDeliveryPrint>();

            foreach (OutputDeliveryLineInfo line in item.Conceptos)
            {
                conceptos.Add(OutputDeliveryLinePrint.New(line));
            }

            //Si no existen conceptos, no tiene sentido un informe detallado. Además, falla en Crystal Reports
            if (conceptos.Count <= 0)
            {
                return(null);
            }

            pList.Add(item.GetPrintObject());

            ReportClass doc = null;

            try
            {
                doc = GetReportFromName("Delivery", "WorkDeliveryRpt");
            }
            catch
            {
                doc = new WorkDeliveryRpt();
            }

            doc.SetDataSource(pList);
            doc.Subreports["LinesClientCopySubRpt"].SetDataSource(conceptos);
            doc.Subreports["LinesCompanyCopySubRpt"].SetDataSource(conceptos);

            CompanyInfo empresa = CompanyInfo.Get(Schema.Oid);

            doc.SetParameterValue("nombreEmpresa", empresa.Name);
            doc.SetParameterValue("dirEmpresa", empresa.Direccion);
            doc.SetParameterValue("CIFEmpresa", empresa.VatNumber);
            doc.SetParameterValue("TlfEmpresa", empresa.Telefonos);
            doc.SetParameterValue("WebEmpresa", empresa.Url);
            doc.SetParameterValue("WorkCode", (work != null) ? work.Codigo : string.Empty);
            doc.SetParameterValue("WorkDescription", (work != null) ? work.Description : string.Empty);

            return(doc);
        }
Beispiel #11
0
        public override void RefreshSecondaryData()
        {
            _company = CompanyInfo.Get(AppContext.ActiveSchema.Oid);
            PgMng.Grow();

            PaymentMethod_BS.DataSource = Library.Common.EnumText <EMedioPago> .GetList(false);

            PgMng.Grow(string.Empty, "Medios de Pago");

            EFormaPago[] formas_pago = { EFormaPago.Contado, EFormaPago.XDiasFechaFactura, EFormaPago.XDiasMes, EFormaPago.Trimestral };

            Datos_FormaPago.DataSource = Library.Common.EnumText <EFormaPago> .GetList(formas_pago, false);

            PgMng.Grow(string.Empty, "Formas de Pago");
        }
        public override void EmailLinkAction()
        {
            if (ActiveItem == null)
            {
                return;
            }

            PgMng.Reset(5, 1, Face.Resources.Messages.RETRIEVING_DATA, this);

            ClienteInfo cliente = ClienteInfo.Get(ActiveItem.OidCliente, false);

            PgMng.Grow();

            CompanyInfo empresa = CompanyInfo.Get(AppContext.ActiveSchema.Oid);

            PgMng.Grow();

            MailParams mail = new MailParams();

            string url = empresa.Url + String.Format(Library.Invoice.ModuleController.GetFacturaWebScript(), ActiveItem.Link);

            mail.To      = cliente.Email;
            mail.Body    = String.Format(Library.Invoice.Resources.Messages.FACTURA_EMAIL_LINK_BODY, url, empresa.Name);
            mail.Subject = Library.Invoice.Resources.Messages.FACTURA_EMAIL_SUBJECT;

            try
            {
                PgMng.Grow(moleQule.Face.Resources.Messages.OPENING_EMAIL_CLIENT, string.Empty);

                EMailSender.MailTo(mail);

                OutputInvoiceInfo item = OutputInvoiceInfo.Get(ActiveOID, true);
                PgMng.Grow();

                if (item.EEstado == EEstado.Abierto)
                {
                    ChangeStateAction(EEstadoItem.Emitido);
                }
            }
            catch
            {
                PgMng.ShowInfoException(moleQule.Face.Resources.Messages.NO_EMAIL_CLIENT);
            }
            finally
            {
                PgMng.FillUp();
            }
        }
Beispiel #13
0
        protected virtual void PrintDisponiblesAction()
        {
            SelectFechaDisponibilidadForm select_form = new SelectFechaDisponibilidadForm();

            if (select_form.ShowDialog() == DialogResult.OK)
            {
                InformePlantillaList List = InformePlantillaList.GetDisponiblesList(EntityInfo.Oid, select_form.FechaDisponibilidad_DTP.Value.Date);

                ExamenReportMng reportMng = new ExamenReportMng(AppContext.ActiveSchema);

                if (List.Count > 0)
                {
                    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; }
                    }

                    moleQule.Library.Instruction.Reports.Examen.InformeDisponiblesPlantillaRpt report = reportMng.GetInformeDisponiblesPlantillaReport(EntityInfo, List);
                    report.SetParameterValue("Empresa", empresa.Name);
                    report.SetParameterValue("FechaDisponibilidad", select_form.FechaDisponibilidad_DTP.Value.Date);
                    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();
                }
            }
        }
        protected override void PrintAction()
        {
            ExamenReportMng reportMng = new ExamenReportMng(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; }
            }

            ISchemaInfo schema = AppContext.ActiveSchema;

            try
            {
                schema = empresa as ISchemaInfo;
                if (schema == null)
                {
                    schema = AppContext.ActiveSchema;
                }
            }
            catch
            {
            }

            ReportViewer.SetReport(reportMng.GetDetailResumenExamenReport(_examen,
                                                                          lista, null, empresa));
            ReportViewer.ShowDialog();
        }
        protected override void PrintAction()
        {
            if (Ficha_TP.SelectedTab == Capacitacion_TP)
            {
                Submodulo_Instructor_PromocionList List = Submodulo_Instructor_PromocionList.GetListByInstructor(_entity.Oid);

                InstructorReportMng reportMng = new InstructorReportMng(AppContext.ActiveSchema);

                if (List.Count > 0)
                {
                    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; }
                    }

                    moleQule.Library.Instruction.Reports.Instructor.CapacitacionInstructorRpt report = reportMng.GetDetailReport(empresa, EntityInfo, List);
                    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();
                }
            }
        }
        public static void Login()
        {
            if (AppContext.Principal != null)
            {
                return;
            }

            try { AppController.Instance.Init("7.5.23.2"); }
            catch { }

            SettingsMng.Instance.SetLANServer("localhost");

            Principal.Login("Admin", "iQi_1998");

            //Carga del schema
            long oidSchema = SettingsMng.Instance.GetDefaultSchema();

            CompanyInfo company = CompanyInfo.Get(oidSchema);

            AppContext.Principal.ChangeUserSchema(company);
        }
Beispiel #17
0
        public MermaStockRpt GetMermaDetailReport(StockInfo item)
        {
            if (item == null)
            {
                return(null);
            }

            List <StockPrint> pList = new List <StockPrint>();

            pList.Add(item.GetPrintObject());

            MermaStockRpt doc = new MermaStockRpt();

            doc.SetDataSource(pList);

            CompanyInfo empresa = CompanyInfo.Get(Schema.Oid);

            doc.SetParameterValue("nombreEmpresa", empresa.Name);
            doc.SetParameterValue("dirEmpresa", empresa.Direccion);
            doc.SetParameterValue("CIFEmpresa", empresa.VatNumber);

            return(doc);
        }
Beispiel #18
0
        /// <summary>
        /// Función que carga la clase principal del programa (Empresa).
        /// </summary>
        /// <remarks>
        /// Si se quiere cargar el esquema por defecto basta con comentar la función
        /// y que tome el control el LoadSchema de moleQule
        /// </remarks>
        public override void LoadSchema()
        {
            try
            {
                // Obtenemos la empresa por defecto del fichero de los settings de usuario
                long oidSchema = SettingsMng.Instance.GetDefaultSchema();

                if (oidSchema != 0)
                {
                    CompanyInfo empresa = CompanyInfo.Get(oidSchema);
                    if (empresa.Code != null && empresa.Oid != 0)
                    {
                        CompanyMngForm em = new CompanyMngForm(true, this);
                        em.LoadSchema(empresa);
                        Controler.CheckModulesDBVersion();
                        AppContext.Principal.LoadUserContext();
                        AppController.SetHipatiaFTPParameters();
                    }
                    else
                    {
                        FormMng.OpenForm(CompanySelectForm.ID);
                    }
                }
                else
                {
                    FormMng.OpenForm(CompanySelectForm.ID);
                }
            }
            catch (Exception ex)
            {
                ProgressInfoMng.ShowException(ex);
                this.Dispose();
                System.Windows.Forms.Application.Exit();
            }

            this.Reload();
        }
        private void PrintCertificado_BT_Click(object sender, EventArgs e)
        {
            AlumnoReportMng reportMng = new AlumnoReportMng(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.Alumno.CertificadoNotasRpt rpt = reportMng.GetDetailReport(_entity, 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 #20
0
        protected override void LoadSettings()
        {
            //APPLICATION SETTINGS
            LANHost_TB.Text = Principal.GetLANServer();
            WANHost_TB.Text = Principal.GetWANServer();

            // GENERAL SETTINGS
            //try { FiltrarAno_CkB.Checked = Library.Common.ModulePrincipal.GetUseActiveYear(); }
            //catch { }
            //try { AnoActivo_DTP.Value = Library.Common.ModulePrincipal.GetActiveYear(); }
            //catch { }

            //NOTIFICACIONES
            //try { ShowNofity_CkB.Checked = SettingsMng.Instance.GetShowAutopilot(); }
            //catch { }

            //try { NotifyFacturasE_CkB.Checked = Library.Invoice.ModulePrincipal.GetNotifyFacturasEmitidas(); }
            //catch { }
            //try { NotifyFacturasR_CkB.Checked = Library.Store.ModulePrincipal.GetNotifyFacturasRecibidas(); }
            //catch { }
            //try { NotifyCobros_CkB.Checked = Library.Invoice.ModulePrincipal.GetNotifyCobros(); }
            //catch { }
            //try { NotifyPagos_CkB.Checked = Library.Store.ModulePrincipal.GetNotifyPagos(); }
            //catch { }
            //try { NotifyGastos_CkB.Checked = Library.Store.ModulePrincipal.GetNotifyGastos(); }
            //catch { }

            //try { NotifyFacturasE_TB.Text = Library.Invoice.ModulePrincipal.GetNotifyPlazoFacturasEmitidas().ToString(); }
            //catch { }
            //try { NotifyFacturasR_TB.Text = Library.Store.ModulePrincipal.GetNotifyPlazoFacturasRecibidas().ToString(); }
            //catch { }
            //try { NotifyCobros_TB.Text = Library.Invoice.ModulePrincipal.GetNotifyPlazoCobros().ToString(); }
            //catch { }
            //try { NotifyPagos_TB.Text = Library.Store.ModulePrincipal.GetNotifyPlazoPagos().ToString(); }
            //catch { }
            //try { NotifyGastos_TB.Text = Library.Store.ModulePrincipal.GetNotifyPlazoGastos().ToString(); }
            //catch { }

            // FACTURACION / CAJA
            //try
            //{
            //    _serie_venta = SerieInfo.Get(Library.Invoice.ModulePrincipal.GetDefaultSerieSetting());
            //    SerieVenta_TB.Text = _serie_venta.Nombre;
            //}
            //catch { }

            //try
            //{
            //    _serie_compra = SerieInfo.Get(Library.Store.ModulePrincipal.GetDefaultSerieSetting());
            //    SerieCompra_TB.Text = _serie_compra.Nombre;
            //}
            //catch { }

            //try { LineaCaja_CkB.Checked = Library.Invoice.ModulePrincipal.GetLineaCajaLibreSetting(); }
            //catch { }

            //try
            //{
            //    _caja_tickets = CashInfo.Get(Library.Invoice.ModulePrincipal.GetCajaTicketsSetting());
            //    CajaTickets_TB.Text = _caja_tickets.Nombre;
            //}
            //catch { }

            // CONTABILIDAD
            //CuentaCaja_TB.Text = CashInfo.Get(1, false).CuentaContable;
            //CuentaNominas_TB.Text = Library.Invoice.ModulePrincipal.GetCuentaNominasSetting();
            //CuentaSegSocial_TB.Text = Library.Invoice.ModulePrincipal.GetCuentaSegurosSocialesSetting();
            //CuentaHacienda_TB.Text = Library.Invoice.ModulePrincipal.GetCuentaHaciendaSetting();
            //CuentaRemuneraciones_TB.Text = Library.Invoice.ModulePrincipal.GetCuentaRemuneracionesSetting();
            //CuentaEfectosAPagar_TB.Text = Library.Invoice.ModulePrincipal.GetCuentaEfectosAPagarSetting();
            //CuentaEfectosACobrar_TB.Text = Library.Invoice.ModulePrincipal.GetCuentaEfectosACobrarSetting();
            //AsientoInicial_TB.Text = Library.Invoice.ModulePrincipal.GetLastAsientoSetting();
            //Diario_TB.Text = Library.Invoice.ModulePrincipal.GetJournalSetting();
            //NDigitosCuentasContables_CB.Text = Library.Common.ModulePrincipal.GetNDigitosCuentasContablesSetting().ToString();
            //UseTPVCount_CkB.Checked = Library.Invoice.ModulePrincipal.GetUseTPVCountSetting();
            //ContabilidadFolder_TB.Text = Library.Invoice.ModulePrincipal.GetContabilidadFolder();

            //CuentaCaja_TB.Text = CashInfo.Get(1, false).CuentaContable;

            // NOMINAS
            //try
            //{
            //    _nominas = TipoGastoInfo.Get(Library.Store.ModulePrincipal.GetDefaultNominasSetting());
            //    Nominas_TB.Text = _nominas.Nombre;
            //}
            //catch { }

            //try
            //{
            //    _seguros = TipoGastoInfo.Get(Library.Store.ModulePrincipal.GetDefaultSegurosSetting());
            //    Seguros_TB.Text = _seguros.Nombre;
            //}
            //catch { }

            //try
            //{
            //    _irpf = TipoGastoInfo.Get(Library.Store.ModulePrincipal.GetDefaultIRPFSetting());
            //    IRPF_TB.Text = _irpf.Nombre;
            //}
            //catch { }

            ////// BALANCE
            //BalancePrintFacturasExplotacion_CkB.Checked = Library.Invoice.ModulePrincipal.GetBalancePrintFacturasExplotacion();
            //BalancePrintFacturasAcreedores_CkB.Checked = Library.Invoice.ModulePrincipal.GetBalancePrintFacturasAcreeedores();
            //BalancePrintOtrosGastos_CkB.Checked = Library.Invoice.ModulePrincipal.GetBalancePrintOtrosGastos();
            //BalancePrintGastosNominas_CkB.Checked = Library.Invoice.ModulePrincipal.GetBalancePrintGastosNominas();
            //BalancePrintEfectosPtesVto_CkB.Checked = Library.Invoice.ModulePrincipal.GetBalancePrintEfectosPendientesVto();
            //BalancePrintPagosEstimados_CkB.Checked = Library.Invoice.ModulePrincipal.GetBalancePrintPagosEstimados();

            //BalancePrintFacturasEmitidas_CkB.Checked = Library.Invoice.ModulePrincipal.GetBalancePrintFacturasEmitidas();
            //BalancePrintExistencias_CkB.Checked = Library.Invoice.ModulePrincipal.GetBalancePrintExistencias();
            //BalancePrintEfectosNegociados_CkB.Checked = Library.Invoice.ModulePrincipal.GetBalancePrintEfectosNegociados();
            //BalancePrintEfectosPendientes_CkB.Checked = Library.Invoice.ModulePrincipal.GetBalancePrintEfectosPendientes();
            //BalancePrintAyudasPendientes_CkB.Checked = Library.Invoice.ModulePrincipal.GetBalancePrintAyudasPendientes();
            //BalancePrintAyudasCobradas_CkB.Checked = Library.Invoice.ModulePrincipal.GetBalancePrintAyudasCobradas();
            //BalancePrintBancos_CkB.Checked = Library.Invoice.ModulePrincipal.GetBalancePrintBancos();

            //Settings de Auditoría

            //try { NotifyAuditorias_CkB.Checked = Library.Quality.ModulePrincipal.GetNotifyAuditorias(); }
            //catch { }

            //try { NotifyAuditorias_TB.Text = Library.Quality.ModulePrincipal.GetNotifyPlazoAuditorias().ToString(); }
            //catch { }

            //try { PM_DiscrepanciasN1_TB.Text = Library.Quality.ModulePrincipal.GetPlazoMaximoDiscrepanciasN1Setting().ToString(); }
            //catch { }
            //try { PM_DiscrepanciasN2_TB.Text = Library.Quality.ModulePrincipal.GetPlazoMaximoDiscrepanciasN2Setting().ToString(); }
            //catch { }
            //try { PM_DiscrepanciasN3_TB.Text = Library.Quality.ModulePrincipal.GetPlazoMaximoDiscrepanciasN3Setting().ToString(); }
            //catch { }
            //try { PM_GeneracionInforme_TB.Text = Library.Quality.ModulePrincipal.GetPlazoMaximoGeneracionInformeSetting().ToString(); }
            //catch { }
            //try { PM_NotificacionDiscrepancias_TB.Text = Library.Quality.ModulePrincipal.GetPlazoMaximoNotificacionDiscrepanciasSetting().ToString(); }
            //catch { }
            //try { PM_NotificacionFinAuditoria_TB.Text = Library.Quality.ModulePrincipal.GetPlazoMaximoNotificacionFinAuditoriaSetting().ToString(); }
            //catch { }
            //try { PM_RespuestaAmpliacion_TB.Text = Library.Quality.ModulePrincipal.GetPlazoMaximoRespuestaAmpliacionSetting().ToString(); }
            //catch { }
            //try { PorcentajeMaximoAmpliacion_TB.Text = Library.Quality.ModulePrincipal.GetPlazoMaximoAmpliacionSetting().ToString(); }
            //catch { }
            //try { AvisoDiscrepanciasAbiertas_TB.Text = Library.Quality.ModulePrincipal.GetAvisoDiscrepanciasAbiertasSetting().ToString(); }
            //catch { }

            //Exámenes

            try { PM_FaltasModulo_TB.Text = Library.Instruction.ModulePrincipal.GetPorcentajeMaximoFaltasModuloSetting().ToString(); }
            catch { }
            try { Pm_ExamenAprobado_TB.Text = Library.Instruction.ModulePrincipal.GetPorcentajeMinimoExamenAprobadoSetting().ToString(); }
            catch { }
            try { PM_FaltasModulo_CB.Checked = Convert.ToBoolean(Library.Instruction.ModulePrincipal.GetCriterioPorcentajeMaximoFaltasModuloSetting()); }
            catch { }
            try { Pm_NotaExamen_CB.Checked = Convert.ToBoolean(Library.Instruction.ModulePrincipal.GetCriterioPorcentajeMinimoExamenAprobadoSetting()); }
            catch { }
            try { PreguntasDesarrollo_MTB.Text = Library.Instruction.ModulePrincipal.GetTiempoPreguntasTipoDesarrolloSetting().TimeOfDay.ToString(); }
            catch { }
            try { PreguntasTest_MTB.Text = Library.Instruction.ModulePrincipal.GetTiempoPreguntasTipoTestSetting().TimeOfDay.ToString(); }
            catch { }

            moleQule.Library.HComboBoxSourceList lista_horas_ini = new moleQule.Library.HComboBoxSourceList();

            lista_horas_ini.Add(new ComboBoxSource(1, "9:00"));
            lista_horas_ini.Add(new ComboBoxSource(2, "10:00"));
            lista_horas_ini.Add(new ComboBoxSource(3, "11:00"));
            lista_horas_ini.Add(new ComboBoxSource(4, "12:00"));
            lista_horas_ini.Add(new ComboBoxSource(5, "13:00"));
            lista_horas_ini.Add(new ComboBoxSource(6, "14:00"));
            lista_horas_ini.Add(new ComboBoxSource(7, "15:00"));
            lista_horas_ini.Add(new ComboBoxSource(8, "16:00"));
            lista_horas_ini.Add(new ComboBoxSource(9, "17:00"));
            lista_horas_ini.Add(new ComboBoxSource(10, "18:00"));
            lista_horas_ini.Add(new ComboBoxSource(11, "19:00"));
            lista_horas_ini.Add(new ComboBoxSource(12, "20:00"));
            lista_horas_ini.Add(new ComboBoxSource(13, "21:00"));

            moleQule.Library.HComboBoxSourceList lista_horas_fin = new moleQule.Library.HComboBoxSourceList();

            lista_horas_fin.Add(new ComboBoxSource(1, "9:59"));
            lista_horas_fin.Add(new ComboBoxSource(2, "10:59"));
            lista_horas_fin.Add(new ComboBoxSource(3, "11:59"));
            lista_horas_fin.Add(new ComboBoxSource(4, "12:59"));
            lista_horas_fin.Add(new ComboBoxSource(5, "13:59"));
            lista_horas_fin.Add(new ComboBoxSource(6, "14:59"));
            lista_horas_fin.Add(new ComboBoxSource(7, "15:59"));
            lista_horas_fin.Add(new ComboBoxSource(8, "16:59"));
            lista_horas_fin.Add(new ComboBoxSource(9, "17:59"));
            lista_horas_fin.Add(new ComboBoxSource(10, "18:59"));
            lista_horas_fin.Add(new ComboBoxSource(11, "19:59"));
            lista_horas_fin.Add(new ComboBoxSource(12, "20:59"));
            lista_horas_fin.Add(new ComboBoxSource(13, "21:59"));

            Datos_HorasMI.DataSource  = lista_horas_ini;
            Datos_HorasMF.DataSource  = lista_horas_fin;
            Datos_HorasT1I.DataSource = lista_horas_ini;
            Datos_HorasT1F.DataSource = lista_horas_fin;
            Datos_HorasT2I.DataSource = lista_horas_ini;
            Datos_HorasT2F.DataSource = lista_horas_fin;

            try { InicioManana_CB.SelectedValue = Convert.ToInt64(Library.Instruction.ModulePrincipal.GetHoraInicioDisponibilidadMananaSetting()); }
            catch { }
            try { FinManana_CB.SelectedValue = Convert.ToInt64(Library.Instruction.ModulePrincipal.GetHoraFinDisponibilidadMananaSetting()); }
            catch { }
            try { InicioTarde1_CB.SelectedValue = Convert.ToInt64(Library.Instruction.ModulePrincipal.GetHoraInicioDisponibilidadTarde1Setting()); }
            catch { }
            try { FinTarde1_CB.SelectedValue = Convert.ToInt64(Library.Instruction.ModulePrincipal.GetHoraFinDisponibilidadTarde1Setting()); }
            catch { }
            try { InicioTarde2_CB.SelectedValue = Convert.ToInt64(Library.Instruction.ModulePrincipal.GetHoraInicioDisponibilidadTarde2Setting()); }
            catch { }
            try { FinTarde2_CB.SelectedValue = Convert.ToInt64(Library.Instruction.ModulePrincipal.GetHoraFinDisponibilidadTarde2Setting()); }
            catch { }

            try { InstructoresAutorizados_CB.Checked = Convert.ToBoolean(Library.Instruction.ModulePrincipal.GetMostrarInstructoresAutorizadosSetting()); }
            catch { }

            try { ImpresionEmpresaDefault_CB.Checked = Convert.ToBoolean(Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting()); }
            catch { }

            try {
                CompanyInfo empresa = CompanyInfo.Get(Convert.ToInt64(Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting()), false);
                ImpresionEmpresaDefault_TB.Text = empresa.Name;
            }
            catch { }


            base.LoadSettings();
        }
        public static void SendMailsFacturasPendientes()
        {
            try
            {
                OutputInvoiceList facturas = OutputInvoiceList.GetNoCobradasList(true);
                ClienteList       clientes = ClienteList.GetList(false);
                SerieList         series   = SerieList.GetList(false);
                CompanyInfo       empresa  = CompanyInfo.Get(AppContext.ActiveSchema.Oid);

                SerieInfo   serie;
                ClienteInfo cliente;

                Registro registro = Registro.New(ETipoRegistro.Email);
                registro.Nombre        = "Envio automático de Facturas";
                registro.Observaciones = "Envio automático de Facturas pendientes de pago";

                foreach (OutputInvoiceInfo item in facturas)
                {
                    if (item.Prevision.AddDays(ModulePrincipal.GetPeriodicidadEnvioFacturasPendientes()) > DateTime.Today)
                    {
                        continue;
                    }

                    cliente = clientes.GetItem(item.OidCliente);
                    if (!cliente.EnviarFacturaPendiente)
                    {
                        continue;
                    }

                    serie = series.GetItem(item.OidSerie);

                    FormatConfFacturaAlbaranReport conf = new FormatConfFacturaAlbaranReport();

                    conf.nota  = (cliente.OidImpuesto == 1) ? Resources.Messages.NOTA_EXENTO_IGIC : string.Empty;
                    conf.nota += Environment.NewLine + (item.Nota ? serie.Cabecera : "");

                    OutputInvoiceReportMng reportMng = new OutputInvoiceReportMng(AppContext.ActiveSchema, string.Empty, string.Empty);
                    ReportClass            report    = reportMng.GetDetailReport(item, serie, cliente, null, conf);

                    if (report != null)
                    {
                        LineaRegistro linea = registro.LineaRegistros.NewItem(registro, cliente);

                        ExportOptions options = new ExportOptions();
                        DiskFileDestinationOptions diskFileDestinationOptions = new DiskFileDestinationOptions();

                        string fileName = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                        fileName += "\\" + item.FileName;

                        diskFileDestinationOptions.DiskFileName = fileName;
                        options.ExportFormatType         = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
                        options.ExportDestinationType    = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
                        options.ExportDestinationOptions = diskFileDestinationOptions;

                        report.Export(options);

                        System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();

                        mail.To.Add(new MailAddress(cliente.Email, cliente.Nombre));
                        mail.From    = new MailAddress(SettingsMng.Instance.GetSMTPMail(), empresa.Name);
                        mail.Body    = String.Format(Resources.Messages.FACTURA_EMAIL_ATTACHMENT_BODY, empresa.Name);
                        mail.Subject = Resources.Messages.FACTURA_EMAIL_SUBJECT;
                        mail.Attachments.Add(new Attachment(fileName));

                        try
                        {
                            Thread mailThread = new Thread(SendMailDelegate);
                            mailThread.Start(mail);
                            while (mailThread.IsAlive)
                            {
                                ;
                            }

                            linea.Observaciones = linea.Descripcion;
                            linea.Descripcion   = String.Format(Resources.Messages.FACTURA_EMAIL_OK, item.NFactura);
                        }
                        catch (Exception ex)
                        {
                            linea.Observaciones = linea.Descripcion;
                            linea.Descripcion   = String.Format(Resources.Messages.FACTURA_EMAIL_ERROR, item.NFactura);
                            registro.Save();
                            throw new iQException(ex.Message + Environment.NewLine + Environment.NewLine + moleQule.Library.Resources.Errors.SMTP_SETTINGS);
                        }
                        finally
                        {
                            mail.Dispose();
                            try { File.Delete(fileName); }
                            catch (Exception ex) { string a = ex.Message; }
                        }
                    }
                }

                registro.Save();

                ModulePrincipal.SetFechaUltimoEnvioFacturasPendientes(DateTime.Now);
                AppContext.Principal.SaveSettings();
            }
            catch { }
        }
        /// <summary>
        /// Implementa Save_button_Click
        /// </summary>
        protected override void SubmitAction()
        {
            this.Enabled = false;

            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; }
            }

            try
            {
                if (CReports_CkB.CheckState == CheckState.Checked)
                {
                    if (Portada_CB.Checked)
                    {
                        ExportaCR(ETipoPagina.Portada, empresa);
                    }

                    if (Preguntas_CB.Checked)
                    {
                        ExportaCR(ETipoPagina.Preguntas, empresa);
                    }
                }
                else if (PDF_CkB.CheckState == CheckState.Checked)
                {
                    if (Portada_CB.Checked)
                    {
                        ExportaPDF(ETipoPagina.Portada, empresa);
                    }

                    if (Preguntas_CB.Checked)
                    {
                        ExportaPDF(ETipoPagina.Preguntas, empresa);
                    }
                }
                else if (Doc_CkB.CheckState == CheckState.Checked)
                {
                    if (Portada_CB.Checked)
                    {
                        ExportaCR(ETipoPagina.Portada, empresa);
                    }

                    if (Preguntas_CB.Checked)
                    {
                        ExportaDOC(empresa);
                    }
                }

                if (ModeloRespuesta_CB.Checked)
                {
                    foreach (PreguntaExamenInfo item in _entity.PreguntaExamenes)
                    {
                        if (_entity.Emitido)
                        {
                            System.Diagnostics.Process.Start(item.ModeloRespuestaPath);
                        }
                        else
                        {
                            System.Diagnostics.Process.Start(moleQule.Library.Application.AppController.MODELOS_PREGUNTAS_PATH + item.ModeloRespuesta);
                        }
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
            finally { this.Enabled = true; }

            _action_result = DialogResult.Ignore;
            Close();
        }
        /// <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;
            }
        }
 protected override void RefreshMainData()
 {
     _company = CompanyInfo.Get(AppContext.ActiveSchema.Oid);
     PgMng.Grow();
 }
        private void Imprimir_BT_Click(object sender, EventArgs e)
        {
            InsertarRegistros();
            ExamenInfo      EntityInfo = _entity.GetInfo(true);
            ExamenReportMng reportMng  = new ExamenReportMng(AppContext.ActiveSchema);

            //List<Alumno_ExamenInfo> lista = new List<Alumno_ExamenInfo>();

            //foreach (AlumnoInfo alumno in _alumnos)
            //{
            //    Alumno_ExamenInfo item = EntityInfo.Alumnos.GetItemByProperty("OidAlumno", alumno.Oid);
            //    if (item != null)
            //        lista.Add(item);
            //}

            foreach (TreeNode promocion in Arbol_TV.Nodes)
            {
                List <Alumno_ExamenInfo> lista = new List <Alumno_ExamenInfo>();

                foreach (TreeNode alumno in promocion.Nodes)
                {
                    if (alumno.Checked)
                    {
                        long oid = ((AlumnoInfo)alumno.Tag).Oid;
                        Alumno_ExamenInfo item = EntityInfo.Alumnos.GetItemByProperty("OidAlumno", oid);
                        if (item != null)
                        {
                            lista.Add(item);
                        }
                    }
                }

                if (lista.Count > 0)
                {
                    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; }
                    }

                    ISchemaInfo schema = AppContext.ActiveSchema;
                    try
                    {
                        schema = empresa as ISchemaInfo;
                        if (schema == null)
                        {
                            schema = AppContext.ActiveSchema;
                        }
                    }
                    catch
                    {
                    }

                    ReportViewer.SetReport(reportMng.GetDetailAsistenciaExamenReport(EntityInfo,
                                                                                     _promociones, lista,
                                                                                     empresa,
                                                                                     ((PromocionInfo)promocion.Tag).Nombre));
                    ReportViewer.ShowDialog();
                }
            }

            /*foreach (Alumno_ExamenInfo item in EntityInfo.Alumnos)
             * {
             *  AlumnoInfo alumno = _alumnos.GetItem(item.OidAlumno);
             *  if (alumno != null)
             *  {
             *      //item.OidPromocion = alumno.OidPromocion;
             *      lista.Add(item);
             *  }
             * }*/

            //if (lista.Count > 0)
            //{
            //    ReportViewer.SetReport(reportMng.GetDetailAsistenciaExamenReport(EntityInfo,
            //                                                                    _promociones, lista,
            //                                                                    moleQule.Library.Common.EmpresaInfo.Get(AppContext.ActiveSchema.Oid)));
            //    ReportViewer.ShowDialog();
            //}
        }
        public override void EmailPDFAction()
        {
            if (ActiveItem == null)
            {
                return;
            }

            PgMng.Reset(10, 1, Face.Resources.Messages.RETRIEVING_DATA, this);

            SerieInfo serie = SerieInfo.Get(ActiveItem.OidSerie, false);

            PgMng.Grow();

            ClienteInfo client = ClienteInfo.Get(ActiveItem.OidCliente, false);

            PgMng.Grow();

            TransporterInfo transporter = TransporterInfo.Get(ActiveItem.OidTransportista, ETipoAcreedor.TransportistaDestino, false);

            PgMng.Grow();

            CompanyInfo company = CompanyInfo.Get(AppContext.ActiveSchema.Oid);

            PgMng.Grow();

            FormatConfFacturaAlbaranReport conf = new FormatConfFacturaAlbaranReport();

            conf.nota            = (client.OidImpuesto == 1) ? Library.Invoice.Resources.Messages.NOTA_EXENTO_IGIC : string.Empty;
            conf.nota           += Environment.NewLine + (ActiveItem.Nota ? serie.Cabecera : "");
            conf.cuenta_bancaria = ActiveItem.CuentaBancaria;
            PgMng.Grow();

            OutputInvoiceInfo item = OutputInvoiceInfo.Get(ActiveOID, true);

            PgMng.Grow();

            OutputInvoiceReportMng reportMng = new OutputInvoiceReportMng(AppContext.ActiveSchema, this.Text, this.FilterValues);
            ReportClass            report    = reportMng.GetDetailReport(item, serie, client, transporter, conf);

            PgMng.Grow();

            if (report != null)
            {
                ExportOptions options = new ExportOptions();
                DiskFileDestinationOptions diskFileDestinationOptions = new DiskFileDestinationOptions();

                string fileName = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                fileName += "\\" + ActiveItem.FileName;

                PgMng.Grow(String.Format(Face.Resources.Messages.EXPORTING_PDF, fileName), string.Empty);

                diskFileDestinationOptions.DiskFileName = fileName;
                options.ExportFormatType         = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
                options.ExportDestinationType    = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
                options.ExportDestinationOptions = diskFileDestinationOptions;

                PgMng.Grow();

                report.Export(options);

                PgMng.Grow(Face.Resources.Messages.SENDING_EMAIL);

                System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();

                mail.To.Add(new MailAddress(client.Email, client.Nombre));
                mail.From    = new MailAddress(SettingsMng.Instance.GetSMTPMail(), company.Name);
                mail.Body    = String.Format(Library.Invoice.Resources.Messages.FACTURA_EMAIL_ATTACHMENT_BODY, company.Name);
                mail.Subject = Library.Invoice.Resources.Messages.FACTURA_EMAIL_SUBJECT;
                mail.Attachments.Add(new Attachment(fileName));

                try
                {
                    PgMng.Grow(moleQule.Face.Resources.Messages.SENDING_EMAIL, string.Empty);

                    EMailClient.Instance.SmtpCliente.Send(mail);

                    if (item.EEstado == EEstado.Abierto)
                    {
                        ChangeStateAction(EEstadoItem.Emitido);
                    }

                    PgMng.ShowInfoException("Mensaje enviado con éxito");
                }
                catch (Exception ex)
                {
                    PgMng.ShowInfoException(ex.Message + Environment.NewLine + Environment.NewLine + moleQule.Library.Resources.Errors.SMTP_SETTINGS);
                }
                finally
                {
                    mail.Dispose();
                    PgMng.FillUp();
                }
            }
            else
            {
                PgMng.ShowInfoException(Face.Resources.Messages.NO_DATA_REPORTS);

                PgMng.FillUp();
            }
        }
        private void Imprimir_BT_Click(object sender, EventArgs e)
        {
            AuditoriaReportMng reportMng = new AuditoriaReportMng(AppContext.ActiveSchema);

            switch (_entity.TipoAsociado)
            {
            case (long)TipoNotificacionAsociado.COMUNICADO_AUDITORIA:
            {
                NotificacionInternaRpt comunicado = reportMng.GetDetailNotificacionAuditoriaReport(EntityInfo, Auditoria.GetInfo(false), CompanyInfo.Get(AppContext.ActiveSchema.Oid, false));

                ReportViewer.SetReport(comunicado);
                ReportViewer.ShowDialog();
            } break;

            case (long)TipoNotificacionAsociado.INFORME_DISCREPANCIAS:
            {
                NotificacionInternaRpt comunicado = reportMng.GetDetailNotificacionDiscrepanciasReport(EntityInfo, Auditoria.GetInfo(false), CompanyInfo.Get(AppContext.ActiveSchema.Oid, false));

                ReportViewer.SetReport(comunicado);
                ReportViewer.ShowDialog();
            }
            break;

            case (long)TipoNotificacionAsociado.INFORME_ACCIONES_CORRECTORAS:
            {
                NotificacionInternaRpt comunicado = reportMng.GetDetailNotificacionDiscrepanciasReport(EntityInfo, Auditoria.GetInfo(false), CompanyInfo.Get(AppContext.ActiveSchema.Oid, false));

                ReportViewer.SetReport(comunicado);
                ReportViewer.ShowDialog();
            }
            break;

            case (long)TipoNotificacionAsociado.INFORME_FIN_AUDITORIA:
            {
                NotificacionInternaRpt comunicado = reportMng.GetDetailNotificacionCierreDiscrepanciasReport(EntityInfo, Auditoria.GetInfo(false), CompanyInfo.Get(AppContext.ActiveSchema.Oid, false));

                ReportViewer.SetReport(comunicado);
                ReportViewer.ShowDialog();
            }
            break;

            case (long)TipoNotificacionAsociado.SOLICITUD_AMPLIACION:
            {
                NotificacionInternaRpt comunicado = reportMng.GetDetailNotificacionDiscrepanciasReport(EntityInfo, Auditoria.GetInfo(false), CompanyInfo.Get(AppContext.ActiveSchema.Oid, false));

                ReportViewer.SetReport(comunicado);
                ReportViewer.ShowDialog();
            }
            break;

            case (long)TipoNotificacionAsociado.CONCESION_AMPLIACION:
            {
                NotificacionInternaRpt comunicado = reportMng.GetDetailNotificacionDiscrepanciasReport(EntityInfo, Auditoria.GetInfo(false), CompanyInfo.Get(AppContext.ActiveSchema.Oid, false));

                ReportViewer.SetReport(comunicado);
                ReportViewer.ShowDialog();
            }
            break;

            case (long)TipoNotificacionAsociado.DENEGACION_AMPLIACION:
            {
                NotificacionInternaRpt comunicado = reportMng.GetDetailNotificacionDiscrepanciasReport(EntityInfo, Auditoria.GetInfo(false), CompanyInfo.Get(AppContext.ActiveSchema.Oid, false));

                ReportViewer.SetReport(comunicado);
                ReportViewer.ShowDialog();
            }
            break;

            default:
                break;
            }
        }
Beispiel #28
0
        private void Estadisticas_BT_Click(object sender, EventArgs e)
        {
            if (EntityInfo.FechaEmision.Date > DateTime.Today.Date)
            {
                MessageBox.Show(Resources.Messages.EXAMEN_NO_EMITIDO);
                return;
            }

            if (!EntityInfo.Desarrollo)
            {
                EstadisticaExamenList estadisticas = EstadisticaExamenList.GetList(Entity);
                ShowChartAction(estadisticas);

                ExamenReportMng reportMng = new ExamenReportMng(AppContext.ActiveSchema);

                EstadisticaExamenRpt rpt = reportMng.GetEstadisticaReport(EntityInfo, estadisticas, CompanyInfo.Get(AppContext.ActiveSchema.Oid, false));

                ReportViewer.SetReport(rpt);
                ReportViewer.ShowDialog();
            }
        }
Beispiel #29
0
        protected override void PrintComunicado()
        {
            if ((EstadoAuditoria)_entity.Estado >= EstadoAuditoria.COMUNICADA)
            {
                AuditoriaReportMng reportMng = new AuditoriaReportMng(AppContext.ActiveSchema);

                if (_entity.Notificaciones.Count > 0)
                {
                    NotificacionInternaInfo comunicado = _entity.Notificaciones[0].GetInfo();

                    NotificacionInternaRpt rpt = reportMng.GetDetailNotificacionAuditoriaReport(comunicado, EntityInfo, CompanyInfo.Get(AppContext.ActiveSchema.Oid, false));

                    ReportViewer.SetReport(rpt);
                    ReportViewer.ShowDialog();
                }

                /*if (_entity.Informes.Count > 0)
                 * {
                 *  InformeDiscrepanciaRpt Dreport = reportMng.GetDetailReport(_entity.GetInfo(true).Informes[0].Discrepancias);
                 *
                 *  ReportViewer.SetReport(Dreport);
                 *  ReportViewer.ShowDialog();
                 *
                 *  InformeAccionesCorrectorasRpt Creport = reportMng.GetDetailReport(_entity.GetInfo(true).Informes[0].Correctores[0]);
                 *
                 *  ReportViewer.SetReport(Creport);
                 *  ReportViewer.ShowDialog();
                 *
                 *  ControlNoConformidadRpt Nreport = reportMng.GetNoConformidadDetailReport(_entity.GetInfo(true).Informes[0].Discrepancias);
                 *
                 *  ReportViewer.SetReport(Nreport);
                 *  ReportViewer.ShowDialog();
                 * }*/
            }
        }
 protected override void GetFormSourceData(long oid)
 {
     _entity = CompanyInfo.Get(oid, true);
 }