-- CFA test script - CFAMX-448, API call issue.

-- ATL2CFANPV001
use jatesting
go

-- TESTS:
-- pick a store and run the SP to see what dates have no data and make sure the config setting days includes these dates.

-- list stores to test with...
select EntityID, Entity from tbEntity with(nolock) where EntityTypeID = 4
order by 1
go

-- get missing forecast for store matching our config date range.
declare @entityId bigint = 588
	, @configEnum varchar(50) = '83501'
	, @daysBack int = 7
	, @startDate date
	, @endDate date

select @daysBack = convert(int, [Value]) from tbConfigurationSetting with(nolock)
where ConfigurationEnum = @configEnum

set @endDate = getdate()
set @startDate = dateadd(DAY, -@daysBack, @endDate)

exec [Forecasting].[qryHasForecastForEntityWithDateRange] @entityId, @startDate, @endDate
go


