select t1.fname,
       t1.fcommunity,
       t1.fnumber,
       t1.fdate,
       t1.changedate,
       t1.forderamount,--订单金额
       t1.fdepositamount,--定金
       t1.freceivedamount,--已收尾款
       t1.freceivablesamount,--应收款
       t1.tcustomer_receptid
from tcustomer_reception t1
where t1.ftype = '销售'
  and t1.siteid =$siteid$
  and t1.tagentsid=$tagentsid$
  and $where$