USP_DATAFORMTEMPLATE_VIEW_GLFISCALYEARCOPYVALID
The load procedure used by the view dataform template "Fiscal Year Copy Valid Context View Form"
Parameters
| Parameter | Parameter Type | Mode | Description |
|---|---|---|---|
| @ID | uniqueidentifier | IN | The input ID parameter used to load the fields defined on the form. |
| @DATALOADED | bit | INOUT | Output parameter indicating whether or not data was actually loaded. |
| @YEARNAME | nvarchar(12) | INOUT | YEARNAME |
| @CONTEXTSTARTDATE | datetime | INOUT | CONTEXTSTARTDATE |
| @LASTENDDATE | datetime | INOUT | LASTENDDATE |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_VIEW_GLFISCALYEARCOPYVALID
(
@ID uniqueidentifier,
@DATALOADED bit = 0 output,
@YEARNAME nvarchar(12) = null output,
@CONTEXTSTARTDATE datetime = null output,
@LASTENDDATE datetime = null output
)
as
set nocount on;
-- be sure to set this, in case the select returns no rows
set @DATALOADED = 0;
select @LASTENDDATE = max(ENDDATE) from dbo.GLFISCALPERIOD
-- populate the output parameters, which correspond to fields on the form. Note that
-- we set @DATALOADED = 1 to indicate that the load was successful. Otherwise, the system
-- will display a "no data loaded" message.
select @DATALOADED = 1,
@YEARNAME = YEARID,
@CONTEXTSTARTDATE = min(T2.STARTDATE)
from dbo.GLFISCALYEAR T1
inner join dbo.GLFISCALPERIOD T2 on T2.GLFISCALYEARID = T1.ID
where T1.ID = @ID
group by T1.YEARID
return 0;