diff --git a/erp_web/js/pages/materials/in_out.js b/erp_web/js/pages/materials/in_out.js index 4c14f6e1..1c8ab0f2 100644 --- a/erp_web/js/pages/materials/in_out.js +++ b/erp_web/js/pages/materials/in_out.js @@ -553,26 +553,26 @@ columns:[[ { field: 'id',width:35,align:"center",checkbox:true}, { title: '操作',field: 'op',align:"center",width:opWidth, - formatter:function(value,rec) { + formatter:function(value, rec,index) { var str = ''; - var rowInfo = rec.id + 'AaBb' + rec.projectid+ 'AaBb' + rec.number+ 'AaBb' + rec.operpersonname - + 'AaBb' + rec.opertimeStr+ '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 + 'AaBb' + rec.linknumber; - rowInfo = rowInfo.replace(/\"/g, ""); - rowInfo = rowInfo.replace(/\[|]/g,""); + // var rowInfo = rec.id + 'AaBb' + rec.projectid+ 'AaBb' + rec.number+ 'AaBb' + rec.operpersonname + // + 'AaBb' + rec.opertimeStr+ '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 + 'AaBb' + rec.linknumber; + // rowInfo = rowInfo.replace(/\"/g, ""); + // rowInfo = rowInfo.replace(/\[|]/g,""); var orgId = rec.organid? rec.organid:0; - str += '   '; - str += '   '; + str += '   '; + str += '   '; str += ''; if(isShowSkip) { - str += '   '; + str += '   '; } return str; } @@ -1338,11 +1338,13 @@ } //订单转采购或销售 - function skipDepotHead(rowInfo, status){ + function skipDepotHead(index, status){ + //获取当前行 + var rowsdata = $("#tableData").datagrid("getRows")[index]; if(status == "0" || status == "2") { $.messager.alert('提示','未审核和已转的单据禁止操作!','warning'); } else { - sessionStorage.setItem("rowInfo", rowInfo); //将单据信息存入缓存中 + sessionStorage.setItem("rowInfo", JSON.stringify(rowsdata)); //将单据信息存入缓存中 if(listTitle == "采购订单列表") { parent.addTab("订单转采购", "../materials/purchase_in_list.html?t=skip", ""); } else if(listTitle == "销售订单列表") { @@ -1644,54 +1646,61 @@ } //编辑信息 - function editDepotHead(depotHeadTotalInfo, status){ + function editDepotHead(index, status){ if(status == "1" || status == "2") { $.messager.alert('编辑提示','已审核和已转的单据不能编辑!','warning'); return; } - var depotHeadInfo = depotHeadTotalInfo.split("AaBb"); - $("#ProjectId").focus().val(depotHeadInfo[1]); - var ProjectId=depotHeadInfo[1]; + // var depotHeadInfo = depotHeadTotalInfo.split("AaBb"); + //获取当前行 + var rowsdata =''; + if(Number(index).toString()=='NaN'){ + rowsdata=$.parseJSON(index); + }else{ + rowsdata=$("#tableData").datagrid("getRows")[index]; + } + $("#ProjectId").focus().val(rowsdata.projectid); + var ProjectId=rowsdata.projectid; if(ProjectId!='') { initSystemData_person(ProjectId); initSelectInfo_person(); } - var TotalPrice = depotHeadInfo[14]; //合计金额 + var TotalPrice = rowsdata.totalprice; //合计金额 if(pageType === "skip") { //从订单跳转过来 buildNumber(); //生成单据编号 var thisDateTime = getNowFormatDateTime(); //当前时间 $("#OperTime").val(thisDateTime); - $("#LinkNumber").val(depotHeadInfo[2]); //关联订单号 + $("#LinkNumber").val(rowsdata.number); //关联订单号 $("#AccountId").val(defaultAccountId); //初始化默认的账户Id $("#DiscountLastMoney").val(TotalPrice); //优惠后金额 $("#ChangeAmount").val(TotalPrice).attr("data-changeamount", TotalPrice); } else { - $("#Number").val(depotHeadInfo[2]).attr("data-defaultNumber",depotHeadInfo[2]); - $("#OperTime").val(depotHeadInfo[4]); - $("#LinkNumber").val(depotHeadInfo[28].replace("undefined","")); //关联订单号 - $("#AccountId").val(depotHeadInfo[7]); //账户Id - $("#DiscountLastMoney").val(depotHeadInfo[21].replace("undefined","0.00")); //优惠后金额 - $("#ChangeAmount").val(depotHeadInfo[8]).attr("data-changeamount", depotHeadInfo[8]); + $("#Number").val(rowsdata.number).attr("data-defaultNumber",rowsdata.number); + $("#OperTime").val(rowsdata.opertimeStr); + $("#LinkNumber").val(rowsdata.linknumber==undefined?"":rowsdata.linknumber); //关联订单号 + $("#AccountId").val(rowsdata.accountid); //账户Id + $("#DiscountLastMoney").val(rowsdata.discountlastmoney==undefined?"0.00":rowsdata.discountlastmoney); //优惠后金额 + $("#ChangeAmount").val(rowsdata.changeamount).attr("data-changeamount", rowsdata.changeamount); } - $('#OrganId').combobox('setValue', depotHeadInfo[5]=='undefined'?'':depotHeadInfo[5]); - $("#HandsPersonId").val(depotHeadInfo[6]); - $("#Remark").val(depotHeadInfo[9]); - $("#Discount").val(depotHeadInfo[19].replace("undefined","0")); - $("#DiscountMoney").val(depotHeadInfo[20].replace("undefined","0.00")); - $("#Debt").val((depotHeadInfo[21].replace("undefined","0.00")-depotHeadInfo[8]).toFixed(2)); - $("#AccountDay").val(depotHeadInfo[27].replace("undefined","")); //结算天数 - preTotalPrice = depotHeadInfo[14]; //记录前一次合计金额,用于扣预付款 - $("#AllocationProjectId").val(depotHeadInfo[15]); - oldNumber = depotHeadInfo[2]; //记录编辑前的单据编号 - oldId = depotHeadInfo[0]; //记录单据Id + $('#OrganId').combobox('setValue', rowsdata.organid==undefined?'':rowsdata.organid); + $("#HandsPersonId").val(rowsdata.handspersonid); + $("#Remark").val(rowsdata.remark); + $("#Discount").val(rowsdata.discount==undefined?"0":rowsdata.discount); + $("#DiscountMoney").val(rowsdata.discountmoney==undefined?"0.00":rowsdata.discountmoney); + $("#Debt").val(Number((rowsdata.discountlastmoney==undefined?'0.00':rowsdata.discountlastmoney-rowsdata.changeamount)).toFixed(2)); + $("#AccountDay").val(rowsdata.accountday==undefined?"":rowsdata.accountday); //结算天数 + preTotalPrice = rowsdata.totalprice; //记录前一次合计金额,用于扣预付款 + $("#AllocationProjectId").val(rowsdata.allocationprojectid); + oldNumber = rowsdata.number; //记录编辑前的单据编号 + oldId = rowsdata.id; //记录单据Id var editTitle = listTitle.replace("列表","信息"); $('#depotHeadDlg').dialog('open').dialog('setTitle',' 编辑' + editTitle); $(".window-mask").css({ width: webW ,height: webH}); - depotHeadID = depotHeadInfo[0]; + depotHeadID = rowsdata.id; if(listSubType == "零售"){ var option = ""; - if(depotHeadInfo[17] === "预付款"){ + if(rowsdata.paytype == "预付款"){ option = ''; option += ''; } @@ -1701,9 +1710,9 @@ $("#payType").empty().append(option); } - if(listSubType === "销售" || listSubType === "销售退货"){ - if(depotHeadInfo[18]){ - var arr = depotHeadInfo[18].split(","); + if(listSubType == "销售" || listSubType == "销售退货"){ + if(rowsdata.salesman){ + var arr = rowsdata.salesman.split(","); var salesmanArray = []; for(var i=0;i 查看' + showTitle); $(".window-mask").css({ width: webW ,height: webH}); - depotHeadID = depotHeadInfo[0]; + depotHeadID = rowsdata.id; initTableData_material_show(TotalPrice); //商品列表-查看状态 //零售单据展示数据 @@ -1843,8 +1854,8 @@ } } if(listSubType === "销售" || listSubType === "销售退货"){ - if(depotHeadInfo[18]){ - var arr = depotHeadInfo[18].split(","); + if(rowsdata.salesman){ + var arr = rowsdata.salesman.split(","); var salesmanStr = ""; for(var i=0;i