var mygrid_recv; var mygrid_pay; var page_count = 5; var column_count; var jsonFeeObj; var jsonPayObj; var changeCount = 0; var authoriyStatus; var changeFeeRecvCount = 0; var changeFeePayCount = 0; var newFeeRecvCount = 0; var newFeePayCount = 0; var recv_menu; var pay_menu; var linkgid = ""; var clientgid = ""; var cknum=0;//出库数量 var pressRecord; var quantityVal; var quantityObj; function $(id){ return document.getElementById(id); } //function document.onkeydown(){ // if(event.keyCode == 8){ // if(document.selection){ // var range = document.selection.createRange();; // // if(range.parentElement().name == null){ // return false; // }else{ // return true; // } // } // } //} function initGrid(){ doInitRecvGrid(); } function doInitRecvGrid(){ enableAction(); mygrid_recv = new dhtmlXGridObject('mygrid_container_recv'); mygrid_recv.setImagePath("../images/"); mygrid_recv.setSkin("xp"); // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 //mygrid_recv.setHeader(",费用状态,海运费及附加费名称,结算单位,计费标准,单价,数量,佣金比例,金额,币别,汇率,FRT,费用备注,是否垫付,结算金额,开票金额,发票号码,录入人,录入时间,TID,linkgid"); // 1 2 3 4 5 mygrid_recv.setHeader(",费用名称,船公司,箱型,报价,备注"); mygrid_recv.setInitWidths("40,120,120,120,120,280"); mygrid_recv.setColAlign("center,center,center,center,center,center"); mygrid_recv.setColSorting("na,str,str,str,int,str"); mygrid_recv.setColTypes("ch,co,co,co,ed,ed"); // clientgid = $("hdCLIENTGID").value; linkgid = $("hdGID").value; //判断委托单有无费用 var urlVal = "CRMClientQuotationListGridSource.aspx?type=1&handle=exist&linkgid=" + linkgid + "&clientgid=" + clientgid + "&val=" + newGuid(); var loader = dhtmlxAjax.getSync(urlVal); var loadVal = loader.xmlDoc.responseText; loader = null; if(parseInt(loadVal) == 1){ //获取海运费及附加费信息,初始化grid mygrid_recv.loadXML("CRMClientQuotationListGridSource.aspx?type=1&handle=init&linkgid=" + linkgid + "&clientgid=" + clientgid, function() { ReShowLabel(mygrid_recv); doInitPayGrid(); }); }else{ doInitPayGrid(); } mygrid_recv.init(); mygrid_recv.enableEditEvents(true,false,true); mygrid_recv.enableKeyboardSupport(true); setTimeout(function(){ //initLoading(); //调用缓存信息 var cacheTemplate = $("h_cachetemplate").value; var importType = parseInt($("h_importtype").value); if(cacheTemplate != ""){ var jsonCacheObj = null; jsonCacheObj = eval('(' + cacheTemplate + ')'); var delAry = new Array(); for(var i=0;i= 0){ var combo_feename; combo_feename = mygrid_recv.getCustomCombo(id,1); if(combo_feename.getKeys.length <= 1){ setFeeNameCombo(combo_feename); } var combo_cust; combo_cust = mygrid_recv.getCustomCombo(id,2); if(combo_cust.getKeys.length <= 1){ setCustomerCombo(combo_cust,id); } var combo_unit; combo_unit = mygrid_recv.getCustomCombo(id,3); if(combo_unit.getKeys.length <= 1){ setUnitCombo(combo_unit); } return true; } } }); //手动编写Grid控件编辑事件,由于免费控件没有提供完整的编辑判断功能,现特此做更改 mygrid_recv.attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){ var newCheckValue = false; //初始化状态 if (stage == 0) { return true; } if(stage == 1){ var selectedId = mygrid_recv.getSelectedRowId(); var rowIndex = mygrid_recv.getRowIndex(selectedId); for(var i = 0; i < document.all.length; i++){ if(document.all(i).tagName == "TEXTAREA" && document.all(i).id != "tbREMARK"){ txtEdit = document.all(i); txtEdit.focus(); txtEdit.select(); break; } } } //如果编辑结束 if(stage == 2){ if(oValue==null || oValue=="" || oValue=="0"){ return true; } changeFeeRecvCount++; if(cInd == 1 || cInd == 2) { var rowIndex = mygrid_recv.getRowIndex(rId); if(pressCount == 1) { if(flagFilter == 1) { mygrid_recv.cellByIndex(rowIndex,cInd).setLabel(oValue);//alert(oValue); return true; } else { var cellVal = mygrid_recv.cellByIndex(rowIndex,cInd).getValue(); var combo = mygrid_recv.getCustomCombo(rId,cInd); var comboArg = combo.getKeys(); var tempCount = 0; if(cellVal.indexOf(" ") >0 && cellVal.indexOf(" ") < cellVal.length){ cellVal = cellVal.substring(0,cellVal.indexOf(" ")); for(var i = 0;i 0){ mygrid_recv.cellByIndex(rowIndex,cInd).setValue(comboArg[i]); mygrid_recv.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]); tempCount++; break; } } } } if(tempCount == 0){ mygrid_recv.cellByIndex(rowIndex,cInd).setValue(""); mygrid_recv.cellByIndex(rowIndex,cInd).setLabel(""); } isExchange = false; pressRecord = ""; pressRowIndex = -1; pressCellIndex = -1; pressCount = 0; flagFilter = 0; return true; } } else if(pressCount == 2) { if(flagFilter == 1) { mygrid_recv.editStop(); mygrid_recv.cellByIndex(rowIndex,cInd).setLabel(oValue); } else { if(pressRowIndex != rowIndex && pressCellIndex != cInd) { return true; } else { isExchange = false; pressRecord = ""; pressRowIndex = -1; pressCellIndex = -1; pressCount = 0; flagFilter = 0; var cellVal = mygrid_recv.cellByIndex(rowIndex,cInd).getValue().trim(); var combo = mygrid_recv.getCustomCombo(rId,cInd); var comboArg = combo.getKeys(); var tempCount = 0; if(cellVal.indexOf(" ") >0 && cellVal.indexOf(" ") < cellVal.length){ cellVal = cellVal.substring(0,cellVal.indexOf(" ")); for(var i = 0;i0 && cellVal.indexOf(" ") < cellVal.length) { cellVal = cellVal.substring(0,cellVal.indexOf(" ")); for(var i = 0;i 0) { mygrid_recv.cellByIndex(rowIndex,cInd).setValue(comboArg[i]); mygrid_recv.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]); break; } } } return true; } } else { return true; } } }); //键盘操作事件 mygrid_recv.attachEvent("onKeyPress", function(code, cFlag, sFlag) { //onKeyPress begin //获取当前RowID var selectedId = mygrid_recv.getSelectedRowId(); //获取当前RowIndex var rowIndex = mygrid_recv.getRowIndex(selectedId); //获取当前CellIndex(ind) var ind = mygrid_recv.getSelectedCellIndex(); //触发操作事件前获取单元值 var oldVal = mygrid_recv.cellByIndex(rowIndex, ind).getValue(); //获取编辑单元 var txtEdit; for (i = 0; i < document.all.length; i++) { if (document.all(i).tagName == "TEXTAREA" && document.all(i).id != "tbREMARK") { txtEdit = document.all(i); break; } } if (code == 13) { //Enter键 if (ind == 1 || ind == 2 || ind == 3) { //如果是检索失败, if (pressCount == 2) { mygrid_recv.editStop(); //将value写入cell(触发 stage2) mygrid_recv.cellByIndex(rowIndex, ind).setValue(oldVal); //重新打开cell(触发stage0 stage1) mygrid_recv.selectCell(rowIndex, ind, true, true); mygrid_recv.cellByIndex(rowIndex, ind).setLabel(oldVal); mygrid_recv.editCell(); return true; } else { return true; } } else { return true; } } //Tab键 if (code == 9) { //code9 begin var colCount = mygrid_recv.getColumnsNum(); var rowCount = mygrid_recv.getRowsNum(); if (ind < colCount) { mygrid_recv.selectCell(rowIndex, ind + 1, true, true); mygrid_recv.editCell(); if (ind == colCount - 1) { if (rowIndex < rowCount) { mygrid_recv.editStop(true); mygrid_recv.clearSelection(); mygrid_recv.selectCell(rowIndex + 1, 1, true, true); mygrid_recv.editCell(); } else { return; } } else { return; } } //cdoe9 end } if ((code >= 65 && code <= 90) || (code >= 48 && code <= 57) || (code >= 96 && code <= 105)) {//如果是输入英文字符 if (ind == 1 || ind == 2 || ind == 3) { //获取键盘输入字符 var pressVal = String.fromCharCode(code); var start = 0; var end = 0; if (document.selection) { var range = document.selection.createRange(); if (range.parentElement().className == txtEdit.className) { var range_all = document.body.createTextRange(); range_all.moveToElementText(txtEdit); for (start = 0; range_all.compareEndPoints("StartToStart", range) < 0; start++) { range_all.moveStart('character', 1); } for (var i = 0; i <= start; i++) { if (txtEdit.value.charAt(i) == '\n') start++; } var range_all = document.body.createTextRange(); range_all.moveToElementText(txtEdit); for (end = 0; range_all.compareEndPoints('StartToEnd', range) < 0; end++) range_all.moveStart('character', 1); for (var i = 0; i <= end; i++) { if (txtEdit.value.charAt(i) == '\n') end++; } } } //如果是当前检索位置 if (rowIndex == pressRowIndex && ind == pressCellIndex) { //未选中多个字符 if (start == end) { if (pressRecord != null) { if (start != pressRecord.length) { if (start != 0) { var firstVal = pressRecord.substring(0, start - 1); var endVal = pressRecord.substring(start + 1, txtEdit.value.length - 1); pressRecord = firstVal + pressVal + endVal; } } else { pressRecord = pressRecord + pressVal; } } } //选中多个字符 if (start != end) { if (pressRecord != null) { var firstVal = pressRecord.substring(0, start); var endVal = pressRecord.substring(end - 1, txtEdit.value.length - 1); pressRecord = firstVal + pressVal + endVal; } } } else { pressRecord = pressVal; pressRowIndex = rowIndex; pressCellIndex = ind; } //获取combo下拉列表 var combo = mygrid_recv.getCustomCombo(selectedId, ind); var comboArg = combo.getKeys(); var count = 0; //开始遍历检索 //如果检索成功 状态pressCount=1 如果不成功应为pressCount=2 for (var i = 0; i < comboArg.length; i++) { if (combo.get(comboArg[i]).toUpperCase().trim().indexOf(pressRecord) == 0) { //计数 count++; //获取value var oldVal = comboArg[i]; //获取label var oldLab = combo.get(comboArg[i]); //记录状态值 检索到数据项 pressCount = 1; flagFilter = 1; //关闭编辑 mygrid_recv.editStop(); //将value写入cell(触发 stage2) mygrid_recv.cellByIndex(rowIndex, ind).setValue(oldVal); flagFilter = 0; //重新打开cell(触发stage0 stage1) mygrid_recv.selectCell(rowIndex, ind, true, true); mygrid_recv.editCell(); var old_length = oldLab.length; //产生效果将检索字母之后的数据进行选黑 for (i = 0; i < document.all.length; i++) { if (document.all(i).tagName == "TEXTAREA" && document.all(i).id != "tbREMARK") { txtEdit = document.all(i); var rt = txtEdit.createTextRange(); rt.collapse(); rt.select(); //光标置最前 var r = document.selection.createRange(); r.collapse(false); r.moveStart("character", pressRecord.length); //从m位开始 r.moveEnd("character", old_length); //选取n位 r.select(); break; } } break; } } //如果检索不能成功 pressCount=2 if (count == 0) { pressCount = 2; txtEdit.value = pressRecord; for (i = 0; i < document.all.length; i++) { if (document.all(i).tagName == "TEXTAREA" && document.all(i).id != "tbREMARK") { txtEdit = document.all(i); var rt = txtEdit.createTextRange(); rt.collapse(); rt.select(); //光标置最前 var r = document.selection.createRange(); r.collapse(true); r.moveStart("character", pressRecord.length); //从m位开始 r.moveEnd("character", pressRecord.length); //选取n位 r.select(); break; } } } } if ((code >= 48 && code <= 57) || (code >= 96 && code <= 105)) { if (ind == 4 || ind == 5) { return true; } } } //delete if (code == 8) { //code8 begin if (ind == 1 || ind == 2 || ind == 3) { var start = 0; var end = 0; if (document.selection) { var range = document.selection.createRange(); if (range.parentElement().className == txtEdit.className) { var range_all = document.body.createTextRange(); range_all.moveToElementText(txtEdit); for (start = 0; range_all.compareEndPoints("StartToStart", range) < 0; start++) { range_all.moveStart('character', 1); } for (var i = 0; i <= start; i++) { if (txtEdit.value.charAt(i) == '\n') start++; } var range_all = document.body.createTextRange(); range_all.moveToElementText(txtEdit); for (end = 0; range_all.compareEndPoints('StartToEnd', range) < 0; end++) range_all.moveStart('character', 1); for (var i = 0; i <= end; i++) { if (txtEdit.value.charAt(i) == '\n') end++; } } } // alert(start);alert(end); //未选中多个字符 if (start == end) { if (pressRecord != null) { if (start != 0) { var firstVal = pressRecord.substring(0, start - 1); var endVal = pressRecord.substring(start + 1, txtEdit.value.length - 1); pressRecord = firstVal; } } } //选中多个字符 if (start != end) { if (pressRecord != null) { var firstVal = pressRecord.substring(0, start); var endVal = pressRecord.substring(end - 1, txtEdit.value.length - 1); pressRecord = firstVal + endVal; } } setTimeout(function() { if (pressRecord != null) { if (pressRecord.trim().length > 0) { var combo = mygrid_recv.getCustomCombo(selectedId, ind); var comboArg = combo.getKeys(); var count = 0; for (var i = 0; i < comboArg.length; i++) { if (combo.get(comboArg[i]).toUpperCase().trim().indexOf(pressRecord) == 0) { count++; var oldVal = comboArg[i]; var oldLab = combo.get(comboArg[i]); pressCount = 3; mygrid_recv.editStop(); mygrid_recv.cellByIndex(rowIndex, ind).setValue(oldVal); mygrid_recv.selectCell(rowIndex, ind, true, true); mygrid_recv.editCell(); var old_length = oldLab.length; for (i = 0; i < document.all.length; i++) { if (document.all(i).tagName == "TEXTAREA" && document.all(i).id != "tbREMARK") { txtEdit = document.all(i); var rt = txtEdit.createTextRange(); rt.collapse(); rt.select(); //光标置最前 var r = document.selection.createRange(); r.collapse(false); r.moveStart("character", pressRecord.length); //从m位开始 r.moveEnd("character", old_length); //选取n位 //txtEdit.focus(); r.select(); } } break; } } } } }, 1000); return true; } else { return true; } //code8 end } //向下方向键 if (code == 40) { //code40 begin if (ind == 5 || ind == 4) { var rowCount = mygrid_recv.getRowsNum(); mygrid_recv.clearSelection(); mygrid_recv.editStop(); if (rowIndex == (rowCount - 1)) { addRecvRow(); } else { mygrid_recv.selectCell(rowIndex + 1, 1, true, true); mygrid_recv.editCell(); } } else { pressCount = 0; return true; } //code40 end } //向上箭头 if (code == 38) { //code38 begin if (ind == 5 || ind == 4) { if (rowIndex > 0) { mygrid_recv.clearSelection(); mygrid_recv.editStop(); mygrid_recv.selectCell(rowIndex - 1, 1, true, true); mygrid_recv.editCell(); var rowfeename = mygrid_recv.cellByIndex(rowIndex,1).getValue(); if (rowfeename == 0) { mygrid_recv.deleteRow(selectedId) newFeeRecvCount--; } } } else { pressCount = 0; return true; } //code38 end } //左箭头 if (code == 37) { //code37 begin mygrid_recv.clearSelection(); mygrid_recv.editStop(); mygrid_recv.editCell(); return true; } //code37 end //右箭头 if (code == 39) { //code39 begin mygrid_recv.clearSelection(); mygrid_recv.editStop(); mygrid_recv.editCell(); return true; } //code39 end //键盘输入数字code >= 48 && code <= 57|| code >= 96 && code <= 105 || if (code >= 48 && code <= 57 || code >= 96 && code <= 105 || code == 188 || code == 110 || code == 190 || code == 229) { if (ind == 2 || ind == 3 || ind == 4 || ind == 5 || ind == 1) { return true; } } if (code >= 65 && code <= 90) {//如果是输入英文字符 if (ind == 2 || ind == 3 || ind == 5 || ind == 1) { return true; } } if (code == 189 || code == 109) { if (ind == 4) { return true; } } //onKeyPress end }); setTimeout(function(){ },460); } //讲下拉列表Combo所有生成Array数组 function setComboByArray(gridNewObj,comboObj,rowGID,colIndex){ //var comboTxt_arg = new Array(); var comboVal_arg = new Array(); comboVal_arg = comboObj.getKeys(); var newCombo = gridNewObj.getCustomCombo(rowGID,colIndex); for(var i = 0;i < comboVal_arg.length;i++){ var txtValue = comboObj.get(comboVal_arg[i]); newCombo.put(comboVal_arg[i],txtValue); } } function spliceBuffer(arrayRow){ var strBuffer = ""; for(var i = 0;i,费用状态,人民币费用名称,结算单位,计费标准,单价,数量,佣金比例,金额,币别,汇率,FRT,费用备注,是否垫付,结算金额,申请金额,支票号码,录入人,录入时间,TID,linkgid"); // 1 2 3 4 mygrid_pay.setHeader(",费用名称,箱型,报价,备注"); mygrid_pay.setInitWidths("40,120,120,120,400"); mygrid_pay.setColAlign("center,center,center,center,center"); mygrid_pay.setColSorting("na,str,str,int,str"); mygrid_pay.setColTypes("ch,co,co,ed,ed"); // clientgid = $("hdCLIENTGID").value; linkgid = $("hdGID").value; ////判断委托单有无人民币费用 var urlVal = "CRMClientQuotationListGridSource.aspx?type=2&handle=exist&linkgid=" + linkgid + "&clientgid=" + clientgid + "&val=" + newGuid(); var loader = dhtmlxAjax.getSync(urlVal); var loadVal = loader.xmlDoc.responseText; loader = null; if(parseInt(loadVal) == 1){ //获取委托单人民币信息,初始化grid mygrid_pay.loadXML("CRMClientQuotationListGridSource.aspx?type=2&handle=init&linkgid=" + linkgid + "&clientgid=" + clientgid, function() { ReShowLabel(mygrid_pay); }); } else{} mygrid_pay.init(); mygrid_pay.enableEditEvents(true,false,true); mygrid_pay.enableMultiselect(true); mygrid_pay.enableKeyboardSupport(true); var cacheTemplate = $("h_cachetemplate").value; var importType = parseInt($("h_importtype").value); setTimeout(function(){ var cacheTemplate = $("h_cachetemplate").value; var importType = parseInt($("h_importtype").value); if(cacheTemplate != ""){ var jsonCacheObj = null; jsonCacheObj = eval('(' + cacheTemplate + ')'); var delAry = new Array(); for(var i=0;i= 0){ var combo_feename; combo_feename = mygrid_pay.getCustomCombo(id,1); if(combo_feename.getKeys.length <= 1){ setFeeNameCombo(combo_feename); } var combo_unit; combo_unit = mygrid_pay.getCustomCombo(id,2); if(combo_unit.getKeys.length <= 1){ setUnitCombo(combo_unit); } return true; } } }); //手动编写Grid控件编辑事件,由于免费控件没有提供完整的编辑判断功能,现特此做更改 mygrid_pay.attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){ var newCheckValue = false; //初始化状态 if (stage == 0) { return true; } if(stage == 1){ var selectedId = mygrid_pay.getSelectedRowId(); var rowIndex = mygrid_pay.getRowIndex(selectedId); var txtEdit; for(i = 0; i < document.all.length; i++){ if(document.all(i).tagName == "TEXTAREA" && document.all(i).id != "tbREMARK"){ txtEdit = document.all(i); txtEdit.focus(); txtEdit.select(); break; } } } //如果编辑结束 if(stage == 2){ if(oValue==null || oValue=="" || oValue=="0"){ return true; } changeFeePayCount++; if(cInd == 1){ var rowIndex = mygrid_pay.getRowIndex(rId); if(pressCount == 1){ if(flagFilter == 1){ mygrid_pay.cellByIndex(rowIndex,cInd).setLabel(oValue); return true; }else{ var cellVal = mygrid_pay.cellByIndex(rowIndex,cInd).getValue(); var combo = mygrid_pay.getCustomCombo(rId,cInd); var comboArg = combo.getKeys(); var tempCount = 0; if(cellVal.indexOf(" ") >0 && cellVal.indexOf(" ") < cellVal.length){ cellVal = cellVal.substring(0,cellVal.indexOf(" ")); for(var i = 0;i 0){ mygrid_pay.cellByIndex(rowIndex,cInd).setValue(comboArg[i]); mygrid_pay.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]); tempCount++; break; } } } }//alert(tempCount) if(tempCount == 0){ mygrid_pay.cellByIndex(rowIndex,cInd).setValue(""); mygrid_pay.cellByIndex(rowIndex,cInd).setLabel(""); } isExchange = false; pressRecord = ""; pressRowIndex = -1; pressCellIndex = -1; pressCount = 0; flagFilter = 0; return true; } }else if(pressCount == 2){ if(flagFilter == 1){ mygrid_pay.editStop(); mygrid_pay.cellByIndex(rowIndex,cInd).setLabel(oValue); }else{ if(pressRowIndex != rowIndex && pressCellIndex != cInd){//alert(11) return true; }else{ isExchange = false; pressRecord = ""; pressRowIndex = -1; pressCellIndex = -1; pressCount = 0; flagFilter = 0; var cellVal = mygrid_pay.cellByIndex(rowIndex,cInd).getValue();//alert(cellVal) var combo = mygrid_pay.getCustomCombo(rId,cInd); var comboArg = combo.getKeys(); var tempCount = 0; if(cellVal.indexOf(" ") >0 && cellVal.indexOf(" ") < cellVal.length){ cellVal = cellVal.substring(0,cellVal.indexOf(" ")); for(var i = 0;i0 && cellVal.indexOf(" ") < cellVal.length){ cellVal = cellVal.substring(0,cellVal.indexOf(" ")); for(var i = 0;i 0){ mygrid_pay.cellByIndex(rowIndex,cInd).setValue(comboArg[i]); mygrid_pay.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]); break; } } } return true; } }else{ return true; } } }); //键盘操作事件 mygrid_pay.attachEvent("onKeyPress", function(code, cFlag, sFlag) { //onKeyPress begin //获取当前RowID var selectedId = mygrid_pay.getSelectedRowId(); //获取当前RowIndex var rowIndex = mygrid_pay.getRowIndex(selectedId); //获取当前CellIndex(ind) var ind = mygrid_pay.getSelectedCellIndex(); //触发操作事件前获取单元值 var oldVal = mygrid_pay.cellByIndex(rowIndex, ind).getValue(); //获取编辑单元 var txtEdit; for (i = 0; i < document.all.length; i++) { if (document.all(i).tagName == "TEXTAREA" && document.all(i).id != "tbREMARK") { txtEdit = document.all(i); break; } } if (code == 13) { if (ind == 1 || ind == 2) { //如果是检索失败, if (pressCount == 2) { mygrid_pay.editStop(); //将value写入cell(触发 stage2) mygrid_pay.cellByIndex(rowIndex, ind).setValue(oldVal); //重新打开cell(触发stage0 stage1) mygrid_pay.selectCell(rowIndex, ind, true, true); mygrid_pay.cellByIndex(rowIndex, ind).setLabel(oldVal); mygrid_pay.editCell(); return true; } else { return true; } } else { return true; } } //Tab键 if (code == 9) { //code9 begin var colCount = mygrid_pay.getColumnsNum(); var rowCount = mygrid_pay.getRowsNum(); if (ind < colCount) { mygrid_pay.selectCell(rowIndex, ind + 1, true, true); mygrid_pay.editCell(); if (ind == colCount - 1) { if (rowIndex < rowCount) { mygrid_pay.editStop(true); mygrid_pay.clearSelection(); mygrid_pay.selectCell(rowIndex + 1, 1, true, true); mygrid_pay.editCell(); } else { return; } } else { return; } } //cdoe9 end } if ((code >= 65 && code <= 90) || (code >= 48 && code <= 57) || (code >= 96 && code <= 105)) {//如果是输入英文字符 if (ind == 1 || ind == 2) { //获取键盘输入字符 var pressVal = String.fromCharCode(code); var start = 0; var end = 0; if (document.selection) { var range = document.selection.createRange(); if (range.parentElement().className == txtEdit.className) { var range_all = document.body.createTextRange(); range_all.moveToElementText(txtEdit); for (start = 0; range_all.compareEndPoints("StartToStart", range) < 0; start++) { range_all.moveStart('character', 1); } for (var i = 0; i <= start; i++) { if (txtEdit.value.charAt(i) == '\n') start++; } var range_all = document.body.createTextRange(); range_all.moveToElementText(txtEdit); for (end = 0; range_all.compareEndPoints('StartToEnd', range) < 0; end++) range_all.moveStart('character', 1); for (var i = 0; i <= end; i++) { if (txtEdit.value.charAt(i) == '\n') end++; } } } //如果是当前检索位置 if (rowIndex == pressRowIndex && ind == pressCellIndex) { //未选中多个字符 if (start == end) { if (start != pressRecord.length) { if (start != 0) { var firstVal = pressRecord.substring(0, start - 1); var endVal = pressRecord.substring(start + 1, txtEdit.value.length - 1); pressRecord = firstVal + pressVal + endVal; } } else { pressRecord = pressRecord + pressVal; } } //选中多个字符 if (start != end) { var firstVal = pressRecord.substring(0, start); var endVal = pressRecord.substring(end - 1, txtEdit.value.length - 1); pressRecord = firstVal + pressVal + endVal; } } else { pressRecord = pressVal; pressRowIndex = rowIndex; pressCellIndex = ind; } //获取combo下拉列表 var combo = mygrid_pay.getCustomCombo(selectedId, ind); var comboArg = combo.getKeys(); var count = 0; //开始遍历检索 //如果检索成功 状态pressCount=1 如果不成功应为pressCount=2 for (var i = 0; i < comboArg.length; i++) { if (combo.get(comboArg[i]).toUpperCase().trim().indexOf(pressRecord) == 0) { //计数 count++; //获取value var oldVal = comboArg[i]; //获取label var oldLab = combo.get(comboArg[i]); //记录状态值 检索到数据项 pressCount = 1; flagFilter = 1; //关闭编辑 mygrid_pay.editStop(); //将value写入cell(触发 stage2) mygrid_pay.cellByIndex(rowIndex, ind).setValue(oldVal); flagFilter = 0; //重新打开cell(触发stage0 stage1) mygrid_pay.selectCell(rowIndex, ind, true, true); mygrid_pay.editCell(); var old_length = oldLab.length; //产生效果将检索字母之后的数据进行选黑 for (i = 0; i < document.all.length; i++) { if (document.all(i).tagName == "TEXTAREA" && document.all(i).id != "tbREMARK") { txtEdit = document.all(i); var rt = txtEdit.createTextRange(); rt.collapse(); rt.select(); //光标置最前 var r = document.selection.createRange(); r.collapse(false); r.moveStart("character", pressRecord.length); //从m位开始 r.moveEnd("character", old_length); //选取n位 r.select(); break; } } break; } } //如果检索不能成功 pressCount=2 if (count == 0) { pressCount = 2; txtEdit.value = pressRecord; for (i = 0; i < document.all.length; i++) { if (document.all(i).tagName == "TEXTAREA" && document.all(i).id != "tbREMARK") { txtEdit = document.all(i); var rt = txtEdit.createTextRange(); rt.collapse(); rt.select(); //光标置最前 var r = document.selection.createRange(); r.collapse(true); r.moveStart("character", pressRecord.length); //从m位开始 r.moveEnd("character", pressRecord.length); //选取n位 r.select(); break; } } } } if ((code >= 48 && code <= 57) || (code >= 96 && code <= 105)) { if (ind == 3) { return true; } } } //delete if (code == 8) { //code8 begin if (ind == 1 || ind == 2) { var start = 0; var end = 0; if (document.selection) { var range = document.selection.createRange(); if (range.parentElement().className == txtEdit.className) { var range_all = document.body.createTextRange(); range_all.moveToElementText(txtEdit); for (start = 0; range_all.compareEndPoints("StartToStart", range) < 0; start++) { range_all.moveStart('character', 1); } for (var i = 0; i <= start; i++) { if (txtEdit.value.charAt(i) == '\n') start++; } var range_all = document.body.createTextRange(); range_all.moveToElementText(txtEdit); for (end = 0; range_all.compareEndPoints('StartToEnd', range) < 0; end++) range_all.moveStart('character', 1); for (var i = 0; i <= end; i++) { if (txtEdit.value.charAt(i) == '\n') end++; } } } //未选中多个字符 if (start == end) { if (start != 0) { var firstVal = pressRecord.substring(0, start - 1); var endVal = pressRecord.substring(start + 1, txtEdit.value.length - 1); pressRecord = firstVal; } } //选中多个字符 if (start != end) { var firstVal = pressRecord.substring(0, start); var endVal = pressRecord.substring(end - 1, txtEdit.value.length - 1); pressRecord = firstVal + endVal; } setTimeout(function() { if (pressRecord != null) { if (pressRecord.trim().length > 0) { var combo = mygrid_pay.getCustomCombo(selectedId, ind); var comboArg = combo.getKeys(); var count = 0; for (var i = 0; i < comboArg.length; i++) { if (combo.get(comboArg[i]).toUpperCase().trim().indexOf(pressRecord) == 0) { count++; var oldVal = comboArg[i]; var oldLab = combo.get(comboArg[i]); pressCount = 3; mygrid_pay.editStop(); mygrid_pay.cellByIndex(rowIndex, ind).setValue(oldVal); mygrid_pay.selectCell(rowIndex, ind, true, true); mygrid_pay.editCell(); var old_length = oldLab.length; for (i = 0; i < document.all.length; i++) { if (document.all(i).tagName == "TEXTAREA" && document.all(i).id != "tbREMARK") { txtEdit = document.all(i); var rt = txtEdit.createTextRange(); rt.collapse(); rt.select(); //光标置最前 var r = document.selection.createRange(); r.collapse(false); r.moveStart("character", pressRecord.length); //从m位开始 r.moveEnd("character", old_length); //选取n位 //txtEdit.focus(); r.select(); } } break; } } } } }, 500); return true; } else { return true; } //code8 end } //向下方向键 if (code == 40) { //code40 begin if (ind == 3 || ind == 4) { var rowCount = mygrid_pay.getRowsNum(); mygrid_pay.clearSelection(); mygrid_pay.editStop(); if (rowIndex == (rowCount - 1)) { addPayRow(); } else { mygrid_pay.selectCell(rowIndex + 1, 1, true, true); mygrid_pay.editCell(); } } else { pressCount = 0; return true; } //code40 end } //向上箭头 if (code == 38) { //code38 begin if (ind == 3 || ind == 4) { if (rowIndex > 0) { mygrid_pay.clearSelection(); mygrid_pay.editStop(); mygrid_pay.selectCell(rowIndex - 1, 1, true, true); mygrid_pay.editCell(); var rowfeename = mygrid_pay.cellByIndex(rowIndex, 1).getValue(); if (rowfeename == 0) { mygrid_pay.deleteRow(selectedId) newFeePayCount--; } } } else { pressCount = 0; return true; } //code38 end } //左箭头 if (code == 37) { //code37 begin mygrid_pay.clearSelection(); mygrid_pay.editStop(); mygrid_pay.editCell(); return true; } //code37 end //右箭头 if (code == 39) { //code39 begin mygrid_pay.clearSelection(); mygrid_pay.editStop(); mygrid_pay.editCell(); return true; } //code39 end //键盘输入数字code >= 48 && code <= 57|| code >= 96 && code <= 105 || if (code >= 48 && code <= 57 || code >= 96 && code <= 105 || code == 188 || code == 110 || code == 190 || code == 229) { if (ind == 1 || ind == 2 || ind == 3 || ind == 4) { return true; } } if (code >= 65 && code <= 90) {//如果是输入英文字符 if (ind == 2 || ind == 1 || ind == 4) { return true; } } if (code == 189 || code == 109) { if (ind == 3) { return true; } } //onKeyPress end }); setTimeout(function(){ },460); var pressVal = ""; var pressColIndex = 0; var pressRowIndex = 0; var pressGridType = 1;//recv } function addRecvRow(){ var clientgid = $("hdCLIENTGID").value; var newId = newGuid(); //获取插入新纪录位置 var rowCount = mygrid_recv.getRowsNum(); mygrid_recv.addRow(newId, [0, "", $("hd_comboCARRIER").value.trim(), "", 0.00, ""], rowCount); mygrid_recv.clearSelection(); var rId = mygrid_recv.getRowId(rowCount - 1); var combo_feename; combo_feename = mygrid_recv.getCustomCombo(newId,1); setFeeNameCombo(combo_feename); var combo_cust; combo_cust = mygrid_recv.getCustomCombo(newId,2); setCustomerCombo(combo_cust,newId); var combo_unit; combo_unit = mygrid_recv.getCustomCombo(newId,3); setUnitCombo(combo_unit); newFeeRecvCount++; setTimeout(function(){ mygrid_recv.editStop(true); mygrid_recv.selectCell(mygrid_recv.getRowIndex(newId),1,true,true); mygrid_recv.editCell(); },150); } function addPayRow(){ var clientgid = $("hdCLIENTGID").value; var newId = newGuid(); //获取插入新纪录位置 var rowCount = mygrid_pay.getRowsNum(); mygrid_pay.addRow(newId,[0,"","",0.00,""],rowCount); mygrid_pay.clearSelection(); var rId = mygrid_pay.getRowId(rowCount - 1); var combo_feename; combo_feename = mygrid_pay.getCustomCombo(newId,1); setFeeNameCombo(combo_feename); var combo_unit; combo_unit = mygrid_pay.getCustomCombo(newId,2); setUnitCombo(combo_unit); newFeePayCount++; setTimeout(function(){ mygrid_pay.editStop(true); mygrid_pay.selectCell(mygrid_pay.getRowIndex(newId),1,true,true); mygrid_pay.editCell(); },150); } function deleteRecvRow(){ var clientgid = $("hdCLIENTGID").value; var iSuccess = 0; var iFailure = 0; var iCount = 0; var recvArg = new Array(); for(var i=0;i 0){ var delCount = 0; if(recvArg.length > 0){ if(window.confirm("您确定要将所选费用删除")){ while(delCount < recvArg.length){ var rowIndex = mygrid_recv.getRowIndex(recvArg[delCount]); //删除委托业务内的费用,当ch_fee.feestatus=1或6时,通过费用GID删除(ch_fee)单条费用,更新(fee_gain)重算利润,并返回删除操作结果 var urlVal = "CRMClientQuotationListGridSource.aspx?feegid=" + recvArg[delCount] + "&handle=delete&no=" + newGuid(); var loader = dhtmlxAjax.getSync(urlVal); var loadVal = loader.xmlDoc.responseText; if(loadVal == 1 ){ mygrid_recv.deleteRow(recvArg[delCount]); }else{ } delCount++; } } } }else{ alert("未选中要操作的费用项"); } } function deletePayRow(id){ var clientgid = $("hdCLIENTGID").value; var iSuccess = 0; var iFailure = 0; var iCount = 0; var recvArg = new Array(); for(var i=0;i 0){ var delCount = 0; if(recvArg.length > 0){ if(window.confirm("您确定要将所选费用删除")){ while(delCount < recvArg.length){ var rowIndex = mygrid_pay.getRowIndex(recvArg[delCount]); //删除委托业务内的费用,当ch_fee.feestatus=1或6时,通过费用GID删除(ch_fee)单条费用,更新(fee_gain)重算利润,并返回删除操作结果 var urlVal = "CRMClientQuotationListGridSource.aspx?feegid=" + recvArg[delCount] + "&handle=delete&no=" + newGuid(); var loader = dhtmlxAjax.getSync(urlVal); var loadVal = loader.xmlDoc.responseText; if(loadVal == 1 ){ mygrid_pay.deleteRow(recvArg[delCount]); }else{ } delCount++; } } } }else{ alert("未选中要操作的费用项"); } } //保存海运费及附加费 function saveRecvChange(){ var clientgid = $("hdCLIENTGID").value; var jsonFeeObj = null; for(var i=0;i 0){ opStatus = parseInt(validStatusObj.valid[0].opstatus); feeStatus = parseInt(validStatusObj.valid[0].feestatus); } if(feeStatus < 1){ alert("委托业务已锁定,不能编辑费用信息"); return; } if(opStatus == 1){ //查看是否有被选中的费用项 var iCount = 0; var recvArg = new Array(); for(var i=0;i 0){ var delCount = 0; if(recvArg.length > 0){ if(window.confirm("您确定要将所选海运费及附加费放弃修改")){ while(delCount < recvArg.length){ var rowIndex = mygrid_recv.getRowIndex(recvArg[delCount]); var tid = mygrid_recv.cellByIndex(rowIndex,19).getValue(); var feeName = mygrid_recv.cellByIndex(rowIndex,2).getValue(); var cusName = mygrid_recv.cellByIndex(rowIndex,3).getValue(); //恢复委托费用:通过费用ch_fee.gid获取ch_fee信息,返回字符串 var urlVal = "../Shipping/FeeService.aspx?gid="+recvArg[delCount]+"&handle=recover&no="+newGuid(); var loader = dhtmlxAjax.getSync(urlVal); var loadVal = loader.xmlDoc.responseText; if(!IsNum(loadVal)){ var recoverArg = new Array(); recoverArg = loadVal.split(","); var selRowIndex = mygrid_recv.getRowIndex(recvArg[delCount]); var colCount = mygrid_recv.getColumnsNum(); for(var i=2;i= 1){ jsonCacheObj.templates.splice(i,1); $("h_cachetemplate").value = JSON.stringify(jsonCacheObj); mygrid_recv.deleteRow(recvArg[delCount]); iSuccess++; tempCount++; }else{ iFailure++; } break; } } if(tempCount == 0){ mygrid_recv.deleteRow(recvArg[delCount]); iSuccess++; } }else if(cacheHistory != ""){ var jsonCacheObj = null; jsonCacheObj = eval('(' + cacheHistory + ')'); var tempCount = 0; for(var i=0;i= 1){ jsonCacheObj.history.splice(i,1); $("h_cachehistory").value = JSON.stringify(jsonCacheObj); mygrid_recv.deleteRow(recvArg[delCount]); iSuccess++; tempCount++; }else{ iFailure++; } break; } } if(tempCount == 0){ mygrid_recv.deleteRow(recvArg[delCount]); iSuccess++; } }else{ mygrid_recv.deleteRow(recvArg[delCount]); iSuccess++; } } delCount++; } } ReShowLabel(mygrid_recv); alert("提交放弃修改海运费及附加费 共 "+delCount+" 条 成功 "+iSuccess+" 条 失败 "+iFailure+" 条"); } }else{ alert("未选中要操作的费用项"); } }else{ alert("委托已退载,费用修改费用"); return; } } //放弃人民币费用修改 重新加载页面 function recoverPayChange(){ var iSuccess = 0; var iFailure = 0; var clientgid = $("hdCLIENTGID").value; if(clientgid == ""){ return; } //验证委托状态是否为退舱状态(op_status和 op_seai),返回json值 var urlVal = "../Shipping/FeeService.aspx?clientgid="+clientgid+"&handle=checkopstatus&uid="+newGuid(); var loader = dhtmlxAjax.getSync(urlVal); var loadVal = loader.xmlDoc.responseText; var validStatusObj = eval('(' + loadVal + ')'); var opStatus = 0; var feeStatus = 0; if(validStatusObj.valid.length > 0){ opStatus = parseInt(validStatusObj.valid[0].opstatus); feeStatus = parseInt(validStatusObj.valid[0].feestatus); } if(feeStatus < 1){ alert("委托业务已锁定,不能编辑费用信息"); return; } if(opStatus == 1){ //查看是否有被选中的费用项 var iCount = 0; var recvArg = new Array(); for(var i=0;i 0){ var delCount = 0; if(recvArg.length > 0){ if(window.confirm("您确定要将所选人民币费用放弃修改")){ while(delCount < recvArg.length){ var rowIndex = mygrid_pay.getRowIndex(recvArg[delCount]); var tid = mygrid_pay.cellByIndex(rowIndex,19).getValue(); var feeName = mygrid_pay.cellByIndex(rowIndex,2).getValue(); var cusName = mygrid_pay.cellByIndex(rowIndex,3).getValue(); //恢复委托费用:通过费用ch_fee.gid获取ch_fee信息,返回字符串 var urlVal = "../Shipping/FeeService.aspx?gid="+recvArg[delCount]+"&handle=recover&no="+newGuid(); var loader = dhtmlxAjax.getSync(urlVal); var loadVal = loader.xmlDoc.responseText; if(!IsNum(loadVal)){ var recoverArg = new Array(); recoverArg = loadVal.split(","); var selRowIndex = mygrid_pay.getRowIndex(recvArg[delCount]); var colCount = mygrid_pay.getColumnsNum(); for(var i=2;i= 1){ jsonCacheObj.templates.splice(i,1); $("h_cachetemplate").value = JSON.stringify(jsonCacheObj); mygrid_pay.deleteRow(recvArg[delCount]); iSuccess++; tempCount++; }else{ iFailure++; } break; } } if(tempCount == 0){ mygrid_pay.deleteRow(recvArg[delCount]); iSuccess++; } }else if(cacheHistory != ""){ var jsonCacheObj = null; jsonCacheObj = eval('(' + cacheHistory + ')'); var tempCount = 0; for(var i=0;i= 1){ jsonCacheObj.history.splice(i,1); $("h_cachehistory").value = JSON.stringify(jsonCacheObj); mygrid_pay.deleteRow(recvArg[delCount]); iSuccess++; tempCount++; }else{ iFailure++; } break; } } if(tempCount == 0){ mygrid_pay.deleteRow(recvArg[delCount]); iSuccess++; } }else{ mygrid_pay.deleteRow(recvArg[delCount]); iSuccess++; } } delCount++; } } ReShowLabel(mygrid_pay); alert("提交放弃修改海运费及附加费 共 "+delCount+" 条 成功 "+iSuccess+" 条 失败 "+iFailure+" 条"); } }else{ alert("未选中要操作的费用项"); } }else{ alert("委托已退载,费用修改费用"); return; } } function print_recv(){ printMessageBox(event,1); } function print_pay(){ printMessageBox(event,2); } //输出money function outputMoney(number) { number= number.replace(/\,/g,""); if (isNaN(number)||number=="") return ""; number = Math.round( number*10000) /10000; if (number < 0) { var sdf = '-' + outputDollars(Math.floor(Math.abs(number) - 0) + '') + outputCents(Math.abs(number) - 0); return '-' + outputDollars(Math.floor(Math.abs(number) - 0) + '') + outputCents(Math.abs(number) - 0); } else { var sdf = outputDollars(Math.floor(number - 0) + '') + outputCents(number - 0); 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) { var ls = ""; amount = Math.round(((amount) - Math.floor(amount)) * 10000); if (amount < 10) { ls = '.000' + amount; } else if (amount < 100) { ls = '.00' + amount; } else if (amount < 1000) { ls = '.0' + amount; } else if (amount < 10000) { ls = '.' + amount; } //return (amount<10 ? '.000' + amount : '.' + amount); return ls; } //获取GUID function newGuid() { 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 dialog() { // alert("打开dialog"); this.width=450; this.height=360; this.title_height=20; this.html=''; this.title=''; var self = this; var bgObj,msgObj,titleObj; this.close=function() { document.body.removeChild(document.getElementById("bgDiv")); document.getElementById("msgDiv").removeChild(document.getElementById("msgTitle")); document.body.removeChild(document.getElementById("msgDiv")); } this.show=function() { var msgw,msgh,bordercolor; msgw=self.width; msgh=self.height; bordercolor="#336699"; titlecolor="#99CCFF"; var sWidth,sHeight; sWidth=document.body.offsetWidth; sHeight=screen.height; bgObj=document.createElement("div"); bgObj.setAttribute('id','bgDiv'); bgObj.style.position="absolute"; bgObj.style.top="0"; bgObj.style.background="#777"; bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75"; bgObj.style.opacity="0.6"; bgObj.style.left="0"; bgObj.style.width=sWidth + "px"; bgObj.style.height=sHeight + "px"; bgObj.style.zIndex = "10000"; document.body.appendChild(bgObj); msgObj=document.createElement("div") msgObj.setAttribute("id","msgDiv"); msgObj.setAttribute("align","center"); msgObj.style.background="white"; msgObj.style.border="1px solid " + bordercolor; msgObj.style.position = "absolute"; msgObj.style.left = "50%"; msgObj.style.top = "30%"; msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif"; msgObj.style.marginLeft = "-225px" ; msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px"; msgObj.style.width = msgw + "px"; msgObj.style.height =msgh + "px"; msgObj.style.textAlign = "center"; msgObj.style.lineHeight ="25px"; msgObj.style.zIndex = "10001"; titleObj=document.createElement("h4"); titleObj.setAttribute("id","msgTitle"); titleObj.setAttribute("align","center"); titleObj.style.margin="0"; titleObj.style.padding="3px"; titleObj.style.background=bordercolor; titleObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);"; titleObj.style.opacity="0.75"; titleObj.style.border="1px solid " + bordercolor; titleObj.style.height=self.title_height+"px"; titleObj.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif"; titleObj.style.color="white"; titleObj.style.cursor="pointer"; titleObj.innerHTML=self.title; //titleObj.onclick=function(){self.close();} document.body.appendChild(msgObj); document.getElementById("msgDiv").appendChild(titleObj); var txt=document.createElement("div"); txt.style.margin="1em 0" txt.setAttribute("id","msgTxt"); txt.innerHTML=self.html; document.getElementById("msgDiv").appendChild(txt); } } //信息提示 function msgBox(){ var dg=new dialog(); dg.html="费用正在保存中,请稍等……";//""; dg.width=200; dg.height=100; dg.title=""; dg.show(); } //是否为数字 function IsNum(val){ var re = /^[-\+]?\d+(\.\d+)?$/; if (!re.test(val)){ return false; }else{ return true; } } //去除“,” function ConvertToMoney(strObj){ var result = strObj.replace(",",""); return result; } //过滤结算单位ComboCustomer的键盘 function filterComboCustomerPress(gridObj,rowID,rowIndex,colIndex,filterVal,oldVal){ var combo = gridObj.getCustomCombo(rowID,colIndex); var comboArg = combo.getKeys(); var doCount = 0; for(var i = 0;i 0){ for(var i = 0;i 0){ for(var i = 0;i 0){ if(valObj.indexOf("-") == 0){ valObj = "-"+valObj.replace(/-/g,""); }else{ valObj = valObj.replace(/-/g,""); } } return valObj; } //刷新海运费及附加费 function refreshRecv(){ if(newFeeRecvCount > 0 || changeFeeRecvCount > 0){ if(window.confirm("费用未保存,您确定要刷新费用列表,刷新后自动放弃未保存内容")){ doInitRecvGrid(); newFeeRecvCount = 0; changeFeeRecvCount = 0; } }else{ doInitRecvGrid(); } } //刷新人民币费用 function refreshPay(){ if(newFeePayCount > 0 || changeFeePayCount > 0){ if(window.confirm("费用未保存,您确定要刷新费用列表,刷新后自动放弃未保存内容")){ doInitPayGrid(); newFeePayCount = 0; changeFeePayCount = 0; } }else{ doInitPayGrid(); } } //人民币费用查看信息 function checkPayHistory(){ var strclientgid = $("hdCLIENTGID").value; var openSet = "height=540, width=890, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-540)/2 + ",Left= "+(screen.width-890)/2 var openType = "_blank"; //打开费用“历史信息查询”页面 var openUrl = "../Shipping/FeeHistory.aspx?clientgid="+strclientgid+"&type=2"; window.open (openUrl,openType,openSet); } //引入海运费及附加费模板 function importRecvTemplate(){ if(!validOperatePower("",1,"import")){ alert("没有权限操作数据"); return; } var clientgid = $("hdCLIENTGID").value; if(clientgid == ""){ return; } //验证委托状态是否为退舱状态(op_status和 op_seai),返回json值 var urlVal = "../Shipping/FeeService.aspx?clientgid="+clientgid+"&handle=checkopstatus&uid="+newGuid();; var loader = dhtmlxAjax.getSync(urlVal); var loadVal = loader.xmlDoc.responseText; var validStatusObj = eval('(' + loadVal + ')'); var opStatus = 0; var feeStatus = 0; if(validStatusObj.valid.length > 0){ opStatus = parseInt(validStatusObj.valid[0].opstatus); feeStatus = parseInt(validStatusObj.valid[0].feestatus); } if(feeStatus < 1){ alert("委托业务已锁定,不能编辑费用信息"); return; } if(opStatus == 1){ if(newFeePayCount > 0 || changeFeePayCount > 0){ alert("人民币费用未保存,先保存人民币费用,再操作海运费及附加费-引入费用模板"); return; } var openSet = "height=700, width=1000, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=10,Left= " + (screen.width - 900) / 2; var openType = "_blank"; //打开海运费及附加费“引入费用模板”页面 var openUrl = "../Shipping/ImportFeeTemplate.aspx?handle=import&type=3"; //海运费及附加费 window.open (openUrl,openType,openSet); }else{ alert("委托已退载,不能引入费用"); return; } } //打开人民币费用模板 function importPayTemplate() { if ($("hdHandle").value.trim() != "edit") { alert("请先保存报价单,再引入费用!"); return; } var openSet = "height=700, width=1000, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=10,Left= " + (screen.width - 900) / 2; var openType = "_blank"; //打开人民币费用“引入费用模板”页面 var openUrl = "../Shipping/ImportFeeTemplate.aspx?handle=import&type=4"; //人民币杂费 window.open (openUrl,openType,openSet); } //检查浏览器是否是Ie var isIe=(document.all)?true:false; //设置select的可见状态 function setSelectState(state){ var objl=document.getElementsByTagName('select'); for(var i=0;i" + "" + "
"+content+"
"; var v_top=(document.body.clientHeight-mesW.clientHeight)/2; v_top+=document.documentElement.scrollTop; styleStr="top:"+(v_top-180)+"px;left:"+(document.body.clientWidth/2-mesW.clientWidth/2)+"px;position:absolute;width:600px;margin-left:-300px;left:50%;z-index:9999;"; mesW.style.cssText=styleStr; document.body.appendChild(mesW); var Container = $("dvGain"); Container.attachEvent("onresize",function(){ $("back").style.width = parseInt(document.documentElement.scrollWidth); $("back").style.height = parseInt(document.documentElement.scrollHeight); }); } //让背景渐渐变暗 function showBackground(obj,endInt){ if(isIe){ obj.filters.alpha.opacity+=5; if(obj.filters.alpha.opacity 0 || changeFeeRecvCount > 0){ alert("海运费及附加费未保存,请先保存之后再打印"); return; } for(var j=0;j 0 || changeFeePayCount > 0){ alert("人民币费用未保存,请先保存之后再打印"); return; } for(var j=0;j"+feeNameArg[k]+""; } var objPos = mousePosition(ev); messContent = "
" +"
" +"
" +"
" +" " +" " +"
" +"
"; showMessageBox('费用打印',messContent,objPos,350); } //打印报表 function printReport(){ var strclientgid = ""; var typeName = ""; strclientgid = $("hdCLIENTGID").value; var printUrl = ""; var companyID = ""; var typeName = "SEAOPFEE"; var dbSourceID = ""; var userID = ""; var selectObj = $("reportType"); var selVal = parseInt(selectObj.options[selectObj.selectedIndex].value); var url = ""; var searchCustomer = ""; var selectedObj = $("sel_print"); for(var j=0;j 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; } } //打印海运费及附加费报表 function onReportTypeChange(id){ var selectObj = $(id); var selVal = parseInt(selectObj.options[selectObj.selectedIndex].value); if(selVal == 3){ $("sel_customer").disabled = 1; $("sel_print").disabled = 1; $("dvRemove").disabled = 1; $("dvAdd").disabled = 1; } pageShowCount = selVal; } //鼠标移过图标变化 function mouseMoveImg(obj,type){ var imgUrl = obj.src; var urlArg = imgUrl.split("/"); if(type == 1){ if(urlArg[urlArg.length-1] == "edit_left.gif"){ var newUrl = ""; for(var i=0;i 0){ for(var i = 0;i < jsonCacheObj.customer.length;i++){ obj.put(jsonCacheObj.customer[i].name,jsonCacheObj.customer[i].code + ' '+jsonCacheObj.customer[i].name); } } } var h_Feename=""; function setFeeNameCombo(obj){ var feeCodeInfo = ""; if($("h_feecache").value.trim() != ""){ feeCodeInfo = $("h_feecache").value.trim(); }else{//返回code_fee费用信息的JSON字符串 var url = "../FeeCodes/FeeCodeService.aspx?handle=feecode&uid="+newGuid(); var loader = dhtmlxAjax.getSync(url); feeCodeInfo = loader.xmlDoc.responseText; } var jsonCacheObj = eval('(' + feeCodeInfo + ')'); if(jsonCacheObj.feecode.length > 0){ for(var i = 0;i < jsonCacheObj.feecode.length;i++){ obj.put(jsonCacheObj.feecode[i].name,jsonCacheObj.feecode[i].code); } } } var h_Unit=""; function setUnitCombo(obj){//初始化计费标准Combo var feeCodeCtnObj = null; var clientgid = $("hdCLIENTGID").value; //集装箱(op_ctn)信息,返回JSON数据源 var url = "CRMClientQuotationListGridSource.aspx?handle=getctn&uid=" + newGuid(); var loader = dhtmlxAjax.getSync(url); var ctnInfo = loader.xmlDoc.responseText; if(ctnInfo.trim() != ""){ feeCodeCtnObj = eval('(' + ctnInfo + ')'); if(feeCodeCtnObj.ctns.length > 0){ for(var i=0;i 0){ opStatus = parseInt(validStatusObj.valid[0].opstatus); feeStatus = parseInt(validStatusObj.valid[0].feestatus); } if(feeStatus < 1){ alert("委托业务已锁定,不能编辑费用信息"); return; } if(opStatus == 1){ if(newFeePayCount > 0 || changeFeePayCount > 0){ alert("人民币费用未保存,先保存人民币费用,再操作海运费及附加费-引入历史"); return; } var openSet = "height=600, width=1000, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-600)/2 + ",Left= "+(screen.width-900)/2 var openType = "_blank"; //打开海运费及附加费“历史引入”页面 var openUrl = "../Shipping/ImportFeeHistory.aspx?handle=import&historytype=1"; window.open (openUrl,openType,openSet); }else{ alert("委托已退载,不能引入费用"); return; } } function importPayHistory(){//人民币费用菜单“历史引入” if(!validOperatePower("",2,"import")){ alert("没有权限操作数据"); return; } var clientgid = $("hdCLIENTGID").value; if(clientgid == ""){ return; } //验证委托状态是否为退舱状态(op_status和 op_seai),返回json值 var urlVal = "../Shipping/FeeService.aspx?clientgid="+clientgid+"&handle=checkopstatus&uid="+newGuid();; var loader = dhtmlxAjax.getSync(urlVal); var loadVal = loader.xmlDoc.responseText; var validStatusObj = eval('(' + loadVal + ')'); var opStatus = 0; var feeStatus = 0; if(validStatusObj.valid.length > 0){ opStatus = parseInt(validStatusObj.valid[0].opstatus); feeStatus = parseInt(validStatusObj.valid[0].feestatus); } if(feeStatus < 1){ alert("委托业务已锁定,不能编辑费用信息"); return; } if(opStatus == 1){ if(newFeeRecvCount > 0 || changeFeeRecvCount > 0){ alert("海运费及附加费未保存,先保存海运费及附加费,再操作人民币费用-引入历史"); return; } var openSet = "height=600, width=1000, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-600)/2 + ",Left= "+(screen.width-900)/2 var openType = "_blank"; //打开人民币费用“历史引入”页面 var openUrl = "../Shipping/ImportFeeHistory.aspx?handle=import&historytype=2"; window.open (openUrl,openType,openSet); }else{ alert("委托已退载,不能引入费用"); return; } } function establishPay(type){//type=1 只复制算选的费用到人民币 type=2复制所有到人民币 for(var i=0;i 0){ if(quantityObj.quantity[0].value > 0){ mygrid_pay.cellByIndex(rowIndex,4).setValue(quantityObj.quantity[0].name); mygrid_pay.cellByIndex(rowIndex,6).setValue(quantityObj.quantity[0].value); var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue()))); var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString()))); var amount = unitPrice * quantityCount; mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString())); } } }else{ mygrid_pay.cellByIndex(rowIndex,6).setValue(1); var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue()))); var quantityCount = 1;//clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString()))); var amount = unitPrice * quantityCount; mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString())); } } } if(feeCodeObj.feecode[0].credit > 0){ var debitObj = null; debitObj = getDebitType(feeCodeObj.feecode[0].credit); if(debitObj.debit.length > 0){ if(debitObj.debit[0].value.trim() != ""){ mygrid_pay.cellByIndex(rowIndex,3).setValue(debitObj.debit[0].value); } } } ReShowLabel(mygrid_pay); } } } } } } function establishRecv(type){//type=1 只复制算选的费用到应收 type=2复制所有到应收 for(var i=0;i 0){ if(quantityObj.quantity[0].value > 0){ mygrid_recv.cellByIndex(rowIndex,4).setValue(quantityObj.quantity[0].name); mygrid_recv.cellByIndex(rowIndex,6).setValue(quantityObj.quantity[0].value); var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue()))); var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString()))); var amount = unitPrice * quantityCount; mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString())); } } }else{ mygrid_recv.cellByIndex(rowIndex,6).setValue(1); var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue()))); var quantityCount = 1; var amount = unitPrice * quantityCount; mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString())); } } } if(feeCodeObj.feecode[0].debit > 0){ var debitObj = null; debitObj = getDebitType(feeCodeObj.feecode[0].debit); if(debitObj.debit.length > 0){ if(debitObj.debit[0].value.trim() != ""){ mygrid_recv.cellByIndex(rowIndex,3).setValue(debitObj.debit[0].value); } } } ReShowLabel(mygrid_recv); } } } } } } //----------------------------------------------------------------------------------------------------------------------------------------- function getonload() { initComboSHORTNAME2(); initComboCONTACTNAME2(); initComboSALE2(); initComboPORTLOAD2(); initComboPORTDISCHARGE2(); initComboENTREPORT2(); initComboLANE2(); initComboCARRIER2(); initPayMenu(); } var comboSHORTNAME; //潜在客户 var comboCONTACTNAME; //潜在客户联系人 var comboSALE; //揽货人 var comboPORTLOAD; //启运港 var comboPORTDISCHARGE; //卸货港交货地 var comboENTREPORT; //中转港 var comboLANE; //航线 var comboCARRIER; //船公司 //initComboPORTLOAD2();initComboPORTDISCHARGE2(); //initComboSHORTNAME(); initComboSALE(); function initComboSHORTNAME()//潜在客户 { comboSHORTNAME = dhtmlXComboFromSelect("ddlSHORTNAME"); comboSHORTNAME.loadXML("CRMClientVisitListGridSource.aspx?handle=getshortname"); //comboSHORTNAME.loadXML("CRMClientQuotationListGridSource.aspx?handle=getshortname"); } function initComboSHORTNAME2()//潜在客户 { if ($("hdEnabled").value == "0" || $("hdISCLIENTGID").value == "1") { comboSHORTNAME.disable(true); } // comboSHORTNAME.setOptionWidth(200); comboSHORTNAME.attachEvent("onChange", function() { comboSHORTNAME.setComboText($("hd_comboSHORTNAME").value); }); comboSHORTNAME.attachEvent("onBlur", function() { var s1 = comboSHORTNAME.getComboText().trim(); var s2 = s1.indexOf("|"); if (s1 == "") { $("hd_comboSHORTNAME").value = ""; comboSHORTNAME.setComboText($("hd_comboSHORTNAME").value); } else { if (s2 > 0) { s2 = s2 + 2; } var s3 = s1.substring(s2); if (s2 > 0) { comboSHORTNAME.setComboText(s3); $("hd_comboSHORTNAME").value = s3; } else { comboSHORTNAME.setComboText($("hd_comboSHORTNAME").value); } } initComboCONTACTNAME3(); }); comboSHORTNAME.setComboText($("hd_comboSHORTNAME").value); comboSHORTNAME.attachEvent("onKeyPressed", function(keyCode) { if (keyCode != "8") { var arrayArg = new Array(); setTimeout(function() { var filterCount = 0; var is = -1; var ishd = $("hd_comboSHORTNAME").value.trim(); if ("" != comboSHORTNAME.getComboText().trim()) { while ("undefined" != typeof comboSHORTNAME.getOptionByIndex(filterCount)) { var comboValue = comboSHORTNAME.getOptionByIndex(filterCount).text.toUpperCase(); //.value; var enterValue = comboSHORTNAME.getComboText().trim().toUpperCase(); $("hd_comboSHORTNAME").value = comboSHORTNAME.getComboText().trim().toUpperCase(); if (comboValue.indexOf(enterValue) == 0) { comboSHORTNAME.selectOption(filterCount, true, true); is = filterCount; break; } ++filterCount; } if (is == -1) { $("hd_comboSHORTNAME").value = ishd; alert("无此内容,请重新选择!"); } } }, 10); } }); comboSHORTNAME.attachEvent("onSelectionChange", function() { $("hd_comboSHORTNAME").value = comboSHORTNAME.getComboText().trim(); }); } function initComboCONTACTNAME()//潜在客户联系人 { //生成 comboCONTACTNAME = dhtmlXComboFromSelect("ddlCONTACTNAME"); comboCONTACTNAME.loadXML("CRMClientQuotationListGridSource.aspx?handle=getcontactname&clientname=" + escape($("hd_comboSHORTNAME").value)); } function initComboCONTACTNAME3()//潜在客户联系人 { comboCONTACTNAME.loadXML("CRMClientQuotationListGridSource.aspx?handle=getcontactname&clientname=" + escape($("hd_comboSHORTNAME").value)); } function initComboCONTACTNAME2()//潜在客户联系人 { if ($("hdEnabled").value == "0") { comboCONTACTNAME.disable(true); } // comboCONTACTNAME.setOptionWidth(200); comboCONTACTNAME.attachEvent("onChange", function () { comboCONTACTNAME.setComboText($("hd_comboCONTACTNAME").value); }); comboCONTACTNAME.attachEvent("onBlur", function () { var s1 = comboCONTACTNAME.getComboText(); var s2 = s1.indexOf("|"); if (s1 == "") { $("hd_comboCONTACTNAME").value = ""; comboCONTACTNAME.setComboText($("hd_comboCONTACTNAME").value); } else { if (s2 > 0) { s2 = s2 + 2; } var s3 = s1.substring(s2); if (s2 > 0) { comboCONTACTNAME.setComboText(s3); $("hd_comboCONTACTNAME").value = s3; } else { comboCONTACTNAME.setComboText($("hd_comboCONTACTNAME").value); } } }); comboCONTACTNAME.setComboText($("hd_comboCONTACTNAME").value); comboCONTACTNAME.attachEvent("onKeyPressed", function (keyCode) { if (keyCode != "8") { var arrayArg = new Array(); setTimeout(function () { var filterCount = 0; var is = -1; var ishd = $("hd_comboCONTACTNAME").value; if ("" != comboCONTACTNAME.getComboText()) { while ("undefined" != typeof comboCONTACTNAME.getOptionByIndex(filterCount)) { var comboValue = comboCONTACTNAME.getOptionByIndex(filterCount).text.toUpperCase(); //.value; var enterValue = comboCONTACTNAME.getComboText().toUpperCase(); $("hd_comboCONTACTNAME").value = comboCONTACTNAME.getComboText().toUpperCase(); if (comboValue.indexOf(enterValue) == 0) { comboCONTACTNAME.selectOption(filterCount, true, true); is = filterCount; break; } ++filterCount; } if (is == -1) { $("hd_comboCONTACTNAME").value = ishd; alert("无此内容,请重新选择!"); } } }, 10); } }); comboCONTACTNAME.attachEvent("onSelectionChange", function () { $("hd_comboCONTACTNAME").value = comboCONTACTNAME.getComboText(); }); } function initComboSALE()//揽货人 { //生成 comboSALE = dhtmlXComboFromSelect("ddlSALE"); comboSALE.loadXML("CRMClientAssignListGridSource.aspx?handle=issaleman"); } function initComboSALE2()//揽货人 { if ($("hdEnabled").value == "0") { comboSALE.disable(true); } // comboSALE.setOptionWidth(200); comboSALE.attachEvent("onChange", function() { comboSALE.setComboText($("hd_comboSALE").value); }); comboSALE.attachEvent("onBlur", function() { var s1 = comboSALE.getComboText(); var s2 = s1.indexOf("|"); if (s1 == "") { $("hd_comboSALE").value = ""; comboSALE.setComboText($("hd_comboSALE").value); } else { if (s2 > 0) { s2 = s2 + 2; } var s3 = s1.substring(s2); if (s2 > 0) { comboSALE.setComboText(s3); $("hd_comboSALE").value = s3; } else { comboSALE.setComboText($("hd_comboSALE").value); } } }); comboSALE.setComboText($("hd_comboSALE").value); comboSALE.attachEvent("onKeyPressed", function(keyCode) { if (keyCode != "8") { var arrayArg = new Array(); setTimeout(function() { var filterCount = 0; var is = -1; var ishd = $("hd_comboSALE").value; if ("" != comboSALE.getComboText()) { while ("undefined" != typeof comboSALE.getOptionByIndex(filterCount)) { var comboValue = comboSALE.getOptionByIndex(filterCount).text.toUpperCase(); //.value; var enterValue = comboSALE.getComboText().toUpperCase(); $("hd_comboSALE").value = comboSALE.getComboText().toUpperCase(); if (comboValue.indexOf(enterValue) == 0) { comboSALE.selectOption(filterCount, true, true); is = filterCount; break; } ++filterCount; } if (is == -1) { $("hd_comboSALE").value = ishd; alert("无此内容,请重新选择!"); } } }, 10); } }); comboSALE.attachEvent("onSelectionChange", function() { $("hd_comboSALE").value = comboSALE.getComboText(); }); } function initComboPORTLOAD()//启运港==装货港 { comboPORTLOAD = dhtmlXComboFromSelect("ddlPORTLOAD"); comboPORTLOAD.loadXML("../FeeCodes/TCodeLoadportAdapter.aspx?mask=0&pos=0"); } function initComboPORTLOAD2()//启运港==装货港 { if ($("hdEnabled").value == "0") { comboPORTLOAD.disable(true); } // comboPORTLOAD.setOptionWidth(200); comboPORTLOAD.attachEvent("onChange", function() { comboPORTLOAD.setComboText($("hd_comboPORTLOAD").value); }); comboPORTLOAD.attachEvent("onBlur", function() { comboPORTLOAD.setComboText($("hd_comboPORTLOAD").value); }); comboPORTLOAD.setComboText($("hd_comboPORTLOAD").value); comboPORTLOAD.attachEvent("onKeyPressed", function(keyCode) { if (keyCode != "8") { var arrayArg = new Array(); setTimeout(function() { var filterCount = 0; var is = -1; var ishd = $("hd_comboPORTLOAD").value.trim(); if ("" != comboPORTLOAD.getComboText().trim()) { while ("undefined" != typeof comboPORTLOAD.getOptionByIndex(filterCount)) { var comboValue = comboPORTLOAD.getOptionByIndex(filterCount).text.toUpperCase(); //.value; var enterValue = comboPORTLOAD.getComboText().trim().toUpperCase(); $("hd_comboPORTLOAD").value = comboPORTLOAD.getComboText().trim().toUpperCase(); if (comboValue.indexOf(enterValue) == 0) { comboPORTLOAD.selectOption(filterCount, true, true); is = filterCount; break; } ++filterCount; } if (is == -1) { $("hd_comboPORTLOAD").value = ishd; alert("无此内容,请重新选择!"); } } }, 10); } }); comboPORTLOAD.attachEvent("onSelectionChange", function() { $("hd_comboPORTLOAD").value = comboPORTLOAD.getComboText().trim(); }); } function initComboPORTDISCHARGE()//卸货港 { comboPORTDISCHARGE = dhtmlXComboFromSelect("ddlPORTDISCHARGE"); } function initComboPORTDISCHARGE2()//卸货港 { if ($("hdEnabled").value == "0") { comboPORTDISCHARGE.disable(true); } // comboPORTDISCHARGE.setOptionWidth(200); comboPORTDISCHARGE.attachEvent("onOpen", function() { if (comboPORTDISCHARGE.getOptionByIndex(0) == null) { comboPORTDISCHARGE.loadXML("../FeeCodes/TCodeDisportAdapter.aspx?mask=0&pos=0&strSel="); } }); comboPORTDISCHARGE.attachEvent("onChange", function() { $("hd_comboPORTDISCHARGE").value = comboPORTDISCHARGE.getComboText().trim().toUpperCase(); //comboPORTDISCHARGE.getSelectedText(); comboPORTDISCHARGE.setComboText($("hd_comboPORTDISCHARGE").value); }); comboPORTDISCHARGE.attachEvent("onBlur", function() { comboPORTDISCHARGE.setComboText($("hd_comboPORTDISCHARGE").value); }); comboPORTDISCHARGE.setComboText($("hd_comboPORTDISCHARGE").value); //检索 //comboPORTDISCHARGE.enableFilteringMode(true); comboPORTDISCHARGE.attachEvent("onKeyPressed", function(keyCode) { var arrayArg = new Array(); setTimeout(function() { var filterCount = 0; if ("" != comboPORTDISCHARGE.getComboText().trim()) { var enterValue = comboPORTDISCHARGE.getComboText().toUpperCase(); comboPORTDISCHARGE.loadXML("../FeeCodes/TCodeDisportAdapter.aspx?mask=0&pos=0&strSel=" + enterValue); } }, 10); }); comboPORTDISCHARGE.attachEvent("onSelectionChange", function() { $("hd_comboPORTDISCHARGE").value = comboPORTDISCHARGE.getComboText().trim(); }); } function initComboENTREPORT()//中转港 { comboENTREPORT = dhtmlXComboFromSelect("ddlENTREPORT"); } function initComboENTREPORT2()//中转港 { if ($("hdEnabled").value == "0") { comboENTREPORT.disable(true); } // comboENTREPORT.setOptionWidth(200); comboENTREPORT.attachEvent("onOpen", function() { if (comboENTREPORT.getOptionByIndex(0) == null) { comboENTREPORT.loadXML("../FeeCodes/TCodeDisportAdapter.aspx?mask=0&pos=0&strSel="); } }); comboENTREPORT.attachEvent("onChange", function() { $("hd_comboENTREPORT").value = comboENTREPORT.getComboText().trim().toUpperCase(); //comboENTREPORT.getSelectedText(); comboENTREPORT.setComboText($("hd_comboENTREPORT").value); }); comboENTREPORT.attachEvent("onBlur", function() { comboENTREPORT.setComboText($("hd_comboENTREPORT").value); }); comboENTREPORT.setComboText($("hd_comboENTREPORT").value); //检索 //comboENTREPORT.enableFilteringMode(true); comboENTREPORT.attachEvent("onKeyPressed", function(keyCode) { var arrayArg = new Array(); setTimeout(function() { var filterCount = 0; if ("" != comboENTREPORT.getComboText().trim()) { var enterValue = comboENTREPORT.getComboText().toUpperCase(); comboENTREPORT.loadXML("../FeeCodes/TCodeDisportAdapter.aspx?mask=0&pos=0&strSel=" + enterValue); } }, 10); }); comboENTREPORT.attachEvent("onSelectionChange", function() { $("hd_comboENTREPORT").value = comboENTREPORT.getComboText().trim(); }); } function initComboLANE()//航线 { comboLANE = dhtmlXComboFromSelect("ddlLANE"); comboLANE.loadXML("../FeeCodes/TCodeLanesAdapter.aspx?mask=0&pos=0"); } function initComboLANE3()//航线 { comboLANE.loadXML("../FeeCodes/TCodeLanesAdapter.aspx?mask=0&pos=0"); } function initComboLANE2()//航线 { if ($("hdEnabled").value == "0") { comboLANE.disable(true); } // comboLANE.setOptionWidth(200); comboLANE.attachEvent("onChange", function() { comboLANE.setComboText($("hd_comboLANE").value); }); comboLANE.attachEvent("onBlur", function() { var s1 = comboLANE.getComboText().trim(); var s2 = s1.indexOf("|"); if (s1 == "") { $("hd_comboLANE").value = ""; comboLANE.setComboText($("hd_comboLANE").value); } else { if (s2 > 0) { s2 = s2 + 2; } var s3 = s1.substring(s2); if (s2 > 0) { comboLANE.setComboText(s3); $("hd_comboLANE").value = s3; } else { comboLANE.setComboText($("hd_comboLANE").value); } } }); comboLANE.setComboText($("hd_comboLANE").value); comboLANE.attachEvent("onKeyPressed", function(keyCode) { if (keyCode != "8") { var arrayArg = new Array(); setTimeout(function() { var filterCount = 0; var is = -1; var ishd = $("hd_comboLANE").value.trim(); if ("" != comboLANE.getComboText().trim()) { while ("undefined" != typeof comboLANE.getOptionByIndex(filterCount)) { var comboValue = comboLANE.getOptionByIndex(filterCount).text.toUpperCase(); //.value; var enterValue = comboLANE.getComboText().trim().toUpperCase(); $("hd_comboLANE").value = comboLANE.getComboText().trim().toUpperCase(); if (comboValue.indexOf(enterValue) == 0) { comboLANE.selectOption(filterCount, true, true); is = filterCount; break; } ++filterCount; } if (is == -1) { $("hd_comboLANE").value = ishd; alert("无此内容,请重新选择!"); } } }, 10); } }); comboLANE.attachEvent("onSelectionChange", function() { $("hd_comboLANE").value = comboLANE.getComboText().trim(); }); } function initComboLANE()//航线 { comboLANE = dhtmlXComboFromSelect("ddlLANE"); comboLANE.loadXML("../FeeCodes/TCodeLanesAdapter.aspx?mask=0&pos=0"); } function initComboLANE3()//航线 { comboLANE.loadXML("../FeeCodes/TCodeLanesAdapter.aspx?mask=0&pos=0"); } function initComboLANE2()//航线 { if ($("hdEnabled").value == "0") { comboLANE.disable(true); } // comboLANE.setOptionWidth(200); comboLANE.attachEvent("onChange", function() { comboLANE.setComboText($("hd_comboLANE").value); }); comboLANE.attachEvent("onBlur", function() { var s1 = comboLANE.getComboText().trim(); var s2 = s1.indexOf("|"); if (s1 == "") { $("hd_comboLANE").value = ""; comboLANE.setComboText($("hd_comboLANE").value); } else { if (s2 > 0) { s2 = s2 + 2; } var s3 = s1.substring(s2); if (s2 > 0) { comboLANE.setComboText(s3); $("hd_comboLANE").value = s3; } else { comboLANE.setComboText($("hd_comboLANE").value); } } }); comboLANE.setComboText($("hd_comboLANE").value); comboLANE.attachEvent("onKeyPressed", function(keyCode) { if (keyCode != "8") { var arrayArg = new Array(); setTimeout(function() { var filterCount = 0; var is = -1; var ishd = $("hd_comboLANE").value.trim(); if ("" != comboLANE.getComboText().trim()) { while ("undefined" != typeof comboLANE.getOptionByIndex(filterCount)) { var comboValue = comboLANE.getOptionByIndex(filterCount).text.toUpperCase(); //.value; var enterValue = comboLANE.getComboText().trim().toUpperCase(); $("hd_comboLANE").value = comboLANE.getComboText().trim().toUpperCase(); if (comboValue.indexOf(enterValue) == 0) { comboLANE.selectOption(filterCount, true, true); is = filterCount; break; } ++filterCount; } if (is == -1) { $("hd_comboLANE").value = ishd; alert("无此内容,请重新选择!"); } } }, 10); } }); comboLANE.attachEvent("onSelectionChange", function() { $("hd_comboLANE").value = comboLANE.getComboText().trim(); }); } function initComboCARRIER()//船公司 { comboCARRIER = dhtmlXComboFromSelect("ddlCARRIER"); comboCARRIER.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISCARRIER"); } function initComboCARRIER2()//船公司 { if ($("hdEnabled").value == "0") { comboCARRIER.disable(true); } // comboCARRIER.setOptionWidth(200); comboCARRIER.attachEvent("onChange", function() { comboCARRIER.setComboText($("hd_comboCARRIER").value); }); comboCARRIER.attachEvent("onBlur", function() { var s1 = comboCARRIER.getComboText().trim(); var s2 = s1.indexOf("|"); if (s1 == "") { $("hd_comboCARRIER").value = ""; comboCARRIER.setComboText($("hd_comboCARRIER").value); } else { if (s2 > 0) { s2 = s2 + 2; } var s3 = s1.substring(s2); if (s2 > 0) { comboCARRIER.setComboText(s3); $("hd_comboCARRIER").value = s3; } else { comboCARRIER.setComboText($("hd_comboCARRIER").value); } } }); comboCARRIER.setComboText($("hd_comboCARRIER").value); comboCARRIER.attachEvent("onKeyPressed", function(keyCode) { if (keyCode != "8") { var arrayArg = new Array(); setTimeout(function() { var is = -1; var ishd = $("hd_comboCARRIER").value.trim(); var filterCount = 0; if ("" != comboCARRIER.getComboText().trim()) { while ("undefined" != typeof comboCARRIER.getOptionByIndex(filterCount)) { var comboValue = comboCARRIER.getOptionByIndex(filterCount).text.toUpperCase(); //.value; var enterValue = comboCARRIER.getComboText().trim().toUpperCase(); $("hd_comboCARRIER").value = comboCARRIER.getComboText().trim().toUpperCase(); if (comboValue.indexOf(enterValue) == 0) { comboCARRIER.selectOption(filterCount, true, true); is = filterCount; break; } ++filterCount; } if (is == -1) { $("hd_comboCARRIER").value = ishd; alert("无此内容,请重新选择!"); } } }, 10); } }); comboCARRIER.attachEvent("onSelectionChange", function() { $("hd_comboCARRIER").value = comboCARRIER.getComboText().trim(); }); } function printAction() { var strBSNO = ""; strBSNO = $("hdGID").value; var printUrl = ""; var companyID = ""; var typeName = "QuotationReport"; var dbSourceID = ""; var userID = ""; var url = "../Reports/ReportService.aspx?handle=printquotation&bsno=" + strBSNO + "&val=" + newGuid(); 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; } } function setWEEK() { var sdate = $("tbETD").value.trim(); //判断日期是否正确 var bl = verifyDate(sdate); if (bl) { //var year = 2011, month = 6, date = 23; // month=6表示7月 var sdate = $("tbETD").value; var irqI = sdate.indexOf("-"); var irqL = sdate.lastIndexOf("-"); var syear = sdate.substr(0, irqI); var smonth = sdate.substr(irqI + 1, irqL - irqI - 1); var sday = sdate.substr(irqL + 1); smonth = parseInt(smonth, 10) - 1; var dt = new Date(syear, smonth, sday); var weekDay = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; var sdkj = weekDay[dt.getDay()]; $("lbWEEK").value = sdkj; } }