USP_DATAFORMTEMPLATE_ADD_PDACCOUNTCODEMAPDEVELOPMENTGIFTAID2

The save procedure used by the add dataform template "Map Development Gift Aid Add Form 2".

Parameters

Parameter Parameter Type Mode Description
@SYSTEMID uniqueidentifier IN Input parameter indicating the context ID for the record being added.
@ID uniqueidentifier INOUT The output parameter indicating the ID of the record added.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the procedure.
@REVENUETYPES xml IN Transaction types
@DEBITGLACCOUNTID uniqueidentifier IN Account
@DEBITPDACCOUNTSEGMENTVALUEID uniqueidentifier IN Account code
@CREDITGLACCOUNTID uniqueidentifier IN Account
@CREDITPDACCOUNTSEGMENTVALUEID uniqueidentifier IN Account code
@PDACCOUNTSYSTEMID uniqueidentifier IN

Definition

Copy

    CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_PDACCOUNTCODEMAPDEVELOPMENTGIFTAID2
    (
        @SYSTEMID uniqueidentifier,
        @ID uniqueidentifier = null output,
        @CHANGEAGENTID uniqueidentifier = null,
        @REVENUETYPES xml = null,
        @DEBITGLACCOUNTID uniqueidentifier = null,
        @DEBITPDACCOUNTSEGMENTVALUEID uniqueidentifier = null,
        @CREDITGLACCOUNTID uniqueidentifier = null,
        @CREDITPDACCOUNTSEGMENTVALUEID uniqueidentifier = null,
        @PDACCOUNTSYSTEMID uniqueidentifier = null
    )
    as

    set nocount on;

    if @ID is null
        set @ID = newid()

    if @CHANGEAGENTID is null  
        exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output

    declare @CURRENTDATE datetime
    set @CURRENTDATE = getdate()
    declare @PDACCOUNTCODEMAPOFFICEID uniqueidentifier
    set @PDACCOUNTCODEMAPOFFICEID = '46920386-2344-42c9-9572-192FBBF06E91'
    set @PDACCOUNTSYSTEMID = @SYSTEMID
    declare @OFFICEID int
    set @OFFICEID = 12
    begin try
        begin tran
            insert into dbo.PDACCOUNTCODEMAPPING
                (ID, REVENUETYPE, PDACCOUNTCODEMAPOFFICEID, OFFICEID, DEBITGLACCOUNTID, DEBITPDACCOUNTSEGMENTVALUEID, CREDITGLACCOUNTID, CREDITPDACCOUNTSEGMENTVALUEID, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED, PDACCOUNTSYSTEMID)
            values
                (@ID, (select sum(NAMEID) from dbo.UFN_PDACCOUNTCODEMAPPING_REVENUETYPES_FROMITEMLISTXML(@REVENUETYPES)), @PDACCOUNTCODEMAPOFFICEID, @OFFICEID, @DEBITGLACCOUNTID, @DEBITPDACCOUNTSEGMENTVALUEID, @CREDITGLACCOUNTID, @CREDITPDACCOUNTSEGMENTVALUEID, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE, @SYSTEMID)

        commit
    end try

    begin catch
        exec dbo.USP_RAISE_ERROR
        return 1
    end catch

    return 0