USP_DATAFORMTEMPLATE_EDITLOAD_GLACCOUNT2

The load procedure used by the edit dataform template "Account Edit Form 2"

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.
@ACCOUNTNUMBER nvarchar(100) INOUT Account number
@ACCOUNTDESCRIPTION nvarchar(100) INOUT Description
@CATEGORY nvarchar(10) INOUT Category
@ACCTFORMAT nvarchar(101) INOUT Account format
@EXISTINGTRANSACTIONS bit INOUT
@ACCOUNTALIAS nvarchar(100) INOUT Account alias

Definition

Copy


CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_GLACCOUNT2
(
    @ID uniqueidentifier,
    @DATALOADED bit = 0 output,
    @TSLONG bigint = 0 output,
    @ACCOUNTNUMBER nvarchar(100) = null output,
    @ACCOUNTDESCRIPTION nvarchar(100) = null output,
    @CATEGORY nvarchar(10) = null output,
    @ACCTFORMAT nvarchar(101) = null output,
    @EXISTINGTRANSACTIONS bit = null output,
    @ACCOUNTALIAS nvarchar(100) = null output
)
as
    set nocount on;

    set @DATALOADED = 0;
    set @TSLONG = 0;

  if @ACCOUNTALIAS is null
    set @ACCOUNTALIAS = '';

    declare @PDACCOUNTSYSTEMID uniqueidentifier    
    select
        @DATALOADED = 1,
        @TSLONG = TSLONG,
        @ACCOUNTNUMBER = ACCOUNTNUMBER,
        @ACCOUNTDESCRIPTION = ACCOUNTDESCRIPTION,
        @PDACCOUNTSYSTEMID = PDACCOUNTSYSTEMID,
        @CATEGORY = null
    -- PDCATEGORYDEFINITION.CATEGORYNAME,

    @ACCOUNTALIAS = ACCOUNTALIAS
    from
        dbo.GLACCOUNT
    where
        ID = @ID;

    select @ACCTFORMAT = dbo.UFN_PDACCOUNTSTRUCTURE_DEFINEMASK2(@PDACCOUNTSYSTEMID)

    set @EXISTINGTRANSACTIONS = '0'
    select @EXISTINGTRANSACTIONS = '1' 
    from dbo.GLACCOUNT 
    inner join dbo.JOURNALENTRY on JOURNALENTRY.GLACCOUNTID = GLACCOUNT.ID
    option (recompile)

  return 0;