diff --git a/src/main/java/com/jsh/action/basic/AccountAction.java b/src/main/java/com/jsh/action/basic/AccountAction.java index 768a04cd1..5437297f0 100644 --- a/src/main/java/com/jsh/action/basic/AccountAction.java +++ b/src/main/java/com/jsh/action/basic/AccountAction.java @@ -423,6 +423,7 @@ public class AccountAction extends BaseAction */ Map condition = new HashMap(); condition.put("AccountId_n_eq", id); + condition.put("PayType_s_neq", "预付款"); if(!monthTime.equals("")){ condition.put("OperTime_s_gteq", monthTime + "-01 00:00:00"); condition.put("OperTime_s_lteq", monthTime + "-31 00:00:00"); diff --git a/src/main/java/com/jsh/action/basic/SupplierAction.java b/src/main/java/com/jsh/action/basic/SupplierAction.java index 88ed7e6ce..a6d92e48a 100644 --- a/src/main/java/com/jsh/action/basic/SupplierAction.java +++ b/src/main/java/com/jsh/action/basic/SupplierAction.java @@ -421,6 +421,7 @@ public class SupplierAction extends BaseAction item.put("id", supplier.getId()); //客户名称 item.put("supplier", supplier.getSupplier()); + item.put("advanceIn", supplier.getAdvanceIn()); //预付款金额 dataArray.add(item); } } diff --git a/src/main/java/com/jsh/action/materials/DepotHeadAction.java b/src/main/java/com/jsh/action/materials/DepotHeadAction.java index 05e6bfd19..c8190d143 100644 --- a/src/main/java/com/jsh/action/materials/DepotHeadAction.java +++ b/src/main/java/com/jsh/action/materials/DepotHeadAction.java @@ -282,6 +282,7 @@ public class DepotHeadAction extends BaseAction item.put("AllocationProjectId", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getId()); item.put("AllocationProjectName", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getName()); item.put("TotalPrice", depotHead.getTotalPrice()==null?"":Math.abs(depotHead.getTotalPrice())); + item.put("payType", depotHead.getPayType()==null?"":depotHead.getPayType()); item.put("Remark", depotHead.getRemark()); item.put("op", 1); dataArray.add(item); diff --git a/src/main/webapp/js/pages/financial/financial_base.js b/src/main/webapp/js/pages/financial/financial_base.js index a1211d8e9..a77b601f3 100644 --- a/src/main/webapp/js/pages/financial/financial_base.js +++ b/src/main/webapp/js/pages/financial/financial_base.js @@ -17,6 +17,7 @@ var listTitle = ""; //单据标题 var payTypeTitle = "";//收入 支出 var organUrl = ""; //组织数据接口地址 + var amountNum = ""; //单据编号开头字符 var itemType = true; //隐藏当前列 var moneyType = true; //隐藏当前列 var inOrOut = ""; //链接类型为收入或者支出 @@ -45,6 +46,7 @@ payTypeTitle = "收入项目"; inOrOut = "in"; organUrl = cusUrl; + amountNum = "SR"; } else if(listTitle === "支出单列表"){ listType = "支出"; @@ -53,6 +55,7 @@ payTypeTitle = "支出项目"; inOrOut = "out"; organUrl = supUrl; + amountNum = "ZC"; } else if(listTitle === "收款单列表"){ listType = "收款"; @@ -61,6 +64,7 @@ payTypeTitle = "无标题"; inOrOut = ""; organUrl = cusUrl; + amountNum = "SK"; } else if(listTitle === "付款单列表"){ listType = "付款"; @@ -69,6 +73,7 @@ payTypeTitle = "无标题"; inOrOut = ""; organUrl = supUrl; + amountNum = "FK"; } else if(listTitle === "转账单列表"){ listType = "转账"; @@ -77,6 +82,7 @@ payTypeTitle = "无标题"; inOrOut = ""; organUrl = supUrl; + amountNum = "ZZ"; } else if(listTitle === "收预付款列表"){ listType = "收预付款"; @@ -85,6 +91,7 @@ payTypeTitle = "无标题"; inOrOut = ""; organUrl = retailUrl; + amountNum = "SYF"; } } //获取账户信息 @@ -599,10 +606,13 @@ function addAccountHead(){ $("#clientIp").val(clientIp); $('#accountHeadFM').form('clear'); + var thisDate = getNowFormatDate(); //当前日期 + $("#BillTime").val(thisDate); + var thisNumber = getNowFormatDateNum(); //根据时间生成编号 + $("#BillNo").val(amountNum + thisNumber).focus(); var addTitle = listTitle.replace("列表","信息"); $('#accountHeadDlg').dialog('open').dialog('setTitle',' 增加' + addTitle); $(".window-mask").css({ width: webW ,height: webH}); - $("#BillNo").val("").focus(); orgAccountHead = ""; accountHeadID = 0; diff --git a/src/main/webapp/js/pages/materials/in_out.js b/src/main/webapp/js/pages/materials/in_out.js index 102b2e79d..56911578c 100644 --- a/src/main/webapp/js/pages/materials/in_out.js +++ b/src/main/webapp/js/pages/materials/in_out.js @@ -12,7 +12,8 @@ var depotHeadMaxId=null; //获取最大的Id var accepId=null; //保存的主表id var url; - var depotHeadID = 0; + var depotHeadID = 0; + var preTotalPrice = 0; //前一次加载的金额 var orgDepotHead = ""; var editIndex = undefined; var listTitle = ""; //单据标题 @@ -58,7 +59,7 @@ } else if(listTitle === "零售退货列表"){ listType = "入库"; - listSubType = "零售退货"; + listSubType = "零售退货"; //注:用预付款购买的产品不能退货 payTypeTitle = "付款"; organUrl = retailUrl; amountNum = "LSTH"; @@ -219,6 +220,19 @@ orgDefaultId = data[i].id; } } + }, + onSelect: function(rec){ + if(listSubType === "零售"){ + var option = ""; + if(rec.supplier !== "非会员" && rec.advanceIn >0){ + option = ''; + option += ''; + } + else { + option += ''; + } + $("#payType").empty().append(option); + } } }); } @@ -337,6 +351,7 @@ pageList: initPageNum, columns:[[ { field: 'Id',width:35,align:"center",checkbox:true}, + {field: 'OrganId',width:5, hidden:true}, { title: '单据编号',field: 'Number',width:100}, { title: '单据日期 ',field: 'OperTime',width:100}, { title: '创建时间',field: 'CreateTime',width:100}, @@ -351,12 +366,13 @@ + 'AaBb' + rec.OperTime+ 'AaBb' + rec.OrganId+ 'AaBb' + rec.HandsPersonId + 'AaBb' + rec.AccountId+ 'AaBb' + rec.ChangeAmount+ 'AaBb' + rec.Remark + 'AaBb' + rec.ProjectName+ 'AaBb' + rec.OrganName+ 'AaBb' + rec.HandsPersonName - + 'AaBb' + rec.AccountName + 'AaBb' + rec.TotalPrice + 'AaBb' + rec.AllocationProjectId + 'AaBb' + rec.AllocationProjectName; + + 'AaBb' + rec.AccountName + 'AaBb' + rec.TotalPrice + 'AaBb' + rec.AllocationProjectId + + 'AaBb' + rec.AllocationProjectName + 'AaBb' + rec.payType; if(1 == value) { str += '查看'; str += '编辑'; - str += '删除'; + str += '删除'; } return str; } @@ -621,9 +637,9 @@ } } - //删除采购入库信息 - function deleteDepotHead(depotHeadID){ - $.messager.confirm('删除确认','确定要删除此采购入库信息吗?',function(r) + //删除单据信息 + function deleteDepotHead(depotHeadID, thisOrganId, totalPrice){ + $.messager.confirm('删除确认','确定要删除此单据信息吗?',function(r) { if (r) { @@ -644,20 +660,42 @@ $("#searchBtn").click(); } else - $.messager.alert('删除提示','删除采购入库信息失败,请稍后再试!','error'); + $.messager.alert('删除提示','删除单据信息失败,请稍后再试!','error'); }, //此处添加错误处理 error:function() { - $.messager.alert('删除提示','删除采购入库信息异常,请稍后再试!','error'); + $.messager.alert('删除提示','删除单据信息异常,请稍后再试!','error'); return; } - }); + }); + + //更新会员的预收款信息 + if(listSubType === "零售") { + $.ajax({ + type:"post", + url: path + "/supplier/updateAdvanceIn.action", + dataType: "json", + data:{ + SupplierID: thisOrganId, //会员id + AdvanceIn: totalPrice //删除时同时返还用户的预付款 + }, + success: function(res){ + if(res) { + //保存会员预收款成功 + } + }, + error: function(){ + $.messager.alert('提示','保存信息异常,请稍后再试!','error'); + return; + } + }); + } } }); } - //批量删除采购入库 + //批量删除单据信息 function batDeleteDepotHead(){ var row = $('#tableData').datagrid('getChecked'); if(row.length == 0) @@ -667,7 +705,7 @@ } if(row.length > 0) { - $.messager.confirm('删除确认','确定要删除选中的' + row.length + '条采购入库信息吗?',function(r) + $.messager.confirm('删除确认','确定要删除选中的' + row.length + '条单据信息吗?',function(r) { if (r) { @@ -682,6 +720,30 @@ //alert(row[i].id); ids += row[i].Id + ","; } + //批量更新会员的预收款信息 + for(var i = 0;i < row.length; i ++) { + if(listSubType === "零售") { + $.ajax({ + type:"post", + url: path + "/supplier/updateAdvanceIn.action", + dataType: "json", + data:{ + SupplierID: row[i].OrganId, //会员id + AdvanceIn: row[i].TotalPrice //删除时同时返还用户的预付款 + }, + success: function(res){ + if(res) { + //保存会员预收款成功 + } + }, + error: function(){ + $.messager.alert('提示','保存信息异常,请稍后再试!','error'); + return; + } + }); + } + } + //批量删除 $.ajax({ type:"post", url: path + "/depotHead/batchDelete.action", @@ -701,12 +763,12 @@ $(":checkbox").attr("checked",false); } else - $.messager.alert('删除提示','删除采购入库信息失败,请稍后再试!','error'); + $.messager.alert('删除提示','删除单据信息失败,请稍后再试!','error'); }, //此处添加错误处理 error:function() { - $.messager.alert('删除提示','删除采购入库信息异常,请稍后再试!','error'); + $.messager.alert('删除提示','删除单据信息异常,请稍后再试!','error'); return; } }); @@ -768,12 +830,25 @@ $("#ChangeAmount").attr("data-changeamount", depotHeadInfo[8]); $("#Remark").val(depotHeadInfo[9]); var TotalPrice = depotHeadInfo[14]; + preTotalPrice = depotHeadInfo[14]; //记录前一次合计金额,用于扣预付款 $("#AllocationProjectId").val(depotHeadInfo[15]); //orgDepotHead = depotHeadInfo[1]; var editTitle = listTitle.replace("列表","信息"); $('#depotHeadDlg').dialog('open').dialog('setTitle',' 编辑' + editTitle); $(".window-mask").css({ width: webW ,height: webH}); depotHeadID = depotHeadInfo[0]; + + if(listSubType === "零售" ){ + var option = ""; + if(depotHeadInfo[17] === "预付款"){ + option = ''; + option += ''; + } + else { + option += ''; + } + $("#payType").empty().append(option); + } initTableData_material("edit",TotalPrice); //商品列表 reject(); //撤销下、刷新商品列表 @@ -791,6 +866,7 @@ $("#AccountIdShow").text(depotHeadInfo[13]); $("#ChangeAmountShow").text(depotHeadInfo[8]); $("#RemarkShow").text(depotHeadInfo[9]); + $("#payTypeShow").text(depotHeadInfo[17]); var TotalPrice = depotHeadInfo[14]; $("#AllocationProjectIdShow").text(depotHeadInfo[16]); var showTitle = listTitle.replace("列表","信息"); @@ -860,7 +936,7 @@ } //零售时候,可以从会员预付款中扣款 var thisPayType = "现付"; - if(listSubType === "零售" || listSubType === "零售退货") { + if(listSubType === "零售") { if($("#payType").val() ==="预付款") { thisPayType = "预付款"; } @@ -895,34 +971,41 @@ var opts = $("#tableData").datagrid('options'); showDepotHeadDetails(opts.pageNumber,opts.pageSize); } + + if(thisPayType === "预付款") { + //更新用户信息-预付款 + var advanceIn = 0; //预付款金额 + if(depotHeadID){ + advanceIn = TotalPrice - preTotalPrice; //修改时,预付款=合计金额-加载金额 + } + else{ + advanceIn = TotalPrice; //新增时,预付款=合计金额 + } + $.ajax({ + type:"post", + url: path + "/supplier/updateAdvanceIn.action", + dataType: "json", + data:{ + SupplierID: OrganId, //会员id + AdvanceIn: 0 - advanceIn //保存的同时扣掉用户的预付款 + }, + success: function(res){ + if(res) { + //保存会员预收款成功 + } + }, + error: function(){ + $.messager.alert('提示','保存信息异常,请稍后再试!','error'); + return; + } + }); + } + //保存明细记录 if(depotHeadID ==0) { 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 948ad82b9..b018a0c36 100644 --- a/src/main/webapp/pages/manage/vendor.jsp +++ b/src/main/webapp/pages/manage/vendor.jsp @@ -123,10 +123,6 @@ -
- - -
@@ -207,13 +203,10 @@ { title: '期初应收',field: 'BeginNeedGet',width:70,align:"center"}, { title: '期初应付',field: 'BeginNeedPay',width:70,align:"center"}, { title: '类型',field: 'type',width:50}, - { title: '启动',field: 'enabled',width:40,formatter:function(value){ - return value? "开":"关"; - }}, { 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.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; if(1 == value) { str += ' 编辑  '; @@ -480,7 +473,6 @@ BeginNeedPay : supplierInfo[6], description : supplierInfo[8], type : supplierInfo[9], - enabled : supplierInfo[10], clientIp:'<%=clientIp %>' }; orgSupplier = supplierInfo[1]; diff --git a/src/main/webapp/pages/materials/retail_out_list.jsp b/src/main/webapp/pages/materials/retail_out_list.jsp index ff893db92..796ce06a7 100644 --- a/src/main/webapp/pages/materials/retail_out_list.jsp +++ b/src/main/webapp/pages/materials/retail_out_list.jsp @@ -94,7 +94,6 @@ @@ -175,9 +174,13 @@ 单据备注: - + + 付款类型: + + +