|
|
@@ -493,17 +493,19 @@ public class rebateaccounthead extends Controller {
|
|
|
public BigDecimal CalculateAmount(String begindate, String enddate, long sys_enterpriseid, ArrayList<Long> itemclsids,String agentitemclsnums,
|
|
|
String itemids) throws YosException {
|
|
|
Rows rows = null;
|
|
|
+ itemclsids.addAll(ItemClass.getSubItemClassIds(this,itemclsids));
|
|
|
+ itemclsids.add(0l);
|
|
|
if (itemids .equals("()")) {
|
|
|
rows = dbConnect.runSqlQuery("select SUM(if(t1.isclose,t1.amount,t1.price*(t1.qty-t1.undeliqty))) amount from sa_orderitems t1 \n" +
|
|
|
"inner join sa_order t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid\n" +
|
|
|
"inner join plm_item t3 on t1.itemid=t3.itemid and t1.siteid=t3.siteid where '"+begindate+"'<=DATE_FORMAT(t2.closedate, '%Y-%m-%d') and '"+enddate+"'>=DATE_FORMAT(t2.closedate, '%Y-%m-%d') " +
|
|
|
- "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"' and t2.status in('关闭') and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + ItemClass.getSubItemClassIds(this,itemclsids).toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
|
|
|
+ "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"' and t2.status in('关闭') and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + itemclsids.toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
|
|
|
|
|
|
} else {
|
|
|
rows = dbConnect.runSqlQuery("select SUM(if(t1.isclose,t1.amount,t1.price*(t1.qty-t1.undeliqty))) amount from sa_orderitems t1 \n" +
|
|
|
"inner join sa_order t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid\n" +
|
|
|
"inner join plm_item t3 on t1.itemid=t3.itemid and t1.siteid=t3.siteid where '"+begindate+"'<=DATE_FORMAT(t2.closedate, '%Y-%m-%d') and '"+enddate+"'>=DATE_FORMAT(t2.closedate, '%Y-%m-%d') " +
|
|
|
- "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"' and t2.status in('关闭') and t1.itemid not in" + itemids + " and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + ItemClass.getSubItemClassIds(this,itemclsids).toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
|
|
|
+ "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"' and t2.status in('关闭') and t1.itemid not in" + itemids + " and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + itemclsids.toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
|
|
|
|
|
|
}
|
|
|
if (rows.isEmpty()) {
|
|
|
@@ -516,17 +518,19 @@ public class rebateaccounthead extends Controller {
|
|
|
public Rows QuerySaorderNum(String begindate, String enddate, long sys_enterpriseid, ArrayList<Long> itemclsids,String agentitemclsnums,
|
|
|
String itemids) throws YosException {
|
|
|
Rows rows = null;
|
|
|
+ itemclsids.addAll(ItemClass.getSubItemClassIds(this,itemclsids));
|
|
|
+ itemclsids.add(0l);
|
|
|
if (itemids .equals("()")) {
|
|
|
rows = dbConnect.runSqlQuery("select t2.sa_orderid,SUM(if(t1.isclose,t1.amount,t1.price*(t1.qty-t1.undeliqty))) amount from sa_orderitems t1 \n" +
|
|
|
"inner join sa_order t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid\n" +
|
|
|
"inner join plm_item t3 on t1.itemid=t3.itemid and t1.siteid=t3.siteid where '"+begindate+"'<=DATE_FORMAT(t2.closedate, '%Y-%m-%d') and '"+enddate+"'>=DATE_FORMAT(t2.closedate, '%Y-%m-%d') " +
|
|
|
- "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"' and t2.status in('关闭') and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + ItemClass.getSubItemClassIds(this,itemclsids).toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"' group by t2.sa_orderid ");
|
|
|
+ "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"' and t2.status in('关闭') and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + itemclsids.toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"' group by t2.sa_orderid ");
|
|
|
|
|
|
} else {
|
|
|
rows = dbConnect.runSqlQuery("select t2.sa_orderid,SUM(if(t1.isclose,t1.amount,t1.price*(t1.qty-t1.undeliqty))) amount from sa_orderitems t1 \n" +
|
|
|
"inner join sa_order t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid\n" +
|
|
|
"inner join plm_item t3 on t1.itemid=t3.itemid and t1.siteid=t3.siteid where '"+begindate+"'<=DATE_FORMAT(t2.closedate, '%Y-%m-%d') and '"+enddate+"'>=DATE_FORMAT(t2.closedate, '%Y-%m-%d') " +
|
|
|
- "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"' and t2.status in('关闭') and t1.itemid not in" + itemids + " and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + ItemClass.getSubItemClassIds(this,itemclsids).toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"' group by t2.sa_orderid");
|
|
|
+ "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"' and t2.status in('关闭') and t1.itemid not in" + itemids + " and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + itemclsids.toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"' group by t2.sa_orderid");
|
|
|
|
|
|
|
|
|
}
|
|
|
@@ -536,17 +540,19 @@ public class rebateaccounthead extends Controller {
|
|
|
public String QuerySaorderDetailId(String begindate, String enddate, long sys_enterpriseid, ArrayList<Long> itemclsids,String agentitemclsnums,
|
|
|
String itemids) throws YosException {
|
|
|
Rows rows = null;
|
|
|
+ itemclsids.addAll(ItemClass.getSubItemClassIds(this,itemclsids));
|
|
|
+ itemclsids.add(0l);
|
|
|
if (itemids .equals("()")) {
|
|
|
rows = dbConnect.runSqlQuery("select t1.sa_orderitemsid from sa_orderitems t1 \n" +
|
|
|
"inner join sa_order t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid\n" +
|
|
|
"inner join plm_item t3 on t1.itemid=t3.itemid and t1.siteid=t3.siteid where '"+begindate+"'<=DATE_FORMAT(t2.closedate, '%Y-%m-%d') and '"+enddate+"'>=DATE_FORMAT(t2.closedate, '%Y-%m-%d') " +
|
|
|
- "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"' and t2.status in('关闭') and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + ItemClass.getSubItemClassIds(this,itemclsids).toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
|
|
|
+ "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"' and t2.status in('关闭') and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + itemclsids.toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
|
|
|
|
|
|
} else {
|
|
|
rows = dbConnect.runSqlQuery("select t1.sa_orderitemsid from sa_orderitems t1 \n" +
|
|
|
"inner join sa_order t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid\n" +
|
|
|
"inner join plm_item t3 on t1.itemid=t3.itemid and t1.siteid=t3.siteid where '"+begindate+"'<=DATE_FORMAT(t2.closedate, '%Y-%m-%d') and '"+enddate+"'>=DATE_FORMAT(t2.closedate, '%Y-%m-%d') " +
|
|
|
- "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"' and t2.status in('关闭') and t1.itemid not in" + itemids + " and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" +ItemClass.getSubItemClassIds(this,itemclsids).toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
|
|
|
+ "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"' and t2.status in('关闭') and t1.itemid not in" + itemids + " and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" +itemclsids.toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
|
|
|
|
|
|
|
|
|
}
|