USP_DATAFORMTEMPLATE_EDITLOAD_ALLOWGLDISTRIBUTIONS

The load procedure used by the edit dataform template "Allow GL Distributions 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.
@ALLOWGLDISTRIBUTIONS bit INOUT Allow GL distributions
@PDACCOUNTSYSTEMID uniqueidentifier INOUT
@GLDISTRIBUTIONSSETTING nvarchar(max) INOUT
@PDACCOUNTSYSTEMNAME nvarchar(50) INOUT Account system
@HASUNPOSTEDTRANSACTIONS bit INOUT Has unposted transactions

Definition

Copy

                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_ALLOWGLDISTRIBUTIONS
                    (
                            @ID uniqueidentifier,
                            @DATALOADED bit = 0 output,
                            @TSLONG bigint = 0 output,
                            @ALLOWGLDISTRIBUTIONS bit = null output,
                            @PDACCOUNTSYSTEMID uniqueidentifier = null output,
                            @GLDISTRIBUTIONSSETTING nvarchar(max) = null output,
                            @PDACCOUNTSYSTEMNAME nvarchar(50) = null output,
                            @HASUNPOSTEDTRANSACTIONS bit = null output
                    )
                    as

                        set nocount on;

                        set @DATALOADED = 0
                        set @TSLONG = 0

                        select
                            @DATALOADED = 1,
                            @TSLONG = TSLONG,
                            @ALLOWGLDISTRIBUTIONS = ALLOWGLDISTRIBUTIONS,
                            @PDACCOUNTSYSTEMID = @ID,
                            @PDACCOUNTSYSTEMNAME = NAME
                        from
                            dbo.PDACCOUNTSYSTEM
                        where
                            ID = @ID

                        set @HASUNPOSTEDTRANSACTIONS = 0;

                        if exists(
                                select
                                    1
                                from
                                    dbo.FINANCIALTRANSACTIONLINEITEM LI
                                inner join
                                    dbo.FINANCIALTRANSACTION FT
                                on
                                    FT.ID = LI.FINANCIALTRANSACTIONID
                                where
                                    FT.PDACCOUNTSYSTEMID = @ID
                                and
                                    LI.POSTSTATUSCODE = 1
                            )
                            set
                                @HASUNPOSTEDTRANSACTIONS = 1;

                        return 0;