SELECT cdr.cdr_dstname, cdr.cdr_dstaddress1, cdr.cdr_dstaddress2, cdr.cdr_dstcity, cdr.cdr_dststate, cdr.cdr_dstzip, dst.dstid, dst.dstname, dst.dstcompanytype, dst.dstparentco, dst.dstsaleschannel, dst.dstdisttype, dst.dstsptycat, dst.dstbuyinggrp, dst.dstaddr1, dst.dstaddr2, dst.dstcity, dst.dststate, dst.dstzip, dst.dstcountryid, dst.dstphoneac, dst.dstphone, dst.dstfaxac, dst.dstfax, dst.dsturl, dst.EmailDomain, dst.dstlogo, dst.dstprofile, dst.dstkeywords, dst.dstcomments, dst.dstlastupdate, dst.dstlastupdatenotes, dst.dstpubtrade, dst.dstexchsymbol, dst.dstprofileready, dst.recordlock, byg.name bygName, img.imageThumb, img.contentPath FROM tbl_CDR_Distributors cdr LEFT OUTER JOIN tbl_DST_Distributors dst ON dst.dstid = cdr.fsl_dstid LEFT OUTER JOIN tbl_BYG_BuyingGroups byg ON byg.uniqueid = dst.dstbuyinggrp LEFT OUTER JOIN qryContentFullPathLookup img ON img.contentid = dst.dstlogo WHERE cdr.cdr_recordid = AND cdr.ownerid = AND cdr.fsl_tablecode = if( qmd_selDistributorDetail.dstid neq "" and useFSEProfile) { dstName = qmd_selDistributorDetail.dstname; dstAddr1 = qmd_selDistributorDetail.dstaddr1; dstAddr2 = qmd_selDistributorDetail.dstaddr2; dstCity = qmd_selDistributorDetail.dstcity; dstZip = qmd_selDistributorDetail.dstZip; dstState = qmd_selDistributorDetail.dstState; dstphoneac = qmd_selDistributorDetail.dstPhoneAc; dstphone = qmd_selDistributorDetail.dstPhone; dstfaxac = qmd_selDistributorDetail.dstFaxac; dstfax = qmd_selDistributorDetail.dstFax; dsturl = qmd_selDistributorDetail.dstUrl; dstlogo = qmd_selDistributorDetail.dstLogo; dstprofile = qmd_selDistributorDetail.dstProfile; dstCompanyType = qmd_selDistributorDetail.dstcompanytype; dstsaleschannel = qmd_selDistributorDetail.dstsaleschannel; dstdisttype = qmd_selDistributorDetail.dstdisttype; dstsptycat = qmd_selDistributorDetail.dstsptycat; dstbuyinggrp = qmd_selDistributorDetail.dstbuyinggrp; bygName = qmd_selDistributorDetail.bygName; } else { dstName = qmd_selDistributorDetail.cdr_dstname; dstAddr1 = qmd_selDistributorDetail.cdr_dstaddress1; dstAddr2 = qmd_selDistributorDetail.cdr_dstaddress2; dstCity = qmd_selDistributorDetail.cdr_dstcity; dstZip = qmd_selDistributorDetail.cdr_dstZip; dstState = qmd_selDistributorDetail.cdr_dstState; dstphoneac = ""; dstphone = ""; dstfaxac = ""; dstfax = ""; dsturl = ""; dstlogo = 755; dstprofile = ""; dstCompanyType = ""; dstsaleschannel = ""; dstdisttype = ""; dstsptycat = ""; dstbuyinggrp = ""; bygName = ""; }
#dstname#
http://#dstURL#"> --->
Address & Contact Info.
Address#dstaddr1#
#dstaddr2#
#dstCity#, #dstState# #dstZip#
Phone#phoneDisplay#
Fax#faxDisplay#
Web Site#WebDisplay#
Business Profile
Channel / Type#dstSalesChannel# / #dstdisttype#
Buying Group#bygName#
Overview#writeHTMLParagraphs(replacenocase(dstProfile, "
", crlf, "ALL"))#
Company Type#ctype#
Parent Company#parentco#

#paragraph#