From 0c917016d37234afe3f11097f713ec80441a9cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Wed, 30 Aug 2017 00:12:14 +0800 Subject: [PATCH] no commit message --- src/main/webapp/css/common.css | 26 - src/main/webapp/css/in_out.css | 107 + src/main/webapp/css/material.css | 11 + .../webapp/js/HoorayOS_mini/js/templates.js | 2 +- src/main/webapp/js/common/common.js | 60 +- src/main/webapp/js/easyui-1.3.5/outlook.js | 6 +- .../webapp/js/easyui-1.3.5/themes/icon.css | 8 +- .../js/easyui-1.3.5/themes/icons/filelist.jpg | Bin 0 -> 1421 bytes .../js/pages/financial/financial_base.js | 41 +- src/main/webapp/js/pages/manage/pushBtn.json | 22 + src/main/webapp/js/pages/manage/supplier.js | 746 +++++++ src/main/webapp/js/pages/materials/in_out.js | 1756 ++++++++++++++--- src/main/webapp/pages/common/menu.jsp | 110 +- src/main/webapp/pages/manage/customer.jsp | 185 ++ src/main/webapp/pages/manage/depot.jsp | 270 ++- src/main/webapp/pages/manage/functions.jsp | 106 +- src/main/webapp/pages/manage/member.jsp | 185 ++ src/main/webapp/pages/manage/role.jsp | 15 +- src/main/webapp/pages/manage/roleApp.jsp | 4 +- .../webapp/pages/manage/roleFunctions.jsp | 11 +- src/main/webapp/pages/manage/rolePushBtn.jsp | 264 +++ src/main/webapp/pages/manage/unit.jsp | 468 +++++ src/main/webapp/pages/manage/user.jsp | 65 +- src/main/webapp/pages/manage/vendor.jsp | 715 ++----- .../pages/materials/allocation_out_list.jsp | 150 +- .../webapp/pages/materials/gift_out_list.jsp | 1 + .../pages/materials/gift_recharge_list.jsp | 1 + src/main/webapp/pages/materials/material.jsp | 1310 +++++++++--- .../pages/materials/materialcategory.jsp | 11 +- .../webapp/pages/materials/other_in_list.jsp | 160 +- .../webapp/pages/materials/other_out_list.jsp | 151 +- src/main/webapp/pages/materials/person.jsp | 2 + .../pages/materials/purchase_back_list.jsp | 393 +++- .../pages/materials/purchase_in_list.jsp | 385 +++- .../pages/materials/retail_back_list.jsp | 278 ++- .../pages/materials/retail_out_list.jsp | 225 +-- .../webapp/pages/materials/sale_back_list.jsp | 298 ++- .../webapp/pages/materials/sale_out_list.jsp | 298 ++- .../pages/reports/in_out_stock_report.jsp | 5 +- src/main/webapp/pages/user/userCustomer.jsp | 136 ++ 40 files changed, 6538 insertions(+), 2449 deletions(-) create mode 100644 src/main/webapp/css/in_out.css create mode 100644 src/main/webapp/css/material.css create mode 100644 src/main/webapp/js/easyui-1.3.5/themes/icons/filelist.jpg create mode 100644 src/main/webapp/js/pages/manage/pushBtn.json create mode 100644 src/main/webapp/js/pages/manage/supplier.js create mode 100644 src/main/webapp/pages/manage/customer.jsp create mode 100644 src/main/webapp/pages/manage/member.jsp create mode 100644 src/main/webapp/pages/manage/rolePushBtn.jsp create mode 100644 src/main/webapp/pages/manage/unit.jsp create mode 100644 src/main/webapp/pages/user/userCustomer.jsp diff --git a/src/main/webapp/css/common.css b/src/main/webapp/css/common.css index edee442a..09b46b20 100644 --- a/src/main/webapp/css/common.css +++ b/src/main/webapp/css/common.css @@ -11,7 +11,6 @@ #tablePanel .action-show { background: url('../js/easyui-1.3.5/themes/icons/list.png') no-repeat left center; - padding: 0 8px 0 20px; } #tablePanel .action-edit { @@ -24,28 +23,3 @@ padding-left: 20px; } -#depotHeadFM .price-list { - width:110px; - float:left; - position:absolute; - border:1px solid #95B8E7; -} - -#depotHeadFM .price-list ul{ - padding: 0px; - margin: 0px; - background-color: #fff; -} - -#depotHeadFM .price-list ul li{ - list-style: none; - padding: 3px; -} - -#depotHeadFM .price-list ul li:hover{ - background-color: #e9f1fc; -} - - - - diff --git a/src/main/webapp/css/in_out.css b/src/main/webapp/css/in_out.css new file mode 100644 index 00000000..13d2dd06 --- /dev/null +++ b/src/main/webapp/css/in_out.css @@ -0,0 +1,107 @@ +/*价格*/ +#depotHeadFM .price-list { + width:110px; + float:left; + position:absolute; + border:1px solid #95B8E7; +} + +#depotHeadFM .price-list ul{ + padding: 0px; + margin: 0px; + background-color: #fff; +} + +#depotHeadFM .price-list ul li{ + list-style: none; + padding: 3px; +} + +#depotHeadFM .price-list ul li:hover{ + background-color: #e9f1fc; +} + +/*零售*/ +#depotHeadFM .retail-amount tr td{ + padding: 5px; +} + +#depotHeadFM .retail-amount tr td input{ + width: 225px; + height: 30px; + line-height: 30px; + font-size: 24px; + border-color: #878787; + border-style: solid; + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 1px; + border-left-width: 0px +} + +#depotHeadFM .retail-amount .change-amount{ + color:purple; +} + +#depotHeadFM .retail-amount .get-amount{ + color:red; +} + +#depotHeadFM .retail-amount .back-amount{ + color: green; + text-align: right; +} + +#depotHeadDlgShow .retail-amount-show tr td{ + padding: 5px; +} + +#depotHeadDlgShow .retail-amount-show .change-amount-show{ + color:purple; + font-size: 24px; +} + +#depotHeadDlgShow .retail-amount-show .get-amount-show{ + color:red; + font-size: 24px; +} + +#depotHeadDlgShow .retail-amount-show .back-amount-show{ + color: green; + text-align: right; + font-size: 24px; +} + +/*计量单位*/ +#depotHeadFM .unit-list { + width:68px; + float:left; + position:absolute; + border:1px solid #95B8E7; +} + +#depotHeadFM .unit-list ul{ + padding: 0px; + margin: 0px; + background-color: #fff; +} + +#depotHeadFM .unit-list ul li{ + list-style: none; + padding: 3px; +} + +#depotHeadFM .unit-list ul li:hover{ + background-color: #e9f1fc; +} + +#depotHeadDlg .org-list{ + float: left; + width:135px; +} + +#depotHeadDlg .add-org-btn{ + float: left; + width:30px; + padding: 2px; +} \ No newline at end of file diff --git a/src/main/webapp/css/material.css b/src/main/webapp/css/material.css new file mode 100644 index 00000000..e6399c5e --- /dev/null +++ b/src/main/webapp/css/material.css @@ -0,0 +1,11 @@ +.first-select-unit{ + display: none; +} + +.price-list { + display: none; +} + +.price-list input{ + width: 120px; +} diff --git a/src/main/webapp/js/HoorayOS_mini/js/templates.js b/src/main/webapp/js/HoorayOS_mini/js/templates.js index 8ee4f03d..84722030 100644 --- a/src/main/webapp/js/HoorayOS_mini/js/templates.js +++ b/src/main/webapp/js/HoorayOS_mini/js/templates.js @@ -38,7 +38,7 @@ var windowTemp = template( 'style="display:none"<% } %>>'+ '<% } %>'+ '<% if(istitlebarFullscreen){ %>'+ - '+'+ + ''+ '<% } %>'+ '×'+ ''+ diff --git a/src/main/webapp/js/common/common.js b/src/main/webapp/js/common/common.js index 3e32f56f..3734959d 100644 --- a/src/main/webapp/js/common/common.js +++ b/src/main/webapp/js/common/common.js @@ -84,6 +84,29 @@ function getUrlParam(name) { if (r != null) return unescape(r[2]); return null; //返回参数值 } +/** + * 获取按钮的权限 + */ +function getBtnStr() { + var funId = window.parent.window.funId; //功能id + var btnStrList = window.parent.window.winBtnStrList; //按钮功能列表 JSON字符串 + var btnEnableList =""; //按钮列表 + if(funId && btnStrList) { + btnStrList = JSON.parse(btnStrList); + for(var i=0; i= 1 && month <= 9) { month = "0" + month; } if (strDate >= 0 && strDate <= 9) { strDate = "0" + strDate; } + if (strHours >= 0 && strHours <= 9) { + strHours = "0" + strHours; + } + if (strMinutes >= 0 && strMinutes <= 9) { + strMinutes = "0" + strMinutes; + } + if (strSeconds >= 0 && strSeconds <= 9) { + strSeconds = "0" + strSeconds; + } var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate - + " " + date.getHours() + seperator2 + date.getMinutes() - + seperator2 + date.getSeconds(); + + " " + strHours + seperator2 + strMinutes + + seperator2 + strSeconds; return currentdate; } @@ -138,6 +173,23 @@ function getNowFormatDate() { return currentdate; } +/** + * js获取当前时间, 格式“yyyyMMdd” + */ +function getNowFormatDateTwo() { + var date = new Date(); + var month = date.getMonth() + 1; + var strDate = date.getDate(); + if (month >= 1 && month <= 9) { + month = "0" + month; + } + if (strDate >= 0 && strDate <= 9) { + strDate = "0" + strDate; + } + var currentdate = date.getFullYear() + month + strDate; + return currentdate; +} + /** * js根据时间生成编号, 格式“yyyyMMddHHMMSS” */ @@ -156,4 +208,8 @@ function getNowFormatDateNum() { var currentdate = date.getFullYear() + month + strDate + date.getHours() + date.getMinutes() + date.getSeconds(); return currentdate; +} + +function encode(name){ + return encodeURI(encodeURI(name)); } \ No newline at end of file diff --git a/src/main/webapp/js/easyui-1.3.5/outlook.js b/src/main/webapp/js/easyui-1.3.5/outlook.js index cb0e8d69..5b6dd7bf 100644 --- a/src/main/webapp/js/easyui-1.3.5/outlook.js +++ b/src/main/webapp/js/easyui-1.3.5/outlook.js @@ -171,9 +171,9 @@ function tabCloseEven() { return false; }); - //退出 - $("#mm-exit").click(function () { - $('#mm').menu('hide'); + //显示版权信息 + $("#mm-version").click(function () { + window.open("https://gitee.com/jishenghua/JSH_ERP"); }) } diff --git a/src/main/webapp/js/easyui-1.3.5/themes/icon.css b/src/main/webapp/js/easyui-1.3.5/themes/icon.css index 1a2a5956..6bd4668b 100644 --- a/src/main/webapp/js/easyui-1.3.5/themes/icon.css +++ b/src/main/webapp/js/easyui-1.3.5/themes/icon.css @@ -55,8 +55,6 @@ .icon-filter{ background:url('icons/filter.png') no-repeat center center; } - - .icon-mini-add{ background:url('icons/mini_add.png') no-repeat center center; } @@ -92,4 +90,10 @@ } .icon-excel{ background:url('icons/receipt-excel.png') no-repeat center center; +} +.icon-excel-new{ + background:url('icons/excel1.png') no-repeat center center; +} +.icon-page-excel{ + background:url('icons/page_excel.png') no-repeat center center; } \ No newline at end of file diff --git a/src/main/webapp/js/easyui-1.3.5/themes/icons/filelist.jpg b/src/main/webapp/js/easyui-1.3.5/themes/icons/filelist.jpg new file mode 100644 index 0000000000000000000000000000000000000000..08ce7b43f830ca2e3280b0ed2e0cd3a53f5d57ea GIT binary patch literal 1421 zcma)5Z%i9y7=N#KZRsCaZ!HrB#@i9+KicbE+q?Fp5a`i?3kqE~mS|i`?*=z^cjfMo zg2)G_0l%nA2$_p9Gch{Jq8S=LY>Ar*e$!x*8z~b30L;$dWIzkS@WfM zrAzRo6^Y2EG6d=K6QHgkn@Od61s&@Wx$woFXu5nF~-Vc*cR z$@EZfI>O@(^;lh&%}Nm_zMjiCMe+5f1_lOv z0|B3+b`xYI63NG)D6iq+)dpofmG#P6O)&x|XlYf<=%ONH`G~15rC*QYMy3C>AZ6Ox zHUi&wT9TCStKhBa31PF0`+951!Hhs81WoBz(}Lk%Qv@5cdvKz>qfrgZDd~Pmko8tB ziW?RmFY;`V3)2h}4>EKtK$6W&Q`{enGjt$ChvQ5W87pF2Wlc}XX`zS}H?e^SV%eA~ zq;y41D$3E~_S$Mo*W1XVRD+5}7u7R2Q&+veI< z=5)I~9=E%?s;a8`kqv>YR%@xVw8G`8*jbL2@7%cfze?^RKudrJcwh(xCKQ5EC^rp` z0RThL=1T{_Y_Y;65HP|2vI5wIm?0Mc2y8~or9}XQnqaWK+>Ln5mR&on6)R*%%|nf; zzOz)%# z@>F8a=Lp^CI5~FWd-o^&?Q>tS%X=q=`zLE3rA~hLQ_a;Y$lj^lm6zRPm0!=zPuH%! zej2zw9DniGrNuM#k6-y?wSM-gr-zRZ+5*hwGxV%|&NgmpX}J^2PVJw5b8@u3d*aBu z=SlbRwIi#$N5*DGhx?je`TbBicjqo~@A`@5{a>zB9lXcB^YE*+fBkT7je5EMv#~{u z3%PyAZY59OeZo5T<6AS&hr5Sv%qJV>M;w1XS32|CEp~MAy}$=&JC{a;Mds&v{6g;P E-}fr1ApigX literal 0 HcmV?d00001 diff --git a/src/main/webapp/js/pages/financial/financial_base.js b/src/main/webapp/js/pages/financial/financial_base.js index 32d93bf4..b37af4a9 100644 --- a/src/main/webapp/js/pages/financial/financial_base.js +++ b/src/main/webapp/js/pages/financial/financial_base.js @@ -221,28 +221,27 @@ pageSize: 5, pageList: initPageNum, columns:[[ - { field: 'Id',width:35,align:"center",checkbox:true}, - {field: 'OrganId',width:5, hidden:true}, - { title: '单据编号',field: 'BillNo',width:140}, - { title: '单据时间 ',field: 'BillTime',width:100}, - { title: '合计',field: 'TotalPrice',width:80}, - { title: '备注',field: 'Remark',width:100}, - { title: '操作',field: 'op',align:"center",width:180,formatter:function(value,rec) - { - var str = ''; - var rowInfo = rec.Id + 'AaBb' + rec.BillNo+ 'AaBb' + rec.BillTime+ 'AaBb' + rec.Remark - + 'AaBb' + rec.AccountId+ 'AaBb' + rec.AccountName + 'AaBb' + rec.OrganId + 'AaBb' + rec.OrganName - + 'AaBb' + rec.HandsPersonId + 'AaBb' + rec.HandsPersonName + 'AaBb' + rec.ChangeAmount + 'AaBb' + rec.TotalPrice; - if(1 == value) - { - var orgId = rec.OrganId ? rec.OrganId : 0; - str += '查看'; - str += '编辑'; - str += '删除'; + { field: 'Id',width:35,align:"center",checkbox:true}, + { title: '操作',field: 'op',align:"center",width:90,formatter:function(value,rec) { + var str = ''; + var rowInfo = rec.Id + 'AaBb' + rec.BillNo+ 'AaBb' + rec.BillTime+ 'AaBb' + rec.Remark + + 'AaBb' + rec.AccountId+ 'AaBb' + rec.AccountName + 'AaBb' + rec.OrganId + 'AaBb' + rec.OrganName + + 'AaBb' + rec.HandsPersonId + 'AaBb' + rec.HandsPersonName + 'AaBb' + rec.ChangeAmount + 'AaBb' + rec.TotalPrice; + if(1 == value) + { + var orgId = rec.OrganId ? rec.OrganId : 0; + str += '   '; + str += '   '; + str += ''; + } + return str; } - return str; - } - } + }, + { field: 'OrganId',width:5, hidden:true}, + { title: '单据编号',field: 'BillNo',width:140}, + { title: '单据时间 ',field: 'BillTime',width:100}, + { title: '合计',field: 'TotalPrice',width:80}, + { title: '备注',field: 'Remark',width:100} ]], toolbar:[ { diff --git a/src/main/webapp/js/pages/manage/pushBtn.json b/src/main/webapp/js/pages/manage/pushBtn.json new file mode 100644 index 00000000..881d1bbd --- /dev/null +++ b/src/main/webapp/js/pages/manage/pushBtn.json @@ -0,0 +1,22 @@ +[ + { + "id": 1, + "text": "导入导出" + }, + { + "id": 2, + "text": "启用禁用" + }, + { + "id": 3, + "text": "审核反审核" + }, + { + "id": 4, + "text": "打印" + }, + { + "id": 5, + "text": "作废" + } +] \ No newline at end of file diff --git a/src/main/webapp/js/pages/manage/supplier.js b/src/main/webapp/js/pages/manage/supplier.js new file mode 100644 index 00000000..cd233076 --- /dev/null +++ b/src/main/webapp/js/pages/manage/supplier.js @@ -0,0 +1,746 @@ + //初始化界面 + $(function() { + var listTitle = ""; //单据标题 + var listType = ""; //类型 + var listTypeEn = ""; //英文类型 + getType(); + getPersonList(); //获取业务员 + initTableData(); + ininPager(); + bindEvent(); + }); + + //根据名称获取类型 + function getType(){ + listTitle = $("#tablePanel").prev().text(); + if(listTitle === "供应商信息列表"){ + listType = "供应商"; + listTypeEn = "Vendor"; + } + else if(listTitle === "客户信息列表"){ + listType = "客户"; + listTypeEn = "Customer"; + } + else if(listTitle === "会员信息列表"){ + listType = "会员"; + listTypeEn = "Member"; + } + } + + //获取业务员 + function getPersonList(){ + $.ajax({ + type:"post", + url: path + "/person/getBasicData.action", + dataType: "json", + success: function (systemInfo) + { + var msgTip = systemInfo.showModel.msgTip; + if(msgTip !== "exceptoin"){ + var personList = systemInfo.showModel.map.personList; + var personID,options; + if(personList !=null) + { + for(var i = 0 ;i < personList.length;i++) + { + var person = personList[i]; + if(0 == i) + { + personID = person.id; + } + if(person.type=="仓管员") + { + options += ''; + } + } + $("#personId").empty().append('').append(options); + } + } + else { + $.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error'); + return; + } + } + }); + } + + //初始化表格数据 + function initTableData() { + //改变宽度和高度 + $("#searchPanel").panel({width:webW-2}); + $("#tablePanel").panel({width:webW-2}); + $('#tableData').datagrid({ + //title:'单位列表', + //iconCls:'icon-save', + //width:700, + height:heightInfo, + nowrap: false, + rownumbers: false, + //动画效果 + animate:false, + //选中单行 + singleSelect : true, + collapsible:false, + selectOnCheck:false, + //fitColumns:true, + //单击行是否选中 + checkOnSelect : false, + //交替出现背景 + striped : true, + pagination: true, + //自动截取数据 + //nowrap : true, + //loadFilter: pagerFilter, + pageSize: initPageSize, + pageList: initPageNum, + columns:[[ + { field: 'id',width:35,align:"center",checkbox:true}, + { title: '操作',field: 'op',align:"center",width:60,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.fax + 'AaBb' + rec.telephone + 'AaBb' + rec.address + 'AaBb' + rec.taxNum + 'AaBb' + rec.bankName + 'AaBb' + rec.accountNumber + 'AaBb' + rec.taxRate; + if(1 == value) + { + str += '   '; + str += ''; + } + return str; + } + }, + { title: '名称',field: 'supplier',width:150}, + { title: '联系人', field: 'contacts',width:50,align:"center"}, + { title: '手机号码', field: 'telephone',width:100,align:"center"}, + { title: '电子邮箱',field: 'email',width:80,align:"center"}, + { title: '联系电话', field: 'phonenum',width:100,align:"center"}, + { title: '传真', field: 'fax',width:100,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: 'taxRate',width:50,align:"center"}, + { title: '状态',field: 'enabled',width:70,align:"center",formatter:function(value){ + return value? "启用":"禁用"; + }} + ]], + toolbar:[ + { + id:'addSupplier', + text:'增加', + iconCls:'icon-add', + handler:function() { + addSuppler(); + } + },'-', + { + id:'deleteSupplier', + text:'删除', + iconCls:'icon-remove', + handler:function() { + batDeleteSupplier(); + } + },'-', + { + id:'setEnable', + text:'启用', + iconCls:'icon-ok', + handler:function() { + setEnableFun(); + } + },'-', + { + id:'setDisEnable', + text:'禁用', + iconCls:'icon-no', + handler:function() { + setDisEnableFun(); + } + },'-', + { + id:'setInput', + text:'导入', + iconCls:'icon-excel', + handler:function() { + setInputFun(); + } + },'-', + { + id:'setOutput', + text:'导出', + iconCls:'icon-excel', + handler:function() { + setOutputFun(); + } + } + ], + onLoadError:function() + { + $.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error'); + return; + } + }); + } + + + //分页信息处理 + function ininPager() { + try + { + var opts = $("#tableData").datagrid('options'); + var pager = $("#tableData").datagrid('getPager'); + pager.pagination({ + onSelectPage:function(pageNum, pageSize) + { + opts.pageNumber = pageNum; + opts.pageSize = pageSize; + pager.pagination('refresh', + { + pageNumber:pageNum, + pageSize:pageSize + }); + showSupplierDetails(pageNum,pageSize); + } + }); + } + catch (e) + { + $.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error'); + } + } + + //删除信息 + function deleteSupplier(supplierInfo) { + $.messager.confirm('删除确认','确定要删除此条信息吗?',function(r) + { + if (r) + { + var supplierTotalInfo = supplierInfo.split("AaBb"); + $.ajax({ + type:"post", + url: path + "/supplier/delete.action", + dataType: "json", + data: ({ + supplierID : supplierTotalInfo[0], + supplier:supplierTotalInfo[1], + clientIp: clientIp + }), + success: function (tipInfo) + { + var msg = tipInfo.showModel.msgTip; + if(msg == '成功') + //加载完以后重新初始化 + $("#searchBtn").click(); + else + $.messager.alert('删除提示','删除信息失败,请稍后再试!','error'); + }, + //此处添加错误处理 + error:function() + { + $.messager.alert('删除提示','删除信息异常,请稍后再试!','error'); + return; + } + }); + } + }); + } + + //批量删除单位 + function batDeleteSupplier() { + var row = $('#tableData').datagrid('getChecked'); + if(row.length == 0) + { + $.messager.alert('删除提示','没有记录被选中!','info'); + return; + } + if(row.length > 0) + { + $.messager.confirm('删除确认','确定要删除选中的' + row.length + '条信息吗?',function(r) + { + if (r) + { + var ids = ""; + for(var i = 0;i < row.length; i ++) + { + if(i == row.length-1) + { + ids += row[i].id; + break; + } + ids += row[i].id + ","; + } + $.ajax({ + type:"post", + url: path + "/supplier/batchDelete.action", + dataType: "json", + async : false, + data: ({ + supplierIDs : ids, + clientIp: clientIp + }), + success: function (tipInfo) + { + var msg = tipInfo.showModel.msgTip; + if(msg == '成功') + { + //加载完以后重新初始化 + $("#searchBtn").click(); + $(":checkbox").attr("checked",false); + } + else + $.messager.alert('删除提示','删除信息失败,请稍后再试!','error'); + }, + //此处添加错误处理 + error:function() + { + $.messager.alert('删除提示','删除信息异常,请稍后再试!','error'); + return; + } + }); + } + }); + } + } + + //批量启用 + function setEnableFun() { + var row = $('#tableData').datagrid('getChecked'); + if(row.length == 0) + { + $.messager.alert('启用提示','没有记录被选中!','info'); + return; + } + if(row.length > 0) + { + $.messager.confirm('启用确认','确定要启用选中的' + row.length + '条信息吗?',function(r) + { + if (r) + { + var ids = ""; + for(var i = 0;i < row.length; i ++) + { + if(i == row.length-1) + { + ids += row[i].id; + break; + } + ids += row[i].id + ","; + } + $.ajax({ + type:"post", + url: path + "/supplier/batchSetEnable.action", + dataType: "json", + async : false, + data: ({ + enabled: true, + supplierIDs : ids, + clientIp: clientIp + }), + success: function (tipInfo) + { + var msg = tipInfo.showModel.msgTip; + if(msg == '成功') + { + //加载完以后重新初始化 + $("#searchBtn").click(); + $(":checkbox").attr("checked",false); + } + else + $.messager.alert('启用提示','启用信息失败,请稍后再试!','error'); + }, + //此处添加错误处理 + error:function() + { + $.messager.alert('启用提示','启用信息异常,请稍后再试!','error'); + return; + } + }); + } + }); + } + } + + //批量禁用 + function setDisEnableFun() { + var row = $('#tableData').datagrid('getChecked'); + if(row.length == 0) + { + $.messager.alert('禁用提示','没有记录被选中!','info'); + return; + } + if(row.length > 0) + { + $.messager.confirm('禁用确认','确定要禁用选中的' + row.length + '条信息吗?',function(r) + { + if (r) + { + var ids = ""; + for(var i = 0;i < row.length; i ++) + { + if(i == row.length-1) + { + ids += row[i].id; + break; + } + ids += row[i].id + ","; + } + $.ajax({ + type:"post", + url: path + "/supplier/batchSetEnable.action", + dataType: "json", + async : false, + data: ({ + enabled: false, + supplierIDs : ids, + clientIp: clientIp + }), + success: function (tipInfo) + { + var msg = tipInfo.showModel.msgTip; + if(msg == '成功') + { + //加载完以后重新初始化 + $("#searchBtn").click(); + $(":checkbox").attr("checked",false); + } + else + $.messager.alert('禁用提示','禁用信息失败,请稍后再试!','error'); + }, + //此处添加错误处理 + error:function() + { + $.messager.alert('禁用提示','禁用信息异常,请稍后再试!','error'); + return; + } + }); + } + }); + } + } + + //导入数据 + function setInputFun(){ + //IE下不允许编辑 input=file的值 解决思路:重新克隆input=file,把这个input元素复制一个,然后将原来的删除。 + //在IE下复制元素的时候,其中的值是不会被复制的,所以就达到了清空文件域的目的了。 + //而在Firefox下,其中的值也会被一同复制,清空一下就做到兼容 + var fileUploadInput = $("#supplierFile"); + fileUploadInput.after(fileUploadInput.clone().val("")); + fileUploadInput.remove(); + $("#isCheck").val(1); + $('#importExcelDlg').dialog('open').dialog('setTitle','导入' + listType + '信息'); + $(".window-mask").css({ width: webW-20 ,height: webH}); + $("#supplierFile").focus(); + } + + //导出数据 + function setOutputFun(){ + window.location.href = path + "/supplier/exportExcel.action?browserType=" + getOs() + "&type=" + listTypeEn; + } + + //增加单位 + var url; + var supplierID = 0; + //保存编辑前的名称 + var orgSupplier = ""; + + function addSuppler() { + $('#supplierDlg').dialog('open').dialog('setTitle',' 增加'+listType+"信息"); + $(".window-mask").css({ width: webW ,height: webH}); + $("#supplier").focus(); + $('#supplierFM').form('clear'); + orgSupplier = ""; + supplierID = 0; + url = path + '/supplier/create.action'; + } + + function bindEvent(){ + //导入excel对话框 + $('#importExcelDlg').dialog({ + width: 400, + closed: true, + cache: false, + modal: true, + collapsible:false, + closable: true, + buttons:'#dlg-buttons5' + }); + //导入excel表格 + $("#saveimport").unbind().bind({ + click:function() + { + if($("#supplierFile").val().length == 0) + { + $.messager.alert('提示','请选择文件!','info'); + return; + } + $("#importExcelFM").submit(); + $('#importExcelDlg').dialog('close'); + + $.messager.progress({ + title:'请稍候', + msg:'数据处理ing...' + }); + setTimeout(function(){ + $.messager.progress('close'); + var opts = $("#tableData").datagrid('options'); + showSupplierDetails(opts.pageNumber,opts.pageSize); + },3300); + } + }); + //保存信息 + $("#saveSupplier").off("click").on("click",function() { + if(!$('#supplierFM').form('validate')){ + return; + } + else if(checkSupplierName()){ + return; + } + var reg = /^([0-9])+$/; + var phonenum = $.trim($("#phonenum").val()); + if(phonenum.length>0 && !reg.test(phonenum)) { + $.messager.alert('提示','电话号码只能是数字','info'); + $("#phonenum").val("").focus(); + return; + } + var beginNeedGet = $.trim($("#BeginNeedGet").val()); + var beginNeedPay = $.trim($("#BeginNeedPay").val()); + if(beginNeedGet && beginNeedPay) { + $.messager.alert('提示','期初应收和期初应付不能同时输入','info'); + return; + } + + $.ajax({ + url: url, + type:"post", + dataType: "json", + data:{ + supplier:$("#supplier").val(), + type: listType, + contacts:$("#contacts").val(), + phonenum:$("#phonenum").val(), + telephone:$("#telephone").val(), + email:$("#email").val(), + address:$("#address").val(), + fax:$("#fax").val(), + BeginNeedGet:$("#BeginNeedGet").val(), + BeginNeedPay:$("#BeginNeedPay").val(), + taxNum:$("#taxNum").val(), + taxRate:$("#taxRate").val(), + bankName:$("#bankName").val(), + accountNumber:$("#accountNumber").val(), + description:$("#description").val(), + enabled:1, + clientIp: clientIp + }, + success: function(res) { + if (res) { + $('#supplierDlg').dialog('close'); + var opts = $("#tableData").datagrid('options'); + showSupplierDetails(opts.pageNumber,opts.pageSize); + } + } + }); + }); + + //初始化键盘enter事件 + $(document).keydown(function(event) { + //兼容 IE和firefox 事件 + var e = window.event || event; + var k = e.keyCode||e.which||e.charCode; + //兼容 IE,firefox 兼容 + var obj = e.srcElement ? e.srcElement : e.target; + //绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 + if(k == "13"&&(obj.id=="supplier" || obj.id=="contacts"|| obj.id=="phonenum" + || obj.id=="email" || obj.id=="description" )) + { + $("#saveSupplier").click(); + } + + //搜索按钮添加快捷键 + if(k == "13"&&(obj.id=="searchSupplier" || obj.id=="searchContacts"|| obj.id=="searchPhonenum" + || obj.id=="searchEmail" || obj.id=="searchDesc" )) + { + $("#searchBtn").click(); + } + }); + + //搜索处理 + $("#searchBtn").unbind().bind({ + click:function() + { + showSupplierDetails(1,initPageSize); + var opts = $("#tableData").datagrid('options'); + var pager = $("#tableData").datagrid('getPager'); + opts.pageNumber = 1; + opts.pageSize = initPageSize; + pager.pagination('refresh', + { + pageNumber:1, + pageSize:initPageSize + }); + } + }); + + $("#searchBtn").click(); + + //重置按钮 + $("#searchResetBtn").unbind().bind({ + click:function(){ + $("#searchSupplier").val(""); + $("#searchType").val(""); + $("#searchPhonenum").val(""); + $("#searchTelephone").val(""); + $("#searchDesc").val(""); + + //加载完以后重新初始化 + $("#searchBtn").click(); + } + }); + + } + + + //编辑信息 + function editSupplier(supplierTotalInfo) { + var supplierInfo = supplierTotalInfo.split("AaBb"); + var row = { + supplier : supplierInfo[1], + contacts : supplierInfo[2].replace("undefined",""), + phonenum : supplierInfo[3].replace("undefined",""), + email : supplierInfo[4].replace("undefined",""), + BeginNeedGet : supplierInfo[5], + BeginNeedPay : supplierInfo[6], + description : supplierInfo[8].replace("undefined",""), + type : supplierInfo[9], + fax : supplierInfo[10].replace("undefined",""), + telephone : supplierInfo[11].replace("undefined",""), + address : supplierInfo[12].replace("undefined",""), + taxNum : supplierInfo[13].replace("undefined",""), + bankName : supplierInfo[14].replace("undefined",""), + accountNumber : supplierInfo[15].replace("undefined",""), + taxRate : supplierInfo[16].replace("undefined",""), + clientIp: clientIp + }; + orgSupplier = supplierInfo[1]; + $('#supplierDlg').dialog('open').dialog('setTitle',' 编辑'+listType +"信息"); + $(".window-mask").css({ width: webW ,height: webH}); + $('#supplierFM').form('load',row); + supplierID = supplierInfo[0]; + //焦点在名称输入框==定焦在输入文字后面 + $("#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; + } + }) + } + + + //检查单位名称是否存在 ++ 重名无法提示问题需要跟进 + function checkSupplierName() { + var supplierName = $.trim($("#supplier").val()); + //表示是否存在 true == 存在 false = 不存在 + var flag = false; + //开始ajax名称检验,不能重名 + if(supplierName.length > 0 &&( orgSupplier.length ==0 || supplierName != orgSupplier)) + { + $.ajax({ + type:"post", + url: path + "/supplier/checkIsNameExist.action", + dataType: "json", + async : false, + data: ({ + supplierID : supplierID, + supplier : supplierName + }), + success: function (tipInfo) + { + flag = tipInfo; + if(tipInfo) + { + $.messager.alert('提示','单位名称已经存在','info'); + return; + } + }, + //此处添加错误处理 + error:function() + { + $.messager.alert('提示','检查单位名称是否存在异常,请稍后再试!','error'); + return; + } + }); + } + return flag; + } + + + function showSupplierDetails(pageNo,pageSize) { + $.ajax({ + type:"post", + url: path + "/supplier/findBy.action", + dataType: "json", + data: ({ + supplier:$.trim($("#searchSupplier").val()), + type: listType, + phonenum:$.trim($("#searchPhonenum").val()), + telephone:$.trim($("#searchTelephone").val()), + description:$.trim($("#searchDesc").val()), + pageNo:pageNo, + pageSize:pageSize + }), + success: function (data) + { + $("#tableData").datagrid('loadData',data); + //$('#tableData').datagrid('reload'); + }, + //此处添加错误处理 + error:function() + { + $.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error'); + return; + } + }); + } + diff --git a/src/main/webapp/js/pages/materials/in_out.js b/src/main/webapp/js/pages/materials/in_out.js index 8ca2351c..9b1c7f34 100644 --- a/src/main/webapp/js/pages/materials/in_out.js +++ b/src/main/webapp/js/pages/materials/in_out.js @@ -1,30 +1,37 @@ //初始化界面 + var depotList = null; + var depotID = null; + var supplierList = null; + var supplierID = null; + var personList = null; + var personID = null; + var ProjectSearch=null; + var userBusinessList=null; + var userdepot=null; + var depotHeadMaxId=null; //获取最大的Id + var accepId=null; //保存的主表id + var url; + var depotHeadID = 0; + var preTotalPrice = 0; //前一次加载的金额 + var orgDepotHead = ""; + var editIndex = undefined; + var listTitle = ""; //单据标题 + var listType = ""; //入库 出库 + var listSubType = ""; //采购 销售等 + var payTypeTitle = "";//付款 收款 + var organUrl = ""; //组织数据接口地址 + var amountNum = ""; //单据编号开头字符 + var depotString = ""; //店铺列表 + var orgDefaultId = 0; //单位默认编号 + var orgDefaultList; //存储查询出来的会员列表 + var accountList; //账户列表 + var outItemList; //支出项目列表 + var thisTaxRate = 0; //当前税率,选择供应商或者客户的时候设置 + var oldNumber = ""; //编辑前的单据编号 + var oldId = 0; //编辑前的单据Id + var otherColumns = true; //明细中的‘别名’列是否显示 + var btnEnableList = getBtnStr(); //获取按钮的权限 $(function(){ - var depotList = null; - var depotID = null; - var supplierList = null; - var supplierID = null; - var personList = null; - var personID = null; - var ProjectSearch=null; - var userBusinessList=null; - var userdepot=null; - var depotHeadMaxId=null; //获取最大的Id - var accepId=null; //保存的主表id - var url; - var depotHeadID = 0; - var preTotalPrice = 0; //前一次加载的金额 - var orgDepotHead = ""; - var editIndex = undefined; - var listTitle = ""; //单据标题 - var listType = ""; //入库 出库 - var listSubType = ""; //采购 销售等 - var payTypeTitle = "";//付款 收款 - var organUrl = ""; //组织数据接口地址 - var amountNum = ""; //单据编号开头字符 - var depotString = ""; //店铺列表 - var orgDefaultId = 0; //单位默认编号 - var orgDefaultList; //存储查询出来的会员列表 //初始化系统基础信息 getType(); initSystemData_UB(); @@ -36,7 +43,9 @@ initSystemData_account(); initSelectInfo_account(); initSupplier(); //供应商 + initSalesman(); //销售人员 initGift(); //初始化礼品卡 + initOutItemList(); //初始化支出项目 initTableData(); ininPager(); initForm(); @@ -50,7 +59,7 @@ $("#searchPanel").panel({width:webW-2}); $("#tablePanel").panel({width:webW-2}); var supUrl = path + "/supplier/findBySelect_sup.action"; //供应商接口 - var cusUrl = path + "/supplier/findBySelect_cus.action"; //客户接口 + var cusUrl = path + "/supplier/findBySelect_cus.action?UBType=UserCustomer&UBKeyId=" + kid; //客户接口 var retailUrl = path + "/supplier/findBySelect_retail.action"; //散户接口 if(listTitle === "采购入库列表"){ listType = "入库"; @@ -229,6 +238,10 @@ url: organUrl, valueField:'id', textField:'supplier', + filter: function(q, row){ + var opts = $(this).combobox('options'); + return row[opts.textField].indexOf(q) >-1; + }, onLoadSuccess: function(res) { var data = $(this).combobox('getData'); for(var i = 0; i<= data.length; i++){ @@ -252,10 +265,38 @@ } $("#payType").empty().append(option); } + else{ + $.ajax({ + type:"get", + url: path + "/supplier/findById.action", + data: { + SupplierID: rec.id + }, + dataType: "json", + success: function (res){ + if(res && res.rows && res.rows[0]){ + thisTaxRate = res.rows[0].taxRate; //设置当前的税率 + } + }, + error:function(){ + + } + }); + } } }); } + //初始化销售人员 + function initSalesman(){ + $('#Salesman').combobox({ + url: path + "/person/getPersonByNumType.action?type=1", + valueField:'id', + textField:'name', + multiple: true + }); + } + //初始化-礼品卡 function initGift(){ if(listSubType == "礼品充值"|| listSubType == "礼品销售"){ @@ -283,6 +324,25 @@ }); } } + + //初始化收入项目列表 + function initOutItemList(){ + $.ajax({ + type:"post", + url: path + "/inOutItem/findBySelect.action?type=out", + //设置为同步 + async:false, + dataType: "json", + success: function (res){ + if(res){ + outItemList = res; + } + }, + error:function(){ + + } + }); + } //初始化系统基础信息 function initSystemData_person(){ @@ -348,11 +408,10 @@ //获取账户信息 function initSelectInfo_account(){ var options = ""; - if(accountList !=null) - { - options = ""; - for(var i = 0 ;i < accountList.length;i++) - { + if(accountList !=null){ + options = ""; + options += ""; + for(var i = 0 ;i < accountList.length;i++) { var account = accountList[i]; options += ''; } @@ -375,9 +434,50 @@ if(payTypeTitle === "隐藏"){ hideType = true; //隐藏当前列 } + var tableToolBar = [ + { + id:'addDepotHead', + text:'增加', + iconCls:'icon-add', + handler:function() + { + addDepotHead(); + } + }, + { + id:'deleteDepotHead', + text:'删除', + iconCls:'icon-remove', + handler:function() + { + batDeleteDepotHead(); + } + } + ]; + //如果允许的按钮列表中存在就显示,3-代表审核|反审核的权限 + if(btnEnableList && btnEnableList.indexOf(3)>-1){ + tableToolBar.push({ + id:'okDepotHead', + text:'审核', + iconCls:'icon-ok', + handler:function() { + setStatusFun(); + } + }, + { + id:'undoDepotHead', + text:'反审核', + iconCls:'icon-undo', + handler:function() { + setUnStatusFun(); + } + }); + } + var isShowLastMoneyColumn = false; //是否显示优惠后金额和价税合计,true为隐藏,false为显示 + if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货"){ + isShowLastMoneyColumn = true; //隐藏 + } $('#tableData').datagrid({ - //iconCls:'icon-save', - //width:700, height:heightInfo, rownumbers: false, //动画效果 @@ -397,55 +497,47 @@ pageSize: 5, pageList: initPageNum, columns:[[ - { field: 'Id',width:35,align:"center",checkbox:true}, - {field: 'OrganId',width:5, hidden:true}, - { title: '单据编号',field: 'Number',width:140}, - { title: '单据日期 ',field: 'OperTime',width:80}, - { title: '创建时间',field: 'CreateTime',width:80}, - { title: '操作员',field: 'OperPersonName',width:80}, - { title: '合计',field: 'TotalPrice',width:50}, - { title: payTypeTitle,field: 'ChangeAmount',width:50,hidden:hideType}, - { title: '单据备注',field: 'Remark',width:100}, - { title: '操作',field: 'op',align:"center",width:180,formatter:function(value,rec) - { - var str = ''; - var rowInfo = rec.Id + 'AaBb' + rec.ProjectId+ 'AaBb' + rec.Number+ 'AaBb' + rec.OperPersonName - + '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.payType; - if(1 == value) - { - var orgId = rec.OrganId? rec.OrganId:0; - str += '查看'; - str += '编辑'; - str += '删除'; - } - return str; - } - } - ]], - toolbar:[ - { - id:'addDepotHead', - text:'增加', - iconCls:'icon-add', - handler:function() - { - addDepotHead(); + { field: 'Id',width:35,align:"center",checkbox:true}, + { title: '操作',field: 'op',align:"center",width:90, + formatter:function(value,rec) { + var str = ''; + var rowInfo = rec.Id + 'AaBb' + rec.ProjectId+ 'AaBb' + rec.Number+ 'AaBb' + rec.OperPersonName + + '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.payType + 'AaBb' + rec.Salesman + + 'AaBb' + rec.Discount + 'AaBb' + rec.DiscountMoney + 'AaBb' + rec.DiscountLastMoney + + 'AaBb' + rec.AccountIdList + 'AaBb' + rec.AccountMoneyList + + 'AaBb' + rec.OtherMoney + 'AaBb' + rec.OtherMoneyList + 'AaBb' + rec.OtherMoneyItem + 'AaBb' + rec.AccountDay; + if(1 == value) { + var orgId = rec.OrganId? rec.OrganId:0; + str += '   '; + str += '   '; + str += ''; + } + return str; } }, - { - id:'deleteDepotHead', - text:'删除', - iconCls:'icon-remove', - handler:function() - { - batDeleteDepotHead(); + {field: 'OrganId',width:5, hidden:true}, + { title: '单据编号',field: 'Number',width:140}, + { title: '单据日期 ',field: 'OperTime',width:130}, + { title: '操作员',field: 'OperPersonName',width:80}, + { title: '金额合计',field: 'TotalPrice',width:60}, + { title: '含税合计',field: 'TotalTaxLastMoney',hidden:isShowLastMoneyColumn,width:60,formatter:function(value,rec){ + return (rec.DiscountMoney + rec.DiscountLastMoney).toFixed(2); } - } - ], + }, + { title: '优惠后金额',field: 'DiscountLastMoney',hidden:isShowLastMoneyColumn,width:80}, + { title: payTypeTitle,field: 'ChangeAmount',width:50,hidden:hideType}, + { title: '状态',field: 'Status',width:70,align:"center",formatter:function(value){ + return value? "已审核":"未审核"; + } + }, + { title: '单据备注',field: 'Remark',width:100}, + { title: '创建时间',field: 'CreateTime',width:130} + ]], + toolbar:tableToolBar, onLoadError:function() { $.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error'); @@ -454,10 +546,137 @@ }); } + //查找库存的方法 + function findStockNumById(depotId, mId, monthTime, body, input, ratio){ + var thisRatio = 1; //比例 + $.ajax({ + url: path + "/material/findById.action", + type: "get", + dataType: "json", + data: { + "MaterialID": mId + }, + success: function (rec) { + if(rec && rec.rows && rec.rows[0]) { + var loadRatio = 1; //在单位输入框上面加载比例字段 + if(rec.rows[0].Unit) { //如果存在计量单位信息 + loadRatio = 1; + } + else{ + var unitName = rec.rows[0].UnitName; + if(unitName) { + thisRatio = unitName.substring(unitName.indexOf(":")+1).replace(")",""); + unitName = unitName.substring(0, unitName.indexOf("(")); + } + var unitArr = unitName.split(","); + var basicUnit = unitArr[0]; //基础单位 + var otherUnit = unitArr[1]; //副单位 + var unitSetInput =""; //单位 + if(listSubType === "采购" || listSubType === "采购退货"){ + unitSetInput = rec.rows[0].FirstInUnit; + if(basicUnit==unitSetInput){ + loadRatio = 1; + } + else if(otherUnit==unitSetInput){ + loadRatio = thisRatio; + } + } + else if(listSubType === "销售" || listSubType === "销售退货"){ + unitSetInput = rec.rows[0].FirstOutUnit; + if(basicUnit==unitSetInput){ + loadRatio = 1; + } + else if(otherUnit==unitSetInput){ + loadRatio = thisRatio; + } + } + } + //查询库存 + $.ajax({ + type: "get", + url: path + '/depotItem/findStockNumById.action', + data:{ + ProjectId: depotId, + MaterialId: mId, + MonthTime: monthTime + }, + dataType: "json", + success: function (res) { + if(res && res.rows && res.rows[0]){ + var thisStock = res.rows[0].thisSum; + if(ratio!=undefined){ + loadRatio = ratio; + } + thisStock = (thisStock/loadRatio).toFixed(2); + body.find("[field='Stock']").find(input).val(thisStock).attr("data-stock",res.rows[0].thisSum); //加载库存数据 + } + else{ + body.find("[field='Stock']").find(input).val(0).attr("data-stock",0); //加载库存数据 + } + body.find("[field='Stock']").find(input).prop("readonly","readonly"); //设置库存数据为只读 + }, + error:function() { + $.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error'); + } + }); + } + }, + error: function () { + $.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error'); + } + }); + } + //优惠率、合计的统计方法 + function statisticsFun(body,UnitPrice,OperNumber,footer,taxRate){ + var TotalPrice = 0; + var taxLastMoneyTotal = 0; + //金额的合计 + body.find("[field='AllPrice']").each(function(){ + if($(this).find("div").text()!==""){ + TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString()); + } + }); + TotalPrice = TotalPrice + UnitPrice*OperNumber; + footer.find("[field='AllPrice']").find("div").text((TotalPrice).toFixed(2)); //金额的合计 + //价税合计的总计 + body.find("[field='TaxLastMoney']").each(function(){ + if($(this).find("div").text()!==""){ + taxLastMoneyTotal = taxLastMoneyTotal + (parseFloat($(this).find("div").text().toString())-0); + } + }); + taxLastMoneyTotal = taxLastMoneyTotal + (UnitPrice*OperNumber*(1+taxRate/100)); + footer.find("[field='TaxLastMoney']").find("div").text((taxLastMoneyTotal).toFixed(2)); //价税合计的页脚总计 + var discount = $("#Discount").val(); //优惠率 + var discountMoney = (taxLastMoneyTotal*discount/100).toFixed(2); + $("#DiscountMoney").val(discountMoney);//优惠金额 + var discountLastMoney = (taxLastMoneyTotal*(1-discount/100)).toFixed(2) + $("#DiscountLastMoney").val(discountLastMoney);//优惠后金额 + if($("#AccountId").val()!=="many"){ + $("#ChangeAmount").val(discountLastMoney); //本次付、收款 + } + var changeAmountNum = $("#ChangeAmount").val()-0; //本次付款或者收款 + $("#Debt").val((discountLastMoney-changeAmountNum).toFixed(2)); //本次欠款 + + if(listSubType == "零售" || listSubType == "零售退货") { + $("#ChangeAmount, #getAmount").val((TotalPrice).toFixed(2)); + $("#backAmount").val(0); + } + } //初始化表格数据-商品列表-编辑状态 function initTableData_material(type,TotalPrice){ + var body,footer,input; //定义表格和文本框 + var ratio = 1; //比例 + var monthTime = getNowFormatMonth(); + var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示 + if(listSubType == "调拨"){ + isShowAnotherDepot = false; //调拨时候显示对方仓库 + } + var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示 + if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货"){ + isShowTaxColumn = true; //隐藏 + } $('#materialData').datagrid({ - height:300, + height:245, rownumbers: false, //动画效果 animate:false, @@ -465,20 +684,41 @@ singleSelect : true, collapsible:false, selectOnCheck:false, - //fitColumns:true, //单击行是否选中 - //checkOnSelect : false, - pagination: true, + checkOnSelect : false, + pagination: false, //交替出现背景 striped : true, showFooter: true, //loadFilter: pagerFilter, onClickRow: onClickRow, - pageSize: 50, - pageList: [50,100,150], columns:[[ { field: 'Id',width:35,align:"center",checkbox:true}, - { title: '商品名称',field: 'MaterialId',width:230, + { title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90, + formatter: function (value, row, index) { + return row.DepotName; + }, + editor: { + type: 'combobox', + options: { + valueField: 'id', + textField: 'depotName', + method: 'get', + url: path + '/depot/findDepotByUserId.action?UBType=UserDepot&UBKeyId='+kid, + onSelect:function(rec){ + var depotId = rec.id; + body =$("#depotHeadFM .datagrid-body"); + footer =$("#depotHeadFM .datagrid-footer"); + input = ".datagrid-editable-input"; + var mId = body.find("[field='MaterialId']").find(".combo-value").val(); + if(mId){ + findStockNumById(depotId, mId, monthTime, body, input, ratio); + } + } + } + } + }, + { title: '品名(型号)(制造商)(包装)',field: 'MaterialId',width:230, formatter:function(value,row,index){ return row.MaterialName; }, @@ -489,46 +729,187 @@ textField:'MaterialName', method:'get', url: path + "/material/findBySelect.action", + panelWidth: 300, //下拉框的宽度 + //全面模糊匹配,过滤字段 + filter: function(q, row){ + var opts = $(this).combobox('options'); + return row[opts.textField].indexOf(q) >-1; + }, onSelect:function(rec){ if(rec) { + var mId = rec.Id; $.ajax({ url: path + "/material/findById.action", type: "get", dataType: "json", data: { - "MaterialID": rec.Id + "MaterialID": mId }, success: function (res) { if(res && res.rows && res.rows[0]) { - var retailPrice = res.rows[0].RetailPrice; //零售价格 - var presetPriceOne = res.rows[0].PresetPriceOne; //价格1 - var presetPriceTwo = res.rows[0].PresetPriceTwo; //价格2 - var TotalPrice = 0; - var allPrice = 0; - var body =$("#depotHeadFM .datagrid-body"); - var footer =$("#depotHeadFM .datagrid-footer"); - var input = ".datagrid-editable-input"; - body.find("[field='OperNumber']").find(input).val(1); + var retailPrice = res.rows[0].RetailPrice-0; //零售价格 + var presetPriceOne = res.rows[0].PresetPriceOne-0; //预计采购价 + var presetPriceTwo = res.rows[0].PresetPriceTwo-0; //批发价 + var firstInUnit = res.rows[0].FirstInUnit; //首选入库单位 + var firstOutUnit = res.rows[0].FirstOutUnit; //首选出库单位 + var basicPresetPriceOne = ""; //多单位-入库-基础价格 + var otherPresetPriceOne = ""; //多单位-入库-其他价格 + var basicPresetPriceTwo = ""; //多单位-出库-基础价格 + var otherPresetPriceTwo = ""; //多单位-出库-其他价格 + var basicUnit = ""; //基础单位 + var otherUnit = ""; //其他单位 + if(!res.rows[0].Unit){ + basicPresetPriceOne = res.rows[0].PriceStrategy[0].basic.PresetPriceOne-0; + otherPresetPriceOne = res.rows[0].PriceStrategy[1].other.PresetPriceOne-0; + basicPresetPriceTwo = res.rows[0].PriceStrategy[0].basic.PresetPriceTwo-0; + otherPresetPriceTwo = res.rows[0].PriceStrategy[1].other.PresetPriceTwo-0; + basicUnit = res.rows[0].PriceStrategy[0].basic.Unit; + otherUnit = res.rows[0].PriceStrategy[1].other.Unit; + } + body =$("#depotHeadFM .datagrid-body"); + footer =$("#depotHeadFM .datagrid-footer"); + input = ".datagrid-editable-input"; + if(res.rows[0].Unit){ //如果存在计量单位信息 + ratio = 1; //重置比例为1 + body.find("[field='Unit']").find(input).val(res.rows[0].Unit); //设置-计量单位信息 + body.find("[field='Unit']").find(input).prop("readonly","readonly"); //设置计量单位为只读 + body.find("[field='Unit']").find(input).off("click"); //移除点击事件 + body.find("[field='Unit']").find(input).attr("data-ratio",ratio); //修改比例缓存信息 + } + else { + var unitName = res.rows[0].UnitName; + if(unitName) { + ratio = unitName.substring(unitName.indexOf(":")+1).replace(")",""); + unitName = unitName.substring(0, unitName.indexOf("(")); + } + var unitArr = unitName.split(","); + var basicUnit = unitArr[0]; //基础单位 + var otherUnit = unitArr[1]; //副单位 + var unitSetInput =""; //单位 + body.find("[field='Unit']").find(input).prop("readonly","readonly"); //设置计量单位为只读 + var loadRatio = 1; //在单位输入框上面加载比例字段 + if(listSubType === "采购" || listSubType === "采购退货"){ + unitSetInput = res.rows[0].FirstInUnit; + if(basicUnit==unitSetInput){ + loadRatio = 1; + } + else if(otherUnit==unitSetInput){ + loadRatio = ratio; + } + } + else if(listSubType === "销售" || listSubType === "销售退货"){ + unitSetInput = res.rows[0].FirstOutUnit; + if(basicUnit==unitSetInput){ + loadRatio = 1; + } + else if(otherUnit==unitSetInput){ + loadRatio = ratio; + } + } + body.find("[field='Unit']").find(input).val(unitSetInput).attr("data-ratio", loadRatio); //设置-首选单位 + + body.find("[field='Unit']").find(input).off("click").on("click",function(){ + var self = this; + //定义模版 + var temp = "
"; + temp +="
    "; + temp +="
  • " + basicUnit + "
  • "; + temp +="
  • " + otherUnit + "
  • "; + temp +="
"; + temp +="
"; + if($('.unit-list').length){ + $('.unit-list').remove(); //如果存在计量单位列表先移除 + } + else { + $(self).after(temp); //加载列表信息 + } + //计量单位列表的单击事件 + $('.unit-list ul li').off("click").on("click",function(){ + var unit = $(this).text(); + var thisRatio = $(this).attr("data-ratio"); //获取比例 + $(self).val(unit).attr("data-ratio", thisRatio); + $(self).keyup(); //模拟键盘操作 + $('.unit-list').remove(); //移除计量单位列表 + var stock = body.find("[field='Stock']").find(input).attr("data-stock"); //从缓存中取值 + var type = $(this).attr("data-type"); + var UnitPrice = 0; + if(type === "basic"){ + if(listTitle == "采购入库列表" || listTitle == "销售退货列表" || listTitle == "其它入库列表") { + UnitPrice = basicPresetPriceOne; + } + else if(listTitle == "销售出库列表" || listTitle == "采购退货列表" || listTitle == "其它出库列表" || listTitle == "调拨出库列表") { + UnitPrice = basicPresetPriceTwo; + } + body.find("[field='Stock']").find(input).val(stock); //修改库存 + } + else if(type === "other"){ + if(listTitle == "采购入库列表" || listTitle == "销售退货列表" || listTitle == "其它入库列表") { + UnitPrice = otherPresetPriceOne; + } + else if(listTitle == "销售出库列表" || listTitle == "采购退货列表" || listTitle == "其它出库列表" || listTitle == "调拨出库列表") { + UnitPrice = otherPresetPriceTwo; + } + body.find("[field='Stock']").find(input).val((stock/ratio).toFixed(2)); //修改库存 + } + body.find("[field='UnitPrice']").find(input).val(UnitPrice); //单价 + var OperNumber = body.find("[field='OperNumber']").find(input).val(); //获取数量 + var taxRate = body.find("[field='TaxRate']").find(input).val(); //获取税率 + body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价 + body.find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); //金额 + body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额 + body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计 + statisticsFun(body,UnitPrice,OperNumber,footer,taxRate); + }); + //点击空白处移除计量单位列表 + $(".datagrid-body").off("click").on("click",function(){ + $('.unit-list').remove(); //移除计量单位列表 + }); + }); + } + var detailPrice = 0; //明细列表-单价 if(listSubType == "零售" || listSubType == "零售退货") { - body.find("[field='UnitPrice']").find(input).val(retailPrice); - body.find("[field='AllPrice']").find(input).val(retailPrice); - allPrice = retailPrice; + detailPrice = retailPrice; + } + else if(listTitle == "采购入库列表" || listTitle == "销售退货列表" || listTitle == "其它入库列表") { + if(res.rows[0].Unit) { //如果存在计量单位信息 + detailPrice = presetPriceOne; + } + else { + if (firstInUnit == basicUnit) { + detailPrice = basicPresetPriceOne; + } + else if (firstInUnit == otherUnit) { + detailPrice = otherPresetPriceOne; + } + } } else if(listTitle == "销售出库列表" || listTitle == "采购退货列表" || listTitle == "其它出库列表" || listTitle == "调拨出库列表") { - body.find("[field='UnitPrice']").find(input).val(presetPriceOne); - body.find("[field='AllPrice']").find(input).val(presetPriceOne); - allPrice = presetPriceOne; - } - body.find("[field='AllPrice']").each(function(){ - if($(this).find("div").text()!==""){ - TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString()); + if(res.rows[0].Unit) { //如果存在计量单位信息 + detailPrice = presetPriceTwo; } - }); - TotalPrice = TotalPrice + allPrice; - footer.find("[field='AllPrice']").find("div").text((TotalPrice).toFixed(2)); - if(listSubType == "零售" || listSubType == "零售退货") { - $("#ChangeAmount, #getAmount").val((TotalPrice).toFixed(2)); - $("#backAmount").val(0); + else { + if(firstOutUnit==basicUnit) { + detailPrice = basicPresetPriceTwo; + } + else if(firstOutUnit==otherUnit){ + detailPrice = otherPresetPriceTwo; + } + } + } + body.find("[field='OperNumber']").find(input).val(1); //数量初始化为1 + //单价和总价赋值 + body.find("[field='UnitPrice']").find(input).val(detailPrice); + body.find("[field='AllPrice']").find(input).val(detailPrice); + var taxRate = body.find("[field='TaxRate']").find(input).val()-0; //获取税率 + body.find("[field='TaxUnitPrice']").find(input).val((detailPrice*(1+taxRate/100)).toFixed(2)); //含税单价 + body.find("[field='TaxMoney']").find(input).val((detailPrice*(taxRate/100)).toFixed(2)); //税额 + body.find("[field='TaxLastMoney']").find(input).val((detailPrice*(1+taxRate/100)).toFixed(2)); //价税合计 + statisticsFun(body,detailPrice,1,footer,taxRate); + + //查询库存信息 + var depotId = body.find("[field='DepotId']").find(".combo-value").val(); + if(depotId) { + findStockNumById(depotId, mId, monthTime, body, input,ratio); } } }, @@ -541,10 +922,35 @@ } } }, - { title: '数量',field: 'OperNumber',editor:'validatebox',width:50}, - { title: '单价',field: 'UnitPrice',editor:'validatebox',width:50}, - { title: '金额',field: 'AllPrice',editor:'validatebox',width:50}, - { title: '备注',field: 'Remark',editor:'validatebox',width:150} + { title: '库存',field: 'Stock',editor:'validatebox',width:70}, + { title: '调入仓库',field: 'AnotherDepotId',editor:'validatebox',hidden:isShowAnotherDepot,width:90, + formatter: function (value, row, index) { + return row.AnotherDepotName; + }, + editor: { + type: 'combobox', + options: { + valueField: 'id', + textField: 'depotName', + method: 'get', + url: path + '/depot/findDepotByUserId.action?UBType=UserDepot&UBKeyId='+kid + } + } + }, + { title: '单位',field: 'Unit',editor:'validatebox',width:70}, + { title: '数量',field: 'OperNumber',editor:'validatebox',width:70}, + { title: '单价',field: 'UnitPrice',editor:'validatebox',width:70}, + { title: '含税单价',field: 'TaxUnitPrice',editor:'validatebox',hidden:isShowTaxColumn,width:80}, + { title: '金额',field: 'AllPrice',editor:'validatebox',width:80}, + { title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:80}, + { title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:80}, + { title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:80}, + { title: '备注',field: 'Remark',editor:'validatebox',width:150}, + { title: '品名-别',field: 'OtherField1',editor:'validatebox',hidden:otherColumns,width:60}, + { title: '型号-别',field: 'OtherField2',editor:'validatebox',hidden:otherColumns,width:60}, + { title: '制造商-别',field: 'OtherField3',editor:'validatebox',hidden:otherColumns,width:60}, + { title: '备注1',field: 'OtherField4',editor:'validatebox',hidden:true,width:60}, + { title: '备注2',field: 'OtherField5',editor:'validatebox',hidden:true,width:60} ]], toolbar:[ { @@ -586,13 +992,18 @@ url: path + '/depotItem/findBy.action?HeaderId=' + depotHeadID, dataType: "json", success: function (res) { - var AllPrice = 0 + var AllPrice = 0; + var TaxLastMoney = 0; + var DiscountMoney = $("#DiscountMoney").val()-0; //优惠金额 + var DiscountLastMoney = $("#DiscountLastMoney").val()-0; //优惠后金额 if(type === "edit") { - AllPrice = TotalPrice; + AllPrice = TotalPrice; + TaxLastMoney = DiscountMoney + DiscountLastMoney; } var array = []; array.push({ - "AllPrice": AllPrice + "AllPrice": AllPrice, + "TaxLastMoney": TaxLastMoney }); res.footer = array; $("#materialData").datagrid('loadData',res); @@ -606,8 +1017,16 @@ //初始化表格数据-商品列表-查看状态 function initTableData_material_show(TotalPrice){ + var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示 + if(listSubType == "调拨"){ + isShowAnotherDepot = false; //调拨时候显示对方仓库 + } + var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示 + if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货"){ + isShowTaxColumn = true; //隐藏 + } $('#materialDataShow').datagrid({ - height:300, + height:245, rownumbers: true, //动画效果 animate:false, @@ -615,26 +1034,31 @@ singleSelect : true, collapsible:false, selectOnCheck:false, - //fitColumns:true, - //单击行是否选中 - //checkOnSelect : false, - pagination: true, + pagination: false, //交替出现背景 striped : true, showFooter: true, - //loadFilter: pagerFilter, onClickRow: onClickRow, - pageSize: 50, - pageList: [50,100,150], columns:[[ - { title: '商品名称',field: 'MaterialName',width:230}, - { title: '数量',field: 'OperNumber',width:50}, - { title: '单价',field: 'UnitPrice',width:50}, - { title: '金额',field: 'AllPrice',width:50}, - { title: '备注',field: 'Remark',width:150} + { title: '仓库名称',field: 'DepotName',editor:'validatebox',width:90}, + { title: '品名(型号)(制造商)(包装)',field: 'MaterialName',width:230}, + { title: '调入仓库',field: 'AnotherDepotName',hidden:isShowAnotherDepot,width:90}, + { title: '单位',field: 'Unit',editor:'validatebox',width:70}, + { title: '数量',field: 'OperNumber',editor:'validatebox',width:70}, + { title: '单价',field: 'UnitPrice',editor:'validatebox',width:70}, + { title: '含税单价',field: 'TaxUnitPrice',editor:'validattebox',hidden:isShowTaxColumn,width:80}, + { title: '金额',field: 'AllPrice',editor:'validatebox',width:80}, + { title: '税率',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:80}, + { title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:80}, + { title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:80}, + { title: '备注',field: 'Remark',editor:'validatebox',width:150}, + { title: '品名-别',field: 'OtherField1',editor:'validatebox',hidden:otherColumns,width:60}, + { title: '型号-别',field: 'OtherField2',editor:'validatebox',hidden:otherColumns,width:60}, + { title: '制造商-别',field: 'OtherField3',editor:'validatebox',hidden:otherColumns,width:60}, + { title: '备注1',field: 'OtherField4',editor:'validatebox',hidden:true,width:60}, + { title: '备注2',field: 'OtherField5',editor:'validatebox',hidden:true,width:60} ]], - onLoadError:function() - { + onLoadError:function() { $.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error'); return; } @@ -644,10 +1068,13 @@ url: path + '/depotItem/findBy.action?HeaderId=' + depotHeadID, dataType: "json", success: function (res) { - var AllPrice = TotalPrice; + var AllPrice = TotalPrice; + var DiscountMoney = $("#DiscountMoneyShow").text()-0; //优惠金额 + var DiscountLastMoney = $("#DiscountLastMoneyShow").text()-0; //优惠后金额 var array = []; array.push({ - "AllPrice": AllPrice + "AllPrice": AllPrice, + "TaxLastMoney": DiscountMoney + DiscountLastMoney }); res.footer = array; $("#materialDataShow").datagrid('loadData',res); @@ -686,11 +1113,13 @@ } //删除单据信息 - function deleteDepotHead(depotHeadID, thisOrganId, totalPrice){ - $.messager.confirm('删除确认','确定要删除此单据信息吗?',function(r) - { - if (r) - { + function deleteDepotHead(depotHeadID, thisOrganId, totalPrice, status){ + if(status) { + $.messager.alert('删除提示','已审核的单据不能删除!','warning'); + return; + } + $.messager.confirm('删除确认','确定要删除此单据信息吗?',function(r) { + if (r) { $.ajax({ type:"post", url: path + "/depotHead/delete.action", @@ -824,14 +1253,160 @@ }); } } + + //批量审核 + function setStatusFun() { + var row = $('#tableData').datagrid('getChecked'); + if(row.length == 0) { + $.messager.alert('审核提示','没有记录被选中!','info'); + return; + } + if(row.length > 0) { + $.messager.confirm('审核确认','确定要审核选中的' + row.length + '条信息吗?',function(r) + { + if (r) + { + var ids = ""; + for(var i = 0;i < row.length; i ++) + { + if(i == row.length-1) + { + ids += row[i].Id; + break; + } + ids += row[i].Id + ","; + } + $.ajax({ + type:"post", + url: path + "/depotHead/batchSetStatus.action", + dataType: "json", + async : false, + data: ({ + Status: true, + DepotHeadIDs : ids, + clientIp: clientIp + }), + success: function (tipInfo) + { + var msg = tipInfo.showModel.msgTip; + if(msg == '成功') + { + //加载完以后重新初始化 + $("#searchBtn").click(); + $(":checkbox").attr("checked",false); + } + else + $.messager.alert('审核提示','审核信息失败,请稍后再试!','error'); + }, + //此处添加错误处理 + error:function() + { + $.messager.alert('审核提示','审核信息异常,请稍后再试!','error'); + return; + } + }); + } + }); + } + } + + //批量反审核 + function setUnStatusFun() { + var row = $('#tableData').datagrid('getChecked'); + if(row.length == 0) + { + $.messager.alert('反审核提示','没有记录被选中!','info'); + return; + } + if(row.length > 0) + { + $.messager.confirm('反审核确认','确定要反审核选中的' + row.length + '条信息吗?',function(r) + { + if (r) + { + var ids = ""; + for(var i = 0;i < row.length; i ++) + { + if(i == row.length-1) + { + ids += row[i].Id; + break; + } + ids += row[i].Id + ","; + } + $.ajax({ + type:"post", + url: path + "/depotHead/batchSetStatus.action", + dataType: "json", + async : false, + data: ({ + Status: false, + DepotHeadIDs : ids, + clientIp: clientIp + }), + success: function (tipInfo) + { + var msg = tipInfo.showModel.msgTip; + if(msg == '成功') + { + //加载完以后重新初始化 + $("#searchBtn").click(); + $(":checkbox").attr("checked",false); + } + else + $.messager.alert('反审核提示','反审核信息失败,请稍后再试!','error'); + }, + //此处添加错误处理 + error:function() + { + $.messager.alert('反审核提示','反审核信息异常,请稍后再试!','error'); + return; + } + }); + } + }); + } + } + //新增信息 function addDepotHead(){ $("#clientIp").val(clientIp); $('#depotHeadFM').form('clear'); - var thisDate = getNowFormatDate(); //当前日期 - $("#OperTime").val(thisDate); + var thisDateTime = getNowFormatDateTime(); //当前时间 + $("#OperTime").val(thisDateTime); var thisNumber = getNowFormatDateNum(); //根据时间生成编号 - $("#Number").val(amountNum + thisNumber).focus(); + var thisDate = getNowFormatDate(); //当前日期 + var beginTime = thisDate + " 00:00:00"; + var endTime = thisDate + " 23:59:59"; + //生成单据编号 + $.ajax({ + type: "post", + url: path + "/depotHead/buildNumber.action", + data: { + Type: listType, + SubType: listSubType, + BeginTime: beginTime, + EndTime: endTime + }, + success:function(res){ + if(res){ + res = JSON.parse(res); + var defaultNumber = res.DefaultNumber; + var thisDateTwo = getNowFormatDateTwo(); //当前日期 + var newNumber = amountNum + thisDateTwo + defaultNumber + $("#Number").val(newNumber).attr("data-defaultNumber",newNumber); + } + }, + error:function(){ + $.messager.alert('提示','生成单据编号失败!','error'); + } + }); + //初始化优惠率、优惠金额、优惠后金额、本次付|收款、本次欠款 为0 + $("#Discount").val(0); + $("#DiscountMoney").val(0); + $("#DiscountLastMoney").val(0); + $("#ChangeAmount").val(0); + $("#Debt").val(0); var addTitle = listTitle.replace("列表","信息"); $('#depotHeadDlg').dialog('open').dialog('setTitle',' 增加' + addTitle); $(".window-mask").css({ width: webW ,height: webH}); @@ -840,6 +1415,9 @@ depotHeadID = 0; initTableData_material("add"); //商品列表 reject(); //撤销下、刷新商品列表 + $("#addOrgan").off("click").on("click",function(){ + $('#supplierDlg').dialog('open').dialog('setTitle',' 增加供应商'); + }); url = path + '/depotHead/create.action'; //零售单据修改收款时,自动计算找零 @@ -883,7 +1461,11 @@ } //编辑信息 - function editDepotHead(depotHeadTotalInfo){ + function editDepotHead(depotHeadTotalInfo, status){ + if(status) { + $.messager.alert('编辑提示','已审核的单据不能编辑!','warning'); + return; + } var depotHeadInfo = depotHeadTotalInfo.split("AaBb"); $("#clientIp").val(clientIp); if(listSubType==="礼品销售"){ @@ -898,7 +1480,7 @@ initSystemData_person(ProjectId); initSelectInfo_person(); } - $("#Number").val(depotHeadInfo[2]); + $("#Number").val(depotHeadInfo[2]).attr("data-defaultNumber",depotHeadInfo[2]); $("#OperTime").val(depotHeadInfo[4]); $('#OrganId').combobox('setValue', depotHeadInfo[5]); $("#HandsPersonId").val(depotHeadInfo[6]); @@ -906,13 +1488,19 @@ $("#ChangeAmount").val(depotHeadInfo[8]); $("#ChangeAmount").attr("data-changeamount", depotHeadInfo[8]); $("#Remark").val(depotHeadInfo[9]); + $("#Discount").val(depotHeadInfo[19]); + $("#DiscountMoney").val(depotHeadInfo[20]); + $("#DiscountLastMoney").val(depotHeadInfo[21]); + $("#Debt").val((depotHeadInfo[21]-depotHeadInfo[8]).toFixed(2)); + $("#AccountDay").val(depotHeadInfo[27].replace("undefined","")); //结算天数 var TotalPrice = depotHeadInfo[14]; preTotalPrice = depotHeadInfo[14]; //记录前一次合计金额,用于扣预付款 $("#AllocationProjectId").val(depotHeadInfo[15]); if(listSubType==="礼品充值"){ $("#GiftId").combobox('setValue', depotHeadInfo[15]); } - //orgDepotHead = depotHeadInfo[1]; + oldNumber = depotHeadInfo[2]; //记录编辑前的单据编号 + oldId = depotHeadInfo[0]; //记录单据Id var editTitle = listTitle.replace("列表","信息"); $('#depotHeadDlg').dialog('open').dialog('setTitle',' 编辑' + editTitle); $(".window-mask").css({ width: webW ,height: webH}); @@ -929,6 +1517,36 @@ } $("#payType").empty().append(option); } + + if(listSubType === "销售" || listSubType === "销售退货"){ + if(depotHeadInfo[18]){ + var arr = depotHeadInfo[18].split(","); + var salesmanArray = []; + for(var i=0;i","")); + } + } + $("#Salesman").combobox('setValues', salesmanArray); + } + } + + //采购入库、销售出库的多账户加载 + if(depotHeadInfo[22]!="undefined" && depotHeadInfo[23]!="undefined"){ + $("#AccountId").val("many"); //下拉框选中多账户 + var accountArr = depotHeadInfo[22].split(","); + var accountMoneyArr = depotHeadInfo[23].split(","); + $("#AccountId").attr("data-accountArr", JSON.stringify(accountArr)).attr("data-accountMoneyArr", JSON.stringify(accountMoneyArr)); //json数据存储 + $(".many-account-ico").show(); //显示多账户的ico图标 + } + + //采购入库、销售出库的费用数据加载 + if(depotHeadInfo[25] && depotHeadInfo[26]){ + $("#OtherMoney").val(depotHeadInfo[24].replace("undefined","0")); //采购费用、销售费用 + var itemArr = depotHeadInfo[25].split(","); + var itemMoneyArr = depotHeadInfo[26].split(","); + $("#OtherMoney").attr("data-itemArr",JSON.stringify(itemArr)).attr("data-itemMoneyArr",JSON.stringify(itemMoneyArr)); //json数据存储 + } initTableData_material("edit",TotalPrice); //商品列表 reject(); //撤销下、刷新商品列表 @@ -943,9 +1561,51 @@ $("#OperTimeShow").text(depotHeadInfo[4]); $('#OrganIdShow').text(depotHeadInfo[11]); $("#HandsPersonIdShow").text(depotHeadInfo[12]); - $("#AccountIdShow").text(depotHeadInfo[13]); + if(depotHeadInfo[13]){ + $("#AccountIdShow").text(depotHeadInfo[13]); //结算账户 + } + else if(depotHeadInfo[22] && depotHeadInfo[23]){ + var accountArr = depotHeadInfo[22].split(","); //账户id列表 + var accountMoneyArr = depotHeadInfo[23].split(","); //账户金额列表 + var accountIdShow = ""; + for(var j =0;j",""); + } + else { + salesmanStr += arr[i].replace("<","").replace(">","") + ","; + } + } + } + $.ajax({ + type: "post", + url: path + "/person/getPersonByIds.action", + data: { + PersonIDs: salesmanStr + }, + success:function(res){ + if(res){ + $("#SalesmanShow").text(res); //销售人员列表 + } + }, + error:function(){ + + } + }); + } + } } //绑定操作事件 @@ -979,7 +1670,7 @@ pageSize:initPageSize }); }); - + //重置按钮 $("#searchResetBtn").unbind().bind({ click:function(){ @@ -989,100 +1680,100 @@ $("#searchEndTime").val(""); //加载完以后重新初始化 $("#searchBtn").click(); - } + } }); - + + //检查单据编号是否存在 + function checkDepotHeadNumber() { + var thisNumber = $.trim($("#Number").val()); + //表示是否存在 true == 存在 false = 不存在 + var flag = false; + //开始ajax名称检验,不能重名 + if(thisNumber.length > 0 &&( oldNumber.length ==0 || thisNumber != oldNumber)) + { + $.ajax({ + type:"post", + url: path + "/depotHead/checkIsNumberExist.action", + dataType: "json", + async : false, + data: ({ + DepotHeadID : oldId, + Number : thisNumber + }), + success: function (tipInfo) + { + flag = tipInfo; + if(tipInfo) + { + $.messager.alert('提示','抱歉,该单据编号已经存在','warning'); + return; + } + }, + //此处添加错误处理 + error:function() + { + $.messager.alert('提示','检查单据编号是否存在异常,请稍后再试!','error'); + return; + } + }); + } + return flag; + } //保存信息 $("#saveDepotHead").unbind().bind({ click:function() { - if(!$('#depotHeadFM').form('validate')) + if(!$('#depotHeadFM').form('validate')){ return; + } else { + //如果初始编号被修改了,就要判断单据编号是否存在 + if($.trim($("#Number").val()) != $('#Number').attr("data-defaultNumber")){ + //调用查询单据编号是否重名的方法 + if(checkDepotHeadNumber()){ + return; + } + } //输入框提示 if(listTitle === "采购入库列表"){ - if(!$("#ProjectId").val()){ - $.messager.alert('提示','请选择收货仓库!','warning'); - return; - } if(!$('#OrganId').combobox('getValue')){ - $.messager.alert('提示','请选择供货单位!','warning'); - return; - } - if(!$('#HandsPersonId').val()){ - $.messager.alert('提示','请选择经手人!','warning'); + $.messager.alert('提示','请选择供应商!','warning'); return; } if(!$('#AccountId').val()){ - $.messager.alert('提示','请选择付款账户!','warning'); + $.messager.alert('提示','请选择结算账户!','warning'); return; } } else if(listTitle === "零售退货列表"){ - if(!$("#ProjectId").val()){ - $.messager.alert('提示','请选择收货仓库!','warning'); - return; - } if(!$('#AccountId').val()){ $.messager.alert('提示','请选择付款账户!','warning'); return; } - if(!$('#HandsPersonId').val()){ - $.messager.alert('提示','请选择经手人!','warning'); - return; - } } else if(listTitle === "销售退货列表"){ - if(!$("#ProjectId").val()){ - $.messager.alert('提示','请选择收货仓库!','warning'); - return; - } if(!$('#OrganId').combobox('getValue')){ $.messager.alert('提示','请选择退货单位!','warning'); return; } - if(!$('#HandsPersonId').val()){ - $.messager.alert('提示','请选择经手人!','warning'); - return; - } if(!$('#AccountId').val()){ $.messager.alert('提示','请选择付款账户!','warning'); return; } } else if(listTitle === "其它入库列表"){ - if(!$("#ProjectId").val()){ - $.messager.alert('提示','请选择收货仓库!','warning'); - return; - } if(!$('#OrganId').combobox('getValue')){ $.messager.alert('提示','请选择往来单位!','warning'); return; } - if(!$('#HandsPersonId').val()){ - $.messager.alert('提示','请选择经手人!','warning'); - return; - } } else if(listTitle === "零售出库列表"){ - if(!$("#ProjectId").val()){ - $.messager.alert('提示','请选择发货仓库!','warning'); - return; - } if(!$('#AccountId').val()){ $.messager.alert('提示','请选择收款账户!','warning'); return; } - if(!$('#HandsPersonId').val()){ - $.messager.alert('提示','请选择经手人!','warning'); - return; - } } else if(listTitle === "销售出库列表"){ - if(!$("#ProjectId").val()){ - $.messager.alert('提示','请选择发货仓库!','warning'); - return; - } if(!$('#OrganId').combobox('getValue')){ $.messager.alert('提示','请选择购买单位!','warning'); return; @@ -1093,50 +1784,23 @@ } } else if(listTitle === "采购退货列表"){ - if(!$("#ProjectId").val()){ - $.messager.alert('提示','请选择发货仓库!','warning'); - return; - } if(!$('#OrganId').combobox('getValue')){ $.messager.alert('提示','请选择收货单位!','warning'); return; } - if(!$('#HandsPersonId').val()){ - $.messager.alert('提示','请选择经手人!','warning'); - return; - } if(!$('#AccountId').val()){ $.messager.alert('提示','请选择收款账户!','warning'); return; } } else if(listTitle === "其它出库列表"){ - if(!$("#ProjectId").val()){ - $.messager.alert('提示','请选择发货仓库!','warning'); - return; - } if(!$('#OrganId').combobox('getValue')){ $.messager.alert('提示','请选择往来单位!','warning'); return; } - if(!$('#HandsPersonId').val()){ - $.messager.alert('提示','请选择经手人!','warning'); - return; - } } else if(listTitle === "调拨出库列表"){ - if(!$("#ProjectId").val()){ - $.messager.alert('提示','请选择发货仓库!','warning'); - return; - } - if(!$('#HandsPersonId').val()){ - $.messager.alert('提示','请选择经手人!','warning'); - return; - } - if(!$("#AllocationProjectId").val()){ - $.messager.alert('提示','请选择收货仓库!','warning'); - return; - } + } var OrganId = null, ProjectId = null,AllocationProjectId = null; var ChangeAmount = $.trim($("#ChangeAmount").val()); @@ -1148,7 +1812,7 @@ ProjectId = $.trim($("#ProjectId").val()); } if(listSubType ==="调拨"){ - AllocationProjectId = $.trim($("#AllocationProjectId").val()); //收货仓库-对方 + } else if(listSubType ==="礼品充值"){ AllocationProjectId = $('#GiftId').combobox('getValue'); //礼品卡 @@ -1160,7 +1824,9 @@ OrganId = null; } else { - OrganId = $('#OrganId').combobox('getValue'); + if($('#OrganId').length){ + OrganId = $('#OrganId').combobox('getValue'); + } } if(listSubType === "采购"||listSubType === "零售退货"||listSubType === "销售退货"){ //付款为负数 @@ -1174,6 +1840,23 @@ thisPayType = "预付款"; } } + var SalesmanStr = ""; + if(listSubType === "销售" || listSubType === "销售退货"){ + var Salesman = $('#Salesman').combobox('getValues').toString(); //销售人员 + var SalesmanArray = Salesman.split(","); + for (var i = 0; i < SalesmanArray.length; i++) { + if (i === SalesmanArray.length - 1) { + SalesmanStr += "<" + SalesmanArray[i] + ">"; + } + else { + SalesmanStr += "<" + SalesmanArray[i] + ">,"; + } + } + } + var getAccountID = $.trim($("#AccountId").val()); + if($("#AccountId").val() === "many"){ //多账户 + getAccountID = null; + } $.ajax({ type:"post", url: url, @@ -1184,15 +1867,26 @@ SubType: listSubType, ProjectId: ProjectId, AllocationProjectId: AllocationProjectId, + DefaultNumber: $.trim($("#Number").attr("data-defaultNumber")),//初始编号 Number: $.trim($("#Number").val()), OperTime: $("#OperTime").val(), OrganId: OrganId, HandsPersonId: $.trim($("#HandsPersonId").val()), - AccountId: $.trim($("#AccountId").val()), + Salesman: SalesmanStr, //销售人员 + AccountId: getAccountID, ChangeAmount: ChangeAmount, //付款/收款 TotalPrice: TotalPrice, //合计 - PayType: thisPayType, //现付/预付款 + PayType: thisPayType, //现付/预付款 Remark: $.trim($("#Remark").val()), + AccountIdList: $("#AccountId").attr("data-accountarr"), //账户列表-多账户 + AccountMoneyList: $("#AccountId").attr("data-accountmoneyarr"), //账户金额列表-多账户 + Discount: $.trim($("#Discount").val()), + DiscountMoney: $.trim($("#DiscountMoney").val()), + DiscountLastMoney: $.trim($("#DiscountLastMoney").val()), + OtherMoney: $.trim($("#OtherMoney").val()), //采购费用、销售费用 + OtherMoneyList: $("#OtherMoney").attr("data-itemarr"), //支出项目列表-涉及费用 + OtherMoneyItem: $("#OtherMoney").attr("data-itemmoneyarr"), //支出项目金额列表-涉及费用 + AccountDay: $("#AccountDay").val(), //结算天数 clientIp: clientIp }), success: function (tipInfo) @@ -1201,8 +1895,8 @@ { function closeDialog(){ $('#depotHeadDlg').dialog('close'); - var opts = $("#tableData").datagrid('options'); - showDepotHeadDetails(opts.pageNumber,opts.pageSize); + var opts = $("#tableData").datagrid('options'); + showDepotHeadDetails(opts.pageNumber,opts.pageSize); } if(thisPayType === "预付款") { @@ -1238,14 +1932,12 @@ if(depotHeadID ==0) { getMaxId(); //查找最大的Id - accept(depotHeadMaxId); //新增 - closeDialog(); + accept(depotHeadMaxId,closeDialog); //新增 } else { - accept(depotHeadID); //修改 - closeDialog(); - } + accept(depotHeadID,closeDialog); //修改 + } } else { @@ -1261,31 +1953,422 @@ $.messager.alert('提示','保存信息异常,请稍后再试!','error'); return; } - }); + }); } } }); - + //初始化键盘enter事件 - $(document).keydown(function(event){ - //兼容 IE和firefox 事件 - var e = window.event || event; - var k = e.keyCode||e.which||e.charCode; - //兼容 IE,firefox 兼容 - var obj = e.srcElement ? e.srcElement : e.target; + $(document).keydown(function(event){ + //兼容 IE和firefox 事件 + var e = window.event || event; + var k = e.keyCode||e.which||e.charCode; + //兼容 IE,firefox 兼容 + var obj = e.srcElement ? e.srcElement : e.target; //绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题 if(k == "13"&&(obj.id=="State"||obj.id=="Number")) - { + { $("#saveDepotHead").click(); } //搜索按钮添加快捷键 if(k == "13"&&(obj.id=="searchState"||obj.id=="searchNumber")) - { + { $("#searchBtn").click(); } - }); + }); + + //优惠率输入框事件 + $("#Discount").off("keyup").on("keyup",function(){ + var footer =$("#depotHeadFM .datagrid-footer"); + var totalPrice = footer.find("[field='TaxLastMoney']").find("div").text(); + var discountNum = $(this).val(); + var discountMoney = (discountNum/100*totalPrice).toFixed(2); + var discountLastMoney = (totalPrice - discountMoney).toFixed(2); + $("#DiscountMoney").val(discountMoney); //优惠金额 + $("#DiscountLastMoney").val(discountLastMoney); //优惠后金额 + if($("#AccountId").val()!=="many"){ + $("#ChangeAmount").val(discountLastMoney); //本次付、收款 + } + var changeAmountNum = $("#ChangeAmount").val()-0; //本次付款或者收款 + $("#Debt").val((discountLastMoney-changeAmountNum).toFixed(2)); //本次欠款 + }); + + //优惠金额输入框事件 + $("#DiscountMoney").off("keyup").on("keyup",function(){ + var footer =$("#depotHeadFM .datagrid-footer"); + var totalPrice = footer.find("[field='TaxLastMoney']").find("div").text(); + var discountMoney = $(this).val(); + var discount = (discountMoney/totalPrice).toFixed(2)*100; + var discountLastMoney = (totalPrice - discountMoney).toFixed(2); + $("#Discount").val(discount); //优惠金额 + $("#DiscountLastMoney").val(discountLastMoney); //优惠后金额 + if($("#AccountId").val()!=="many"){ + $("#ChangeAmount").val(discountLastMoney); //本次付、收款 + } + var changeAmountNum = $("#ChangeAmount").val()-0; //本次付款或者收款 + $("#Debt").val((discountLastMoney-changeAmountNum).toFixed(2)); //本次欠款 + }); + + //付款、收款输入框事件 + $("#ChangeAmount").off("keyup").on("keyup",function(){ + var discountLastMoney = $("#DiscountLastMoney").val(); + var changeAmount = $(this).val(); + var debtMoney = (discountLastMoney - changeAmount).toFixed(2); + $("#Debt").val(debtMoney); //本次欠款 + }); + + //多账户结算窗口弹出事件 + function depotHeadAccountDlgFun(){ + $('#depotHeadAccountDlg').dialog('open').dialog('setTitle',' 多账户结算'); + $("#depotHeadAccountDlg .account-dlg .account-content-tmp").remove(); //先移除输入栏目 + $("#accountMoneyTotalDlg").text(0); //将合计初始化为0 + for(var i=0; i<6; i++) { + $("#depotHeadAccountDlg .tabs-tmp .account-content-tmp").attr("data-index",5-i); //添加索引 + var contentTmp = $("#depotHeadAccountDlg .tabs-tmp tbody").html(); + var accountDlgHead = $("#depotHeadAccountDlg .account-head-tmp"); + accountDlgHead.after(contentTmp); + } + + //获取账户信息 + function accountDlgFun() { + var options = ""; + if(accountList !=null){ + for(var i = 0 ;i < accountList.length;i++) { + var account = accountList[i]; + options += ''; + } + $(".account-id-dlg").empty().append("").append(options); + } + } + accountDlgFun(); //获取账户信息 + $("#depotHeadAccountDlg .tabs-tmp").hide(); //隐藏模板 + + //账户金额输入框事件-多账户 + $("#depotHeadAccountDlg .account-dlg .account-money-dlg").off("keyup").on("keyup",function(){ + var totalAccoutNum = 0; + $("#depotHeadAccountDlg .account-dlg .account-content-tmp").each(function(){ + var eachAccountMoney = $(this).find(".account-money-dlg").val()-0; + totalAccoutNum += eachAccountMoney; + }); + $("#accountMoneyTotalDlg").text(totalAccoutNum); + }); + + //结算多账户列表的切换事件 + $("#depotHeadAccountDlg .account-dlg .account-id-dlg").off("change").on("change",function(){ + var selectAccount = $(this).children('option:selected').text(); + if(selectAccount === ""){ + var thisMoneyDom = $(this).closest(".account-content-tmp").find(".account-money-dlg"); + var thisMoney = thisMoneyDom.val()-0; + var accountMoneyTotal = $("#accountMoneyTotalDlg").text() - 0; + $("#accountMoneyTotalDlg").text(accountMoneyTotal - thisMoney); + thisMoneyDom.val(""); //账户为空时候,将金额也置为空 + } + }); + + //保存按钮事件 + $("#saveDepotHeadAccountDlg").off("click").on("click", function(){ + //完成多账户的json数据存储 + var accountArr = []; //账户id数组 + var accountMoneyArr = []; //账户金额数组 + var errorIndex = -1; + $("#depotHeadAccountDlg .account-dlg .account-content-tmp").each(function(){ + var thisAccId = $(this).find(".account-id-dlg").val(); + var thisAccMoney = $(this).find(".account-money-dlg").val(); + if(!thisAccId && thisAccMoney) { + errorIndex = $(this).attr("data-index")-0; + return; + } + if(thisAccId && !thisAccMoney) { + errorIndex = $(this).attr("data-index")-0; + return; + } + if(thisAccId && thisAccMoney) { + accountArr.push(thisAccId); + accountMoneyArr.push(thisAccMoney); + } + }); + if(errorIndex >-1){ + $.messager.alert('错误提示',"第" + (errorIndex+1) + "行数据存在问题,请修改",'warning'); + return; + } + var discountLastMoneyNum =$("#DiscountLastMoney").val()-0; //优惠后金额 + var accountMoneyTotal = $("#accountMoneyTotalDlg").text()-0; //本次付款或者收款 + if(accountMoneyTotal===0){ + $.messager.alert('错误提示',"请填写金额后保存",'warning'); + return; + } + if(accountArr.length && accountMoneyArr.length) { + $("#AccountId").attr("data-accountArr",JSON.stringify(accountArr)).attr("data-accountMoneyArr",JSON.stringify(accountMoneyArr)); //json数据存储 + } + $("#ChangeAmount").val(accountMoneyTotal); //给付款或者收款金额赋值 + $("#Debt").val((discountLastMoneyNum-accountMoneyTotal).toFixed(2)); //本次欠款 + $("#depotHeadAccountDlg").dialog('close'); + }); + + //取消事件 + function cancelFun(){ + if($("#AccountId").attr("data-accountArr")){ + $("#depotHeadAccountDlg").dialog('close'); + } + else { + $("#depotHeadAccountDlg").dialog('close'); + $("#AccountId").val("").removeAttr("data-accountArr").removeAttr("data-accountMoneyArr"); //将下拉置空并把缓存参数清空 + $("#ChangeAmount").removeProp("readonly","readonly"); + $(".many-account-ico").hide(); //隐藏多账户小图标 + } + } + //多账户-取消按钮 + $("#cancelDepotHeadAccountDlg").off("click").on("click", function(){ + cancelFun(); + }); + + //多账户-右上角的关闭按钮 + $("#depotHeadAccountDlg").prev().find(".panel-tool-close").off("click").on("click", function(){ + cancelFun(); + }); + } + //点击多账户,弹出输入框 + $("#AccountId").off("change").on("change",function(){ + var selectText = $(this).children('option:selected').text(); + if(selectText === "多账户"){ + $("#ChangeAmount").prop("readonly","readonly"); + depotHeadAccountDlgFun(); + $(".many-account-ico").show(); //显示多账户小图标 + } + else{ + $(this).removeAttr("data-accountArr").removeAttr("data-accountMoneyArr"); //将下拉置空并把缓存参数清空 + $("#ChangeAmount").removeProp("readonly","readonly"); + $(".many-account-ico").hide(); //隐藏多账户小图标 + } + }); + + //结算账户-多账户小图标-点击事件 + $(".many-account-ico").off("click").on("click",function(){ + depotHeadAccountDlgFun(); + //给弹窗赋值-多账户数据 + var accountArr = $("#AccountId").attr("data-accountArr"); + accountArr = JSON.parse(accountArr); + var accountMoneyArr = $("#AccountId").attr("data-accountMoneyArr"); + accountMoneyArr = JSON.parse(accountMoneyArr); + $("#depotHeadAccountDlg .account-dlg .account-content-tmp").each(function(){ + var index = $(this).attr("data-index"); + $(this).find(".account-id-dlg").val(accountArr[index]); + $(this).find(".account-money-dlg").val(accountMoneyArr[index]); + }); + $("#accountMoneyTotalDlg").text($("#ChangeAmount").val()); + }); + + //点击采购费用、销售费用的事件 + $(".other-money-ico").off("click").on("click",function(){ + $('#otherMoneyDlg').dialog('open').dialog('setTitle',' '+ listSubType +'费用'); + $("#otherMoneyDlg .money-dlg .money-content-tmp").remove(); //先移除输入栏目 + $("#otherMoneyTotalDlg").text(0); //将合计初始化为0 + for(var i=0; i<6; i++) { + $("#otherMoneyDlg .tabs-tmp .money-content-tmp").attr("data-index",5-i); //添加索引 + var contentTmp = $("#otherMoneyDlg .tabs-tmp tbody").html(); + var moneyDlgHead = $("#otherMoneyDlg .money-head-tmp"); + moneyDlgHead.after(contentTmp); + } + + //获取支出项目信息 + function moneyDlgFun() { + var options = ""; + if(outItemList !=null){ + for(var i = 0 ;i < outItemList.length;i++) { + var money = outItemList[i]; + options += ''; + } + $(".money-id-dlg").empty().append("").append(options); + } + } + moneyDlgFun(); //获取支出项目信息 + $("#otherMoneyDlg .tabs-tmp").hide(); //隐藏模板 + + //支出项目的金额输入框事件 + $("#otherMoneyDlg .money-dlg .other-money-dlg").off("keyup").on("keyup",function(){ + var totalMoneyNum = 0; + $("#otherMoneyDlg .money-dlg .money-content-tmp").each(function(){ + var eachOtherMoney = $(this).find(".other-money-dlg").val()-0; + totalMoneyNum += eachOtherMoney; + }); + $("#otherMoneyTotalDlg").text(totalMoneyNum); + }); + + //支出项目列表的切换事件 + $("#otherMoneyDlg .money-dlg .money-id-dlg").off("change").on("change",function(){ + var selectItem = $(this).children('option:selected').text(); + if(selectItem === ""){ + var thisMoneyDom = $(this).closest(".money-content-tmp").find(".other-money-dlg"); + var thisMoney = thisMoneyDom.val()-0; + var otherMoneyTotal = $("#otherMoneyTotalDlg").text() - 0; + $("#otherMoneyTotalDlg").text(otherMoneyTotal - thisMoney); + thisMoneyDom.val(""); //支出项目为空时候,将金额也置为空 + } + }); + + //保存按钮事件 + $("#saveOtherMoneyDlg").off("click").on("click", function(){ + //完成支出项目的json数据存储 + var itemArr = []; //支出项目id数组 + var itemMoneyArr = []; //支出项目金额数组 + var errorIndex = -1; + $("#otherMoneyDlg .money-dlg .money-content-tmp").each(function(){ + var thisId = $(this).find(".money-id-dlg").val(); + var thisMoney = $(this).find(".other-money-dlg").val(); + if(!thisId && thisMoney) { + errorIndex = $(this).attr("data-index")-0; + return; + } + if(thisId && !thisMoney) { + errorIndex = $(this).attr("data-index")-0; + return; + } + if(thisId && thisMoney) { + itemArr.push(thisId); + itemMoneyArr.push(thisMoney); + } + }); + if(errorIndex >-1){ + $.messager.alert('错误提示',"第" + (errorIndex+1) + "行数据存在问题,请修改",'warning'); + return; + } + var otherMoneyTotal = $("#otherMoneyTotalDlg").text()-0; //合计金额 + if(otherMoneyTotal === 0){ //0的时候清空缓存数据 + $("#OtherMoney").removeAttr("data-itemArr").removeAttr("data-itemMoneyArr"); + } + if(itemArr.length && itemMoneyArr.length) { + $("#OtherMoney").attr("data-itemArr",JSON.stringify(itemArr)).attr("data-itemMoneyArr",JSON.stringify(itemMoneyArr)); //json数据存储 + } + $("#OtherMoney").val(otherMoneyTotal); //给采购费用、销售费用赋值 + $("#otherMoneyDlg").dialog('close'); + }); + + //取消事件 + function cancelFun(){ + if($("#OtherMoney").attr("data-itemArr")){ + $("#otherMoneyDlg").dialog('close'); + } + else { + $("#otherMoneyDlg").dialog('close'); + $("#OtherMoney").val("").removeAttr("data-itemArr").removeAttr("data-itemMoneyArr"); //将下拉置空并把缓存参数清空 + } + } + //费用-取消按钮 + $("#cancelOtherMoneyDlg").off("click").on("click", function(){ + cancelFun(); + }); + + //费用-右上角的关闭按钮 + $("#otherMoneyDlg").prev().find(".panel-tool-close").off("click").on("click", function(){ + cancelFun(); + }); + + //给弹窗赋值-采购费用、销售费用数据 + var itemArr = $("#OtherMoney").attr("data-itemArr"); + itemArr = JSON.parse(itemArr); + var itemMoneyArr = $("#OtherMoney").attr("data-itemMoneyArr"); + itemMoneyArr = JSON.parse(itemMoneyArr); + $("#otherMoneyDlg .money-dlg .money-content-tmp").each(function(){ + var index = $(this).attr("data-index"); + $(this).find(".money-id-dlg").val(itemArr[index]); + if(itemMoneyArr[index]!="undefined"){ + $(this).find(".other-money-dlg").val(itemMoneyArr[index]); + } + }); + $("#otherMoneyTotalDlg").text($("#OtherMoney").val()); + }); + + if(listTitle === "采购入库列表"){ + //检查单位名称是否存在 ++ 重名无法提示问题需要跟进 + function checkSupplierName() { + var supplierName = $.trim($("#supplier").val()); + var orgSupplier = ""; + //表示是否存在 true == 存在 false = 不存在 + var flag = false; + //开始ajax名称检验,不能重名 + if(supplierName.length > 0 &&( orgSupplier.length ==0 || supplierName != orgSupplier)) + { + $.ajax({ + type:"post", + url: path + "/supplier/checkIsNameExist.action", + dataType: "json", + async : false, + data: ({ + supplierID : 0, + supplier : supplierName + }), + success: function (tipInfo) + { + flag = tipInfo; + if(tipInfo) + { + $.messager.alert('提示','单位名称已经存在','info'); + return; + } + }, + //此处添加错误处理 + error:function() + { + $.messager.alert('提示','检查单位名称是否存在异常,请稍后再试!','error'); + return; + } + }); + } + return flag; + } + //保存供应商信息 + $("#saveSupplier").off("click").on("click",function() { + if(checkSupplierName()){ + return; + } + var reg = /^([0-9])+$/; + var phonenum = $.trim($("#phonenum").val()); + if(phonenum.length>0 && !reg.test(phonenum)) + { + $.messager.alert('提示','电话号码只能是数字','info'); + $("#phonenum").val("").focus(); + return; + } + var beginNeedGet = $.trim($("#BeginNeedGet").val()); + var beginNeedPay = $.trim($("#BeginNeedPay").val()); + if(beginNeedGet && beginNeedPay) { + $.messager.alert('提示','期初应收和期初应付不能同时输入','info'); + return; + } + var url = path + '/supplier/create.action'; + $.ajax({ + url: url, + type:"post", + dataType: "json", + data:{ + supplier:$("#supplier").val(), + type: "供应商", + contacts:$("#contacts").val(), + phonenum:$("#phonenum").val(), + telephone:$("#telephone").val(), + email:$("#email").val(), + address:$("#address").val(), + fax:$("#fax").val(), + BeginNeedGet:$("#BeginNeedGet").val(), + BeginNeedPay:$("#BeginNeedPay").val(), + taxNum:$("#taxNum").val(), + taxRate:$("#taxRate").val(), + bankName:$("#bankName").val(), + accountNumber:$("#accountNumber").val(), + description:$("#description").val(), + enabled:1, + clientIp: clientIp + }, + success: function(res) { + if (res) { + $('#supplierDlg').dialog('close'); + initSupplier(); //刷新供应商 + } + } + }); + }); + } } - function showDepotHeadDetails(pageNo,pageSize){ var ProjectId = null; @@ -1300,8 +2383,6 @@ url: path + "/depotHead/findBy.action", dataType: "json", data: ({ - ProjectId: ProjectId, - DepotIds: depotString, Type: listType, SubType:listSubType, State:$.trim($("#searchState").val()), @@ -1332,24 +2413,44 @@ var footer =$("#depotHeadFM .datagrid-footer"); var input = ".datagrid-editable-input"; //点击商品下拉框,自动加载数量、单价、金额 + body.find("[field='Stock']").find(input).prop("readonly","readonly"); + //点击库存文本框,字段计算库存 + body.find("[field='Stock']").find(input).off("click").on("click",function(){ + var depotId = body.find("[field='DepotId']").find(".combo-value").val(); + var mId = body.find("[field='MaterialId']").find(".combo-value").val(); + var monthTime = getNowFormatMonth(); + if(depotId && mId){ + var ratio = body.find("[field='Unit']").find(input).attr("data-ratio"); + body.find("[field='Stock']").find(input).prop("readonly","readonly"); + //在新增的时候,这个ratio有值;在编辑的时候,这个ratio为undefined + findStockNumById(depotId, mId, monthTime, body, input,ratio); + } + else{ + body.find("[field='Stock']").find(input).val(0).attr("data-stock",0); //加载库存数据 + } + }); + //修改数量,自动计算金额和合计,另外计算含税单价、税额、价税合计 + body.find("[field='OperNumber']").find(input).off("keyup").on("keyup",function(){ + var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价 + var taxRate = body.find("[field='TaxRate']").find(input).val(); //税率 + var OperNumber =$(this).val()-0; //数量 + body.find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); //金额 + body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价 + body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额 + body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计 + statisticsFun(body,UnitPrice,OperNumber,footer,taxRate); + }); //修改单价,自动计算金额和合计 body.find("[field='UnitPrice']").find(input).off("keyup").on("keyup",function(){ var UnitPrice =$(this).val()-0; //单价 - var TotalPrice = 0; - var OperNumber = body.find("[field='OperNumber']").find(input).val(); //数量 - body.find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); - body.find("[field='AllPrice']").each(function(){ - if($(this).find("div").text()!==""){ - TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString()); - } - }); - TotalPrice = TotalPrice + UnitPrice*OperNumber; - footer.find("[field='AllPrice']").find("div").text((TotalPrice).toFixed(2)); - if(listSubType == "零售" || listSubType == "零售退货") { - $("#ChangeAmount, #getAmount").val((TotalPrice).toFixed(2)); - $("#backAmount").val(0); - } + var taxRate = body.find("[field='TaxRate']").find(input).val(); //税率 + var OperNumber = body.find("[field='OperNumber']").find(input).val(); //数量 + body.find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); //金额 + body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价 + body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额 + body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计 + statisticsFun(body,UnitPrice,OperNumber,footer,taxRate); }); //点击单价,自动提示参考价格列表 body.find("[field='UnitPrice']").find(input).off("click").on("click",function(){ @@ -1408,42 +2509,72 @@ }); } }); - //修改数量,自动计算金额和合计 - body.find("[field='OperNumber']").find(input).off("keyup").on("keyup",function(){ - var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价 - var TotalPrice = 0; - var OperNumber =$(this).val()-0; //数量 - body.find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); - body.find("[field='AllPrice']").each(function(){ - if($(this).find("div").text()!==""){ - TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString()); - } - }); - TotalPrice = TotalPrice + UnitPrice*OperNumber; - footer.find("[field='AllPrice']").find("div").text((TotalPrice).toFixed(2)); - if(listSubType == "零售" || listSubType == "零售退货") { - $("#ChangeAmount, #getAmount").val((TotalPrice).toFixed(2)); - $("#backAmount").val(0); - } - }); - //修改金额,自动计算单价和合计 + //修改含税单价,自动计算单价、金额、税额、价税合计和合计 + body.find("[field='TaxUnitPrice']").find(input).off("keyup").on("keyup",function(){ + var TaxUnitPrice =$(this).val()-0; //含税单价 + var taxRate = body.find("[field='TaxRate']").find(input).val(); //税率 + var UnitPrice = TaxUnitPrice/(1+taxRate/100); //计算单价 + body.find("[field='UnitPrice']").find(input).val((UnitPrice).toFixed(2)); //单价 + var OperNumber = body.find("[field='OperNumber']").find(input).val(); //数量 + body.find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); //金额 + body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额 + body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计 + statisticsFun(body,UnitPrice,OperNumber,footer,taxRate); + }); + //修改金额,自动计算单价、税额、价税合计和合计 body.find("[field='AllPrice']").find(input).off("keyup").on("keyup",function(){ var OperNumber = body.find("[field='OperNumber']").find(input).val(); //数量 - var TotalPrice = 0; + var taxRate = body.find("[field='TaxRate']").find(input).val(); //税率 var AllPrice =$(this).val()-0; //金额 - body.find("[field='UnitPrice']").find(input).val((AllPrice/OperNumber).toFixed(2)); - body.find("[field='AllPrice']").each(function(){ - if($(this).find("div").text()!==""){ - TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString()); - } - }); - TotalPrice = TotalPrice + AllPrice; - footer.find("[field='AllPrice']").find("div").text((TotalPrice).toFixed(2)); - if(listSubType == "零售" || listSubType == "零售退货") { - $("#ChangeAmount, #getAmount").val((TotalPrice).toFixed(2)); - $("#backAmount").val(0); - } + var UnitPrice = (AllPrice/OperNumber).toFixed(2); + body.find("[field='UnitPrice']").find(input).val(UnitPrice); //单价 + body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价 + body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额 + body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计 + statisticsFun(body,UnitPrice,OperNumber,footer,taxRate); }); + //修改税率,自动计算含税单价、税额、价税合计和合计 + body.find("[field='TaxRate']").find(input).off("keyup").on("keyup",function(){ + var taxRate =$(this).val()-0; //税率 + var OperNumber = body.find("[field='OperNumber']").find(input).val(); //数量 + var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价 + body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价 + body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额 + body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计 + statisticsFun(body,UnitPrice,OperNumber,footer,taxRate); + }); + //修改税额,自动计算税率、含税单价、价税合计和合计 + body.find("[field='TaxMoney']").find(input).off("keyup").on("keyup",function(){ + var taxMoney =$(this).val()-0; //税额 + var AllPrice = body.find("[field='AllPrice']").find(input).val(); //金额 + var taxRate = taxMoney/AllPrice*100; //税率 + var OperNumber = body.find("[field='OperNumber']").find(input).val(); //数量 + var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价 + body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价 + body.find("[field='TaxRate']").find(input).val((taxRate).toFixed(2)); //税率 + body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计 + statisticsFun(body,UnitPrice,OperNumber,footer,taxRate); + }); + //修改价税合计,自动计算税率、含税单价、税额和合计 + body.find("[field='TaxLastMoney']").find(input).off("keyup").on("keyup",function(){ + var taxLastMoney =$(this).val()-0; //价税合计 + var AllPrice = body.find("[field='AllPrice']").find(input).val(); //金额 + var taxRate = (taxLastMoney-AllPrice)/AllPrice*100; //税率 + var OperNumber = body.find("[field='OperNumber']").find(input).val(); //数量 + var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价 + body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价 + body.find("[field='TaxRate']").find(input).val((taxRate).toFixed(2)); //税率 + body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额 + statisticsFun(body,UnitPrice,OperNumber,footer,taxRate); + }); + + //加载税率 + if(thisTaxRate) { + body.find("[field='TaxRate']").find(input).val(thisTaxRate); + } + else { + body.find("[field='TaxRate']").find(input).val(0); //默认为0 + } },500); } @@ -1451,8 +2582,13 @@ function endEditing() { if (editIndex == undefined) { return true } if ($('#materialData').datagrid('validateRow', editIndex)) { - var ed = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialId'}); - var MaterialName = $(ed.target).combobox('getText'); + //仓库信息 + var edDepot = $('#materialData').datagrid('getEditor', {index:editIndex,field:'DepotId'}); + var DepotName = $(edDepot.target).combobox('getText'); + $('#materialData').datagrid('getRows')[editIndex]['DepotName'] = DepotName; + //商品信息 + var edMaterial = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialId'}); + var MaterialName = $(edMaterial.target).combobox('getText'); $('#materialData').datagrid('getRows')[editIndex]['MaterialName'] = MaterialName; $('#materialData').datagrid('endEdit', editIndex); editIndex = undefined; @@ -1499,7 +2635,7 @@ var row = $('#materialData').datagrid('getRows'); var totalRowNum = ""; for (var i = 0; i < row.length; i++) { - if (row[i].MaterialId == "") { + if (row[i].MaterialId == "" || row[i].OperNumber == "" || row[i].UnitPrice == "" || row[i].AllPrice == "") { totalRowNum += (i + 1) + "、"; } } @@ -1511,12 +2647,13 @@ return true; } //保存 - function accept(accepId) { + function accept(accepId,fun) { append(); removeit(); if ($("#materialData").datagrid('getChanges').length) { - if (!CheckData()) - return false; + if (!CheckData()) { + return; + } var inserted = $("#materialData").datagrid('getChanges', "inserted"); var deleted = $("#materialData").datagrid('getChanges', "deleted"); var updated = $("#materialData").datagrid('getChanges', "updated"); @@ -1535,16 +2672,21 @@ if (tipInfo) { $.messager.alert('提示','保存成功!','info'); } - else - $.messager.alert('提示','保存失败!','error'); - + else { + $.messager.alert('提示', '保存失败!', 'error'); + } + fun && fun(); }, error: function (XmlHttpRequest, textStatus, errorThrown) { - $.messager.alert('提示',XmlHttpRequest.responseText,'error'); + $.messager.alert('提示',XmlHttpRequest.responseText,'error'); + fun && fun(); } }); } + else { + fun && fun(); + } if (endEditing()) { $('#materialData').datagrid('acceptChanges'); } diff --git a/src/main/webapp/pages/common/menu.jsp b/src/main/webapp/pages/common/menu.jsp index 0b37f43f..926630fe 100644 --- a/src/main/webapp/pages/common/menu.jsp +++ b/src/main/webapp/pages/common/menu.jsp @@ -20,7 +20,8 @@ @@ -39,6 +40,7 @@ var kid=null; var lei=null; var last=""; var functions=""; +var btnStrList = []; //按钮权限列表 //初始化界面 $(function() @@ -86,26 +88,31 @@ function initSystemData(kid,type) } //初始化页面选项卡 -function initSelectInfo(lei) -{ - - if(userBusinessList !=null) - { - if(userBusinessList.length>0) - { +function initSelectInfo(lei) { + if(userBusinessList !=null) { + if(userBusinessList.length>0) { options =userBusinessList[0].value; - if(options!="") - { + if(options!="") { options=options.substring(1,options.length-1); } - if(lei==1) - { + //app内列表赋值 + if(lei==1) { last+=options+']['; } - else if(lei==2) - { + //功能菜单列表 + else if(lei==2) { functions+=options+']['; } + //按钮权限列表 + else if(lei==3) { + var btnStr =userBusinessList[0].btnStr; + if(btnStr!=null){ + btnStr = JSON.parse(btnStr); + for(var j=0; j抱歉,您没有该权限!").appendTo("body"); - } - - } - if(functions!="") - { - functions="["+functions.substring(0,functions.length-1); - //alert(functions); - } - + var arr = options.split(']['); + for(var i in arr){ + initSystemData(arr[i],'RoleAPP'); //根据角色找app + initSelectInfo(1);//app内列表赋值 + + initSystemData(arr[i],'RoleFunctions'); //根据角色找functions + initSelectInfo(2); //功能菜单列表 + initSelectInfo(3); //查询角色对应的按钮权限 + } + if(last!="") + { + last="["+last.substring(0,last.length-1); + //alert(last); + + if(last.indexOf("["+pageid+"]")!=-1) + { + //alert("存在"); + $("#west").show(); + $("#mainPanle").show(); + $("#mm").show(); + } + else + { + //alert("不存在"); + $("div").remove(); + $("
抱歉,您没有该权限!
").appendTo("body"); + } + } + if(functions!="") + { + functions="["+functions.substring(0,functions.length-1); + //alert(functions); + } + if(btnStrList.length>0){ + window.winBtnStrList = JSON.stringify(btnStrList); //将按钮功能列表存为全局变量 + } } //测试自定义hql @@ -238,8 +246,8 @@ function ceshi() -
- 退出 +
+ jshERP官网
diff --git a/src/main/webapp/pages/manage/customer.jsp b/src/main/webapp/pages/manage/customer.jsp new file mode 100644 index 00000000..6a1c7777 --- /dev/null +++ b/src/main/webapp/pages/manage/customer.jsp @@ -0,0 +1,185 @@ +<%@page import="com.jsh.util.Tools"%> +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<% + String path = request.getContextPath(); + String clientIp = Tools.getCurrentUserIP(); +%> + + + + 客户信息 + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
名    称: + +  手机号码: + +  联系电话: + +  备        注: + +   + 查询   + 重置 +
+
+ + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称 + + 联系人 + +
手机号码 + + 电子邮箱 + +
联系电话 + + 传真 + +
期初应收 + + 期初应付 + +
累计应收 + + 累计应付 + +
纳税人识别号 + + 税率 + +
开户行 + + 账号 + +
地址 + +
备注 + +
+
+
+
+ 保存 + 取消 +
+ + +
+
+
+ + +
+
+ (预收款、期初应收、期初应付、税率均为数值且要大于0;另外期初应收、期初应付不能同时输入) +
+ + +
+ 导入 + 取消 +
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/pages/manage/depot.jsp b/src/main/webapp/pages/manage/depot.jsp index dd37038f..80c8a9f2 100644 --- a/src/main/webapp/pages/manage/depot.jsp +++ b/src/main/webapp/pages/manage/depot.jsp @@ -2,13 +2,12 @@ <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); - String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; String clientIp = Tools.getCurrentUserIP(); %> - 部门管理 + 仓库管理 @@ -28,17 +27,14 @@ 仓库名称: - +   -   - 描        述: + 描述: - +   -   -   查询   重置 @@ -57,16 +53,40 @@
- - + + + + + + + + + + + + + + + + + + - - - - - - + +
仓库名称 + +
仓库地址 + +
仓储费 +  元/天/KG +
搬运费 +  元 +
排序 + +
描述 + +
@@ -84,27 +104,7 @@ initTableData(); ininPager(); initForm(); - browserFit(); - }); - - //浏览器适配 - function browserFit() - { - if(getOs()=='MSIE') - { - $("#searchRemarkLabel").empty().append("描        述:"); - $("#nameLabel").empty().append("仓库名称  "); - $("#sortLabel").empty().append("排        序  "); - $("#remarkLabel").empty().append("描        述  "); - } - else - { - $("#searchRemarkLabel").empty().append("描    述:"); - $("#nameLabel").empty().append("仓库名称 "); - $("#sortLabel").empty().append("排    序 "); - $("#remarkLabel").empty().append("描    述 "); - } - } + }); //防止表单提交重复 function initForm() @@ -117,8 +117,7 @@ } //初始化表格数据 - function initTableData() - { + function initTableData() { $('#tableData').datagrid({ //title:'仓库列表', //iconCls:'icon-save', @@ -143,45 +142,46 @@ pageSize: initPageSize, pageList: initPageNum, columns:[[ - { field: 'id',width:35,align:"center",checkbox:true}, - { title: '仓库名称',field: 'name',width:200}, - { title: '排序',field: 'sort',width:200}, - { title: '描述',field: 'remark',width:200}, - { title: '操作',field: 'op',align:"center",width:130,formatter:function(value,rec) - { - var str = ''; - var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.sort + 'AaBb' + rec.remark; - if(1 == value) - { - str += ' 编辑  '; - str += ' 删除  '; - } - return str; - } - } + { field: 'id',width:35,align:"center",checkbox:true}, + { title: '操作',field: 'op',align:"center",width:60, + formatter:function(value,rec) { + var str = ''; + var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.sort + 'AaBb' + rec.remark + 'AaBb' + + rec.address + 'AaBb' + rec.warehousing + 'AaBb' + rec.truckage; + if(1 == value) + { + str += '   '; + str += ''; + } + return str; + } + }, + { title: '仓库名称',field: 'name',width:200}, + { title: '仓库地址',field: 'address',width:200}, + { title: '仓储费',field: 'warehousing',width:60}, + { title: '搬运费',field: 'truckage',width:60}, + { title: '排序',field: 'sort',width:60}, + { title: '描述',field: 'remark',width:120} ]], toolbar:[ { id:'addDepot', text:'增加', iconCls:'icon-add', - handler:function() - { + handler:function() { addDepot(); } - }, + },'-', { id:'deleteDepot', text:'删除', iconCls:'icon-remove', - handler:function() - { + handler:function() { batDeleteDepot(); } } ], - onLoadError:function() - { + onLoadError:function() { $.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error'); return; } @@ -189,38 +189,31 @@ } //初始化键盘enter事件 - $(document).keydown(function(event) - { + $(document).keydown(function(event) { //兼容 IE和firefox 事件 var e = window.event || event; var k = e.keyCode||e.which||e.charCode; //兼容 IE,firefox 兼容 var obj = e.srcElement ? e.srcElement : e.target; //绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题 - if(k == "13"&&(obj.id=="name"||obj.id=="sort"|| obj.id=="remark" )) - { + if(k == "13"&&(obj.id=="name"||obj.id=="sort"|| obj.id=="remark" )) { $("#saveDepot").click(); } //搜索按钮添加快捷键 - if(k == "13"&&(obj.id=="searchName" || obj.id=="searchRemark" )) - { + if(k == "13"&&(obj.id=="searchName" || obj.id=="searchRemark" )) { $("#searchBtn").click(); } }); //分页信息处理 - function ininPager() - { - try - { + function ininPager() { + try { var opts = $("#tableData").datagrid('options'); var pager = $("#tableData").datagrid('getPager'); pager.pagination({ - onSelectPage:function(pageNum, pageSize) - { + onSelectPage:function(pageNum, pageSize) { opts.pageNumber = pageNum; opts.pageSize = pageSize; - pager.pagination('refresh', - { + pager.pagination('refresh', { pageNumber:pageNum, pageSize:pageSize }); @@ -228,19 +221,15 @@ } }); } - catch (e) - { + catch (e) { $.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error'); } } //删除供应商信息 - function deleteDepot(depotID) - { - $.messager.confirm('删除确认','确定要删除此仓库信息吗?',function(r) - { - if (r) - { + function deleteDepot(depotID) { + $.messager.confirm('删除确认','确定要删除此仓库信息吗?',function(r) { + if (r) { $.ajax({ type:"post", url: "<%=path %>/depot/delete.action", @@ -249,8 +238,7 @@ depotID : depotID, clientIp:'<%=clientIp %>' }), - success: function (tipInfo) - { + success: function (tipInfo) { var msg = tipInfo.showModel.msgTip; if(msg == '成功') { @@ -261,8 +249,7 @@ $.messager.alert('删除提示','删除仓库信息失败,请稍后再试!','error'); }, //此处添加错误处理 - error:function() - { + error:function() { $.messager.alert('删除提示','删除仓库信息异常,请稍后再试!','error'); return; } @@ -272,18 +259,14 @@ } //批量删除供应商 - function batDeleteDepot() - { + function batDeleteDepot() { var row = $('#tableData').datagrid('getChecked'); - if(row.length == 0) - { + if(row.length == 0) { $.messager.alert('删除提示','没有记录被选中!','info'); return; } - if(row.length > 0) - { - $.messager.confirm('删除确认','确定要删除选中的' + row.length + '条仓库信息吗?',function(r) - { + if(row.length > 0) { + $.messager.confirm('删除确认','确定要删除选中的' + row.length + '条仓库信息吗?',function(r) { if (r) { var ids = ""; @@ -339,12 +322,10 @@ function addDepot() { $("#clientIp").val('<%=clientIp %>'); - $("#sort").val(""); - $("#remark").val(""); $('#depotDlg').dialog('open').dialog('setTitle',' 增加仓库信息'); $(".window-mask").css({ width: webW ,height: webH}); - $("#name").val("").focus(); - //$('#depotFM').form('clear'); + $('#depotFM').form('clear'); + $("#name").focus(); orgDepot = ""; depotID = 0; @@ -352,52 +333,52 @@ } //保存信息 - $("#saveDepot").unbind().bind({ - click:function() + $("#saveDepot").off("click").on("click",function() { + if(!$('#depotFM').form('validate')) + return; + else if(checkDepotName()) + return; + else { - if(!$('#depotFM').form('validate')) - return; - else if(checkDepotName()) - return; - else - { - $.ajax({ - type:"post", - url: url, - dataType: "json", - async : false, - data: ({ - name : $.trim($("#name").val()), - type : 0, - sort : $.trim($("#sort").val()), - remark : $.trim($("#remark").val()), - clientIp:'<%=clientIp %>' - }), - success: function (tipInfo) + $.ajax({ + type:"post", + url: url, + dataType: "json", + async : false, + data: ({ + name : $.trim($("#name").val()), + address: $.trim($("#address").val()), + warehousing: $.trim($("#warehousing").val()), + truckage: $.trim($("#truckage").val()), + type : 0, + sort : $.trim($("#sort").val()), + remark : $.trim($("#remark").val()), + clientIp:'<%=clientIp %>' + }), + success: function (tipInfo) + { + if(tipInfo) { - if(tipInfo) - { - $('#depotDlg').dialog('close'); - - var opts = $("#tableData").datagrid('options'); - showDepotDetails(opts.pageNumber,opts.pageSize); - } - else - { - $.messager.show({ - title: '错误提示', - msg: '保存仓库信息失败,请稍后重试!' - }); - } - }, - //此处添加错误处理 - error:function() - { - $.messager.alert('提示','保存仓库信息异常,请稍后再试!','error'); - return; + $('#depotDlg').dialog('close'); + + var opts = $("#tableData").datagrid('options'); + showDepotDetails(opts.pageNumber,opts.pageSize); } - }); - } + else + { + $.messager.show({ + title: '错误提示', + msg: '保存仓库信息失败,请稍后重试!' + }); + } + }, + //此处添加错误处理 + error:function() + { + $.messager.alert('提示','保存仓库信息异常,请稍后再试!','error'); + return; + } + }); } }); @@ -410,6 +391,9 @@ $("#name").focus().val(depotInfo[1]); $("#sort").val(depotInfo[2]); $("#remark").val(depotInfo[3]); + $("#address").val(depotInfo[4]); + $("#warehousing").val(depotInfo[5]); + $("#truckage").val(depotInfo[6]); orgDepot = depotInfo[1]; $('#depotDlg').dialog('open').dialog('setTitle',' 编辑仓库信息'); diff --git a/src/main/webapp/pages/manage/functions.jsp b/src/main/webapp/pages/manage/functions.jsp index 17f67bf9..7b2d4073 100644 --- a/src/main/webapp/pages/manage/functions.jsp +++ b/src/main/webapp/pages/manage/functions.jsp @@ -60,41 +60,47 @@ closed="true" buttons="#dlg-buttons" modal="true" cache="false" collapsible="false" closable="true"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
编号
名称
上级编号
链接
收缩
排序
启用
类型 -
编号
名称
上级编号
链接
排序
功能按钮 + +
收缩
启用
类型 +
@@ -111,6 +117,7 @@ initTableData(); ininPager(); initForm(); + bindEvent(); }); //防止表单提交重复 @@ -166,7 +173,7 @@ { var str = ''; var rowInfo = rec.Id + 'AaBb' + rec.Number+ 'AaBb' + rec.Name+ 'AaBb' + rec.PNumber+ 'AaBb' + rec.URL - + 'AaBb' + rec.State+ 'AaBb' + rec.Sort+ 'AaBb' + rec.Enabled+ 'AaBb' + rec.Type; + + 'AaBb' + rec.State+ 'AaBb' + rec.Sort+ 'AaBb' + rec.Enabled+ 'AaBb' + rec.Type + 'AaBb' + rec.PushBtn; if(1 == value) { str += ' 编辑  '; @@ -249,6 +256,17 @@ $.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error'); } } + + //绑定事件 + function bindEvent(){ + $('#PushBtn').combobox({ + url: '<%=path %>/js/pages/manage/pushBtn.json', + valueField:'id', + textField:'text', + panelHeight:120, + multiple:true + }); + } //删除供应商信息 function deleteFunctions(functionsID) @@ -393,6 +411,7 @@ Sort : $.trim($("#Sort").val()), Enabled : $("#Enabled").is(':checked'), Type : $.trim($("#Type").val()), + PushBtn : $('#PushBtn').combobox('getValues').toString(), //功能按钮 clientIp:'<%=clientIp %>' }), success: function (tipInfo) @@ -437,6 +456,21 @@ $("#Sort").focus().val(functionsInfo[6]); $("#Enabled").attr("checked",functionsInfo[7]=='true'?true:false); $("#Type").focus().val(functionsInfo[8]); + if(functionsInfo[9] !== "undefined" && functionsInfo[9] !== ""){ + var arr = functionsInfo[9].split(","); + var pushBtnArray = []; + for(var i=0;i 编辑功能信息'); diff --git a/src/main/webapp/pages/manage/member.jsp b/src/main/webapp/pages/manage/member.jsp new file mode 100644 index 00000000..a9948ff2 --- /dev/null +++ b/src/main/webapp/pages/manage/member.jsp @@ -0,0 +1,185 @@ +<%@page import="com.jsh.util.Tools"%> +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<% + String path = request.getContextPath(); + String clientIp = Tools.getCurrentUserIP(); +%> + + + + 会员信息 + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
名    称: + +  手机号码: + +  联系电话: + +  备        注: + +   + 查询   + 重置 +
+
+ + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称 + + 联系人 + +
手机号码 + + 电子邮箱 + +
联系电话 + + 传真 + +
期初应收 + + 期初应付 + +
累计应收 + + 累计应付 + +
纳税人识别号 + + 税率 + +
开户行 + + 账号 + +
地址 + +
备注 + +
+
+
+
+ 保存 + 取消 +
+ + +
+
+
+ + +
+
+ (预收款、期初应收、期初应付、税率均为数值且要大于0;另外期初应收、期初应付不能同时输入) +
+ + +
+ 导入 + 取消 +
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/pages/manage/role.jsp b/src/main/webapp/pages/manage/role.jsp index 72833969..52cf45b6 100644 --- a/src/main/webapp/pages/manage/role.jsp +++ b/src/main/webapp/pages/manage/role.jsp @@ -31,7 +31,7 @@ 角色名称: - +     @@ -40,7 +40,8 @@ 查询   重置   分配应用   - 分配功能 + 分配功能   + 分配按钮 @@ -510,6 +511,16 @@ } this.href = "<%=path %>/pages/manage/roleFunctions.jsp?id=" + currentRow.Id; }); + + //分配按钮 + $('#btnSetPushBtn').click(function () { + var currentRow = $("#tableData").datagrid("getSelected"); + if (currentRow == null) { + alert("请选择一条数据再操作!"); + return false; + } + this.href = "<%=path %>/pages/manage/rolePushBtn.jsp?id=" + currentRow.Id; + }); \ No newline at end of file diff --git a/src/main/webapp/pages/manage/roleApp.jsp b/src/main/webapp/pages/manage/roleApp.jsp index 94e78558..294bf259 100644 --- a/src/main/webapp/pages/manage/roleApp.jsp +++ b/src/main/webapp/pages/manage/roleApp.jsp @@ -23,8 +23,8 @@ -
- 保存 +
+ 保存
    diff --git a/src/main/webapp/pages/manage/roleFunctions.jsp b/src/main/webapp/pages/manage/roleFunctions.jsp index 03376f02..69182ea4 100644 --- a/src/main/webapp/pages/manage/roleFunctions.jsp +++ b/src/main/webapp/pages/manage/roleFunctions.jsp @@ -23,8 +23,8 @@ -
    - 保存 +
    + 保存
      @@ -63,13 +63,12 @@ $(function () { - $('#tt').tree({ + $('#tt').tree({ url:'<%=path%>/functions/findRoleFunctions.action?UBType='+type+'&UBKeyId='+url_id, animate:true, checkbox:true - }); - - + }); + $("#btnOK").click( function() { if(!checkRoleFunctions()) diff --git a/src/main/webapp/pages/manage/rolePushBtn.jsp b/src/main/webapp/pages/manage/rolePushBtn.jsp new file mode 100644 index 00000000..efc4b6fc --- /dev/null +++ b/src/main/webapp/pages/manage/rolePushBtn.jsp @@ -0,0 +1,264 @@ +<%@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 diff --git a/src/main/webapp/pages/manage/unit.jsp b/src/main/webapp/pages/manage/unit.jsp new file mode 100644 index 00000000..7b38ad9c --- /dev/null +++ b/src/main/webapp/pages/manage/unit.jsp @@ -0,0 +1,468 @@ +<%@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 diff --git a/src/main/webapp/pages/manage/user.jsp b/src/main/webapp/pages/manage/user.jsp index 4e817cb7..b96483e7 100644 --- a/src/main/webapp/pages/manage/user.jsp +++ b/src/main/webapp/pages/manage/user.jsp @@ -46,7 +46,8 @@ 查询   重置   分配角色   - 分配仓库 + 分配仓库   + 分配客户 @@ -92,32 +93,11 @@
      - - \ No newline at end of file diff --git a/src/main/webapp/pages/manage/vendor.jsp b/src/main/webapp/pages/manage/vendor.jsp index ef8604d4..fdaecafb 100644 --- a/src/main/webapp/pages/manage/vendor.jsp +++ b/src/main/webapp/pages/manage/vendor.jsp @@ -2,13 +2,12 @@ <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); - String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; String clientIp = Tools.getCurrentUserIP(); %> - - + + - 单位信息 + 供应商信息 @@ -20,6 +19,12 @@ + + @@ -28,41 +33,24 @@ 名    称: - + -   -   - 类    型: + 手机号码: - +   -   联系电话: - + - - - 电子邮箱: +   + 备        注: - +   -   - 描        述: - - - -   -   -   查询   重置 @@ -72,572 +60,127 @@
      -
      +
      -
      -
      -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      - -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      -
      - - -
      - -
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      名称 + + 联系人 + +
      手机号码 + + 电子邮箱 + +
      联系电话 + + 传真 + +
      期初应收 + + 期初应付 + +
      累计应收 + + 累计应付 + +
      纳税人识别号 + + 税率 + +
      开户行 + + 账号 + +
      地址 + +
      备注 + +
      +
      - - + +
      +
      +
      + + +
      +
      + (预收款、期初应收、期初应付、税率均为数值且要大于0;另外期初应收、期初应付不能同时输入) +
      + + +
      + 导入 + 取消 +
      +
      +
      + \ No newline at end of file diff --git a/src/main/webapp/pages/materials/allocation_out_list.jsp b/src/main/webapp/pages/materials/allocation_out_list.jsp index bca2e33a..73c7c6fb 100644 --- a/src/main/webapp/pages/materials/allocation_out_list.jsp +++ b/src/main/webapp/pages/materials/allocation_out_list.jsp @@ -15,6 +15,7 @@ + @@ -32,21 +33,17 @@
      - -
      发货仓库: - - 单据编号: - + 单据日期: - + - - +   @@ -62,48 +59,36 @@
      -
      - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
      发货仓库: - - 单据日期: - - 经手人: - -
      收货仓库: - - 单据编号: - 单据备注: - -
      商品列表: - -
      -
      单据日期: + + 单据编号: + +
      + +
      +
      + +
      @@ -112,50 +97,37 @@ 保存 取消
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - -
      发货仓库: - - 单据日期: - - 经手人: - - -
      收货仓库: - - 单据编号: - - 单据备注: - -
      商品列表: - -
      -
      + + + + + + + + + + + + + + + + + + + +
      单据日期: + + 单据编号: + +
      + +
      +
      单据备注: + +
      \ No newline at end of file diff --git a/src/main/webapp/pages/materials/gift_out_list.jsp b/src/main/webapp/pages/materials/gift_out_list.jsp index 4614e741..a318019b 100644 --- a/src/main/webapp/pages/materials/gift_out_list.jsp +++ b/src/main/webapp/pages/materials/gift_out_list.jsp @@ -15,6 +15,7 @@ + diff --git a/src/main/webapp/pages/materials/gift_recharge_list.jsp b/src/main/webapp/pages/materials/gift_recharge_list.jsp index 4e984897..23b140bf 100644 --- a/src/main/webapp/pages/materials/gift_recharge_list.jsp +++ b/src/main/webapp/pages/materials/gift_recharge_list.jsp @@ -15,6 +15,7 @@ + diff --git a/src/main/webapp/pages/materials/material.jsp b/src/main/webapp/pages/materials/material.jsp index cab256f7..a13316df 100644 --- a/src/main/webapp/pages/materials/material.jsp +++ b/src/main/webapp/pages/materials/material.jsp @@ -2,14 +2,13 @@ <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); - String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; String clientIp = Tools.getCurrentUserIP(); %> 商品信息 - + @@ -17,6 +16,7 @@ + @@ -26,6 +26,19 @@
      + + + + + + + - -
      品名: + +  型号: + + 制造商: + + 类别: @@ -33,8 +46,6 @@     查询   重置 @@ -48,49 +59,114 @@
      -
      +
      - +
      - - + + + + + - - + + + - - + + + - - + + - + + - - - + + + + + + + + + + + + + - + + - - + + - + + - - + + +
      名称品名 + + 型号 + +
      类别 - - - - 类别 + + + + + 修改 +
      型号制造商 + + 规格
      颜色安全存量 + + 单位 + + + + 多单位 +
      零售价
      首选出库单位 + + 首选入库单位 + +
      + + + + + + + + + + + + + + + + + + + + + + + + + +
      价格列表计量单位零售价最低售价预计采购价批发价
      基本单位
      副单位
      +
      零售价 最低售价
      预设售价一
      预计采购价 预设售价二批发价
      备注备注
      @@ -100,7 +176,32 @@ 保存 取消
      - + + +
      + +
      + + +
      +
      + (多单位清空下,价格请用斜线隔开) +
      + + +
      + 导入 + 取消 +
      + +
      diff --git a/src/main/webapp/pages/materials/materialcategory.jsp b/src/main/webapp/pages/materials/materialcategory.jsp index 738a3601..553d9619 100644 --- a/src/main/webapp/pages/materials/materialcategory.jsp +++ b/src/main/webapp/pages/materials/materialcategory.jsp @@ -26,6 +26,11 @@
      + + + - -
      名称: + +   类别: @@ -33,8 +38,6 @@     查询   重置 @@ -277,6 +280,7 @@ addMaterialCategory(); } }, + '-', { id:'deleteMaterialCategory', text:'删除', @@ -309,7 +313,7 @@ $("#saveMaterialCategory").click(); } //搜索按钮添加快捷键 - if(k == "13"&&(obj.id=="searchParentId")) + if(k == "13"&&(obj.id=="searchParentId"||(obj.id=="searchName"))) { $("#searchBtn").click(); } @@ -570,6 +574,7 @@ url: "<%=path %>/materialCategory/findBy.action", dataType: "json", data: ({ + Name: $.trim($("#searchName").val()), ParentId:parent, pageNo:pageNo, pageSize:pageSize diff --git a/src/main/webapp/pages/materials/other_in_list.jsp b/src/main/webapp/pages/materials/other_in_list.jsp index 42d1308d..7a6d2ddd 100644 --- a/src/main/webapp/pages/materials/other_in_list.jsp +++ b/src/main/webapp/pages/materials/other_in_list.jsp @@ -15,6 +15,7 @@ + @@ -32,21 +33,17 @@
      - -
      收货仓库: - - 单据编号: - + 单据日期: - + - - +   @@ -62,49 +59,44 @@
      -
      - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
      收货仓库: - - 单据日期: - - 往来单位: - -
      经手人: - - 单据编号: - - 单据备注: - -
      商品列表: - -
      -
      供应商: +
      + +
      +
      + 增加供应商 +
      +
      单据日期: + + 单据编号: + + +
      + +
      +
      + +
      @@ -113,49 +105,39 @@ 保存 取消
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - -
      收货仓库: - - 单据日期: - - 往来单位: - -
      经手人: - - 单据编号: - - 单据备注: - -
      商品列表: - -
      -
      + + + + + + + + + + + + + + + + + + + +
      供应商: + + 单据日期: + + 单据编号: + +
      + +
      +
      单据备注: + +
      diff --git a/src/main/webapp/pages/materials/other_out_list.jsp b/src/main/webapp/pages/materials/other_out_list.jsp index 07318857..b344f2ec 100644 --- a/src/main/webapp/pages/materials/other_out_list.jsp +++ b/src/main/webapp/pages/materials/other_out_list.jsp @@ -15,6 +15,7 @@ + @@ -32,21 +33,17 @@
      - -
      发货仓库: - - 单据编号: - + 单据日期: - + - - +   @@ -62,48 +59,39 @@
      -
      - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
      发货仓库: - - 单据日期: - - 往来单位: - -
      经手人: - - 单据编号: - 单据备注: - -
      商品列表: - -
      -
      客户: + + 单据日期: + + 单据编号: + + +
      + +
      +
      + +
      @@ -112,49 +100,38 @@ 保存 取消
      -
      - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
      发货仓库: - - 单据日期: - - 往来单位: - - -
      经手人: - - 单据编号: - - 单据备注: - -
      商品列表: - -
      -
      客户: + + 单据日期: + + 单据编号: + +
      + +
      +
      单据备注: + +
      diff --git a/src/main/webapp/pages/materials/person.jsp b/src/main/webapp/pages/materials/person.jsp index 8939e462..825dc4f6 100644 --- a/src/main/webapp/pages/materials/person.jsp +++ b/src/main/webapp/pages/materials/person.jsp @@ -34,6 +34,7 @@
      @@ -63,6 +64,7 @@ diff --git a/src/main/webapp/pages/materials/purchase_back_list.jsp b/src/main/webapp/pages/materials/purchase_back_list.jsp index 758100c6..8610a06d 100644 --- a/src/main/webapp/pages/materials/purchase_back_list.jsp +++ b/src/main/webapp/pages/materials/purchase_back_list.jsp @@ -15,6 +15,7 @@ + @@ -32,21 +33,17 @@
      - -
      发货仓库: - - 单据编号: - + 单据日期: - + - - +   @@ -62,53 +59,84 @@
      -
      - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      发货仓库: - - 单据日期: - - 收货单位: - - 经手人: - -
      收款账户: - - 收款金额: - - 单据编号: - - 单据备注: - -
      商品列表: - -
      -
      供应商: +
      + +
      +
      + 增加供应商 +
      +
      单据日期: + + 单据编号: + + +
      + +
      +
      + +
      优惠率: + + % + 退款优惠: + + 优惠后金额: + + 本次退款: + +
      结算账户: + + + 本次欠款: + + 采购费用: + + + +
      @@ -117,53 +145,222 @@ 保存 取消
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - -
      发货仓库: - - 单据日期: - - 收货单位: - - 经手人: - -
      收款账户: - - 收款金额: - - 单据编号: - - 单据备注: - -
      商品列表: - -
      -
      -
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      供应商: + + 单据日期: + + 单据编号: + +
      + +
      +
      单据备注: + +
      优惠率: + + % + 付款优惠: + + 优惠后金额: + + 本次付款: + +
      结算账户: + + 本次欠款: + + 采购费用: + + +
      + +
      + + + + + + + + + + + + + + + + + + +
      +
      +
      + 保存 + 取消 +
      +
      + + + + + + + + + + + +
      结算账户金额
      合计:
      + + + + + + +
      +
      +
      + 保存 + 取消 +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      名称 + + 联系人 + +
      联系电话 + + 手机 + +
      电子邮箱 + + 传真 + +
      期初应收 + + 期初应付 + +
      累计应收 + + 累计应付 + +
      纳税人识别号 + + 税率 + +
      开户行 + + 账号 + +
      地址 + +
      备注 + +
      +
      +
      +
      + 保存 + 取消 +
      diff --git a/src/main/webapp/pages/materials/purchase_in_list.jsp b/src/main/webapp/pages/materials/purchase_in_list.jsp index f1ad230e..3bff6e69 100644 --- a/src/main/webapp/pages/materials/purchase_in_list.jsp +++ b/src/main/webapp/pages/materials/purchase_in_list.jsp @@ -15,6 +15,7 @@ + @@ -32,21 +33,17 @@
      - -
      收货仓库: - - 单据编号: - + 单据日期: - + - - +   @@ -62,53 +59,85 @@
      -
      - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      收货仓库: - - 单据日期: - - 供货单位: - - 经手人: - -
      付款账户: - - 付款金额: - - 单据编号: - - 单据备注: - -
      商品列表: - -
      -
      供应商: +
      + +
      +
      + 增加供应商 +
      +
      单据日期: + + 单据编号: + + +
      + +
      +
      + +
      优惠率: + + % + 付款优惠: + + 优惠后金额: + + 本次付款: + +
      结算账户: + + + 本次欠款: + + 采购费用: + + + 结算天数: + +
      @@ -117,53 +146,223 @@ 保存 取消
      -
      - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      收货仓库: - - 单据日期: - - 供货单位: - - 经手人: - -
      付款账户: - - 付款金额: - - 单据编号: - - 单据备注: - -
      商品列表: - -
      -
      供应商: + + 单据日期: + + 单据编号: + +
      + +
      +
      单据备注: + +
      优惠率: + + % + 付款优惠: + + 优惠后金额: + + 本次付款: + +
      结算账户: + + 本次欠款: + + 采购费用: + + 结算天数: + +
      +
      + + + + + + + + + + + + + + + + + + +
      +
      +
      + 保存 + 取消 +
      +
      + + + + + + + + + + + +
      结算账户金额
      合计:
      + + + + + + +
      +
      +
      + 保存 + 取消 +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      名称 + + 联系人 + +
      联系电话 + + 手机 + +
      电子邮箱 + + 传真 + +
      期初应收 + + 期初应付 + +
      累计应收 + + 累计应付 + +
      纳税人识别号 + + 税率 + +
      开户行 + + 账号 + +
      地址 + +
      备注 + +
      +
      +
      +
      + 保存 + 取消 +
      diff --git a/src/main/webapp/pages/materials/retail_back_list.jsp b/src/main/webapp/pages/materials/retail_back_list.jsp index 0fc1d03f..3e3c6943 100644 --- a/src/main/webapp/pages/materials/retail_back_list.jsp +++ b/src/main/webapp/pages/materials/retail_back_list.jsp @@ -15,7 +15,7 @@ - + @@ -29,81 +29,143 @@ - -
      - - - - - - - - - - - - - -
      发货仓库: - - 单据编号: - - 单据日期: - - - - -   - 查询  - 重置 -
      -
      - - -
      -
      -
      - -
      -
      - + +
      +
      - - - - - - + + + + +
      会员卡号: - - 收货仓库: - - 单据编号: - + + 单据日期: - + + + - + +   + 查询  + 重置
      +
      + + +
      +
      +
      + +
      + + + + + + + + + + + + + + + + + + + +
      会员卡号: + + 单据日期: + + 单据编号: + +
      + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + +
      实付金额
      + +
      付款金额
      + +
      找零
      + +
      付款账户: + + +
      +
      + +
      + + +
      +
      + 保存 + 取消 +
      +
      + - - + + + + + + + + + +
      单据备注: - + 会员卡号: + + 单据日期: + + 单据编号: + +
      -
      +
      - +
      @@ -111,7 +173,7 @@ @@ -119,106 +181,24 @@ - - - - -
      实付金额
      - +
      - +
      - +
      付款账户: - -
      经手人: - + +
      + +
      - - -
      -
      - 保存 - 取消 -
      -
      - - - - - - - - - - - - - - - - - - - -
      会员卡号: - - 发货仓库: - - 单据编号: - - 单据日期: - -
      单据备注: - -
      - -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      实收金额
      - -
      收款金额
      - -
      找零
      - -
      收款账户: - -
      经手人: - -
      -
      -
      + \ No newline at end of file diff --git a/src/main/webapp/pages/materials/retail_out_list.jsp b/src/main/webapp/pages/materials/retail_out_list.jsp index 796ce06a..90c2282e 100644 --- a/src/main/webapp/pages/materials/retail_out_list.jsp +++ b/src/main/webapp/pages/materials/retail_out_list.jsp @@ -15,7 +15,7 @@ - + @@ -33,21 +33,17 @@
      - - + + +
      发货仓库: - - 单据编号: - + 单据日期: - + - - +   @@ -63,42 +59,32 @@
      -
      - - + - + - + - - - - - - - - + - @@ -131,18 +117,18 @@ - - - -
      会员卡号: - + 会员卡号: + 发货仓库:单据日期: - + 单据编号:单据编号: - + 单据日期: - -
      单据备注: - - 付款类型: - 付款类型: +
      +
      收款账户: - -
      经手人: - + +
      + +
      @@ -151,84 +137,99 @@ 保存 取消
      -
      - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
      会员卡号: - - 发货仓库: - - 单据编号: - - 单据日期: - -
      单据备注: - - 付款类型: - -
      - -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      实收金额
      - -
      收款金额
      - -
      找零
      - -
      收款账户: - -
      经手人: - -
      -
      会员卡号: + + 单据日期: + + 单据编号: + + 付款类型: + +
      + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + +
      实收金额
      + +
      收款金额
      + +
      找零
      + +
      收款账户: + +
      +
      + +
      +
      + + + + + + + + + + + + + + + + + + +
      +
      +
      + 保存 + 取消 +
      \ No newline at end of file diff --git a/src/main/webapp/pages/materials/sale_back_list.jsp b/src/main/webapp/pages/materials/sale_back_list.jsp index d3163859..874f2150 100644 --- a/src/main/webapp/pages/materials/sale_back_list.jsp +++ b/src/main/webapp/pages/materials/sale_back_list.jsp @@ -15,6 +15,7 @@ + @@ -32,21 +33,17 @@
      - -
      收货仓库: - - 单据编号: - + 单据日期: - + - - +   @@ -62,53 +59,80 @@
      -
      - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      收货仓库: - - 单据日期: - - 退货单位: - - 经手人: - -
      付款账户: - - 付款金额: - - 单据编号: - - 单据备注: - -
      商品列表: - -
      -
      客户: + + 销售人员: + + 单据日期: + + 单据编号: + +
      + +
      +
      + +
      优惠率: + + % + 退款优惠: + + 优惠后金额: + + 本次退款: + +
      结算账户: + + + 本次欠款: + + 销售费用: + + + +
      @@ -117,53 +141,131 @@ 保存 取消
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - -
      收货仓库: - - 单据日期: - - 退货单位: - - 经手人: - -
      付款账户: - - 付款金额: - - 单据编号: - - 单据备注: - -
      商品列表: - -
      -
      -
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      客户: + + 销售人员: + + 单据日期: + + 单据编号: + +
      + +
      +
      单据备注: + +
      优惠率: + + % + 退款优惠: + + 优惠后金额: + + 本次退款: + +
      结算账户: + + 本次欠款: + + 销售费用: + + +
      + +
      + + + + + + + + + + + + + + + + + + +
      +
      +
      + 保存 + 取消 +
      +
      + + + + + + + + + + + +
      结算账户金额
      合计:
      + + + + + + +
      +
      +
      + 保存 + 取消 +
      \ No newline at end of file diff --git a/src/main/webapp/pages/materials/sale_out_list.jsp b/src/main/webapp/pages/materials/sale_out_list.jsp index 27d93148..47073079 100644 --- a/src/main/webapp/pages/materials/sale_out_list.jsp +++ b/src/main/webapp/pages/materials/sale_out_list.jsp @@ -15,6 +15,7 @@ + @@ -32,21 +33,17 @@
      - -
      发货仓库: - - 单据编号: - + 单据日期: - + - - +   @@ -62,52 +59,81 @@
      -
      - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      发货仓库: - - 单据日期: - - 购买单位: - - 经手人: - -
      收款账户: - - 收款金额: - - 单据编号: - 单据备注: - -
      商品列表: - -
      -
      客户: + + 销售人员: + + 单据日期: + + 单据编号: + +
      + +
      +
      + +
      优惠率: + + % + 收款优惠: + + 优惠后金额: + + 本次收款: + +
      结算账户: + + + 本次欠款: + + 销售费用: + + + 结算天数: + +
      @@ -116,53 +142,133 @@ 保存 取消
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - -
      发货仓库: - - 单据日期: - - 购买单位: - - 经手人: - -
      收款账户: - - 收款金额: - - 单据编号: - - 单据备注: - -
      商品列表: - -
      -
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      客户: + + 销售人员: + + 单据日期: + + 单据编号: + +
      + +
      +
      单据备注: + +
      优惠率: + + % + 收款优惠: + + 优惠后金额: + + 本次收款: + +
      结算账户: + + 本次欠款: + + 销售费用: + + 结算天数: + +
      +
      + + + + + + + + + + + + + + + + + + +
      +
      +
      + 保存 + 取消 +
      +
      + + + + + + + + + + + +
      结算账户金额
      合计:
      + + + + + + +
      +
      +
      + 保存 + 取消 +
      + \ No newline at end of file diff --git a/src/main/webapp/pages/reports/in_out_stock_report.jsp b/src/main/webapp/pages/reports/in_out_stock_report.jsp index 3c9d503a..f2bc9a5d 100644 --- a/src/main/webapp/pages/reports/in_out_stock_report.jsp +++ b/src/main/webapp/pages/reports/in_out_stock_report.jsp @@ -304,7 +304,6 @@ url: "<%=path %>/depotHead/findByMonth.action", dataType: "json", data: ({ - ProjectId: $.trim($("#searchProjectId").val()), MonthTime:$("#searchMonth").val() }), success: function (res) @@ -364,8 +363,8 @@ { if(data && data.totalCount) { var count = data.totalCount.toString(); - if(count.lastIndexOf('.')>-1) { - count = count.substring(0, count.lastIndexOf('.') + 3); + if(count.lastIndexOf('.')>-1){ + count = count.substring(0,count.lastIndexOf('.')+3); } $("#searchPanel .total-count").text("本月合计金额:" + count + "元");//本月合计金额 } diff --git a/src/main/webapp/pages/user/userCustomer.jsp b/src/main/webapp/pages/user/userCustomer.jsp new file mode 100644 index 00000000..b3d3d7d2 --- /dev/null +++ b/src/main/webapp/pages/user/userCustomer.jsp @@ -0,0 +1,136 @@ +<%@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