Browse Source

企业业绩目标(指定经销商)报错修复

hu 6 months ago
parent
commit
cfaf45c876

+ 1 - 1
src/custom/restcontroller/sale/salestarget/SQL/企业-出货-经销商.sql

@@ -3,7 +3,7 @@ with sa_salestarget as (
 FROM sa_orderitems t1
         inner join st_stockbill_items t5 ON t5.sa_orderitemsid = t1.sa_orderitemsid AND t5.siteid = t1.siteid
         inner join st_stockbill t6 ON t6.st_stockbillid = t5.st_stockbillid AND t6.siteid = t5.siteid
-WHERE t6.sys_enterpriseid in $sys_enterpriseid$ AND t1.siteid=$siteid$ and t6.type='销售出库' and t6.rb=1) a
+WHERE t6.sys_enterpriseid in $sys_enterpriseid$ AND t1.siteid=$siteid$ and t6.type='销售出库' and t6.rb=1) a where  ifnull(year,'')!=''
 GROUP BY point,sys_enterpriseid,year
     )
 SELECT DISTINCT m.year,

+ 1 - 1
src/custom/restcontroller/sale/salestarget/SQL/企业-开票-经销商.sql

@@ -1,7 +1,7 @@
 with sa_salestarget as (
       select point,year,sys_enterpriseid,sum(amount) amount from (SELECT  0+CAST(if(isclose,t1.price*t1.deliedqty,amount) AS CHAR) amount, QUARTER(t2.billdate) point,YEAR(t2.billdate) year,t2.sys_enterpriseid FROM sa_orderitems t1
     INNER JOIN sa_order t2 ON t1.sa_orderid=t2.sa_orderid AND t1.siteid=t2.siteid
-WHERE t1.siteid = $siteid$ and t2.sys_enterpriseid in $sys_enterpriseid$ and $where1$) a
+WHERE t1.siteid = $siteid$ and t2.sys_enterpriseid in $sys_enterpriseid$ and $where1$) a where  ifnull(year,'')!=''
 GROUP BY point,year,sys_enterpriseid
     )
 SELECT DISTINCT m.year,

+ 1 - 1
src/custom/restcontroller/sale/salestarget/SQL/企业-收款-经销商.sql

@@ -1,6 +1,6 @@
 with sa_salestarget as (
    select point,year,sys_enterpriseid,sum(amount) amount from (SELECT 0+CAST(amount AS CHAR) amount, QUARTER(period) point,YEAR(period) year,sys_enterpriseid FROM sa_cashbill
-    WHERE siteid =$siteid$ AND status in('审核') and ($where1$) and type=1 and sys_enterpriseid in $sys_enterpriseid$) a
+    WHERE siteid =$siteid$ AND status in('审核') and ($where1$) and type=1 and sys_enterpriseid in $sys_enterpriseid$) a where  ifnull(year,'')!=''
     GROUP BY point,year,sys_enterpriseid
     )
 SELECT DISTINCT m.year,

+ 1 - 1
src/custom/restcontroller/sale/salestarget/SQL/企业-订单-经销商.sql

@@ -1,7 +1,7 @@
 with sa_salestarget as (
       select point,year,sys_enterpriseid,sum(amount) amount from (SELECT  0+CAST(if(isclose,t1.price*t1.deliedqty,amount) AS CHAR) amount, QUARTER(t2.billdate) point,YEAR(t2.billdate) year,t2.sys_enterpriseid FROM sa_orderitems t1
     INNER JOIN sa_order t2 ON t1.sa_orderid=t2.sa_orderid AND t1.siteid=t2.siteid
-WHERE t1.siteid = $siteid$ and t2.sys_enterpriseid in $sys_enterpriseid$ and $where1$) a
+WHERE t1.siteid = $siteid$ and t2.sys_enterpriseid in $sys_enterpriseid$ and $where1$) a where  ifnull(year,'')!=''
 GROUP BY point,year,sys_enterpriseid
     )
 SELECT DISTINCT m.year,