diff --git a/src/main/java/com/jsh/action/materials/DepotHeadAction.java b/src/main/java/com/jsh/action/materials/DepotHeadAction.java index dfa28845..0dca38f3 100644 --- a/src/main/java/com/jsh/action/materials/DepotHeadAction.java +++ b/src/main/java/com/jsh/action/materials/DepotHeadAction.java @@ -576,10 +576,8 @@ public class DepotHeadAction extends BaseAction //进销部分 sum = sum - (allMoney(getS, "入库", "采购", "合计") - allMoney(getS, "入库", "采购", "实际"))*i; sum = sum - (allMoney(getS, "入库", "销售退货", "合计") - allMoney(getS, "入库", "销售退货", "实际"))*i; - sum = sum - (allMoney(getS, "入库", "其他", "合计") - allMoney(getS, "入库", "其他", "实际"))*i; sum = sum + (allMoney(getS, "出库", "销售", "合计") - allMoney(getS, "出库", "销售", "实际"))*i; sum = sum + (allMoney(getS, "出库", "采购退货", "合计") - allMoney(getS, "出库", "采购退货", "实际"))*i; - sum = sum + (allMoney(getS, "出库", "其他", "合计") - allMoney(getS, "出库", "其他", "实际"))*i; outer.put("getAllMoney", sum); toClient(outer.toString()); } @@ -765,16 +763,14 @@ public class DepotHeadAction extends BaseAction Object[] arr = (Object[]) dl; //转为数组 item.put("number", arr[0]); //单据编号 item.put("type", arr[1]); //类型 - item.put("changeAmount", arr[2]); //金额 - item.put("totalPrice", arr[3]); //金额 String type = arr[1].toString(); Double p1 = 0.0; Double p2 = 0.0; - if(arr[3]!=null){ - p1 = Double.parseDouble(arr[3].toString()); - } if(arr[2]!=null){ - p2 = Double.parseDouble(arr[2].toString()); + p1 = Double.parseDouble(arr[2].toString()); + } + if(arr[3]!=null){ + p2 = Double.parseDouble(arr[3].toString()); } Double allPrice = 0.0; if(p1<0) { @@ -789,18 +785,12 @@ public class DepotHeadAction extends BaseAction else if(type.equals("销售退货入库")) { allPrice = -(p1-p2); } - else if(type.equals("其他入库")) { - allPrice = -(p1-p2); - } else if(type.equals("销售出库")) { allPrice = p1-p2; } else if(type.equals("采购退货出库")) { allPrice = p1-p2; } - else if(type.equals("其他出库")) { - allPrice = p1-p2; - } else if(type.equals("付款")) { allPrice = p1+p2; } @@ -813,6 +803,8 @@ public class DepotHeadAction extends BaseAction else if(type.equals("支出")) { allPrice = -(p1-p2); } + item.put("discountLastMoney", p1); //金额 + item.put("changeAmount", p2); //金额 item.put("allPrice", String .format("%.2f",allPrice)); //计算后的金额 item.put("supplierName", arr[4]); //供应商 item.put("operTime", arr[5]); //入库出库日期 diff --git a/src/main/java/com/jsh/dao/materials/DepotHeadDAO.java b/src/main/java/com/jsh/dao/materials/DepotHeadDAO.java index e7f374f5..6890f389 100644 --- a/src/main/java/com/jsh/dao/materials/DepotHeadDAO.java +++ b/src/main/java/com/jsh/dao/materials/DepotHeadDAO.java @@ -36,7 +36,7 @@ public class DepotHeadDAO extends BaseDAO 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 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("")) { diff --git a/src/main/webapp/pages/reports/statement_of_account.jsp b/src/main/webapp/pages/reports/statement_of_account.jsp index 8c49202d..c43d6899 100644 --- a/src/main/webapp/pages/reports/statement_of_account.jsp +++ b/src/main/webapp/pages/reports/statement_of_account.jsp @@ -114,7 +114,7 @@ { title: '单据编号',field: 'number',width:140}, { title: '类型',field: 'type',width:100}, { title: '单位名称',field: 'supplierName',width:200}, - { title: '单据金额',field: 'totalPrice',width:80}, + { title: '单据金额',field: 'discountLastMoney',width:80}, { title: '实际支付',field: 'changeAmount',width:80}, { title: '本期变化',field: 'allPrice',width:80}, { title: '单据日期',field: 'operTime',width:140}