Browse Source

信用调整单添加经销商编码及名称

hu 1 year ago
parent
commit
ed7db2d67c

+ 9 - 1
src/custom/restcontroller/sale/creditbill/SQL/信用额度调整单列表查询.sql

@@ -10,7 +10,15 @@ SELECT
 	t1.changeby,
     t1.changedate,
     t1.checkby,
-    t1.checkdate
+    t1.checkdate,
+		t3.sys_enterpriseid,
+		t4.agentnum,
+		t5.abbreviation,
+		t5.enterprisename
 FROM
     sa_creditbill t1
+	  left join (select sa_creditbillid,siteid,min(sa_creditbilldetailid) sa_creditbilldetailid from sa_creditbilldetail group by sa_creditbillid,siteid) t2 on t1.sa_creditbillid=t2.sa_creditbillid and t1.siteid=t2.siteid
+		left join sa_creditbilldetail t3 on t2.sa_creditbilldetailid=t3.sa_creditbilldetailid and t2.siteid=t3.siteid
+		left join sa_agents t4 on t4.sys_enterpriseid=t3.sys_enterpriseid and t4.siteid=t3.siteid
+		left join sys_enterprise t5 on t5.sys_enterpriseid=t3.sys_enterpriseid and t5.siteid=t3.siteid
 where $where$ and t1.siteid=$siteid$

+ 10 - 2
src/custom/restcontroller/sale/creditbill/SQL/信用额度调整单详情查询.sql

@@ -10,7 +10,15 @@ SELECT
 	t1.changeby,
     t1.changedate,
     t1.checkby,
-    t1.checkdate
+    t1.checkdate,
+		t3.sys_enterpriseid,
+		t4.agentnum,
+		t5.abbreviation,
+		t5.enterprisename
 FROM
-    sa_creditbill t1   
+    sa_creditbill t1
+	  left join (select sa_creditbillid,siteid,min(sa_creditbilldetailid) sa_creditbilldetailid from sa_creditbilldetail group by sa_creditbillid,siteid) t2 on t1.sa_creditbillid=t2.sa_creditbillid and t1.siteid=t2.siteid
+		left join sa_creditbilldetail t3 on t2.sa_creditbilldetailid=t3.sa_creditbilldetailid and t2.siteid=t3.siteid
+		left join sa_agents t4 on t4.sys_enterpriseid=t3.sys_enterpriseid and t4.siteid=t3.siteid
+		left join sys_enterprise t5 on t5.sys_enterpriseid=t3.sys_enterpriseid and t5.siteid=t3.siteid
 where t1.sa_creditbillid=$sa_creditbillid$

+ 3 - 1
src/custom/restcontroller/sale/creditbill/SQL/合作企业档案列表查询.sql

@@ -7,9 +7,11 @@ SELECT t1.sys_enterpriseid,
        t1.contact,
        t1.phonenumber,
        t1.taxno,
-       t2.erpagentnum
+       t2.erpagentnum,
+       t3.agentnum
 FROM sys_enterprise t1
          LEFT JOIN sys_dataextend t2
                    ON t1.sys_enterpriseid = t2.ownerid and t2.ownertable = 'sys_enterprise' and t1.siteid = t2.siteid
+         inner join sa_agents t3 on t1.sys_enterpriseid=t3.sys_enterpriseid and t1.siteid=t3.siteid
 where $where$
   and t1.siteid = $siteid$