How to Create a Payroll Application Using .NET Tablix Reporting Controls

There is no need to recount the need for payroll reports, especially during the tax season. Every organization that maintains payroll needs to be able to generate its payroll reports either on a schedule or on-demand. ActiveReports can be used as an out-of-the-box payroll generator for .NET and JavaScript applications. All you need to do is create a layout and render that report on demand for a clean payroll report.

To create a Detailed Payroll Report, we will do the following:

  • Use an ActiveReports.NET Report Designer
  • Bind to a JSON dataset
  • Use the Tablix control for layout
  • Preview

By doing so, we will produce the following result:

result

 

Use an ActiveReports.NET Report Designer

ActiveReports.NET has several designer applications targeting different user groups. For non-technical report authors, such as end-user report designers, we have a web-based report designer with a simplified UI and report design experience. We have the Visual Studio integrated report designer and a standalone report designer for more technical report authors. In this blog, we will use the latter.

With the ActiveReports.NET Report Designer launched, we will create a new RDL report type.

designer

Let's quickly change the PageOrientation to Landscape and the page's Margins:

landscape

Bind to a JSON dataset

Of course, your data can come directly from a relational database, a flat file, or a JSON endpoint. For this example, we will use a URL to retrieve our data. To bind to a dataset, we'll right-click on Data Sources in the Report Explorer and select Add Data Source. With the Report Data Source dialog box open, set the Type and Connection properties as follows, then click OK:

json

You should see a payroll node under Data Sources in your Report Explorer. Right-click on the payroll node and select Add a Data Set. In the resulting DataSet dialog box, enter the appropriate query to retrieve the data. In our case, we will use: $.[*].

Use Tablix Control for Layout

The Tablix is an advanced control, a cross between a Table and a Matrix. It allows for both row and column grouping and aggregation. One of the unique features of the Tablix is its ability to create child groups and adjacent groups.

In our example, we will group our data by Quarter (QTD) and Year (YTD) using adjacent column groups. The Tablix also has a dedicated Group Editor panel to help manage groups.

Drag and drop the Tablix to the report design surface. Open the Group Editor panel and select the Tablix1_RowGroup1 from the Row Groups. In the Properties panel, expand Group and click on the GroupExpressions ellipsis. Select a field in the Expression property to group by then click OK. In this case, I'm grouping by EmployeeID:

tablix

With the Group Editor still open, select the Tablix1_ColumnGroup1 from the Column Groups. Again, click on the GroupExpressions ellipsis to launch the Expression Collection Editor. Use the Quarter() expression to group by calendar year quarter:

tablix

This will represent our QuarterToDate grouping. Since we're also grouping by YearToDate, we will add an adjacent column group to the Tablix.

Click the '+' icon next to Tablix1_ColumnGroup1 and select Add Group > Adjacent Right

group

Select the Tablix1_ColumnGroup2 and click on the GroupExpressions ellipsis in the properties panel to launch the Expression Collection Editor. This time, we'll use the Year() expression to group by calendar year: =Year(Fields!payStart.Value).

At this point, the Tablix is grouped to show QuarterToDate (QTD) and YearToDate (YTD) info per employee. Next, we'll add some static rows and columns to each group. Add seven static rows to the Tablix by right-clicking on the row header and selecting Insert Row > Inside Group - Below.

row

We'll add two static columns to each column group by right-clicking on the QTD and YTD column headers and selecting Insert Column > Inside Group - Right. Format each column and header, so your Tablix looks like this:

column

Now, we must use aggregates to calculate each value. Hover over each cell to display the Field Selectors. Click on the Selectors to choose your field. This will automatically add an aggregation expression to your cell. We will create the following layout:

column

That's it. Now, when we preview this report, we get the result we were looking for:

result

Download the sample from the link below. Payroll.rdlx

If you don't yet have ActiveReports.NET installed, or are looking for a dynamic payroll report generator for your .NET applications, click on this link to download a 30-day free trial of ActiveReports.NET. https://www.grapecity.com/activereportsnet/download

Tags:

comments powered by Disqus