diff --git a/src/main/java/com/jsh/action/basic/SupplierAction.java b/src/main/java/com/jsh/action/basic/SupplierAction.java index 9e720cfc..88ed7e6c 100644 --- a/src/main/java/com/jsh/action/basic/SupplierAction.java +++ b/src/main/java/com/jsh/action/basic/SupplierAction.java @@ -158,6 +158,56 @@ public class SupplierAction extends BaseAction new Timestamp(System.currentTimeMillis()) , tipType, "更新供应商ID为 "+ model.getSupplierID() + " " + tipMsg + "!", "更新供应商" + tipMsg)); } + + /** + * 更新供应商-只更新预付款,其余用原来的值 + * @return + */ + public void updateAdvanceIn() + { + Boolean flag = false; + try + { + Supplier supplier = supplierService.get(model.getSupplierID()); + supplier.setContacts(supplier.getContacts()); + supplier.setType(supplier.getType()); + supplier.setDescription(supplier.getDescription()); + supplier.setEmail(supplier.getEmail()); + supplier.setAdvanceIn(supplier.getAdvanceIn() + model.getAdvanceIn()); //增加预收款的金额,可能增加的是负值 + supplier.setBeginNeedGet(supplier.getBeginNeedGet()); + supplier.setBeginNeedPay(supplier.getBeginNeedPay()); + supplier.setIsystem((short)1); + supplier.setPhonenum(supplier.getPhonenum()); + supplier.setSupplier(supplier.getSupplier()); + supplier.setEnabled(supplier.getEnabled()); + supplierService.update(supplier); + + flag = true; + tipMsg = "成功"; + tipType = 0; + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>修改供应商ID为 : " + model.getSupplierID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } + finally + { + try + { + toClient(flag.toString()); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>修改供应商回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新供应商预付款", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新供应商ID为 "+ model.getSupplierID() + " " + tipMsg + "!", "更新供应商" + tipMsg)); + } /** * 批量删除指定ID供应商 @@ -244,6 +294,7 @@ public class SupplierAction extends BaseAction item.put("contacts",supplier.getContacts()); item.put("phonenum", supplier.getPhonenum()); item.put("email", supplier.getEmail()); + item.put("AdvanceIn",supplier.getAdvanceIn()); item.put("BeginNeedGet",supplier.getBeginNeedGet()); item.put("BeginNeedPay",supplier.getBeginNeedPay()); item.put("isystem", supplier.getIsystem() == (short)0?"是":"否"); diff --git a/src/main/java/com/jsh/action/materials/DepotHeadAction.java b/src/main/java/com/jsh/action/materials/DepotHeadAction.java index 786eed41..05e6bfd1 100644 --- a/src/main/java/com/jsh/action/materials/DepotHeadAction.java +++ b/src/main/java/com/jsh/action/materials/DepotHeadAction.java @@ -92,6 +92,7 @@ public class DepotHeadAction extends BaseAction depotHead.setChangeAmount(model.getChangeAmount()); if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));} depotHead.setTotalPrice(model.getTotalPrice()); + depotHead.setPayType(model.getPayType()); depotHead.setRemark(model.getRemark()); depotHeadService.create(depotHead); @@ -181,7 +182,8 @@ public class DepotHeadAction extends BaseAction if(model.getAccountId()!=null){depotHead.setAccountId(new Account(model.getAccountId()));} depotHead.setChangeAmount(model.getChangeAmount()); if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));} - depotHead.setTotalPrice(model.getTotalPrice()); + depotHead.setTotalPrice(model.getTotalPrice()); + depotHead.setPayType(model.getPayType()); depotHead.setRemark(model.getRemark()); depotHeadService.update(depotHead); diff --git a/src/main/java/com/jsh/dao/basic/SupplierDAO.java b/src/main/java/com/jsh/dao/basic/SupplierDAO.java index 4710ba26..8459e135 100644 --- a/src/main/java/com/jsh/dao/basic/SupplierDAO.java +++ b/src/main/java/com/jsh/dao/basic/SupplierDAO.java @@ -2,6 +2,9 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.Supplier; +import com.jsh.util.PageUtil; +import com.jsh.util.SearchConditionUtil; +import org.hibernate.Query; public class SupplierDAO extends BaseDAO implements SupplierIDAO { @@ -14,6 +17,5 @@ public class SupplierDAO extends BaseDAO implements SupplierIDAO { return Supplier.class; } - - + } diff --git a/src/main/java/com/jsh/dao/basic/SupplierIDAO.java b/src/main/java/com/jsh/dao/basic/SupplierIDAO.java index 199dac0c..1b7b3a62 100644 --- a/src/main/java/com/jsh/dao/basic/SupplierIDAO.java +++ b/src/main/java/com/jsh/dao/basic/SupplierIDAO.java @@ -5,5 +5,4 @@ import com.jsh.model.po.Supplier; public interface SupplierIDAO extends BaseIDAO { - } diff --git a/src/main/java/com/jsh/model/po/DepotHead.java b/src/main/java/com/jsh/model/po/DepotHead.java index 6b15402f..5593b409 100644 --- a/src/main/java/com/jsh/model/po/DepotHead.java +++ b/src/main/java/com/jsh/model/po/DepotHead.java @@ -19,6 +19,7 @@ public class DepotHead implements java.io.Serializable private Double ChangeAmount; private Depot AllocationProjectId; private Double TotalPrice; + private String PayType; private String Remark; public DepotHead() @@ -34,7 +35,7 @@ public class DepotHead implements java.io.Serializable public DepotHead(String type, String subType, Depot projectId, String number, String operPersonName, Timestamp createTime, Timestamp operTime, Supplier organId, Person handsPersonId, - Account accountId, Double changeAmount, Depot allocationProjectId, Double totalPrice, String remark) { + Account accountId, Double changeAmount, Depot allocationProjectId, Double totalPrice,String payType, String remark) { super(); Type = type; SubType = subType; @@ -49,6 +50,7 @@ public class DepotHead implements java.io.Serializable ChangeAmount = changeAmount; AllocationProjectId = allocationProjectId; TotalPrice = totalPrice; + PayType = payType; Remark = remark; } @@ -164,6 +166,14 @@ public class DepotHead implements java.io.Serializable TotalPrice = totalPrice; } + public String getPayType() { + return PayType; + } + + public void setPayType(String payType) { + PayType = payType; + } + public String getRemark() { return Remark; } diff --git a/src/main/java/com/jsh/model/po/Supplier.java b/src/main/java/com/jsh/model/po/Supplier.java index 2578eb99..5702713d 100644 --- a/src/main/java/com/jsh/model/po/Supplier.java +++ b/src/main/java/com/jsh/model/po/Supplier.java @@ -9,6 +9,7 @@ public class Supplier implements java.io.Serializable private String contacts; private String phonenum; private String email; + private Double advanceIn; private Double BeginNeedGet; private Double BeginNeedPay; private Double AllNeedGet; @@ -28,7 +29,7 @@ public class Supplier implements java.io.Serializable } public Supplier(String supplier, String type, String contacts, String phonenum, - String email, Short isystem, String description, Boolean enabled, + String email, Short isystem, String description, Boolean enabled, Double advanceIn, Double beginNeedGet,Double beginNeedPay,Double allNeedGet,Double allNeedPay) { super(); this.supplier = supplier; @@ -43,6 +44,7 @@ public class Supplier implements java.io.Serializable this.isystem = isystem; this.description = description; this.enabled = enabled; + this.advanceIn = advanceIn; } public Long getId() @@ -158,6 +160,13 @@ public class Supplier implements java.io.Serializable public void setEnabled(Boolean enabled) { this.enabled = enabled; - } - + } + + public Double getAdvanceIn() { + return advanceIn; + } + + public void setAdvanceIn(Double advanceIn) { + this.advanceIn = advanceIn; + } } diff --git a/src/main/java/com/jsh/model/vo/basic/SupplierModel.java b/src/main/java/com/jsh/model/vo/basic/SupplierModel.java index 8ab7317c..53da4bdf 100644 --- a/src/main/java/com/jsh/model/vo/basic/SupplierModel.java +++ b/src/main/java/com/jsh/model/vo/basic/SupplierModel.java @@ -31,12 +31,17 @@ public class SupplierModel implements Serializable /** * 电子邮箱 */ - private String email = ""; - - /** - * 期初应收 + private String email = ""; + + /** + * 预付款 */ - private Double BeginNeedGet; + private Double AdvanceIn; + + /** + * 期初应收 + */ + private Double BeginNeedGet; /** * 期初应付 @@ -135,6 +140,14 @@ public class SupplierModel implements Serializable public void setEmail(String email) { this.email = email; } + + public Double getAdvanceIn() { + return AdvanceIn; + } + + public void setAdvanceIn(Double advanceIn) { + AdvanceIn = advanceIn; + } public void setBeginNeedGet(Double beginNeedGet) { 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 b4a5620a..1f04f5d6 100644 --- a/src/main/java/com/jsh/model/vo/materials/DepotHeadModel.java +++ b/src/main/java/com/jsh/model/vo/materials/DepotHeadModel.java @@ -21,6 +21,7 @@ public class DepotHeadModel implements Serializable private Double ChangeAmount; private Long AllocationProjectId; private Double TotalPrice; + private String PayType = ""; private String Remark = ""; private String BeginTime; //查询开始时间 @@ -158,6 +159,14 @@ public class DepotHeadModel implements Serializable TotalPrice = totalPrice; } + public String getPayType() { + return PayType; + } + + public void setPayType(String payType) { + PayType = payType; + } + public String getRemark() { return Remark; } diff --git a/src/main/java/com/jsh/service/basic/SupplierIService.java b/src/main/java/com/jsh/service/basic/SupplierIService.java index bf81a37f..a5fb7fec 100644 --- a/src/main/java/com/jsh/service/basic/SupplierIService.java +++ b/src/main/java/com/jsh/service/basic/SupplierIService.java @@ -5,5 +5,5 @@ import com.jsh.model.po.Supplier; public interface SupplierIService extends BaseIService { - + } diff --git a/src/main/java/com/jsh/service/basic/SupplierService.java b/src/main/java/com/jsh/service/basic/SupplierService.java index 96650a26..d7922743 100644 --- a/src/main/java/com/jsh/service/basic/SupplierService.java +++ b/src/main/java/com/jsh/service/basic/SupplierService.java @@ -3,6 +3,7 @@ package com.jsh.service.basic; import com.jsh.base.BaseService; import com.jsh.dao.basic.SupplierIDAO; import com.jsh.model.po.Supplier; +import com.jsh.util.JshException; public class SupplierService extends BaseService implements SupplierIService { @@ -22,4 +23,5 @@ public class SupplierService extends BaseService implements SupplierIS { return Supplier.class; } + } diff --git a/src/main/resources/hibernate/DepotHead.hbm.xml b/src/main/resources/hibernate/DepotHead.hbm.xml index 80352b74..96257ac4 100644 --- a/src/main/resources/hibernate/DepotHead.hbm.xml +++ b/src/main/resources/hibernate/DepotHead.hbm.xml @@ -72,6 +72,11 @@ 合计金额 + + + 付款类型 + + 备注 diff --git a/src/main/resources/hibernate/Supplier.hbm.xml b/src/main/resources/hibernate/Supplier.hbm.xml index c4410ec7..475cc5bc 100644 --- a/src/main/resources/hibernate/Supplier.hbm.xml +++ b/src/main/resources/hibernate/Supplier.hbm.xml @@ -32,6 +32,11 @@ 电子邮箱 + + + 预收款 + + 期初应收 diff --git a/src/main/webapp/js/pages/financial/financial_base.js b/src/main/webapp/js/pages/financial/financial_base.js index abbdfedf..a1211d8e 100644 --- a/src/main/webapp/js/pages/financial/financial_base.js +++ b/src/main/webapp/js/pages/financial/financial_base.js @@ -10,7 +10,8 @@ var accountHeadMaxId = null; //获取最大的Id var accepId = null; //保存的主表id var url; - var accountHeadID = 0; + var accountHeadID = 0; + var preTotalPrice = 0; //前一次加载的金额 var orgAccountHead = ""; //保存编辑前的名称 var editIndex = undefined; var listTitle = ""; //单据标题 @@ -36,6 +37,7 @@ listTitle = $("#tablePanel").prev().text(); var supUrl = path + "/supplier/findBySelect_sup.action"; //供应商接口 var cusUrl = path + "/supplier/findBySelect_cus.action"; //客户接口 + var retailUrl = path + "/supplier/findBySelect_retail.action"; //散户接口 if(listTitle === "收入单列表"){ listType = "收入"; itemType = false; //显示当前列 @@ -76,6 +78,14 @@ inOrOut = ""; organUrl = supUrl; } + else if(listTitle === "收预付款列表"){ + listType = "收预付款"; + itemType = true; //隐藏当前列 + moneyType = false; //显示当前列 + payTypeTitle = "无标题"; + inOrOut = ""; + organUrl = retailUrl; + } } //获取账户信息 function initSystemData_account(){ @@ -117,7 +127,13 @@ $('#OrganId').combobox({ url: organUrl, valueField:'id', - textField:'supplier' + textField:'supplier', + formatter: function(row){ + var opts = $(this).combobox('options'); + if(row[opts.textField]!=="非会员") { + return row[opts.textField]; + } + } }); } @@ -199,6 +215,7 @@ pageList: initPageNum, columns:[[ { field: 'Id',width:35,align:"center",checkbox:true}, + {field: 'OrganId',width:5, hidden:true}, { title: '单据编号',field: 'BillNo',width:100}, { title: '单据时间 ',field: 'BillTime',width:100}, { title: '合计',field: 'TotalPrice',width:80}, @@ -213,7 +230,7 @@ { str += ' 查看  '; str += ' 编辑  '; - str += ' 删除'; + str += ' 删除'; } return str; } @@ -441,7 +458,7 @@ } //删除财务信息 - function deleteAccountHead(accountHeadID){ + function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){ $.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r) { if (r) @@ -471,7 +488,29 @@ $.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error'); return; } - }); + }); + + //更新会员的预收款信息 + if(listType === "收预付款"){ + $.ajax({ + type:"post", + url: path + "/supplier/updateAdvanceIn.action", + dataType: "json", + data:{ + SupplierID: thisOrganId, //会员id + AdvanceIn: 0-totalPrice //删除时同时删除用户的预付款信息 + }, + success: function(res){ + if(res) { + //保存会员预收款成功 + } + }, + error: function(){ + $.messager.alert('提示','保存信息异常,请稍后再试!','error'); + return; + } + }); + } } }); } @@ -491,16 +530,38 @@ if (r) { var ids = ""; - for(var i = 0;i < row.length; i ++) - { + for(var i = 0;i < row.length; i ++) { if(i == row.length-1) { ids += row[i].Id; break; } - //alert(row[i].id); ids += row[i].Id + ","; } + //批量更新会员的预收款信息 + for(var i = 0;i < row.length; i ++) { + if(listType === "收预付款"){ + $.ajax({ + type:"post", + url: path + "/supplier/updateAdvanceIn.action", + dataType: "json", + data:{ + SupplierID: row[i].OrganId, //会员id + AdvanceIn: 0 - row[i].TotalPrice //删除时同时删除用户的预付款信息 + }, + success: function(res){ + if(res) { + //保存会员预收款成功 + } + }, + error: function(){ + $.messager.alert('提示','保存信息异常,请稍后再试!','error'); + return; + } + }); + } + } + //批量删除 $.ajax({ type:"post", url: path + "/accountHead/batchDelete.action", @@ -562,6 +623,7 @@ $("#HandsPersonId").val(accountHeadInfo[8]); $("#ChangeAmount").val(accountHeadInfo[10]); var TotalPrice = accountHeadInfo[11]; + preTotalPrice = accountHeadInfo[11]; //记录前一次合计金额,用于收预付款 var editTitle = listTitle.replace("列表","信息"); $('#accountHeadDlg').dialog('open').dialog('setTitle',' 编辑' + editTitle); $(".window-mask").css({ width: webW ,height: webH}); @@ -643,6 +705,36 @@ //支出和付款为负数 TotalPrice = 0 - TotalPrice; } + //更新会员的预收款信息 + if(listType === "收预付款"){ + var advanceIn = 0; //预付款金额 + if(accountHeadID){ + advanceIn = TotalPrice - preTotalPrice; //修改时,预付款=合计金额-加载金额 + } + else{ + advanceIn = TotalPrice; //新增时,预付款=合计金额 + } + $.ajax({ + type:"post", + url: path + "/supplier/updateAdvanceIn.action", + dataType: "json", + data:{ + SupplierID: OrganId, + AdvanceIn: advanceIn + }, + success: function(res){ + if(res) { + //保存会员预收款成功 + } + }, + error: function(){ + $.messager.alert('提示','保存信息异常,请稍后再试!','error'); + return; + } + }); + } + + //保存单位信息 $.ajax({ type:"post", url: url, diff --git a/src/main/webapp/js/pages/materials/in_out.js b/src/main/webapp/js/pages/materials/in_out.js index b5c83727..102b2e79 100644 --- a/src/main/webapp/js/pages/materials/in_out.js +++ b/src/main/webapp/js/pages/materials/in_out.js @@ -734,6 +734,7 @@ //零售单据修改收款时,自动计算找零 if(listSubType == "零售" || listSubType == "零售退货") { + $("#payType").val("现付"); $("#OrganId").combobox("setValue", orgDefaultId); var getAmount = $("#depotHeadFM .get-amount"); var changeAmount = $("#depotHeadFM .change-amount"); @@ -857,6 +858,13 @@ ChangeAmount = 0 - ChangeAmount; TotalPrice = 0 - TotalPrice; } + //零售时候,可以从会员预付款中扣款 + var thisPayType = "现付"; + if(listSubType === "零售" || listSubType === "零售退货") { + if($("#payType").val() ==="预付款") { + thisPayType = "预付款"; + } + } $.ajax({ type:"post", url: url, @@ -874,6 +882,7 @@ AccountId: $.trim($("#AccountId").val()), ChangeAmount: ChangeAmount, //付款/收款 TotalPrice: TotalPrice, //合计 + PayType: thisPayType, //现付/预付款 Remark: $.trim($("#Remark").val()), clientIp: clientIp }), @@ -891,6 +900,29 @@ { getMaxId(); //查找最大的Id accept(depotHeadMaxId); //新增 + + if(thisPayType === "预付款") { + //更新用户信息-预付款 + $.ajax({ + type:"post", + url: path + "/supplier/updateAdvanceIn.action", + dataType: "json", + data:{ + SupplierID: OrganId, //会员id + AdvanceIn: 0 - ChangeAmount //保存的同时扣掉用户的预付款 + }, + success: function(res){ + if(res) { + //保存会员预收款成功 + } + }, + error: function(){ + $.messager.alert('提示','保存信息异常,请稍后再试!','error'); + return; + } + }); + } + closeDialog(); } else diff --git a/src/main/webapp/pages/manage/vendor.jsp b/src/main/webapp/pages/manage/vendor.jsp index 19ce4b33..948ad82b 100644 --- a/src/main/webapp/pages/manage/vendor.jsp +++ b/src/main/webapp/pages/manage/vendor.jsp @@ -203,6 +203,7 @@ { title: '联系人', field: 'contacts',width:50,align:"center"}, { title: '联系电话', field: 'phonenum',width:60,align:"center"}, { title: '电子邮箱',field: 'email',width:80,align:"center"}, + { title: '预付款',field: 'AdvanceIn',width:70,align:"center"}, { title: '期初应收',field: 'BeginNeedGet',width:70,align:"center"}, { title: '期初应付',field: 'BeginNeedPay',width:70,align:"center"}, { title: '类型',field: 'type',width:50}, diff --git a/src/main/webapp/pages/materials/retail_out_list.jsp b/src/main/webapp/pages/materials/retail_out_list.jsp index 41d4dd92..ff893db9 100644 --- a/src/main/webapp/pages/materials/retail_out_list.jsp +++ b/src/main/webapp/pages/materials/retail_out_list.jsp @@ -87,9 +87,16 @@ 单据备注: - + + 付款类型: + + +