USP_DATAFORMTEMPLATE_ADD_FEPPROCESS
The save procedure used by the add dataform template "FEP Process Add Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@NAME | nvarchar(150) | IN | Name |
@DESCRIPTION | nvarchar(250) | IN | Description |
@SITEID | uniqueidentifier | IN | Site |
@ORGANIZATIONNAME | nvarchar(50) | IN | Organization name |
@COUNTRYID | uniqueidentifier | IN | Country |
@POSTCODE | nvarchar(12) | IN | ZIP Code |
@IDNUMBER | nvarchar(15) | IN | Identification number |
@CONTACTNAME | nvarchar(50) | IN | Contact person |
@CONTACTEMAIL | nvarchar(100) | IN | Email address |
@CONTACTPHONE | nvarchar(20) | IN | Phone |
@AFP | bit | IN | AFP (Association of Fundraising Professionals) |
@CASE | bit | IN | CASE (Council for Advancement and Support of Education) |
@AHP | bit | IN | AHP (Association for Healthcare Philanthropy) |
@ALDE | bit | IN | ALDE (Association of Lutheran Development Executives) |
@NCPG | bit | IN | NCPG (National Committee on Planned Giving) |
@CRD | bit | IN | CRD (Council for Resource Development) |
@OTHER | bit | IN | Other (please specify) |
@OTHERAFFILIATION | nvarchar(50) | IN | |
@INITIALYEAR | UDT_YEAR | IN | Year development program initiated (YYYY) |
@SUBSECTORCODE | tinyint | IN | Subsector or type of organization |
@FUNDRAISINGEXPENSES | money | IN | Fundraising Expenses |
@FTEPROFESSIONAL | decimal(20, 2) | IN | Full-time Professional staff (Period 2) |
@FTESUPPORT | decimal(20, 2) | IN | Full-time Support staff (Period 2) |
@FTECONSULTANT | decimal(20, 2) | IN | Consultant full-time equivalent (Period 2) |
@FTEVOLUNTEER | decimal(20, 2) | IN | Full-time Volunteer fundraisers (Period 2) |
@COMMENTS | nvarchar(250) | IN | Comments |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_FEPPROCESS
(
@ID uniqueidentifier = null output,
@CURRENTAPPUSERID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@NAME nvarchar(150) = '',
@DESCRIPTION nvarchar(250) = '',
@SITEID uniqueidentifier = null,
@ORGANIZATIONNAME nvarchar(50) = '',
@COUNTRYID uniqueidentifier = null,
@POSTCODE nvarchar(12) = '',
@IDNUMBER nvarchar(15) = '',
@CONTACTNAME nvarchar(50) = '',
@CONTACTEMAIL nvarchar(100) = '',
@CONTACTPHONE nvarchar(20) = '',
@AFP bit = 0,
@CASE bit = 0,
@AHP bit = 0,
@ALDE bit = 0,
@NCPG bit = 0,
@CRD bit = 0,
@OTHER bit = 0,
@OTHERAFFILIATION nvarchar(50) = '',
@INITIALYEAR dbo.UDT_YEAR = null,
@SUBSECTORCODE tinyint = 0,
@FUNDRAISINGEXPENSES money = 0,
@FTEPROFESSIONAL decimal(20,2) = 0,
@FTESUPPORT decimal(20,2) = 0,
@FTECONSULTANT decimal(20,2) = 0,
@FTEVOLUNTEER decimal(20,2) = 0,
@COMMENTS nvarchar(250) = ''
)
as
set nocount on;
declare @CURRENTDATE datetime = getDate();
if @ID is null
set @ID = NewID();
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
begin try
if @SITEID is not null
begin
if dbo.UFN_SITEALLOWEDFORUSER(@CURRENTAPPUSERID, @SITEID) = 0
raiserror('ERR_SITE_NOACCESS', 13, 1);
end
else
begin
if dbo.UFN_SITEREQUIREDFORUSER(@CURRENTAPPUSERID) = 1
raiserror('ERR_SITEREQUIRED', 13, 1);
end
insert into dbo.FEPPROCESS
(ID, NAME, DESCRIPTION, SITEID, ORGANIZATIONNAME, COUNTRYID, POSTCODE, IDNUMBER,
CONTACTNAME, CONTACTEMAIL, CONTACTPHONE, AFP, [CASE], AHP, ALDE, NCPG, CRD, OTHER, OTHERAFFILIATION,
INITIALYEAR, SUBSECTORCODE, FUNDRAISINGEXPENSES, FTEPROFESSIONAL, FTESUPPORT, FTECONSULTANT, FTEVOLUNTEER,
COMMENTS, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
values
(@ID, @NAME, @DESCRIPTION, @SITEID, @ORGANIZATIONNAME, @COUNTRYID, @POSTCODE, @IDNUMBER,
@CONTACTNAME, @CONTACTEMAIL, @CONTACTPHONE, @AFP, @CASE, @AHP, @ALDE, @NCPG, @CRD, @OTHER, @OTHERAFFILIATION,
@INITIALYEAR, @SUBSECTORCODE, @FUNDRAISINGEXPENSES, @FTEPROFESSIONAL, @FTESUPPORT, @FTECONSULTANT, @FTEVOLUNTEER,
@COMMENTS, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE);
-- Add Submit process
declare @FEPSUBMITPROCESSID uniqueidentifier = newID();
insert into dbo.FEPSUBMITPROCESS
(ID, FEPPROCESSID, NAME, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
values
(@FEPSUBMITPROCESSID, @ID, @NAME, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE);
exec dbo.USP_BUSINESSPROCESSINSTANCE_ADD
@CHANGEAGENTID = @CHANGEAGENTID,
@BUSINESSPROCESSCATALOGID = 'cad79b29-5309-4650-b452-d03f379bdc60',
@BUSINESSPROCESSPARAMETERSETID = @FEPSUBMITPROCESSID,
@OWNERID = @CURRENTAPPUSERID,
@SITEID = @SITEID;
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;