public static ReportCell[] GetDetailRow(DeviceCostDetail deviceCostDetail, String detailType)
        {
            ReportCell[] cells;

            switch (detailType)
            {
            case "PrintingCosts":
                cells = new ReportCell[]
                {
                    new ReportCell(deviceCostDetail.jobTime.ToString()),
                    new ReportCell(deviceCostDetail.documentName),
                    new ReportCell(deviceCostDetail.userName),
                    new ReportCell(deviceCostDetail.pageAmount),
                    new ReportCell(deviceCostDetail.cost)
                };
                break;

            case "CopyingCosts":
                cells = new ReportCell[]
                {
                    new ReportCell(deviceCostDetail.jobTime.ToString()),
                    new ReportCell(deviceCostDetail.userName),
                    new ReportCell(deviceCostDetail.pageAmount),
                    new ReportCell(deviceCostDetail.cost)
                };
                break;

            default:
                cells = new ReportCell[] { };
                break;
            }

            return(cells);
        }
        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();
        }