query=this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"' and MaterialId ="+MId+" and jsh_depothead.OperTime <'"+MonthTime+"-01 00:00:00' "+SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
else{
query=this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"' and MaterialId ="+MId+" and jsh_depothead.OperTime >='"+MonthTime+"-01 00:00:00' and jsh_depothead.OperTime <='"+MonthTime+"-31 00:00:00' "+SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));