USP_DATAFORMTEMPLATE_ADD_PDACCOUNTCODEMAPDEVELOPMENTGIFTFEE

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

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 Revenue types
@APPLICATIONTYPES xml IN Application types
@PAYMENTMETHODS xml IN Payment methods
@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_PDACCOUNTCODEMAPDEVELOPMENTGIFTFEE
                (
                    @SYSTEMID uniqueidentifier,
                    @ID uniqueidentifier = null output,
                    @CHANGEAGENTID uniqueidentifier = null,
                    @REVENUETYPES xml = null,
                    @APPLICATIONTYPES xml = null,
                    @PAYMENTMETHODS 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
                declare @PaymentMethodsTable table (NameID int)

                set @CURRENTDATE = getdate()
                declare @PDACCOUNTCODEMAPOFFICEID uniqueidentifier
                set @PDACCOUNTCODEMAPOFFICEID = '2DBCE41F-9A2C-4FED-9513-BC09CDE4496C'
                set @PDACCOUNTSYSTEMID = @SYSTEMID
                declare @OFFICEID int
                set @OFFICEID = 15

                begin try
                  insert into @PaymentMethodsTable (NameID)
                  select NameID from dbo.UFN_PDACCOUNTCODEMAPPING_PAYMENTMETHODS_FROMITEMLISTXML(@PAYMENTMETHODS)

                    insert into dbo.PDACCOUNTCODEMAPPING
                        (ID, REVENUETYPE, APPLICATIONTYPE, PAYMENTMETHOD, PDACCOUNTCODEMAPOFFICEID, OFFICEID, DEBITGLACCOUNTID, DEBITPDACCOUNTSEGMENTVALUEID, CREDITGLACCOUNTID, CREDITPDACCOUNTSEGMENTVALUEID,ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED,PDACCOUNTSYSTEMID)
                    values
                        (@ID, (select sum(NAMEID) from dbo.UFN_PDACCOUNTCODEMAPPING_REVENUETYPES_FROMITEMLISTXML(@REVENUETYPES)), (select sum(NAMEID) from dbo.UFN_PDACCOUNTCODEMAPPING_APPLICATIONTYPES_FROMITEMLISTXML(@APPLICATIONTYPES)), (select sum(NAMEID) from @PaymentMethodsTable), @PDACCOUNTCODEMAPOFFICEID, @OFFICEID, @DEBITGLACCOUNTID, @DEBITPDACCOUNTSEGMENTVALUEID, @CREDITGLACCOUNTID, @CREDITPDACCOUNTSEGMENTVALUEID, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE, @SYSTEMID)

                end try

                begin catch
                    rollback
                    exec dbo.USP_RAISE_ERROR
                    return 1
                end catch

                return 0