select t1.tcustomer_receptid as forderno,t1.tcustomer_receptid,t2.fstorename,t1.fwaiter,
t1.fcommunity,t1.fname,t1.fphonenumber,t1.forderamount,fdepositamount,t1.fdate,t1.createdate,
freceivablesamount,freceivedamount,t1.fstatus,freturnamount,fchannel,
       t3.fprovince,t3.fcity,t3.fcounty,t3.fagentname,t4.fname as fsaler,t1.fnotes from DSBCRM..tcustomer_reception t1
left join  DSBCRM..tstore t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid and t1.tstoreid=t2.tstoreid
inner join DSBCRM..tagents t3 on t1.siteid=t3.siteid and t1.tagentsid=t3.tagentsid
left join DSBCRM..tenterprise_users t4 on t3.siteid=t4.siteid and t3.fsaleruserid=t4.tenterprise_userid
where t1.ftype='ÏúÊÛ' and t1.siteid=$siteid$ and
convert(varchar(7),t1.fdate,120)>=$fbegmonth$ and convert(varchar(7),t1.fdate,120)<=$fendmonth$
and t3.fsaleruserid in $tenterprise_userid$