USP_SIMPLEDATALIST_ATTRIBUTECURRENCY

Returns the list of currencies that should be available when adding a currency attribute to the system.

Parameters

Parameter Parameter Type Mode Description
@TRANSACTIONCURRENCYID uniqueidentifier IN
@BASECURRENCYID uniqueidentifier IN
@CURRENTCURRENCYID uniqueidentifier IN
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.

Definition

Copy


                create procedure dbo.USP_SIMPLEDATALIST_ATTRIBUTECURRENCY
                    (
                        @TRANSACTIONCURRENCYID uniqueidentifier = null,
                        @BASECURRENCYID uniqueidentifier = null,
                        @CURRENTCURRENCYID uniqueidentifier = null,
                        @CURRENTAPPUSERID uniqueidentifier = null
                    )
                    as
                        --Get appuser currency set

                        declare @APPUSERCURRENCYSET uniqueidentifier;
                        select @APPUSERCURRENCYSET = dbo.UFN_CURRENCYSET_GETAPPUSERCURRENCYSET(@CURRENTAPPUSERID);

                        --Return distinct currencies.            

                        select distinct
                            CURRENCY.ID as VALUE,
                            CURRENCY.NAME + ' (' + CURRENCY.ISO4217 + ')' as LABEL
                        from dbo.CURRENCY
                            inner join (
                                --Appuser currency set transaction currencies        

                                select 
                                    CURRENCYID
                                from
                                    dbo.UFN_CURRENCYSET_GETTRANSACTIONCURRENCIES(@APPUSERCURRENCYSET)

                                union all

                                --Organization currency

                                select dbo.UFN_CURRENCY_GETORGANIZATIONCURRENCY() as CURRENCYID

                                union all

                                --Currency parameter passed in

                                select @CURRENTCURRENCYID as CURRENCYID

                                union all

                                --Transaction currency of given record.

                                select @TRANSACTIONCURRENCYID

                                union all

                                --Base currency of given record.

                                select @BASECURRENCYID

                            ) AVAILABLECURRENCY on AVAILABLECURRENCY.CURRENCYID = CURRENCY.ID

                        order by LABEL