private void ShowGrid()
    {
        this.LblFrom.Text = this.cc2DateSelector.StartDate().ToLongDateString();
        this.LblTo.Text = this.cc2DateSelector.EndDate().ToLongDateString();
        this.LblProductive.Text = "";
        this.LblUnproductive.Text = "";
        this.LblProductivePercent.Text = "";

        ClassReport oRep = new ClassReport();
        DataSet oDs = oRep.GetCostCentre(this.cc2DateSelector.StartDate(), this.cc2DateSelector.EndDate());
        double TotalHours = 0.0;
        Boolean bOkay = false;
        double Productive = 0.0;
        double Unproductive = 0.0;

        if (oDs != null)
        {
            if (oDs.Tables.Count > 0)
            {
                if (oDs.Tables[0].Rows.Count > 0)
                {
                    bOkay = true;

                    foreach (DataRow oDr in oDs.Tables[0].Rows)
                    {
                        TotalHours += Convert.ToDouble(oDr["Hours"].ToString());

                        if (oDr["IsProductive"].ToString() == "Yes")
                            Productive += Convert.ToDouble(oDr["Hours"].ToString());
                        else
                            Unproductive += Convert.ToDouble(oDr["Hours"].ToString());
                    }
                }
            }
        }

        ViewState["TotalHours"] = TotalHours.ToString();

        if (bOkay == true)
        {
            this.GridTime.DataSource = oDs;
            this.GridTime.DataBind();
        }
        else
        {
            this.GridTime.DataSource = null;
            this.GridTime.DataBind();
        }

        this.LblProductive.Text = Productive.ToString("N2");
        this.LblUnproductive.Text = Unproductive.ToString("N2");

        if ((Productive + Unproductive) != 0)
        {
            this.LblProductivePercent.Text = string.Format("{0:N2}%", (100 * Productive / (Productive + Unproductive)));
        }
    }
    private void DoExport(Boolean bToCSV)
    {
        ClassReport oRep = new ClassReport();
        DataSet oDs = oRep.GetCostCentre(this.cc2DateSelector.StartDate(), this.cc2DateSelector.EndDate());
        Boolean bOkay = false;

        this.RowError1.Visible = false;
        this.RowError2.Visible = false;

        if (oDs != null)
        {
            if (oDs.Tables.Count > 0)
            {
                if (oDs.Tables[0].Rows.Count > 0)
                {
                    bOkay = true;
                }
            }
        }

        if (bOkay == true)
        {
            RKLib.ExportData.Export oExp = new RKLib.ExportData.Export("Web");

            Int32[] Columns = { 0, 1, 2, 3 };

            if (bToCSV == true)
            {
                //	Export to CSV file.

                oExp.ExportDetails(oDs.Tables[0], Columns, RKLib.ExportData.Export.ExportFormat.CSV, "Report.csv");
            }
            else
            {
                //	Export to Microsoft Excel.

                oExp.ExportDetails(oDs.Tables[0], Columns, RKLib.ExportData.Export.ExportFormat.Excel, "Report.xls");
            }
        }
        else
        {
            this.RowError1.Visible = true;
            this.RowError2.Visible = true;
            this.LblMsg.Text = "No Data Found!";
        }
    }