public iTextSharp.text.Table GenerateCoreReport(String RptDate)
    {
        iTextSharp.text.Table datatable = new iTextSharp.text.Table(10);
        datatable.Padding = 4.0F;
        datatable.Spacing = 0.0F;
        //datatable.setBorder(Rectangle.NO_BORDER);
        int[] headerwidths = { 10, 24, 12, 12, 7, 7, 7, 7, 1, 1 };

        datatable.SetWidths(headerwidths);
        datatable.Width = 100;

        // the first cell spans 10 columns
        Cell cell = new Cell(new Phrase("Daily Production Report For " + RptDate, FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD)));
        cell.HorizontalAlignment = 1;
        cell.Leading = 30;
        cell.Colspan = 10;
        cell.Border =   iTextSharp.text.Rectangle.NO_BORDER;
        cell.BackgroundColor = iTextSharp.text.Color.LIGHT_GRAY;
        datatable.AddCell(cell);

        // These cells span 2 rows
        datatable.DefaultCellBorderWidth = 2;
        datatable.DefaultHorizontalAlignment = 1;
        datatable.DefaultRowspan = 2;
        datatable.AddCell("User Id");
        datatable.AddCell(new Phrase("Name", FontFactory.GetFont(FontFactory.HELVETICA, 14, iTextSharp.text.Font.BOLD)));
        datatable.AddCell("Work order");
        datatable.AddCell("Comments");

        // This cell spans the remaining 6 columns in 1 row
        datatable.DefaultRowspan = 1;
        datatable.DefaultColspan = 6;
        datatable.AddCell("Hours");

        // These cells span 1 row and 1 column
        datatable.DefaultColspan = 1;
        datatable.AddCell("Fab.");
        datatable.AddCell("Finish");
        datatable.AddCell("Eng.");
        datatable.AddCell("Misc.");
        datatable.AddCell("");
        datatable.AddCell("");

        //Here goes the Outer Loop to get the Project Information for the Day.Get the Project Name and display Here.
        whitfield_prod_reports _wproj = new whitfield_prod_reports();
        DataSet _mOuter = _wproj.GetProjectReportOuter(RptDate);
        DataTable dtProject = _mOuter.Tables[0];
        foreach (DataRow dProjRow in dtProject.Rows)
        {
            String _projNumber = dProjRow["TWC_Proj_Number"] == DBNull.Value ? "" : dProjRow["TWC_Proj_Number"].ToString();
            String _projName = dProjRow["ProjName"] == DBNull.Value ? "" : dProjRow["ProjName"].ToString();
            String _rptNumber = dProjRow["twc_report_number"] == DBNull.Value ? "" : dProjRow["twc_report_number"].ToString();

            Cell cell1 = new Cell(new Phrase(_projName + '(' + _projNumber + ')' , FontFactory.GetFont(FontFactory.HELVETICA, 12, iTextSharp.text.Font.BOLD)));
            cell1.HorizontalAlignment = 1;
            cell1.Leading = 30;
            cell1.Colspan = 10;
            cell1.Border = iTextSharp.text.Rectangle.TOP_BORDER;
            cell1.BackgroundColor = iTextSharp.text.Color.LIGHT_GRAY;
            datatable.AddCell(cell1);

            datatable.DefaultCellBorderWidth = 1;
            datatable.DefaultRowspan = 1;

            //Here Goes the Inner Loop for the Employees worked on the Project.
            DataSet _mInner = _wproj.GetProjectReportInner(Convert.ToInt32(_rptNumber), Convert.ToInt32(_projNumber));
            DataTable dtActivity = _mInner.Tables[0];
            foreach (DataRow drActivity in dtActivity.Rows)
            {
                datatable.DefaultHorizontalAlignment = 1;
                datatable.AddCell(drActivity["loginid"] == DBNull.Value ? "" : drActivity["loginid"].ToString());
                datatable.AddCell(drActivity["UName"] == DBNull.Value ? "" : drActivity["UName"].ToString());
                datatable.AddCell(drActivity["Description"] == DBNull.Value ? "" : drActivity["Description"].ToString());
                datatable.AddCell(drActivity["empl_comments"] == DBNull.Value ? "" : drActivity["empl_comments"].ToString());
                datatable.DefaultHorizontalAlignment = 0;
                datatable.AddCell(drActivity["fab_hours"] == DBNull.Value ? "0" : drActivity["fab_hours"].ToString());
                datatable.AddCell(drActivity["fin_hours"] == DBNull.Value ? "0" : drActivity["fin_hours"].ToString());
                datatable.AddCell(drActivity["eng_hours"] == DBNull.Value ? "0" : drActivity["eng_hours"].ToString());
                datatable.AddCell(drActivity["misc_hours"] == DBNull.Value ? "0" : drActivity["misc_hours"].ToString());
                _totFabHours += Convert.ToInt32(drActivity["fab_hours"] == DBNull.Value ? "0" : drActivity["fab_hours"].ToString());
                _totFinHours += Convert.ToInt32(drActivity["fin_hours"] == DBNull.Value ? "0" : drActivity["fin_hours"].ToString());
                _totEngHours += Convert.ToInt32(drActivity["eng_hours"] == DBNull.Value ? "0" : drActivity["eng_hours"].ToString());
                _totMiscHours += Convert.ToInt32(drActivity["misc_hours"] == DBNull.Value ? "0" : drActivity["misc_hours"].ToString());
                datatable.AddCell("");
                datatable.AddCell("");
            }
                    //Here goes the SubTotal Per project.. Dont Forget.
                    datatable.DefaultCellBorderWidth = 1;
                    datatable.DefaultRowspan = 1;
                    datatable.DefaultHorizontalAlignment = 1;
                    datatable.AddCell("");
                    datatable.AddCell("Subtotal:");
                    datatable.AddCell("");
                    datatable.AddCell("");
                    datatable.DefaultHorizontalAlignment = 0;
                    datatable.AddCell(_totFabHours.ToString());
                    datatable.AddCell(_totFinHours.ToString());
                    datatable.AddCell(_totEngHours.ToString());
                    datatable.AddCell(_totMiscHours.ToString());
                    datatable.AddCell("");
                    datatable.AddCell("");
                    //Subtotal calculation ends here.
            _totFabHours = 0;
            _totFinHours = 0;
            _totEngHours = 0;
            _totMiscHours = 0;
        }
        return datatable;
    }