--Force MIS total calculation in order to remove canceled online res. from MIS 
Declare @CoronaUpdate int
Declare @SettingExcist int

select @SettingExcist = Count(*) from HotelSetup where SearchKey = 'MISTotalCalcNeeded' 
If @SettingExcist = 1
Begin
  select @CoronaUpdate = Count(*) from HotelSetup where SearchKey = 'MISTotalCalcNeeded' and IsNull(LabelName, '') <> 'CoronaRecalc'
End Else
Begin
  Set @CoronaUpdate = 1
End

If @CoronaUpdate = 1
Begin
  If @SettingExcist = 1
    UPDATE HotelSetup set KeyValue='1', LabelName='CoronaRecalc' WHERE SearchKey = 'MISTotalCalcNeeded'
  ELSE
    INSERT INTO HotelSetup (SearchKey, KeyValue, LabelName) Values('MISTotalCalcNeeded', '1', 'CoronaRecalc')
End  

