select int.interactiondate, case when int.partnertype = 'opr' then opr.companyname else cdr.cdr_dstname end as companyname from tbl_crm_interactions int with (nolock) left outer join tbl_opr_clientoperators opr with (nolock) on opr.operatorid = int.partnerid and int.partnertype = 'opr' left outer join tbl_cdr_distributors cdr with (nolock) on cdr.cdr_recordid = int.partnerid and int.partnertype <> 'opr' where int.interactionid = and int.ownerid = and int.ownertype = select email, firstname, lastname from tbl_crm_interactions int with (nolock) inner join tbl_fspro_members fsp with (nolock) on fsp.fspro_userid = int.contactid and fsp.ownerid = and fsp.fsl_tablecode = where int.interactionid = and int.ownerid = and int.ownertype =
Email Call Details
Options
Email
From: #client.email#
    Subject:

    item summary will go here

    sales call recap PDF attachment

    select count(*) as skucount from qcf_dispInteractionProducts where itemtype = 'SKU'
    select * from tbl_CRM_InteractionLinkedAssets ila with (nolock) where ila.ownerId = and ila.ownerType = and ila.interactionId = and ila.linkid = and ila.linkType = 'SKU' and ila.assetid = 0 and ila.assetType = 'NSS' select * from tbl_CRM_InteractionLinkedAssets ila with (nolock) where ila.ownerId = and ila.ownerType = and ila.interactionId = and ila.linkid = and ila.linkType = 'SKU' and ila.assetid = and ila.assetType = 'DOC'