--Force MIS total calculation back in time in order to save wareNumbers in MIS
Declare @UpdateNeeded int
Declare @SettingExcist int

/*2020-10-02: Not needed any more, and LastMISUpdate was set to 20191231 when Picasso has set MISTotalCalcNeeded */

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

If @UpdateNeeded = 1
Begin
  If @SettingExcist = 1
    UPDATE HotelSetup set KeyValue='1', LabelName='WareUpdate' WHERE SearchKey = 'MISTotalCalcNeeded'
  ELSE
    INSERT INTO HotelSetup (SearchKey, KeyValue, LabelName) Values('MISTotalCalcNeeded', '1', 'WareUpdate')
	
  UPDATE HotelSetup set KeyValue='20191231', LabelName='' WHERE SearchKey = 'LastMISUpdate'	
End */  


