USP_DATAFORMTEMPLATE_ADD_RECONCILIATIONCREATECHECK
The save procedure used by the add dataform template "Reconciliation Create Check Add Data Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@APPUSERID | uniqueidentifier | IN | APPUSERID |
@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. |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_RECONCILIATIONCREATECHECK
(
@ID uniqueidentifier = null output,
@APPUSERID uniqueidentifier = null,
@CURRENTAPPUSERID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null
)
as
set nocount on;
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
declare @CURRENTDATE datetime
set @CURRENTDATE = getdate();
begin try
if @APPUSERID is null
set @APPUSERID = @CURRENTAPPUSERID;
if exists(select 1 from dbo.CLOSEDRAWERCONFIGURATION C where C.CONFIGURATIONOPTIONCODE = 0)
select @ID = ID
from dbo.RECONCILIATION
where APPUSERID = @APPUSERID and STATUSCODE = 0;
else
select @ID = ID
from dbo.RECONCILIATION
where STATUSCODE = 0;
if @ID is null
begin
set @ID = newid();
insert into dbo.[RECONCILIATION] (
[ID],
[ADDEDBYID],
[CHANGEDBYID],
[DATEADDED],
[DATECHANGED],
[APPUSERID]
) values (
@ID,
@CHANGEAGENTID,
@CHANGEAGENTID,
@CURRENTDATE,
@CURRENTDATE,
@APPUSERID
);
end
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0