Click here to Skip to main content
13,630,357 members
Click here to Skip to main content
Articles » Multimedia » GDI+ » General » Downloads

Stats

28K views
1.2K downloads
39 bookmarked
Posted 29 Dec 2012
Licenced CPOL

WPF-Less GDI+.NET Report Component: Star Report

, 25 Jan 2013
StarReport: WPF-less GDI+.NET report component.
UniverseReportDemo
UniverseReport_WithoutPrinter_Project
UniverseReport
mac_button.png
mac_checkbox.png
mac_radiobutton.png
Plex_button.png
Plex_checkbox.png
Plex_radiobutton.png
Properties
Resources
Report1.bmp
StarReport.png
Thumbs.db
UniverseReport.csproj.user
UniverseReport.suo
UpgradeLog.XML
xp1_button.png
xp1_checkbox.png
xp1_radiobutton.png
UniverseReportDemo.suo
UniverseReportDemo
bin
Debug
Properties
mac_button.png
mac_checkbox.png
mac_radiobutton.png
Plex_button.png
Plex_checkbox.png
Plex_radiobutton.png
Report1.bmp
StarReport.png
Thumbs.db
UniverseReport.csproj.user
UniverseReport.suo
UpgradeLog.XML
xp1_button.png
xp1_checkbox.png
xp1_radiobutton.png
UniverseReportDemo.suo
UniverseReport.dll
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using UniverseReport;
using System.Collections.ObjectModel;
using System.Data;
using System.Data.SqlClient;

namespace UniverseReportDemo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void starReport1_Load(object sender, EventArgs e)
        {

        }

        private void btnGenerateReport_Click(object sender, EventArgs e)
        {
            switch (cmbReportList.SelectedIndex)
            {
                case 0:
                    {
                        PrintPatientList();
                    }
                    break;
                case 1:
                    {
                        PrintReferralSourcesPatient();
                    }
                    break;
                case 2:
                    {
                        PrintProviderCases();
                    }
                    break;
                case 3:
                    {
                        DailyPaymentCharges();
                    }
                    break;
                case 4:
                    {
                        InsuranceCarrierAgingReport();
                    }
                    break;
            }
        }

        private void PrintPatientList()
        {
            DataTable table = new DataTable();

            DataSet ds = new DataSet();

            try
            {
                ds.ReadXml("Patients.xml");
                table = ds.Tables[0];
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return;
            }

            sr.Reset();

            sr.Report.Settings.ReportType = ReportType.GeneralList;
            sr.Report.Settings.Header.ReportTitle = "Patient Master List";
            sr.Report.Settings.OutlineTable = true;
            sr.Report.Settings.PrintTableGrid = true;
            sr.Report.Settings.PrintTotalRecords = true;
            sr.Report.Settings.TotalText = "Total Records";
            sr.PageSettings.Landscape = true;


            //NAME
            ColumnCell name = new ColumnCell("Name", 200);
            RowCellInfo nameInfo = new RowCellInfo("Name", 200);
            nameInfo.RowCell.CellFormat.FormatFlags = StringFormatFlags.NoClip;
            nameInfo.RowCell.Font = new Font(nameInfo.RowCell.Font, FontStyle.Bold);
            name.RowCellInfoCollection.Add(nameInfo);


            sr.Report.Data.ColumnCellCollection.Add(name);

            //ID
            ColumnCell id = new ColumnCell("Chart No.", 70);
            RowCellInfo idInfo = new RowCellInfo("ID", 70);
            idInfo.RowCell.DataType = DataType.Int32;
            idInfo.RowCell.FormatString = "D8";
            id.RowCellInfoCollection.Add(idInfo);
            sr.Report.Data.ColumnCellCollection.Add(id);

            //DOB
            ColumnCell dob = new ColumnCell("DOB", 70);
            RowCellInfo dobInfo = new RowCellInfo("DOB", 70);
            dob.RowCellInfoCollection.Add(dobInfo);
            sr.Report.Data.ColumnCellCollection.Add(dob);


            //SOCIAL
            ColumnCell ss = new ColumnCell("SS#");
            RowCellInfo ssInfo = new RowCellInfo("SocialSecurity");
            ss.RowCellInfoCollection.Add(ssInfo);

            //GENDER
            ColumnCell genderCol = new ColumnCell("Gender", 60);
            RowCellInfo genderInfo = new RowCellInfo("Gender", 60);
            genderCol.RowCellInfoCollection.Add(genderInfo);
            sr.Report.Data.ColumnCellCollection.Add(genderCol);

            //PHONE
            ColumnCell phoneCol = new ColumnCell("Phone", 150);
            RowCellInfo phoneInfo = new RowCellInfo("Phone", 150);
            phoneCol.RowCellInfoCollection.Add(phoneInfo);
            sr.Report.Data.ColumnCellCollection.Add(phoneCol);

            //ADDRESS
            ColumnCell addressCol = new ColumnCell("Address", 200);
            RowCellInfo addressInfo = new RowCellInfo("Address", 200);
            addressCol.RowCellInfoCollection.Add(addressInfo);
            sr.Report.Data.ColumnCellCollection.Add(addressCol);

            //CITY
            ColumnCell cityCol = new ColumnCell("City", 150);
            RowCellInfo cityInfo = new RowCellInfo("City", 150);
            cityCol.RowCellInfoCollection.Add(cityInfo);

            sr.Report.Data.ColumnCellCollection.Add(cityCol);

            //STATE
            ColumnCell stateCol = new ColumnCell("State", 40);
            RowCellInfo stateInfo = new RowCellInfo("State", 40);
            stateCol.RowCellInfoCollection.Add(stateInfo);
            sr.Report.Data.ColumnCellCollection.Add(stateCol);

            //Zip
            ColumnCell zipCol = new ColumnCell("Zip", 50);
            zipCol.ExtendToMargin = true;
            RowCellInfo zipInfo = new RowCellInfo("Zip", 50);
            zipCol.RowCellInfoCollection.Add(zipInfo);
            sr.Report.Data.ColumnCellCollection.Add(zipCol);
            zipInfo.RowCell.ExtendToMargin = true;

            sr.GenerateReport(table, PrintPageDisplay.PREVIEW);

        }

        private void PrintReferralSourcesPatient()
        {
            DataTable table = new DataTable();

            DataSet ds = new DataSet();

            try
            {
                ds.ReadXml("PatientReferrals.xml");
                table = ds.Tables[0];
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return;
            }

            sr.Reset();
            sr.PageSettings.Landscape = false;
            sr.Report.Data.ColumnCellCollection.Clear();
            sr.Report.Settings.ReportType = ReportType.Hierachy;
            sr.Report.Settings.Header.ReportTitle = "Referral Sources: Patient";
            sr.Report.Data.Group.Indent = 30;

            RowCellInfo sourceName = new RowCellInfo("Referral Source");
            sourceName.Delta = true;
            sourceName.RowCell.Width = 150;
            sourceName.RowCell.ExtendToMargin = false;
            sourceName.RowCell.Font = new Font(sourceName.RowCell.Font, FontStyle.Bold);



            sourceName.RowCell.Font = new Font("Tahoma", 10, FontStyle.Bold);

            sr.Report.Data.Group.RowCellInfos.Add(sourceName);

            RowCellInfo sourcePhone = new RowCellInfo("RefPhone");
            sourcePhone.RowCell.Font = new Font("Tahoma", 10, FontStyle.Bold);
            sourcePhone.RowCell.ExtendToMargin = true;


            sourcePhone.RowCell.Font = new Font("Tahoma", 10, FontStyle.Bold);

            sr.Report.Data.Group.RowCellInfos.Add(sourcePhone);

            //Column Case
            ColumnCell patientID = new ColumnCell(false, "Patient ID", 100);
            sr.Report.Data.SubGroup.Columns.Add(patientID);

            RowCellInfo patientIDInfo = new RowCellInfo("PatientID");
            patientIDInfo.RowCell.Width = 100;
            patientIDInfo.RowCell.Outline = true;

            patientIDInfo.FunctionType = FunctionType.Count;
            patientIDInfo.RowCell.FormatString = "D8";
            patientIDInfo.RowCell.DataType = DataType.Int32;

            sr.Report.Data.SubGroup.RowCellInfos.Add(patientIDInfo);

            //Column Patient Name
            ColumnCell patientName = new ColumnCell(false, "Patient", 150);

            sr.Report.Data.SubGroup.Columns.Add(patientName);
            RowCellInfo patientNameInfo = new RowCellInfo("Patient", 150);
            sr.Report.Data.SubGroup.RowCellInfos.Add(patientNameInfo);
            patientNameInfo.RowCell.Outline = true;

            //Column Patient SS
            ColumnCell ss = new ColumnCell(false, "SS #", 75);

            sr.Report.Data.SubGroup.Columns.Add(ss);

            RowCellInfo ssInfo = new RowCellInfo("SocialSecurity", 75);
            ssInfo.PrintSummaryLine = true;
            ssInfo.RowCell.Outline = true;

            sr.Report.Data.SubGroup.RowCellInfos.Add(ssInfo);

            //Column Patient Name
            ColumnCell phone = new ColumnCell(false, " Phone #", 150);

            sr.Report.Data.SubGroup.Columns.Add(phone);

            RowCellInfo phoneInfo = new RowCellInfo("Phone", 150);
            phoneInfo.PrintSummaryLine = true;
            phoneInfo.RowCell.Outline = true;

            sr.Report.Data.SubGroup.RowCellInfos.Add(phoneInfo);

            //Column Patient:Date Created
            ColumnCell dateCreated = new ColumnCell(false, " Entered", 150);
            dateCreated.ExtendToMargin = true;


            sr.Report.Data.SubGroup.Columns.Add(dateCreated);

            RowCellInfo dateCreatedInfo = new RowCellInfo("DateCreated");
            dateCreatedInfo.RowCell.ExtendToMargin = true;
            dateCreatedInfo.PrintSummaryLine = true;
            dateCreatedInfo.RowCell.Outline = true;

            sr.Report.Data.SubGroup.RowCellInfos.Add(dateCreatedInfo);

            sr.GenerateReport(table, PrintPageDisplay.PREVIEW);

        }

        private void PrintProviderCases()
        {
            DataTable table = new DataTable();

            DataSet ds = new DataSet();

            try
            {
                ds.ReadXml("ProviderCases.xml");
                table = ds.Tables[0];
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return;
            }


            sr.Reset();
            sr.Report.Settings.ReportType = ReportType.Hierachy;
            sr.Report.Settings.Header.ReportTitle = "Cases By Provider";
            sr.Report.Settings.PrintRowSeparator = true;
            sr.Report.Settings.GroupIndentSpace = 20;


            //Column Provider Name
            ColumnCell providerName = new ColumnCell("Provider", 200);
            RowCellInfo providerNameInfo = new RowCellInfo("Provider", 200);
            providerNameInfo.RowCell.Font = new Font("Tahoma", 10, FontStyle.Bold);

            sr.Report.Data.Group.RowCellInfos.Add(providerNameInfo);


            //Provider ID
            ColumnCell providerID = new ColumnCell("ID", 200);
            RowCellInfo providerIDInfo = new RowCellInfo("ID", 200);
            providerIDInfo.Delta = true;
            providerIDInfo.RowCell.FormatString = "D8";
            providerIDInfo.RowCell.Font = new Font("Tahoma", 10, FontStyle.Bold);

            sr.Report.Data.Group.RowCellInfos.Add(providerIDInfo);

            //Column Case
            ColumnCell ccase = new ColumnCell("Case ID", 100);
            sr.Report.Data.SubGroup.Columns.Add(ccase);

            RowCellInfo ccaseIDInfo = new RowCellInfo("Case ID", 100);
            ccaseIDInfo.FunctionType = FunctionType.Count;
            ccaseIDInfo.PrintSummaryLine = true;
            ccaseIDInfo.RowCell.FormatString = "D8";
            ccaseIDInfo.RowCell.DataType = DataType.Int32;

            sr.Report.Data.SubGroup.RowCellInfos.Add(ccaseIDInfo);

            //Column Case Date Created
            ColumnCell ccaseCreated = new ColumnCell("Created", 150);
            sr.Report.Data.SubGroup.Columns.Add(ccaseCreated);

            RowCellInfo ccaseCreatedInfo = new RowCellInfo("DateCreated", 150);
            sr.Report.Data.SubGroup.RowCellInfos.Add(ccaseCreatedInfo);

            sr.GenerateReport(table, PrintPageDisplay.PREVIEW);

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            cmbReportList.SelectedIndex = 0;
        }

        private void DailyPaymentCharges()
        {
            DataTable table = new DataTable();

            DataSet ds = new DataSet();

            try
            {
                ds.ReadXml("DailyPaymentCharges.xml");
                table = ds.Tables[0];
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return;
            }




            sr.Reset();
            sr.Report.Settings.ReportType = ReportType.GeneralList;
            sr.Report.Settings.Header.ReportTitle = "Daily Charges and Payment";
            sr.Report.Settings.OutlineTable = true;
            sr.Report.Settings.PrintTableGrid = true;
            sr.Report.Settings.PrintTotalRecords = true;
            sr.Report.Settings.TotalText = "Total Records";
            sr.PageSettings.Landscape = false;


            //Code col
            ColumnCell codeCol = new ColumnCell("Date", 150);
            codeCol.CellFormat.Alignment = Alignment.Near;


            RowCellInfo codeInfo = new RowCellInfo("Date", 150);
            codeInfo.RowCell.Font = new Font(codeInfo.RowCell.Font, FontStyle.Bold);

            codeCol.RowCellInfoCollection.Add(codeInfo);
            sr.Report.Data.ColumnCellCollection.Add(codeCol);

            //Mod 3 Col
            ColumnCell mod3Col = new ColumnCell("Charges", 100);
            mod3Col.CellFormat.Alignment = Alignment.Far;
            RowCellInfo mod3Info = new RowCellInfo("Charges", 100);
            mod3Info.RowCell.CellFormat.Alignment = Alignment.Far;
            mod3Info.SetFunction(FunctionType.Summary, DataType.Double);
            mod3Info.SummaryFormatString = "C2";


            mod3Col.RowCellInfoCollection.Add(mod3Info);
            sr.Report.Data.ColumnCellCollection.Add(mod3Col);


            //Mod 1 Col
            ColumnCell mod1Col = new ColumnCell("Payments", 100, true);
            mod1Col.CellFormat.Alignment = Alignment.Far;
            RowCellInfo mod1Info = new RowCellInfo("Payments", 100, true, true);
            mod1Info.RowCell.CellFormat.Alignment = Alignment.Far;
            mod1Info.SetFunction(FunctionType.Summary, DataType.Double);
            mod1Info.SummaryFormatString = "C2";

            mod1Col.RowCellInfoCollection.Add(mod1Info);
            sr.Report.Data.ColumnCellCollection.Add(mod1Col);




            sr.GenerateReport(table, PrintPageDisplay.PREVIEW);


        }

        private void InsuranceCarrierAgingReport()
        {
            DataTable table = new DataTable();

            DataSet ds = new DataSet();

            try
            {
                ds.ReadXml("InsAging.xml");
                table = ds.Tables[0];
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return;
            }


            sr.Reset();
            sr.Report.Settings.ReportType = ReportType.GeneralList;
            sr.Report.Settings.Header.ReportTitle = "Primary Insurance Carrier Aging Report";

            sr.Report.Settings.PrintTableGrid = true;
            sr.PageSettings.Landscape = true;


            ColumnCell carrierCol = new ColumnCell(" INSURANCE CARRIER", 300);
            carrierCol.CellFormat.Alignment = Alignment.Near;


            //id.Width=60;
            RowCellInfo carrierInfo = new RowCellInfo("Name", 300);
            carrierInfo.RowCell.Font = new Font(carrierInfo.RowCell.Font, FontStyle.Bold);


            carrierCol.RowCellInfoCollection.Add(carrierInfo);
            sr.Report.Data.ColumnCellCollection.Add(carrierCol);

            //0-30
            ColumnCell c0_30Col = new ColumnCell(" 0-30 DAYS");


            RowCellInfo c0_30Info = new RowCellInfo("0-30");
            c0_30Info.FunctionType = FunctionType.Summary;
            c0_30Info.PrintSummaryLine = true;
            c0_30Info.RowCell.FormatString = "C";
            c0_30Info.RowCell.DataType = DataType.Double;
            c0_30Info.SummaryLine.Thickness = 4;
            //c0_30Info.RowCell.LeftPadding=1;

            c0_30Col.RowCellInfoCollection.Add(c0_30Info);
            sr.Report.Data.ColumnCellCollection.Add(c0_30Col);

            //31-60
            ColumnCell c31_60Col = new ColumnCell(" 31-60 DAYS");



            RowCellInfo c31_60Info = new RowCellInfo("31-60");
            c31_60Info.FunctionType = FunctionType.Summary;
            c31_60Info.RowCell.FormatString = "C";
            c31_60Info.RowCell.DataType = DataType.Double;
            c31_60Info.PrintSummaryLine = true;
            c31_60Info.SummaryLine.Thickness = 4;


            c31_60Col.RowCellInfoCollection.Add(c31_60Info);
            sr.Report.Data.ColumnCellCollection.Add(c31_60Col);

            //61-90
            ColumnCell c61_90Col = new ColumnCell(" 61-90 DAYS");


            RowCellInfo c61_90Info = new RowCellInfo("61-90");
            c61_90Info.FunctionType = FunctionType.Summary;
            c61_90Info.PrintSummaryLine = true;
            c61_90Info.RowCell.FormatString = "C";
            c61_90Info.RowCell.DataType = DataType.Double;
            c61_90Info.SummaryLine.Thickness = 4;


            c61_90Col.RowCellInfoCollection.Add(c61_90Info);
            sr.Report.Data.ColumnCellCollection.Add(c61_90Col);


            //91-120
            ColumnCell c91_120Col = new ColumnCell(" 91-120 DAYS");


            RowCellInfo c91_120Info = new RowCellInfo("91-120");
            c91_120Info.FunctionType = FunctionType.Summary;
            c91_120Info.RowCell.DataType = DataType.Double;
            c91_120Info.PrintSummaryLine = true;
            c91_120Info.RowCell.FormatString = "C";
            c91_120Info.SummaryLine.Thickness = 4;

            c91_120Col.RowCellInfoCollection.Add(c91_120Info);
            sr.Report.Data.ColumnCellCollection.Add(c91_120Col);

            //120+
            ColumnCell c120PlusCol = new ColumnCell(" 120+ DAYS");



            RowCellInfo c120PlusInfo = new RowCellInfo("120+");
            c120PlusInfo.FunctionType = FunctionType.Summary;
            c120PlusInfo.PrintSummaryLine = true;
            c120PlusInfo.RowCell.FormatString = "C";
            c120PlusInfo.RowCell.DataType = DataType.Double;
            c120PlusInfo.SummaryLine.Thickness = 4;


            c120PlusCol.RowCellInfoCollection.Add(c120PlusInfo);
            sr.Report.Data.ColumnCellCollection.Add(c120PlusCol);

            //Total
            ColumnCell totalCol = new ColumnCell(" TOTAL");
            totalCol.ExtendToMargin = true;
            totalCol.CellFormat.Alignment = Alignment.Far;


            RowCellInfo totalInfo = new RowCellInfo("Total");
            totalInfo.RowCell.ExtendToMargin = true;
            totalInfo.FunctionType = FunctionType.Summary;
            totalInfo.PrintSummaryLine = true;
            totalInfo.RowCell.CellFormat.Alignment = UniverseReport.Alignment.Far;
            totalInfo.RowCell.Font = new Font(totalInfo.RowCell.Font, FontStyle.Bold);
            totalInfo.RowCell.DataType = DataType.Double;
            totalInfo.RowCell.FormatString = "C2";
            totalInfo.SummaryFormatString = "C2";
            totalInfo.SummaryLine.Thickness = 4;

            totalCol.RowCellInfoCollection.Add(totalInfo);
            sr.Report.Data.ColumnCellCollection.Add(totalCol);

            sr.GenerateReport(table, PrintPageDisplay.PREVIEW);


        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

FatCatProgrammer
Software Developer (Senior) Finance Industry
United States United States
Currently pursuing 'Programming Nirvana' (The ineffable ultimate in which one has attained disinterested wisdom and compassion as it relates to programming)

Respected Technologies
1. Confusor (https://confuser.codeplex.com/)
2. Power Threading (http://www.wintellect.com/Resources/visit-the-power-threading-library)
3. EDI Parsers (http://www.rdpcrystal.com)


Acknowledgements:

Microsoft Certified Technologist for WPF and .Net 3.5 (MCTS)
Microsoft Certified Technologist for WCF and .Net 3.5 (MCTS)
Microsoft Certified Application Developer for .Net (MCAD)
Microsoft Certified Systems Engineer (MCSE)
Microsoft Certified Professional (MCP)

Sun Certified Developer for Java 2 Platform (SCD)
Sun Certified Programmer for Java 2 Platform (SCP)
Sun Certified Web Component Developer (SCWCD)

CompTIA A+ Certified Professional

Registered Business School Teacher for Computer Programming and Computer Applications (2004)
(University of the State of New York Education Department)

Graduated from University At Stony Brook

You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02-2016 | 2.8.180712.1 | Last Updated 25 Jan 2013
Article Copyright 2012 by FatCatProgrammer
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid