|
@@ -264,7 +264,7 @@ public class databoard extends Controller {
|
|
|
|
|
|
|
|
|
if (!begindate.equals("")) {
|
|
|
- where.append(" and t1.checkdate >='").append(begindate).append(" 00:00:00'");
|
|
|
+ where.append(" and t1.checkdate>='").append(begindate).append("'");
|
|
|
Date date = sdf.parse(begindate);
|
|
|
//创建Calendar实例
|
|
|
Calendar cal = Calendar.getInstance();
|
|
@@ -272,10 +272,10 @@ public class databoard extends Controller {
|
|
|
cal.setTime(date);
|
|
|
//在当前时间基础上减一年
|
|
|
cal.add(Calendar.YEAR, -1);
|
|
|
- whereLastYear.append(" and t1.checkdate >='").append(sdf.format(cal.getTime())).append(" 00:00:00'");
|
|
|
+ whereLastYear.append(" and t1.checkdate >='").append(sdf.format(cal.getTime())).append("'");
|
|
|
}
|
|
|
if (!enddate.equals("")) {
|
|
|
- where.append(" and t1.checkdate <='").append(enddate).append(" 23:59:59'");
|
|
|
+ where.append(" and t1.checkdate <='").append(enddate).append("'");
|
|
|
Date date = sdf.parse(enddate);
|
|
|
//创建Calendar实例
|
|
|
Calendar cal = Calendar.getInstance();
|
|
@@ -283,7 +283,7 @@ public class databoard extends Controller {
|
|
|
cal.setTime(date);
|
|
|
//在当前时间基础上减一年
|
|
|
cal.add(Calendar.YEAR, -1);
|
|
|
- whereLastYear.append(" and t1.checkdate <='").append(sdf.format(cal.getTime())).append(" 23:59:59'");
|
|
|
+ whereLastYear.append(" and t1.checkdate <='").append(sdf.format(cal.getTime())).append("'");
|
|
|
}
|
|
|
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
@@ -390,6 +390,7 @@ public class databoard extends Controller {
|
|
|
whereLastYear.append("t2.accountname in"+result);
|
|
|
whereLastYear.append(")");
|
|
|
}
|
|
|
+ StringBuffer stringBuffer= new StringBuffer();
|
|
|
if(!statisticsrule_type.isEmpty()){
|
|
|
StringBuffer str=new StringBuffer("(");
|
|
|
for(Object o :statisticsrule_type){
|
|
@@ -397,13 +398,14 @@ public class databoard extends Controller {
|
|
|
}
|
|
|
String result = str.substring(0, str.length() - 1);
|
|
|
result=result+")";
|
|
|
- where.append(" and(");
|
|
|
- where.append("t1.class in"+result);
|
|
|
- where.append(")");
|
|
|
-
|
|
|
- whereLastYear.append(" and(");
|
|
|
- whereLastYear.append("t1.class in"+result);
|
|
|
- whereLastYear.append(")");
|
|
|
+ stringBuffer.append(" or t1.class in"+ result);
|
|
|
+// where.append(" and(");
|
|
|
+// where.append("t1.class in"+result);
|
|
|
+// where.append(")");
|
|
|
+//
|
|
|
+// whereLastYear.append(" and(");
|
|
|
+// whereLastYear.append("t1.class in"+result);
|
|
|
+// whereLastYear.append(")");
|
|
|
}
|
|
|
if(!statisticsrule_typemx.isEmpty()){
|
|
|
StringBuffer str=new StringBuffer("(");
|
|
@@ -412,23 +414,29 @@ public class databoard extends Controller {
|
|
|
}
|
|
|
String result = str.substring(0, str.length() - 1);
|
|
|
result=result+")";
|
|
|
- where.append(" and(");
|
|
|
- where.append("t1.subclass in"+result);
|
|
|
- where.append(")");
|
|
|
-
|
|
|
- whereLastYear.append(" and(");
|
|
|
- whereLastYear.append("t1.subclass in"+result);
|
|
|
- whereLastYear.append(")");
|
|
|
+ stringBuffer.append(" or t1.subclass in"+ result);
|
|
|
+// where.append(" and(");
|
|
|
+// where.append("t1.subclass in"+result);
|
|
|
+// where.append(")");
|
|
|
+//
|
|
|
+// whereLastYear.append(" and(");
|
|
|
+// whereLastYear.append("t1.subclass in"+result);
|
|
|
+// whereLastYear.append(")");
|
|
|
}
|
|
|
+ if(statisticsrule_type.isEmpty() && statisticsrule_typemx.isEmpty() ){
|
|
|
+ stringBuffer.append(" 1=1 ");
|
|
|
+ }
|
|
|
+ where.append(" and ("+(stringBuffer.toString()).replaceFirst("or", "")+")");
|
|
|
+ whereLastYear.append(" and ("+(stringBuffer.toString()).replaceFirst("or", "")+")");
|
|
|
jsonObject = new JSONObject();
|
|
|
factory = new SQLFactory(this, "回款统计查询");
|
|
|
factory.addParameter("siteid", siteid);
|
|
|
- factory.addParameter_SQL("where", where);
|
|
|
+ factory.addParameter_SQL("where",where.toString().replaceAll("checkdate", "period"));
|
|
|
rows = dbConnect.runSqlQuery(factory.getSQL(false));
|
|
|
|
|
|
factoryLastYear = new SQLFactory(this, "回款统计查询");
|
|
|
factoryLastYear.addParameter("siteid", siteid);
|
|
|
- factoryLastYear.addParameter_SQL("where", whereLastYear);
|
|
|
+ factoryLastYear.addParameter_SQL("where", whereLastYear.toString().replaceAll("checkdate", "period"));
|
|
|
rowsLastYear = dbConnect.runSqlQuery(factoryLastYear.getSQL(false));
|
|
|
|
|
|
Rows salestargetbillrows =dbConnect.runSqlQuery("select * from sa_salestargetbill where siteid='"+siteid+"' and year="+currentYear+" and targettype='人员目标' and assessmentindicators='收款'");
|