Exemplo n.º 1
0
        private void BuildResultsTable()
        {
            var last_book_month_included = (ctrlCriteria.BookMonth == "00") ? "09" : ctrlCriteria.BookMonth;
            //get Totals data always:
            DataSet ds       = null;
            var     dsTotals = FSTotalsReport.GetSummaryState(ctrlCriteria.FiscalYear, ctrlCriteria.Organization, ctrlCriteria.BusinessLine, last_book_month_included, ctrlCriteria.ViewMode, false);

            //get Monthly data only if needed:
            if (ctrlCriteria.ExpandedByMonthView)
            {
                ds = FSTotalsReport.GetSummaryState(ctrlCriteria.FiscalYear, ctrlCriteria.Organization, ctrlCriteria.BusinessLine, last_book_month_included, ctrlCriteria.ViewMode, ctrlCriteria.ExpandedByMonthView);
            }

            if (dsTotals == null || dsTotals.Tables[0].Rows.Count == 0)
            {
                lblMessages.Text = "No records found.";
            }
            else
            {
                lblMessages.Text = "";

                //draw the table tblData:
                var drawing_class = new FSReviewUI();
                drawing_class.TotalsDataTable = dsTotals.Tables[0];
                drawing_class.SourceDataTable = (ds == null) ? null : ds.Tables[0];
                drawing_class.TableToDraw     = tblData;
                drawing_class.MonthlyView     = ctrlCriteria.ExpandedByMonthView;
                if (ctrlCriteria.ViewMode == (int)FundsReviewViewMode.fvIncome)
                {
                    drawing_class.DisplayColumnObjClassCode = false;
                }
                drawing_class.BookMonth = ctrlCriteria.BookMonth;
                var link = String.Format("FundSearch.aspx?vm={0}&org={1}&fy={2}&ba={3}&bl={4}", ctrlCriteria.ViewMode, ctrlCriteria.Organization, ctrlCriteria.FiscalYear, DEFAULT_VALUE_BUDGET_ACTIVITY, ctrlCriteria.BusinessLine);
                link = link + "&bm={0}&sf={1}&oc={2}";
                drawing_class.CellLinkOnClick = link;
                drawing_class.BuildTheTable();
                tblData = drawing_class.TableToDraw;
            }
        }
Exemplo n.º 2
0
        private void BuildFundsReviewTable()
        {
            //ctrlCriteria.ExpandedByMonthView - always Expanded view in Excel:
            var expanded_view = true;

            //get Query parameters:
            /************************************/
            var ht                 = (new PageBase()).FundsReviewSelectedValues;
            var organization       = (string)ht[HT_KEY_ORG];
            var business_line_code = (string)ht[HT_KEY_BL];
            var business_line      = (string)ht[HT_KEY_BL_NAME];
            var fiscal_year        = (string)ht[HT_KEY_YEAR];
            var book_month         = (string)ht[HT_KEY_BOOK_MONTH];
            var obl_income_view    = Int32.Parse((string)ht[HT_KEY_VIEW]);
            var title_text         = "";

            switch (obl_income_view)
            {
            case (int)FundsReviewViewMode.fvObligations:
                title_text = "Obligations";
                break;

            case (int)FundsReviewViewMode.fvIncome:
                title_text = "Income";
                break;

            case (int)FundsReviewViewMode.fvOneTimeAdjustments:
                title_text = "One Time Adjustments";
                break;
            }

            //start Excel headers:
            /************************************/
            var tr = new HtmlTableRow();

            Sheet.Rows.Add(tr);

            tr = new HtmlTableRow();
            tr.Cells.AddCell("Funds Review", "title", CELL_ALIGN_LEFT);
            Sheet.Rows.Add(tr);
            tr = new HtmlTableRow();
            tr.Cells.AddCell(title_text, "title2", CELL_ALIGN_LEFT);
            Sheet.Rows.Add(tr);

            tr = new HtmlTableRow();
            Sheet.Rows.Add(tr);

            //get the data:
            /************************************/
            var last_book_month_included = (book_month == "00") ? "09" : book_month;
            var dsTotal = FSTotalsReport.GetSummaryState(fiscal_year, organization, business_line_code, last_book_month_included, obl_income_view, false);
            var ds      = FSTotalsReport.GetSummaryState(fiscal_year, organization, business_line_code, last_book_month_included, obl_income_view, true);

            //display query parameters in Excel:
            /************************************/
            if (business_line_code != "")
            {
                tr = new HtmlTableRow();
                tr.Cells.AddCell("Business Line:", "reportCaption2", CELL_ALIGN_LEFT);
                tr.Cells.AddCell(business_line, "title2", CELL_ALIGN_RIGHT);
                Sheet.Rows.Add(tr);
            }
            tr = new HtmlTableRow();
            tr.Cells.AddCell("Organization:", "reportCaption2", CELL_ALIGN_LEFT);
            tr.Cells.AddCell(organization, "title2", CELL_ALIGN_RIGHT);
            Sheet.Rows.Add(tr);
            tr = new HtmlTableRow();
            tr.Cells.AddCell("Fiscal Year:", "reportCaption2", CELL_ALIGN_LEFT);
            tr.Cells.AddCell(fiscal_year, "title2", CELL_ALIGN_RIGHT);
            Sheet.Rows.Add(tr);
            tr = new HtmlTableRow();
            tr.Cells.AddCell("Book Month:", "reportCaption2", CELL_ALIGN_LEFT);
            if (book_month == "00")
            {
                tr.Cells.AddCell("All Available", "title2", CELL_ALIGN_RIGHT);
            }
            else
            {
                tr.Cells.AddCell(String.Format("{0:MMMM}", DateTime.Parse(book_month + "/" + fiscal_year)), "title2", CELL_ALIGN_RIGHT);
            }
            Sheet.Rows.Add(tr);

            tr = new HtmlTableRow();
            Sheet.Rows.Add(tr);

            if (dsTotal == null || dsTotal.Tables[0].Rows.Count == 0)
            {
                //no records:
                /************************************/
                tr = new HtmlTableRow();
                tr.Cells.AddCell("No records found", "reportCaption2", CELL_ALIGN_LEFT);
                Sheet.Rows.Add(tr);
            }
            else
            {
                //draw the table Sheet that will be displayed in Excel:
                /******************************************************/
                var drawing_class = new FSReviewUI();
                drawing_class.TotalsDataTable = dsTotal.Tables[0];
                drawing_class.SourceDataTable = (ds == null) ? null : ds.Tables[0];
                drawing_class.TableToDraw     = Sheet;
                drawing_class.MonthlyView     = true;
                if (obl_income_view == (int)FundsReviewViewMode.fvIncome)
                {
                    drawing_class.DisplayColumnObjClassCode = false;
                }
                drawing_class.BookMonth           = book_month;
                drawing_class.BuildReportForExcel = true;
                drawing_class.BuildTheTable();
                Sheet = drawing_class.TableToDraw;
            }
        }