Datanband gets only first entry

Stimulsoft Reports.WPF discussion
Post Reply
DeSchneller
Posts: 12
Joined: Mon Oct 31, 2011 4:58 am
Location: Germany

Datanband gets only first entry

Post by DeSchneller »

Hi there,

i was trying to code a report by myself, but the result was, that my Databand was only filled with the first item in the BusinessObject.

The Code of my Report is below.

Thanks for help at this point.

Code: Select all

    internal class ClaimList
    {
        ClaimListHeadDto mHead;
        List<ClaimListDto> mList;

        ClaimListBusinessObject claimListBO = new ClaimListBusinessObject();
        ClaimListHeaderBusinessObject claimHeadBO = new ClaimListHeaderBusinessObject();

        StiStyle oddStyle;
        StiStyle evenStyle;

        internal ClaimList(ClaimListHeadDto head, List<ClaimListDto> list)
        {
            mHead = head;
            mList = list;
        }

        internal void Fill(ref StiReport report)
        {
            SetReportSpecifics(ref report);
            
            StiPage page = SetPage(report);
            page.Components.Clear();

            page.Components.AddRange(GetPageComponents(page));
            report.Pages.Add(page);
        }

        private void SetReportSpecifics(ref StiReport report)
        {
            #region BusinessObjects
            report.Dictionary.BusinessObjects.Clear();
            report.BusinessObjectsStore.Clear();

            claimHeadBO.Columns.AddRange(new StiDataColumn[]
                                                    {
                                                        new StiDataColumn("Client", "Client", "Client", typeof(DateTime), null),
                                                        new StiDataColumn("Debtor", "Debtor", "Debtor", typeof(string), null),
                                                        new StiDataColumn("FullIncidentNumber", "FullIncidentNumber", "FullIncidentNumber", typeof(string), null)
                                                    });

            claimListBO.Columns.AddRange(new StiDataColumn[]
                                                    {
                                                        new StiDataColumn("Date", "Date", "Date", typeof(DateTime), null),
                                                        new StiDataColumn("PostingText", "PostingText", "PostingText", typeof(string), null),
                                                        new StiDataColumn("PaymentAmount", "PaymentAmount", "PaymentAmount", typeof(decimal?), null),
                                                        new StiDataColumn("ClaimAmount", "ClaimAmount", "ClaimAmount", typeof(decimal?), null),
                                                        new StiDataColumn("CostAmount", "CostAmount", "CostAmount", typeof(decimal?), null),
                                                        new StiDataColumn("RateAmount", "RateAmount", "RateAmount", typeof(decimal?), null),
                                                        new StiDataColumn("BalanceAmount", "BalanceAmount", "BalanceAmount", typeof(decimal?), null)
                                                    });

            report.Dictionary.BusinessObjects.Add(claimHeadBO);
            report.Dictionary.BusinessObjects.Add(claimListBO);

            report.BusinessObjectsStore.Add(new StiBusinessObjectData("Common", "Header", "Header", mHead));
            report.BusinessObjectsStore.Add(new StiBusinessObjectData("Common", "ClaimList", "ClaimList", mList));
            #endregion

            #region Styles
            report.Styles.Clear();

            oddStyle = new StiStyle();
            oddStyle.Name = "OddStyle";
            oddStyle.Border = new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false);
            oddStyle.Brush = new StiSolidBrush(Color.FromArgb(255, 242, 242, 242));
            oddStyle.Font = new Font("Calibri", 9F);
            oddStyle.TextBrush = new StiSolidBrush(Color.Black);
            oddStyle.Image = null;

            evenStyle = new StiStyle();
            evenStyle.Name = "EvenStyle";
            evenStyle.Border = new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false);
            evenStyle.Brush = new StiSolidBrush(Color.FromArgb(255, 216, 216, 216));
            evenStyle.Font = new Font("Calibri", 9F);
            evenStyle.TextBrush = new StiSolidBrush(Color.Black);
            evenStyle.Image = null;

            report.Styles.AddRange(new StiBaseStyle[]
                                            {
                                                oddStyle,
                                                evenStyle
                                            });
            #endregion
        }

        private StiPage SetPage(StiReport report)
        {
            StiPage page = new StiPage();

            page.Guid = new Guid().ToString();
            page.Name = "ClaimListPage";
            page.PageHeight = 29.7;
            page.PageWidth = 21;
            page.PaperSize = PaperKind.A4;
            page.Border = new StiBorder(StiBorderSides.None, Color.Black, 2, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false);
            page.Brush = new StiSolidBrush(Color.Transparent);
            page.ExcelSheetValue = null;
            page.Interaction = null;
            page.Margins = new StiMargins(0, 0, 0, 0);

            page.Report = report;

            return page;
        }

        #region Bands
        private StiComponent[] GetPageComponents(StiPage page)
        {
            return new StiComponent[]
                                {
                                    GetPageHeaderBand(page),
                                    GetPageFooterBand(page),
                                    GetDataHeaderBand(page),
                                    GetDataBand(page),
                                    GetDataFooterBand(page)
                                };
        }

        private StiPageHeaderBand GetPageHeaderBand(StiPage page)
        {
            StiPageHeaderBand band = new StiPageHeaderBand();
            band.Components.Clear();

            band.ClientRectangle = new RectangleD(0, 0.4, 21, 3.8);
            band.Name = "PageHead";
            band.Border = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false);
            band.Brush = new StiSolidBrush(Color.Transparent);

            band.Components.AddRange(GetHeaderBandComponents(band, page));
            band.Report = page.Report;
            band.Parent = page;

            return band;
        }

        private StiComponent[] GetHeaderBandComponents(StiPageHeaderBand band, StiPage page)
        {
            return new StiComponent[]
                                {
                                    GetHeadText(band, page),
                                    GetInCaseText(band, page),
                                    GetClientAndIncidentNumberText(band, page),
                                    GetAgainstText(band, page),
                                    GetDebtorText(band, page),
                                    GetDateText(band, page)
                                };
        }

        private StiComponent GetPageFooterBand(StiPage page)
        {
            StiPageFooterBand band = new StiPageFooterBand();
            band.Components.Clear();

            band.ClientRectangle = new RectangleD(0, 28, 21, 1.7);
            band.Name = "PageFoot";
            band.Border = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false);
            band.Brush = new StiSolidBrush(Color.Transparent);

            band.Components.AddRange(GetHeaderBandComponents(band, page));
            band.Report = page.Report;
            band.Parent = page;

            return band;
        }

        private StiComponent[] GetHeaderBandComponents(StiPageFooterBand band, StiPage page)
        {
            return new StiComponent[]
                                {
                                    GetPageText(band, page)
                                };
        }

        private StiComponent GetDataHeaderBand(StiPage page)
        {
            StiHeaderBand band = new StiHeaderBand();
            band.Components.Clear();

            band.ClientRectangle = new RectangleD(0, 5, 21, 0.4);
            band.Name = "DataHeader";
            band.Border = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false);
            band.Brush = new StiSolidBrush(Color.Transparent);

            band.Components.AddRange(GetDataHeaderBandComponents(band, page));
            band.Report = page.Report;
            band.Parent = page;

            return band;
        }

        private StiComponent[] GetDataHeaderBandComponents(StiHeaderBand band, StiPage page)
        {
            return new StiComponent[]
                                {
                                    GetVoucherDateDataHeaderText(band, page),
                                    GetPostingDataHeaderText(band, page),
                                    GetPaymentDataHeaderText(band, page),
                                    GetClaimDataHeaderText(band, page),
                                    GetCostDataHeaderText(band, page),
                                    GetRateDataHeaderText(band, page),
                                    GetBalanceDataHeaderText(band, page)
                                };
        }

        private StiComponent GetDataBand(StiPage page)
        {
            StiDataBand band = new StiDataBand();
            band.Components.Clear();

            band.BusinessObjectGuid = "164f26f04fad42988450376537c5147a";
            band.ClientRectangle = new RectangleD(0, 6.2, 21, 0.4);
            band.EvenStyle = "EvenStyle";
            band.Name = "Data";
            band.OddStyle = "OddStyle";
            band.Sort = new string[0];
            band.Border = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false);
            band.Brush = new StiSolidBrush(Color.Transparent);

            band.Rendering += new EventHandler(DataBand_Rendering);

            band.Components.AddRange(GetDataBandComponents(band, page));
            band.Report = page.Report;
            band.Parent = page;

            return band;
        }

        private StiComponent[] GetDataBandComponents(StiDataBand band, StiPage page)
        {
            return new StiComponent[]
                                {
                                    GetVoucherDateDataText(band, page),
                                    GetPostingDataText(band, page),
                                    GetPaymentDataText(band, page),
                                    GetClaimDataText(band, page),
                                    GetCostDataText(band, page),
                                    GetRateDataText(band, page),
                                    GetBalanceDataText(band, page)
                                };
        }

        private StiComponent GetDataFooterBand(StiPage page)
        {
            StiFooterBand band = new StiFooterBand();
            band.Components.Clear();

            band.ClientRectangle = new RectangleD(0, 7.4, 21, 0.8);
            band.Name = "DataFooter";
            band.Border = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false);
            band.Brush = new StiSolidBrush(Color.Transparent);

            band.Components.AddRange(GetDataBandComponents(band, page));
            band.Report = page.Report;
            band.Parent = page;

            return band;
        }

        private StiComponent[] GetDataBandComponents(StiFooterBand band, StiPage page)
        {
            return new StiComponent[]
                                {
                                    GetBalanceDataFooterText(band, page),
                                    GetSumTextDataFooterText(band, page)
                                };
        }
        #endregion

        #region StiText
        private StiText GetText(StiContainer band, StiPage page, bool canGrow, RectangleD clientRectange, bool growToHeight, StiTextHorAlignment horizontal, string name, string value, StiVertAlignment vertical, StiBorder border, StiSolidBrush borderBrush, Font font, StiMargins margins, StiSolidBrush textBrush, StiTextOptions textOptions)
        {
            StiText text = new StiText();

            text.CanGrow = canGrow;
            text.ClientRectangle = clientRectange;
            text.HorAlignment = horizontal;
            text.Name = name;
            text.Text = value;
            text.Type = StiSystemTextType.Expression;
            text.VertAlignment = vertical;
            text.Border = border;
            text.Brush = borderBrush;
            text.Font = font;
            text.Indicator = null;
            text.Interaction = null;
            text.Margins = margins;
            text.TextBrush = textBrush;
            text.TextOptions = textOptions;

            text.Parent = band;
            text.Page = page;

            return text;
        }

        private StiText GetHeadText(StiPageHeaderBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           false,
                           new RectangleD(0, 1, 21, 0.7),
                           false,
                           StiTextHorAlignment.Center,
                           "HeadText",
                           GetHeadValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 16F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetInCaseText(StiPageHeaderBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           false,
                           new RectangleD(0.8, 1.8, 1.6, 0.5),
                           false,
                           StiTextHorAlignment.Left,
                           "CaseText",
                           GetInCaseValue(),
                           StiVertAlignment.Top,
                           new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 10F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetClientAndIncidentNumberText(StiPageHeaderBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           false,
                           new RectangleD(2.8, 1.8, 7.9, 1.8),
                           false,
                           StiTextHorAlignment.Left,
                           "ClientAndIncidentNumberText",
                           GetClientAndIncidentNumberValue(),
                           StiVertAlignment.Top,
                           new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 10F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetAgainstText(StiPageHeaderBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           false,
                           new RectangleD(10.7, 1.8, 1.2, 0.5),
                           false,
                           StiTextHorAlignment.Left,
                           "AgainstText",
                           GetAgainstValue(),
                           StiVertAlignment.Top,
                           new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 10F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetDebtorText(StiPageHeaderBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           false,
                           new RectangleD(12.3, 1.8, 7.9, 1.8),
                           false,
                           StiTextHorAlignment.Left,
                           "DebtorText",
                           GetDebtorValue(),
                           StiVertAlignment.Top,
                           new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 10F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetDateText(StiPageHeaderBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           false,
                           new RectangleD(17.2, 1.2, 3, 0.5),
                           false,
                           StiTextHorAlignment.Right,
                           "DateText",
                           GetInCaseValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 10F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetPageText(StiPageFooterBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           false,
                           new RectangleD(0.6, 0.7, 19.8, 0.4),
                           false,
                           StiTextHorAlignment.Right,
                           "PageText",
                           GetPageValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 9F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetVoucherDateDataHeaderText(StiHeaderBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(0.6, 0.7, 19.8, 0.4),
                           true,
                           StiTextHorAlignment.Left,
                           "VoucherDateDataHeaderText",
                           GetVoucherDateHeaderValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.FromArgb(255, 165, 165, 165)),
                           new Font("Calibri", 9F, FontStyle.Bold),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetBalanceDataHeaderText(StiHeaderBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(18.9, 0, 2.1, 0.4),
                           true,
                           StiTextHorAlignment.Center,
                           "BalanceDataHeaderText",
                           GetBalanceHeaderValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.FromArgb(255, 165, 165, 165)),
                           new Font("Calibri", 9F, FontStyle.Bold),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetRateDataHeaderText(StiHeaderBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(16.8, 0, 2.1, 0.4),
                           true,
                           StiTextHorAlignment.Center,
                           "RateDataHeaderText",
                           GetRateHeaderValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.FromArgb(255, 165, 165, 165)),
                           new Font("Calibri", 9F, FontStyle.Bold),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetCostDataHeaderText(StiHeaderBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(14.7, 0, 2.1, 0.4),
                           true,
                           StiTextHorAlignment.Center,
                           "CostDataHeaderText",
                           GetCostHeaderValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.FromArgb(255, 165, 165, 165)),
                           new Font("Calibri", 9F, FontStyle.Bold),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetClaimDataHeaderText(StiHeaderBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(12.6, 0, 2.1, 0.4),
                           true,
                           StiTextHorAlignment.Center,
                           "ClaimDataHeaderText",
                           GetClaimHeaderValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.FromArgb(255, 165, 165, 165)),
                           new Font("Calibri", 9F, FontStyle.Bold),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetPaymentDataHeaderText(StiHeaderBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(10.5, 0, 2.1, 0.4),
                           true,
                           StiTextHorAlignment.Center,
                           "PaymentDataHeaderText",
                           GetPaymentHeaderValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.FromArgb(255, 165, 165, 165)),
                           new Font("Calibri", 9F, FontStyle.Bold),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetPostingDataHeaderText(StiHeaderBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(1.8, 0, 8.7, 0.4),
                           true,
                           StiTextHorAlignment.Left,
                           "PostingDataHeaderText",
                           GetPostingHeaderValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.FromArgb(255, 165, 165, 165)),
                           new Font("Calibri", 9F, FontStyle.Bold),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetVoucherDateDataText(StiDataBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(0, 0, 1.8, 0.4),
                           true,
                           StiTextHorAlignment.Left,
                           "VoucherDateDataText",
                           GetVoucherDateDataValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255,255,255,255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 9F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetBalanceDataText(StiDataBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(18.9, 0, 2.1, 0.4),
                           true,
                           StiTextHorAlignment.Right,
                           "BalanceDataText",
                           GetBalanceDataValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 9F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetRateDataText(StiDataBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(16.8, 0, 2.1, 0.4),
                           true,
                           StiTextHorAlignment.Right,
                           "RateDataText",
                           GetRateDataValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 9F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetCostDataText(StiDataBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(14.7, 0, 2.1, 0.4),
                           true,
                           StiTextHorAlignment.Right,
                           "CostDataText",
                           GetCostDataValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 9F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetClaimDataText(StiDataBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(12.6, 0, 2.1, 0.4),
                           true,
                           StiTextHorAlignment.Right,
                           "ClaimDataText",
                           GetClaimDataValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 9F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetPaymentDataText(StiDataBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(10.5, 0, 2.1, 0.4),
                           true,
                           StiTextHorAlignment.Right,
                           "PaymentDataText",
                           GetPaymentDataValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 9F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetPostingDataText(StiDataBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(1.8, 0, 8.7, 0.4),
                           true,
                           StiTextHorAlignment.Left,
                           "PostingDataText",
                           GetPostingDataValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None | StiBorderSides.Left | StiBorderSides.Right, Color.FromArgb(255, 255, 255, 255), 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 9F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetBalanceDataFooterText(StiFooterBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(18.9, 0.4, 2.1, 0.4),
                           true,
                           StiTextHorAlignment.Right,
                           "BalanceDataFooterText",
                           GetBalanceFooterValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 9F),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }

        private StiText GetSumTextDataFooterText(StiFooterBand band, StiPage page)
        {
            return GetText(
                           band,
                           page,
                           true,
                           new RectangleD(0, 0.4, 18.9, 0.4),
                           true,
                           StiTextHorAlignment.Right,
                           "SumDataFooterText",
                           GetSumTextFooterValue(),
                           StiVertAlignment.Center,
                           new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black), false),
                           new StiSolidBrush(Color.Transparent),
                           new Font("Calibri", 9F, FontStyle.Bold),
                           new StiMargins(0, 0, 0, 0),
                           new StiSolidBrush(Color.Black),
                           new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None));
        }
        #endregion

        #region Values
        private string GetHeadValue()
        {
            return "Forderungsaufstellung";
        }

        private string GetInCaseValue()
        {
            return "In Sachen:";
        }

        private string GetClientAndIncidentNumberValue()
        {
            return string.Format("{0}\r\nVorgangsnummer: {1}", claimHeadBO.Client, claimHeadBO.FullIncidentNumber);
        }

        private string GetAgainstValue()
        {
            return "gegen:";
        }

        private string GetDebtorValue()
        {
            return claimHeadBO.Debtor;
        }

        private string GetDateValue()
        {
            return string.Format("Datum: {0}", DateTime.Now.ToShortDateString());
        }

        private string GetPageValue()
        {
            return "{PageNofM}";
        }

        private string GetVoucherDateDataValue()
        {
            return claimListBO.Date.ToShortDateString();
        }

        private string GetBalanceDataValue()
        {
            return claimListBO.BalanceAmount.HasValue ? string.Format("{0:C}", claimListBO.BalanceAmount.Value) : string.Empty;
        }

        private string GetRateDataValue()
        {
            return claimListBO.RateAmount.HasValue ? string.Format("{0:C}", claimListBO.RateAmount.Value) : string.Empty;
        }

        private string GetCostDataValue()
        {
            return claimListBO.CostAmount.HasValue ? string.Format("{0:C}", claimListBO.CostAmount.Value) : string.Empty;
        }

        private string GetClaimDataValue()
        {
            return claimListBO.ClaimAmount.HasValue ? string.Format("{0:C}", claimListBO.ClaimAmount.Value) : string.Empty;
        }

        private string GetPaymentDataValue()
        {
            return claimListBO.PaymentAmount.HasValue ? string.Format("{0:C}", claimListBO.PaymentAmount.Value) : string.Empty;
        }

        private string GetPostingDataValue()
        {
            return claimListBO.PostingText;
        }

        private string GetVoucherDateHeaderValue()
        {
            return "Datum";
        }

        private string GetBalanceHeaderValue()
        {
            return "Saldo";
        }

        private string GetRateHeaderValue()
        {
            return "Zinsen";
        }

        private string GetCostHeaderValue()
        {
            return "Kosten";
        }

        private string GetClaimHeaderValue()
        {
            return "Hauptforderung";
        }

        private string GetPaymentHeaderValue()
        {
            return "Zahlung";
        }

        private string GetPostingHeaderValue()
        {
            return "Buchungstext";
        }

        private string GetBalanceFooterValue()
        {
            decimal balance = 0;

            balance = mList.Sum(c => c.ClaimAmount.HasValue ? c.ClaimAmount.Value : 0)
                        + mList.Sum(c => c.CostAmount.HasValue ? c.CostAmount.Value : 0)
                        + mList.Sum(c => c.RateAmount.HasValue ? c.RateAmount.Value : 0)
                        - mList.Sum(c => c.PaymentAmount.HasValue ? c.PaymentAmount.Value : 0);


            return string.Format("{0:C}", balance);
        }

        private string GetSumTextFooterValue()
        {
            return "Gesamtforderung aus Salden";
        }
        #endregion

        private void DataBand_Rendering(object sender, System.EventArgs e)
        {
            try
            {
            }
            catch (System.Exception ex)
            {
                StiLogService.Write(this.GetType(), "DataBand1 RenderingEvent Text22_Sum ...ERROR");
                StiLogService.Write(this.GetType(), ex);
            }
        }
    }
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Datanband gets only first entry

Post by HighAley »

Hello.

Sorry, we need to reproduce the issue to help you.
Could you send us a working sample project?

Thank you.
DeSchneller
Posts: 12
Joined: Mon Oct 31, 2011 4:58 am
Location: Germany

Re: Datanband gets only first entry

Post by DeSchneller »

Hi may i upload here (how) or how can i give it to you?
DeSchneller
Posts: 12
Joined: Mon Oct 31, 2011 4:58 am
Location: Germany

Re: Datanband gets only first entry

Post by DeSchneller »

heres the project
Attachments
NotFilledDataBand.zip
(449.12 KiB) Downloaded 216 times
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Datanband gets only first entry

Post by HighAley »

Hello.

Please, open your report in the Designer and look at the text components on the Data Band.
They have static values. But there should be column names.
Band.png
Band.png (12.51 KiB) Viewed 3577 times
Thank you.
DeSchneller
Posts: 12
Joined: Mon Oct 31, 2011 4:58 am
Location: Germany

Re: Datanband gets only first entry

Post by DeSchneller »

Hi have no designer Source. The Values in the Screenshot you are posting is the first entry in the Businessobject from the solution (i have entered because u have no DB Access to my Database). The Report is only generated by the code of the solution, not in the designer.
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Datanband gets only first entry

Post by HighAley »

Hello.

You should use the column names in these texts. Like, {DataSource.Column}
But you are adding the value of this column instead of on its name.

Thank you.
Post Reply