case when in where in sql :   

  DECLARE @ONum int --variable
    DECLARE @CrUsId nvarchar(128)='D901D15C-62FA-4243-A3DB-D3D448DC3F91'--assign value
    DECLARE @From Datetime =4/2/2017  --assign value
    DECLARE @To Datetime  = 25/2/2017  --assign value
    `declare @day nvarchar(50)`
    `select * from PurchaseOrder`

    where 
     CreateUserID =  CASE @CrUsId
      WHEN @CrUsId = '' THEN CreateUserID
     WHEN @CrUsId <> CreateUserID THEN NULL  -- if input is some text but      
       WHEN @CrUsId IS NULL THEN CreateUserID
      WHEN @CrUsId != '' AND CreateUserID = @CrUsId THEN CreateUserID
     END

