wu 3 miesięcy temu
rodzic
commit
52271d9303

+ 2 - 1
src/custom/restcontroller/webmanage/sale/salestarget2/SQL/查询人员的统计商品明细.sql

@@ -1,4 +1,4 @@
-SELECT DISTINCT t4.sa_customersid,t6.enterprisename hospitalname,t1.sa_hospitaldepid,t4.hospitaldepname,t8.itemclassname, t2.itemid,t2.itemname,t2.model,t9.spec,CONCAT(t1.sa_hospitaldepid,';',t2.itemid) keyid
+SELECT DISTINCT t4.sa_customersid,t6.enterprisename hospitalname,t1.sa_hospitaldepid,t4.hospitaldepname,GROUP_CONCAT(t8.itemclassname) itemclassname, t2.itemid,t2.itemname,t2.model,t9.spec,CONCAT(t1.sa_hospitaldepid,';',t2.itemid) keyid
 from sa_order t1
          INNER JOIN sa_orderitems t2 ON t2.sa_orderid = t1.sa_orderid and t2.siteid = t1.siteid
          LEFT JOIN sys_hr t3 ON t3.hrid = t1.saler_hrid
@@ -9,4 +9,5 @@ from sa_order t1
          LEFT JOIN plm_itemclass t8 ON t8.itemclassid=t7.itemclassid
          LEFT JOIN plm_item t9 ON t9.itemid=t2.itemid
 WHERE t1.siteid = $siteid$ and t1.`status` in ('审核', '关闭') and YEAR (t1.checkdate) in ($year$) and t3.userid=$userid$ and $where$ and t1.deleted=0
+GROUP BY t4.sa_customersid,t6.enterprisename,t1.sa_hospitaldepid,t4.hospitaldepname,t2.itemid,t2.itemname,t2.model,t9.spec
 ORDER BY t6.enterprisename,t4.hospitaldepname

+ 2 - 1
src/custom/restcontroller/webmanage/sale/salestarget2/SQL/查询医院的统计商品明细.sql

@@ -1,4 +1,4 @@
-SELECT DISTINCT t4.sa_customersid,t6.enterprisename hospitalname,t1.sa_hospitaldepid,t4.hospitaldepname,t8.itemclassname, t2.itemid,t2.itemname,t2.model,t9.spec,CONCAT(t1.sa_hospitaldepid,';',t2.itemid) keyid
+SELECT DISTINCT t4.sa_customersid,t6.enterprisename hospitalname,t1.sa_hospitaldepid,t4.hospitaldepname,GROUP_CONCAT(t8.itemclassname) itemclassname, t2.itemid,t2.itemname,t2.model,t9.spec,CONCAT(t1.sa_hospitaldepid,';',t2.itemid) keyid
 from sa_order t1
          INNER JOIN sa_orderitems t2 ON t2.sa_orderid = t1.sa_orderid and t2.siteid = t1.siteid
          LEFT JOIN sys_hr t3 ON t3.hrid = t1.saler_hrid
@@ -9,4 +9,5 @@ from sa_order t1
          LEFT JOIN plm_itemclass t8 ON t8.itemclassid=t7.itemclassid
          LEFT JOIN plm_item t9 ON t9.itemid=t2.itemid
 WHERE t1.siteid = $siteid$ and t1.`status` in ('审核', '关闭') and YEAR (t1.checkdate) in ($year$) and t1.sa_customersid=$sa_customersid$ and $where$ and t1.deleted=0
+GROUP BY t4.sa_customersid,t6.enterprisename,t1.sa_hospitaldepid,t4.hospitaldepname,t2.itemid,t2.itemname,t2.model,t9.spec
 ORDER BY t6.enterprisename,t4.hospitaldepname

+ 2 - 1
src/custom/restcontroller/webmanage/sale/salestarget2/SQL/查询经销商的统计商品明细.sql

@@ -1,4 +1,4 @@
-SELECT DISTINCT t4.sa_customersid,t6.enterprisename hospitalname,t1.sa_hospitaldepid,t4.hospitaldepname,t8.itemclassname, t2.itemid,t2.itemname,t2.model,t9.spec,CONCAT(t1.sa_hospitaldepid,';',t2.itemid) keyid
+SELECT DISTINCT t4.sa_customersid,t6.enterprisename hospitalname,t1.sa_hospitaldepid,t4.hospitaldepname,GROUP_CONCAT(t8.itemclassname) t8.itemclassname, t2.itemid,t2.itemname,t2.model,t9.spec,CONCAT(t1.sa_hospitaldepid,';',t2.itemid) keyid
 from sa_order t1
          INNER JOIN sa_orderitems t2 ON t2.sa_orderid = t1.sa_orderid and t2.siteid = t1.siteid
          LEFT JOIN sys_hr t3 ON t3.hrid = t1.saler_hrid
@@ -9,4 +9,5 @@ from sa_order t1
          LEFT JOIN plm_itemclass t8 ON t8.itemclassid=t7.itemclassid
          LEFT JOIN plm_item t9 ON t9.itemid=t2.itemid
 WHERE t1.siteid = $siteid$ and t1.`status` in ('审核', '关闭') and YEAR (t1.checkdate) in ($year$) and t1.sa_agentsid=$sa_agentsid$ and $where$ and t1.deleted=0
+GROUP BY t4.sa_customersid,t6.enterprisename,t1.sa_hospitaldepid,t4.hospitaldepname,t2.itemid,t2.itemname,t2.model,t9.spec
 ORDER BY t6.enterprisename,t4.hospitaldepname

+ 3 - 3
src/custom/restcontroller/webmanage/sale/salestarget2/salestargetstatistics.java

@@ -523,10 +523,10 @@ public class salestargetstatistics extends Controller {
         if (content.containsKey("where")) {
             JSONObject whereObject = content.getJSONObject("where");
             if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
-                where.append(" and t2.checkdate >='").append(whereObject.getString("begindate")).append("' ");
+                where.append(" and t2.checkdate >='").append(whereObject.getString("begindate")).append("-01' ");
             }
             if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
-                where.append(" and t2.checkdate <='").append(whereObject.getString("enddate")).append(" 23:59:59' ");
+                where.append(" and t2.checkdate <'").append(getNextMonth(whereObject.getString("enddate"))).append("-01' ");
             }
         }
 
@@ -1488,7 +1488,7 @@ public class salestargetstatistics extends Controller {
         sqlFactory = new SQLFactory(this, "首页医院金额");
         sqlFactory.addParameter("siteid", siteid);
         sqlFactory.addParameter("start", startMonth + "-01");
-        sqlFactory.addParameter("end", getNextMonth(endMonth) + "-01");
+        sqlFactory.addParameter("end",  getNextMonth(endMonth) + "-01");
         sqlFactory.addParameter("userid", userid);
         BigDecimal saleamount = dbConnect.runSqlQuery(sqlFactory).get(0).getBigDecimal("saleamount");