Beispiel #1
0
        public ActionResult Mats(RevenueGroupType tab = RevenueGroupType.Expenditure, MatFinancingType financing = MatFinancingType.TrustAndAcademies)
        {
            ChartGroupType chartGroup;

            switch (tab)
            {
            case RevenueGroupType.Expenditure:
                chartGroup = ChartGroupType.TotalExpenditure;
                break;

            case RevenueGroupType.Income:
                chartGroup = ChartGroupType.TotalIncome;
                break;

            case RevenueGroupType.Balance:
                chartGroup = ChartGroupType.InYearBalance;
                break;

            default:
                chartGroup = ChartGroupType.All;
                break;
            }

            var defaultUnitType = tab == RevenueGroupType.Workforce ? UnitType.AbsoluteCount : UnitType.AbsoluteMoney;
            var benchmarkCharts = BuildTrustBenchmarkCharts(tab, chartGroup, UnitType.AbsoluteMoney, financing);
            var chartGroups     = _benchmarkChartBuilder.Build(tab, EstablishmentType.MAT).DistinctBy(c => c.ChartGroup).ToList();

            var academiesTerm  = FormatHelpers.FinancialTermFormatAcademies(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Academies));
            var maintainedTerm = FormatHelpers.FinancialTermFormatMaintained(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Maintained));

            var vm = new BenchmarkChartListViewModel(benchmarkCharts, null, chartGroups, ComparisonType.Manual, null, null, null, EstablishmentType.MAT, EstablishmentType.MAT, null, null, academiesTerm, maintainedTerm, ComparisonArea.All, null, null, ComparisonListLimit.DEFAULT, base.ExtractTrustComparisonListFromCookie());

            ViewBag.Tab               = tab;
            ViewBag.ChartGroup        = chartGroup;
            ViewBag.UnitType          = defaultUnitType;
            ViewBag.HomeSchoolId      = vm.TrustComparisonList.DefaultTrustMatNo;
            ViewBag.EstablishmentType = vm.EstablishmentType;
            ViewBag.TrustFinancing    = financing;

            return(View("Index", vm));
        }
Beispiel #2
0
        public async Task <PartialViewResult> CustomReport(string json, ChartFormat format)
        {
            var customSelection = (CustomSelectionListViewModel)JsonConvert.DeserializeObject(json, typeof(CustomSelectionListViewModel));
            var customCharts    = ConvertSelectionListToChartList(customSelection.HierarchicalCharts);
            var comparisonList  = base.ExtractSchoolComparisonListFromCookie();

            var financialDataModels = await this.GetFinancialDataForSchoolsAsync(comparisonList.BenchmarkSchools, (CentralFinancingType)Enum.Parse(typeof(CentralFinancingType), customSelection.CentralFinance));

            var trimSchoolNames = Request.Browser.IsMobileDevice;

            _fcService.PopulateBenchmarkChartsWithFinancialData(customCharts, financialDataModels, comparisonList.BenchmarkSchools, comparisonList.HomeSchoolUrn, null, trimSchoolNames);

            var academiesTerm  = FormatHelpers.FinancialTermFormatAcademies(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Academies));
            var maintainedTerm = FormatHelpers.FinancialTermFormatMaintained(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Maintained));

            var vm = new BenchmarkChartListViewModel(customCharts, base.ExtractSchoolComparisonListFromCookie(), null,
                                                     ComparisonType.Manual, null, null, null, EstablishmentType.All, EstablishmentType.All, null, null, academiesTerm, maintainedTerm, ComparisonArea.All, null, null, ComparisonListLimit.DEFAULT);

            ViewBag.ChartFormat = format;

            return(PartialView("Partials/CustomCharts", vm));
        }
Beispiel #3
0
        public async Task <PartialViewResult> TabChange(EstablishmentType type, UnitType showValue, RevenueGroupType tab = RevenueGroupType.Expenditure, CentralFinancingType financing = CentralFinancingType.Include, MatFinancingType trustFinancing = MatFinancingType.TrustAndAcademies, ChartFormat format = ChartFormat.Charts)
        {
            ChartGroupType chartGroup;

            switch (tab)
            {
            case RevenueGroupType.Expenditure:
                chartGroup = ChartGroupType.TotalExpenditure;
                break;

            case RevenueGroupType.Income:
                chartGroup = ChartGroupType.TotalIncome;
                break;

            case RevenueGroupType.Balance:
                chartGroup = ChartGroupType.InYearBalance;
                break;

            case RevenueGroupType.Workforce:
                chartGroup = ChartGroupType.Workforce;
                break;

            default:
                chartGroup = ChartGroupType.All;
                break;
            }

            UnitType unitType;

            switch (tab)
            {
            case RevenueGroupType.Workforce:
                unitType = UnitType.AbsoluteCount;
                break;

            case RevenueGroupType.Balance:
                unitType = showValue == UnitType.AbsoluteMoney || showValue == UnitType.PerPupil || showValue == UnitType.PerTeacher ? showValue : UnitType.AbsoluteMoney;
                break;

            default:
                unitType = showValue;
                break;
            }

            List <ChartViewModel> benchmarkCharts;

            if (type == EstablishmentType.MAT)
            {
                benchmarkCharts = BuildTrustBenchmarkCharts(tab, chartGroup, unitType, trustFinancing);
            }
            else
            {
                benchmarkCharts = await BuildSchoolBenchmarkChartsAsync(tab, chartGroup, unitType, financing);
            }
            var chartGroups = _benchmarkChartBuilder.Build(tab, EstablishmentType.All).DistinctBy(c => c.ChartGroup).ToList();

            var academiesTerm  = FormatHelpers.FinancialTermFormatAcademies(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Academies));
            var maintainedTerm = FormatHelpers.FinancialTermFormatMaintained(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Maintained));

            var vm = new BenchmarkChartListViewModel(benchmarkCharts, base.ExtractSchoolComparisonListFromCookie(), chartGroups, ComparisonType.Manual, null, null, null, type, type, null, null, academiesTerm, maintainedTerm, ComparisonArea.All, null, null, ComparisonListLimit.DEFAULT, base.ExtractTrustComparisonListFromCookie());

            ViewBag.Tab               = tab;
            ViewBag.ChartGroup        = chartGroup;
            ViewBag.UnitType          = unitType;
            ViewBag.EstablishmentType = type;
            ViewBag.Financing         = financing;
            ViewBag.TrustFinancing    = trustFinancing;
            ViewBag.HomeSchoolId      = (type == EstablishmentType.MAT) ? vm.TrustComparisonList.DefaultTrustMatNo : vm.SchoolComparisonList.HomeSchoolUrn;
            ViewBag.ChartFormat       = format;

            return(PartialView("Partials/TabContent", vm));
        }
Beispiel #4
0
        public async Task <ActionResult> Index(
            string urn,
            SimpleCriteria simpleCriteria,
            BenchmarkCriteria benchmarkCriteria,
            int basketSize = ComparisonListLimit.DEFAULT,
            SchoolFinancialDataModel benchmarkSchoolData = null,
            EstablishmentType searchedEstabType          = EstablishmentType.All,
            ComparisonType comparisonType = ComparisonType.Manual,
            ComparisonArea areaType       = ComparisonArea.All,
            string laCode                  = null,
            RevenueGroupType tab           = RevenueGroupType.Expenditure,
            CentralFinancingType financing = CentralFinancingType.Include)
        {
            ChartGroupType chartGroup;

            switch (tab)
            {
            case RevenueGroupType.Expenditure:
                chartGroup = ChartGroupType.TotalExpenditure;
                break;

            case RevenueGroupType.Income:
                chartGroup = ChartGroupType.TotalIncome;
                break;

            case RevenueGroupType.Balance:
                chartGroup = ChartGroupType.InYearBalance;
                break;

            case RevenueGroupType.Workforce:
                chartGroup = ChartGroupType.Workforce;
                break;

            default:
                chartGroup = ChartGroupType.All;
                break;
            }

            var defaultUnitType = tab == RevenueGroupType.Workforce ? UnitType.AbsoluteCount : UnitType.AbsoluteMoney;
            var benchmarkCharts = await BuildSchoolBenchmarkChartsAsync(tab, chartGroup, defaultUnitType, financing);

            var establishmentType = DetectEstablishmentType(base.ExtractSchoolComparisonListFromCookie());

            var chartGroups = _benchmarkChartBuilder.Build(tab, establishmentType).DistinctBy(c => c.ChartGroup).ToList();

            string selectedArea = "";

            switch (areaType)
            {
            case ComparisonArea.All:
                selectedArea = "All England";
                break;

            case ComparisonArea.LaCode:
            case ComparisonArea.LaName:
                selectedArea = _laService.GetLaName(laCode);
                break;
            }

            string schoolArea = "";

            if (benchmarkSchoolData != null)
            {
                schoolArea = _laService.GetLaName(benchmarkSchoolData.LaNumber.ToString());
            }

            var academiesTerm  = FormatHelpers.FinancialTermFormatAcademies(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Academies));
            var maintainedTerm = FormatHelpers.FinancialTermFormatMaintained(_financialDataService.GetLatestDataYearPerSchoolType(SchoolFinancialType.Maintained));

            var vm = new BenchmarkChartListViewModel(benchmarkCharts, base.ExtractSchoolComparisonListFromCookie(), chartGroups, comparisonType, benchmarkCriteria, simpleCriteria, benchmarkSchoolData, establishmentType, searchedEstabType, schoolArea, selectedArea, academiesTerm, maintainedTerm, areaType, laCode, urn, basketSize);

            ViewBag.Tab               = tab;
            ViewBag.ChartGroup        = chartGroup;
            ViewBag.UnitType          = defaultUnitType;
            ViewBag.HomeSchoolId      = vm.SchoolComparisonList.HomeSchoolUrn;
            ViewBag.EstablishmentType = vm.EstablishmentType;
            ViewBag.Financing         = financing;
            ViewBag.ChartFormat       = ChartFormat.Charts;

            return(View("Index", vm));
        }