Пример #1
0
        private void BuildReport()
        {
            lblState.Text = "";

            if (!(User.IsInRole(((int)UserRoles.urFSBDPowerReader).ToString()) || User.IsInRole(((int)UserRoles.urFSBDAnalystFundsCoordinator).ToString()) ||
                  User.IsInRole(((int)UserRoles.urFSBDAdminAllowanceRO).ToString()) || User.IsInRole(((int)UserRoles.urFSBDAdminAllowanceWR).ToString())))
            {
                if (Users.UserAuthorizedForFSReports(CurrentUserID, ctrlCriteria.BusinessLine, ctrlCriteria.Organization) <= 0)
                {
                    throw new Exception("You are not authorized to see current report. Please select Business Line or Organization that you are allowed to review. Thank you.");
                }
            }

            //first check if the report data is valid:
            var status = FSSummaryReport.GetReportStateStatus(ctrlCriteria.FiscalYear, ctrlCriteria.Organization, ctrlCriteria.BusinessLine);

            if (status == (int)FundStatusReportStateStatus.rsDoesNotExist)
            {
                divReportState.Visible = true;
                lblState.Text          = String.Format("Fund Status Report for Organization {0}, Fiscal Year {1} is not available at this moment. <p />The report data is updated by automated process every {2} minutes. <br />You can request the report immediately (it might take a few minutes). Thank you.", ctrlCriteria.Organization, ctrlCriteria.FiscalYear, Settings.Default.RebuildReportIntervalInMinutes);
            }
            else if (status == (int)FundStatusReportStateStatus.rsObsolete)
            {
                divReportState.Visible = true;
                lblState.Text          = String.Format("Fund Status Report for Organization {0}, Fiscal Year {1} is obsolete. <p />The report data is updated by automated process every {2} minutes. <br />You can request the report immediately (it might take a few minutes). Thank you.", ctrlCriteria.Organization, ctrlCriteria.FiscalYear, Settings.Default.RebuildReportIntervalInMinutes);
            }
            else
            {
                divReportState.Visible = false;
                lblState.Text          = "";
            }

            if (status == (int)FundStatusReportStateStatus.rsObsolete || status == (int)FundStatusReportStateStatus.rsValid)
            {
                //draw the table tblData:
                var drawing_class = new FSReportUI();
                drawing_class.FiscalYear   = ctrlCriteria.FiscalYear;
                drawing_class.BookMonth    = ctrlCriteria.BookMonth;
                drawing_class.Organization = ctrlCriteria.Organization;
                drawing_class.BusinessLine = ctrlCriteria.BusinessLine;
                drawing_class.TableToDraw  = tblData;
                drawing_class.BuildHTMLTable();
                tblData = drawing_class.TableToDraw;
            }
        }
Пример #2
0
        private void BuildStatusReportTable()
        {
            //start Excel headers:
            /************************************/
            var tr = new HtmlTableRow();

            Sheet.Rows.Add(tr);

            tr = new HtmlTableRow();
            tr.Cells.AddCell("Fund Status Report", "title", CELL_ALIGN_LEFT);
            Sheet.Rows.Add(tr);

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

            //get Query parameters:
            /************************************/
            var ht               = (new PageBase()).FundsStatusSelectedValues;
            var organization     = (string)ht[HT_KEY_ORG];
            var fiscal_year      = (string)ht[HT_KEY_YEAR];
            var book_month       = (string)ht[HT_KEY_BOOK_MONTH];
            var business_line    = (string)ht[HT_KEY_BL_NAME];
            var business_line_id = (string)ht[HT_KEY_BL];

            //check if user's role allows to get this report:
            if (!(User.IsInRole(((int)UserRoles.urFSBDPowerReader).ToString()) || User.IsInRole(((int)UserRoles.urFSBDAnalystFundsCoordinator).ToString()) ||
                  User.IsInRole(((int)UserRoles.urFSBDAdminAllowanceRO).ToString()) || User.IsInRole(((int)UserRoles.urFSBDAdminAllowanceWR).ToString())))
            {
                if (Users.UserAuthorizedForFSReports((new PageBase()).CurrentUserID, business_line_id, organization) <= 0)
                {
                    throw new Exception("You are not authorized to review this data.");
                }
            }

            //display query parameters in Excel:
            /************************************/
            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);
            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);

            //draw the table Sheet that will be displayed in Excel:
            var drawing_class = new FSReportUI();

            drawing_class.FiscalYear          = fiscal_year;
            drawing_class.BookMonth           = book_month;
            drawing_class.BusinessLine        = business_line_id;
            drawing_class.Organization        = organization;
            drawing_class.TableToDraw         = Sheet;
            drawing_class.BuildReportForExcel = true;
            drawing_class.BuildHTMLTable();
            Sheet = drawing_class.TableToDraw;
        }