SBD.GL General Ledger: Part 4 Report


Now it is time to add a report
Lets start with a profit and loss, which is always over a period of time.

I followed the steps to create my initial report
Strangely not all the properties of the Transaction class appear in the field list.

I found to make a field visible in the report designer, I had to not use [Browseable(false)]

       // [Browsable(false)]
        public Decimal Amount { get; set; }

After messing around a bit I got

So how to resolve that?
I guess I will try deleting the assignment

   this.collectionDataSource1.ObjectTypeName = "SBD.GL.Module.BusinessObjects.Transaction";

Er and close all the windows

Now I can open the designer again.

I am going to try things a different way



I need to alter some code

       public override IEnumerable<ModuleUpdater> GetModuleUpdaters(IObjectSpace objectSpace, Version versionFromDB) {
            ModuleUpdater updater = new DatabaseUpdate.Updater(objectSpace, versionFromDB);

            PredefinedReportsUpdater predefinedReportsUpdater =
                new PredefinedReportsUpdater(Application, objectSpace, versionFromDB);
            predefinedReportsUpdater.AddPredefinedReport<PandLReport>("P and L Report", typeof(PandLReportDto));

            return new ModuleUpdater[] { updater, predefinedReportsUpdater };

Looking at my old question


I set up the parameters I wanted using the report properties , parameters collection

and then I added code to the report to set the data source.

  public partial class PandLReport : DevExpress.XtraReports.UI.XtraReport
        public PandLReport()

        private void InitializeParameters()
            if ((DateTime) Parameters[0].Value == DateTime.MinValue)
                var date = DateTime.Today;
                var firstDayOfMonth = new DateTime(date.Year, date.Month, 1);
                Parameters[0].Value = firstDayOfMonth;

            if ((DateTime) Parameters[1].Value == DateTime.MinValue)
                Parameters[1].Value = DateTime.Today;

        protected override void OnParametersRequestSubmit(ParametersRequestEventArgs e)

        private void BindToData()

            var fromDate = (DateTime) this.Parameters[0].Value;
            var toDate = (DateTime) this.Parameters[1].Value  ;
            var results = PandLReportData.PandL(fromDate, toDate);
            DataSource = results;
SBD.GL General Ledger: Part 3

Part 5