예제 #1
0
        public override void BuildReport()
        {
            TenantDAO tenantDAO = new TenantDAO(sqlConnection);
            Tenant    tenant    = tenantDAO.GetTenant(tenantId);

            DuplexPrintingCostDAO duplexPrintingCostDAO = new DuplexPrintingCostDAO(sqlConnection);
            List <Object>         duplexPrintingCosts   = duplexPrintingCostDAO.GetDuplexPrintingCosts(tenantId, startDate, endDate);

            reportBuilder.OpenMedia(reportMedia); // Abre a mídia para o output do relatório

            Dictionary <String, Object> reportFilter = new Dictionary <String, Object>();

            reportFilter.Add("tenantId", tenantId);
            reportFilter.Add("startDate", startDate);
            reportFilter.Add("endDate", endDate);
            reportBuilder.SetReportHeadings("Relatório de custos de impressão Simplex/Duplex", tenant.alias, reportFilter);

            String[] columnNames  = new String[] { "Usuário", "Páginas Simplex", "Páginas Duplex", "Total Páginas", "Custo Simplex", "Custo Duplex", "Total Custo" };
            int[]    columnWidths = new int[] { 50, 15, 15, 15, 15, 15, 15 };
            int      rowCount     = duplexPrintingCosts.Count;

            reportBuilder.CreateDataTable(columnNames, columnWidths, rowCount);
            if (reportBuilder.IsNavigable())
            {
                Dictionary <String, Object> exportOptions = ExportFormatContext.GetExportOptions(tenantId, sqlConnection);
                reportBuilder.SetNavigationData(this.GetType().Name, rowCount, exportOptions); // neste caso recordCount = rowCount
                reportBuilder.SetReportPage(action, currentPage);
            }
            for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
            {
                DuplexPrintingCost duplexPrintingCost = (DuplexPrintingCost)duplexPrintingCosts[rowIndex];
                ReportCell[]       cells = new ReportCell[]
                {
                    new ReportCell(duplexPrintingCost.userName),
                    new ReportCell(duplexPrintingCost.simplexPageCount),
                    new ReportCell(duplexPrintingCost.duplexPageCount),
                    new ReportCell(duplexPrintingCost.totalPageCount),
                    new ReportCell(duplexPrintingCost.simplexCost),
                    new ReportCell(duplexPrintingCost.duplexCost),
                    new ReportCell(duplexPrintingCost.totalCost)
                };
                reportBuilder.InsertRow(rowIndex, cells);
            }
            ReportCell[] footerCells = new ReportCell[]
            {
                new ReportCell("TOTAL", Color.Red),
                new ReportCell("paginasSimplex", ReportCellType.Number),
                new ReportCell("paginasDuplex", ReportCellType.Number),
                new ReportCell("totalPaginas", ReportCellType.Number),
                new ReportCell("custoSimplex", ReportCellType.Money),
                new ReportCell("custoDuplex", ReportCellType.Money),
                new ReportCell("totalCusto", ReportCellType.Money)
            };
            reportBuilder.InsertFooter(footerCells);

            reportBuilder.CloseMedia();
        }
        public override void BuildReport()
        {
            TenantDAO tenantDAO = new TenantDAO(sqlConnection);
            Tenant    tenant    = tenantDAO.GetTenant(tenantId);

            DeviceCopyingCostDAO deviceCopyingCostDAO = new DeviceCopyingCostDAO(sqlConnection);
            List <Object>        deviceCopyingCosts   = deviceCopyingCostDAO.GetDeviceCopyingCosts(tenantId, startDate, endDate);

            reportBuilder.OpenMedia(reportMedia); // Abre a mídia para o output do relatório

            Dictionary <String, Object> reportFilter = new Dictionary <String, Object>();

            reportFilter.Add("tenantId", tenantId);
            reportFilter.Add("startDate", startDate);
            reportFilter.Add("endDate", endDate);
            reportBuilder.SetReportHeadings("Custos de Cópia por Equipamento", tenant.alias, reportFilter);

            String[] columnNames  = new String[] { "Copiadora", "Páginas", "Percentual de páginas", "Custo", "Percentual de custo" };
            int[]    columnWidths = new int[] { 25, 15, 30, 15, 30 };
            int      rowCount     = deviceCopyingCosts.Count;

            reportBuilder.CreateDataTable(columnNames, columnWidths, rowCount);
            if (reportBuilder.IsNavigable())
            {
                Dictionary <String, Object> exportOptions = ExportFormatContext.GetExportOptions(tenantId, sqlConnection);
                reportBuilder.SetNavigationData(this.GetType().Name, rowCount, exportOptions); // neste caso recordCount = rowCount
                reportBuilder.SetReportPage(action, currentPage);
            }
            for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
            {
                DeviceCopyingCost deviceCopyingCost = (DeviceCopyingCost)deviceCopyingCosts[rowIndex];
                ReportCell[]      cells             = new ReportCell[]
                {
                    GetDeviceCell(deviceCopyingCost, reportBuilder.IsNavigable()),
                    new ReportCell(deviceCopyingCost.pageAmount),
                    new ReportCell(deviceCopyingCost.pagePercentage),
                    new ReportCell(deviceCopyingCost.cost),
                    new ReportCell(deviceCopyingCost.costPercentage)
                };
                reportBuilder.InsertRow(rowIndex, cells);
            }
            ReportCell[] footerCells = new ReportCell[]
            {
                new ReportCell("TOTAL", Color.Red),
                new ReportCell("totalPaginas", ReportCellType.Number),
                new ReportCell("totalPercPag", ReportCellType.Percentage),
                new ReportCell("totalCusto", ReportCellType.Money),
                new ReportCell("totalPercCusto", ReportCellType.Percentage)
            };
            reportBuilder.InsertFooter(footerCells);

            reportBuilder.CloseMedia();
        }
        public override void BuildReport()
        {
            TenantDAO tenantDAO = new TenantDAO(sqlConnection);
            Tenant    tenant    = tenantDAO.GetTenant(tenantId);

            CostTreePersistence persistence = new CostTreePersistence(sqlConnection);
            CostTree            tree        = persistence.GetCostTree(tenantId);

            UserPrintingCostDAO userPrintingCostDAO = new UserPrintingCostDAO(sqlConnection);
            List <Object>       userPrintingCosts   = userPrintingCostDAO.GetUserPrintingCosts(tenantId, startDate, endDate);

            PrintingCostsAssembler costAssembler      = new PrintingCostsAssembler(userPrintingCosts);
            List <Object>          groupPrintingCosts = costAssembler.GetCostsOfBranches(tree);

            reportBuilder.OpenMedia(reportMedia); // Abre a mídia para o output do relatório

            Dictionary <String, Object> reportFilter = new Dictionary <String, Object>();

            reportFilter.Add("tenantId", tenantId);
            reportFilter.Add("startDate", startDate);
            reportFilter.Add("endDate", endDate);
            reportBuilder.SetReportHeadings("Custos de impressão por Grupo (CC)", tenant.alias, reportFilter);

            String[] columnNames  = new String[] { "Centro de custo", "Páginas Pb", "Páginas Cor", "Total Páginas", "Custo Pb", "Custo Cor", "Total Custo" };
            int[]    columnWidths = new int[] { 50, 15, 15, 15, 15, 15, 15 };
            int      rowCount     = groupPrintingCosts.Count;

            reportBuilder.CreateDataTable(columnNames, columnWidths, rowCount);
            if (reportBuilder.IsNavigable())
            {
                Dictionary <String, Object> exportOptions = ExportFormatContext.GetExportOptions(tenantId, sqlConnection);
                reportBuilder.SetNavigationData(this.GetType().Name, rowCount, exportOptions); // neste caso recordCount = rowCount
                reportBuilder.SetReportPage(action, currentPage);
            }
            for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
            {
                GroupPrintingCost groupPrintingCost = (GroupPrintingCost)groupPrintingCosts[rowIndex];
                ReportCell[]      cells             = new ReportCell[]
                {
                    GetGroupCell(groupPrintingCost, reportBuilder.IsNavigable()),
                    new ReportCell(groupPrintingCost.bwPageCount),
                    new ReportCell(groupPrintingCost.colorPageCount),
                    new ReportCell(groupPrintingCost.totalPageCount),
                    new ReportCell(groupPrintingCost.bwCost),
                    new ReportCell(groupPrintingCost.colorCost),
                    new ReportCell(groupPrintingCost.totalCost)
                };
                reportBuilder.InsertRow(rowIndex, cells);
            }

            reportBuilder.CloseMedia();
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Organiza os argumentos recebidos na querystring
            ArgumentBuilder argumentBuilder = new ArgumentBuilder();

            foreach (String argumentName in Request.QueryString)
            {
                argumentBuilder.Add(argumentName, Request.QueryString[argumentName]);
            }

            // Cria uma instância da classe de relatório ( através de Reflection )
            Type           reportClass = null;
            AbstractReport report      = null;

            if (!String.IsNullOrEmpty(Request["report"]))
            {
                // Usa a classe base dos relatórios para obter o nome completo da classe incluindo dll/assembly
                String qualifiedName = typeof(AbstractReport).AssemblyQualifiedName;
                qualifiedName = qualifiedName.Replace("AbstractReport", Request["report"]);

                reportClass = Type.GetType(qualifiedName);
                report      = (AbstractReport)Activator.CreateInstance(reportClass, argumentBuilder.GetArguments(reportClass));
            }

            // Aborta a operação caso o relatório solicitado não exista
            if ((reportClass == null) || (report == null))
            {
                return;
            }

            Dictionary <String, Object> exportOptions = ExportFormatContext.GetExportOptions(Session);

            this.Response.Clear();
            this.Response.ContentType = (String)exportOptions["ContentType"];
            this.Response.AddHeader("content-disposition", (String)exportOptions["Disposition"]);

            // Abre a conexão com o banco
            DataAccess dataAccess = DataAccess.Instance;

            dataAccess.MountConnection(FileResource.MapWebResource(this.Page.Server, "DataAccess.xml"), DatabaseEnum.PrintAccounting);
            dataAccess.OpenConnection();

            // Executa inicializações e chama o método "BuildReport" na instância da classe de relatório
            report.InitializeComponents(this.Page, (IReportBuilder)exportOptions["ReportBuilder"], dataAccess.GetConnection());
            report.BuildReport();

            // Fecha a conexão com o banco
            dataAccess.CloseConnection();
            dataAccess = null;

            this.Response.End();
        }
예제 #5
0
        // Obtem o mecanismo de renderização de relatórios ( necessário para gerar o arquivo de
        // relatório que será enviado por e-mail )
        private IReportBuilder GetReportBuilder(int exportFormat)
        {
            IReportBuilder reportBuilder = null;

            ExportFormatEnum            currentFormat = (ExportFormatEnum)exportFormat;
            Dictionary <String, Object> exportOptions = ExportFormatContext.GetExportOptions(currentFormat);

            if (exportOptions.ContainsKey("ReportBuilder"))
            {
                reportBuilder = (IReportBuilder)exportOptions["ReportBuilder"];
            }

            return(reportBuilder);
        }
        public override void BuildReport()
        {
            TenantDAO tenantDAO = new TenantDAO(sqlConnection);
            Tenant    tenant    = tenantDAO.GetTenant(tenantId);

            // Obtem a lista de documentos considerando o filtro (faixa de datas, usuário, impressora)
            PrintedDocumentDAO printedDocumentDAO = new PrintedDocumentDAO(sqlConnection);
            List <Object>      printedDocuments   = printedDocumentDAO.GetPrintedDocuments(tenantId, startDate, endDate, userId, printerId);

            reportBuilder.OpenMedia(reportMedia); // Abre a mídia para o output do relatório

            Dictionary <String, Object> reportFilter = new Dictionary <String, Object>();

            reportFilter.Add("tenantId", tenantId);
            reportFilter.Add("startDate", startDate);
            reportFilter.Add("endDate", endDate);
            reportFilter.Add("userId", userId);
            reportFilter.Add("printerId", printerId);
            reportBuilder.SetReportHeadings("Relatório de Impressões", tenant.alias, reportFilter);

            String[] columnNames  = new String[] { "Data/Hora", "Usuário", "Impressora", "Páginas", "Nome do documento" };
            int[]    columnWidths = new int[] { 25, 25, 25, 15, 45 };
            int      rowCount     = printedDocuments.Count;

            reportBuilder.CreateDataTable(columnNames, columnWidths, rowCount);
            if (reportBuilder.IsNavigable())
            {
                Dictionary <String, Object> exportOptions = ExportFormatContext.GetExportOptions(tenantId, sqlConnection);
                reportBuilder.SetNavigationData(this.GetType().Name, rowCount, exportOptions); // neste caso recordCount = rowCount
                reportBuilder.SetReportPage(action, currentPage);
            }
            for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
            {
                PrintedDocument printedDocument = (PrintedDocument)printedDocuments[rowIndex];
                ReportCell[]    cells           = new ReportCell[]
                {
                    new ReportCell(printedDocument.jobTime.ToString()),
                    new ReportCell(printedDocument.userName),
                    new ReportCell(printedDocument.printerName),
                    new ReportCell(printedDocument.pageCount * printedDocument.copyCount),
                    new ReportCell(printedDocument.name)
                };
                reportBuilder.InsertRow(rowIndex, cells);
            }

            reportBuilder.CloseMedia();
        }
        public override void BuildReport()
        {
            Dictionary <String, Object> reportData = GetReportData(detailType);

            TenantDAO tenantDAO = new TenantDAO(sqlConnection);
            Tenant    tenant    = tenantDAO.GetTenant(tenantId);

            PrinterDAO printerDAO = new PrinterDAO(sqlConnection);
            Printer    printer    = printerDAO.GetPrinter(tenantId, printerId);

            DeviceCostDetailDAO deviceCostDetailDAO = new DeviceCostDetailDAO(sqlConnection);
            List <Object>       deviceCostDetails   = deviceCostDetailDAO.GetDeviceCostDetails(tenantId, printerId, startDate, endDate, detailType);

            reportBuilder.OpenMedia(reportMedia); // Abre a mídia para o output do relatório

            Dictionary <String, Object> reportFilter = new Dictionary <String, Object>();

            reportFilter.Add("tenantId", tenantId);
            reportFilter.Add("printerId", printerId);
            reportFilter.Add("startDate", startDate);
            reportFilter.Add("endDate", endDate);
            reportFilter.Add("detailType", detailType);
            reportBuilder.SetReportHeadings(reportData["title"] + ". " + "Impressora: " + printer.name, tenant.alias, reportFilter);

            String[] columnNames  = (String[])reportData["columnNames"];
            int[]    columnWidths = (int[])reportData["columnWidths"];
            int      rowCount     = deviceCostDetails.Count;

            reportBuilder.CreateDataTable(columnNames, columnWidths, rowCount);
            if (reportBuilder.IsNavigable())
            {
                Dictionary <String, Object> exportOptions = ExportFormatContext.GetExportOptions(tenantId, sqlConnection);
                reportBuilder.SetNavigationData(this.GetType().Name, rowCount, exportOptions); // neste caso recordCount = rowCount
                reportBuilder.SetReportPage(action, currentPage);
            }
            for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
            {
                DeviceCostDetail deviceCostDetail = (DeviceCostDetail)deviceCostDetails[rowIndex];
                reportBuilder.InsertRow(rowIndex, GetDetailRow(deviceCostDetail, detailType));
            }
            reportBuilder.InsertFooter(GetFooterCells(detailType));

            reportBuilder.CloseMedia();
        }
        public override void BuildReport()
        {
            TenantDAO tenantDAO = new TenantDAO(sqlConnection);
            Tenant    tenant    = tenantDAO.GetTenant(tenantId);

            List <Object> quotaExceededUsers = GetQuotaExceededUsers();

            reportBuilder.OpenMedia(reportMedia); // Abre a mídia para o output do relatório

            Dictionary <String, Object> reportFilter = new Dictionary <String, Object>();

            reportFilter.Add("tenantId", tenantId);
            reportFilter.Add("startDate", startDate);
            reportFilter.Add("endDate", endDate);
            reportBuilder.SetReportHeadings("Relatório de Cotas Excedidas", tenant.alias, reportFilter);

            String[] columnNames  = new String[] { "Usuário", "Cota Definida", "Valor Impressões", "Valor Excedido" };
            int[]    columnWidths = new int[] { 50, 30, 30, 30 };
            int      rowCount     = quotaExceededUsers.Count;

            reportBuilder.CreateDataTable(columnNames, columnWidths, rowCount);
            if (reportBuilder.IsNavigable())
            {
                Dictionary <String, Object> exportOptions = ExportFormatContext.GetExportOptions(tenantId, sqlConnection);
                reportBuilder.SetNavigationData(this.GetType().Name, rowCount, exportOptions); // neste caso recordCount = rowCount
                reportBuilder.SetReportPage(action, currentPage);
            }
            for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
            {
                String[]     rowValues = (String[])quotaExceededUsers[rowIndex];
                ReportCell[] cells     = new ReportCell[]
                {
                    new ReportCell(rowValues[0]),
                    new ReportCell(rowValues[1]),
                    new ReportCell(rowValues[2]),
                    new ReportCell(rowValues[3])
                };
                reportBuilder.InsertRow(rowIndex, cells);
            }

            reportBuilder.CloseMedia();
        }
예제 #9
0
        public override void BuildReport()
        {
            TenantDAO tenantDAO = new TenantDAO(sqlConnection);
            Tenant    tenant    = tenantDAO.GetTenant(tenantId);

            CostCenterDAO costCenterDAO = new CostCenterDAO(sqlConnection);
            CostCenter    costCenter    = costCenterDAO.GetCostCenter(tenantId, costCenterId);

            CostTreePersistence persistence = new CostTreePersistence(sqlConnection);
            CostTree            tree        = persistence.GetCostTree(tenantId);

            CostBranch    branch        = tree.GetBranchById(costCenterId);
            List <Object> detailedCosts = GetDetailedCosts(branch);

            reportBuilder.OpenMedia(reportMedia); // Abre a mídia para o output do relatório

            Dictionary <String, Object> reportFilter = new Dictionary <String, Object>();

            reportFilter.Add("tenantId", tenantId);
            reportFilter.Add("costCenterId", costCenterId);
            reportFilter.Add("startDate", startDate);
            reportFilter.Add("endDate", endDate);
            reportBuilder.SetReportHeadings("Relatório de Custos de Impressão" + ". " + "Centro de Custo:  " + costCenter.name, tenant.alias, reportFilter);

            String[] columnNames  = new String[] { "Usuário", "Páginas Pb", "Páginas Cor", "Total Páginas", "Custo Pb", "Custo Cor", "Total Custo" };
            int[]    columnWidths = new int[] { 50, 15, 15, 15, 15, 15, 15 };
            int      rowCount     = detailedCosts.Count;

            reportBuilder.CreateDataTable(columnNames, columnWidths, rowCount);
            if (reportBuilder.IsNavigable())
            {
                Dictionary <String, Object> exportOptions = ExportFormatContext.GetExportOptions(tenantId, sqlConnection);
                reportBuilder.SetNavigationData(this.GetType().Name, rowCount, exportOptions); // neste caso recordCount = rowCount
                reportBuilder.SetReportPage(action, currentPage);
            }
            for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
            {
                UserPrintingCost userPrintingCost = (UserPrintingCost)detailedCosts[rowIndex];
                ReportCell[]     cells            = new ReportCell[]
                {
                    new ReportCell(userPrintingCost.userName),
                    new ReportCell(userPrintingCost.bwPageCount),
                    new ReportCell(userPrintingCost.colorPageCount),
                    new ReportCell(userPrintingCost.totalPageCount),
                    new ReportCell(userPrintingCost.bwCost),
                    new ReportCell(userPrintingCost.colorCost),
                    new ReportCell(userPrintingCost.totalCost)
                };
                reportBuilder.InsertRow(rowIndex, cells);
            }
            ReportCell[] footerCells = new ReportCell[]
            {
                new ReportCell("TOTAL", Color.Red),
                new ReportCell("paginasPb", ReportCellType.Number),
                new ReportCell("paginasCor", ReportCellType.Number),
                new ReportCell("totalPaginas", ReportCellType.Number),
                new ReportCell("custoPb", ReportCellType.Money),
                new ReportCell("custoCor", ReportCellType.Money),
                new ReportCell("totalCusto", ReportCellType.Money)
            };
            reportBuilder.InsertFooter(footerCells);

            reportBuilder.CloseMedia();
        }