USP_DATAFORMTEMPLATE_EXPRESSIONVIEW_BANKACCOUNTDEPOSITCORRECTION

The load procedure used by the view dataform template "Bank Account Deposit Correction Expression View 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.
@BANKACCOUNTDEPOSITID uniqueidentifier INOUT Bank account deposit Id
@TRANSACTIONNUMBER int INOUT Deposit number
@AMOUNT numeric(19, 4) INOUT Amount
@DATE datetime INOUT Date
@DEPOSITSTATUSCODE tinyint INOUT Deposit status
@BANKACCOUNTSTATUSCODE tinyint INOUT Bank account status
@LINKNAME nvarchar(100) INOUT Link name
@POSTSTATUSCODE tinyint INOUT Post status
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@SHOWGLINFO tinyint INOUT Show GL Information
@TRANSACTIONCURRENCYID uniqueidentifier INOUT Currency
@HASSYSTEMDISTRIBUTIONS bit INOUT HASSYSTEMDISTRIBUTIONS

Definition

Copy


CREATE procedure dbo.USP_DATAFORMTEMPLATE_EXPRESSIONVIEW_BANKACCOUNTDEPOSITCORRECTION
(
    @ID uniqueidentifier,
    @DATALOADED bit = 0 output,
    @BANKACCOUNTDEPOSITID uniqueidentifier = null output,
    @TRANSACTIONNUMBER int = null output,
    @AMOUNT numeric(19,4) = null output,
    @DATE datetime = null output,
    @DEPOSITSTATUSCODE tinyint = null output,
    @BANKACCOUNTSTATUSCODE tinyint = null output,
    @LINKNAME nvarchar(100) = null output,
    @POSTSTATUSCODE tinyint = null output,
    @CURRENTAPPUSERID uniqueidentifier = null,
    @SHOWGLINFO tinyint = null output
  ,@TRANSACTIONCURRENCYID uniqueidentifier = null output
  ,@HASSYSTEMDISTRIBUTIONS bit = null output
)
as
    set nocount on;

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

    set @DATALOADED = 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.

    select @DATALOADED = 1,
           @BANKACCOUNTDEPOSITID = D.ID,
           @TRANSACTIONNUMBER = T.TRANSACTIONNUMBER,
           @AMOUNT = C.TRANSACTIONAMOUNT,
       @DATE = C.DATE,
       @DEPOSITSTATUSCODE = D.STATUSCODE,
       @BANKACCOUNTSTATUSCODE = B.STATUSCODE,
       @LINKNAME = CAST(T.TRANSACTIONNUMBER as nvarchar(100)) + ' - ' + B.ACCOUNTNAME,
             @POSTSTATUSCODE = T.POSTSTATUSCODE
       ,@TRANSACTIONCURRENCYID = D.TRANSACTIONCURRENCYID
    from dbo.BANKACCOUNTDEPOSITCORRECTION C
  inner join dbo.BANKACCOUNTDEPOSIT D on C.DEPOSITID = D.ID
  inner join dbo.BANKACCOUNTTRANSACTION T on D.ID = T.ID
  inner join dbo.BANKACCOUNT B on T.BANKACCOUNTID = B.ID
    where C.ID = @ID

        set @SHOWGLINFO = 0
        if dbo.UFN_INSTALLEDPRODUCTS_PRODUCTIS('133F9BCA-00F1-4007-9792-586B931340C6') != 0
        begin
            if dbo.UFN_PDACCOUNTSYSTEM_GETNUMBEROFSYSTEMSFORUSER(@CURRENTAPPUSERID) > 1
                set @SHOWGLINFO = 1
        end

  if exists(select T.ID from dbo.GLTRANSACTION T inner join dbo.BANKACCOUNTDEPOSITCORRECTIONGLDISTRIBUTION D on D.GLTRANSACTIONID = T.ID where D.BANKACCOUNTDEPOSITCORRECTIONID = @ID and T.SYSTEMDISTRIBUTION = 1)
        set @HASSYSTEMDISTRIBUTIONS = 1;
    else
        set @HASSYSTEMDISTRIBUTIONS = 0;    

    return 0;