SELECT case when bsr.fspro_userid is not null then bsr.firstName else case when rm.fspro_userid is not null then rm.firstName else pm.firstName end end cmFirstName, case when bsr.fspro_userid is not null then bsr.lastName else case when rm.fspro_userid is not null then rm.lastName else pm.lastName end end cmLastName, case when bsr.fspro_userid is not null then bsr.email else case when rm.fspro_userid is not null then rm.email else pm.email end end cmEmail, coalesce( bsr.fspro_userid, coalesce( rm.fspro_userid, pm.fspro_userid )) cmUserId FROM tbl_CDR_Distributors cdr INNER JOIN tbl_TER_Territories t ON t.territoryid = cdr.cdr_territoryid AND t.ownerid = cdr.ownerid AND t.fsl_tablecode = cdr.fsl_tablecode left outer join tbl_FSPro_Members pm on pm.fspro_userId = t.primaryManager and pm.ownerId = t.ownerId and pm.fsl_tablecode = t.fsl_tablecode left outer join tbl_FSpro_Members bsr on bsr.fspro_userid = cdr.mfr_bsr_id left outer join tbl_SMA_BrokerOfficeLink sma on sma.territoryId = t.territoryId and sma.primaryOffice = 'Y' left outer join tbl_SEC_MemGrpLink rml on rml.partnerId = t.ownerId and rml.partnerTyp = t.fsl_tablecode and rml.brokerOfficeId = sma.brokerOfficeID and rml.groupId = left outer join tbl_FSpro_Members rm on rm.fspro_userid = rml.fspro_userId WHERE cdr.fsl_tablecode = AND cdr.ownerid = and cdr.cdr_recordId =

#qmd_dispCDRDistrProfile.cdr_dstname#&##160;&##160;[#qmd_lookupCustomerManager.cmFirstName# #qmd_lookupCustomerManager.cmLastName#]

Add New Distributor
#htmleditformat( qmd_dispCDRDistrProfile.cdr_dstAddress1 )#unknown street, #htmleditformat( qmd_dispCDRDistrProfile.cdr_dstcity)#unknown city, #qmd_dispCDRDistrProfile.cdr_dststate#unknown state
#htmleditformat( qmd_dispCDRDistrProfile.cdr_dstcode )#&##160;
 
select eventId, eventName from tbl_EVT_Events where partnerId = and partnerType = 'CDR' and ownerId = and ownerType = and ownerType = 'MFR' ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "dtl", "Profile", true, true, client.cdr_selectedTab eq "dtl" )); if ( request.portalConfiguration.apps.102.profile.contactsTabEnabled ) { ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "cntct", "Contacts", tabEnabled, tabEnabled, client.cdr_selectedTab eq "cntct" )); } if( _showPurchasing and ( request.portalConfiguration.apps.102.profile.purchasingTabEnabled )) { ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "pp", "Purchasing", tabEnabled, tabEnabled, client.cdr_selectedTab eq "pp" )); } if( /*#attributes.ownerType# neq "BRO" and */ attributes.ownerId neq 643 and request.portalConfiguration.apps.102.profile.interactionsTabEnabled ){ ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "inits", "Interactions", tabEnabled, tabEnabled, client.cdr_selectedTab eq "inits" )); } if( _showTrade and request.portalConfiguration.apps.102.profile.tradeTabEnabled ) { ArrayAppend( myTabConfig.tabset, buildDistributorTab( "tpm", "Trade", tabEnabled, tabEnabled, client.cdr_selectedTab eq "tpm" )); } if( qmd_events.recordCount or ( listFindNoCase("G,P",qmd_dispCDRDistrProfile.cdr_dstCompanytype) AND request.portalConfiguration.apps.102.usingConferenceApp eq true) ) { ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "conf", "Conf.", tabEnabled, tabEnabled, client.cdr_selectedTab eq "conf" )); } if( _showOpportunities and request.portalConfiguration.apps.102.profile.opportunitiesTabEnabled ) { _busPlanTabName = "Opportunities"; if( qmd_events.recordCount ) { _busPlanTabName = "Opps."; } ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "spl", _busPlanTabName, tabEnabled, tabEnabled, client.cdr_selectedTab eq "spl" )); } /* if( _showInteractions ) { ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "inits", "Interactions", tabEnabled, tabEnabled, client.cdr_selectedTab eq "inits" )); } */ /* if((( client.ownerId eq 1984 or client.ownerId eq 1644 or client.ownerId eq 241 or client.ownerId eq 1) and client.ownerType eq "MFR" ) or cgi.server_name eq "dev.fsenablers.com" or listFind( client.permissionList, "MarketManagementApp" )) { ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "pp", "Purchasing", tabEnabled, tabEnabled, client.cdr_selectedTab eq "pp" )); if( client.ownerId neq 241 ) { ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "spl", "Opportunities", tabEnabled, tabEnabled, client.cdr_selectedTab eq "spl" )); } } */ if( qmd_distributorDetails.cdr_dstcompanytype eq "B") { if( _showManufacturers ) { ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "mfr", "Manufacturers", tabEnabled, tabEnabled, client.cdr_selectedTab eq "mfr" )); } ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "opr", "Operators", tabEnabled, tabEnabled, client.cdr_selectedTab eq "opr" )); } else if( qmd_distributorDetails.cdr_dstcompanytype eq "P") { ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "branches", "Branches", tabEnabled, tabEnabled, client.cdr_selectedTab eq "branches" )); } else if ( qmd_distributorDetails.cdr_dstCompanyType eq "G") { ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "affiliates", "Members", tabEnabled, tabEnabled, client.cdr_selectedTab eq "affiliates" )); } if( attributes.ownerType eq "BRO" and structKeyExists( request.portalConfiguration.apps, "BID" )) { ArrayAppend( myTabConfig.tabset, buildDistributorTab( "bids", "Bids", tabEnabled, tabEnabled, client.cdr_selectedTab eq "bids" )); } if ( request.portalConfiguration.apps.102.profile.notesTabEnabled ) { ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "notes", "Notes", tabEnabled, tabEnabled, client.cdr_selectedTab eq "notes" )); } if ( request.portalConfiguration.apps.102.profile.filesTabEnabled ) { ArrayAppend( myTabConfig.tabSet, buildDistributorTab( "files", "Files", tabEnabled, tabEnabled, client.cdr_selectedTab eq "files" )); } #distributorTabSet#
 
--->