USP_SIMPLEDATALIST_MANAGEPURPOSEDESIGNATIONINFORMATION

Returns the 'New Value' list from the selected field

Parameters

Parameter Parameter Type Mode Description
@NAMECODE int IN Name code
@VSECATEGORYID uniqueidentifier IN VSE Category ID
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.

Definition

Copy


CREATE procedure dbo.USP_SIMPLEDATALIST_MANAGEPURPOSEDESIGNATIONINFORMATION
(
    @NAMECODE integer = null,
    @VSECATEGORYID uniqueidentifier = null,
    @CURRENTAPPUSERID uniqueidentifier  = null
)
as
begin
  set nocount on;
    -- Designation Records

    if (@NAMECODE = 4) or (@NAMECODE = 2)        --PurposeReportCode1 or DesignationReportCode1

            begin
                select
                    ID as VALUE,
                    DESCRIPTION as LABEL 
                from 
                    dbo.DESIGNATIONREPORT1CODE
                order by DESCRIPTION asc
            end        
    else if (@NAMECODE = 5) or (@NAMECODE = 3)        --PurposeReportCode2 or DesignationReportCode2

            begin
                select
                    ID as VALUE,
                    DESCRIPTION as LABEL 
                from 
                    dbo.DESIGNATIONREPORT2CODE
                order by DESCRIPTION asc;
            end        
    else if @NAMECODE = 6        --IsRevenueDesignation

            begin
                select
                    convert(uniqueidentifier,'00000000-0000-0000-0000-000000000001') as VALUE,
                    'Yes' as LABEL 
                union all
                select
                    convert(uniqueidentifier,'00000000-0000-0000-0000-000000000002') as VALUE,
                    'No' as LABEL 
            end
    else if @NAMECODE = 7        --UseCode

            begin
                select
                    ID as VALUE,
                    DESCRIPTION as LABEL 
                from 
                    dbo.DESIGNATIONUSECODE
                order by DESCRIPTION asc;
            end
    else if @NAMECODE = 8        --VSECategory

            begin
                exec dbo.USP_SIMPLEDATALIST_VSECATEGORIESCOLLEGE
            end
    else if (@NAMECODE = 9 and @VSECATEGORYID is not null)        --VESSubCategory

            begin
                exec dbo.USP_SIMPLEDATALIST_VSESUBCATEGORIES @VSECATEGORYID
            end    

    -- Purpose Records

    else if @NAMECODE = 0        --Category

            begin
                select
                    ID as VALUE,
                    DESCRIPTION as LABEL 
                from 
                    dbo.DESIGNATIONLEVELCATEGORYCODE
                order by DESCRIPTION asc
            end        
    else if @NAMECODE = 1        --Site

            begin
                exec dbo.USP_SIMPLEDATALIST_SITESFORUSER @CURRENTAPPUSERID
            end

end