USP_DATAFORMTEMPLATE_ADD_PDACCOUNTCODEMAPDEVELOPMENT_COMMITMENTREVALUATIONCURRENCY
The save procedure used by the add dataform template "Map Development Commitment Revaluation Currency 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. |
@PAYMENTMETHODS | xml | IN | Type |
@REVENUETYPES | xml | IN | Revenue types |
@SUBTYPEONE | xml | IN | Currency |
@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_PDACCOUNTCODEMAPDEVELOPMENT_COMMITMENTREVALUATIONCURRENCY
(
@SYSTEMID uniqueidentifier,
@ID uniqueidentifier = null output,
@CHANGEAGENTID uniqueidentifier = null,
@PAYMENTMETHODS xml = null,
@REVENUETYPES xml = null,
@SUBTYPEONE 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 = 'C256C03B-8FD7-4D16-B6C3-5C2C05D7FA92';
set @PDACCOUNTSYSTEMID = @SYSTEMID;
declare @OFFICEID int;
set @OFFICEID = 17;
begin try
-- handle inserting the data
begin tran
insert into dbo.PDACCOUNTCODEMAPPING
(
ID,
PDACCOUNTSYSTEMID,
REVENUETYPE,
PAYMENTMETHOD,
PDACCOUNTCODEMAPOFFICEID,
OFFICEID,
DEBITGLACCOUNTID,
DEBITPDACCOUNTSEGMENTVALUEID,
CREDITGLACCOUNTID,
CREDITPDACCOUNTSEGMENTVALUEID,
ADDEDBYID,
CHANGEDBYID,
DATEADDED,
DATECHANGED
)
values
(
@ID,
@PDACCOUNTSYSTEMID,
(select sum(NAMEID) from dbo.UFN_PDACCOUNTCODEMAPPING_REVENUETYPES_FROMITEMLISTXML(@REVENUETYPES)),
(select sum(NAMEID) from dbo.UFN_PDACCOUNTCODEMAPPING_PAYMENTMETHODS_FROMITEMLISTXML(@PAYMENTMETHODS)),
@PDACCOUNTCODEMAPOFFICEID,
@OFFICEID,
@DEBITGLACCOUNTID,
@DEBITPDACCOUNTSEGMENTVALUEID,
@CREDITGLACCOUNTID,
@CREDITPDACCOUNTSEGMENTVALUEID,
@CHANGEAGENTID,
@CHANGEAGENTID,
@CURRENTDATE,
@CURRENTDATE
)
if not exists
(
select
*
from
dbo.UFN_PDACCOUNTCODEMAPPINGSUBTYPE_SUBTYPEONE_FROMITEMLISTXML(@SUBTYPEONE)
where
SUBTYPEONEID = '99999999-9999-9999-9999-999999999999'
)
insert into dbo.PDACCOUNTCODEMAPPINGSUBTYPE
(
ADDITIONALSUBTYPE,
PDACCOUNTCODEMAPPINGID,
SUBTYPEID,
ADDEDBYID,
CHANGEDBYID,
DATEADDED,
DATECHANGED
)
select
9,
@ID,
SUBTYPEONEID,
@CHANGEAGENTID,
@CHANGEAGENTID,
@CURRENTDATE,
@CURRENTDATE
from
dbo.UFN_PDACCOUNTCODEMAPPINGSUBTYPE_SUBTYPEONE_FROMITEMLISTXML(@SUBTYPEONE);
else
insert into dbo.PDACCOUNTCODEMAPPINGSUBTYPE
(
ADDITIONALSUBTYPE,
PDACCOUNTCODEMAPPINGID,
SUBTYPEID,
ADDEDBYID,
CHANGEDBYID,
DATEADDED,
DATECHANGED
)
values
(
9,
@ID,
'99999999-9999-9999-9999-999999999999',
@CHANGEAGENTID,
@CHANGEAGENTID,
@CURRENTDATE,
@CURRENTDATE
);
commit
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0