//Grid 对象 var commonGridObj_recvappsettlement; var comboCustomer;//委托单位 function $(id){ return document.getElementById(id); } //创建Grid function createGrid(){ //header var headerArgs_paysettlement = new Array("","申请单号","申请单状态","结算单位","结算方式","USD","RMB","申请人","申请日期","备注"); //width var widthArgs_paysettlement = new Array("40","120","70","100","70","80","80","80","150","200"); //column align var colAlignArgs_paysettlement = new Array("center","center","center","center","center","center","center","center","center","center"); //column sort var colSortArgs_paysettlement = new Array("na","str","str","str","str","str","str","str","str","str"); //column type var colTypeArgs_paysettlement = new Array("ch","ro","ro","ro","ro","ro","ro","ro","ro","ro"); commonGridObj_recvappsettlement = new TGridCommon("mygrid_container_recvsettlement","form1",headerArgs_paysettlement,widthArgs_paysettlement,colAlignArgs_paysettlement,colSortArgs_paysettlement,colTypeArgs_paysettlement); commonGridObj_recvappsettlement.setResponseUrl("RecvSettlementGridSource.aspx"); commonGridObj_recvappsettlement.setRequest("RecvSettlementGridSource.aspx?handle=recvappsettlelist&search=" + escape($("hdSearch").value.trim())); commonGridObj_recvappsettlement.setSourceType("json"); commonGridObj_recvappsettlement.setSkin("xp"); commonGridObj_recvappsettlement.setImageUrl("../images/"); commonGridObj_recvappsettlement.initGrid(); commonGridObj_recvappsettlement.bind(); commonGridObj_recvappsettlement.getGridObj().attachEvent("onRowDblClicked", function(rId,cInd){ var rId = commonGridObj_recvappsettlement.getGridObj().getSelectedRowId(); var rowIndex = commonGridObj_recvappsettlement.getGridObj().getRowIndex(rId); var billNO = commonGridObj_recvappsettlement.getGridObj().cellByIndex(rowIndex,1).getValue(); var openSet = "height=500, width=1050, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-710)/2 + ",Left= "+(screen.width-800)/2 var openType = "_blank"; var moduleName = commonGridObj_recvappsettlement.$("h_mod").value; var openUrl = "CommonRecvApplicationSettlement.aspx?id="+rId+"&billno=" + billNO + "&mod=" + moduleName; window.open (openUrl,openType,openSet); }); } function initCombo(){ createComboCustomer();//结算单位 } //结算按钮事件 function settleAction(){ var iCount = 0; if(commonGridObj_recvappsettlement != null){ var rowId = ""; var billno = ""; for(var i = 0;i 0){ for(var j=0;j0){ s2=s2+2; } var s3 = s1.substring(s2); if(s2>0){ comboCustomer.setComboText(s3); $("h_customer").value=s3; } else { comboCustomer.setComboText($("h_customer").value); } }); comboCustomer.setComboText($("h_customer").value); comboCustomer.attachEvent("onKeyPressed", function(keyCode){ if(keyCode!="8"){ var arrayArg = new Array(); setTimeout(function(){ var filterCount = 0; var is = -1; var ishd = $("h_customer").value.trim(); if("" != comboCustomer.getComboText().trim()){ while("undefined" != typeof comboCustomer.getOptionByIndex(filterCount)){ var comboValue = comboCustomer.getOptionByIndex(filterCount).text.toUpperCase();//.value; var enterValue = comboCustomer.getComboText().trim().toUpperCase(); $("h_customer").value = comboCustomer.getComboText().trim().toUpperCase(); if(comboValue.indexOf(enterValue) == 0){ comboCustomer.selectOption(filterCount,true,true); is=filterCount; break; } ++filterCount; } if(is==-1){ $("h_customer").value = ishd; alert("无此内容,请重新选择!"); } } },10); } }); comboCustomer.attachEvent("onSelectionChange", function(){ $("h_customer").value = comboCustomer.getComboText().trim(); }); } function checkAll(id){ if($(id).checked){ for(var i=0;i 0){ }else{ firstCust } payAppArg.push(commonGridObj_recvappsettlement.getGridObj().getRowId(i)); } } if(payAppArg.length > 1){ $("h_merge").value = payAppArg; $("h_enter").value = "1"; postEnterFee(); }else{ alert("合并结算操作错误,合并操作至少不能小于2条收费申请"); } } function postEnterFee(){ var myForm = document.getElementById("form1"); myForm.submit() ; } function redirectSettle(type,val){ var openSet = "height=600, width=950, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " + (screen.height - 460) / 2 + ",Left= " + (screen.width - 800) / 2 var openType = "_blank"; var openUrl = ""; if(type == 1){ //单个收费申请结算 openUrl = "DoRecvApplicationSettlement.aspx?type="+type+"&billno="+val; }else if(type == 2){ //合并收费申请结算 openUrl = "DoRecvApplicationSettlement.aspx?type="+type+"&mergecachename="+val; } window.open (openUrl,openType,openSet); } //根据条件查询收费申请信息 function search() { var _begintime = $("txt_beginDate").value.trim(); if (_begintime.trim() != "") { if (!validateDateTime(_begintime)) { alert("起始时间格式错误"); return; } } var _endtime = $("txt_endDate").value.trim(); if (_endtime.trim() != "") { if (!validateDateTime(_endtime)) { alert("结束时间格式错误"); return; } } var _customer = $("h_customer").value.trim(); var _checkno = $("txt_billno").value.trim(); var searchJson = ""; //begin searchJson += "{"; searchJson += "["; //如果查询条件设置了起始时间和结束时间则判断结束时间是否大于起始时间 if (_begintime != "" && _endtime != "") { if (_begintime.length > 9 && _endtime.length > 9) { var status = DateTimeEqual(_begintime, _endtime); if (status == 0) { searchJson += "\"btime\":\"" + _begintime + "\"," searchJson += "\"etime\":\"" + _endtime + "\"," } else if (status == -1) { alert("时间设置错误,起始时间不能大于结束时间,请修改!"); return; } // else if (status == -2) { // alert("时间设置错误,起始时间不能等于结束时间,请修改!"); // return; // } } else { alert("时间格式有问题,长度应大于9个字符,请修改!"); return; } } else { searchJson += "\"btime\":\"" + _begintime + "\"," searchJson += "\"etime\":\"" + _endtime + "\"," } searchJson += "\"cus\":\"" + _customer + "\","; searchJson += "\"no\":\"" + _checkno + "\""; searchJson += "]"; searchJson += "}"; //alert(searchJson); $("hdSearch").value = searchJson; createGrid(); } //根据条件查询收费申请信息 function clear_txt() { $("txt_beginDate").value = ""; $("txt_endDate").value = ""; $("h_customer").value = ""; comboCustomer.setComboText($("h_customer").value); $("txt_billno").value = ""; $("hdSearch").value = ""; } function auditReject() { var iCount = 0; if (commonGridObj_recvappsettlement != null) { var selGroup = new Array(); var selRowID = commonGridObj_recvappsettlement.getGridObj().getCheckedRows(0); //所有选中的grid的id编号; if (selRowID.trim() == "") { alert("您没有选择要操作的收费申请"); return; } if (selRowID.indexOf(",") > 0) { selGroup = selRowID.split(","); } else { if (selRowID != null) { selGroup.push(selRowID); } } //查看是否有被选中的费用项 if (selGroup.length > 0) { for (var i = 0; i < selGroup.length; i++) { var rowId = selGroup[i].toString(); //获取RowID //获取当前RowIndex var RowIndex = commonGridObj_recvappsettlement.getGridObj().getRowIndex(rowId); var billno = commonGridObj_recvappsettlement.getGridObj().cellByIndex(RowIndex, 1).getValue(); //异步执行操作 var url = "RecvSettlementGridSource.aspx?handle=auditreject&billno=" + billno + "&uid=" + commonGridObj_recvappsettlement.newGuid(); var loader = dhtmlxAjax.getSync(url); var postStatus = loader.xmlDoc.responseText; var status = parseInt(postStatus); switch (status) { case 1: iCount = 1; break; case -1: alert("驳回操作失败"); break; case -2: alert("您没有权限驳回收费申请"); break; case -3: alert("审核已经进入下一步,不能执行驳回操作"); break; } } } // if (iCount == 1) { alert("驳回申请操作完成"); createGrid(); } } }