private void BuildReport() { lblMessages.Text = ""; lblState.Text = ""; //divData.Attributes["style"] = "display:none;"; 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) { if (status == (int)FundStatusReportStateStatus.rsValid) { lblMessages.Text = "TIP: click on the month header to enter Fund Status Report."; } draw = new FSSummaryUI(); draw.FiscalYear = ctrlCriteria.FiscalYear; draw.Organization = ctrlCriteria.Organization; draw.BusinessLine = ctrlCriteria.BusinessLine; CreateReportView((int)FundStatusSummaryReportView.svObligations, "Obligations", "Show/Hide Fund Status Summary Report - Obligations Info"); CreateReportView((int)FundStatusSummaryReportView.svObligationsMonthly, "Obligations - Monthly View", "Show/Hide Fund Status Summary Report - Obligations Monthly Amounts Info"); CreateReportView((int)FundStatusSummaryReportView.svIncome, "Income", "Show/Hide Fund Status Summary Report - Income Info"); CreateReportView((int)FundStatusSummaryReportView.svIncomeMonthly, "Income - Monthly View", "Show/Hide Fund Status Summary Report - Income Monthly Amounts Info"); CreateReportView((int)FundStatusSummaryReportView.svAllowance, "Allowance", "Show/Hide Fund Status Summary Report - Allowance Info"); CreateReportView((int)FundStatusSummaryReportView.svYearEndProjection, "Year End Projection", "Show/Hide Fund Status Summary Report - Year End Projection Info"); CreateReportView((int)FundStatusSummaryReportView.svProjectionVariance, "Projection Variance", "Show/Hide Fund Status Summary Report - Projection Variance Info"); CreateReportView((int)FundStatusSummaryReportView.svProjectedBalance, "Projected Balance", "Show/Hide Fund Status Summary Report - Projected Balance Info"); divData.Attributes["style"] = "display:inline;"; /* * StringBuilder sb = new StringBuilder(); * sb.Append("<script language='javascript'> "); * sb.Append("on_long_load(); "); * sb.Append("</script>"); * Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "load_back", sb.ToString()); */ } else { draw = null; } }
private void BuildSummaryProjectionReportTable() { //start Excel headers: /************************************/ var tr = new HtmlTableRow(); Sheet.Rows.Add(tr); tr = new HtmlTableRow(); tr.Cells.AddCell("Fund Summary Projection Report", "title", CELL_ALIGN_LEFT); Sheet.Rows.Add(tr); tr = new HtmlTableRow(); Sheet.Rows.Add(tr); //get Query parameters: /************************************/ var ht = (new PageBase()).FundsSummaryReportSelectedValues; var organization = (string)ht[HT_KEY_ORG]; var fiscal_year = (string)ht[HT_KEY_YEAR]; 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(); Sheet.Rows.Add(tr); //draw the table Sheet that will be displayed in Excel: draw = new FSSummaryUI(); draw.FiscalYear = fiscal_year; draw.Organization = organization; draw.BusinessLine = business_line_id; CreateReportView((int)FundStatusSummaryReportView.svObligations, "Obligations", "Fund Status Summary Report - Obligations Info"); CreateReportView((int)FundStatusSummaryReportView.svObligationsMonthly, "Obligations - Monthly View", "Fund Status Summary Report - Obligations Monthly Amounts Info"); CreateReportView((int)FundStatusSummaryReportView.svIncome, "Income", "Fund Status Summary Report - Income Info"); CreateReportView((int)FundStatusSummaryReportView.svIncomeMonthly, "Income - Monthly View", "Fund Status Summary Report - Income Monthly Amounts Info"); CreateReportView((int)FundStatusSummaryReportView.svAllowance, "Allowance", "Fund Status Summary Report - Allowance Info"); CreateReportView((int)FundStatusSummaryReportView.svYearEndProjection, "Year End Projection", "Fund Status Summary Report - Year End Projection Info"); CreateReportView((int)FundStatusSummaryReportView.svProjectionVariance, "Projection Variance", "Fund Status Summary Report - Projection Variance Info"); CreateReportView((int)FundStatusSummaryReportView.svProjectedBalance, "Projected Balance", "Fund Status Summary Report - Projected Balance Info"); }