USP_DATAFORMTEMPLATE_EDITLOAD_WPBUSINESSOWNERSHIP_ORG

The load procedure used by the edit dataform template "Organization Business Ownership Edit Form"

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter used to load the fields defined on the form.
@DATALOADED bit INOUT Output parameter indicating whether or not data was actually loaded.
@TSLONG bigint INOUT Output parameter indicating the TSLONG value of the record being edited. This is used to manage multi-user concurrency issues when multiple users access the same record.
@SOURCE nvarchar(100) INOUT Source
@COMPANY nvarchar(100) INOUT Company
@SICNAME nvarchar(100) INOUT Trade name
@LINE_OF_BUSINESS_DESCRIPTION nvarchar(50) INOUT Description
@PHONE nvarchar(20) INOUT Phone
@LINE1 nvarchar(150) INOUT Company address
@CITY nvarchar(30) INOUT Company city
@STATE nvarchar(100) INOUT Company state
@ZIP nvarchar(10) INOUT Company ZIP
@MAILINGLINE1 nvarchar(150) INOUT Mailing address
@MAILINGCITY nvarchar(30) INOUT Mailing city
@MAILINGSTATE nvarchar(100) INOUT Mailing state
@MAILINGZIP nvarchar(10) INOUT Mailing ZIP
@DUNS nvarchar(10) INOUT DUNS
@SIC_CODE nvarchar(4) INOUT SIC code
@YEAR_STARTED UDT_YEAR INOUT Year started
@EMPLOYEES_TOTAL int INOUT # of employees
@HELDCODE tinyint INOUT Held
@SALES_VOLUME money INOUT Sales
@VALUATION money INOUT Valuation
@PERCENTAGE decimal(20, 4) INOUT % ownership
@OWNERSHIPVALUEOVERRIDE money INOUT Ownership value
@OWNERSHIPVALUEOVERRIDDEN bit INOUT Ownership value overridden
@CNOTES nvarchar(1024) INOUT Notes
@WPBUSINESSOWNERSHIPBIOS xml INOUT
@WPBUSINESSOWNERSHIPOWNERSHIP xml INOUT
@ISBUILTIN bit INOUT

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_WPBUSINESSOWNERSHIP_ORG(
                        @ID uniqueidentifier,
                        @DATALOADED bit = 0 output,
                        @TSLONG bigint = 0 output,

                        @SOURCE nvarchar(100) = null output,
                        @COMPANY nvarchar(100) = null output,
                        @SICNAME nvarchar(100) = null output,
                        @LINE_OF_BUSINESS_DESCRIPTION nvarchar(50) = null output,

                        @PHONE nvarchar(20) = null output,

                        @LINE1 nvarchar(150) = null output,
                        @CITY nvarchar(30) = null output,
                        @STATE nvarchar(100) = null output,
                        @ZIP nvarchar(10) = null output,

                        @MAILINGLINE1 nvarchar(150) = null output,
                        @MAILINGCITY nvarchar(30) = null output,
                        @MAILINGSTATE nvarchar(100) = null output,
                        @MAILINGZIP nvarchar(10) = null output,

                        @DUNS nvarchar(10) = null output,
                        @SIC_CODE nvarchar(4) = null output,
                        @YEAR_STARTED dbo.UDT_YEAR = null output,
                        @EMPLOYEES_TOTAL int = null output,
                        @HELDCODE tinyint = null output,
                        @SALES_VOLUME money = null output,
                        @VALUATION money = null output,
                        @PERCENTAGE decimal(20,4) = null output,
                        @OWNERSHIPVALUEOVERRIDE money = null output,
                        @OWNERSHIPVALUEOVERRIDDEN bit = null output,
                        @CNOTES nvarchar(1024) = null output,
                        @WPBUSINESSOWNERSHIPBIOS xml = null output,
                        @WPBUSINESSOWNERSHIPOWNERSHIP xml = null output,

                        @ISBUILTIN bit = null output
                    ) as begin

                        set nocount on;

                        set @DATALOADED = 0;
                        set @TSLONG = 0;                        

                        select 
                            @DATALOADED = 1,
                            @TSLONG = BO.TSLONG,
                            @SOURCE = BO.SOURCE,
                            @CNOTES = BO.CNOTES,
                            @LINE1 = BO.LINE1,
                            @CITY = BO.CITY,
                            @STATE = BO.STATE,
                            @ZIP = BO.ZIP,
                            @HELDCODE = BO.HELDCODE,
                            @COMPANY = BO.COMPANY,
                            @PHONE = BO.PHONE,
                            @LINE_OF_BUSINESS_DESCRIPTION = BO.LINE_OF_BUSINESS_DESCRIPTION,
                            @SALES_VOLUME = BO.SALES_VOLUME,
                            @YEAR_STARTED = BO.YEAR_STARTED,
                            @EMPLOYEES_TOTAL = BO.EMPLOYEES_TOTAL,
                            @SIC_CODE = BO.SIC_CODE,
                            @DUNS = coalesce(RBO.DUNS, ''),
                            @PERCENTAGE = BO.PERCENTAGE,
                            @VALUATION = BO.VALUATION,
                            @MAILINGLINE1 = BO.MAILINGLINE1,
                            @MAILINGCITY = BO.MAILINGCITY,
                            @MAILINGSTATE = BO.MAILINGSTATE,
                            @MAILINGZIP = BO.MAILINGZIP,
                            @SICNAME = BO.SICNAME,
                            @WPBUSINESSOWNERSHIPBIOS = dbo.UFN_WPBUSINESSOWNERSHIP_BIOS_TOITEMLISTXML(@ID),
                            @WPBUSINESSOWNERSHIPOWNERSHIP = dbo.UFN_WPBUSINESSOWNERSHIP_OWNERSHIP_TOITEMLISTXML(@ID),
                            @OWNERSHIPVALUEOVERRIDE = BO.OWNERSHIPVALUEOVERRIDE,
                            @OWNERSHIPVALUEOVERRIDDEN = BO.OWNERSHIPVALUEOVERRIDDEN
                        from
                            dbo.WPBUSINESSOWNERSHIP BO
                        left join dbo.WPRELATIONSHIP_BO RBO
                            on BO.WPRELATIONSHIP_BO_ID = RBO.ID
                        where
                            BO.ID=@ID;

                        exec @ISBUILTIN = UFN_ISBUILTIN_WEALTHSOURCE @SOURCE;

                        return 0;

                    end;