Esempio n. 1
0
        public static void ProcessReportSystemAudit(CustomReportDisplayMode pViewMode, string filter, string filterHumanReadable)
        {
            try
            {
                //Move This to CustomReport SubClasses ex Filename, Params, DataSources etc

                string       reportFile   = GetReportFilePath("ReportSystemAuditList.frx");
                CustomReport customReport = new CustomReport(reportFile, 1);
                //Report Parameters
                customReport.SetParameterValue("Report Title", Resx.report_list_audit_table);
                //customReport.SetParameterValue("Factura No", 280);

                //Prepare and Declare FRBOGenericCollections
                FRBOGenericCollection <FRBOSystemAuditView> gcSystemAudit = new FRBOGenericCollection <FRBOSystemAuditView>(filter);

                //Prepare and Enable DataSources
                customReport.RegisterData(gcSystemAudit, "SystemAudit");
                if (customReport.GetDataSource("SystemAudit") != null)
                {
                    customReport.GetDataSource("SystemAudit").Enabled = true;
                }

                //customReport.ReportInfo.Name = FILL THIS WITH REPORT NAME;
                customReport.Process(pViewMode);
                customReport.Dispose();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Esempio n. 2
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //Static

        // report_label_list_family_subfamily_articles : Relatório - Familias, SubFamilias e Artigos
        public static void ProcessReportArticle(CustomReportDisplayMode pViewMode)
        {
            try
            {
                //Move This to CustomReport SubClasses ex Filename, Params, DataSources etc

                string       reportFile   = GetReportFilePath("ReportArticleList.frx");
                CustomReport customReport = new CustomReport(reportFile, 1);
                //Report Parameters
                customReport.SetParameterValue("Report Title", Resx.report_list_family_subfamily_articles);
                //customReport.SetParameterValue("Factura No", 280);

                //Prepare and Declare FRBOGenericCollections
                //"Oid,Designation,ButtonLabel"
                FRBOGenericCollection <FRBOArticleFamily>    gcArticleFamily = new FRBOGenericCollection <FRBOArticleFamily>();
                FRBOGenericCollection <FRBOArticleSubFamily> gcArticleSubFamily;
                FRBOGenericCollection <FRBOArticle>          gcArticle;

                //Render Child Bussiness Objects
                foreach (FRBOArticleFamily family in gcArticleFamily)
                {
                    //Get SubFamily
                    gcArticleSubFamily      = new FRBOGenericCollection <FRBOArticleSubFamily>(string.Format("Family = '{0}'", family.Oid), "Ord");
                    family.ArticleSubFamily = gcArticleSubFamily.List;

                    //Get Articles
                    foreach (FRBOArticleSubFamily subFamily in family.ArticleSubFamily)
                    {
                        gcArticle         = new FRBOGenericCollection <FRBOArticle>(string.Format("SubFamily = '{0}'", subFamily.Oid), "Ord");
                        subFamily.Article = gcArticle.List;
                    }
                }

                //Prepare and Enable DataSources
                customReport.RegisterData(gcArticleFamily, "ArticleFamily");
                if (customReport.GetDataSource("ArticleFamily") != null)
                {
                    customReport.GetDataSource("ArticleFamily").Enabled = true;
                }
                if (customReport.GetDataSource("ArticleFamily.ArticleSubFamily") != null)
                {
                    customReport.GetDataSource("ArticleFamily.ArticleSubFamily").Enabled = true;
                }
                if (customReport.GetDataSource("ArticleFamily.ArticleSubFamily.Article") != null)
                {
                    customReport.GetDataSource("ArticleFamily.ArticleSubFamily.Article").Enabled = true;
                }

                //customReport.ReportInfo.Name = FILL THIS WITH REPORT NAME;
                customReport.Process(pViewMode);
                customReport.Dispose();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Esempio n. 3
0
        public static void ProcessReportDocumentMasterList(CustomReportDisplayMode pViewMode, string reportTitle, string groupCondition, string groupTitle, string filter, string filterHumanReadable)
        {
            try
            {
                //Move This to CustomReport SubClasses ex Filename, Params, DataSources etc

                string       reportFile   = GetReportFilePath("ReportDocumentFinanceMasterList.frx");
                CustomReport customReport = new CustomReport(reportFile, 1);
                //Report Parameters
                customReport.SetParameterValue("Report Title", reportTitle);
                if (!string.IsNullOrEmpty(filterHumanReadable))
                {
                    customReport.SetParameterValue("Report Filter", filterHumanReadable);
                }

                // Get Objects
                GroupHeaderBand groupHeaderBand     = (GroupHeaderBand)customReport.FindObject("GroupHeader1");
                TextObject      groupHeaderBandText = (TextObject)customReport.FindObject("TextGroupHeader1");
                if (groupHeaderBand != null && groupHeaderBandText != null)
                {
                    groupHeaderBand.Condition = groupCondition;
                    groupHeaderBandText.Text  = groupTitle;
                }
                else
                {
                    _log.Error("Error cant find Report Objects");
                }

                //Prepare and Declare FRBOGenericCollections
                FRBOGenericCollection <FRBODocumentFinanceMaster> gcDocumentFinanceMaster = new FRBOGenericCollection <FRBODocumentFinanceMaster>(filter);

                //Prepare and Enable DataSources
                customReport.RegisterData(gcDocumentFinanceMaster, "DocumentFinanceMaster");
                if (customReport.GetDataSource("DocumentFinanceMaster") != null)
                {
                    customReport.GetDataSource("DocumentFinanceMaster").Enabled = true;
                }

                //customReport.ReportInfo.Name = FILL THIS WITH REPORT NAME;
                customReport.Process(pViewMode);
                customReport.Dispose();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Esempio n. 4
0
        // report_label_list_customers : Relatório - Clientes
        public static void ProcessReportCustomer(CustomReportDisplayMode pViewMode)
        {
            try
            {
                //Move This to CustomReport SubClasses ex Filename, Params, DataSources etc

                string       reportFile   = GetReportFilePath("ReportCustomerList.frx");
                CustomReport customReport = new CustomReport(reportFile, 1);
                //Report Parameters
                customReport.SetParameterValue("Report Title", Resx.report_list_customers);
                //customReport.SetParameterValue("Factura No", 280);

                //Prepare and Declare FRBOGenericCollections
                //"Oid,Designation,ButtonLabel"
                FRBOGenericCollection <FRBOCustomerType> gcCustomerType = new FRBOGenericCollection <FRBOCustomerType>();
                FRBOGenericCollection <FRBOCustomer>     gcCustomer;

                //Render Child Bussiness Objects
                foreach (FRBOCustomerType customerType in gcCustomerType)
                {
                    //Get SubFamily
                    gcCustomer            = new FRBOGenericCollection <FRBOCustomer>(string.Format("CustomerType = '{0}'", customerType.Oid), "Ord");
                    customerType.Customer = gcCustomer.List;
                }

                //Prepare and Enable DataSources
                customReport.RegisterData(gcCustomerType, "CustomerType");
                if (customReport.GetDataSource("CustomerType") != null)
                {
                    customReport.GetDataSource("CustomerType").Enabled = true;
                }
                if (customReport.GetDataSource("CustomerType.Customer") != null)
                {
                    customReport.GetDataSource("CustomerType.Customer").Enabled = true;
                }

                //customReport.ReportInfo.Name = FILL THIS WITH REPORT NAME;
                customReport.Process(pViewMode);
                customReport.Dispose();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Esempio n. 5
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //ProcessReportFinanceDocumentPayment

        public static string ProcessReportFinanceDocumentPayment(CustomReportDisplayMode pViewMode, Guid pDocumentFinancePaymentOid, List <int> pCopyNames, string pDestinationFileName = "")
        {
            string result = String.Empty;

            try
            {
                string       fileUserReportDocumentFinancePayment = FrameworkUtils.OSSlash(string.Format("{0}{1}\\{2}", GlobalFramework.Path["reports"], "UserReports", "ReportDocumentFinancePayment.frx"));
                CustomReport customReport = new CustomReport(fileUserReportDocumentFinancePayment, pCopyNames);

                //Get Result Objects from FRBOHelper
                ResultFRBODocumentFinancePayment fRBOHelperResponseProcessReportFinancePayment = FRBOHelper.GetFRBOFinancePayment(pDocumentFinancePaymentOid);
                //Get Generic Collections From FRBOHelper Results
                FRBOGenericCollection <FRBODocumentFinancePaymentView> gcDocumentFinancePayment = fRBOHelperResponseProcessReportFinancePayment.DocumentFinancePayment;

                //Prepare and Enable DataSources
                customReport.RegisterData(gcDocumentFinancePayment, "DocumentFinancePayment");
                if (customReport.GetDataSource("DocumentFinancePayment") != null)
                {
                    customReport.GetDataSource("DocumentFinancePayment").Enabled = true;
                }
                if (customReport.GetDataSource("DocumentFinancePayment.DocumentFinancePaymentDocument") != null)
                {
                    customReport.GetDataSource("DocumentFinancePayment.DocumentFinancePaymentDocument").Enabled = true;
                }

                //Add ReportInfo.Name, to be used for Ex in Pdf Filenames, OS etc
                customReport.ReportInfo.Name = gcDocumentFinancePayment.List[0].PaymentRefNo;
                result = customReport.Process(pViewMode, pDestinationFileName);
                customReport.Dispose();

                return(result);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
                throw new Exception(ex.Message);
            }
        }
Esempio n. 6
0
        public static void ProcessReportDocumentDetail(CustomReportDisplayMode pViewMode, string resourceString, string groupField, string groupCondition, string groupTitle, string filter, string filterHumanReadable, bool grouped)
        {
            try
            {
                //Move This to CustomReport SubClasses ex Filename, Params, DataSources etc

                string       reportFile   = GetReportFilePath("ReportDocumentFinanceDetailList.frx");
                CustomReport customReport = new CustomReport(reportFile, 1);

                // Add PostFix to Report Title
                Tuple <string, string> tuppleResourceString = GetResourceString(resourceString);
                string reportTitleString        = tuppleResourceString.Item1;
                string reportTitleStringPostfix = tuppleResourceString.Item2;

                //Report Parameters
                customReport.SetParameterValue("Report Title", String.Format("{0}{1}", reportTitleString, reportTitleStringPostfix));
                if (!string.IsNullOrEmpty(filterHumanReadable))
                {
                    customReport.SetParameterValue("Report Filter", filterHumanReadable);
                }

                // Get Objects
                GroupHeaderBand groupHeaderBand     = (GroupHeaderBand)customReport.FindObject("GroupHeader1");
                TextObject      groupHeaderBandText = (TextObject)customReport.FindObject("TextGroupHeader1");
                if (groupHeaderBand != null && groupHeaderBandText != null)
                {
                    groupHeaderBand.Condition = groupCondition;
                    groupHeaderBandText.Text  = groupTitle;
                }
                else
                {
                    _log.Error("Error cant find Report Objects");
                }

                //Prepare and Declare FRBOGenericCollections for non grouped and gouped reports
                if (!grouped)
                {
                    // Using view_documentfinance
                    FRBOGenericCollection <FRBODocumentFinanceMasterDetailView> gcDocumentFinanceMasterDetail = new FRBOGenericCollection <FRBODocumentFinanceMasterDetailView>(filter);
                    //Prepare and Enable DataSources
                    customReport.RegisterData(gcDocumentFinanceMasterDetail, "DocumentFinanceDetail");
                }
                else
                {
                    // Using view_documentfinancesellgroup
                    FRBOGenericCollection <FRBODocumentFinanceMasterDetailGroupView> gcDocumentFinanceMasterDetail = new FRBOGenericCollection <FRBODocumentFinanceMasterDetailGroupView>(filter, groupField, string.Empty);
                    //Prepare and Enable DataSources
                    customReport.RegisterData(gcDocumentFinanceMasterDetail, "DocumentFinanceDetail");

                    DataBand   dataBandData3               = (DataBand)customReport.FindObject("Data3");
                    TextObject textColumnDateHeader        = (TextObject)customReport.FindObject("TextColumnDateHeader");
                    TextObject textColumnDateData          = (TextObject)customReport.FindObject("TextColumnDateData");
                    TextObject textColumnCodeHeader        = (TextObject)customReport.FindObject("TextColumnCodeHeader");
                    TextObject textColumnCodeData          = (TextObject)customReport.FindObject("TextColumnCodeData");
                    TextObject textColumnDesignationHeader = (TextObject)customReport.FindObject("TextColumnDesignationHeader");
                    TextObject textColumnDesignationData   = (TextObject)customReport.FindObject("textColumnDesignationData");
                    // Change Objects
                    if (dataBandData3 != null && groupHeaderBandText != null && textColumnDateData != null && textColumnCodeHeader != null && textColumnCodeData != null && textColumnDesignationHeader != null && textColumnDesignationData != null)
                    {
                        // Remove [DocumentFinanceDetail.Date] and use sencon Sort has Priority
                        dataBandData3.Sort[0].Expression = dataBandData3.Sort[1].Expression;
                        dataBandData3.Sort[1].Expression = string.Empty;
                        // Date : Disable non exitence fields [DocumentFinanceDetail.Date] in sort and firts colum data
                        textColumnDateHeader.Delete();
                        textColumnDateData.Delete();
                        // Code
                        textColumnCodeHeader.Left         = 0;
                        textColumnCodeData.Left           = 0;
                        textColumnDesignationHeader.Left  = 56.7F;
                        textColumnDesignationData.Left    = 56.7F;
                        textColumnDesignationHeader.Width = 292.95F;
                        textColumnDesignationData.Width   = 292.95F;
                    }
                    else
                    {
                        _log.Error("Error cant find Report Objects");
                    }
                }

                if (customReport.GetDataSource("DocumentFinanceDetail") != null)
                {
                    customReport.GetDataSource("DocumentFinanceDetail").Enabled = true;
                }

                //customReport.ReportInfo.Name = FILL THIS WITH REPORT NAME;
                customReport.Process(pViewMode);
                customReport.Dispose();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Esempio n. 7
0
        public static string ProcessReportFinanceDocument(CustomReportDisplayMode pViewMode, Guid pDocumentFinanceMasterOid, string pHash4Chars, List <int> pCopyNames, bool pSecondCopy, string pMotive, string pDestinationFileName = "")
        {
            string result = String.Empty;

            try
            {
                //TODO: Move This to CustomReport SubClasses ex Filename, Params, DataSources etc

                //Get DocumentFinanceMaster
                FIN_DocumentFinanceMaster documentMaster = (FIN_DocumentFinanceMaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_DocumentFinanceMaster), pDocumentFinanceMasterOid);

                // Build Final Filename Report
                string fileName = (documentMaster.DocumentType.WayBill) ? "ReportDocumentFinanceWayBill.frx" : "ReportDocumentFinance.frx";
                string fileUserReportDocumentFinance = FrameworkUtils.OSSlash(string.Format("{0}{1}\\{2}", GlobalFramework.Path["reports"], "UserReports", fileName));

                CustomReport customReport = new CustomReport(fileUserReportDocumentFinance, pCopyNames);
                customReport.DoublePass = (documentMaster.DocumentDetail.Count > SettingsApp.CustomReportReportDocumentFinanceMaxDetail);
                customReport.Hash4Chars = pHash4Chars;
                //Report Parameters
                //customReport.SetParameterValue("Invoice Noº", 280);

                //Get Result Objects from FRBOHelper
                ResultFRBODocumentFinanceMaster fRBOHelperResponseProcessReportFinanceDocument = FRBOHelper.GetFRBOFinanceDocument(pDocumentFinanceMasterOid);
                //Get Generic Collections From FRBOHelper Results
                FRBOGenericCollection <FRBODocumentFinanceMasterView> gcDocumentFinanceMaster = fRBOHelperResponseProcessReportFinanceDocument.DocumentFinanceMaster;

                //Prepare and Enable DataSources
                customReport.RegisterData(gcDocumentFinanceMaster, "DocumentFinanceMaster");
                if (customReport.GetDataSource("DocumentFinanceMaster") != null)
                {
                    customReport.GetDataSource("DocumentFinanceMaster").Enabled = true;
                }
                if (customReport.GetDataSource("DocumentFinanceMaster.DocumentFinanceDetail") != null)
                {
                    customReport.GetDataSource("DocumentFinanceMaster.DocumentFinanceDetail").Enabled = true;
                }
                if (customReport.GetDataSource("DocumentFinanceMaster.DocumentFinanceMasterTotal") != null)
                {
                    customReport.GetDataSource("DocumentFinanceMaster.DocumentFinanceMasterTotal").Enabled = true;
                }

                //Scripts - Dont Delete this Comment, may be usefull if we remove Script from Report File
                //Print X Records per Data Band
                //FastReport.DataBand dataBand = (DataBand) customReport.FindObject("Data1");
                //int dataBandRec = 1;
                ////Used to Break Page on X Recs, Usefull to leave open space for Report Summary
                //int dataBandMaxRecs = 30;
                //dataBand.AfterPrint += delegate {
                //  Console.WriteLine(string.Format("dataBandRec.RowNo:[{0}], dataBandMaxRecs:[{1}], , dataBand.RowNo[{2}], report.Pages.Count[{3}]", dataBandRec, dataBandMaxRecs, dataBand.RowNo, report.Pages.Count));
                //  if (dataBandRec == dataBandMaxRecs) {
                //    dataBandRec = 1;
                //    dataBand.StartNewPage = true;
                //  }
                //  else
                //  {
                //    dataBandRec++;
                //    dataBand.StartNewPage = false;
                //  };
                //};

                //Assign Second Copy Reference
                _secondCopy = pSecondCopy;

                //Add ReportInfo.Name, to be used for Ex in Pdf Filenames, OS etc
                customReport.ReportInfo.Name = gcDocumentFinanceMaster.List[0].DocumentNumber;
                result = customReport.Process(pViewMode, pDestinationFileName);
                customReport.Dispose();

                return(result);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
                throw new Exception(ex.Message);
            }
        }