var commonGridObj_order; var commonGridObj_fee; var comboCustomer;//委托单位 var comboVessel;//船名 var comboVoyno;//航次 var comboBsType;//业务类型 var comboFeeName;//费用名称 var comboFeeType;//费用类型 var comboCurrency;//币别 var isLoad = 0; var sel_val = new Array; var selectoplb;//选中行的业务类别 function $(id){ return document.getElementById(id); } function createOrder(){ previous_id = ""; //header // //new Array("","业务类型","委托单位","委托编号","主提单号","分提单号"); var headerArgs_order = new Array("", "业务类型", "委托单位", "委托编号", "主提单号", "分提单号", "报关单号", "备案清单号"); //width var widthArgs_order = new Array("40", "60", "100", "100", "100", "100", "100", "100"); //column align var colAlignArgs_order = new Array("center", "center", "center", "center", "center", "center", "center", "center"); //column sort var colSortArgs_order = new Array("na", "str", "str", "str", "str", "str", "str", "str"); //column type var colTypeArgs_order = new Array("ch", "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("SettlementGridSource.aspx"); commonGridObj_order.setRequest("SettlementGridSource.aspx?handle=orderlist"); 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; if(tempCache.trim() != ""){ 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 += "\"orig\":\"1\","; //原始类型 cacheBuffer += "\"oname\":\"" + gridObj.cellByIndex(rowIndex, 3).getValue() + "\","; //更改费用名称 cacheBuffer += "\"ocstl\":\"" + gridObj.cellByIndex(rowIndex, 6).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(), orig: "1", oname: gridObj.cellByIndex(rowIndex, 3).getValue(), ocstl: gridObj.cellByIndex(rowIndex, 6).getValue() }; //alert(newCache); jsonCacheObj.caches.push(newCache); } } } $("h_feecache").value = JSON.stringify(jsonCacheObj); //$("dvResult").innerHTML = JSON.stringify(jsonCacheObj); } Statistics(); }, 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); Statistics(); //$("dvResult").innerHTML = $("h_feecache").value } }, 100); }); } function createFeeList(){ //header var headerArgs_order = new Array("", "D/C", "结算单位", "费用名称", "币别", "应结", "本次结算", "未结", "备注"); //width var widthArgs_order = new Array("40", "25", "100", "100", "40", "70", "70", "70", "300"); //column align var colAlignArgs_order = new Array("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"); //column type var colTypeArgs_order = new Array("ch", "ro", "ro", "ro", "ro", "ro", "ed", "ro", "ro"); commonGridObj_fee = new TGridCommon("mygrid_container_fee","form1",headerArgs_order,widthArgs_order,colAlignArgs_order,colSortArgs_order,colTypeArgs_order); commonGridObj_fee.setResponseUrl("SettlementGridSource.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 _customer = comboCustomer.getComboText().trim(); _feename = _feename == null ? "":_feename; _feetype = _feetype == null?"":_feetype; _currency = _currency == null?"":_currency; var searchJson = ""; //begin searchJson +="{"; searchJson += "["; searchJson += "\"cus\":\""+_customer+"\"," searchJson += "\"fnm\":\""+_feename+"\"," searchJson += "\"fty\":\""+_feetype+"\","; searchJson += "\"cur\":\"" + _currency + "\","; searchJson += "\"amount1\":\"" + $("txt_amount1").value.trim() + "\","; searchJson += "\"amount2\":\"" + $("txt_amount2").value.trim() + "\""; searchJson += "]"; searchJson += "}"; //alert(searchJson); var cacheName = ""; if($("h_cachename").value.trim() != ""){ cacheName = "&ordercachename="+$("h_cachename").value.trim(); } // commonGridObj_fee.setRequest("SettlementGridSource.aspx?handle=feelist&bsno="+_bsno+"&fsearch="+escape(searchJson)); commonGridObj_fee.setRequest("SettlementGridSource.aspx?handle=orderfee&bsno="+_bsno+"&fsearch="+escape(searchJson)+cacheName); commonGridObj_fee.setSourceType("json"); commonGridObj_fee.setSkin("xp"); commonGridObj_fee.setImageUrl("../images/"); commonGridObj_fee.initGrid(); if(_bsno != ""){ commonGridObj_fee.bind(); // //遍历当前打开的费用信息,如果已经记录到缓存中,则自动将前端选择框置1 // setTimeout(function(){ // var tempCache = $("h_feecache").value; // var jsonCacheObj = null; // if(tempCache.trim() != ""){ // jsonCacheObj = eval('(' + tempCache + ')'); // for(var i=0;i 1){ cacheTotalObj = eval('(' + cacheVal.trim() + ')'); if(cacheTotalObj.totals.length > 0){ $("dvTotalRecvRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvrmb.toString()); $("dvTotalRecvUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvusd.toString()); $("dvTotalPayRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payrmb.toString()); $("dvTotalPayUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payusd.toString()); $("dvTotalSettleRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalrmb.toString()); $("dvTotalSettleUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalusd.toString()); $("dvTotalRecvRMBVal").style.color = "#F00"; $("dvTotalRecvUSDVal").style.color = "#F00"; $("dvTotalPayRMBVal").style.color = "#090"; $("dvTotalPayUSDVal").style.color = "#090"; state = parseInt(cacheTotalObj.totals[0].state); } } if(state < 0){ commonGridObj_fee.getGridObj().cellByIndex(rowIndex,0).setValue(0); alert("没有权限添加费用"); } // var gridObj = commonGridObj_fee.getGridObj(); // var rowIndex = gridObj.getRowIndex(rId); // // var isCheck = gridObj.cellByIndex(rowIndex,0).getValue(); // var type = gridObj.cellByIndex(rowIndex,1).getValue(); // var tempCache = $("h_feecache").value; // // //Is Exist Same GID // var result = ""; // // if(isCheck == 1){ // var orderObjRowID = commonGridObj_order.getGridObj().getSelectedRowId(); // var orderObjRowIndex = commonGridObj_order.getGridObj().getRowIndex(orderObjRowID); // // commonGridObj_order.getGridObj().cellByIndex(orderObjRowIndex,0).setValue(1); // var cacheBuffer = ""; // //init jsonObj // if(tempCache.trim() == ""){ // cacheBuffer += "{"; // cacheBuffer += "\"id\":\""+rId+"\","; // var rowIndex = gridObj.getRowIndex(rId); // var feeType = gridObj.cellByIndex(rowIndex,1).getValue() == "收"?1:2; // cacheBuffer += "\"type\":"+feeType+","; // //cacheBuffer += "\"type\":\""+gridObj.cellByIndex(rowIndex,1).getValue()+"\","; // cacheBuffer += "\"bsno\":\""+commonGridObj_order.getGridObj().getSelectedRowId()+"\","; // 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 += "\"orig\":\"1\",";//原始类型 // cacheBuffer += "\"oname\":\""+commonGridObj_fee.getGridObj().cellByIndex(rowIndex,3).getValue()+"\",";//更改费用名称 // cacheBuffer += "\"ocstl\":\""+commonGridObj_fee.getGridObj().cellByIndex(rowIndex,6).getValue()+"\"";//更改费用值 // cacheBuffer += "}"; // // result += "{\"caches\":["; // result += cacheBuffer; // result += "]}"; // // jsonCacheObj = eval('(' + result + ')'); // // $("h_feecache").value = JSON.stringify(jsonCacheObj); // //$("dvResult").innerHTML = JSON.stringify(jsonCacheObj); // }else{ // // jsonCacheObj = eval('(' + tempCache + ')'); // // var isExist = false; // 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; // } // } // // } // // Statistics(); // //$("dvResult").innerHTML = $("h_feecache").value // } // Statistics(); }); 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;i oldCstl && newCstl > (stl - ustl))//(oldCstl + ustl)) { return false; } else if (newCstl == 0) { return false; } var newStl = 0.0; // if(oldCstl != ustl){ // newStl = (ustl+oldCstl) - newCstl; // }else{ // newStl = ustl - newCstl; // } newStl = stl - newCstl; commonGridObj_fee.getGridObj().cellByIndex(rowIndex,0).setValue(1); commonGridObj_fee.getGridObj().cellByIndex(rowIndex,6).setValue(ConvertToMoney(outputMoney(cstl.toString()))); if(newStl == 0){ newStl = cstl; } commonGridObj_fee.getGridObj().cellByIndex(rowIndex,7).setValue(ConvertToMoney(outputMoney(newStl.toString()))); var cacheName = ""; var bsnoCacheName = ""; var totalCacheName = ""; if($("h_cachename").value.trim() != ""){ cacheName = "&ordercachename="+$("h_cachename").value.trim(); }else{ $("h_cachename").value = commonGridObj_order.newGuid(); cacheName = "&ordercachename="+$("h_cachename").value.trim(); } if($("h_bsnocache").value.trim() != ""){ bsnoCacheName = "&bsnocachename="+$("h_bsnocache").value.trim(); }else{ $("h_bsnocache").value = commonGridObj_order.newGuid(); bsnoCacheName = "&bsnocachename="+$("h_bsnocache").value.trim(); } if($("h_totalcache").value.trim() != ""){ totalCacheName = "&totalcachename="+$("h_totalcache").value.trim(); }else{ $("h_totalcache").value = commonGridObj_order.newGuid(); totalCacheName = "&totalcachename="+$("h_totalcache").value.trim(); } var url = ""; var strBSNO = ""; strBSNO = $("h_bsno").value; var state = 0; url = "SettlementGridSource.aspx?handle=changefee" + cacheName + bsnoCacheName + totalCacheName + "&feeid=" + rId + "&search=" + escape(searchJson) + "&cstl=" + cstl + "&ustl=" + newStl + "&uid=" + commonGridObj_fee.newGuid() + "&do=paysettle" + "&bsno=" + strBSNO + "&oplb=" + selectoplb; var loader = dhtmlxAjax.getSync(url); var cacheTotal = ""; var cacheTotalObj = null; var cacheVal = loader.xmlDoc.responseText;//alert(opInfo); if(cacheVal.trim().length > 1){ cacheTotalObj = eval('(' + cacheVal.trim() + ')'); if(cacheTotalObj.totals.length > 0){ $("dvTotalRecvRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvrmb.toString()); $("dvTotalRecvUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvusd.toString()); $("dvTotalPayRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payrmb.toString()); $("dvTotalPayUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payusd.toString()); $("dvTotalSettleRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalrmb.toString()); $("dvTotalSettleUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalusd.toString()); $("dvTotalRecvRMBVal").style.color = "#F00"; $("dvTotalRecvUSDVal").style.color = "#F00"; $("dvTotalPayRMBVal").style.color = "#090"; $("dvTotalPayUSDVal").style.color = "#090"; state = cacheTotalObj.totals[0].state; } } if(state < 0){ commonGridObj_fee.getGridObj().cellByIndex(rowIndex,0).setValue(0); alert("没有权限修改添加费用"); return false; }else{ return true; } } }); isLoad = 1; } function createComboCustomer(){//委托单位 comboCustomer = dhtmlXComboFromSelect("sel_customer"); comboCustomer.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0"); comboCustomer.attachEvent("onChange", function(){ comboCustomer.setComboText($("h_customer").value); }); comboCustomer.attachEvent("onBlur", function(){ var s1 = comboCustomer.getComboText().trim(); var s2 = s1.indexOf("|"); if(s2>0){ 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 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 bsnoVal = $("h_bsno").value; var state = 0; var _customer = comboCustomer.getComboText().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 += "\"amount1\":\"" + $("txt_amount1").value.trim() + "\","; searchJson += "\"amount2\":\"" + $("txt_amount2").value.trim() + "\""; searchJson += "]"; searchJson +="}"; var cacheName = ""; var bsnoCacheName = ""; var totalCacheName = ""; //先获取缓存名称,如果没有缓存名称,则自动创建新的缓存名称 if($("h_cachename").value.trim() != ""){ cacheName = "&ordercachename="+$("h_cachename").value.trim(); }else{ $("h_cachename").value = commonGridObj_order.newGuid(); cacheName = "&ordercachename="+$("h_cachename").value.trim(); } if($("h_bsnocache").value.trim() != ""){ bsnoCacheName = "&bsnocachename="+$("h_bsnocache").value.trim(); }else{ $("h_bsnocache").value = commonGridObj_order.newGuid(); bsnoCacheName = "&bsnocachename="+$("h_bsnocache").value.trim(); } if($("h_totalcache").value.trim() != ""){ totalCacheName = "&totalcachename="+$("h_totalcache").value.trim(); }else{ $("h_totalcache").value = commonGridObj_order.newGuid(); totalCacheName = "&totalcachename="+$("h_totalcache").value.trim(); } var url = ""; // var rowIndex = commonGridObj_fee.getGridObj().getRowIndex(rId); var checkBox = $("ck_allfee").checked; if(checkBox == 1){ url = "SettlementGridSource.aspx?handle=checkallfee&oplb="+selectoplb+"&search="+escape(searchJson)+cacheName+bsnoCacheName+totalCacheName+"&bsno="+bsnoVal+"&op=check&uid="+commonGridObj_order.newGuid()+"&do=paysettle"; }else{ url = "SettlementGridSource.aspx?handle=checkallfee&oplb="+selectoplb+"&search="+escape(searchJson)+cacheName+bsnoCacheName+totalCacheName+"&bsno="+bsnoVal+"&op=uncheck&uid="+commonGridObj_order.newGuid()+"&do=paysettle"; } var loader = dhtmlxAjax.getSync(url); var cacheTotal = ""; var cacheTotalObj = null; var cacheVal = loader.xmlDoc.responseText;//alert(opInfo); if(cacheVal.trim().length > 1){ cacheTotalObj = eval('(' + cacheVal.trim() + ')'); if(cacheTotalObj.totals.length > 0){ $("dvTotalRecvRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvrmb.toString()); $("dvTotalRecvUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvusd.toString()); $("dvTotalPayRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payrmb.toString()); $("dvTotalPayUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payusd.toString()); $("dvTotalSettleRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalrmb.toString()); $("dvTotalSettleUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalusd.toString()); $("dvTotalRecvRMBVal").style.color = "#F00"; $("dvTotalRecvUSDVal").style.color = "#F00"; $("dvTotalPayRMBVal").style.color = "#090"; $("dvTotalPayUSDVal").style.color = "#090"; state = parseInt(cacheTotalObj.totals[0].state); } } createFeeList(); $("ck_allfee").checked = checkBox; if(state < 0){ $("ck_allfee").checked = 0; alert("没有权限添加费用"); } // 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; // } // } // Statistics(); // } // }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(){ // //重新搜索后将缓存数据清除 // $("h_feecache").value = ""; // //并重新计算合计费用 // Statistics(); // commonGridObj_order.bind(); var _customer = comboCustomer.getComboText().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(); var _accdate = $("txt_Accdate").value.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 += "\"amount1\":\"" + $("txt_amount1").value.trim() + "\","; searchJson += "\"amount2\":\"" + $("txt_amount2").value.trim() + "\","; searchJson += "\"accDate\":\""+_accdate+"\""; searchJson += "]"; searchJson +="}"; var cacheName = ""; if($("h_cachename").value.trim() != ""){ cacheName = "&ordercachename="+$("h_cachename").value.trim(); } commonGridObj_order.setRequest("SettlementGridSource.aspx?handle=ordersearch&bstype="+_bstype+"&search="+escape(searchJson)+cacheName+"&uid="+commonGridObj_order.newGuid()+"&do=paysettle"); commonGridObj_order.initGrid(); commonGridObj_order.bind(); // //遍历当前委托信息信息,如果已经记录到缓存中,则自动将前端选择框置1 // setTimeout(function(){ // var tempCache = $("h_feecache").value; // var jsonCacheObj = null; // if(tempCache.trim() != ""){ // jsonCacheObj = eval('(' + tempCache + ')'); // // for(var i=0;i 1){ cacheTotalObj = eval('(' + cacheVal.trim() + ')'); if(cacheTotalObj.totals.length > 0){ $("dvTotalRecvRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvrmb.toString()); $("dvTotalRecvUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvusd.toString()); $("dvTotalPayRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payrmb.toString()); $("dvTotalPayUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payusd.toString()); $("dvTotalSettleRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalrmb.toString()); $("dvTotalSettleUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalusd.toString()); $("dvTotalRecvRMBVal").style.color = "#F00"; $("dvTotalRecvUSDVal").style.color = "#F00"; $("dvTotalPayRMBVal").style.color = "#090"; $("dvTotalPayUSDVal").style.color = "#090"; state = parseInt(cacheTotalObj.totals[0].state); } } createFeeList(); if(state < 0){ commonGridObj_order.getGridObj().cellByIndex(orderRowIndex,0).setValue(0); alert("没有权限添加费用"); } // $("h_bsno").value = rId; // createFeeList(); // // var orderRowIndex = commonGridObj_order.getGridObj().getRowIndex(rId); // // var checkBox = commonGridObj_order.getGridObj().cellByIndex(orderRowIndex,0).getValue(); // //当选中委托信息中某项选中时,自动将委托信息下的所有费用信息选中,并缓存数据 // if(checkBox == 1){ // setTimeout(function(){ // //先查看费用Grid是否已经加载完成 // if(commonGridObj_fee.getGridObj().getRowsNum() > 0){ // var jsonCacheObj = null // //将费用Grid全选复选框 // $("ck_allfee").checked = 1; // //遍历整个费用Grid将所有费用默认选中,并记录到页面缓存内 // for(var k=0;k 0){ // for(var j = 0;j< commonGridObj_fee.getGridObj().getRowsNum();j++){ // var feeID = commonGridObj_fee.getGridObj().getRowId(j); // //遍历缓存数据,清除费用 // for(var i = jsonCacheObj.caches.length-1;i >= 0;i--){ // if(jsonCacheObj.caches[i].id == feeID){ // if(jsonCacheObj.caches.length == 1){ // jsonCacheObj.caches.shift(); // //费用选中状态置0 // commonGridObj_fee.getGridObj().cellByIndex(j,0).setValue(0); // jsonCacheObj = null; // $("h_feecache").value = ""; // }else{ // jsonCacheObj.caches.splice(i,1); // //费用选中状态置0 // commonGridObj_fee.getGridObj().cellByIndex(j,0).setValue(0); // $("h_feecache").value = JSON.stringify(jsonCacheObj); // } // break; // } // } // } // } // Statistics(); // } // },60); // } }); if(commonGridObj_fee != null){ createFeeList(); } } //function searchOrder(){ // var _customer = comboCustomer.getComboText().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 _feetype = comboFeeType.getSelectedValue();//comboFeeType.getComboText().trim(); // //var _currency = comboCurrency.getComboText().trim(); // var _feename = comboFeeName.getSelectedValue(); // var _feetype = comboFeeType.getSelectedValue();//comboFeeType.getComboText().trim(); // var _currency = comboCurrency.getSelectedValue(); // // _feename = _feename == null ? "":_feename; // _feetype = _feetype == null?"":_feetype; // _currency = _currency == null?"":_currency; // 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 += "\"fnm\":\""+_feename+"\"," // searchJson += "\"fty\":\""+_feetype+"\","; // searchJson += "\"cur\":\""+_currency+"\""; // //searchJson += "\"ise\":\""+_is_settled+"\""; // //searchJson += "\"fty\":\""+_feetype+"\","; // //searchJson += "\"cur\":\""+_currency+"\""; // searchJson += "]"; // searchJson +="}"; // //end // // //alert(searchJson);//return; // // // commonGridObj_order.setRequest("SettlementGridSource.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; // // if(tempCache.trim() != ""){ // jsonCacheObj = eval('(' + tempCache + ')'); // // for(var i=0;i 0){ // var jsonCacheObj = null // //将费用Grid全选复选框 // $("ck_allfee").checked = 1; // //遍历整个费用Grid将所有费用默认选中,并记录到页面缓存内 // for(var k=0;k 0){ // for(var j = 0;j< commonGridObj_fee.getGridObj().getRowsNum();j++){ // var feeID = commonGridObj_fee.getGridObj().getRowId(j); // //遍历缓存数据,清除费用 // for(var i = jsonCacheObj.caches.length-1;i >= 0;i--){ // if(jsonCacheObj.caches[i].id == feeID){ // if(jsonCacheObj.caches.length == 1){ // jsonCacheObj.caches.shift(); // //费用选中状态置0 // commonGridObj_fee.getGridObj().cellByIndex(j,0).setValue(0); // jsonCacheObj = null; // $("h_feecache").value = ""; // Statistics(); // }else{ // jsonCacheObj.caches.splice(i,1); // //费用选中状态置0 // commonGridObj_fee.getGridObj().cellByIndex(j,0).setValue(0); // $("h_feecache").value = JSON.stringify(jsonCacheObj); // } // break; // } // } // } // } // Statistics(); // } // },60); // } // }); // // 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 Statistics(){ var strCache = $("h_feecache").value; var jsonCacheObj = null; if(strCache != ""){ jsonCacheObj = eval('(' + strCache + ')'); var recvFeeRMB = 0.0; var recvFeeUSD = 0.0; var payFeeRMB = 0.0; var payFeeUSD = 0.0; var totalRMBFee = 0.0; var totalUSDFee = 0.0; for(var i = 0;i < jsonCacheObj.caches.length;i++){ var feeType = jsonCacheObj.caches[i].type; var currency = jsonCacheObj.caches[i].cur; var stl = parseFloat(jsonCacheObj.caches[i].stl);//应结 var cstl = parseFloat(jsonCacheObj.caches[i].cstl);//本次结算 var ustl = parseFloat(jsonCacheObj.caches[i].ustl);//未结 if(feeType == 1){ if(currency == "RMB"){ recvFeeRMB += cstl; }else if(currency == "USD"){ recvFeeUSD += cstl; } }else{ if(currency == "RMB"){ payFeeRMB += cstl; }else if(currency == "USD"){ payFeeUSD += cstl; } } } totalRMBFee = recvFeeRMB - payFeeRMB; totalUSDFee = recvFeeUSD - payFeeUSD; $("dvTotalRecvRMBVal").innerHTML = outputMoney(recvFeeRMB.toString()); $("dvTotalRecvUSDVal").innerHTML = outputMoney(recvFeeUSD.toString()); $("dvTotalPayRMBVal").innerHTML = outputMoney(payFeeRMB.toString()); $("dvTotalPayUSDVal").innerHTML = outputMoney(payFeeUSD.toString()); $("dvTotalSettleRMBVal").innerHTML = outputMoney(totalRMBFee.toString()); $("dvTotalSettleUSDVal").innerHTML = outputMoney(totalUSDFee.toString()); $("dvTotalRecvRMBVal").style.color = "#F00"; $("dvTotalRecvUSDVal").style.color = "#F00"; $("dvTotalPayRMBVal").style.color = "#090"; $("dvTotalPayUSDVal").style.color = "#090"; if(totalRMBFee <= 0){ $("dvTotalSettleRMBVal").style.color = "#090"; }else{ $("dvTotalSettleRMBVal").style.color = "#F00"; } if(totalUSDFee <= 0){ $("dvTotalSettleUSDVal").style.color = "#090"; }else{ $("dvTotalSettleUSDVal").style.color = "#F00"; } } else{ $("dvTotalRecvRMBVal").innerHTML = 0; $("dvTotalRecvUSDVal").innerHTML = 0; $("dvTotalPayRMBVal").innerHTML = 0; $("dvTotalPayUSDVal").innerHTML = 0; $("dvTotalSettleRMBVal").innerHTML = 0; $("dvTotalSettleUSDVal").innerHTML = 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 postEnterFee(){ /*var myForm = document.createElement("form"); myForm.method="post" ; myForm.action = "gridshow.aspx" ; var myInput = document.createElement("input") ; myInput.setAttribute("name", "abc") ; myInput.setAttribute("value", "bbs"); myForm.appendChild(myInput) ; document.body.appendChild(myForm) ; myForm.submit() ; document.body.removeChild(myForm) ;*/ var myForm = document.getElementById("form1"); myForm.submit() ; } function doSettle(){ // var jsonCacheObj = null; // var tempCache = $("h_feecache").value; // if(tempCache.trim() != ""){ // jsonCacheObj = eval('(' + tempCache + ')'); // // if(jsonCacheObj.caches.length > 0){ // var tempCustomerName = jsonCacheObj.caches[0].cus; // var tempEqualCount = 0; // for(var i=1;i 0){ // alert("不能多个结算单位同时申请付费结算,请修改"); // return; // }else{ // //alert($("h_feecache").value); // postEnterFee(); // } // }else{ // alert("申请付费结算单位不能为空"); // return; // } // }else{ // alert("没有要申请付费结算的信息"); // return; // } var cacheName = ""; var bsnoCacheName = ""; var totalCacheName = ""; //先获取缓存名称,如果没有缓存名称,则自动创建新的缓存名称 if($("h_cachename").value.trim() != ""){ cacheName = "&ordercachename="+$("h_cachename").value.trim(); }else{ $("h_cachename").value = commonGridObj_order.newGuid(); cacheName = "&ordercachename="+$("h_cachename").value.trim(); } if($("h_bsnocache").value.trim() != ""){ bsnoCacheName = "&bsnocachename="+$("h_bsnocache").value.trim(); }else{ $("h_bsnocache").value = commonGridObj_order.newGuid(); bsnoCacheName = "&bsnocachename="+$("h_bsnocache").value.trim(); } if($("h_totalcache").value.trim() != ""){ totalCacheName = "&totalcachename="+$("h_totalcache").value.trim(); }else{ $("h_totalcache").value = commonGridObj_order.newGuid(); totalCacheName = "&totalcachename="+$("h_totalcache").value.trim(); } //先验证要提交开票申请的缓存数据 var validateUrl = ""; var ckBoxRmb = $("ck_rmb").checked; var ckBoxUsd = $("ck_usd").checked; var currency = ""; if(ckBoxRmb){ currency = "¤cy=RMB";//按人民币结算 }else if(ckBoxUsd){ currency = "¤cy=USD";//按美元结算 }else{ currency = "¤cy=ALL";//分别按各自币别结算 } validateUrl = "SettlementGridSource.aspx?handle=validatepost"+cacheName+currency+"&uid="+commonGridObj_order.newGuid(); var loader = dhtmlxAjax.getSync(validateUrl); var validateVal = loader.xmlDoc.responseText; var validateObj = null; if(validateVal.trim() != ""){ validateObj = eval('(' + validateVal + ')'); if(validateObj.validates.length > 0){ var isDiffCustomerName = parseInt(validateObj.validates[0].diffcust); if(isDiffCustomerName == 1){ alert("不能多个结算单位同时申请开票,请修改"); return; } // var isMaxLine = parseInt(validateObj.validates[0].ismaxline); // if(isMaxLine == 1){ // if($("ck_rename").checked){ // if($("txt_rename").value.trim() != ""){ // // }else{ // alert("请填写自定义名称"); // return; // } // }else{ // //如果超过开票最大明细则提示使用自定义名称 // alert("开票明细超过发票最大行数-"+validateObj.validates[0].maxline+" 请减少开票明细或者使用自定义名称"); // return; // } // // // } var isDiffCurrency = parseInt(validateObj.validates[0].diffcurr); if(isDiffCurrency == 1){ //如果存在不同的币别,则弹出汇率设置表 openNewDiv("dvRate");//设置汇率 }else if(isDiffCurrency == 0){ var postSessionName = ""; if($("h_postsession").value.trim() != ""){//alert($("h_postsession").value); postSessionName = "&postsession="+$("h_postsession").value.trim(); }else{ $("h_postsession").value = commonGridObj_order.newGuid(); postSessionName = "&postsession="+$("h_postsession").value.trim(); } var postSessionUrl = ""; postSessionUrl = "SettlementGridSource.aspx?handle=postpaysettle"+cacheName+bsnoCacheName+totalCacheName+postSessionName+currency+"&uid="+commonGridObj_order.newGuid(); var loader = dhtmlxAjax.getSync(postSessionUrl); var cacheVal = loader.xmlDoc.responseText; var postStatus = parseInt(cacheVal); if(postStatus == 1){ setTimeout(function(){ var openSet = "height=460, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-440)/2 + ",Left= "+(screen.width-800)/2 var openType = "_blank"; var settleCurrency = ""; if($("ck_rmb").checked){ settleCurrency = "1"; }else if($("ck_usd").checked){ settleCurrency = "2"; }else{ settleCurrency = "3"; } var openUrl = "DoPaySettlement.aspx?currency="+settleCurrency+"&oplb="+selectoplb+"&uex=1&rex=1&obj="+$("h_postsession").value; $("h_sessionid").value = 0; window.open (openUrl,openType,openSet); },100); } } } } } function openDialog(){ var session = $("h_sessionid").value; var ckBoxRmb = $("ck_rmb").checked; var ckBoxUsd = $("ck_usd").checked; if(session == "1"){ if(ckBoxRmb == 1 || ckBoxUsd == 1){ openNewDiv("dvRate");//设置汇率 var openSet = "height=450, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-450)/2 + ",Left= "+(screen.width-800)/2 var openType = "_blank"; //var feeObj_val = $("dvResult").innerHTML; var settleCurrency = ""; if($("ck_rmb").checked){ settleCurrency = "1"; }else if($("ck_usd").checked){ settleCurrency = "2"; }else{ settleCurrency = "3"; } //var openUrl = "DoSettlement.aspx?currency="+settleCurrency+"&uex="+$("h_exrmbtousd").value+"&rex="+$("txt_exrmb").value+"&obj=feesession"; }else{ var openSet = "height=450, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-450)/2 + ",Left= "+(screen.width-800)/2 var openType = "_blank"; var feeObj_val = $("dvResult").innerHTML; var settleCurrency = ""; if($("ck_rmb").checked){ settleCurrency = "1"; }else if($("ck_usd").checked){ settleCurrency = "2"; }else{ settleCurrency = "3"; } // var urlVal = "../feecodes/CurrencyAdapter.aspx?handle=drate&val="+newGuid(); // var loader = dhtmlxAjax.getSync(urlVal); // var loadVal = loader.xmlDoc.responseText; // loader = null; // // var jsonCacheObj; // var rmbRate = 0.0; // var usdRate = 0.0; // if(loadVal.length > 0){ // // jsonCacheObj = eval('(' + loadVal + ')'); // if(jsonCacheObj != null){ // for(var i = 0;i 0){ jsonCacheObj = eval('(' + loadVal + ')'); if(jsonCacheObj != null){ for(var i = 0;i
币别汇率转换
1 RMB =
" + "
  USD
1 USD =
" + "
  RMB
"; document.body.appendChild(newDiv); // mask图层 var newMask = document.createElement("div"); newMask.id = m; newMask.style.position = "absolute"; newMask.style.zIndex = "1"; newMask.style.width = document.body.scrollWidth + "px"; newMask.style.height = document.body.scrollHeight + "px"; newMask.style.top = "0px"; newMask.style.left = "0px"; newMask.style.background = "#000"; newMask.style.filter = "alpha(opacity=40)"; newMask.style.opacity = "0.40"; document.body.appendChild(newMask); } //汇率设置取消 function rateCancel(){ // $("h_exrmbtousd").value = $("h_oldexusd").value; // $("h_exusdtormb").value = $("h_oldexrmb").value; // // var openSet = "height=450, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-450)/2 + ",Left= "+(screen.width-800)/2 // var openType = "_blank"; // //var feeObj_val = $("dvResult").innerHTML; // var settleCurrency = ""; // // if($("ck_rmb").checked){ // settleCurrency = "1"; // }else if($("ck_usd").checked){ // settleCurrency = "2"; // }else{ // settleCurrency = "3"; // } // // document.body.removeChild(docEle("dvRate")); // document.body.removeChild(docEle("mask")); // // var openUrl = "DoPaySettlement.aspx?currency="+settleCurrency+"&uex="+$("h_exrmbtousd").value+"&rex="+$("txt_exrmb").value+"&obj=paysettlesession"; // $("h_sessionid").value = 0; // window.open (openUrl,openType,openSet); document.body.removeChild(docEle("dvRate")); document.body.removeChild(docEle("mask")); } //汇率设置确定 function rateEnter(){ $("h_exrmbtousd").value = $("txt_exusd").value; $("h_exusdtormb").value = $("txt_exrmb").value; var postSessionName = ""; var bsnoCacheName = ""; var totalCacheName = ""; if($("h_postsession").value.trim() != ""){//alert($("h_postsession").value); postSessionName = "&postsession="+$("h_postsession").value.trim(); }else{ $("h_postsession").value = commonGridObj_order.newGuid(); postSessionName = "&postsession="+$("h_postsession").value.trim(); } var cacheName = ""; //先获取缓存名称,如果没有缓存名称,则自动创建新的缓存名称 if($("h_cachename").value.trim() != ""){ cacheName = "&ordercachename="+$("h_cachename").value.trim(); }else{ $("h_cachename").value = commonGridObj_order.newGuid(); cacheName = "&ordercachename="+$("h_cachename").value.trim(); } if($("h_bsnocache").value.trim() != ""){ bsnoCacheName = "&bsnocachename="+$("h_bsnocache").value.trim(); }else{ $("h_bsnocache").value = commonGridObj_order.newGuid(); bsnoCacheName = "&bsnocachename="+$("h_bsnocache").value.trim(); } if($("h_totalcache").value.trim() != ""){ totalCacheName = "&totalcachename="+$("h_totalcache").value.trim(); }else{ $("h_totalcache").value = commonGridObj_order.newGuid(); totalCacheName = "&totalcachename="+$("h_totalcache").value.trim(); } var ckBoxRmb = $("ck_rmb").checked; var ckBoxUsd = $("ck_usd").checked; var postSessionUrl = ""; var currency = ""; var change = ""; if(ckBoxRmb){ currency = "¤cy=RMB";//按人民币结算 change = "&exchange="+$("h_exusdtormb").value; }else if(ckBoxUsd){ currency = "¤cy=USD";//按美元结算 change = "&exchange="+$("h_exrmbtousd").value; }else{ currency = "¤cy=ALL";//按各自的币别结算 } postSessionUrl = "SettlementGridSource.aspx?handle=postpaysettle"+cacheName+bsnoCacheName+totalCacheName+postSessionName+currency+change+"&uid="+commonGridObj_order.newGuid(); var loader = dhtmlxAjax.getSync(postSessionUrl); var cacheVal = loader.xmlDoc.responseText; var postStatus = parseInt(cacheVal); if(postStatus == 1){ var openSet = "height=460, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-440)/2 + ",Left= "+(screen.width-800)/2 var openType = "_blank"; var settleCurrency = ""; if($("ck_rmb").checked){ settleCurrency = "1"; }else if($("ck_usd").checked){ settleCurrency = "2"; }else{ settleCurrency = "3"; } var openUrl = "DoPaySettlement.aspx?currency="+settleCurrency+"&oplb="+selectoplb+"&uex="+$("h_exrmbtousd").value+"&rex="+$("h_exusdtormb").value+"&obj="+$("h_postsession").value; document.body.removeChild(docEle("dvRate")); document.body.removeChild(docEle("mask")); $("h_sessionid").value = 0; window.open (openUrl,openType,openSet); } // $("h_exrmbtousd").value = $("txt_exusd").value; // $("h_exusdtormb").value = $("txt_exrmb").value; // // var openSet = "height=450, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-450)/2 + ",Left= "+(screen.width-800)/2 // var openType = "_blank"; // //var feeObj_val = $("dvResult").innerHTML; // var settleCurrency = ""; // // if($("ck_rmb").checked){ // settleCurrency = "1"; // }else if($("ck_usd").checked){ // settleCurrency = "2"; // }else{ // settleCurrency = "3"; // } // var moduleName = ""; // // if($("h_mod").value != ""){ // moduleName = "&mod="+$("h_mod").value; // } // var openUrl = "DoApplication.aspx?currency="+settleCurrency+"&uex="+$("h_exrmbtousd").value+"&rex="+$("txt_exrmb").value+"&obj=feepaysession" + moduleName; // $("h_sessionid").value = 0; // // //删除图层 // document.body.removeChild(docEle("dvRate")); // document.body.removeChild(docEle("mask")); // window.open (openUrl,openType,openSet); } //清空查询信息 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 = "";//清空对账编号 $("txt_amount1").value = ""; $("txt_amount2").value = ""; $("h_feecache").value = ""; //初始化Grid createOrder(); commonGridObj_fee.initGrid(); Statistics(); } function orderCheckAll(){ if(commonGridObj_order != null){ var jsonOrderCacheObj = null; var state = 0; var _customer = comboCustomer.getComboText().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 += "\"amount1\":\"" + $("txt_amount1").value.trim() + "\","; searchJson += "\"amount2\":\"" + $("txt_amount2").value.trim() + "\""; searchJson += "]"; searchJson +="}"; var checkStatus = $("order_checkall").checked; //如果费用全选按钮是选中状态,则将所有委托相关的数据进行缓存 if(checkStatus){ //如果费用Grid不为空 // if(commonGridObj_order.getGridObj().getRowsNum() > 0){//alert(commonGridObj_order.getGridObj().getRowsNum()); // var tempOrderCache = ""; // var iCount = commonGridObj_order.getGridObj().getRowsNum(); // for(var i=0;i < iCount;i++){ // //获取费用ID值 // var rowID = commonGridObj_order.getGridObj().getRowId(i); // // if(i == 0){ // //初次加载先生称新的缓存对象 // var orderResult = ""; // var orderCacheBuffer = ""; // // orderCacheBuffer += "{"; // orderCacheBuffer += "\"bsno\":\""+rowID+"\""; // orderCacheBuffer += "}"; // // orderResult += "{\"orders\":["; // orderResult += orderCacheBuffer; // orderResult += "]}"; // //选择框置选中状态 // commonGridObj_order.getGridObj().cellByIndex(i,0).setValue(1); // // jsonOrderCacheObj = eval('(' + orderResult + ')');//生成对象 // // if(iCount == 1){ // $("h_ordercache").value = JSON.stringify(jsonOrderCacheObj); // } // }else{ // if(jsonOrderCacheObj != null){ // var newCache = jsonOrderCacheObj.orders; // newCache = {bsno:rowID}; // jsonOrderCacheObj.orders.push(newCache); // commonGridObj_order.getGridObj().cellByIndex(i,0).setValue(1); // if(i == iCount - 1){ // $("h_ordercache").value = JSON.stringify(jsonOrderCacheObj); // } // } // } // } // } if($("h_cachename").value != ""){ }else{ $("h_cachename").value = commonGridObj_order.newGuid(); } if($("h_bsnocache").value != ""){ }else{ $("h_bsnocache").value = commonGridObj_order.newGuid(); } if($("h_totalcache").value != ""){ }else{ $("h_totalcache").value = commonGridObj_order.newGuid(); } var bankObj = null; var url = "SettlementGridSource.aspx?handle=cacheorder&bsnocachename="+$("h_bsnocache").value+"&ordercachename="+$("h_cachename").value+"&totalcachename="+$("h_totalcache").value+"&op=check&search="+escape(searchJson)+"&val="+commonGridObj_order.newGuid()+"&do=paysettle"; var loader = dhtmlxAjax.getSync(url); var cacheTotal = ""; var cacheTotalObj = null; var cacheVal = loader.xmlDoc.responseText;//alert(opInfo); if(cacheVal.trim().length > 1){ cacheTotalObj = eval('(' + cacheVal.trim() + ')'); if(cacheTotalObj.totals.length > 0){ $("dvTotalRecvRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvrmb.toString()); $("dvTotalRecvUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvusd.toString()); $("dvTotalPayRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payrmb.toString()); $("dvTotalPayUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payusd.toString()); $("dvTotalSettleRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalrmb.toString()); $("dvTotalSettleUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalusd.toString()); $("dvTotalRecvRMBVal").style.color = "#F00"; $("dvTotalRecvUSDVal").style.color = "#F00"; $("dvTotalPayRMBVal").style.color = "#090"; $("dvTotalPayUSDVal").style.color = "#090"; state = parseInt(cacheTotalObj.totals[0].state); } } commonGridObj_order.setRequest("SettlementGridSource.aspx?handle=refreshorder&bsnocachename="+$("h_bsnocache").value+"&ordercachename="+$("h_cachename").value+"&totalcachename="+$("h_totalcache").value+"&op=check&search="+escape(searchJson)+"&uid="+commonGridObj_order.newGuid()+"&do=paysettleapp"); commonGridObj_order.initGrid(); commonGridObj_order.bind(); commonGridObj_order.getGridObj().enableHeaderImages(true); commonGridObj_order.getGridObj().attachEvent("onRowDblClicked", function(rId,cInd){ var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " +(screen.height-750)/2 + ",Left= "+(screen.width-1100)/2 var openType = "_blank"; var openUrl = ""; var oplb=commonGridObj_order.getGridObj().cellById(rId,1).getValue(); if(oplb=="海运出口") { selectoplb="op_Seae"; openUrl = "../baseinfo/opseaebaseinfo.aspx?handle=check&bsno="+rId; } else if(oplb=="海运进口") { selectoplb="op_Seai"; openUrl = "../baseinfo/opseaibaseinfo.aspx?handle=check&bsno="+rId; } else if (oplb == "仓储费") { selectoplb = "wms_fee"; openUrl = ""; } else if (oplb == "仓储入库") { selectoplb = "wms"; openUrl = ""; } else if (oplb == "仓储出库") { selectoplb = "wms_out"; openUrl = ""; } else if (oplb == "陆运托运") { selectoplb = "tmswlbshead"; openUrl = ""; } else if (oplb == "陆运派车") { selectoplb = "tmswlpchead"; openUrl = ""; } else if (oplb == "进口贸易") { selectoplb = "import_main"; openUrl = ""; } else if (oplb == "报关业务") { selectoplb = "op_apply"; openUrl = "../MvcShipping/MsOpApply/ApplyFeeView?handle=check&bsno=" + rId; } else if (oplb == "大宗散货") { selectoplb = "op_bulk"; openUrl = ""; } window.open (openUrl,openType,openSet); }); commonGridObj_order.getGridObj().attachEvent("onRowSelect", function(id,ind){ $("h_bsno").value = id; var oplb=commonGridObj_order.getGridObj().cellById(id,1).getValue(); if(oplb=="海运出口") { selectoplb="op_Seae"; } else if(oplb=="海运进口") { selectoplb="op_Seai"; } else if (oplb == "仓储费") { selectoplb = "wms_fee"; } else if (oplb == "仓储入库") { selectoplb = "wms"; } else if (oplb == "仓储出库") { selectoplb = "wms_out"; } else if (oplb == "陆运托运") { selectoplb = "tmswlbshead"; } else if (oplb == "陆运派车") { selectoplb = "tmswlpchead"; } else if (oplb == "进口贸易") { selectoplb = "import_main"; } else if (oplb == "报关业务") { selectoplb = "op_apply"; } else if (oplb == "大宗散货") { selectoplb = "op_bulk"; } createFeeList(); }); commonGridObj_order.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){ $("h_bsno").value = rId; var oplb=commonGridObj_order.getGridObj().cellById(rId,1).getValue(); if(oplb=="海运出口") { selectoplb="op_Seae"; } else if(oplb=="海运进口") { selectoplb="op_Seai"; } else if (oplb == "仓储费") { selectoplb = "wms_fee"; } else if (oplb == "仓储入库") { selectoplb = "wms"; } else if (oplb == "仓储出库") { selectoplb = "wms_out"; } else if (oplb == "陆运托运") { selectoplb = "tmswlbshead"; } else if (oplb == "陆运派车") { selectoplb = "tmswlpchead"; } else if (oplb == "进口贸易") { selectoplb = "import_main"; } else if (oplb == "报关业务") { selectoplb = "op_apply"; } else if (oplb == "大宗散货") { selectoplb = "op_bulk"; } var state = 0; var cacheName = ""; var bsnoCacheName = ""; var totalCacheName = ""; if($("h_cachename").value.trim() != ""){ cacheName = "&ordercachename="+$("h_cachename").value.trim(); }else{ $("h_cachename").value = commonGridObj_order.newGuid(); cacheName = "&ordercachename="+$("h_cachename").value.trim(); } if($("h_bsnocache").value.trim() != ""){ bsnoCacheName = "&bsnocachename="+$("h_bsnocache").value.trim(); }else{ $("h_bsnocache").value = commonGridObj_order.newGuid(); bsnoCacheName = "&bsnocachename="+$("h_bsnocache").value.trim(); } if($("h_totalcache").value.trim() != ""){ totalCacheName = "&totalcachename="+$("h_totalcache").value.trim(); }else{ $("h_totalcache").value = commonGridObj_order.newGuid(); totalCacheName = "&totalcachename="+$("h_totalcache").value.trim(); } var orderRowIndex = commonGridObj_order.getGridObj().getRowIndex(rId); var checkBox = commonGridObj_order.getGridObj().cellByIndex(orderRowIndex,0).getValue(); var url = ""; if(checkBox == 1){//委托选中状态 url = "SettlementGridSource.aspx?handle=checkorder&oplb="+selectoplb+"&bsno="+rId+"&op=check&search="+escape(searchJson)+"&val="+commonGridObj_order.newGuid()+cacheName+bsnoCacheName+totalCacheName+"&do=paysettleapp"; }else{//委托取消选中状态 url = "SettlementGridSource.aspx?handle=checkorder&oplb="+selectoplb+"&bsno="+rId+"&op=uncheck&search="+escape(searchJson)+"&val="+commonGridObj_order.newGuid()+cacheName+bsnoCacheName+totalCacheName+"&do=paysettleapp"; } //alert(url); var loader = dhtmlxAjax.getSync(url); var cacheTotal = ""; var cacheTotalObj = null; var cacheVal = loader.xmlDoc.responseText;//alert(opInfo); //alert(cacheVal); if(cacheVal.trim().length > 1){ cacheTotalObj = eval('(' + cacheVal.trim() + ')'); if(cacheTotalObj.totals.length > 0){ $("dvTotalRecvRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvrmb.toString()); $("dvTotalRecvUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvusd.toString()); $("dvTotalPayRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payrmb.toString()); $("dvTotalPayUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payusd.toString()); $("dvTotalSettleRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalrmb.toString()); $("dvTotalSettleUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalusd.toString()); $("dvTotalRecvRMBVal").style.color = "#F00"; $("dvTotalRecvUSDVal").style.color = "#F00"; $("dvTotalPayRMBVal").style.color = "#090"; $("dvTotalPayUSDVal").style.color = "#090"; state = parseInt(cacheTotalObj.totals[0].state); } } createFeeList(); if(state < 0){ commonGridObj_order.getGridObj().cellByIndex(orderRowIndex,0).setValue(0); alert("没有权限添加费用"); } }); createFeeList(); $("order_checkall").checked = true; if(state < 0){ alert("没有权限添加委托费用 共计"+(0-state)+"项 未添加"); } }else{ //如果费用Grid不为空 // if(commonGridObj_order.getGridObj().getRowsNum() > 0){ // var tempOrderCache = ""; // var iCount = commonGridObj_order.getGridObj().getRowsNum(); // for(var i=0;i < iCount;i++){ // //获取费用ID值 // var rowID = commonGridObj_order.getGridObj().getRowId(i); // // if(i == 0){ // //初次加载先生称新的缓存对象 // var orderResult = ""; // var orderCacheBuffer = ""; // // orderCacheBuffer += "{"; // orderCacheBuffer += "\"bsno\":\""+rowID+"\""; // orderCacheBuffer += "}"; // // orderResult += "{\"orders\":["; // orderResult += orderCacheBuffer; // orderResult += "]}"; // //选择框置选中状态 // commonGridObj_order.getGridObj().cellByIndex(i,0).setValue(0); // // jsonOrderCacheObj = eval('(' + orderResult + ')');//生成对象 // }else{ // if(jsonOrderCacheObj != null){ // var newCache = jsonOrderCacheObj.orders; // newCache = {bsno:rowID}; // jsonOrderCacheObj.orders.push(newCache); // commonGridObj_order.getGridObj().cellByIndex(i,0).setValue(0); // if(i == iCount - 1){ // $("h_ordercache").value = JSON.stringify(jsonOrderCacheObj); // } // } // } // } // } if($("h_cachename").value != ""){ }else{ $("h_cachename").value = commonGridObj_order.newGuid(); } if($("h_bsnocache").value != ""){ }else{ $("h_bsnocache").value = commonGridObj_order.newGuid(); } var url = "SettlementGridSource.aspx?handle=cacheorder&bsnocachename="+$("h_bsnocache").value+"&ordercachename="+$("h_cachename").value+"&totalcachename="+$("h_totalcache").value+"&op=uncheck&search="+escape(searchJson)+"&val="+commonGridObj_order.newGuid()+"&do=paysettle"; //alert(url); var loader = dhtmlxAjax.getSync(url); var cacheTotal = ""; var cacheTotalObj = null; var cacheVal = loader.xmlDoc.responseText;//alert(opInfo); //alert(cacheVal); if(cacheVal.trim().length > 1){ cacheTotalObj = eval('(' + cacheVal.trim() + ')'); if(cacheTotalObj.totals.length > 0){ $("dvTotalRecvRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvrmb.toString()); $("dvTotalRecvUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvusd.toString()); $("dvTotalPayRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payrmb.toString()); $("dvTotalPayUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payusd.toString()); $("dvTotalSettleRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalrmb.toString()); $("dvTotalSettleUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalusd.toString()); $("dvTotalRecvRMBVal").style.color = "#F00"; $("dvTotalRecvUSDVal").style.color = "#F00"; $("dvTotalPayRMBVal").style.color = "#090"; $("dvTotalPayUSDVal").style.color = "#090"; state = parseInt(cacheTotalObj.totals[0].state); } } commonGridObj_order.setRequest("SettlementGridSource.aspx?handle=refreshorder&bsnocachename="+$("h_bsnocache").value+"&ordercachename="+$("h_cachename").value+"&totalcachename="+$("h_totalcache").value+"&op=uncheck&search="+escape(searchJson)+"&uid="+commonGridObj_order.newGuid()+"&do=paysettleapp"); commonGridObj_order.initGrid(); commonGridObj_order.bind(); commonGridObj_order.getGridObj().enableHeaderImages(true); commonGridObj_order.getGridObj().attachEvent("onRowDblClicked", function(rId,cInd){ var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " +(screen.height-750)/2 + ",Left= "+(screen.width-1100)/2 var openType = "_blank"; var openUrl = ""; var oplb=commonGridObj_order.getGridObj().cellById(rId,1).getValue(); if(oplb=="海运出口") { selectoplb="op_Seae"; openUrl = "../baseinfo/opseaebaseinfo.aspx?handle=check&bsno="+rId; } else if(oplb=="海运进口") { selectoplb="op_Seai"; openUrl = "../baseinfo/opseaibaseinfo.aspx?handle=check&bsno="+rId; } else if (oplb == "仓储费") { selectoplb = "wms_fee"; openUrl = ""; } else if (oplb == "仓储入库") { selectoplb = "wms"; openUrl = ""; } else if (oplb == "仓储出库") { selectoplb = "wms_out"; openUrl = ""; } else if (oplb == "陆运托运") { selectoplb = "tmswlbshead"; openUrl = ""; } else if (oplb == "陆运派车") { selectoplb = "tmswlpchead"; openUrl = ""; } else if (oplb == "进口贸易") { selectoplb = "import_main"; openUrl = ""; } else if (oplb == "报关业务") { selectoplb = "op_apply"; openUrl = "../MvcShipping/MsOpApply/ApplyFeeView?handle=check&bsno=" + rId; } else if (oplb == "大宗散货") { selectoplb = "op_bulk"; openUrl = ""; } window.open (openUrl,openType,openSet); }); commonGridObj_order.getGridObj().attachEvent("onRowSelect", function(id,ind){ $("h_bsno").value = id; var oplb=commonGridObj_order.getGridObj().cellById(id,1).getValue(); if(oplb=="海运出口") { selectoplb="op_Seae"; } else if(oplb=="海运进口") { selectoplb="op_Seai"; } else if (oplb == "仓储费") { selectoplb = "wms_fee"; } else if (oplb == "仓储入库") { selectoplb = "wms"; } else if (oplb == "仓储出库") { selectoplb = "wms_out"; } else if (oplb == "陆运托运") { selectoplb = "tmswlbshead"; } else if (oplb == "陆运派车") { selectoplb = "tmswlpchead"; } else if (oplb == "进口贸易") { selectoplb = "import_main"; } else if (oplb == "报关业务") { selectoplb = "op_apply"; } else if (oplb == "大宗散货") { selectoplb = "op_bulk"; } createFeeList(); }); commonGridObj_order.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){ $("h_bsno").value = rId; var oplb=commonGridObj_order.getGridObj().cellById(rId,1).getValue(); if(oplb=="海运出口") { selectoplb="op_Seae"; } else if(oplb=="海运进口") { selectoplb="op_Seai"; } else if (oplb == "仓储费") { selectoplb = "wms_fee"; } else if (oplb == "仓储入库") { selectoplb = "wms"; } else if (oplb == "仓储出库") { selectoplb = "wms_out"; } else if (oplb == "陆运托运") { selectoplb = "tmswlbshead"; } else if (oplb == "陆运派车") { selectoplb = "tmswlpchead"; } else if (oplb == "进口贸易") { selectoplb = "import_main"; } else if (oplb == "报关业务") { selectoplb = "op_apply"; } else if (oplb == "大宗散货") { selectoplb = "op_bulk"; } var state = 0; var cacheName = ""; var bsnoCacheName = ""; var totalCacheName = ""; if($("h_cachename").value.trim() != ""){ cacheName = "&ordercachename="+$("h_cachename").value.trim(); }else{ $("h_cachename").value = commonGridObj_order.newGuid(); cacheName = "&ordercachename="+$("h_cachename").value.trim(); } if($("h_bsnocache").value.trim() != ""){ bsnoCacheName = "&bsnocachename="+$("h_bsnocache").value.trim(); }else{ $("h_bsnocache").value = commonGridObj_order.newGuid(); bsnoCacheName = "&bsnocachename="+$("h_bsnocache").value.trim(); } if($("h_totalcache").value.trim() != ""){ totalCacheName = "&totalcachename="+$("h_totalcache").value.trim(); }else{ $("h_totalcache").value = commonGridObj_order.newGuid(); totalCacheName = "&totalcachename="+$("h_totalcache").value.trim(); } var orderRowIndex = commonGridObj_order.getGridObj().getRowIndex(rId); var checkBox = commonGridObj_order.getGridObj().cellByIndex(orderRowIndex,0).getValue(); var url = ""; if(checkBox == 1){//委托选中状态 url = "SettlementGridSource.aspx?handle=checkorder&oplb="+selectoplb+"&bsno="+rId+"&op=check&search="+escape(searchJson)+"&val="+commonGridObj_order.newGuid()+cacheName+bsnoCacheName+totalCacheName+"&do=paysettleapp"; }else{//委托取消选中状态 url = "SettlementGridSource.aspx?handle=checkorder&oplb="+selectoplb+"&bsno="+rId+"&op=uncheck&search="+escape(searchJson)+"&val="+commonGridObj_order.newGuid()+cacheName+bsnoCacheName+totalCacheName+"&do=paysettleapp"; } //alert(url); var loader = dhtmlxAjax.getSync(url); var cacheTotal = ""; var cacheTotalObj = null; var cacheVal = loader.xmlDoc.responseText;//alert(opInfo); //alert(cacheVal); if(cacheVal.trim().length > 1){ cacheTotalObj = eval('(' + cacheVal.trim() + ')'); if(cacheTotalObj.totals.length > 0){ $("dvTotalRecvRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvrmb.toString()); $("dvTotalRecvUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].recvusd.toString()); $("dvTotalPayRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payrmb.toString()); $("dvTotalPayUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].payusd.toString()); $("dvTotalSettleRMBVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalrmb.toString()); $("dvTotalSettleUSDVal").innerHTML = outputMoney(cacheTotalObj.totals[0].totalusd.toString()); $("dvTotalRecvRMBVal").style.color = "#F00"; $("dvTotalRecvUSDVal").style.color = "#F00"; $("dvTotalPayRMBVal").style.color = "#090"; $("dvTotalPayUSDVal").style.color = "#090"; state = parseInt(cacheTotalObj.totals[0].state); } } createFeeList(); if(state < 0){ commonGridObj_order.getGridObj().cellByIndex(orderRowIndex,0).setValue(0); alert("没有权限添加费用"); } }); createFeeList(); $("order_checkall").checked = false; if(state < 0){ alert("没有权限添加委托费用 共计"+(0-state)+"项 未取消"); } } } } function exchangeCovert(sourceObj,targetObj,type){ //RMB换算成USD if(type == 1){ var rmbVal = clearNoNum(sourceObj.value); if(rmbVal.trim() == ""){ rmbVal = 1; } var usdVal = clearNoNum(targetObj.value); if(rmbVal == 0.0){ //sourceObj.value = rmbVal; //targetObj.value = 0;//$("h_oldexusd").value; return; } targetObj.value = fomatFloat(1/(usdVal*rmbVal),5); }else if(type == 2){ //USD换算成RMB var usdVal = sourceObj.value; if(usdVal.trim() == ""){ usdVal = 0; } var rmbVal = targetObj.value; targetObj.value = fomatFloat(1/usdVal,5); } } function fomatFloat(src,pos){ return Math.round(src*Math.pow(10, pos))/Math.pow(10, pos); } //是否为数字,且数值格式是否正确 function IsNumFormat(val) { var re = /^[-\+]?\d+(\.\d+)?$/; if (!re.test(val)) { return false; } else { if (val.toString().indexOf(".") > 0) { val.toString().replace("-", ""); val.toString().replace("+", ""); if (val.toString().substr(0, 1) == "0" && val.toString().substr(0, 2) != "0.") { return false; } } else { var re1 = /^[-\+]+[1-9]+[0-9]*]*$/; if (!re1.test(val)) { re1 = /^[1-9]+[0-9]*]*$/; if (!re1.test(val)) { return false; } } } return true; } } // function getIsNum(x) { var str = x.value.trim(); if (str == "0") { return; } else if (str == "") { return; // str = 0; // x.value = 0; } else { var bl = IsNumFormat(str); if (!bl) { alert("数值格式错误!"); x.focus(); x.select(); } } }