diff --git a/pom.xml b/pom.xml index 2aa9e5be..2afa0ee0 100644 --- a/pom.xml +++ b/pom.xml @@ -21,6 +21,7 @@ 2.0.1 2.5 UTF-8 + 1.7 diff --git a/src/main/java/com/jsh/action/materials/DepotHeadAction.java b/src/main/java/com/jsh/action/materials/DepotHeadAction.java index 3adcac48..34dd8458 100644 --- a/src/main/java/com/jsh/action/materials/DepotHeadAction.java +++ b/src/main/java/com/jsh/action/materials/DepotHeadAction.java @@ -339,6 +339,50 @@ public class DepotHeadAction extends BaseAction Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e); } } + + /** + * 查找统计信息_根据礼品卡(报表) + * @return + */ + public void findGiftReport() { + try { + PageUtil pageUtil_in = new PageUtil(); + pageUtil_in.setPageSize(0); + pageUtil_in.setCurPage(0); + pageUtil_in.setAdvSearch(getConditionHead_Gift_In()); + depotHeadService.find(pageUtil_in); + List dataList_in = pageUtil_in.getPageList(); + JSONObject outer = new JSONObject(); + String headId = ""; + if(null != dataList_in) { + for(DepotHead depotHead:dataList_in) { + headId = headId + depotHead.getId() + ","; + } + PageUtil pageUtil_out = new PageUtil(); + pageUtil_out.setPageSize(0); + pageUtil_out.setCurPage(0); + pageUtil_out.setAdvSearch(getConditionHead_Gift_Out()); + depotHeadService.find(pageUtil_out); + List dataList_out = pageUtil_out.getPageList(); + if(null != dataList_out) { + for(DepotHead depotHead:dataList_out) { + headId = headId + depotHead.getId() + ","; + } + } + } + if(headId!="") { + headId = headId.substring(0, headId.lastIndexOf(",")); + } + outer.put("HeadIds", headId); + toClient(outer.toString()); + } + catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓管通信息异常", e); + } + catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e); + } + } /** * 查询单位的累计应收和累计应付,零售不能计入 @@ -442,6 +486,22 @@ public class DepotHeadAction extends BaseAction condition.put("OperTime_s_lteq",model.getMonthTime() + "-31 00:00:00"); return condition; } + + private Map getConditionHead_Gift_In() { + Map condition = new HashMap(); + if(model.getProjectId()!=null) { + condition.put("AllocationProjectId_n_eq", model.getProjectId()); + } + return condition; + } + + private Map getConditionHead_Gift_Out() { + Map condition = new HashMap(); + if(model.getProjectId()!=null) { + condition.put("ProjectId_n_eq", model.getProjectId()); + } + return condition; + } //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== public DepotHeadModel getModel() diff --git a/src/main/java/com/jsh/action/materials/DepotItemAction.java b/src/main/java/com/jsh/action/materials/DepotItemAction.java index 37fd0dce..f34f431a 100644 --- a/src/main/java/com/jsh/action/materials/DepotItemAction.java +++ b/src/main/java/com/jsh/action/materials/DepotItemAction.java @@ -240,6 +240,53 @@ public class DepotItemAction extends BaseAction Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); } } + + /** + * 查找礼品卡信息 + * @return + */ + public void findGiftByAll() { + try { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getConditionALL()); + depotItemService.find(pageUtil); + List dataList = pageUtil.getPageList(); + + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + Integer pid = model.getProjectId(); + JSONArray dataArray = new JSONArray(); + if(null != dataList) { + for(DepotItem depotItem:dataList){ + JSONObject item = new JSONObject(); + Integer InSum = sumNumberGift("礼品充值", pid, depotItem.getMaterialId().getId(), "in"); + Integer OutSum = sumNumberGift("礼品销售", pid, depotItem.getMaterialId().getId(), "out"); + item.put("Id", depotItem.getId()); + item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); + item.put("MaterialName", depotItem.getMaterialId().getName()); + item.put("MaterialModel", depotItem.getMaterialId().getModel()); + item.put("MaterialStandard", depotItem.getMaterialId().getStandard()); + item.put("MaterialColor", depotItem.getMaterialId().getColor()); + item.put("MaterialUnit", depotItem.getMaterialId().getUnit()); + item.put("thisSum", InSum - OutSum); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); + } + catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); + } + } + /** * 进货统计 * @return @@ -487,6 +534,37 @@ public class DepotItemAction extends BaseAction return sumNumber; } + /** + * 数量合计-礼品卡 + * @param type + * @param MId + * @param MonthTime + * @param isPrev + * @return + */ + @SuppressWarnings("unchecked") + public Integer sumNumberGift(String subType,Integer ProjectId,Long MId,String type) { + Integer sumNumber = 0; + String allNumber = ""; + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try { + depotItemService.findGiftByType(pageUtil, subType, ProjectId, MId,type); + allNumber = pageUtil.getPageList().toString(); + allNumber = allNumber.substring(1,allNumber.length()-1); + if(allNumber.equals("null")){ + allNumber = "0"; + } + allNumber = allNumber.replace(".0", ""); + } catch (JshException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + sumNumber = Integer.parseInt(allNumber); + return sumNumber; + } + /** * 价格合计 * @param type diff --git a/src/main/java/com/jsh/dao/materials/DepotItemDAO.java b/src/main/java/com/jsh/dao/materials/DepotItemDAO.java index d1c1972b..fed874c1 100644 --- a/src/main/java/com/jsh/dao/materials/DepotItemDAO.java +++ b/src/main/java/com/jsh/dao/materials/DepotItemDAO.java @@ -27,23 +27,23 @@ public class DepotItemDAO extends BaseDAO implements DepotItemIDAO { //多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便 Query query; - String queryString; - if(isPrev) { - queryString = "select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'"; + StringBuffer queryString = new StringBuffer(); + if(isPrev) { + queryString.append("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'"); if(ProjectId!=null) { - queryString += " and ProjectId='" + ProjectId +"'"; + queryString.append(" and ProjectId='" + ProjectId +"'"); } - queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' "; - query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); - } - else { - queryString = "select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'"; - if(ProjectId!=null) { - queryString += " and ProjectId='" + ProjectId +"'"; - } - queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' " ; + queryString.append(" and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' "); query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); - } + } + else { + queryString.append("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'"); + if(ProjectId!=null) { + queryString.append(" and ProjectId='" + ProjectId +"'"); + } + queryString.append(" and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' "); + query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + } pageUtil.setTotalCount(query.list().size()); pageUtil.setPageList(query.list()); } @@ -54,21 +54,20 @@ public class DepotItemDAO extends BaseDAO implements DepotItemIDAO { //多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便 Query query; - String queryString; - if(isPrev) { - queryString = "select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'"; - if(ProjectId!=null) { - queryString += " and ProjectId='" + ProjectId +"'"; + StringBuffer queryString = new StringBuffer(); + if (isPrev) { + queryString.append("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type + "'"); + if (ProjectId != null) { + queryString.append(" and ProjectId='" + ProjectId + "'"); } - queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' "; + queryString.append(" and MaterialId =" + MId + " and jsh_depothead.OperTime <'" + MonthTime + "-01 00:00:00' "); query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); - } - else { - queryString = "select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'"; - if(ProjectId!=null) { - queryString += " and ProjectId='" + ProjectId +"'"; + } else { + queryString.append("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type + "'"); + if (ProjectId != null) { + queryString.append(" and ProjectId='" + ProjectId + "'"); } - queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' "; + queryString.append(" and MaterialId =" + MId + " and jsh_depothead.OperTime >='" + MonthTime + "-01 00:00:00' and jsh_depothead.OperTime <='" + MonthTime + "-31 00:00:00' "); query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); } pageUtil.setTotalCount(query.list().size()); @@ -90,6 +89,28 @@ public class DepotItemDAO extends BaseDAO implements DepotItemIDAO pageUtil.setTotalCount(query.list().size()); pageUtil.setPageList(query.list()); } + + @SuppressWarnings("unchecked") + @Override + public void findGiftByType(PageUtil pageUtil,String subType,Integer ProjectId,Long MId,String type) throws JshException + { + //多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便 + Query query; + StringBuffer queryString = new StringBuffer(); + queryString.append("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and SubType='" + subType +"'"); + if(ProjectId!=null) { + if(type.equals("in")){ + queryString.append(" and AllocationProjectId='" + ProjectId +"'"); //礼品充值时 + } + else if(type.equals("out")){ + queryString.append(" and ProjectId='" + ProjectId +"'"); + } + } + queryString.append(" and MaterialId ="+ MId); + query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + pageUtil.setTotalCount(query.list().size()); + pageUtil.setPageList(query.list()); + } } diff --git a/src/main/java/com/jsh/dao/materials/DepotItemIDAO.java b/src/main/java/com/jsh/dao/materials/DepotItemIDAO.java index 82b79bcc..061691c8 100644 --- a/src/main/java/com/jsh/dao/materials/DepotItemIDAO.java +++ b/src/main/java/com/jsh/dao/materials/DepotItemIDAO.java @@ -12,5 +12,7 @@ public interface DepotItemIDAO extends BaseIDAO public void findPriceByType(PageUtil pageUtil,String type,Integer ProjectId,Long MId, String MonthTime,Boolean isPrev) throws JshException; - public void buyOrSale(PageUtil pageUtil,String type, String subType,Long MId, String MonthTime, String sumType) throws JshException; + public void buyOrSale(PageUtil pageUtil,String type, String subType,Long MId, String MonthTime, String sumType) throws JshException; + + public void findGiftByType(PageUtil pageUtil,String subType,Integer ProjectId,Long MId, String type) throws JshException; } diff --git a/src/main/java/com/jsh/service/materials/DepotItemIService.java b/src/main/java/com/jsh/service/materials/DepotItemIService.java index d7e83955..13499191 100644 --- a/src/main/java/com/jsh/service/materials/DepotItemIService.java +++ b/src/main/java/com/jsh/service/materials/DepotItemIService.java @@ -19,7 +19,9 @@ public interface DepotItemIService extends BaseIService void findPriceByType(PageUtil depotItem, String type,Integer ProjectId, Long MId, String MonthTime,Boolean isPrev)throws JshException; void buyOrSale(PageUtil depotItem, String type, String subType, Long MId, String MonthTime, String sumType)throws JshException; - + + void findGiftByType(PageUtil depotItem, String subType,Integer ProjectId, Long MId, String type)throws JshException; + /** * 导出信息 * @return diff --git a/src/main/java/com/jsh/service/materials/DepotItemService.java b/src/main/java/com/jsh/service/materials/DepotItemService.java index 7b2dea48..6eb56c31 100644 --- a/src/main/java/com/jsh/service/materials/DepotItemService.java +++ b/src/main/java/com/jsh/service/materials/DepotItemService.java @@ -61,6 +61,12 @@ public class DepotItemService extends BaseService implements DepotIte { depotItemDao.buyOrSale(pageUtil, type, subType, MId, MonthTime, sumType); } + + @Override + public void findGiftByType(PageUtil pageUtil, String subType,Integer ProjectId,Long MId,String type) throws JshException + { + depotItemDao.findGiftByType(pageUtil, subType, ProjectId, MId, type); + } /** * 导出Excel表格 diff --git a/src/main/webapp/js/pages/materials/in_out.js b/src/main/webapp/js/pages/materials/in_out.js index d8d6be6a..8ca2351c 100644 --- a/src/main/webapp/js/pages/materials/in_out.js +++ b/src/main/webapp/js/pages/materials/in_out.js @@ -417,9 +417,10 @@ + 'AaBb' + rec.AllocationProjectName + 'AaBb' + rec.payType; if(1 == value) { + var orgId = rec.OrganId? rec.OrganId:0; str += '查看'; str += '编辑'; - str += '删除'; + str += '删除'; } return str; } @@ -1155,6 +1156,9 @@ if(listSubType === "礼品销售") { OrganId = orgDefaultId; } + else if(listSubType ==="礼品充值"){ + OrganId = null; + } else { OrganId = $('#OrganId').combobox('getValue'); } diff --git a/src/main/webapp/pages/reports/gift_manage_report.jsp b/src/main/webapp/pages/reports/gift_manage_report.jsp new file mode 100644 index 00000000..90406870 --- /dev/null +++ b/src/main/webapp/pages/reports/gift_manage_report.jsp @@ -0,0 +1,236 @@ +<%@page import="com.jsh.util.Tools"%> +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<% + String path = request.getContextPath(); + String clientIp = Tools.getCurrentUserIP(); +%> + + + + 礼品卡统计 + + + + + + + + + + + + + + + +
+ + + + + + + +
礼品卡: + +   + 查询 +
+
+ + +
+
+
+ + + + \ No newline at end of file