@@ -33,6 +33,7 @@ public class P900CalculateLicenceTotal(ID365AppUserService appUserService, ID365
33
33
private decimal Total_Three_to_Five ;
34
34
private decimal Total_Under_Three ;
35
35
private decimal Total_Star_Percentage ;
36
+ private decimal School_Space_Ratio ;
36
37
public short ProcessId => Setup . Process . LicenceDetailRecords . CalculateLicenceTotal ;
37
38
public string ProcessName => Setup . Process . LicenceDetailRecords . CalculteLicenceTotalName ;
38
39
@@ -252,7 +253,9 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
252
253
if ( Total_Operational_Spaces != 0 )
253
254
{
254
255
Total_Star_Percentage = Math . Round ( ( Total_Under_Three + Total_Three_to_Five ) / Total_Operational_Spaces * 100 , 0 , MidpointRounding . AwayFromZero ) ;
255
- }
256
+ School_Space_Ratio = Math . Round ( ( decimal ) licensecategorygroup . Where ( type => type . LicenceCategoryName . Contains ( "Group Child Care (School-Age)" ) ) . Sum ( x => x . OperationalSpacespercategory ) / Total_Operational_Spaces , 2 , MidpointRounding . AwayFromZero ) ;
257
+
258
+ }
256
259
else
257
260
{
258
261
_logger . LogError ( "Total_Operational_Spaces is null or zero. Cannot compute percentage." ) ;
@@ -269,6 +272,7 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
269
272
{ "ofm_family_child_care_op" , ( int ) licensecategorygroup . Where ( type=> type . LicenceCategoryName . Contains ( "Family Child Care" ) ) . Sum ( x=> x . OperationalSpacespercategory ) } ,
270
273
{ "ofm_group_child_care_school_age_op" , ( int ) licensecategorygroup . Where ( type=> type . LicenceCategoryName . Contains ( "Group Child Care (School-Age)" ) ) . Sum ( x=> x . OperationalSpacespercategory ) } ,
271
274
{ "ofm_star_total_percentage" , Total_Star_Percentage } ,
275
+ { "ofm_school_age_spaces_ratio" , School_Space_Ratio }
272
276
} ;
273
277
var serializedApplicationRecord = JsonSerializer . Serialize ( updateApplicationRecord ) ;
274
278
var updateApplicationResult = await d365WebApiService . SendPatchRequestAsync ( _appUserService . AZSystemAppUser , $ "ofm_applications({ _processParams . Application . applicationId } )", serializedApplicationRecord ) ;
0 commit comments