USP_DATAFORMTEMPLATE_EDITLOAD_DISBURSEMENTPROCESSTEMPLATESIGNATURES

The load procedure used by the edit dataform template "Disbursement Process Template Signatures Edit Data 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.
@TSLONG bigint INOUT Output parameter indicating the TSLONG value of the record being edited. This is used to manage multi-user concurrency issues when multiple users access the same record.
@BANKACCOUNTID uniqueidentifier INOUT
@SIGNATURE1OPTIONCODE tinyint INOUT Auto-signature 1 options
@SIGNATURE2OPTIONCODE tinyint INOUT Auto-signature 2 options
@SIGNATURE1ID uniqueidentifier INOUT Signature name
@SIGNATURE1IMAGE varbinary INOUT
@SIGNATURE2ID uniqueidentifier INOUT Signature name
@SIGNATURE2IMAGE varbinary INOUT
@SIGNATURES1XML xml INOUT Signature based on amount
@SIGNATURES2XML xml INOUT Signature based on amount

Definition

Copy


CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_DISBURSEMENTPROCESSTEMPLATESIGNATURES(
    @ID uniqueidentifier,
    @DATALOADED bit = 0 output,
    @TSLONG bigint = 0 output,
  @BANKACCOUNTID uniqueidentifier = null output,
    @SIGNATURE1OPTIONCODE tinyint = null output,
    @SIGNATURE2OPTIONCODE tinyint = null output,
    @SIGNATURE1ID uniqueidentifier = null output,
  @SIGNATURE1IMAGE varbinary(max) = null output,
  @SIGNATURE2ID uniqueidentifier = null output,
  @SIGNATURE2IMAGE varbinary(max) = null output,
  @SIGNATURES1XML xml = null output,
  @SIGNATURES2XML xml = null output
)
as

    set nocount on;

    -- be sure to set these, in case the select returns no rows

    set @DATALOADED = 0
    set @TSLONG = 0

    -- 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.  Also note that we fetch the TSLONG so that concurrency

    -- can be considered.

    select
        @DATALOADED = 1,
        @TSLONG = T.TSLONG,
    @BANKACCOUNTID = T.BANKACCOUNTID,
        @SIGNATURE1OPTIONCODE = T.SIGNATURE1OPTIONCODE,
        @SIGNATURE2OPTIONCODE = T.SIGNATURE2OPTIONCODE,
        @SIGNATURE1ID = T.SIGNATURE1ID,
    @SIGNATURE1IMAGE = S1.SIGNATURETHUMBNAIL,
    @SIGNATURE2ID = T.SIGNATURE2ID,
    @SIGNATURE2IMAGE = S2.SIGNATURETHUMBNAIL,
    @SIGNATURES1XML = dbo.UFN_DISBURSEMENTPROCESSTEMPLATE_SIGNATURES_TOITEMLISTXML(@ID, 0),
    @SIGNATURES2XML = dbo.UFN_DISBURSEMENTPROCESSTEMPLATE_SIGNATURES_TOITEMLISTXML(@ID, 1)
    from dbo.DISBURSEMENTPROCESSTEMPLATE T
  left outer join dbo.BANKACCOUNTAUTHORIZEDSIGNATURE B1 on B1.ID = T.SIGNATURE1ID
  left outer join dbo.SIGNATURE S1 on S1.ID = B1.SIGNATUREID
  left outer join dbo.BANKACCOUNTAUTHORIZEDSIGNATURE B2 on B2.ID = T.SIGNATURE2ID
  left outer join dbo.SIGNATURE S2 on S2.ID = B2.SIGNATUREID
    where T.ID = @ID

    return 0;