Click here to Skip to main content
15,881,173 members
Articles / Web Development / ASP.NET

Drilldown Report Writer with Charting

Rate me:
Please Sign up or sign in to vote.
4.38/5 (7 votes)
28 Feb 2010CPOL4 min read 31.3K   872   26  
This article describes a template-driven reporting tool which allows drilldown and charting.
��USE [Northwind]

GO

/****** Object:  StoredProcedure [dbo].[Report$Sales$Manager$Sales_by_Customer_en]    Script Date: 02/24/2010 12:15:15 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE PROCEDURE [dbo].[Report$Sales$Manager$Sales_by_Customer_en]

@Start_Date datetime,

@End_Date datetime

AS

/*

EXEC Report$Sales$Manager$Sales_by_Customer_en @Start_Date='1997/07/16', @End_Date='2009/01/01'

*/

BEGIN

	SET NOCOUNT ON;



	select top 10

		Customers.CustomerID as Ident

		,Customers.CompanyName

		,convert(varchar(40), 

			convert(money,(sum([Order Details].UnitPrice*Quantity*(1-Discount))))

		, 0) as Total

		, sum([Order Details].UnitPrice*Quantity*(1-Discount)) as Total1

	from 

		[Order Details]

	left join 

		Products on Products.ProductID = [Order Details].ProductId

	left join 

		Categories on Categories.CategoryID=Products.CategoryID

	left join 

		Orders on Orders.OrderID = [Order Details].OrderID

	left join 

		Customers on Customers.CustomerID = Orders.CustomerID

	where

		ShippedDate between @Start_Date and @End_Date

	group by

		CompanyName, Customers.CustomerID

	order by

		Total1 desc

END











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)


Written By
Software Developer (Senior)
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions