|
|
@@ -16,13 +16,15 @@ SELECT t1.sa_orderid,
|
|
|
ifnull(t1.billdate, '') billdate,
|
|
|
t5.erpbillno,
|
|
|
t8.name salename,
|
|
|
- t9.projectname
|
|
|
+ t9.projectname,
|
|
|
+ t7.agentnum
|
|
|
FROM sa_order t1
|
|
|
LEFT JOIN sys_enterprise t2 ON t2.sys_enterpriseid = t1.sys_enterpriseid and t2.siteid = t1.siteid
|
|
|
LEFT JOIN sa_brand t3 ON t3.sa_brandid = t1.sa_brandid
|
|
|
LEFT JOIN sys_enterprise_contacts t4 ON t4.contactsid = t1.rec_contactsid and t4.siteid = t1.siteid
|
|
|
LEFT JOIN sys_dataextend t5
|
|
|
ON t5.ownertable = 'sa_order' and t5.ownerid = t1.sa_orderid AND t1.siteid = t5.siteid and t5.erpbillno is not null
|
|
|
+ left join sa_agents t7 on t7.sys_enterpriseid=t1.sys_enterpriseid and t7.siteid = t1.siteid
|
|
|
LEFT JOIN sys_hr t8 on t8.hrid = t1.saler_hrid and t8.siteid = t1.siteid
|
|
|
left join sa_project t9 on t9.sa_projectid = t1.sa_projectid and t9.siteid = t1.siteid
|
|
|
where t1.siteid = $siteid$
|