var commonGridObj_order; var commonGridObj_fee; var commonGridObj_total; var comboCustomer;//委托单位 var comboVessel;//船名 var comboVoyno;//航次 var comboBsType;//业务类型 var comboFeeName;//费用名称 var comboFeeType;//费用类型 var comboCurrency;//币别 var isLoad = 0; var sel_val = new Array; var SelectRowOplb="";//选中行的业务类别 function $(id){ return document.getElementById(id); } function createTotal(){ var headerArgs_total = new Array("币别","金额"); //width var widthArgs_total = new Array("120","150"); //column align var colAlignArgs_total = new Array("center","center"); //column sort var colSortArgs_total = new Array("str","str"); //column type var colTypeArgs_total = new Array("ro","ro"); commonGridObj_total = new TGridCommon("mygrid_container_total","form1",headerArgs_total,widthArgs_total,colAlignArgs_total,colSortArgs_total,colTypeArgs_total); commonGridObj_total.setResponseUrl(""); commonGridObj_total.setRequest(""); commonGridObj_total.setSourceType("json"); commonGridObj_total.setSkin("xp"); commonGridObj_total.setImageUrl("../images/"); commonGridObj_total.initGrid(); setTimeout(function(){ var jsonTotalObj = null; //alert($("h_total").value); var i = 0; if($("h_total").value != ""){ var tempTotal = $("h_total").value; jsonTotalObj = eval('(' + tempTotal + ')'); if(parseFloat(jsonTotalObj.total[0].rmb) != 0){ commonGridObj_total.getGridObj().addRow(commonGridObj_total.newGuid(),["RMB",outputMoney(jsonTotalObj.total[0].rmb)],i); i++; } if(parseFloat(jsonTotalObj.total[0].usd) != 0){ commonGridObj_total.getGridObj().addRow(commonGridObj_total.newGuid(),["USD",outputMoney(jsonTotalObj.total[0].usd)],i); } }else{ var id = $("h_id").value; var urlVal = "PayAppAuditGridSource.aspx?handle=payapptotal&payappid="+id+"&val="+commonGridObj_total.newGuid(); var loader = dhtmlxAjax.getSync(urlVal); var loadVal = loader.xmlDoc.responseText; loader = null; if(loadVal != null){ $("h_total").value = loadVal; jsonTotalObj = eval('(' + loadVal + ')'); if(parseFloat(jsonTotalObj.total[0].rmb) != 0){ commonGridObj_total.getGridObj().addRow(commonGridObj_total.newGuid(),["RMB",outputMoney(jsonTotalObj.total[0].rmb)],i); i++; } if(parseFloat(jsonTotalObj.total[0].usd) != 0){ commonGridObj_total.getGridObj().addRow(commonGridObj_total.newGuid(),["USD",outputMoney(jsonTotalObj.total[0].usd)],i); } } } },50); } function createOrder(){ previous_id = ""; //header var headerArgs_order = new Array("", '业务类别', "委托单位", "主提单号", "RMB", "USD", "报关单号", "备案清单号", "委托编号", "分提单号"); //width var widthArgs_order = new Array("40", "60", "100", "120", "80", "80", "100", "100", "100", "100"); //column align var colAlignArgs_order = new Array("center", "center", "center", "center", "center", "center", "center", "center", "center", "center"); //column sort var colSortArgs_order = new Array("na", "str", "str", "str", "str", "str", "str", "str", "str", "str"); //column type var colTypeArgs_order = new Array("ch", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro"); commonGridObj_order = new TGridCommon("mygrid_container_order","form1",headerArgs_order,widthArgs_order,colAlignArgs_order,colSortArgs_order,colTypeArgs_order); commonGridObj_order.setResponseUrl("SettlementGridSourceApp.aspx"); var _customer = comboCustomer.getComboText().trim(); var billNO = $("h_billno").value.trim(); var _billno = $("txt_billNO").value.trim(); var _begin_time = $("txt_beginTime").value.trim(); var _end_time = $("txt_endTime").value.trim(); var _vessel = comboVessel.getComboText().trim(); var _voyno = comboVoyno.getComboText().trim(); var _bstype = comboBsType.getSelectedValue();//comboBsType.getComboText().trim(); //var _debitno = $("txt_debitno").value.trim(); var _feename = comboFeeName.getSelectedValue(); var _feetype = comboFeeType.getSelectedValue();//comboFeeType.getComboText().trim(); var _currency = comboCurrency.getSelectedValue(); //var _customer = comboCustomer.getComboText().trim(); _feename = _feename == null ? "":_feename; _feetype = _feetype == null?"":_feetype; _currency = _currency == null?"":_currency; //var _feetype = comboFeeType.getSelectedValue();//comboFeeType.getComboText().trim(); //var _currency = comboCurrency.getComboText().trim(); var searchJson = ""; //begin searchJson +="{"; searchJson += "["; searchJson += "\"cus\":\""+_customer+"\","; searchJson += "\"bno\":\""+_billno+"\","; searchJson += "\"bt\":\""+_begin_time+"\","; searchJson += "\"et\":\""+_end_time+"\","; searchJson += "\"ves\":\""+_vessel+"\","; searchJson += "\"voy\":\""+_voyno+"\","; searchJson += "\"bty\":\""+_bstype+"\","; searchJson += "\"deno\":\"\","; //searchJson += "\"cus\":\""+_customer+"\","; searchJson += "\"fnm\":\""+_feename+"\","; searchJson += "\"fty\":\""+_feetype+"\","; searchJson += "\"cur\":\""+_currency+"\""; //searchJson += "\"ise\":\""+_is_settled+"\""; //searchJson += "\"fty\":\""+_feetype+"\","; //searchJson += "\"cur\":\""+_currency+"\""; searchJson += "]"; searchJson +="}"; //end commonGridObj_order.setRequest("SettlementGridSourceApp.aspx?handle=payauditorderlist&billno="+billNO+"&search="+escape(searchJson)+"&uid="+commonGridObj_order.newGuid()); //commonGridObj_order.setRequest("SettlementGridSourceApp.aspx?handle=payauditorderlist&billno="+billno); commonGridObj_order.setSourceType("json"); commonGridObj_order.setSkin("xp"); commonGridObj_order.setImageUrl("../images/"); commonGridObj_order.initGrid(); commonGridObj_order.bind(); // //遍历当前委托信息信息,如果已经记录到缓存中,则自动将前端选择框置1 // setTimeout(function(){ // var tempCache = $("h_feecache").value; // var jsonCacheObj = null; // jsonCacheObj = eval('(' + tempCache + ')'); // // for(var i=0;i 0) { var tempCache = $("h_feecache").value; var jsonCacheObj; $("ck_allfee").checked = 1; for (var i = 0; i < count; i++) { if (tempCache.trim() == "") { var rowId = gridObj.getRowId(i); var rowIndex = gridObj.getRowIndex(rowId); var cacheBuffer = ""; cacheBuffer += "{"; cacheBuffer += "\"id\":\"" + rowId + "\","; var feeType = gridObj.cellByIndex(rowIndex, 1).getValue() == "收" ? 1 : 2; cacheBuffer += "\"type\":" + feeType + ","; cacheBuffer += "\"bsno\":\"" + rId + "\","; cacheBuffer += "\"cus\":\"" + gridObj.cellByIndex(rowIndex, 2).getValue() + "\","; cacheBuffer += "\"fname\":\"" + gridObj.cellByIndex(rowIndex, 3).getValue() + "\","; cacheBuffer += "\"cur\":\"" + gridObj.cellByIndex(rowIndex, 4).getValue() + "\","; cacheBuffer += "\"stl\":\"" + gridObj.cellByIndex(rowIndex, 5).getValue() + "\","; //应结 cacheBuffer += "\"cstl\":\"" + gridObj.cellByIndex(rowIndex, 6).getValue() + "\","; //本次结算 cacheBuffer += "\"ustl\":\"" + gridObj.cellByIndex(rowIndex, 7).getValue() + "\""; //未结 cacheBuffer += "}"; var result = ""; result += "{\"caches\":["; result += cacheBuffer; result += "]}"; tempCache = result; jsonCacheObj = eval('(' + result + ')'); gridObj.cellByIndex(i, 0).setValue(1); } else { if (jsonCacheObj == null) jsonCacheObj = eval('(' + tempCache + ')'); var isExist = false; var rowId = gridObj.getRowId(i); var rowIndex = gridObj.getRowIndex(rowId); for (var j = 0; j < jsonCacheObj.caches.length; j++) { if (jsonCacheObj.caches[j].id == rowId) { isExist = true; break; } } if (!isExist) { var feeType = gridObj.cellByIndex(rowIndex, 1).getValue() == "收" ? 1 : 2; gridObj.cellByIndex(rowIndex, 0).setValue(1); var newCache = jsonCacheObj.caches; newCache = { id: rowId, type: feeType, bsno: rId, cus: gridObj.cellByIndex(rowIndex, 2).getValue().toString(), fname: gridObj.cellByIndex(rowIndex, 3).getValue(), cur: gridObj.cellByIndex(rowIndex, 4).getValue(), stl: gridObj.cellByIndex(rowIndex, 5).getValue(), cstl: gridObj.cellByIndex(rowIndex, 6).getValue(), ustl: gridObj.cellByIndex(rowIndex, 7).getValue() }; //alert(newCache); jsonCacheObj.caches.push(newCache); } } } $("h_feecache").value = JSON.stringify(jsonCacheObj); //$("dvResult").innerHTML = JSON.stringify(jsonCacheObj); } }, 20); } else { setTimeout(function() { var jsonCacheObj = null; var tempCache = $("h_feecache").value; jsonCacheObj = eval('(' + tempCache + ')'); var gridObj = commonGridObj_fee.getGridObj(); for (var j = 0; j < gridObj.getRowsNum(); j++) { var rId = gridObj.getRowId(j); for (var i = jsonCacheObj.caches.length - 1; i >= 0; i--) { if (jsonCacheObj.caches[i].id == rId) { if (jsonCacheObj.caches.length == 1) { jsonCacheObj.caches.shift(); gridObj.cellByIndex(j, 0).setValue(0); $("h_feecache").value = ""; //$("dvResult").innerHTML = ""; } else { jsonCacheObj.caches.splice(i, 1); gridObj.cellByIndex(j, 0).setValue(0); $("h_feecache").value = JSON.stringify(jsonCacheObj); //$("dvResult").innerHTML = JSON.stringify(jsonCacheObj); break; } } } } }, 20); //$("dvResult").innerHTML = $("h_feecache").value } }, 100); }); } function IsLastFeeCheckOut(bsno) { if (commonGridObj_order != null) { for (var i = 0; i < commonGridObj_order.getGridObj().getRowsNum(); i++) { if (commonGridObj_order.getGridObj().getRowId(i) == bsno) { commonGridObj_order.getGridObj().cellByIndex(i, 0).setValue(0); break; } } //commonGridObj_order.bind(); } } function createFeeList(){ //header var headerArgs_order = new Array("", "D/C", "结算单位", "费用名称", "币别", "应结", "本次结算", "未结", "业务类别", "备份"); //width var widthArgs_order = new Array("40", "25", "120", "100", "40", "70", "70", "70", "0", "300"); //column align var colAlignArgs_order = new Array("center", "center", "center", "center", "center", "center", "center", "center", "center", "center"); //column sort var colSortArgs_order = new Array("na", "str", "str", "str", "str", "str", "str", "str", "str", "str"); //column type var colTypeArgs_order = new Array("ch", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro"); commonGridObj_fee = new TGridCommon("mygrid_container_fee","form1",headerArgs_order,widthArgs_order,colAlignArgs_order,colSortArgs_order,colTypeArgs_order); commonGridObj_fee.setResponseUrl("SettlementGridSourceApp.aspx"); var _bsno = commonGridObj_fee.$("h_bsno").value;//alert(_bsno); var _feename = comboFeeName.getSelectedValue(); var _feetype = comboFeeType.getSelectedValue();//comboFeeType.getComboText().trim(); var _currency = comboCurrency.getSelectedValue(); var _billno = ""; var _user = ""; _feename = _feename == null ? "":_feename; _feetype = _feetype == null?"":_feetype; _currency = _currency == null?"":_currency; _billno = $("h_billno").value; _user = $("h_user").value; var searchJson = ""; //begin searchJson +="{"; searchJson += "["; searchJson += "\"fnm\":\""+_feename+"\"," searchJson += "\"fty\":\""+_feetype+"\","; searchJson += "\"cur\":\""+_currency+"\","; searchJson += "\"billno\":\""+_billno+"\","; searchJson += "\"user\":\""+_user+"\""; searchJson += "]"; searchJson +="}";//alert(searchJson); commonGridObj_fee.setRequest("SettlementGridSourceApp.aspx?handle=payauditfeelist&bsno="+_bsno+"&fsearch="+escape(searchJson)); commonGridObj_fee.setSourceType("json"); commonGridObj_fee.setSkin("xp"); commonGridObj_fee.setImageUrl("../images/"); commonGridObj_fee.initGrid(); commonGridObj_fee.bind(); // if(_bsno != ""){ // commonGridObj_fee.bind(); // // //遍历当前打开的费用信息,如果已经记录到缓存中,则自动将前端选择框置1 // setTimeout(function(){ // var tempCache = $("h_feecache").value; // var jsonCacheObj = null; // jsonCacheObj = eval('(' + tempCache + ')'); // // for(var i=0;i= 0;i--){ if(jsonCacheObj.caches[i].id == rId){ if(jsonCacheObj.caches.length == 1){ IsLastFeeCheckOut(jsonCacheObj.caches[i].bsno); jsonCacheObj.caches.shift(); $("h_feecache").value = ""; }else{ jsonCacheObj.caches.splice(i,1); $("h_feecache").value = JSON.stringify(jsonCacheObj); break; } } } //$("dvResult").innerHTML = $("h_feecache").value } }); commonGridObj_fee.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){ if(stage == 0){ return true; } if(stage == 1){ var selectedId = commonGridObj_fee.getGridObj().getSelectedRowId(); var rowIndex = commonGridObj_fee.getGridObj().getRowIndex(selectedId); var txtEdit for(i = 0; i < document.all.length; i++){ if(document.all(i).tagName == "TEXTAREA"){ txtEdit = document.all(i); // txtEdit.focus(); txtEdit.select(); break; } } if(cInd == 1 || cInd == 2){ if(flagFilter == 0){ //alert(txtEdit.value); } } } if(stage == 2){ var selectedId = commonGridObj_fee.getGridObj().getSelectedRowId(); var rowIndex = commonGridObj_fee.getGridObj().getRowIndex(selectedId); var stl = 0.0; var cstl = 0.0; var ustl = 0.0; stl = parseFloat(clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_fee.getGridObj().cellByIndex(rowIndex,5).getValue())))); cstl = parseFloat(clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_fee.getGridObj().cellByIndex(rowIndex,6).getValue())))); ustl = parseFloat(clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_fee.getGridObj().cellByIndex(rowIndex,7).getValue())))); var rustl = 0.0; if(cstl == ustl){ rustl = ustl; }else{ var newCstl = parseFloat(nValue); var oldCstl = parseFloat(oValue); if(ustl == oldCstl){ rustl = ustl; }else{ rustl = oldCstl + ustl; } } var newStl = 0.0; newStl = rustl - cstl; if(newStl < 0){ commonGridObj_fee.getGridObj().cellByIndex(rowIndex,7).setValue(ConvertToMoney(outputMoney(rustl.toString()))); return false; } commonGridObj_fee.getGridObj().cellByIndex(rowIndex,6).setValue(ConvertToMoney(outputMoney(cstl.toString()))); commonGridObj_fee.getGridObj().cellByIndex(rowIndex,7).setValue(ConvertToMoney(outputMoney(newStl.toString()))); var tempCache = $("h_feecache").value; if(tempCache.trim() != ""){//如果有缓存记录 var jsonCacheObj = eval('(' + tempCache + ')'); for(var i=0;i0){ 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(); }); if ($("h_settlecustomer").value.trim() != "") { comboCustomer.setComboText($("h_settlecustomer").value.trim()); comboCustomer.disable(false); } } function createComboVessel(){ comboVessel = dhtmlXComboFromSelect("sel_vessel"); comboVessel.loadXML("../FeeCodes/TCodeVesselAdapter.aspx?mask=0&pos=0&uid="+newGuid()); var _vessel = $("h_vessel").value; comboVoyno = dhtmlXComboFromSelect("sel_voyno"); if(_vessel != ""){ comboVoyno.loadXML("../FeeCodes/TCodeVoynoAdapter.aspx?mask=0&pos=0&strVESSEL="+_vessel+"&uid="+newGuid()); } comboVessel.setComboText($("h_vessel").value); comboVessel.attachEvent("onKeyPressed", function(keyCode){ if(keyCode!="8"){ var arrayArg = new Array(); setTimeout(function(){ var filterCount = 0; if("" != comboVessel.getComboText().trim()){ while("undefined" != typeof comboVessel.getOptionByIndex(filterCount)){ var comboValue = comboVessel.getOptionByIndex(filterCount).text.toUpperCase();//.value; var enterValue = comboVessel.getComboText().toUpperCase(); $("h_vessel").value = comboVessel.getComboText().toUpperCase(); if(comboValue.indexOf(enterValue) == 0){ comboVessel.selectOption(filterCount,true,true); $("h_vessel").value = comboVessel.getComboText().trim(); break; } ++filterCount; } } },10); } }); comboVessel.attachEvent("onBlur", function(){ $("h_vessel").value = comboVessel.getComboText().trim(); $("h_voyno").value = ""; createComboVoyno(); }); comboVessel.attachEvent("onChange", function(){ comboVessel.setComboText($("h_vessel").value); }); comboVessel.attachEvent("onSelectionChange", function(){ $("h_vessel").value = comboVessel.getComboText().trim(); }); } function createComboVoyno(){ var _vessel; try { _vessel = comboVessel.getSelectedValue().trim();//$("hd_comboVESSEL").value; } catch(e) { _vessel=""; } if(_vessel != ""){ comboVoyno.loadXML("../FeeCodes/TCodeVoynoAdapter.aspx?mask=0&pos=0&strVESSEL="+_vessel); comboVoyno.setComboText($("h_voyno").value); } comboVoyno.attachEvent("onChange", function(){ comboVoyno.setComboText($("h_voyno").value); }); comboVoyno.attachEvent("onKeyPressed", function(keyCode){ if(keyCode!="8"){ var arrayArg = new Array(); setTimeout(function(){ var filterCount = 0; if("" != comboVoyno.getComboText().trim()){ while("undefined" != typeof comboVoyno.getOptionByIndex(filterCount)){ var comboValue = comboVoyno.getOptionByIndex(filterCount).text.toUpperCase();//.value; var enterValue = comboVoyno.getComboText().trim().toUpperCase(); $("h_voyno").value = comboVoyno.getComboText().trim().toUpperCase(); if(comboValue.indexOf(enterValue) == 0){ comboVoyno.selectOption(filterCount,true,true); break; } ++filterCount; } } },10); } }); comboVoyno.attachEvent("onSelectionChange", function(){ $("h_voyno").value = comboVoyno.getComboText().trim(); }); } String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); } //Get Guid var newGuid = function(){ var guid = ""; for (var i = 1; i <= 32; i++){ var n = Math.floor(Math.random()*16.0).toString(16); guid += n; if((i==8)||(i==12)||(i==16)||(i==20)) guid += "-"; } return guid.toUpperCase(); }; function initCombos(){ createComboVessel();//船名 createComboVoyno();//航次 createComboCustomer();//结算单位 createComboBsType();//业务类型 createComboFeeName();//费用名称 createComboFeeType();//费用类型 createComboCurrency();//币别 } function checkAll(gridObj){ var checkBoxId = ""; if(gridObj == commonGridObj_fee){ checkBoxId = "ck_allfee"; //如果费用全选按钮是选中状态 if($(checkBoxId).checked){ for(var i=0;i= 0;j--){ if(jsonCacheObj.caches[j].id == rId){ if(jsonCacheObj.caches.length == 0){ jsonCacheObj.caches.shift(); $("h_feecache").value = ""; commonGridObj_fee.getGridObj().cellByIndex(i,0).setValue(0); }else{ if(jsonCacheObj.caches.length == 1){ jsonCacheObj.caches.shift(); $("h_feecache").value = ""; commonGridObj_fee.getGridObj().cellByIndex(i,0).setValue(0); }else{ jsonCacheObj.caches.splice(j,1); $("h_feecache").value = JSON.stringify(jsonCacheObj); commonGridObj_fee.getGridObj().cellByIndex(i,0).setValue(0); break; } } } } //$("dvResult").innerHTML = $("h_feecache").value; } } } }else if(gridObj == commonGridObj_order){ var checkType = 0; if($("ck_all").checked){ checkType = 1; }else{ checkType = 0; } for(var k=0;k < commonGridObj_order.getGridObj().getRowsNum();k++){ if(checkType == 1){ commonGridObj_order.getGridObj().cellByIndex(k,0).setValue(1); }else{ commonGridObj_order.getGridObj().cellByIndex(k,0).setValue(0); } } } } function createComboBsType(){ comboBsType = dhtmlXComboFromSelect("sel_bstype"); } function createComboFeeName(){ comboFeeName = dhtmlXComboFromSelect("sel_feename"); comboFeeName.loadXML("../FeeCodes/FeeCodeService.aspx?mask=0&pos=0&handle=all"); comboFeeName.attachEvent("onChange", function(){ comboFeeName.setComboText($("h_feename").value); }); comboFeeName.attachEvent("onBlur", function(){ var s1 = comboFeeName.getComboText().trim(); var s2 = s1.indexOf("|"); if(s2>0){ s2=s2+2; } var s3 = s1.substring(s2); if(s2>0){ comboFeeName.setComboText(s3); $("h_feename").value=s3; } else { comboCustomer.setComboText($("h_feename").value); } }); comboFeeName.setComboText($("h_feename").value); comboFeeName.attachEvent("onKeyPressed", function(keyCode){ if(keyCode!="8"){ var arrayArg = new Array(); setTimeout(function(){ var filterCount = 0; var is = -1; var ishd = $("h_feename").value.trim(); if("" != comboFeeName.getComboText().trim()){ while("undefined" != typeof comboFeeName.getOptionByIndex(filterCount)){ var comboValue = comboFeeName.getOptionByIndex(filterCount).text.toUpperCase();//.value; var enterValue = comboFeeName.getComboText().trim().toUpperCase(); $("h_feename").value = comboFeeName.getComboText().trim().toUpperCase(); if(comboValue.indexOf(enterValue) == 0){ comboFeeName.selectOption(filterCount,true,true); is=filterCount; break; } ++filterCount; } if(is==-1){ $("h_feename").value = ishd; alert("无此内容,请重新选择!"); } } },10); } }); comboFeeName.attachEvent("onSelectionChange", function(){ $("h_feename").value = comboFeeName.getComboText().trim(); }); } function createComboFeeType(){ comboFeeType = dhtmlXComboFromSelect("sel_feetype"); } function createComboCurrency(){ comboCurrency = dhtmlXComboFromSelect("sel_currency"); } function searchOrder(){ var _customer = comboCustomer.getComboText().trim(); var _searchbillno = $("txt_billNO").value.trim(); var _begin_time = $("txt_beginTime").value.trim(); var _end_time = $("txt_endTime").value.trim(); var _vessel = comboVessel.getComboText().trim(); var _voyno = comboVoyno.getComboText().trim(); var _bstype = comboBsType.getSelectedValue();//comboBsType.getComboText().trim(); var _debitno = "";//$("txt_debitno").value.trim(); var _id = ""; _id = $("h_id").value; var _billno = ""; _billno = $("h_billno").value; var _user = ""; _user = $("h_user").value; //var _feetype = comboFeeType.getSelectedValue();//comboFeeType.getComboText().trim(); //var _currency = comboCurrency.getComboText().trim(); var searchJson = ""; //begin searchJson +="{"; searchJson += "["; searchJson += "\"cus\":\""+_customer+"\","; searchJson += "\"bno\":\""+_searchbillno+"\","; searchJson += "\"bt\":\""+_begin_time+"\","; searchJson += "\"et\":\""+_end_time+"\","; searchJson += "\"ves\":\""+_vessel+"\","; searchJson += "\"voy\":\""+_voyno+"\","; searchJson += "\"bty\":\""+_bstype+"\","; searchJson += "\"deno\":\""+_debitno+"\","; searchJson += "\"id\":\""+_id+"\","; searchJson += "\"billno\":\""+_billno+"\","; searchJson += "\"user\":\""+_user+"\""; //searchJson += "\"ise\":\""+_is_settled+"\""; //searchJson += "\"fty\":\""+_feetype+"\","; //searchJson += "\"cur\":\""+_currency+"\""; searchJson += "]"; searchJson +="}"; //end //alert(searchJson);//return; commonGridObj_order.setRequest("PayAppAuditGridSource.aspx?handle=ordersearch&search="+escape(searchJson)+"&uid="+commonGridObj_order.newGuid()); commonGridObj_order.initGrid(); commonGridObj_order.bind(); // //遍历当前委托信息信息,如果已经记录到缓存中,则自动将前端选择框置1 // setTimeout(function(){ // var tempCache = $("h_feecache").value; // var jsonCacheObj = null; // jsonCacheObj = eval('(' + tempCache + ')'); // // for(var i=0;i 0){ var tempCache = $("h_feecache").value; var jsonCacheObj; $("ck_allfee").checked = 1; for(var i = 0;i < count;i++){ if(tempCache.trim() == ""){ var rowId = gridObj.getRowId(i); var rowIndex = gridObj.getRowIndex(rowId); var cacheBuffer = ""; cacheBuffer += "{"; cacheBuffer += "\"id\":\""+rowId+"\","; var feeType = gridObj.cellByIndex(rowIndex,1).getValue() == "收"?1:2; cacheBuffer += "\"type\":"+feeType+","; cacheBuffer += "\"bsno\":\""+rId+"\","; cacheBuffer += "\"cus\":\""+gridObj.cellByIndex(rowIndex,2).getValue()+"\","; cacheBuffer += "\"fname\":\""+gridObj.cellByIndex(rowIndex,3).getValue()+"\","; cacheBuffer += "\"cur\":\""+gridObj.cellByIndex(rowIndex,4).getValue()+"\","; cacheBuffer += "\"stl\":\""+gridObj.cellByIndex(rowIndex,5).getValue()+"\",";//应结 cacheBuffer += "\"cstl\":\""+gridObj.cellByIndex(rowIndex,6).getValue()+"\",";//本次结算 cacheBuffer += "\"ustl\":\""+gridObj.cellByIndex(rowIndex,7).getValue()+"\"";//未结 cacheBuffer += "}"; var result = ""; result += "{\"caches\":["; result += cacheBuffer; result += "]}"; tempCache = result; jsonCacheObj = eval('(' + result + ')'); gridObj.cellByIndex(i,0).setValue(1); }else{ if(jsonCacheObj == null) jsonCacheObj = eval('(' + tempCache + ')'); var isExist = false; var rowId = gridObj.getRowId(i); var rowIndex = gridObj.getRowIndex(rowId); for(var j=0;j= 0;i--){ if(jsonCacheObj.caches[i].id == rId){ if(jsonCacheObj.caches.length == 1){ jsonCacheObj.caches.shift(); gridObj.cellByIndex(j,0).setValue(0); $("h_feecache").value = ""; //$("dvResult").innerHTML = ""; }else{ jsonCacheObj.caches.splice(i,1); gridObj.cellByIndex(j,0).setValue(0); $("h_feecache").value = JSON.stringify(jsonCacheObj); //$("dvResult").innerHTML = JSON.stringify(jsonCacheObj); break; } } } } },60); //$("dvResult").innerHTML = $("h_feecache").value } }); if(commonGridObj_fee != null){ createFeeList(); } } //Cache Settlement Fee function saveSettleFee(){ var settleFee = ""; settleFee +="{"; settleFee += "["; settleFee += "]"; settleFee +="}"; } function saveSelectFee(gid,type){ } function getCacheFee(){ var cacheBuffer = $("h_feecache").value; } function postEnterFee(){ var myForm = document.getElementById("form1"); myForm.submit() ; } function doSettle(){ postEnterFee(); } function ConvertToMoney(strObj){ var result = strObj.replace(",",""); return result; } function clearNoNum(valObj) { //先把非数字的都替换掉,除了数字和. valObj = valObj.replace(/[^\d.]/g,""); //必须保证第一个为数字而不是. valObj = valObj.replace(/^\./g,""); //保证只有出现一个.而没有多个. valObj = valObj.replace(/\.{2,}/g,"."); //保证.只出现一次,而不能出现两次以上 valObj = valObj.replace(".","$#$").replace(/\./g,"").replace("$#$","."); return valObj; } function isObjNaN(Obj){ if(Obj.toString().toLowerCase() == "nan"){ return 0; }else{ return Obj; } } function doSettleCurrency(clickObj){ if(clickObj == "ck_rmb"){ if($("ck_usd").checked){ $("ck_usd").checked = 0; } }else{ if($("ck_rmb").checked){ $("ck_rmb").checked = 0; } } } function outputMoney(number) { number= number.replace(/\,/g,""); if (isNaN(number)||number=="") return ""; number = Math.round( number*100) /100; if(number<0) return '-'+outputDollars(Math.floor(Math.abs(number)-0) + '') + outputCents(Math.abs(number) - 0); else return outputDollars(Math.floor(number-0) + '') + outputCents(number - 0); } function outputDollars(number) { if (number.length<= 3) return (number == '' ? '0' : number); else { var mod = number.length%3; var output = (mod == 0 ? '' : (number.substring(0,mod))); for (i=0 ; i< Math.floor(number.length/3) ; i++) { if ((mod ==0) && (i ==0)) output+= number.substring(mod+3*i,mod+3*i+3); else output+= ',' + number.substring(mod+3*i,mod+3*i+3); } return (output); } } function outputCents(amount) { amount = Math.round( ( (amount) - Math.floor(amount) ) *100); return (amount<10 ? '.0' + amount : '.' + amount); } function ConvertToMoney(strObj){ var result = strObj.replace(",",""); return result; } function clearNoNum(valObj) { //先把非数字的都替换掉,除了数字和. valObj = valObj.replace(/[^\d.]/g,""); //必须保证第一个为数字而不是. valObj = valObj.replace(/^\./g,""); //保证只有出现一个.而没有多个. valObj = valObj.replace(/\.{2,}/g,"."); //保证.只出现一次,而不能出现两次以上 valObj = valObj.replace(".","$#$").replace(/\./g,"").replace("$#$","."); return valObj; } function isObjNaN(Obj){ if(Obj.toString().toLowerCase() == "nan"){ return 0; }else{ return Obj; } } function moneyMath(original){ var result = Math.round(original*100)/100; return result; } function financialAudit(){ } //批准支付 function acceptApplyPay(){ $("h_audit").value = 1; postEnterFee(); } ////驳回申请 //function rejectApply(){ //// $("h_audit").value = 2; //// postEnterFee(); //} function auditReject() { var iCount = 0; var strBillNo = $("h_billno").value; //异步执行操作 var url = "FeePayAuditService.aspx?billno="+strBillNo+"&handle=auditreject&oplb="+SelectRowOplb+"&uid="+commonGridObj_total.newGuid(); var loader = dhtmlxAjax.getSync(url); var postStatus = loader.xmlDoc.responseText; var status = parseInt(postStatus); switch(status){ case 1: alert("驳回申请操作完成"); break; case -1: alert("驳回操作失败"); break; case -2: alert("您没有权限审核付费申请"); break; case -3: alert("审核已经进入下一步,不能执行驳回操作"); break; } } //清空查询信息 function initSearch(){ //清空船名 if(comboVessel != null){ $("h_vessel").value = ""; comboVessel.setComboText($("h_vessel").value); } //清空结算单位 if(comboCustomer != null){ $("h_customer").value = ""; comboCustomer.setComboText($("h_customer").value); } //清空航次 if(comboVoyno != null){ $("h_voyno").value = ""; comboVoyno.setComboText($("h_voyno").value); } //清空费用名称 if(comboFeeName != null){ $("h_feename").value = ""; comboFeeName.setComboText($("h_feename").value); } //清空币别 if(comboCurrency != null){ comboCurrency.setComboText("全部"); } //清空费用类型 if(comboFeeType != null){ comboFeeType.setComboText("全部"); } //清空业务类型 if(comboBsType != null){ comboBsType.setComboText("全部"); } $("txt_beginTime").value = "";//清空业务日期 起始时间 $("txt_endTime").value = "";//清空业务日期 结束时间 $("txt_billNO").value = "";//清空编号 文本框 //$("txt_debitno").value = "";//清空对账编号 createOrder(); } function auditPass(){ var iCount = 0; var isOrderPay = false; var isRun = false; var stlName = ""; var clientName = $("h_settlecustomer").value.trim(); //验证结算单位是否是月结或者是半月结 var url = "../FeeCodes/CRMClientInfo.aspx?handle=clientstl&name="+escape(clientName)+"&uid="+commonGridObj_total.newGuid(); var loader = dhtmlxAjax.getSync(url); var stlVal = loader.xmlDoc.responseText; var stlObj = null; stlObj = eval('(' + stlVal + ')'); if(stlObj.customer.length > 0){ var stlType = parseInt(stlObj.customer[0].stl); switch(stlType){ case 1: isOrderPay = true; stlName = "票结"; break; case 2: stlName = "半月结"; isOrderPay = false; break; case 3: stlName = "月结"; isOrderPay = false; break; } }else{ isOrderPay = true; } var strBhhhillNo = $("h_billno").value; if (!isOrderPay) { if (stlName.trim() == "") { isRun = true; } else { if (window.confirm("当前结算单位为 " + stlName + " 您确定要提交付费申请")) { isRun = true; } else { isRun = false; } } } if(isRun){ var strBillNo = $("h_billno").value; //异步执行操作 var url = "FeePayAuditService.aspx?billno="+strBillNo+"&handle=auditpass&oplb="+SelectRowOplb+"&uid="+commonGridObj_total.newGuid(); var loader = dhtmlxAjax.getSync(url); var postStatus = loader.xmlDoc.responseText; var status = parseInt(postStatus); switch(status){ case 1: alert("批准支付操作完成"); window.parent.opener.location.href = window.parent.opener.location.href; window.close(); break; case -1: case -2: alert("审核操作异常"); break; case -3: alert("您没有权限审核付费申请"); break; case -4: alert("付费审核步骤已经完成,不能重复审核"); break; } } } function printInvoice(){ var id = ""; id = $("h_id").value; var printUrl = ""; var companyID = ""; var typeName = "PayFeeAuditReport"; var dbSourceID = ""; var userID = ""; var url = "../Reports/ReportService.aspx?handle=printpayfeeauditreport&bsno="+id +"&val="+commonGridObj_total.newGuid(); typeName = "PayFeeAuditReport"; var loader = dhtmlxAjax.getSync(url); var reportVal = loader.xmlDoc.responseText; var reportObj = null; if(reportVal != ""){ reportObj = eval('(' + reportVal + ')'); if(reportObj.reports.length > 0){ if(reportObj.reports[0].compid != ""){ companyID = reportObj.reports[0].compid; } if(reportObj.reports[0].sourceid != ""){ dbSourceID = reportObj.reports[0].sourceid; } if(reportObj.reports[0].compid != ""){ userID = reportObj.reports[0].userid; } printUrl = "print://?comp="+companyID+"&type="+typeName+"&dbid="+dbSourceID+"&uid="+userID;//alert(printUrl); window.location.href = window.location.href; location.href = printUrl; } }else{ alert("没有要打印的报表"); return; } }