UFN_BATCH_ALLOWEDIT

This function returns a boolean indicating whether or not the batch can be edited.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@BATCHID uniqueidentifier IN

Definition

Copy


CREATE function dbo.UFN_BATCH_ALLOWEDIT
(
    @BATCHID uniqueidentifier
)
returns bit
as
begin
    declare @RESULT as bit;
    set @RESULT = 0;

    declare @STATUSCODE bit;
    select @STATUSCODE = STATUSCODE from dbo.BATCH where ID = @BATCHID;

    if @STATUSCODE = 0
    begin
        select @RESULT = ALLOWEDIT
        from dbo.BATCHWORKFLOWSTATE
            inner join dbo.BATCH on BATCH.BATCHWORKFLOWSTATEID = BATCHWORKFLOWSTATE.ID
        where BATCH.ID = @BATCHID;
    end

    return @RESULT;
end