USP_DATAFORMTEMPLATE_EDIT_APPEAL
The save procedure used by the edit dataform template "Appeal Edit Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | The input ID parameter indicating the ID of the record being edited. |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@NAME | nvarchar(100) | IN | Name |
@DESCRIPTION | nvarchar(255) | IN | Description |
@APPEALCATEGORYCODEID | uniqueidentifier | IN | Category |
@BUSINESSUNITCODEID | uniqueidentifier | IN | Business unit |
@STARTDATE | datetime | IN | Start date |
@ENDDATE | datetime | IN | End date |
@GOAL | money | IN | Goal |
@APPEALREPORT1CODEID | uniqueidentifier | IN | Report code |
@SITEID | uniqueidentifier | IN | Site |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_APPEAL
(
@ID uniqueidentifier,
@CURRENTAPPUSERID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@NAME nvarchar(100),
@DESCRIPTION nvarchar(255),
@APPEALCATEGORYCODEID uniqueidentifier,
@BUSINESSUNITCODEID uniqueidentifier,
@STARTDATE datetime,
@ENDDATE datetime,
@GOAL money,
@APPEALREPORT1CODEID uniqueidentifier,
@SITEID uniqueidentifier
)
as
begin
set nocount on;
declare @CURRENTDATE datetime
set @CURRENTDATE = getdate()
if @SITEID is null
begin
if dbo.UFN_SITEREQUIREDFORUSER(@CURRENTAPPUSERID) = 1
begin
raiserror('Site is required.',13,1)
return
end
end
begin try
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output
update
dbo.APPEAL
set
NAME= @NAME,
DESCRIPTION = @DESCRIPTION ,
APPEALCATEGORYCODEID = @APPEALCATEGORYCODEID ,
BUSINESSUNITCODEID = @BUSINESSUNITCODEID ,
STARTDATE = @STARTDATE ,
ENDDATE = @ENDDATE ,
GOAL = @GOAL ,
APPEALREPORT1CODEID = @APPEALREPORT1CODEID,
CHANGEDBYID = @CHANGEAGENTID,
DATECHANGED = @CURRENTDATE,
SITEID = @SITEID
where
ID = @ID
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0
end