diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Models/HtbTemplate.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Models/HtbTemplate.cs index 7a833d12d..a68b48954 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Models/HtbTemplate.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Models/HtbTemplate.cs @@ -2,6 +2,7 @@ using Dfe.PrepareConversions.Data.Models; using Dfe.PrepareConversions.Data.Models.KeyStagePerformance; using Dfe.PrepareConversions.DocumentGeneration; +using Dfe.PrepareConversions.Utils; using Dfe.PrepareConversions.ViewModels; using System; using System.Collections.Generic; @@ -136,6 +137,24 @@ public class HtbTemplate [DocumentText("MemberOfParliamentNameAndParty")] public string MemberOfParliamentNameAndParty { get; set; } + [DocumentText("PupilsAttendingGroup")] + public string PupilsAttendingGroup { get; set; } + + [DocumentText("NumberOfAlternativeProvisionPlaces")] + public string NumberOfAlternativeProvisionPlaces { get; set; } + + [DocumentText("NumberOfMedicalPlaces")] + public string NumberOfMedicalPlaces { get; set; } + + [DocumentText("NumberOfPost16Places")] + public string NumberOfPost16Places { get; set; } + + [DocumentText("NumberOfSENUnitPlaces")] + public string NumberOfSENUnitPlaces { get; set; } + + [DocumentText("ConversionSupportGrantNumberOfSites")] + public string ConversionSupportGrantNumberOfSites { get; set; } + // rationale [DocumentText("RationaleForProject")] public string RationaleForProject { get; set; } @@ -294,7 +313,13 @@ public static HtbTemplate Build(AcademyConversionProject project, YearThreeProjectedPupilNumbers = project.YearThreeProjectedPupilNumbers.ToString(), YearThreePercentageSchoolFull = project.YearThreeProjectedPupilNumbers.AsPercentageOf(project.YearThreeProjectedCapacity), SchoolPupilForecastsAdditionalInformation = project.SchoolPupilForecastsAdditionalInformation, - SchoolPerformance = schoolPerformance + SchoolPerformance = schoolPerformance, + PupilsAttendingGroup = SchoolOverviewHelper.MapPupilsAttendingGroup(project.PupilsAttendingGroupPermanentlyExcluded, project.PupilsAttendingGroupMedicalAndHealthNeeds, project.PupilsAttendingGroupTeenageMums), + ConversionSupportGrantNumberOfSites = project.ConversionSupportGrantNumberOfSites, + NumberOfAlternativeProvisionPlaces = project.NumberOfAlternativeProvisionPlaces?.ToString(), + NumberOfSENUnitPlaces = project.NumberOfSENUnitPlaces?.ToString(), + NumberOfMedicalPlaces = project.NumberOfMedicalPlaces?.ToString(), + NumberOfPost16Places = project.NumberOfPost16Places?.ToString() }; if (keyStagePerformance.HasKeyStage2PerformanceTables) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml index e71ecc253..db3b95e4b 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml @@ -18,14 +18,14 @@ @* Voluntary grant *@ - - + + @* Sponsored grant *@ - - + + - - + + diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/Sponsored/GrantDetails.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/Sponsored/GrantDetails.cshtml index 3ad48e9ff..ca1c9a1c2 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/Sponsored/GrantDetails.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/Sponsored/GrantDetails.cshtml @@ -34,7 +34,7 @@
- +
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/UpdateAcademyConversionProjectPageModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/UpdateAcademyConversionProjectPageModel.cs index 263a8ae2e..6a7355dea 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/UpdateAcademyConversionProjectPageModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/UpdateAcademyConversionProjectPageModel.cs @@ -91,13 +91,9 @@ private void RePopDatePickerModelsAfterValidationFail() Project.LocalAuthorityInformationTemplateSentDate = AcademyConversionProject.LocalAuthorityInformationTemplateSentDate; Project.LocalAuthorityInformationTemplateReturnedDate = AcademyConversionProject.LocalAuthorityInformationTemplateReturnedDate; } - public static decimal? CalculateGrantAmount(string type, string phase, string numberOfSites = "1") + public static decimal? CalculateGrantAmount(string type, string phase) { int defaultAmount = 25000; - int supplementAmount = CalculateGrantSupplement(numberOfSites); - - defaultAmount += supplementAmount; - if (phase is null) return defaultAmount; switch (phase.ToLower()) { @@ -107,7 +103,7 @@ private void RePopDatePickerModelsAfterValidationFail() SponsoredGrantType.FastTrack => 70000, SponsoredGrantType.Full => 110000, SponsoredGrantType.Intermediate => 90000, - _ => 25000 + _ => defaultAmount }; case "secondary": return type switch @@ -115,7 +111,7 @@ private void RePopDatePickerModelsAfterValidationFail() SponsoredGrantType.FastTrack => 80000, SponsoredGrantType.Full => 150000, SponsoredGrantType.Intermediate => 115000, - _ => 25000 + _ => defaultAmount }; } @@ -123,6 +119,20 @@ private void RePopDatePickerModelsAfterValidationFail() return defaultAmount; } + public static decimal? CalculatePRUGrantAmount(string type, string numberOfSites = "1") + { + int defaultAmount = 25000; + int supplementAmount = CalculateGrantSupplement(numberOfSites); + + return type switch + { + SponsoredGrantType.FastTrack => 70000 + supplementAmount, + SponsoredGrantType.Full => 110000 + supplementAmount, + SponsoredGrantType.Intermediate => 90000 + supplementAmount, + _ => defaultAmount + supplementAmount + }; + } + protected UpdateAcademyConversionProject Build() { return new UpdateAcademyConversionProject @@ -198,7 +208,7 @@ protected UpdateAcademyConversionProject Build() private bool? ConversionSupportGrantAmountChanged(string academyRoute) { - if (academyRoute == AcademyTypeAndRoutes.Sponsored) + if (academyRoute == AcademyTypeAndRoutes.Sponsored || academyRoute == AcademyTypeAndRoutes.Voluntary) { return AcademyConversionProject.ConversionSupportGrantAmountChanged; } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/DocumentGenerator/SchoolAndTrustInformationAndProjectDatesGenerator.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/DocumentGenerator/SchoolAndTrustInformationAndProjectDatesGenerator.cs index 7679ce49c..cab39a63d 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/DocumentGenerator/SchoolAndTrustInformationAndProjectDatesGenerator.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/DocumentGenerator/SchoolAndTrustInformationAndProjectDatesGenerator.cs @@ -118,6 +118,17 @@ private static List VoluntaryRouteInfo(AcademyConversionProject p new TextElement { Value = project.AcademyOrderRequired } }, }; + + if (project.SchoolType.ToLower().Contains("pupil referral unit")) + { + voluntaryRouteInfo.Add(new[] + { + new TextElement { Value = "Number of sites", Bold = true }, + new TextElement { Value = project.ConversionSupportGrantNumberOfSites} + } + ); + } + return voluntaryRouteInfo; } @@ -166,6 +177,17 @@ private static List SponsoredRouteInfo(AcademyConversionProject p new TextElement { Value = project.DaoPackSentDate.ToDateString() } }, }; + + if (project.SchoolType.ToLower().Contains("pupil referral unit")) + { + sponsoredRouteInfo.Add(new[] + { + new TextElement { Value = "Number of sites", Bold = true }, + new TextElement { Value = project.ConversionSupportGrantNumberOfSites} + } + ); + } + return sponsoredRouteInfo; } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/DocumentGenerator/SchoolOverviewGenerator.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/DocumentGenerator/SchoolOverviewGenerator.cs index 1e0a1d504..fe1eb3732 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/DocumentGenerator/SchoolOverviewGenerator.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/DocumentGenerator/SchoolOverviewGenerator.cs @@ -1,6 +1,7 @@ using Dfe.PrepareConversions.DocumentGeneration.Elements; using Dfe.PrepareConversions.DocumentGeneration.Interfaces; using Dfe.PrepareConversions.Models; +using Dfe.PrepareConversions.Utils; using System.Collections.Generic; namespace Dfe.PrepareConversions.Services.DocumentGenerator @@ -28,6 +29,18 @@ public static void AddSchoolOverview(IDocumentBuilder builder, HtbTemplate docum }, new[] { new TextElement { Value = "Viability issues", Bold = true }, new TextElement { Value = document.ViabilityIssues } }}); + if (document.SchoolType.ToLower().Contains("pupil referral unit")) + { + schoolOverviewTable.AddRange(new List { + new[] { new TextElement { Value = "Which groups of pupils attend the school", Bold = true }, new TextElement { Value = document.PupilsAttendingGroup } }, + new[] { new TextElement { Value = "Number of places funded for", Bold = true }, new TextElement { Value = document.NumberOfPlacesFundedFor } }, + new[] { new TextElement { Value = "Alternative provision", Bold = true }, new TextElement { Value = document.NumberOfAlternativeProvisionPlaces } }, + new[] { new TextElement { Value = "SEN Unit", Bold = true }, new TextElement { Value = document.NumberOfSENUnitPlaces } }, + new[] { new TextElement { Value = "Medical", Bold = true }, new TextElement { Value = document.NumberOfMedicalPlaces } }, + new[] { new TextElement { Value = "Post-16", Bold = true }, new TextElement { Value = document.NumberOfPost16Places } }, + }); + } + // Specific SEN fields if (document.SchoolType.ToLower().Contains("special")) { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Utils/SchoolOverviewHelper.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Utils/SchoolOverviewHelper.cs index d32ecd4a5..fae547550 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Utils/SchoolOverviewHelper.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Utils/SchoolOverviewHelper.cs @@ -6,6 +6,7 @@ using System; using DocumentFormat.OpenXml.Drawing; using AngleSharp.Text; +using System.Collections.Generic; namespace Dfe.PrepareConversions.Utils { @@ -31,5 +32,27 @@ public static SetSchoolOverviewModel CreateUpdateSchoolOverview(ProjectViewModel projectViewModel.PupilsAttendingGroupTeenageMums ); } + + public static string MapPupilsAttendingGroup(bool? pupilsAttendingGroupPermanentlyExcluded, bool? pupilsAttendingGroupMedicalAndHealthNeeds, bool? pupilsAttendingGroupTeenageMums) + { + var listOfAttendes = new List(); + + if (pupilsAttendingGroupPermanentlyExcluded.HasValue && pupilsAttendingGroupPermanentlyExcluded.Value) + { + listOfAttendes.Add("Permanently Excluded"); + } + + if (pupilsAttendingGroupMedicalAndHealthNeeds.HasValue && pupilsAttendingGroupMedicalAndHealthNeeds.Value) + { + listOfAttendes.Add("Medical and Health Needs"); + } + + if (pupilsAttendingGroupTeenageMums.HasValue && pupilsAttendingGroupTeenageMums.Value) + { + listOfAttendes.Add("Teenage Mums"); + } + + return string.Join(", ", listOfAttendes); + } } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolAndTrustInformationViewComponent.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolAndTrustInformationViewComponent.cs index 1702e7690..da024e0c1 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolAndTrustInformationViewComponent.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolAndTrustInformationViewComponent.cs @@ -2,7 +2,6 @@ using Dfe.PrepareConversions.Data; using Dfe.PrepareConversions.Data.Models; using Dfe.PrepareConversions.Data.Services; -using Dfe.PrepareConversions.Extensions; using Dfe.PrepareConversions.ViewModels; using Microsoft.AspNetCore.Mvc; using System; @@ -44,7 +43,7 @@ public async Task InvokeAsync() PreviousHeadTeacherBoardLink = project.PreviousHeadTeacherBoardLink, SchoolName = project.SchoolName, SchoolUrn = project.Urn.ToString(), - SchoolType = project.SchoolType.ToString(), + SchoolType = project?.SchoolType?.ToString(), LocalAuthority = project.LocalAuthority, TrustReferenceNumber = project.TrustReferenceNumber, NameOfTrust = project.NameOfTrust, @@ -54,11 +53,11 @@ public async Task InvokeAsync() Form7Received = project.Form7Received, Form7ReceivedDate = project.Form7ReceivedDate.ToDateString(), WasForm7Received = project.Form7Received is not null && project.Form7Received.Equals("Yes"), - ConversionSupportGrantAmount = project.ConversionSupportGrantAmount?.ToMoneyString(true), + ConversionSupportGrantAmount = project?.ConversionSupportGrantAmount?.ToMoneyString(true), ConversionSupportGrantChangeReason = project.ConversionSupportGrantChangeReason, ConversionSupportGrantType = project.ConversionSupportGrantType, ConversionSupportGrantEnvironmentalImprovementGrant = project.ConversionSupportGrantEnvironmentalImprovementGrant, - ConversionSupportNumberOfSites = project.ConversionSupportGrantNumberOfSites, + ConversionSupportNumberOfSites = project?.ConversionSupportGrantNumberOfSites, ProposedAcademyOpeningDate = project.ProposedAcademyOpeningDate.ToDateString(true), DaoPackSentDate = project.DaoPackSentDate.ToDateString() }; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolOverviewViewComponent.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolOverviewViewComponent.cs index 92772efe2..44e64e210 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolOverviewViewComponent.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolOverviewViewComponent.cs @@ -2,6 +2,7 @@ using Dfe.PrepareConversions.Data; using Dfe.PrepareConversions.Data.Models; using Dfe.PrepareConversions.Data.Services; +using Dfe.PrepareConversions.Utils; using Dfe.PrepareConversions.ViewModels; using Microsoft.AspNetCore.Mvc; using System; @@ -62,7 +63,7 @@ public async Task InvokeAsync() MemberOfParliamentNameAndParty = project.MemberOfParliamentNameAndParty, IsSpecial = schoolOverview?.SchoolType?.ToLower().Contains("special") ?? false, IsPRU = schoolOverview?.SchoolType?.ToLower().Contains("pupil referral unit") ?? false, - PupilsAttendingGroup = MapPupilsAttendingGroup(project), + PupilsAttendingGroup = SchoolOverviewHelper.MapPupilsAttendingGroup(project.PupilsAttendingGroupPermanentlyExcluded, project.PupilsAttendingGroupMedicalAndHealthNeeds, project.PupilsAttendingGroupTeenageMums), NumberOfAlternativeProvisionPlaces = project.NumberOfAlternativeProvisionPlaces, NumberOfMedicalPlaces = project.NumberOfMedicalPlaces, NumberOfSENUnitPlaces = project.NumberOfSENUnitPlaces, @@ -71,26 +72,4 @@ public async Task InvokeAsync() return View(viewModel); } - - private static string MapPupilsAttendingGroup(AcademyConversionProject project) - { - var listOfAttendes = new List(); - - if (project.PupilsAttendingGroupPermanentlyExcluded.HasValue && project.PupilsAttendingGroupPermanentlyExcluded.Value) - { - listOfAttendes.Add("Permanently Excluded"); - } - - if (project.PupilsAttendingGroupMedicalAndHealthNeeds.HasValue && project.PupilsAttendingGroupMedicalAndHealthNeeds.Value) - { - listOfAttendes.Add("Medical and Health Needs"); - } - - if (project.PupilsAttendingGroupTeenageMums.HasValue && project.PupilsAttendingGroupTeenageMums.Value) - { - listOfAttendes.Add("Teenage Mums"); - } - - return string.Join(", ", listOfAttendes); - } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SchoolAndTrustInformationViewModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SchoolAndTrustInformationViewModel.cs index 420b91e8e..5dda8cd67 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SchoolAndTrustInformationViewModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SchoolAndTrustInformationViewModel.cs @@ -30,6 +30,7 @@ public class SchoolAndTrustInformationViewModel public string Form7Received { get; set; } public string Form7ReceivedDate { get; set; } public bool IsDao { get; set; } - public bool IsPRU => SchoolType.ToLower().Equals("pupil referral unit"); + public bool IsPRU => SchoolType?.ToLower().Equals("pupil referral unit") ?? false; + public bool IsSEN => SchoolType?.ToLower().Contains("special") ?? false; public bool WasForm7Received { get; set; } }