@yosiasz
See screenshots and code from Stored Procedure below. The form is where users input data to run the report that uses the Stored Procedure.
Here is code from top part of Stored Procedure:
USE [Viewpoint]
GO
/****** Object: StoredProcedure [dbo].[vrptJCUnitCostCT] Script Date: 3/15/2022 2:01:20 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[vrptJCUnitCostCT]
(@JCCo bCompany, @BeginJob bJob='', @EndJob bJob='zzzzzzzzzz',
@BeginDate bDate = '01/01/50', @EndDate bDate, @DateActPost varchar(1) = 'P', @JobActivity char(1))
with recompile
as
declare @BeginPostedDate bDate,@EndPostedDate bDate,@BeginActualDate bDate,@EndActualDate bDate
if @JCCo is null begin select @JCCo=0 end --workaround for Crystal null issue
select @BeginPostedDate=case when @DateActPost = 'P' then @BeginDate else '1/1/1950' end,
@EndPostedDate=case when @DateActPost = 'P' then @EndDate else '12/31/2050' end,
@BeginActualDate=case when @DateActPost <> 'P' then @BeginDate else '1/1/1950' end,
@EndActualDate=case when @DateActPost <> 'P' then @EndDate else '12/31/2050' end