USP_DATAFORMTEMPLATE_EDITLOAD_BANKACCOUNTDEPOSITCORRECTIONGLDISTRIBUTION

The load procedure used by the edit dataform template "Bank Account Deposit Correction GL Distribution 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.
@AMOUNT money INOUT Transaction amount
@GLDISTRIBUTION xml INOUT Bank account deposit correction GL distribution
@PDACCOUNTSYSTEMID uniqueidentifier INOUT Account System
@TRANSACTIONCURRENCYID uniqueidentifier INOUT Transaction currency ID

Definition

Copy

CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_BANKACCOUNTDEPOSITCORRECTIONGLDISTRIBUTION(
  @ID uniqueidentifier,
  @DATALOADED bit = 0 output,
  @TSLONG bigint = 0 output,
    @AMOUNT money = null output,
  @GLDISTRIBUTION xml = null output,
  @PDACCOUNTSYSTEMID uniqueidentifier = null output
  ,@TRANSACTIONCURRENCYID uniqueidentifier = null output
)
as

    set nocount on;

    -- be sure to set these, in case the select returns no rows
    set @DATALOADED = 0
    set @TSLONG = 0

    set @GLDISTRIBUTION = (
    select
      GLDISTRIBUTION.ID, 
      GLDISTRIBUTION.GLTRANSACTIONID,
      GLDISTRIBUTION.TRANSACTIONTYPECODE, 
      GLDISTRIBUTION.GLACCOUNTID,
      GLDISTRIBUTION.PROJECT,
      GLDISTRIBUTION.TRANSACTIONAMOUNT AMOUNT, 
      GLDISTRIBUTION.REFERENCE, 
      GLDISTRIBUTION.TRANSACTIONCURRENCYID
    from dbo.UFN_BANKACCOUNTDEPOSITCORRECTION_GETGLDISTRIBUTION(@ID) GLDISTRIBUTION
        inner join dbo.GLTRANSACTION on GLDISTRIBUTION.GLTRANSACTIONID = GLTRANSACTION.ID
        where SYSTEMDISTRIBUTION = 0
    for xml raw('ITEM'),type,elements,root('GLDISTRIBUTION'),BINARY BASE64
  );

    select
        @DATALOADED = 1,
        @AMOUNT = C.TRANSACTIONAMOUNT
    ,@PDACCOUNTSYSTEMID = BA.PDACCOUNTSYSTEMID
    ,@TRANSACTIONCURRENCYID = BAD.TRANSACTIONCURRENCYID
    from dbo.BANKACCOUNTDEPOSITCORRECTION C
  inner join dbo.BANKACCOUNTDEPOSIT BAD on BAD.ID = C.DEPOSITID
  inner join dbo.BANKACCOUNTTRANSACTION T on T.ID = C.DEPOSITID
  inner join dbo.BANKACCOUNT BA on BA.ID = T.BANKACCOUNTID
    where C.ID = @ID

  if @DATALOADED = 1
    select @TSLONG = MAX(TSLONG) from dbo.BANKACCOUNTDEPOSITCORRECTIONGLDISTRIBUTION where BANKACCOUNTDEPOSITCORRECTIONID = @ID;

  return 0;