USP_DATAFORMTEMPLATE_EDIT_ACKNOWLEDGEMENTPREFERENCE
The save procedure used by the edit dataform template "Acknowledgement Preference Edit Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@REACKNOWLEDGEREVENUE | bit | IN | Re-acknowledge revenue |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_ACKNOWLEDGEMENTPREFERENCE
(
@CHANGEAGENTID uniqueidentifier = null,
@REACKNOWLEDGEREVENUE bit
)
as
set nocount on;
declare @CURRENTDATE datetime;
set @CURRENTDATE = getdate();
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
begin try
if (select count(ID) from dbo.ACKNOWLEDGEMENTPREFERENCE) > 0
begin
update
dbo.ACKNOWLEDGEMENTPREFERENCE
set
REACKNOWLEDGEREVENUE = @REACKNOWLEDGEREVENUE,
DATECHANGED = @CURRENTDATE,
CHANGEDBYID = @CHANGEAGENTID;
end
else
begin
insert into dbo.ACKNOWLEDGEMENTPREFERENCE(ID,REACKNOWLEDGEREVENUE,DATEADDED,DATECHANGED,ADDEDBYID,CHANGEDBYID)
values(newid(),@REACKNOWLEDGEREVENUE,@CURRENTDATE,@CURRENTDATE,@CHANGEAGENTID,@CHANGEAGENTID);
end
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;