//Grid 对象 var commonGridObj_payappsettlement; 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_payappsettlement = new TGridCommon("mygrid_container_paysettlement","form1",headerArgs_paysettlement,widthArgs_paysettlement,colAlignArgs_paysettlement,colSortArgs_paysettlement,colTypeArgs_paysettlement); commonGridObj_payappsettlement.setResponseUrl("PaySettlementGridSource.aspx"); commonGridObj_payappsettlement.setRequest("PaySettlementGridSource.aspx?handle=payappsettlelist&search=" + escape($("hdSearch").value.trim())); commonGridObj_payappsettlement.setSourceType("json"); commonGridObj_payappsettlement.setSkin("xp"); commonGridObj_payappsettlement.setImageUrl("../images/"); commonGridObj_payappsettlement.initGrid(); commonGridObj_payappsettlement.bind(); commonGridObj_payappsettlement.getGridObj().attachEvent("onRowDblClicked", function(rId,cInd){ var rId = commonGridObj_payappsettlement.getGridObj().getSelectedRowId(); var rowIndex = commonGridObj_payappsettlement.getGridObj().getRowIndex(rId); var billNO = commonGridObj_payappsettlement.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_payappsettlement.$("h_mod").value; var openUrl = "CommonPayApplicationSettlement.aspx?id="+rId+"&billno=" + billNO + "&mod=" + moduleName; window.open (openUrl,openType,openSet); }); } function initCombo(){ createComboCustomer();//结算单位 } //结算按钮事件 function settleAction(){ var iCount = 0; if(commonGridObj_payappsettlement != 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_payappsettlement.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 = "DoPayApplicationSettlement.aspx?type="+type+"&billno="+val; }else if(type == 2){ //合并付费申请结算 openUrl = "DoPayApplicationSettlement.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(); }