diff --git a/src/main/java/com/jsh/action/basic/SupplierAction.java b/src/main/java/com/jsh/action/basic/SupplierAction.java index f54942be..ce9ea841 100644 --- a/src/main/java/com/jsh/action/basic/SupplierAction.java +++ b/src/main/java/com/jsh/action/basic/SupplierAction.java @@ -5,15 +5,19 @@ import java.sql.Timestamp; import java.util.HashMap; import java.util.List; import java.util.Map; + import net.sf.json.JSONArray; import net.sf.json.JSONObject; + import org.springframework.dao.DataAccessException; + import com.jsh.base.BaseAction; import com.jsh.base.Log; import com.jsh.model.po.Logdetails; import com.jsh.model.po.Supplier; import com.jsh.model.vo.basic.SupplierModel; import com.jsh.service.basic.SupplierIService; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; /* * 单位管理 @@ -242,8 +246,6 @@ public class SupplierAction extends BaseAction item.put("email", supplier.getEmail()); item.put("BeginNeedGet",supplier.getBeginNeedGet()); item.put("BeginNeedPay",supplier.getBeginNeedPay()); - item.put("AllNeedGet",supplier.getAllNeedGet()); - item.put("AllNeedPay",supplier.getAllNeedPay()); item.put("isystem", supplier.getIsystem() == (short)0?"是":"否"); item.put("description", supplier.getDescription()); item.put("enabled", supplier.getEnabled()); diff --git a/src/main/java/com/jsh/action/materials/AccountHeadAction.java b/src/main/java/com/jsh/action/materials/AccountHeadAction.java index 3a055bdb..ed8e3264 100644 --- a/src/main/java/com/jsh/action/materials/AccountHeadAction.java +++ b/src/main/java/com/jsh/action/materials/AccountHeadAction.java @@ -7,9 +7,12 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; + import net.sf.json.JSONArray; import net.sf.json.JSONObject; + import org.springframework.dao.DataAccessException; + import com.jsh.base.BaseAction; import com.jsh.base.Log; import com.jsh.model.po.Account; @@ -19,6 +22,8 @@ import com.jsh.model.po.Person; import com.jsh.model.po.Supplier; import com.jsh.model.vo.materials.AccountHeadModel; import com.jsh.service.materials.AccountHeadIService; +import com.jsh.service.materials.DepotHeadIService; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; import com.jsh.util.Tools; /* @@ -276,6 +281,70 @@ public class AccountHeadAction extends BaseAction Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询财务信息结果异常", e); } } + + /** + * 查询单位的累计应收和累计应付 + * @return + */ + public void findTotalPay() { + try + { + JSONObject outer = new JSONObject(); + Double sum = 0.0; + String getS = model.getSupplierId(); + //进销部分 + sum = sum - (allMoney(getS, "付款", "合计") + allMoney(getS, "付款", "实际")); + sum = sum + (allMoney(getS, "收款", "合计") + allMoney(getS, "收款", "实际")); + sum = sum - (allMoney(getS, "收入", "合计") - allMoney(getS, "收入", "实际")); + sum = sum + (allMoney(getS, "支出", "合计") - allMoney(getS, "支出", "实际")); + //收付款部分 + + outer.put("getAllMoney", sum); + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询结果异常", e); + } + } + + /** + * 统计总金额 + * @param type + * @param mode 合计或者金额 + * @return + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + public Double allMoney(String getS, String type, String mode) { + Log.infoFileSync("getS:" + getS); + Double allMoney = 0.0; + String allReturn = ""; + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try { + Integer supplierId = Integer.valueOf(getS); + accountHeadService.findAllMoney(pageUtil, supplierId, type, mode); + allReturn = pageUtil.getPageList().toString(); + allReturn = allReturn.substring(1,allReturn.length()-1); + if(allReturn.equals("null")){ + allReturn = "0"; + } + } catch (JshException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + allMoney = Double.parseDouble(allReturn); + //返回正数,如果负数也转为正数 + if(allMoney<0){ + allMoney = -allMoney; + } + return allMoney; + } /** * 拼接搜索条件 @@ -296,7 +365,6 @@ public class AccountHeadAction extends BaseAction } //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override public AccountHeadModel getModel() { return model; diff --git a/src/main/java/com/jsh/action/materials/DepotHeadAction.java b/src/main/java/com/jsh/action/materials/DepotHeadAction.java index 427ce27b..df16802d 100644 --- a/src/main/java/com/jsh/action/materials/DepotHeadAction.java +++ b/src/main/java/com/jsh/action/materials/DepotHeadAction.java @@ -7,9 +7,12 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; + import net.sf.json.JSONArray; import net.sf.json.JSONObject; + import org.springframework.dao.DataAccessException; + import com.jsh.base.BaseAction; import com.jsh.base.Log; import com.jsh.model.po.Account; @@ -20,8 +23,11 @@ import com.jsh.model.po.Person; import com.jsh.model.po.Supplier; import com.jsh.model.vo.materials.DepotHeadModel; import com.jsh.service.materials.DepotHeadIService; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; import com.jsh.util.Tools; + + /* * 单据表头管理 * @author jishenghua qq:752718920 @@ -331,6 +337,72 @@ public class DepotHeadAction extends BaseAction } } + /** + * 查询单位的累计应收和累计应付 + * @return + */ + public void findTotalPay() { + try + { + JSONObject outer = new JSONObject(); + Double sum = 0.0; + String getS = model.getSupplierId(); + //进销部分 + sum = sum + (allMoney(getS, "入库", "采购", "合计") - allMoney(getS, "入库", "采购", "实际")); + sum = sum + (allMoney(getS, "入库", "销售退货", "合计") - allMoney(getS, "入库", "销售退货", "实际")); + sum = sum + (allMoney(getS, "入库", "其他", "合计") - allMoney(getS, "入库", "其他", "实际")); + sum = sum - (allMoney(getS, "出库", "销售", "合计") - allMoney(getS, "出库", "销售", "实际")); + sum = sum - (allMoney(getS, "出库", "采购退货", "合计") - allMoney(getS, "出库", "采购退货", "实际")); + sum = sum - (allMoney(getS, "出库", "其他", "合计") - allMoney(getS, "出库", "其他", "实际")); + outer.put("getAllMoney", sum); + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询结果异常", e); + } + } + + + /** + * 统计总金额 + * @param type + * @param subType + * @param mode 合计或者金额 + * @return + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + public Double allMoney(String getS, String type, String subType, String mode) { + Log.infoFileSync("getS:" + getS); + Double allMoney = 0.0; + String allReturn = ""; + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try { + Integer supplierId = Integer.valueOf(getS); + depotHeadService.findAllMoney(pageUtil, supplierId, type, subType, mode); + allReturn = pageUtil.getPageList().toString(); + allReturn = allReturn.substring(1,allReturn.length()-1); + if(allReturn.equals("null")){ + allReturn = "0"; + } + } catch (JshException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + allMoney = Double.parseDouble(allReturn); + //返回正数,如果负数也转为正数 + if(allMoney<0){ + allMoney = -allMoney; + } + return allMoney; + } + /** * 拼接搜索条件 * @return @@ -362,7 +434,6 @@ public class DepotHeadAction extends BaseAction } //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override public DepotHeadModel getModel() { return model; diff --git a/src/main/java/com/jsh/dao/materials/AccountHeadDAO.java b/src/main/java/com/jsh/dao/materials/AccountHeadDAO.java index 3bfb4839..1731bb97 100644 --- a/src/main/java/com/jsh/dao/materials/AccountHeadDAO.java +++ b/src/main/java/com/jsh/dao/materials/AccountHeadDAO.java @@ -5,6 +5,7 @@ import org.hibernate.Query; import com.jsh.base.BaseDAO; import com.jsh.util.JshException; import com.jsh.model.po.AccountHead; +import com.jsh.model.po.DepotHead; import com.jsh.model.po.UserBusiness; import com.jsh.util.PageUtil; import com.jsh.util.SearchConditionUtil; @@ -22,11 +23,26 @@ public class AccountHeadDAO extends BaseDAO implements AccountHeadI } @SuppressWarnings("unchecked") - @Override public void find(PageUtil pageUtil,String maxid) throws JshException { Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select max(Id) as Id from AccountHead accountHead where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); pageUtil.setTotalCount(query.list().size()); pageUtil.setPageList(query.list()); } + + @SuppressWarnings("unchecked") + public void findAllMoney(PageUtil pageUtil, Integer supplierId, String type, String mode) throws JshException + { + Query query; + String modeName = ""; + if(mode.equals("实际")){ + modeName = "ChangeAmount"; + } + else if(mode.equals("合计")){ + modeName = "TotalPrice"; + } + query= this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select sum(" + modeName + ") as allMoney from AccountHead accountHead where Type='" + type + "' and OrganId =" + supplierId + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + pageUtil.setTotalCount(query.list().size()); + pageUtil.setPageList(query.list()); + } } diff --git a/src/main/java/com/jsh/dao/materials/AccountHeadIDAO.java b/src/main/java/com/jsh/dao/materials/AccountHeadIDAO.java index b350f2f0..a96b7eaa 100644 --- a/src/main/java/com/jsh/dao/materials/AccountHeadIDAO.java +++ b/src/main/java/com/jsh/dao/materials/AccountHeadIDAO.java @@ -3,6 +3,7 @@ package com.jsh.dao.materials; import com.jsh.base.BaseIDAO; import com.jsh.util.JshException; import com.jsh.model.po.AccountHead; +import com.jsh.model.po.DepotHead; import com.jsh.model.po.UserBusiness; import com.jsh.util.PageUtil; @@ -12,4 +13,6 @@ public interface AccountHeadIDAO extends BaseIDAO * 获取MaxId */ void find(PageUtil pageUtil,String maxid) throws JshException; + + void findAllMoney(PageUtil pageUtil, Integer supplierId, String type, String mode) throws JshException; } diff --git a/src/main/java/com/jsh/dao/materials/DepotHeadDAO.java b/src/main/java/com/jsh/dao/materials/DepotHeadDAO.java index a5240497..9e3e0a81 100644 --- a/src/main/java/com/jsh/dao/materials/DepotHeadDAO.java +++ b/src/main/java/com/jsh/dao/materials/DepotHeadDAO.java @@ -22,11 +22,26 @@ public class DepotHeadDAO extends BaseDAO implements DepotHeadIDAO } @SuppressWarnings("unchecked") - @Override - public void find(PageUtil pageUtil,String maxid) throws JshException + public void find(PageUtil pageUtil,String maxid) throws JshException { Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select max(Id) as Id from DepotHead depotHead where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); pageUtil.setTotalCount(query.list().size()); pageUtil.setPageList(query.list()); } + + @SuppressWarnings("unchecked") + public void findAllMoney(PageUtil pageUtil, Integer supplierId, String type, String subType, String mode) throws JshException + { + Query query; + String modeName = ""; + if(mode.equals("实际")){ + modeName = "ChangeAmount"; + } + else if(mode.equals("合计")){ + modeName = "TotalPrice"; + } + 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()); + pageUtil.setPageList(query.list()); + } } diff --git a/src/main/java/com/jsh/dao/materials/DepotHeadIDAO.java b/src/main/java/com/jsh/dao/materials/DepotHeadIDAO.java index 9bd606f5..11a74668 100644 --- a/src/main/java/com/jsh/dao/materials/DepotHeadIDAO.java +++ b/src/main/java/com/jsh/dao/materials/DepotHeadIDAO.java @@ -12,4 +12,7 @@ public interface DepotHeadIDAO extends BaseIDAO * 获取MaxId */ void find(PageUtil pageUtil,String maxid) throws JshException; + + void findAllMoney(PageUtil pageUtil, Integer supplierId, String type, String subType, String mode) throws JshException; + } diff --git a/src/main/java/com/jsh/dao/materials/DepotItemIDAO.java b/src/main/java/com/jsh/dao/materials/DepotItemIDAO.java index 6ccc31c6..c51d79bd 100644 --- a/src/main/java/com/jsh/dao/materials/DepotItemIDAO.java +++ b/src/main/java/com/jsh/dao/materials/DepotItemIDAO.java @@ -8,7 +8,7 @@ import com.jsh.util.PageUtil; public interface DepotItemIDAO extends BaseIDAO { - void findByType(PageUtil pageUtil,String type,Long MId, String MonthTime,Boolean isPrev) throws JshException; + public void findByType(PageUtil pageUtil,String type,Long MId, String MonthTime,Boolean isPrev) throws JshException; - 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; } diff --git a/src/main/java/com/jsh/model/vo/materials/AccountHeadModel.java b/src/main/java/com/jsh/model/vo/materials/AccountHeadModel.java index 0c0b1432..386dae88 100644 --- a/src/main/java/com/jsh/model/vo/materials/AccountHeadModel.java +++ b/src/main/java/com/jsh/model/vo/materials/AccountHeadModel.java @@ -20,6 +20,8 @@ public class AccountHeadModel implements Serializable private String BeginTime; //查询开始时间 private String EndTime; //查询结束时间 private String MonthTime; //查询月份 + + private String supplierId; //单位Id,用于查询单位的收付款 /** * 分类ID */ @@ -222,4 +224,14 @@ public class AccountHeadModel implements Serializable public String getClientIp() { return clientIp; - }} + } + + public String getSupplierId() { + return supplierId; + } + + public void setSupplierId(String supplierId) { + this.supplierId = supplierId; + } + +} diff --git a/src/main/java/com/jsh/model/vo/materials/DepotHeadModel.java b/src/main/java/com/jsh/model/vo/materials/DepotHeadModel.java index f41ffb8b..761d6ade 100644 --- a/src/main/java/com/jsh/model/vo/materials/DepotHeadModel.java +++ b/src/main/java/com/jsh/model/vo/materials/DepotHeadModel.java @@ -25,7 +25,10 @@ public class DepotHeadModel implements Serializable private String BeginTime; //查询开始时间 private String EndTime; //查询结束时间 private String MonthTime; //查询月份 - /** + + private String supplierId; //单位Id,用于查询单位的应收应付 + + /** * 分类ID */ private Long depotHeadID = 0l; @@ -225,5 +228,14 @@ public class DepotHeadModel implements Serializable public void setMonthTime(String monthTime) { MonthTime = monthTime; } + + public String getSupplierId() { + return supplierId; + } + + public void setSupplierId(String supplierId) { + this.supplierId = supplierId; + } + } diff --git a/src/main/java/com/jsh/service/materials/AccountHeadIService.java b/src/main/java/com/jsh/service/materials/AccountHeadIService.java index 90ba812a..cb46fcd7 100644 --- a/src/main/java/com/jsh/service/materials/AccountHeadIService.java +++ b/src/main/java/com/jsh/service/materials/AccountHeadIService.java @@ -3,6 +3,7 @@ package com.jsh.service.materials; import com.jsh.base.BaseIService; import com.jsh.util.JshException; import com.jsh.model.po.AccountHead; +import com.jsh.model.po.DepotHead; import com.jsh.model.po.UserBusiness; import com.jsh.util.PageUtil; @@ -12,4 +13,6 @@ public interface AccountHeadIService extends BaseIService * 获取MaxId */ void find(PageUtil accountHead,String maxid)throws JshException; + + void findAllMoney(PageUtil accountHead, Integer supplierId, String type, String mode)throws JshException; } diff --git a/src/main/java/com/jsh/service/materials/AccountHeadService.java b/src/main/java/com/jsh/service/materials/AccountHeadService.java index 5b298234..c4267b1f 100644 --- a/src/main/java/com/jsh/service/materials/AccountHeadService.java +++ b/src/main/java/com/jsh/service/materials/AccountHeadService.java @@ -4,6 +4,7 @@ import com.jsh.base.BaseService; import com.jsh.dao.materials.AccountHeadIDAO; import com.jsh.util.JshException; import com.jsh.model.po.AccountHead; +import com.jsh.model.po.DepotHead; import com.jsh.model.po.UserBusiness; import com.jsh.util.PageUtil; @@ -24,9 +25,13 @@ public class AccountHeadService extends BaseService implements Acco return AccountHead.class; } - @Override public void find(PageUtil pageUtil, String maxid) throws JshException { accountHeadDao.find(pageUtil, maxid); } + + public void findAllMoney(PageUtil pageUtil, Integer supplierId, String type, String mode) throws JshException + { + accountHeadDao.findAllMoney(pageUtil, supplierId, type, mode); + } } diff --git a/src/main/java/com/jsh/service/materials/DepotHeadIService.java b/src/main/java/com/jsh/service/materials/DepotHeadIService.java index a3e2bc59..75f6c0d1 100644 --- a/src/main/java/com/jsh/service/materials/DepotHeadIService.java +++ b/src/main/java/com/jsh/service/materials/DepotHeadIService.java @@ -12,4 +12,6 @@ public interface DepotHeadIService extends BaseIService * 获取MaxId */ void find(PageUtil depotHead,String maxid)throws JshException; + + void findAllMoney(PageUtil depotHead, Integer supplierId, String type, String subType, String mode)throws JshException; } diff --git a/src/main/java/com/jsh/service/materials/DepotHeadService.java b/src/main/java/com/jsh/service/materials/DepotHeadService.java index b912b84b..94f790c0 100644 --- a/src/main/java/com/jsh/service/materials/DepotHeadService.java +++ b/src/main/java/com/jsh/service/materials/DepotHeadService.java @@ -24,9 +24,13 @@ public class DepotHeadService extends BaseService implements DepotHea return DepotHead.class; } - @Override public void find(PageUtil pageUtil, String maxid) throws JshException { depotHeadDao.find(pageUtil, maxid); } + + public void findAllMoney(PageUtil pageUtil, Integer supplierId, String type, String subType, String mode) throws JshException + { + depotHeadDao.findAllMoney(pageUtil, supplierId, type, subType, mode); + } } diff --git a/src/main/webapp/WEB-INF/classes/com/jsh/action/basic/SupplierAction.class b/src/main/webapp/WEB-INF/classes/com/jsh/action/basic/SupplierAction.class index b15dc5ea..5cb6496f 100644 Binary files a/src/main/webapp/WEB-INF/classes/com/jsh/action/basic/SupplierAction.class and b/src/main/webapp/WEB-INF/classes/com/jsh/action/basic/SupplierAction.class differ diff --git a/src/main/webapp/WEB-INF/classes/com/jsh/action/materials/AccountHeadAction.class b/src/main/webapp/WEB-INF/classes/com/jsh/action/materials/AccountHeadAction.class index 6bbd3b7f..ba362b4e 100644 Binary files a/src/main/webapp/WEB-INF/classes/com/jsh/action/materials/AccountHeadAction.class and b/src/main/webapp/WEB-INF/classes/com/jsh/action/materials/AccountHeadAction.class differ diff --git a/src/main/webapp/WEB-INF/classes/com/jsh/action/materials/DepotHeadAction.class b/src/main/webapp/WEB-INF/classes/com/jsh/action/materials/DepotHeadAction.class index 487b7623..fb79268c 100644 Binary files a/src/main/webapp/WEB-INF/classes/com/jsh/action/materials/DepotHeadAction.class and b/src/main/webapp/WEB-INF/classes/com/jsh/action/materials/DepotHeadAction.class differ diff --git a/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/AccountHeadDAO.class b/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/AccountHeadDAO.class index 866d9f66..755fb388 100644 Binary files a/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/AccountHeadDAO.class and b/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/AccountHeadDAO.class differ diff --git a/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/AccountHeadIDAO.class b/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/AccountHeadIDAO.class index 0e1fe1cb..c841582f 100644 Binary files a/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/AccountHeadIDAO.class and b/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/AccountHeadIDAO.class differ diff --git a/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/DepotHeadDAO.class b/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/DepotHeadDAO.class index 5493313e..eeef685d 100644 Binary files a/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/DepotHeadDAO.class and b/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/DepotHeadDAO.class differ diff --git a/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/DepotHeadIDAO.class b/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/DepotHeadIDAO.class index b1ef2652..6e3d1ab1 100644 Binary files a/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/DepotHeadIDAO.class and b/src/main/webapp/WEB-INF/classes/com/jsh/dao/materials/DepotHeadIDAO.class differ diff --git a/src/main/webapp/WEB-INF/classes/com/jsh/model/vo/materials/AccountHeadModel.class b/src/main/webapp/WEB-INF/classes/com/jsh/model/vo/materials/AccountHeadModel.class index 7e333a78..2a13cedb 100644 Binary files a/src/main/webapp/WEB-INF/classes/com/jsh/model/vo/materials/AccountHeadModel.class and b/src/main/webapp/WEB-INF/classes/com/jsh/model/vo/materials/AccountHeadModel.class differ diff --git a/src/main/webapp/WEB-INF/classes/com/jsh/model/vo/materials/DepotHeadModel.class b/src/main/webapp/WEB-INF/classes/com/jsh/model/vo/materials/DepotHeadModel.class index 5e967fc3..aa2e1665 100644 Binary files a/src/main/webapp/WEB-INF/classes/com/jsh/model/vo/materials/DepotHeadModel.class and b/src/main/webapp/WEB-INF/classes/com/jsh/model/vo/materials/DepotHeadModel.class differ diff --git a/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/AccountHeadIService.class b/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/AccountHeadIService.class index 6a4ddd30..187ede52 100644 Binary files a/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/AccountHeadIService.class and b/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/AccountHeadIService.class differ diff --git a/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/AccountHeadService.class b/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/AccountHeadService.class index 41dea364..f13b3a42 100644 Binary files a/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/AccountHeadService.class and b/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/AccountHeadService.class differ diff --git a/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/DepotHeadIService.class b/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/DepotHeadIService.class index 9a57d0c5..11258b77 100644 Binary files a/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/DepotHeadIService.class and b/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/DepotHeadIService.class differ diff --git a/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/DepotHeadService.class b/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/DepotHeadService.class index ebc9f180..efb62b7c 100644 Binary files a/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/DepotHeadService.class and b/src/main/webapp/WEB-INF/classes/com/jsh/service/materials/DepotHeadService.class differ diff --git a/src/main/webapp/js/pages/financial/financial_base.js b/src/main/webapp/js/pages/financial/financial_base.js index 54d87576..abbdfedf 100644 --- a/src/main/webapp/js/pages/financial/financial_base.js +++ b/src/main/webapp/js/pages/financial/financial_base.js @@ -42,7 +42,7 @@ moneyType = true; //隐藏当前列 payTypeTitle = "收入项目"; inOrOut = "in"; - organUrl = supUrl; + organUrl = cusUrl; } else if(listTitle === "支出单列表"){ listType = "支出"; @@ -50,7 +50,7 @@ moneyType = true; //隐藏当前列 payTypeTitle = "支出项目"; inOrOut = "out"; - organUrl = cusUrl; + organUrl = supUrl; } else if(listTitle === "收款单列表"){ listType = "收款"; @@ -58,7 +58,7 @@ moneyType = false; //显示当前列 payTypeTitle = "无标题"; inOrOut = ""; - organUrl = supUrl; + organUrl = cusUrl; } else if(listTitle === "付款单列表"){ listType = "付款"; @@ -66,7 +66,7 @@ moneyType = false; //显示当前列 payTypeTitle = "无标题"; inOrOut = ""; - organUrl = cusUrl; + organUrl = supUrl; } else if(listTitle === "转账单列表"){ listType = "转账"; diff --git a/src/main/webapp/pages/manage/vendor.jsp b/src/main/webapp/pages/manage/vendor.jsp index 4f9d3b69..f76ec835 100644 --- a/src/main/webapp/pages/manage/vendor.jsp +++ b/src/main/webapp/pages/manage/vendor.jsp @@ -201,14 +201,14 @@ { title: '联系人', field: 'contacts',width:50,align:"center"}, { title: '联系电话', field: 'phonenum',width:60,align:"center"}, { title: '电子邮箱',field: 'email',width:80,align:"center"}, - { title: '累计应收',field: 'AllNeedGet',width:70,align:"center"}, - { title: '累计应付',field: 'AllNeedPay',width:70,align:"center"}, + { title: '期初应收',field: 'BeginNeedGet',width:70,align:"center"}, + { title: '期初应付',field: 'BeginNeedPay',width:70,align:"center"}, { title: '类型',field: 'type',width:50}, { title: '启动',field: 'enabled',width:40}, { title: '操作',field: 'op',align:"center",width:130,formatter:function(value,rec) { var str = ''; - var rowInfo = rec.id + 'AaBb' + rec.supplier +'AaBb' + rec.contacts + 'AaBb'+ rec.phonenum + 'AaBb'+ rec.email + 'AaBb'+ rec.BeginNeedGet + 'AaBb'+ rec.BeginNeedPay + 'AaBb'+ rec.AllNeedGet + 'AaBb'+ rec.AllNeedPay + 'AaBb' + rec.isystem + 'AaBb' + rec.description+ 'AaBb' + rec.type+ 'AaBb' + rec.enabled; + var rowInfo = rec.id + 'AaBb' + rec.supplier +'AaBb' + rec.contacts + 'AaBb'+ rec.phonenum + 'AaBb'+ rec.email + 'AaBb'+ rec.BeginNeedGet + 'AaBb'+ rec.BeginNeedPay + 'AaBb' + rec.isystem + 'AaBb' + rec.description+ 'AaBb' + rec.type+ 'AaBb' + rec.enabled; if(1 == value) { str += ' 编辑  '; @@ -428,6 +428,12 @@ $("#phonenum").val("").focus(); return; } + var beginNeedGet = $.trim($("#BeginNeedGet").val()); + var beginNeedPay = $.trim($("#BeginNeedPay").val()); + if(beginNeedGet && beginNeedPay) { + $.messager.alert('提示','期初应收和期初应付不能同时输入','info'); + return; + } $('#supplierFM').form('submit',{ url: url, @@ -467,11 +473,9 @@ email : supplierInfo[4], BeginNeedGet : supplierInfo[5], BeginNeedPay : supplierInfo[6], - AllNeedGet : supplierInfo[7], - AllNeedPay : supplierInfo[8], - description : supplierInfo[10], - type : supplierInfo[11], - enabled : supplierInfo[12], + description : supplierInfo[8], + type : supplierInfo[9], + enabled : supplierInfo[10], clientIp:'<%=clientIp %>' }; orgSupplier = supplierInfo[1]; @@ -482,6 +486,54 @@ //焦点在名称输入框==定焦在输入文字后面 $("#supplier").val("").focus().val(supplierInfo[1]); url = '<%=path %>/supplier/update.action?supplierID=' + supplierInfo[0]; + + //显示累计应收和累计应付 + $.ajax({ + type:"post", + url: "<%=path %>/depotHead/findTotalPay.action", + dataType: "json", + async: false, + data: ({ + supplierId: supplierInfo[0] + }), + success: function(res){ + if(res) { + var moneyA = res.getAllMoney.toFixed(2)-0; + $.ajax({ + type:"post", + url: "<%=path %>/accountHead/findTotalPay.action", + dataType: "json", + async: false, + data: ({ + supplierId: supplierInfo[0] + }), + success: function(res){ + if(res) { + var moneyB = res.getAllMoney.toFixed(2)-0; + var money = moneyA+moneyB; + var moneyBeginNeedGet = $("#BeginNeedGet").val()-0; //期初应收 + var moneyBeginNeedPay = $("#BeginNeedPay").val()-0; //期初应付 + money = money + moneyBeginNeedPay - moneyBeginNeedGet; + if(money>0) { + $("#AllNeedPay").val(money); //累计应付 + } + else { + $("#AllNeedGet").val(-money); //累计应收 + } + } + }, + error: function(){ + $.messager.alert('提示','网络异常请稍后再试!','error'); + return; + } + }); + } + }, + error: function(){ + $.messager.alert('提示','网络异常请稍后再试!','error'); + return; + } + }) }