Click here to Skip to main content
15,885,278 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.
<html>
<head>
    <title>Sales by category</title>
    <link id='Link2' href='Reports.css' rel='STYLESHEET' type='text/css' />
    <style>
        BODY, TD
        {
            font-family: Arial;
            font-size: small;
        }
        .ReportFormatDDL
        {
            font-size: xx-small;
        }
        .rowclass_odd
        {
            background-color: gray;
        }
        .rowclass_even
        {
            background-color: lightblue;
        }
        #title
        {
            color: Green;
        }
        #subtitle
        {
            color: orange;
        }
    </style>
</head>
<body>
    <div id="title" align="center">
        Sales by category</div>
    <div id="subtitle" align="center">
        (@@@Start_Date@@@ - @@@End_Date@@@)</div>
    <table align="center">
        <tr>
            <td>
                <div style="width: 150px;">
                </div>
            </td>
            <td valign="center">
                <div id="chart" ChartType="donut" width="300" height="300" xcol="2" ycol="3"
                    onclick="ShowMenuEvent(event);" style="cursor: hand;">
                    <table align="center">
                        <tr>
                            <td>
                                Chart appears here
                            </td>
                        </tr>
                    </table>
                </div>
            </td>
            <td valign="center">
                <iframe src='Reporter.aspx?path=MSSQL$Sales$Manager$Sales_by_Customer_ThumbNail_en.html&amp;format=html&amp;Start_Date=@@@Start_Date@@@&amp;End_Date=@@@End_Date@@@'
                    style="width: 150px; height: 300px;" frameborder="0" scrolling="no" marginheight="0"
                    marginwidth="0"></iframe>
            </td>
        </tr>
    </table>
    <table id="table" border="1" style="border-collapse: collapse" align="center">
        <thead>
            <tr>
                <td>
                </td>
                <td style="font-weight: bold">
                    Category
                </td>
                <td style="font-weight: bold">
                    Sales
                </td>
            </tr>
        </thead>
        <tbody>
            <tr class="rowclass_odd" onclick="ShowMenu(this, '@@@1@@@');" style="cursor: hand;">
                <td>
                    @@@row@@@)
                </td>
                <td style="font-weight: bold">
                    @@@2@@@
                </td>
                <td align="right">
                    <b>$</b>@@@3@@@
                </td>
            </tr>
            <tr class="rowclass_even" onclick="ShowMenu(this, '@@@1@@@');" style="cursor: hand;">
                <td>
                    @@@row@@@)
                </td>
                <td style="font-weight: bold">
                    @@@2@@@
                </td>
                <td align="right">
                    <b>$</b>@@@3@@@
                </td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <td>
                </td>
                <td>
                    Totals
                </td>
                <td formula="sum">
                    <b>$</b>@@@3@@@
                </td>
            </tr>
        </tfoot>
    </table>
    <table align="center">
        <tr>
            <td>
                <select name="format" onchange="document.forms[0].submit();">
                    <option value="">Export to ...</option>
                    <option value="xls">excel</option>
                    <option value="xml">xml</option>
                </select>
            </td>
        </tr>
    </table>
    <div id="menu" class="DDL_Menu" style="position: absolute; top: 300; left: 0; display: block;
        width: 300px" onclick="CloseMenu();" runat="server">
        <fieldset style="background-color: lightblue;">
            <legend style="color: black">Drill-down menu  </legend>
            <table id="menutable">
                <tr>
                    <td>
                        <a style="color: black; text-decoration: none" onclick="return(DoDrillDown(this));"
                            href="Reporter.aspx?path=MSSQL$Sales$Manager$Sales_by_Product_by_Specific_Category_en.html&amp;Category=@@@1@@@"
                            target="_blank">Sales by Products by Specific Category</a>
                    </td>
                </tr>
                <tr>
                    <td>
                        <a style="color: black; text-decoration: none" onclick="return(DoDrillDown(this));"
                            href="Reporter.aspx?path=MSSQL$Sales$Manager$Sales_by_Customer_by_Specific_Category_en.html&amp;Category=@@@1@@@"
                            target="_blank">Sales by Customer by Specific Category</a>
                    </td>
                </tr>
            </table>
        </fieldset>
    </div>

    <script>
        document.getElementById("menu").style.display="none";
    </script>

</body>
<div style="display: none">
    <div id="parameters">
        <parameter name="Start_Date" type="date" default="1993/01/01" />
        <parameter name="End_Date" type="date" default="2009/01/01" />
    </div>
    <div id="data">
        <series sql="EXEC Report$Sales$Manager$Sales_by_Category_en @Start_Date='@@@Start_Date@@@', @End_Date='@@@End_Date@@@'" />
    </div>
</div>
</html>

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