优化-客户对账

This commit is contained in:
季圣华
2017-10-29 21:23:43 +08:00
parent a0afb056d4
commit 2f14504b2a
3 changed files with 11 additions and 19 deletions

View File

@@ -36,7 +36,7 @@ public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO {
modeName = "ChangeAmount";
}
else if(mode.equals("合计")){
modeName = "TotalPrice";
modeName = "DiscountLastMoney";
}
query= this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select sum(" + modeName + ") as allMoney from DepotHead depotHead where Type='" + type + "' and SubType = '" + subType + "' and OrganId =" + supplierId + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
@@ -131,14 +131,14 @@ public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO {
@SuppressWarnings("unchecked")
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId) throws JshException {
StringBuffer queryString = new StringBuffer();
queryString.append("select dh.Number,concat(dh.SubType,dh.Type) as newType,dh.ChangeAmount,dh.TotalPrice,s.supplier,date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_depothead dh " +
"inner join jsh_supplier s on s.id=dh.OrganId where s.type!='会员' " +
queryString.append("select dh.Number,concat(dh.SubType,dh.Type) as newType,dh.DiscountLastMoney,dh.ChangeAmount,s.supplier,date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_depothead dh " +
"inner join jsh_supplier s on s.id=dh.OrganId where s.type!='会员' and dh.SubType!='其它' " +
"and dh.OperTime >='"+ beginTime +"' and dh.OperTime<='"+ endTime +"' ");
if(organId!=null && !organId.equals("")) {
queryString.append(" and dh.OrganId='"+ organId +"' ");
}
queryString.append("UNION ALL " +
"select ah.BillNo,ah.Type as newType,ah.ChangeAmount,ah.TotalPrice,s.supplier,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_accounthead ah " +
"select ah.BillNo,ah.Type as newType,ah.TotalPrice,ah.ChangeAmount,s.supplier,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_accounthead ah " +
"inner join jsh_supplier s on s.id=ah.OrganId where s.type!='会员' " +
"and ah.BillTime >='"+ beginTime +"' and ah.BillTime<='"+ endTime +"' ");
if(organId!=null && !organId.equals("")) {