Skip to content

Commit 732372c

Browse files
committed
merging with current DEV branch
2 parents d87c7a3 + ef67e7a commit 732372c

File tree

9 files changed

+47
-18
lines changed

9 files changed

+47
-18
lines changed

OFM.Infrastructure.WebAPI/Models/Fundings/FundingAmounts.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public interface IFundingAmounts
4848
decimal Base_NonHRProgramming { get; }
4949
decimal PF_NonHRProgramming { get; set; }
5050
decimal Projected_NonHRProgramming { get; set; }
51-
51+
decimal Adjusted_FTE { get; set; }
5252
bool Equals(FundingAmounts? other);
5353
bool Equals(object? obj);
5454
int GetHashCode();
@@ -121,7 +121,7 @@ public record FundingAmounts : IFundingAmounts
121121
[Required(ErrorMessage = "Required")]
122122
[Range(LOWER_LIMIT_AMOUNT, UPPER_LIMIT_AMOUNT, ErrorMessage = "The value must be greater than or equal to 0 or less than 100_000_000")]
123123
public decimal PF_NonHRFacility { get; set; } = 0m;
124-
124+
public decimal Adjusted_FTE { get; set; } = 0m;
125125
// Base Amounts (projected - parent fees)
126126
public decimal Base_HRTotal => Projected_HRTotal - PF_HRTotal;
127127
public decimal Base_HRWagesPaidTimeOff => Projected_HRWagesPaidTimeOff - PF_HRWagesPaidTimeOff;
@@ -178,5 +178,6 @@ public record EmptyFundingAmounts : IFundingAmounts {
178178
public decimal Base_NonHRProgramming { get; set; }
179179
public decimal PF_NonHRProgramming { get; set; }
180180
public decimal Projected_NonHRProgramming { get; set; }
181+
public decimal Adjusted_FTE { get; set; }
181182

182183
public bool Equals(FundingAmounts? other) { throw new NotImplementedException(); } };

OFM.Infrastructure.WebAPI/Models/Fundings/Fundings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ public class SupplementaryApplication : ofm_allowance
185185
public string? ofm_funding_number_base { get; set; }
186186
[property: JsonPropertyName("funding.statuscode")]
187187
public int? fundingstatuscode { get; set; }
188+
[property: JsonPropertyName("org.name")]
189+
public string? organizationname { get; set; }
188190
}
189191

190192
public class BusinessClosure

OFM.Infrastructure.WebAPI/Services/Processes/ApplicationScore/P800ScoreCalculatorProvider.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ private string RetrieveApplicationCalculator
3131
<attribute name=""ofm_name"" />
3232
<attribute name=""createdon"" />
3333
<order attribute=""ofm_name"" descending=""false"" />
34+
<filter>
35+
<condition attribute=""statuscode"" operator=""eq"" value=""1"" />
36+
</filter>
3437
<link-entity name=""ofm_intake"" from=""ofm_application_score_calculator"" to=""ofm_application_score_calculatorid"" link-type=""inner"" alias=""intake"">
3538
<attribute name=""ofm_start_date"" />
36-
<attribute name=""ofm_end_date"" />
37-
39+
<attribute name=""ofm_end_date"" />
3840
</link-entity>
3941
</entity>
4042
</fetch>";

OFM.Infrastructure.WebAPI/Services/Processes/ApplicationScore/ScoreStrategy.cs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public Task<bool> EvaluateAsync(IComparisonHandler comparisonHandler, ScoreParam
7777

7878
var preschoolSpaces = licenseData.MaxPreSchoolChildCareSpaces;
7979
var totalOperationalSpaces = licenseData.TotalChildCareSpaces;
80-
var ratio = totalOperationalSpaces > 0 ? (preschoolSpaces / totalOperationalSpaces) * 100 : 0;
80+
var ratio = totalOperationalSpaces > 0 ? (preschoolSpaces / totalOperationalSpaces) : 0;
8181
return Task.FromResult(comparisonHandler.Handle(_operator, ratio, comparisonValue));
8282
}
8383
}
@@ -139,20 +139,23 @@ public class NotForProfitStrategy(int comparisonOperator, string comparisonValue
139139

140140
public Task<bool> EvaluateAsync(IComparisonHandler comparisonHandler, ScoreParameter parameters, OFMApplication application, Facility facilityData, LicenseSpaces licenseData, ACCBIncomeIndicator incomeData, IEnumerable<ApprovedParentFee> feeData, IEnumerable<FortyPercentileThresholdFee> thresholdData, PopulationCentre populationData, SchoolDistrict schoolDistrictData)
141141
{
142-
if (facilityData.OrganizationBusinessType?.ToLower() == "non-profit society")
142+
var isNotForProfit = "No";
143+
if (facilityData.OrganizationBusinessType?.ToLower()?.Trim() == "non-profit society")
143144
{
144145
if (facilityData.OrganizationDateOfIncorporation == null || facilityData.OrganizationDateOfIncorporation == DateTime.MinValue) throw new ArgumentException("Date of Incorporation missing on the Organization");
145146
if (string.IsNullOrEmpty(facilityData.OrganizationOpenMembership)) throw new ArgumentException("OpenMembership is not set to Yes/No on the Organization");
146147
if (string.IsNullOrEmpty(facilityData.OrganizationBoardMembersBCResidents)) throw new ArgumentException("BoardMembersBCResidents is not set to Yes/No on the Organization");
147148
if (string.IsNullOrEmpty(facilityData.OrganizationBoardMembersMembership)) throw new ArgumentException("BoardMembersEntireMembership is not set to Yes/No on the Organization");
148149
if (string.IsNullOrEmpty(facilityData.OrganizationBoardMembersUnpaid)) throw new ArgumentException("BoardMembersElectedUnpaid is not set to Yes/No on the Organization");
150+
if (facilityData.OrganizationDateOfIncorporation > DateTime.Now.AddYears(-4) && (application.LetterOfSupportExists == null || application.LetterOfSupportExists == false)) throw new ArgumentException("No Community Support letter provided as Date of Incorporation is not older than 4 years");
149151

152+
153+
if (facilityData.OrganizationDateOfIncorporation < DateTime.UtcNow.AddYears(-4) || application.LetterOfSupportExists == true)
154+
if (facilityData.OrganizationOpenMembership == "Yes" && facilityData.OrganizationBoardMembersUnpaid == "Yes" && facilityData.OrganizationBoardMembersMembership == "Yes" && facilityData.OrganizationBoardMembersBCResidents == "Yes")
155+
isNotForProfit = "Yes";
150156
}
151-
var isNotForProfit = "No";
152-
if (facilityData.OrganizationDateOfIncorporation < DateTime.UtcNow.AddYears(-4) || application.LetterOfSupportExists == true)
153-
if (facilityData.OrganizationOpenMembership == "Yes" && facilityData.OrganizationBoardMembersUnpaid == "Yes" && facilityData.OrganizationBoardMembersMembership == "Yes" && facilityData.OrganizationBoardMembersUnpaid == "Yes")
154-
isNotForProfit = "Yes";
155157
return Task.FromResult(comparisonHandler.Handle(_operator, isNotForProfit, comparisonValue));
158+
156159
}
157160
}
158161
// Concrete Strategy: Evaluates based on the if Postal code of the facility belongs to High Population centres
@@ -198,11 +201,20 @@ public class LocationStrategy(int comparisonOperator, string comparisonValue) :
198201
public Task<bool> EvaluateAsync(IComparisonHandler comparisonHandler, ScoreParameter parameters, OFMApplication application, Facility facilityData, LicenseSpaces licenseData, ACCBIncomeIndicator incomeData, IEnumerable<ApprovedParentFee> feeData, IEnumerable<FortyPercentileThresholdFee> thresholdData, PopulationCentre populationData, SchoolDistrict schoolDistrictData)
199202
{
200203

204+
if(application.MonthToMonth == "Yes" || application.FacilityType?.ToLower()?.Trim() == "provided free of charge")
205+
return Task.FromResult(comparisonHandler.Handle(_operator, "No", comparisonValue));
201206

202-
203-
DateTime? leaseStartDate = application.LeaseStartDate;
204-
DateTime? leaseEndDate = application.LeaseEndDate;
205-
return Task.FromResult(comparisonHandler.Handle(_operator, application.FacilityType == "Rent/Lease" ? CheckLocationStability(leaseStartDate, leaseEndDate) : "No", comparisonValue));
207+
if (application.FacilityType?.ToLower()?.Trim() == "rent/lease")
208+
{
209+
DateTime? leaseStartDate = application.LeaseStartDate;
210+
DateTime? leaseEndDate = application.LeaseEndDate;
211+
return Task.FromResult(comparisonHandler.Handle(_operator, application.FacilityType == "Rent/Lease" ? CheckLocationStability(leaseStartDate, leaseEndDate) : "No", comparisonValue));
212+
}
213+
if (application.FacilityType?.ToLower()?.Trim() == "owned with mortgage" || application.FacilityType?.ToLower()?.Trim() == "owned without mortgage")
214+
{
215+
return Task.FromResult(comparisonHandler.Handle(_operator, "Yes", comparisonValue));
216+
}
217+
return Task.FromResult(comparisonHandler.Handle(_operator, "No", comparisonValue));
206218
}
207219
static string CheckLocationStability(DateTime? leaseStart, DateTime? leaseEnd)
208220
{

OFM.Infrastructure.WebAPI/Services/Processes/Emails/IEmailRepository.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ public async Task<JsonObject> CreateAllowanceEmail(SupplementaryApplication allo
312312
var effectiveDate = allowance.ofm_start_date;
313313
var retroActiveDate = allowance.ofm_retroactive_date;
314314
var VIN = allowance.ofm_transport_vehicle_vin;
315+
var Organization = allowance.organizationname;
315316
// DateOnly retroActiveDate = allowance.ofm_ret;
316317

317318
// funding status
@@ -344,8 +345,11 @@ public async Task<JsonObject> CreateAllowanceEmail(SupplementaryApplication allo
344345
subject = StripHTML(subject);
345346

346347
string? emaildescription = templateobj?.safehtml;
348+
emaildescription = emaildescription?.Replace("{StartDate}", effectiveDate?.ToString("MM/dd/yyyy"));
349+
emaildescription = emaildescription?.Replace("{Organization}", Organization);
347350
emaildescription = emaildescription?.Replace("[PrimaryContactName]", contactName);
348-
if(allowanceType == ecc_allowance_type.SupportNeedsProgramming || allowanceType == ecc_allowance_type.IndigenousProgramming)
351+
emaildescription = emaildescription?.Replace("{FANumber}", fundingNumber);
352+
if (allowanceType == ecc_allowance_type.SupportNeedsProgramming || allowanceType == ecc_allowance_type.IndigenousProgramming)
349353
emaildescription = emaildescription?.Replace("{Amount}", fundingAmount?.ToString("########.00"));
350354
else
351355
emaildescription = emaildescription?.Replace("{Amount}", MonthlyAmount?.ToString("########.00"));

OFM.Infrastructure.WebAPI/Services/Processes/Emails/P240AllowanceApprovalDenialNotificationProvider.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ public string RequestUri
8282
<filter>
8383
<condition attribute="ofm_version_number" operator="eq" value="0" />
8484
</filter>
85+
</link-entity>
86+
<link-entity name="account" from="accountid" to="ofm_organization" link-type="inner" alias="org">
87+
<attribute name="name" />
8588
</link-entity>
8689
</link-entity>
8790
</entity>

OFM.Infrastructure.WebAPI/Services/Processes/Fundings/CalculatorProgressTracker.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public JsonObject TrackerMessage
5555
{
5656
get
5757
{
58+
5859
string details = TrackingDetails;
5960
string nonHRDetails = NonHRTrackingDetails;
6061
if (TrackingDetails.Length > maxLength)

OFM.Infrastructure.WebAPI/Services/Processes/Fundings/FundingCalculator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public virtual IEnumerable<LicenceDetail> LicenceDetails
116116
private decimal TotalProjectedBenefitsCostPerYear => LicenceDetails.Sum(ld => ld.ProjectedBenefitsCostPerYear);
117117
private decimal TotalHRRenumeration => LicenceDetails.Sum(ld => ld.HRRenumeration);
118118
private decimal TotalEHTRenumeration => LicenceDetails.Sum(ld => ld.StaffingCost + ld.ProjectedBenefitsCostPerYear + ld.ProfessionalDevelopmentHours);
119-
119+
private decimal AdjustedFTE => Math.Round(LicenceDetails.Sum(ld => ld.AdjustedFTEs), 2, MidpointRounding.AwayFromZero);
120120
private decimal TotalProfessionalDevelopmentHours => LicenceDetails.Sum(ld => ld.ProfessionalDevelopmentHours);
121121
private decimal TotalProfessionalDevelopmentExpenses => LicenceDetails.Sum(ld => ld.ProfessionalDevelopmentExpenses);
122122

@@ -275,7 +275,7 @@ public async Task<bool> CalculateAsync()
275275
//Grand Totals
276276
Projected_GrandTotal = TotalProjectedFundingCost,
277277
PF_GrandTotal = TotalParentFees,
278-
278+
Adjusted_FTE = AdjustedFTE,
279279
CalculatedOn = DateTime.UtcNow
280280
};
281281

OFM.Infrastructure.WebAPI/Services/Processes/Fundings/IFundingRepository.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ public async Task<IEnumerable<SpaceAllocation>> GetSpacesAllocationByFundingIdAs
547547
public async Task<bool> SaveFundingAmountsAsync(IFundingResult fundingResult)
548548
{
549549
IFundingAmounts fm = fundingResult.FundingAmounts!;
550+
550551
var newfundingAmounts = new
551552
{
552553
//Projected Amounts
@@ -592,8 +593,11 @@ public async Task<bool> SaveFundingAmountsAsync(IFundingResult fundingResult)
592593
ofm_envelope_grand_total_proj = fm.Projected_GrandTotal,
593594
ofm_envelope_grand_total_pf = fm.PF_GrandTotal,
594595
ofm_envelope_grand_total = fm.Base_GrandTotal,
595-
596+
596597
ofm_calculated_on = fm.CalculatedOn,
598+
ofm_adjusted_fte=fm.Adjusted_FTE
599+
600+
597601
};
598602

599603
var statement = @$"ofm_fundings({_fundingId})";

0 commit comments

Comments
 (0)