public static XRTable GetHeaderTable(List <string> fields, float tableSize)
        {
            var table = new XRTable();

            table.BeginInit();

            table.LocationF = new DevExpress.Utils.PointFloat(0F, 0F);
            table.Borders   = DevExpress.XtraPrinting.BorderSide.All;

            var   tableRow = new XRTableRow();
            float cellSize = tableSize / fields.Count;

            foreach (var field in fields)
            {
                var cell = new XRTableCell()
                {
                    Text      = field,
                    WidthF    = cellSize,
                    BackColor = System.Drawing.Color.Gray
                };
                tableRow.Cells.Add(cell);
            }

            table.Rows.Add(tableRow);

            table.AdjustSize();

            table.EndInit();

            return(table);
        }
示例#2
0
        public XRTable CreateXRTable()
        {
            int   cellsInRow = 3;
            int   rowsCount  = 3;
            float rowHeight  = 25f;

            XRTable table = new XRTable();

            table.Borders = DevExpress.XtraPrinting.BorderSide.All;
            table.BeginInit();

            for (int i = 0; i < rowsCount; i++)
            {
                XRTableRow row = new XRTableRow();
                row.HeightF = rowHeight;
                for (int j = 0; j < cellsInRow; j++)
                {
                    XRTableCell cell = new XRTableCell();
                    row.Cells.Add(cell);
                }
                table.Rows.Add(row);
            }

            table.BeforePrint += new PrintEventHandler(table_BeforePrint);
            table.AdjustSize();
            table.EndInit();
            return(table);
        }
        public XRTable EncabezadoMesesXRTable()
        {
            int   lnColumasDinamicas = (1 + Math.Abs((Convert.ToDateTime(FechaInicial.Value).Month - Convert.ToDateTime(FechaFinal.Value).Month) + 12 * (Convert.ToDateTime(FechaInicial.Value).Year - Convert.ToDateTime(FechaFinal.Value).Year)));
            int   lnFilasDinamicas   = 2;
            float lfAlturaFila       = 22;

            XRTable loTabladetalle = new XRTable();

            loTabladetalle.Borders = DevExpress.XtraPrinting.BorderSide.None;
            loTabladetalle.BeginInit();

            for (int lnFila = 1; lnFila < lnFilasDinamicas; lnFila++)
            {
                XRTableRow row = new XRTableRow();
                row.HeightF = lfAlturaFila;
                for (int lnColumna = 1; lnColumna < lnColumasDinamicas + 1; lnColumna++)
                {
                    XRTableCell cell = new XRTableCell();
                    cell.Width = 120;
                    cell.Text  = Convert.ToDateTime(FechaInicial.Value).AddMonths(lnColumna - 1).ToString("MMMM", CultureInfo.CreateSpecificCulture("es-MX")).ToUpper().Substring(0, 3) + ". " + Convert.ToDateTime(FechaInicial.Value).Year;
                    cell.Name  = "xrAgrupadoMeses" + lnColumna;
                    cell.StylePriority.UseTextAlignment = false;
                    cell.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
                    row.Cells.Add(cell);
                }
                loTabladetalle.Rows.Add(row);
            }
            loTabladetalle.BeforePrint += new PrintEventHandler(EncabezadoMesesXRTable_BeforePrint);
            loTabladetalle.AdjustSize();
            loTabladetalle.EndInit();
            return(loTabladetalle);
        }
        public static XRTable GetTableBoundToData(List <string> fields, float tableSize)
        {
            var table = new XRTable();

            table.BeginInit();

            table.LocationF = new DevExpress.Utils.PointFloat(0F, 0F);
            table.Borders   = DevExpress.XtraPrinting.BorderSide.Left
                              | DevExpress.XtraPrinting.BorderSide.Right
                              | DevExpress.XtraPrinting.BorderSide.Bottom;

            var   tableRow = new XRTableRow();
            float cellSize = tableSize / fields.Count;

            foreach (var field in fields)
            {
                var cell = new XRTableCell()
                {
                    Text   = field,
                    WidthF = cellSize
                };
                cell.ExpressionBindings.Add(new ExpressionBinding("Text", $"[{field}]"));
                tableRow.Cells.Add(cell);
            }

            table.Rows.Add(tableRow);

            table.AdjustSize();
            table.EndInit();

            return(table);
        }
示例#5
0
        private void printHeader(Dictionary <string, string> parameters)
        {
            if (parameters.Count == 0)
            {
                return;
            }


            XRTable table = new XRTable();

            table.BeginInit();


            table.LocationF = new PointF(0, 0);
            int        count = 0;
            XRTableRow row   = new XRTableRow();

            foreach (KeyValuePair <string, string> item in parameters)
            {
                XRTableCell cell = new XRTableCell();

                cell.Text = item.Key;

                cell.BackColor = Color.Gray;
                cell.ForeColor = Color.White;

                XRTableCell valueCell = new XRTableCell();

                valueCell.Text = item.Value;

                row.Cells.Add(cell);
                row.Cells.Add(valueCell);

                count++;
                if (count % 4 == 0)
                {
                    table.Rows.Add(row);
                    row = new XRTableRow();
                }
            }
            if (count % 4 != 0)
            {
                for (int i = 0; i < (4 - (count % 4)) * 2; i++)
                {
                    XRTableCell cell = new XRTableCell();



                    row.Cells.Add(cell);
                }
                table.Rows.Add(row);
            }
            table.BeforePrint += new PrintEventHandler(table_BeforePrint);
            table.AdjustSize();
            table.EndInit();



            this.PageHeader.Controls.Add(table);
        }
示例#6
0
        XRTable CreateTable(XRTableRow sourceRow, float height)
        {
            XRTable    table          = new XRTable();
            XRTableRow headerTableRow = new XRTableRow();

            table.BeginInit();
            table.Rows.Add(headerTableRow);
            foreach (XRTableCell cell in sourceRow.Cells)
            {
                CopyCell(cell, headerTableRow);
            }
            table.Borders   = DevExpress.XtraPrinting.BorderSide.All;
            table.LocationF = new PointF(0, height);
            table.AdjustSize();
            table.EndInit();
            return(table);
        }
示例#7
0
        private void CreateMasterReportControls(XtraReport report)
        {
            XRTable tbl = new XRTable();

            tbl.BeginInit();
            XRTableRow row = new XRTableRow();

            row.HeightF = 40;
            SqlDataSource ds              = report.DataSource as SqlDataSource;
            string        dataMember      = report.DataMember;
            ITable        categoriesTable = ds.Result[dataMember] as ITable;

            foreach (IColumn col in categoriesTable.Columns)
            {
                if (col.Type == typeof(byte[]))
                {
                    continue;
                }
                XRTableCell cell = new XRTableCell();
                cell.DataBindings.Add(new XRBinding("Text", null, string.Format("{0}.{1}", dataMember, col.Name)));
                if (col.Name == "CategoryName")
                {
                    cell.Font = new System.Drawing.Font(cell.Font.FontFamily, 14f, System.Drawing.FontStyle.Underline | System.Drawing.FontStyle.Bold);
                    cell.DataBindings.Add(new XRBinding("Tag", null, string.Format("{0}.{1}", dataMember, "CategoryID")));
                    cell.ForeColor   = System.Drawing.Color.Blue;
                    cell.NavigateUrl = " ";
                }
                row.Cells.Add(cell);
            }
            tbl.Rows.Add(row);
            tbl.BeforePrint += tbl_BeforePrint;
            tbl.AdjustSize();
            tbl.EndInit();
            DetailBand detailBand = null;

            if (report.Bands[BandKind.Detail] == null)
            {
                report.Bands.Add(new DetailBand());
            }
            detailBand           = report.Bands[BandKind.Detail] as DetailBand;
            detailBand.HeightF   = tbl.HeightF + 2;
            detailBand.PageBreak = PageBreak.AfterBand;
            detailBand.Controls.Add(tbl);
        }
        public XRTable DetalleVentaXRTable()
        {
            int   lnColumasDinamicas        = (1 + Math.Abs((Convert.ToDateTime(FechaInicial.Value).Month - Convert.ToDateTime(FechaFinal.Value).Month) + 12 * (Convert.ToDateTime(FechaInicial.Value).Year - Convert.ToDateTime(FechaFinal.Value).Year))) * 2;
            int   lnFilasDinamicas          = 2;
            int   lnIndicadorColumnaDetalle = 1;
            float lfAlturaFila = 22;

            XRTable loTabladetalle = new XRTable();

            loTabladetalle.Borders = DevExpress.XtraPrinting.BorderSide.None;
            loTabladetalle.BeginInit();

            for (int lnFila = 1; lnFila < lnFilasDinamicas; lnFila++)
            {
                XRTableRow row = new XRTableRow();
                row.HeightF = lfAlturaFila;
                for (int lnColumna = 1; lnColumna < lnColumasDinamicas + 1; lnColumna++)
                {
                    loBinding = "Query.AGRUPADOR" + lnIndicadorColumnaDetalle + "_ART_CANTIDAD";
                    if (lnColumna % 2 == 0)
                    {
                        loBinding = "Query.AGRUPADOR" + lnIndicadorColumnaDetalle + "_IMPORTE";
                        lnIndicadorColumnaDetalle = lnIndicadorColumnaDetalle + 1;
                    }
                    XRTableCell cell = new XRTableCell();
                    cell.Width = 60;
                    cell.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
                        new DevExpress.XtraReports.UI.XRBinding("Text", null, loBinding, "{0:n2}")
                    });
                    cell.Name = "xrAgrupado" + lnColumna;
                    cell.StylePriority.UseTextAlignment = false;
                    cell.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight;
                    row.Cells.Add(cell);
                }
                loTabladetalle.Rows.Add(row);
            }
            loTabladetalle.BeforePrint += new PrintEventHandler(DetalleVentaXRTable_BeforePrint);
            loTabladetalle.AdjustSize();
            loTabladetalle.EndInit();
            return(loTabladetalle);
        }
        public XRTable EncabezadoPzasImporteXRTable()
        {
            int   lnColumasDinamicas        = (1 + Math.Abs((Convert.ToDateTime(FechaInicial.Value).Month - Convert.ToDateTime(FechaFinal.Value).Month) + 12 * (Convert.ToDateTime(FechaInicial.Value).Year - Convert.ToDateTime(FechaFinal.Value).Year))) * 2;
            int   lnFilasDinamicas          = 2;
            int   lnIndicadorColumnaDetalle = 1;
            float lfAlturaFila = 22;

            XRTable loTabladetalle = new XRTable();

            loTabladetalle.Borders = DevExpress.XtraPrinting.BorderSide.None;
            loTabladetalle.BeginInit();

            for (int lnFila = 1; lnFila < lnFilasDinamicas; lnFila++)
            {
                XRTableRow row = new XRTableRow();
                row.HeightF = lfAlturaFila;
                for (int lnColumna = 1; lnColumna < lnColumasDinamicas + 1; lnColumna++)
                {
                    loBinding = "PIEZAS";
                    if (lnColumna % 2 == 0)
                    {
                        loBinding = "IMPORTE";
                        lnIndicadorColumnaDetalle = lnIndicadorColumnaDetalle + 1;
                    }
                    XRTableCell cell = new XRTableCell();
                    cell.Width = 60;
                    cell.Text  = loBinding;
                    cell.Name  = "xrAgrupadoPzasImporte" + lnColumna;
                    cell.StylePriority.UseTextAlignment = false;
                    cell.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
                    row.Cells.Add(cell);
                }
                loTabladetalle.Rows.Add(row);
            }
            loTabladetalle.BeforePrint += new PrintEventHandler(EncabezadoPzasImporteXRTable_BeforePrint);
            loTabladetalle.AdjustSize();
            loTabladetalle.EndInit();
            return(loTabladetalle);
        }
示例#10
0
        //-----------------------------------------------------------------------------------------------------------------------------------------//

        public RepKargoPlani(DataTable p_TableResult)
        {
            // Initialize
            InitializeComponent();

            // DateTime
            txtDateTime.Text = DateTime.Now.ToString(alfaDate.DTFormat);

            // Version
            txtVersion.Text = alfaVer.GetAppVersion();

            // Operator
            txtOperator.Text = alfaSession.FullName;

            // Create rowHeader
            DataRow rowHeader = p_TableResult.NewRow();

            foreach (DataColumn col in p_TableResult.Columns)
            {
                // Assign Text
                rowHeader[col.ColumnName] = col.ColumnName;
            }

            // Add to Table
            p_TableResult.Rows.InsertAt(rowHeader, 0);

            //========================================== Create XRTable ========================================//

            int p_Padding    = 10;
            int p_TableWidth = this.PageWidth - this.Margins.Left - this.Margins.Right - p_Padding * 2;
            int p_ColWidth   = p_TableWidth / p_TableResult.Columns.Count;

            // Create Dynamic XRTable
            XRTable repTable = XRTable.CreateTable(new Rectangle(p_Padding, 2, p_TableWidth, 40), 1, 0);

            repTable.BorderWidth         = 2;
            repTable.Width               = p_TableWidth;
            repTable.Rows.FirstRow.Width = p_TableWidth;
            repTable.Font    = new Font("Tahoma", 10, FontStyle.Bold);
            repTable.Borders = DevExpress.XtraPrinting.BorderSide.All;

            // Begin
            repTable.BeginInit();

            foreach (DataColumn col in p_TableResult.Columns)
            {
                // Create Cell
                XRTableCell cell = new XRTableCell();

                // Binding
                XRBinding binding = new XRBinding("Text", this.DataSource, col.ColumnName);

                // Cell Properties
                cell.TextAlignment = TextAlignment.MiddleCenter;
                cell.DataBindings.Add(binding);
                cell.Text      = col.ColumnName;
                cell.Width     = p_ColWidth;
                cell.Multiline = true;
                cell.CanShrink = false;
                cell.CanGrow   = false;

                // Add Cell
                repTable.Rows.FirstRow.Cells.Add(cell);
            }

            // Add to Detail
            Detail.Controls.Add(repTable);

            repTable.BeforePrint += new System.Drawing.Printing.PrintEventHandler(repTable_BeforePrint);

            // Adjust
            repTable.AdjustSize();

            // Begin
            repTable.EndInit();



            //========================================== Create XRTable ========================================//
        }
示例#11
0
        private void addRowHeader(XRTable table)
        {
            // ================================
            // Header Row
            // ================================
            var headerRow = new XRTableRow();
            if(!_parameters.StampaMillesimi.GetValueOrDefault())
                headerRow.Borders = BorderSide.All;
            if (_impostazioniReport.HeaderRowHeight != null)
                headerRow.HeightF = _impostazioniReport.HeaderRowHeight.Value;

            var headerFont = GetFont(_impostazioniReport.FontName, _impostazioniReport.FontSize, getFontStyle(_impostazioniReport.FontStyle));
            if (!string.IsNullOrEmpty(_impostazioniReport.HeaderFontStyle) && !string.IsNullOrEmpty(_impostazioniReport.HeaderFontName) && _impostazioniReport.HeaderFontSize != null)
                headerFont = GetFont(_impostazioniReport.HeaderFontName, _impostazioniReport.HeaderFontSize.Value, getFontStyle(_impostazioniReport.HeaderFontStyle));

            var headerAlignment = TextAlignment.TopCenter;
            if (_impostazioniReport.HeaderAlignment != null)
                headerAlignment = GetTextAlignment(_impostazioniReport.HeaderAlignment);

            var columns = _ripartoHelper.GetColumnList(_report, null, _parameters, _numeroPagina, _parameters.StampaMillesimi.GetValueOrDefault());
            foreach (var tableColumn in columns)
            {
                if (!tableColumn.Hidden && (tableColumn.Order != 9997 || _numeroPagina == null || tableColumn.PrintPage == _numeroPagina))
                {
                    var cell = new XRTableCell
                    {
                        Font = headerFont,
                        Text = tableColumn.Description,
                        TextAlignment = headerAlignment,
                        WidthF = tableColumn.Width
                    };

                    if (tableColumn.ColumnType == ColumnTypeEnum.Conto)
                        cell.BackColor = ColorTranslator.FromHtml(_impostazioniReport.HeaderBackColor);

                    if (_parameters.StampaMillesimi.GetValueOrDefault() && !tableColumn.HideMillesimi)
                    {
                        var tableMillesimi = new XRTable {Borders = BorderSide.None};
                        tableMillesimi.BeginInit();
                        _tablesMillesimi.Add(tableMillesimi);
                        var row1 = new XRTableRow {HeightF = headerRow.HeightF};
                        var cell1 = new XRTableCell
                        {
                            Text = cell.Text,
                            Borders = BorderSide.Bottom,
                            TextAlignment = headerAlignment,
                            Padding = getPaddingInfo(),
                            CanGrow = true,
                            WordWrap = true
                        };

                        cell1.BeforePrint += cell1_BeforePrint;

                        row1.Cells.Add(cell1);
                        tableMillesimi.Rows.Add(row1);

                        var row2 = new XRTableRow {HeightF = headerRow.HeightF };

                        // Cell MILLESIMO
                        // --------------------
                        var cellMillesimo = new XRTableCell
                        {
                            Text = tableColumn.DescriptionMillesimi,
                            TextAlignment = headerAlignment,
                            Borders = BorderSide.Right,
                            Padding = getPaddingInfo()
                        };
                        row2.Cells.Add(cellMillesimo);

                        // Cell IMPORTO
                        // --------------------
                        var cellImporto = new XRTableCell
                        {
                            Borders = BorderSide.Right,
                            Text = tableColumn.DescriptionImporto,
                            TextAlignment = headerAlignment,
                            Padding = getPaddingInfo()
                        };
                        row2.Cells.Add(cellImporto);

                        // Add ROW
                        // --------------------
                        tableMillesimi.Rows.Add(row2);

                        cell.Text = string.Empty;
                        cell.Padding = new PaddingInfo(0, 0, 0, 0);

                        cellMillesimo.WidthF = tableColumn.WidthMillesimi.GetValueOrDefault();
                        cellImporto.WidthF = tableColumn.Width;
                        cell.WidthF = tableColumn.Width + tableColumn.WidthMillesimi.GetValueOrDefault();

                        cell1.Width = cell.Width;

                        cell1.BackColor = cell.BackColor;
                        cellImporto.BackColor = cell.BackColor;
                        cellMillesimo.BackColor = cell.BackColor;

                        tableMillesimi.Width = cell.Width;
                        cell.Controls.Add(tableMillesimi);

                        tableMillesimi.AdjustSize();
                        tableMillesimi.EndInit();
                    }
                    else
                        cell.Padding = getPaddingInfo();

                    headerRow.Cells.Add(cell);
                }

            }

            table.Rows.Add(headerRow);
        }
示例#12
0
        public static void CreateReport(XtraReport report, string[] fields)
        {
            PageHeaderBand pageHeader = new PageHeaderBand()
            {
                HeightF = 23, Name = "pageHeaderBand"
            };
            int     tableWidth  = report.PageWidth - report.Margins.Left - report.Margins.Right;
            XRTable headerTable = XRTable.CreateTable(
                new Rectangle(0,                    // rect X
                              0,                    // rect Y
                              tableWidth,           // width
                              40),                  // height
                1,                                  // table row count
                0);                                 // table column count

            headerTable.Borders             = DevExpress.XtraPrinting.BorderSide.All;
            headerTable.BackColor           = Color.Gainsboro;
            headerTable.Font                = new Font("Verdana", 10, FontStyle.Bold);
            headerTable.Rows.FirstRow.Width = tableWidth;
            headerTable.BeginInit();
            foreach (string field in fields)
            {
                XRTableCell cell = new XRTableCell();
                cell.Width         = 100;
                cell.Text          = field;
                cell.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
                headerTable.Rows.FirstRow.Cells.Add(cell);
            }
            headerTable.EndInit();
            headerTable.AdjustSize();
            pageHeader.Controls.Add(headerTable);



            DetailBand detail = new DetailBand()
            {
                HeightF = 23, Name = "detailBand"
            };
            XRTable detailTable = XRTable.CreateTable(
                new Rectangle(0,                // rect X
                              0,                // rect Y
                              tableWidth,       // width
                              40),              // height
                1,                              // table row count
                0);                             // table column count



            detailTable.Width = tableWidth;
            detailTable.Rows.FirstRow.Width = tableWidth;
            detailTable.Borders             = DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Right | DevExpress.XtraPrinting.BorderSide.Bottom;
            detailTable.BeginInit();
            foreach (string field in fields)
            {
                XRTableCell       cell    = new XRTableCell();
                ExpressionBinding binding = new ExpressionBinding("BeforePrint", "Text", String.Format("[{0}]", field));
                cell.ExpressionBindings.Add(binding);
                cell.Width         = 100;
                cell.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
                if (field.Contains("Date"))
                {
                    cell.TextFormatString = "{0:MM/dd/yyyy}";
                }
                detailTable.Rows.FirstRow.Cells.Add(cell);
            }
            detailTable.Font = new Font("Verdana", 8F);
            detailTable.EndInit();
            detailTable.AdjustSize();
            detail.Controls.Add(detailTable);
            report.Bands.AddRange(new Band[] { detail, pageHeader });
        }
示例#13
0
        private float getLocation(XRTable table)
        {
            var locationY = 0f;
            if (table != null)
            {
                table.AdjustSize();
                locationY = table.HeightF + table.Location.Y;
            }

            //foreach (var xrPageBreak in pageBreaks)
            //{
            //    if (xrPageBreak.Location.Y > locationY)
            //        locationY = xrPageBreak.Location.Y;
            //}

            return locationY + .01f;
        }
示例#14
0
/*
        void table_Draw(object sender, DrawEventArgs e)
        {
            // Set the value to be added to the width of the table's border.
            var dx = GraphicsUnitConverter.Convert(5, GraphicsUnit.Pixel, e.UniGraphics.PageUnit);

            // Get the object's current bounds and increase them.
            var rect = e.Bounds;
            rect.Inflate(dx / 2, dx / 2);
            
            // Store the old clip region.
            var oldBounds = e.UniGraphics.ClipBounds;
            
            // Set the new clip region and draw the borders' rectangle.
            e.UniGraphics.ClipBounds = rect;
            e.UniGraphics.DrawRectangle(new Pen(Brushes.Black, dx), rect);
            
            // Restore the old clip region.
            e.UniGraphics.ClipBounds = oldBounds;
        } 
*/

        private void addRowTotale(XRTable table, int? id, TipoTotale tipoTotale, string descrizione = null)
        {
            // ================================
            // Creazione tabella
            // ================================
            if(descrizione == null)
                table.BeginInit();

            var totaleRow = new XRTableRow { Width = table.Width };
            if (!string.IsNullOrEmpty(_impostazioniReport.BorderColor))
                totaleRow.BorderColor = ColorTranslator.FromHtml(_impostazioniReport.BorderColor);

            if (_impostazioniReport.TotaleRowHeight != null)
                totaleRow.HeightF = _impostazioniReport.TotaleRowHeight.Value;
            table.Rows.Add(totaleRow);

            var totaleFont = GetFont(_impostazioniReport.FontName, _impostazioniReport.FontSize, getFontStyle(_impostazioniReport.FontStyle));
            if (!string.IsNullOrEmpty(_impostazioniReport.TotaleFontStyle) && !string.IsNullOrEmpty(_impostazioniReport.TotaleFontName) && _impostazioniReport.TotaleFontSize != null)
                totaleFont = GetFont(_impostazioniReport.TotaleFontName, _impostazioniReport.TotaleFontSize.Value, getFontStyle(_impostazioniReport.TotaleFontStyle));

            const TextAlignment footerAlignment = TextAlignment.MiddleRight;

            var dataSource = _dataSource;
            var labelPrompt = "Totale Generale";
            if (tipoTotale == TipoTotale.Stabile)
            {
                dataSource = _dataSource.Where(item => item.IdStabile == id).ToList();
                var dataSourceLabel = dataSource.FirstOrDefault();
                if(dataSourceLabel != null)
                    labelPrompt = dataSourceLabel.DescrizioneStabile;
            }
            else if (tipoTotale == TipoTotale.Scala)
            {
                dataSource = _dataSource.Where(item => item.IdGruppoStabile == id).ToList();
                var dataSourceLabel = dataSource.FirstOrDefault();
                if (dataSourceLabel != null)
                    labelPrompt = dataSourceLabel.DescrizioneGruppoStabile;
            }
            else if (tipoTotale == TipoTotale.Nominativo)
            {
                dataSource = _dataSource.Where(item => item.IdPersona == id).ToList();
                labelPrompt = "Totale nominativo";
                if (!string.IsNullOrEmpty(descrizione))
                    labelPrompt = string.Format("Totale {0}", descrizione);
            }
            else if (tipoTotale == TipoTotale.SenzaArrotondamenti)
            {
                dataSource = _dataSource.Where(item => item.OrdineUnitaImmobiliare != int.MaxValue).ToList();
                labelPrompt = "Totale senza arrotondamenti";
            }

            var columns = _pianoRatealeHelper.GetColumnList(_report, null, _parameters, _numeroPagina);

            var cellPrompt = new XRTableCell();
            totaleRow.Cells.Add(cellPrompt);

            cellPrompt.Text = labelPrompt;
            cellPrompt.TextAlignment = footerAlignment;
            cellPrompt.Padding = getPaddingInfo();
            cellPrompt.WidthF = _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.OrdineUnita) +
                          _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.Nominativo) +
                          _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.ProprietaConduzione) +
                          _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.Interno) +
                          _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.Piano) +
                          _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.TipoUnita) +
                          _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.Subalterno);

            cellPrompt.BackColor = ColorTranslator.FromHtml(_impostazioniReport.TotaleBackColor);
            cellPrompt.Font = totaleFont;

            foreach (var tableColumn in columns.Where(item => item.ColumnType == ColumnTypeEnum.Conto))
            {
                if (!tableColumn.Hidden && (_numeroPagina == null || tableColumn.PrintPage == _numeroPagina))
                {
                    var cell = new XRTableCell
                    {
                        BackColor = ColorTranslator.FromHtml(_impostazioniReport.TotaleBackColor),
                        Font = totaleFont,
                        WidthF = tableColumn.Width,
                        CanGrow = true
                    };

                    cell.TextAlignment = TextAlignment.MiddleRight;
                    cell.Padding = getPaddingInfo();

                    var importo = dataSource.Where(item => item.NumeroRata == tableColumn.Order).Sum(item => item.Importo);
                    if (importo != 0)
                        cell.Text = importo.ToString("c");

                    totaleRow.Cells.Add(cell); 
                }

            }

            if (descrizione == null)
            {
                table.AdjustSize();
                table.EndInit();
            }
        }
示例#15
0
        private XRTable createRiepilogoTable(decimal importo, float locationY)
        {
            // ================================
            // Creazione tabella
            // ================================
            var marginTop = 30;
            if (_impostazioniReport.RiepilogoTopMargin != null)
                marginTop = _impostazioniReport.RiepilogoTopMargin.Value;

            var fontRiepilogo = GetFont(_impostazioniReport.FontName, _impostazioniReport.FontSize, FontStyle.Bold);
            if(!string.IsNullOrEmpty(_impostazioniReport.RiepilogoFontName) && _impostazioniReport.RiepilogoFontSize != null)
                fontRiepilogo = GetFont(_impostazioniReport.RiepilogoFontName, _impostazioniReport.RiepilogoFontSize.Value, getFontStyle(_impostazioniReport.RiepilogoFontStyle));

            var fontImportoRiepilogo = (Font)fontRiepilogo.Clone();
            if (!string.IsNullOrEmpty(_impostazioniReport.ImportoRiepilogoFontName) && _impostazioniReport.ImportoRiepilogoFontSize != null)
                fontImportoRiepilogo = GetFont(_impostazioniReport.ImportoRiepilogoFontName, _impostazioniReport.ImportoRiepilogoFontSize.Value, getFontStyle(_impostazioniReport.ImportoRiepilogoFontStyle));

            var table = new XRTable
            {
                Borders = BorderSide.None,
                LocationF = new PointFloat(10F, locationY + marginTop),
                Font = fontRiepilogo,
                Width = 800
            };

            table.BeginInit();

            //if (_parameters.TipoRendiconto == TipoRendiconto.Consuntivo)
            //{
            //    var row = new XRTableRow();
            //    table.Rows.Add(row);

            //    var cellPrompt = new XRTableCell
            //    {
            //        Text = "Saldo Attuale: ",
            //        Font = fontRiepilogo,
            //        TextAlignment = TextAlignment.MiddleLeft,
            //        Padding = new PaddingInfo(5,5,5,5),
            //        Borders = BorderSide.Bottom | BorderSide.Left | BorderSide.Top
            //    };

            //    if (!string.IsNullOrEmpty(_impostazioniReport.RiepilogoText))
            //        cellPrompt.Text = _impostazioniReport.RiepilogoText;

            //    row.Cells.Add(cellPrompt);

            //    var cellValue = new XRTableCell
            //    {
            //        Text = importo.ToString("C"),
            //        Font = fontImportoRiepilogo,
            //        TextAlignment = TextAlignment.MiddleRight,
            //        Padding = new PaddingInfo(5, 5, 5, 5),
            //        Borders = BorderSide.Bottom | BorderSide.Right | BorderSide.Top
            //    };
            //    row.Cells.Add(cellValue);

            //}

            table.AdjustSize();
            table.EndInit();

            return table;
        }
示例#16
0
        private XRTable createDetailTable(IEnumerable<ReportRataSoggettoDTO> dataSource, float locationY)
        {
            // ================================
            // Creazione tabella
            // ================================
            var table = new XRTable
            {
                Borders = BorderSide.All,
                BorderWidth = 1f,
                BorderColor = Color.LightGray,
                LocationF = new PointFloat(10F, locationY)
            };
            if (!string.IsNullOrEmpty(_impostazioniReport.BorderColor))
                table.BorderColor = ColorTranslator.FromHtml(_impostazioniReport.BorderColor);

            table.BeginInit();

            var columns = _pianoRatealeHelper.GetColumnList(_report, null, _parameters, _numeroPagina);

            // ------------------------------------------------------
            //  Raggruppamento per unità immobiliare
            // ------------------------------------------------------
            IList<IGrouping<int, ReportRataSoggettoDTO>> dataSourceByUnitaImmobiliare = !_parameters.TotalePerPersona ? dataSource.OrderBy(item => item.OrdineUnitaImmobiliare).ThenByDescending(item => item.TipoNominativo).GroupBy(item => item.IdUnitaImmobiliare).ToList() : dataSource.OrderBy(item => item.Nominativo).ThenByDescending(item => item.TipoNominativo).GroupBy(item => item.IdPersona).ToList();

            var nominativoPrecedente = string.Empty;
            var idPersonaPrecedente = 0;

            foreach (var dataSourceUnitaImmobiliare in dataSourceByUnitaImmobiliare)
            {
                // ------------------------------------------------------
                //  Raggruppamento Proprietario/Conduttore
                // ------------------------------------------------------
                var indexNominativo = 0;
                var idSoggettoCondominioPrecedente = 0;

                var dataSourceByNominativo = dataSourceUnitaImmobiliare.GroupBy(item => item.IdSoggettoCondominio.ToString(CultureInfo.InvariantCulture).PadLeft(5, '0')).ToList();
                foreach (var dataSourceNominativo in dataSourceByNominativo)
                {
                    var itemNominativo = dataSourceNominativo.OrderBy(item => item.NumeroRata).FirstOrDefault();
                    if (itemNominativo != null)
                    {
                        var isArrotondamenti = itemNominativo.OrdineUnitaImmobiliare == int.MaxValue;

                        if (_parameters.TotalePerPersona && idPersonaPrecedente > 0 && idPersonaPrecedente != itemNominativo.IdPersona)
                        {
                            addRowTotale(table, idPersonaPrecedente, TipoTotale.Nominativo, nominativoPrecedente);
                            indexNominativo = 0;
                        }
                        nominativoPrecedente = itemNominativo.Nominativo;
                        idPersonaPrecedente = itemNominativo.IdPersona;

                        var detailRow = new XRTableRow { Width = table.Width };
                        if (_impostazioniReport.RowHeight != null)
                            detailRow.HeightF = _impostazioniReport.RowHeight.Value;
                        if (_impostazioniReport.ArrotondamentiRowHeight != null)
                            detailRow.HeightF = _impostazioniReport.ArrotondamentiRowHeight.Value;


                        table.Rows.Add(detailRow);
                        foreach (var tableColumn in columns)
                        {
                            if (!tableColumn.Hidden && (!isArrotondamenti || tableColumn.ColumnType == ColumnTypeEnum.Nominativo || tableColumn.ColumnType == ColumnTypeEnum.Conto) && (tableColumn.Order != 9997 || _numeroPagina == null || tableColumn.PrintPage == _numeroPagina))
                            {
                                var cell = new XRTableCell();

                                if (!_impostazioniReport.BorderInsideGroup)
                                    setCellBorder(cell, dataSourceByNominativo.Count, indexNominativo);

                                cell.WidthF = tableColumn.Width;
                                cell.Font = GetFont(tableColumn.FontName, tableColumn.FontSize, getFontStyle(tableColumn.FontStyle));
                                
                                if (isArrotondamenti)
                                {
                                    var arrotondamentiFont = GetFont(tableColumn.FontName, tableColumn.FontSize, getFontStyle(tableColumn.FontStyle));
                                    if (!string.IsNullOrEmpty(_impostazioniReport.TotaleFontStyle) && !string.IsNullOrEmpty(_impostazioniReport.ArrotondamentiFontName) && _impostazioniReport.ArrotondamentiFontSize != null)
                                    {
                                        var fontSize = _impostazioniReport.ArrotondamentiFontSize.Value;
                                        if (Math.Abs(fontSize) < _pianoRatealeHelper.GetTolerance())
                                            fontSize = 8;
                                        arrotondamentiFont = GetFont(_impostazioniReport.ArrotondamentiFontName, fontSize, getFontStyle(_impostazioniReport.ArrotondamentiFontStyle));
                                    }
                                    cell.Font = arrotondamentiFont;
                                }

                                if (tableColumn.ColumnType == ColumnTypeEnum.OrdineUnita)
                                {
                                    if (indexNominativo == 0 || _impostazioniReport.OrdineUnitaAllRows)
                                    {
                                        cell.Text = itemNominativo.OrdineUnitaImmobiliare.ToString(CultureInfo.InvariantCulture);
                                        cell.TextAlignment = TextAlignment.MiddleRight;
                                        cell.Padding = getPaddingInfo();
                                    }

                                    if (_impostazioniReport.BorderInsideGroup)
                                        setCellBorder(cell, dataSourceByNominativo.Count, indexNominativo);
                                }

                                if (tableColumn.ColumnType == ColumnTypeEnum.Nominativo)
                                {
                                    if ((!_parameters.TotalePerPersona && itemNominativo.IdSoggettoCondominio != idSoggettoCondominioPrecedente) || _parameters.TotalePerPersona || isArrotondamenti)
                                        cell.Text = itemNominativo.Nominativo;
                                    cell.TextAlignment = TextAlignment.MiddleLeft;
                                    if (itemNominativo.OrdineUnitaImmobiliare == int.MaxValue)
                                    {
                                        cell.TextAlignment = TextAlignment.MiddleRight;
                                        cell.WidthF = _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.OrdineUnita) +
                                                      _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.Nominativo) +
                                                      _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.ProprietaConduzione) +
                                                      _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.Interno) +
                                                      _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.Piano) +
                                                      _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.TipoUnita) +
                                                      _pianoRatealeHelper.GetColumnWidth(columns, ColumnTypeEnum.Subalterno);
                                    }

                                    cell.Padding = getPaddingInfo();
                                }

                                if (itemNominativo.OrdineUnitaImmobiliare != int.MaxValue)
                                {
                                    if (tableColumn.ColumnType == ColumnTypeEnum.TipoUnita)
                                    {
                                        if (itemNominativo.IdSoggettoCondominio != idSoggettoCondominioPrecedente)
                                            cell.Text = itemNominativo.TipoUnitaImmobiliare;
                                        cell.TextAlignment = TextAlignment.MiddleLeft;
                                        cell.Padding = getPaddingInfo();
                                    }

                                    if (tableColumn.ColumnType == ColumnTypeEnum.Subalterno)
                                    {
                                        if (itemNominativo.IdSoggettoCondominio != idSoggettoCondominioPrecedente)
                                            cell.Text = itemNominativo.SubalternoUnitaImmobiliare;
                                        cell.TextAlignment = TextAlignment.MiddleLeft;
                                        cell.Padding = getPaddingInfo();
                                    }

                                    if (tableColumn.ColumnType == ColumnTypeEnum.Interno)
                                    {
                                        if (itemNominativo.IdSoggettoCondominio != idSoggettoCondominioPrecedente)
                                            cell.Text = itemNominativo.InternoUnitaImmobiliare;
                                        cell.TextAlignment = TextAlignment.MiddleLeft;
                                        cell.Padding = getPaddingInfo();
                                    }

                                    if (tableColumn.ColumnType == ColumnTypeEnum.Piano)
                                    {
                                        if (itemNominativo.IdSoggettoCondominio != idSoggettoCondominioPrecedente)
                                            cell.Text = itemNominativo.PianoUnitaImmobiliare;
                                        cell.TextAlignment = TextAlignment.MiddleRight;
                                        cell.Padding = getPaddingInfo();
                                    }

                                    if (tableColumn.ColumnType == ColumnTypeEnum.ProprietaConduzione)
                                    {
                                        cell.Text = itemNominativo.TipoNominativo.Substring(0, 1).ToUpper();
                                        cell.TextAlignment = TextAlignment.MiddleLeft;
                                        cell.Padding = getPaddingInfo();
                                    }
                                }

                                if (tableColumn.ColumnType == ColumnTypeEnum.Conto)
                                {
                                    cell.TextAlignment = TextAlignment.MiddleRight;
                                    cell.Padding = getPaddingInfo();

                                    var importo = dataSourceNominativo.Where(item => item.NumeroRata == tableColumn.Order).Sum(item => item.Importo);
                                    if (importo != 0)
                                        cell.Text = importo.ToString("c");
                                }

                                detailRow.Cells.Add(cell);                                
                            }
                        }

                        idSoggettoCondominioPrecedente = itemNominativo.IdSoggettoCondominio;
                    }
                    indexNominativo++;
                }
            }

            // Ultimo totale
            if (_parameters.TotalePerPersona && idPersonaPrecedente > 0)
                addRowTotale(table, idPersonaPrecedente, TipoTotale.Nominativo, nominativoPrecedente);

            table.BeforePrint += tableDetailBeforePrint;

            table.AdjustSize();
            table.EndInit();

            return table;
        }
示例#17
0
        private XRTable createHeaderTable()
        {
            // ================================
            // Creazione tabella
            // ================================
            var table = new XRTable
            {
                Borders = BorderSide.Top | BorderSide.Left | BorderSide.Right,
                BorderWidth = 1f,
                BorderColor = Color.LightGray
            };
            if (!string.IsNullOrEmpty(_impostazioniReport.BorderColor))
                table.BorderColor = ColorTranslator.FromHtml(_impostazioniReport.BorderColor);
            table.BeginInit();

            addRowHeader(table);

            table.BeforePrint += tableHeaderBeforePrint;
            table.AdjustSize();
            table.EndInit();

            return table;
        }
示例#18
0
/*
        void table_Draw(object sender, DrawEventArgs e)
        {
            // Set the value to be added to the width of the table's border.
            var dx = GraphicsUnitConverter.Convert(5, GraphicsUnit.Pixel, e.UniGraphics.PageUnit);

            // Get the object's current bounds and increase them.
            var rect = e.Bounds;
            rect.Inflate(dx / 2, dx / 2);
            
            // Store the old clip region.
            var oldBounds = e.UniGraphics.ClipBounds;
            
            // Set the new clip region and draw the borders' rectangle.
            e.UniGraphics.ClipBounds = rect;
            e.UniGraphics.DrawRectangle(new Pen(Brushes.Black, dx), rect);
            
            // Restore the old clip region.
            e.UniGraphics.ClipBounds = oldBounds;
        } 
*/

        private void addRowTotale(XRTable table, int? id, TipoTotale tipoTotale, string descrizione = null)
        {
            // ================================
            // Creazione tabella
            // ================================
            if(descrizione == null)
                table.BeginInit();

            var totaleRow = new XRTableRow { Width = table.Width };
            if (!string.IsNullOrEmpty(_impostazioniReport.BorderColor))
                totaleRow.BorderColor = ColorTranslator.FromHtml(_impostazioniReport.BorderColor);

            if (_impostazioniReport.TotaleRowHeight != null)
                totaleRow.HeightF = _impostazioniReport.TotaleRowHeight.Value;
            table.Rows.Add(totaleRow);

            var totaleFont = GetFont(_impostazioniReport.FontName, _impostazioniReport.FontSize, getFontStyle(_impostazioniReport.FontStyle));
            if (!string.IsNullOrEmpty(_impostazioniReport.TotaleFontStyle) && !string.IsNullOrEmpty(_impostazioniReport.TotaleFontName) && _impostazioniReport.TotaleFontSize != null)
                totaleFont = GetFont(_impostazioniReport.TotaleFontName, _impostazioniReport.TotaleFontSize.Value, getFontStyle(_impostazioniReport.TotaleFontStyle));

            const TextAlignment footerAlignment = TextAlignment.MiddleRight;

            var dataSource = _dataSource;
            var labelPrompt = "Totale Generale";
            if (tipoTotale == TipoTotale.Stabile)
            {
                dataSource = _dataSource.Where(item => item.IdStabile == id).ToList();
                var dataSourceLabel = dataSource.FirstOrDefault();
                if(dataSourceLabel != null)
                    labelPrompt = dataSourceLabel.DescrizioneStabile;
            }
            else if (tipoTotale == TipoTotale.Scala)
            {
                dataSource = _dataSource.Where(item => item.IdGruppoStabile == id).ToList();
                var dataSourceLabel = dataSource.FirstOrDefault();
                if (dataSourceLabel != null)
                    labelPrompt = dataSourceLabel.DescrizioneGruppoStabile;
            }
            else if (tipoTotale == TipoTotale.Nominativo)
            {
                dataSource = _dataSource.Where(item => item.IdPersona == id).ToList();
                labelPrompt = "Totale nominativo";
                if (!string.IsNullOrEmpty(descrizione))
                    labelPrompt = $"Totale {descrizione}";
            }
            else if (tipoTotale == TipoTotale.SenzaArrotondamenti)
            {
                dataSource = _dataSource.Where(item => item.OrdineUnitaImmobiliare != int.MaxValue).ToList();
                labelPrompt = "Totale senza arrotondamenti";
            }

            var columns = _ripartoHelper.GetColumnList(_report, null, _parameters, _numeroPagina, _parameters.StampaMillesimi.GetValueOrDefault());

            var cellPrompt = new XRTableCell();
            totaleRow.Cells.Add(cellPrompt);

            cellPrompt.Text = labelPrompt;
            cellPrompt.TextAlignment = footerAlignment;
            cellPrompt.Padding = getPaddingInfo();
            cellPrompt.WidthF = _ripartoHelper.GetColumnWidth(columns, ColumnTypeEnum.OrdineUnita) +
                          _ripartoHelper.GetColumnWidth(columns, ColumnTypeEnum.Nominativo) +
                          _ripartoHelper.GetColumnWidth(columns, ColumnTypeEnum.ProprietaConduzione) +
                          _ripartoHelper.GetColumnWidth(columns, ColumnTypeEnum.Interno) +
                          _ripartoHelper.GetColumnWidth(columns, ColumnTypeEnum.Piano) +
                          _ripartoHelper.GetColumnWidth(columns, ColumnTypeEnum.TipoUnita) +
                          _ripartoHelper.GetColumnWidth(columns, ColumnTypeEnum.Subalterno);

            cellPrompt.BackColor = ColorTranslator.FromHtml(_impostazioniReport.TotaleBackColor);
            cellPrompt.Font = totaleFont;

            foreach (var tableColumn in columns.Where(item => item.ColumnType == ColumnTypeEnum.Conto))
            {
                if (!tableColumn.Hidden && (_numeroPagina == null || tableColumn.PrintPage == _numeroPagina))
                {
                    var cell = new XRTableCell
                    {
                        BackColor = ColorTranslator.FromHtml(_impostazioniReport.TotaleBackColor),
                        Font = totaleFont,
                        WidthF = tableColumn.Width,
                        CanGrow = true
                    };

                    if (_parameters.StampaMillesimi.GetValueOrDefault() && !tableColumn.HideMillesimi)
                    {
                        var tableMillesimi = new XRTable { Borders = BorderSide.None };
                        var row = new XRTableRow();
                        tableMillesimi.BeginInit();

                        // Cell MILLESIMO
                        // -------------
                        var cellMillesimo = new XRTableCell
                        {
                            BackColor = ColorTranslator.FromHtml(_impostazioniReport.TotaleBackColor),
                            Font = totaleFont,
                            WidthF = tableColumn.Width
                        };

                        var millesimo = dataSource.Where(item => item.OrdineConto == tableColumn.Order).Sum(item => item.Millesimi).GetValueOrDefault();
                        if (millesimo != 0)
                            cellMillesimo.Text = (millesimo * 1000).ToString("#0,000");

                        cellMillesimo.Borders = BorderSide.Right;
                        cellMillesimo.TextAlignment = TextAlignment.MiddleRight;
                        cellMillesimo.Padding = getPaddingInfo();
                        row.Cells.Add(cellMillesimo);

                        // Cell IMPORTO
                        // -------------
                        var cellImporto = new XRTableCell
                        {
                            Borders = BorderSide.None,
                            BackColor = ColorTranslator.FromHtml(_impostazioniReport.TotaleBackColor),
                            Font = totaleFont,
                            WidthF = tableColumn.Width
                        };

                        var importo = dataSource.Where(item => item.OrdineConto == tableColumn.Order).Sum(item => item.Importo.GetValueOrDefault());
                        if (importo != 0)
                            cellImporto.Text = importo.ToString("c");

                        cellImporto.TextAlignment = TextAlignment.MiddleRight;
                        cellImporto.Padding = getPaddingInfo();
                        row.Cells.Add(cellImporto);

                        // Add ROW
                        // -------------
                        tableMillesimi.Rows.Add(row);

                        cell.Text = string.Empty;
                        cell.Padding = new PaddingInfo(0, 0, 0, 0);

                        cellMillesimo.WidthF = tableColumn.WidthMillesimi.GetValueOrDefault();
                        cellImporto.WidthF = tableColumn.Width;
                        cell.WidthF = tableColumn.Width + tableColumn.WidthMillesimi.GetValueOrDefault();

                        tableMillesimi.Width = cell.Width;
                        cell.Controls.Add(tableMillesimi);

                        tableMillesimi.AdjustSize();
                        tableMillesimi.EndInit();
                    }
                    else
                    {
                        cell.TextAlignment = TextAlignment.MiddleRight;
                        cell.Padding = getPaddingInfo();

                        decimal importo;
                        if(tableColumn.Order != 9997)
                            importo = dataSource.Where(item => item.OrdineConto == tableColumn.Order).Sum(item => item.Importo.GetValueOrDefault());
                        else
                        {
                            importo = dataSource.Where(item => item.OrdineConto == 9994).Sum(item => item.Importo.GetValueOrDefault()) +
                                                dataSource.Where(item => item.OrdineConto == 9993).Sum(item => item.Importo.GetValueOrDefault());
                        }
                        if (importo != 0)
                            cell.Text = importo.ToString("c");

                    }

                    totaleRow.Cells.Add(cell); 
                }

            }

            if (descrizione == null)
            {
                table.AdjustSize();
                table.EndInit();
            }
        }
示例#19
0
        private void CreateDetailReportControls(XtraReport report)
        {
            XRLabel titleLbl = new XRLabel()
            {
                LocationF = new System.Drawing.PointF(0, 0),
                SizeF     = new System.Drawing.SizeF(600, 30),
                Font      = new System.Drawing.Font("Arial", 18f, System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic),
                ForeColor = System.Drawing.Color.Red
            };

            titleLbl.DataBindings.Add(new XRBinding(report.Parameters["catNameParam"], "Text", "Details for {0} category"));
            ReportHeaderBand reportHeaderBand = null;

            if (report.Bands[BandKind.ReportHeader] == null)
            {
                report.Bands.Add(new ReportHeaderBand());
            }
            reportHeaderBand         = report.Bands[BandKind.ReportHeader] as ReportHeaderBand;
            reportHeaderBand.HeightF = titleLbl.HeightF + 10;
            reportHeaderBand.Controls.Add(titleLbl);

            XRLabel homeLabel = new XRLabel()
            {
                LocationF   = new System.Drawing.PointF(0, 0),
                SizeF       = new System.Drawing.SizeF(400, 30),
                Text        = "Back to categories",
                Font        = new System.Drawing.Font("Arial", 16f, System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic | System.Drawing.FontStyle.Underline),
                NavigateUrl = " ",
                ForeColor   = System.Drawing.Color.Blue
            };
            PageHeaderBand pageHeaderBand = null;

            if (report.Bands[BandKind.PageHeader] == null)
            {
                report.Bands.Add(new PageHeaderBand());
            }
            pageHeaderBand         = report.Bands[BandKind.PageHeader] as PageHeaderBand;
            pageHeaderBand.HeightF = titleLbl.HeightF;
            pageHeaderBand.Controls.Add(homeLabel);

            XRTable tbl = new XRTable();

            tbl.BeginInit();
            tbl.Borders = DevExpress.XtraPrinting.BorderSide.All;
            XRTableRow row = new XRTableRow();

            row.HeightF = 40;
            SqlDataSource ds              = report.DataSource as SqlDataSource;
            string        dataMember      = report.DataMember;
            ITable        categoriesTable = ds.Result[dataMember] as ITable;

            foreach (IColumn col in categoriesTable.Columns)
            {
                if (col.Type == typeof(byte[]))
                {
                    continue;
                }
                XRTableCell cell = new XRTableCell();
                cell.DataBindings.Add(new XRBinding("Text", null, string.Format("{0}.{1}", dataMember, col.Name)));
                row.Cells.Add(cell);
            }
            tbl.Rows.Add(row);
            tbl.BeforePrint += tbl_BeforePrint;
            tbl.AdjustSize();
            tbl.EndInit();
            DetailBand detailBand = null;

            if (report.Bands[BandKind.Detail] == null)
            {
                report.Bands.Add(new DetailBand());
            }
            detailBand         = report.Bands[BandKind.Detail] as DetailBand;
            detailBand.HeightF = tbl.HeightF;
            detailBand.Controls.Add(tbl);
        }