WHERE
(
(@iDateType = 1 AND dtTransactionDate BETWEEN @dStartDate AND @dEndDate) -- Use Transaction Date
OR
(@iDateType = 2 AND dtBusinessDate BETWEEN @dStartDate AND @dEndDate) -- Use Business Date
OR
(@iDateType = 3 AND dtPostedDate BETWEEN @dStartDate AND @dEndDate) -- Use Posted Date
)
AND
(@iLocationId = -1 OR iLocation = @iLocationId)
AND
(@vcStatus = 'All' OR (ISNULL(vcStatus,'No Status') IN (@vcStatus)))
WHERE
i.OrganizationId = @OrganizationId
AND
(
(@ResultType = 'ALL') AND (ISNULL(i.IsStoreDisplay,0) IN (0,1))
OR
(@ResultType = 'POS') AND (i.ItemStatusId = 2)
OR
(@ResultType = 'STORE') AND (i.ItemStatusId = 2) AND (ISNULL(i.IsStoreDisplay,0) IN (1))
)
Comments