//
        //-------------------------------------------------
        // getResult
        //-------------------------------------------------
        //
        public string getHtml(CPBaseClass cp)
        {
            string result  = "";
            string row     = "";
            string rowList = "";
            int    rowPtr  = 0;
            int    colPtr  = 0;
            string styleClass;
            string content;
            string userErrors;
            string returnHeadJs = "";
            string jsonData     = "";
            string jsonRow      = "";
            string chartHtmlId  = "afwChart" + GnericController.getRandomHtmlId(cp);
            string captionColumn;
            string clickLink;

            //
            // add user errors
            //
            userErrors = cp.Utils.EncodeText(cp.UserError.GetList());
            if (userErrors != "")
            {
                warning = userErrors;
            }
            //
            // headers
            //
            jsonRow = "'" + localXAxisCaption + "'";
            rowList = "";
            if (gridIncludesCaptionColumn)
            {
                rowList += Constants.cr + "<th>" + localXAxisCaption + "</th>";
            }
            for (colPtr = 0; colPtr <= columnMax; colPtr++)
            {
                styleClass = columns[colPtr].captionClass;
                if (styleClass != "")
                {
                    styleClass = " class=\"" + styleClass + "\"";
                }
                content = columns[colPtr].caption;
                if (content == "")
                {
                    content = "&nbsp;";
                }
                rowList += Constants.cr + "<th" + styleClass + ">" + content + "</th>";
                jsonRow += ",'" + content + "'";
            }
            jsonData = Constants.cr + "[" + jsonRow + "]";
            if (gridIncludeHeaderRow)
            {
                result += ""
                          + Constants.cr + "<thead>"
                          + Constants.cr2 + "<tr>"
                          + indent(indent(rowList))
                          + Constants.cr2 + "</tr>"
                          + Constants.cr + "</thead>"
                          + "";
            }
            //
            // body
            //
            rowList = "";
            if (localIsEmptyReport)
            {
                styleClass = columns[0].cellClass;
                if (styleClass != "")
                {
                    styleClass = " class=\"" + styleClass + "\"";
                }
                row      = Constants.cr + "<td style=\"text-align:left\" " + styleClass + " colspan=\"" + (columnMax + 1) + "\">[empty]</td>";
                rowList += ""
                           + Constants.cr + "<tr>"
                           + indent(row)
                           + Constants.cr + "</tr>";
            }
            else
            {
                for (rowPtr = 0; rowPtr <= rowCnt; rowPtr++)
                {
                    row = "";
                    //
                    // first column is a text caption
                    //
                    jsonRow = "'" + rows[rowPtr].caption + "'";
                    if (gridIncludesCaptionColumn)
                    {
                        captionColumn = rows[rowPtr].caption;
                        if (captionColumn == "")
                        {
                            captionColumn = "&nbsp;";
                        }
                        row += Constants.cr + "<th class=\"" + rows[rowPtr].captionClass + "\">" + captionColumn + "</th>";
                    }
                    //
                    // additional columns are numeric
                    //
                    for (colPtr = 0; colPtr <= columnMax; colPtr++)
                    {
                        styleClass = columns[colPtr].cellClass;
                        if (styleClass != "")
                        {
                            styleClass = " class=\"" + styleClass + "\"";
                        }
                        clickLink = barData[rowPtr, colPtr].clickLink;
                        if (clickLink == "")
                        {
                            row += Constants.cr + "<td" + styleClass + ">" + barData[rowPtr, colPtr].height + "</td>";
                        }
                        else
                        {
                            row += Constants.cr + "<td" + styleClass + " onclick=\"location.href='" + clickLink + "';\" style=\"cursor:pointer;\">" + barData[rowPtr, colPtr].height + "</td>";
                        }
                        jsonRow += "," + barData[rowPtr, colPtr].height;
                    }
                    jsonData += Constants.cr + ",[" + jsonRow + "]";
                    if (rowPtr % 2 == 0)
                    {
                        styleClass = "";
                    }
                    else
                    {
                        styleClass = " class=\"afwOdd\"";
                    }
                    rowList += ""
                               + Constants.cr + "<tr" + styleClass + ">"
                               + indent(row)
                               + Constants.cr + "</tr>";
                }
            }
            result += ""
                      + Constants.cr + "<tbody>"
                      + indent(rowList)
                      + Constants.cr + "</tbody>"
                      + "";
            result = ""
                     + Constants.cr + "<table class=\"afwListReportTableCollapse\">"
                     + indent(result)
                     + Constants.cr + "</table>";
            result = ""
                     + Constants.cr + "<div class=\"afwGridCon\">"
                     + indent(result)
                     + Constants.cr + "</div>";
            //
            // bar chart
            //
            result = Constants.cr + "<div id=\"" + chartHtmlId + "\" class=\"afwChartCon\" style=\"width:" + localChartWidth.ToString() + "px; height:" + localChartHeight.ToString() + "px;\"></div>" + result;
            //
            if (localHtmlLeftOfTable != "")
            {
                result = ""
                         + Constants.cr + "<div class=\"afwLeftSideHtml\">"
                         + indent(localHtmlLeftOfTable)
                         + Constants.cr + "</div>"
                         + Constants.cr + "<div class=\"afwRightSideHtml\">"
                         + indent(result)
                         + Constants.cr + "</div>"
                         + Constants.cr + "<div style=\"clear:both\"></div>"
                         + "";
            }
            if (localHtmlBeforeTable != "")
            {
                result = ""
                         + localHtmlBeforeTable
                         + result
                         + "";
            }
            if (localHtmlAfterTable != "")
            {
                result = ""
                         + result
                         + localHtmlAfterTable
                         + "";
            }
            //
            // headers
            //
            if (localDescription != "")
            {
                result = Constants.cr + "<p id=\"afwDescription\">" + localDescription + "</p>" + result;
            }
            if (localWarning != "")
            {
                result = Constants.cr + "<div id=\"afwWarning\">" + localWarning + "</div>" + result;
            }
            if (localTitle != "")
            {
                result = Constants.cr + "<h2 id=\"afwTitle\">" + localTitle + "</h2>" + result;
            }
            //
            // add form
            //
            if (localIncludeForm)
            {
                if (localButtonList != "")
                {
                    localButtonList = ""
                                      + Constants.cr + "<div class=\"afwButtonCon\">"
                                      + indent(localButtonList)
                                      + Constants.cr + "</div>";
                }
                result = Constants.cr + cp.Html.Form(localButtonList + result + localButtonList + localHiddenList, "", "", "", localFormActionQueryString, "");
                //body = ""
                //    + cr + cp.Html.Form( localButtonList + body + localHiddenList )
                //    + cr + "<form action=\"" + localFormAction + "\" method=\"post\" enctype=\"MULTIPART/FORM-DATA\">"
                //    + indent(localButtonList + body + localHiddenList)
                //    + cr + "</form>";
            }
            if (_includeBodyPadding)
            {
                result = cp.Html.div(result, "", "afwBodyPad", "");
            }
            ;
            if (_includeBodyColor)
            {
                result = cp.Html.div(result, "", "afwBodyColor", "");
            }
            ;
            //
            // if outer container, add styles and javascript
            //
            if (localIsOuterContainer)
            {
                cp.Doc.AddHeadJavascript(Properties.Resources.javascript);
                cp.Doc.AddHeadStyle(Properties.Resources.styles);
                result = ""
                         + Constants.cr + "<div id=\"afw\">"
                         + indent(result)
                         + Constants.cr + "</div>";
            }
            returnHeadJs += ""
                            + Constants.cr + "google.load(\"visualization\", \"1\", {packages:[\"corechart\"]});"
                            + Constants.cr + "google.setOnLoadCallback(drawChart);"
                            + Constants.cr + "function drawChart() {"
                            + Constants.cr + "var data = google.visualization.arrayToDataTable([" + jsonData + "]);"
                            + Constants.cr + "var options={title:'" + localTitle + "',hAxis:{title:'" + localXAxisCaption + "',titleTextStyle:{color: 'red'}}};"
                            + Constants.cr + "var chart = new google.visualization.ColumnChart(document.getElementById('" + chartHtmlId + "'));"
                            + Constants.cr + "chart.draw(data, options);"
                            + Constants.cr + "}";
            result      += "<script Language=\"JavaScript\" type=\"text/javascript\">" + returnHeadJs + "</script>";
            returnHeadJs = "";
            //
            // -- set the optional title of the portal subnav
            if (!string.IsNullOrEmpty(portalSubNavTitle))
            {
                cp.Doc.SetProperty("portalSubNavTitle", portalSubNavTitle);
            }
            return(result);
        }
        //
        //-------------------------------------------------
        /// <summary>
        /// getResult
        /// </summary>
        /// <param name="cp"></param>
        /// <returns></returns>
        //
        public string getHtml(CPBaseClass cp)
        {
            //
            // add user errors
            //
            string userErrors = cp.Utils.EncodeText(cp.UserError.GetList());

            if (userErrors != "")
            {
                warning = userErrors;
            }
            //
            // headers
            //
            string gridRowList = "";

            gridRowList += "<th>" + gridCaptionHeader + "</th>";
            gridRowList += "<th>" + gridValueHeader + "</th>";
            gridRowList += "<th>%</th>";
            gridRowList  = ""
                           + "<thead>"
                           + "<tr>"
                           + gridRowList
                           + "</tr>"
                           + "</thead>"
                           + "";
            string jsonData = "";
            double total    = 0;

            //---
            //
            // body
            //
            if (localIsEmptyReport)
            {
            }
            else
            {
                //
                // -- first row of data is the captions
                jsonData += ",['" + gridCaptionHeader + "','" + gridValueHeader + "']";
                int rowPtr = 0;
                for (rowPtr = 0; rowPtr <= rowCnt; rowPtr++)
                {
                    //
                    // -- calcuate the totals
                    total += row[rowPtr].value;
                }
                for (rowPtr = 0; rowPtr <= rowCnt; rowPtr++)
                {
                    string gridRow = "";
                    //
                    // -- first column is a text caption
                    if (gridIncludesCaptionColumn)
                    {
                        string captionColumn = row[rowPtr].caption;
                        if (captionColumn == "")
                        {
                            captionColumn = "&nbsp;";
                        }
                        gridRow += "<th class=\"" + gridCaptionClass + "\">" + captionColumn + "</th>";
                    }
                    //
                    // -- additional columns are numeric
                    gridRow += "<td class=\"" + localgridValueClass + "\">" + row[rowPtr].value.ToString() + "</td>";
                    string percentText = "";
                    if (total > 0)
                    {
                        percentText = (row[rowPtr].value / total).ToString("p1");
                    }
                    else
                    {
                        percentText = "n/a";
                    }
                    gridRow += "<td class=\"" + localgridValueClass + "\">" + percentText + "</td>";
                    string gridRowClass = "";
                    if (rowPtr % 2 == 0)
                    {
                        gridRowClass = "";
                    }
                    else
                    {
                        gridRowClass = " class=\"afwOdd\"";
                    }
                    gridRowList += ""
                                   + "<tr" + gridRowClass + ">"
                                   + gridRow
                                   + "</tr>";
                    jsonData += ",['" + row[rowPtr].caption + "', " + row[rowPtr].value + "]";
                }
            }
            if (jsonData != "")
            {
                jsonData     = jsonData.Substring(1);
                gridRowList += ""
                               + "<tfoot>"
                               + "<tr>"
                               + "<th class=\"" + gridCaptionClass + "\">Total</th>"
                               + "<td class=\"" + gridValueClass + "\">" + total + "</td>"
                               + "<td class=\"" + gridValueClass + "\">&nbsp;</td>"
                               + "</tr>"
                               + "</tfoot>"
                               + "";
            }
            string grid = "";

            grid += ""
                    + "<tbody>"
                    + gridRowList
                    + "</tbody>"
                    + "";
            grid = ""
                   + "<table class=\"afwListReportTableCollapse\">"
                   + grid
                   + "</table>";
            grid = ""
                   + "<div class=\"afwGridCon\">"
                   + grid
                   + "</div>";
            string chartHtmlId = "afwChart" + GnericController.getRandomHtmlId(cp);
            string result      = ""
                                 + "<div class=\"afwChartCon\" style=\"width:" + chartWidth + "px;\">"
                                 + "<div id=\"" + chartHtmlId + "\"></div>"
                                 + "</div>";

            if (includeDataTable)
            {
                result += "<div class=\"afwGridCon\">" + grid + "</div>";
            }
            result = "<div class=\"afwPieCon\">" + result + "</div>";
            if (localFilterListItems != "")
            {
                htmlLeftOfTable += ""
                                   + cp.Html.ul("<h3>Filter Options</h3>" + localFilterListItems, "", "afwFilterList")
                                   + "";
            }
            if (htmlLeftOfTable != "")
            {
                result = ""
                         + "<div class=\"afwLeftSideHtml\">"
                         + htmlLeftOfTable
                         + "</div>"
                         + "<div class=\"afwRightSideHtml\">"
                         + result
                         + "</div>"
                         + "<div style=\"clear:both\"></div>"
                         + "";
            }
            if (htmlBeforeTable != "")
            {
                result = ""
                         + htmlBeforeTable
                         + result
                         + "";
            }
            if (htmlAfterTable != "")
            {
                result = ""
                         + result
                         + htmlAfterTable
                         + "";
            }
            //
            // headers
            //
            if (description != "")
            {
                result = "<p id=\"afwDescription\">" + description + "</p>" + result;
            }
            if (warning != "")
            {
                result = "<div id=\"afwWarning\">" + warning + "</div>" + result;
            }
            if (title != "")
            {
                result = "<h2 id=\"afwTitle\">" + title + "</h2>" + result;
            }
            //
            // add form
            //
            if (localIncludeForm)
            {
                if (localButtonList != "")
                {
                    localButtonList = ""
                                      + "<div class=\"afwButtonCon\">"
                                      + (localButtonList)
                                      + "</div>";
                }
                result = cp.Html.Form(localButtonList + result + localButtonList + localHiddenList, "", "", "", localFormActionQueryString, "");
            }
            if (includeBodyPadding)
            {
                result = cp.Html.div(result, "", "afwBodyPad", "");
            }
            ;
            if (includeBodyColor)
            {
                result = cp.Html.div(result, "", "afwBodyColor", "");
            }
            ;
            string returnHeadJs = "<script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>";

            returnHeadJs += ""
                            + "<script Language=\"JavaScript\" type=\"text/javascript\">"
                            + "google.charts.load('current', {'packages':['corechart']});"
                            + "google.charts.setOnLoadCallback(drawChart);"
                            + "function drawChart() {"
                            + "var data = google.visualization.arrayToDataTable([" + jsonData + "]);"
                            + "var options = {'title':'" + chartTitle + "','width':" + chartWidth + ",'height':" + chartHeight + "};"
                            + "var chart = new google.visualization.PieChart(document.getElementById('" + chartHtmlId + "'));"
                            + "chart.draw(data, options);"
                            + "}"
                            + "</script>";
            result      += returnHeadJs;
            returnHeadJs = "";
            //
            // if outer container, add styles and javascript
            //
            if (isOuterContainer)
            {
                cp.Doc.AddHeadStyle(Properties.Resources.styles);
                result = ""
                         + "<div id=\"afw\">"
                         + result
                         + "</div>";
            }
            //
            // -- set the optional title of the portal subnav
            if (!string.IsNullOrEmpty(portalSubNavTitle))
            {
                cp.Doc.SetProperty("portalSubNavTitle", portalSubNavTitle);
            }
            return(result);
        }