Skip to content

Commit

Permalink
update the query for licence based on submitted on date of Application (
Browse files Browse the repository at this point in the history
  • Loading branch information
pallvigrover authored Jul 25, 2024
1 parent 8caa011 commit c88e554
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ public FundingCalculator(IFundingRepository fundingRepository, Funding funding,
_rateSchedule = _rateSchedules.First(sch => sch.Id == _funding?.ofm_rate_schedule?.ofm_rate_scheduleid) ?? throw new InvalidDataException("No Rate Schedule matched."); ;
}

private DateTime Application_SubmittedOn => _funding.ofm_application!.ofm_summary_submittedon ?? _funding.ofm_application!.createdon ?? new DateTime();

public virtual IEnumerable<LicenceDetail> LicenceDetails
{
get
{
IEnumerable<Licence>? activeLicences = _funding?.ofm_facility?.ofm_facility_licence?.Where(licence => licence.statuscode == ofm_licence_StatusCode.Active &&
licence.ofm_start_date.GetValueOrDefault().ToLocalPST().Date <= DateTime.UtcNow.ToLocalPST().Date &&
(licence.ofm_end_date is null ||
licence.ofm_end_date.GetValueOrDefault().ToLocalPST().Date >= DateTime.UtcNow.ToLocalPST().Date));
licence.ofm_start_date.GetValueOrDefault().ToLocalPST().Date <= Application_SubmittedOn.ToLocalPST().Date &&
(licence.ofm_end_date is null || licence.ofm_end_date.GetValueOrDefault().ToLocalPST().Date >= Application_SubmittedOn.ToLocalPST().Date));

IEnumerable<LicenceDetail>? licenceDetails = activeLicences?
.SelectMany(licence => licence?.ofm_licence_licencedetail!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ private string FundingRequestUri
<link-entity name="ofm_application" from="ofm_applicationid" to="ofm_application" link-type="outer" alias="App">
<attribute name="ofm_application" />
<attribute name="ofm_applicationid" />
<attribute name="createdon" />
<attribute name="ofm_summary_submittedon" />
<attribute name="ofm_summary_ownership" />
<attribute name="ofm_application_type" />
<attribute name="ofm_costs_applicable_fee" />
Expand Down Expand Up @@ -310,7 +312,7 @@ private string FundingRequestUri
""";

var requestUri = $"""
ofm_fundings?$select=_createdby_value,createdon,_modifiedby_value,modifiedon,_ofm_application_value,_ofm_provider_approver_value,ofm_apply_duplicate_caretypes_condition,ofm_apply_room_split_condition,ofm_end_date,ofm_envelope_administrative,ofm_envelope_administrative_pf,ofm_envelope_administrative_proj,ofm_envelope_facility,ofm_envelope_facility_pf,ofm_envelope_facility_proj,ofm_envelope_grand_total,ofm_envelope_grand_total_pf,ofm_envelope_grand_total_proj,ofm_envelope_hr_benefits,ofm_envelope_hr_benefits_pf,ofm_envelope_hr_benefits_proj,ofm_envelope_hr_employerhealthtax,ofm_envelope_hr_employerhealthtax_pf,ofm_envelope_hr_employerhealthtax_proj,ofm_envelope_hr_prodevexpenses,ofm_envelope_hr_prodevexpenses_pf,ofm_envelope_hr_prodevexpenses_proj,ofm_envelope_hr_prodevhours,ofm_envelope_hr_prodevhours_pf,ofm_envelope_hr_prodevhours_proj,ofm_envelope_hr_total,ofm_envelope_hr_total_pf,ofm_envelope_hr_total_proj,ofm_envelope_hr_wages_paidtimeoff,ofm_envelope_hr_wages_paidtimeoff_pf,ofm_envelope_hr_wages_paidtimeoff_proj,ofm_envelope_operational,ofm_envelope_operational_pf,ofm_envelope_operational_proj,ofm_envelope_programming,ofm_envelope_programming_pf,ofm_envelope_programming_proj,_ofm_facility_value,ofm_funding_envelope,ofm_funding_number,ofm_fundingid,ofm_new_allocation_date,ofm_monthly_province_base_funding_y1,ofm_retroactive_payment_date,ofm_retroactive_payment_frequency,_ofm_rate_schedule_value,ofm_start_date,ofm_version_number,_ownerid_value,_owningbusinessunit_value,statecode,statuscode&$expand=ofm_funding_spaceallocation($select=createdon,ofm_adjusted_allocation,ofm_caption,_ofm_cclr_ratio_value,ofm_default_allocation,_ofm_funding_value,ofm_order_number,_ownerid_value,_owningbusinessunit_value,statuscode;$expand=ofm_cclr_ratio($select=ofm_caption,ofm_fte_min_ece,ofm_fte_min_ecea,ofm_fte_min_ite,ofm_fte_min_ra,ofm_group_size,ofm_licence_group,ofm_licence_mapping,ofm_order_number,_ofm_rate_schedule_value,ofm_spaces_max,ofm_spaces_min,statuscode)),ofm_facility($select=accountid,accountnumber,name;$expand=ofm_facility_licence($select=createdon,ofm_accb_providerid,ofm_ccof_facilityid,ofm_ccof_organizationid,_ofm_facility_value,ofm_health_authority,ofm_licence,ofm_tdad_funding_agreement_number,_ownerid_value,statuscode,ofm_start_date,ofm_end_date;$expand=ofm_licence_licencedetail($select=createdon,ofm_care_type,ofm_enrolled_spaces,_ofm_licence_value,ofm_licence_detail,ofm_licence_spaces,ofm_licence_type,ofm_operation_hours_from,ofm_operation_hours_to,ofm_operational_spaces,ofm_overnight_care,ofm_week_days,ofm_apply_room_split_condition,ofm_weeks_in_operation,_ownerid_value,statuscode))),ofm_application($select=ofm_application,ofm_applicationid,ofm_summary_ownership,ofm_application_type,ofm_costs_applicable_fee,ofm_costs_facility_type,ofm_costs_furniture_equipment,ofm_costs_maintenance_repairs,ofm_costs_mortgage,ofm_costs_property_insurance,ofm_costs_property_municipal_tax,ofm_costs_rent_lease,ofm_costs_strata_fee,ofm_costs_supplies,ofm_costs_upkeep_labour_supplies,ofm_costs_utilities,ofm_costs_year_facility_costs,ofm_costs_yearly_operating_costs,ofm_funding_number_base,_ofm_contact_value,_ofm_expense_authority_value,statecode,statuscode),ofm_rate_schedule($select=ofm_rate_scheduleid,ofm_schedule_number)&$filter=(ofm_fundingid eq '{_fundingId!.Value}') and (ofm_facility/accountid ne null) and (ofm_rate_schedule/ofm_rate_scheduleid ne null)
ofm_fundings?$select=_createdby_value,createdon,_modifiedby_value,modifiedon,_ofm_application_value,_ofm_provider_approver_value,ofm_apply_duplicate_caretypes_condition,ofm_apply_room_split_condition,ofm_end_date,ofm_envelope_administrative,ofm_envelope_administrative_pf,ofm_envelope_administrative_proj,ofm_envelope_facility,ofm_envelope_facility_pf,ofm_envelope_facility_proj,ofm_envelope_grand_total,ofm_envelope_grand_total_pf,ofm_envelope_grand_total_proj,ofm_envelope_hr_benefits,ofm_envelope_hr_benefits_pf,ofm_envelope_hr_benefits_proj,ofm_envelope_hr_employerhealthtax,ofm_envelope_hr_employerhealthtax_pf,ofm_envelope_hr_employerhealthtax_proj,ofm_envelope_hr_prodevexpenses,ofm_envelope_hr_prodevexpenses_pf,ofm_envelope_hr_prodevexpenses_proj,ofm_envelope_hr_prodevhours,ofm_envelope_hr_prodevhours_pf,ofm_envelope_hr_prodevhours_proj,ofm_envelope_hr_total,ofm_envelope_hr_total_pf,ofm_envelope_hr_total_proj,ofm_envelope_hr_wages_paidtimeoff,ofm_envelope_hr_wages_paidtimeoff_pf,ofm_envelope_hr_wages_paidtimeoff_proj,ofm_envelope_operational,ofm_envelope_operational_pf,ofm_envelope_operational_proj,ofm_envelope_programming,ofm_envelope_programming_pf,ofm_envelope_programming_proj,_ofm_facility_value,ofm_funding_envelope,ofm_funding_number,ofm_fundingid,ofm_new_allocation_date,ofm_monthly_province_base_funding_y1,ofm_retroactive_payment_date,ofm_retroactive_payment_frequency,_ofm_rate_schedule_value,ofm_start_date,ofm_version_number,_ownerid_value,_owningbusinessunit_value,statecode,statuscode&$expand=ofm_funding_spaceallocation($select=createdon,ofm_adjusted_allocation,ofm_caption,_ofm_cclr_ratio_value,ofm_default_allocation,_ofm_funding_value,ofm_order_number,_ownerid_value,_owningbusinessunit_value,statuscode;$expand=ofm_cclr_ratio($select=ofm_caption,ofm_fte_min_ece,ofm_fte_min_ecea,ofm_fte_min_ite,ofm_fte_min_ra,ofm_group_size,ofm_licence_group,ofm_licence_mapping,ofm_order_number,_ofm_rate_schedule_value,ofm_spaces_max,ofm_spaces_min,statuscode)),ofm_facility($select=accountid,accountnumber,name;$expand=ofm_facility_licence($select=createdon,ofm_accb_providerid,ofm_ccof_facilityid,ofm_ccof_organizationid,_ofm_facility_value,ofm_health_authority,ofm_licence,ofm_tdad_funding_agreement_number,_ownerid_value,statuscode,ofm_start_date,ofm_end_date;$expand=ofm_licence_licencedetail($select=createdon,ofm_care_type,ofm_enrolled_spaces,_ofm_licence_value,ofm_licence_detail,ofm_licence_spaces,ofm_licence_type,ofm_operation_hours_from,ofm_operation_hours_to,ofm_operational_spaces,ofm_overnight_care,ofm_week_days,ofm_apply_room_split_condition,ofm_weeks_in_operation,_ownerid_value,statuscode))),ofm_application($select=ofm_application,ofm_applicationid,createdon,ofm_summary_submittedon,ofm_summary_ownership,ofm_application_type,ofm_costs_applicable_fee,ofm_costs_facility_type,ofm_costs_furniture_equipment,ofm_costs_maintenance_repairs,ofm_costs_mortgage,ofm_costs_property_insurance,ofm_costs_property_municipal_tax,ofm_costs_rent_lease,ofm_costs_strata_fee,ofm_costs_supplies,ofm_costs_upkeep_labour_supplies,ofm_costs_utilities,ofm_costs_year_facility_costs,ofm_costs_yearly_operating_costs,ofm_funding_number_base,_ofm_contact_value,_ofm_expense_authority_value,statecode,statuscode),ofm_rate_schedule($select=ofm_rate_scheduleid,ofm_schedule_number)&$filter=(ofm_fundingid eq '{_fundingId!.Value}') and (ofm_facility/accountid ne null) and (ofm_rate_schedule/ofm_rate_scheduleid ne null)
""";

return requestUri;
Expand Down

0 comments on commit c88e554

Please sign in to comment.