CHAPTER 7 USING CUSTOM .NET CODE WITH REPORTS
Note In this chapter’s example, we’ll use a slightly modified version of the report created in Chapter 6 so that
the employee report parameter will include a treatment with enough patients who have exceeded the maximum
number of visits and average cost.
Using the ExceedMaxCosts Function
Listing 7-1 is the full listing of the custom code that you will add to the Employee Service Cost report. It is
a simple function, called ExceedMaxCost, which determines whether a certain treatment type has
exceeded an average cost over some period of time. This allows you to identify cases for review to
determine why they have such a high cost of services.
Listing 7-1. The ExceedMaxCost Function
Function ExceedMaxCost(ByVal visitCount As Integer, ByVal estCost As Integer) As Boolean
' Our businesses logic dictates that we need to know whether
' the average cost per visit exceeds a certain value but only when the visit
' count is greater than 10
If ( visitCount > 10)
If (estCost/visitCount > 45)
Return True
End If
End If
Return False
End Function
If you are following along with the code in the book, you will need to create a new Visual Studio 2010
BI project, selecting the Reporting Services subcategory and Report Server Project type, as shown in
Figure 7-1. For this example, call the solution Chapter 7 and the project Reports.
Note BIDS is now built directly into Visual Studio with the release of SQL Server 2012. Whether you are
creating this from BIDS or from Visual Studio, the resulting project and solution will be the same.