You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/js/jsGridSeaImportInfoCtn.js

3119 lines
132 KiB
JavaScript

3 years ago
var mygrid_recv;
var page_count = 5;
var column_count;
var jsonTopCtnObj;
var changeCount = 0;
//两端去空格函数
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); }
function $(id) {
return document.getElementById(id);
}
function doInitRecvGrid()
{
mygrid_recv = new dhtmlXGridObject('mygrid_container_recv');
mygrid_recv.setImagePath("../images/");
mygrid_recv.setSkin("xp");
mygrid_recv.setHeader("箱型,箱量,箱号,封号,件数,包装类型,箱内货重,箱皮重,尺码,备注");
mygrid_recv.setInitWidths("60,40,90,50,50,80,80,80,80,134");
mygrid_recv.setColAlign("center,left,left,left,left,left,left,left,left,left");
mygrid_recv.setColSorting("str,str,str,str,str,str,str,str,str,str");
mygrid_recv.setColTypes("co,ed,ed,ed,ed,co,ed,ed,ed,ed");
var BSNO = $("dvOrderNumVal").value.trim();
var urlVal = "SeaImportInfoGridSource.aspx?read=exist&showcount=1&BSNO=" + BSNO + "&val=" + newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
loader = null;
if (parseInt(loadVal) == 1) {
mygrid_recv.loadXML("SeaImportInfoGridSource.aspx?read=init&showcount=1&BSNO=" + BSNO);
setTimeout(function() {
ReShowLabel(mygrid_recv);
}, 200);
}
mygrid_recv.init();
mygrid_recv.enableEditEvents(true, false, true);
mygrid_recv.enableMultiselect(true);
mygrid_recv.enableKeyboardSupport(true);
var pushVal = "";
var pressRecord = "";
var pressRowIndex = -1;
var pressCellIndex = -1;
var pressCount = 0;
var isExchange = false;
var shiftCount = 0;
var isDelete = 0;
var flagFilter = 0;
var flagTab = 0;
var flagEnter = 0;
var flagDelete = 0;
//手动编写Grid控件编辑事件,由于免费控件没有提供完整的编辑判断功能,现特此做更改
mygrid_recv.attachEvent("onEditCell", function(stage, rId, cInd, nValue, oValue) {
var newCheckValue = false;
//初始化状态
if (stage == 0) {
var selectedId = mygrid_recv.getSelectedRowId();
var rowIndex = mygrid_recv.getRowIndex(selectedId);
var oldVal = mygrid_recv.cellByIndex(rowIndex, 0).getValue().trim();
return true;
}
if (stage == 1) {
return true;
}
//如果编辑结束
if (stage == 2) {
//获取当前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();
if (ind == 0) {
oldVal = oldVal.toUpperCase();
var loader = dhtmlxAjax.getSync("../FeeCodes/TopCtnAdapter.aspx?ctn=" + oldVal + "&val=" + newGuid());
oldVal = loader.xmlDoc.responseText;
//将value写入cell(触发 stage2)
mygrid_recv.cellByIndex(rowIndex, ind).setValue(oldVal);
}
else if (ind == 5) {
oldVal = oldVal.toUpperCase();
//comboKINDPKGS.loadXML("../FeeCodes/TCodePackageAdapter.aspx?mask=0&pos=0");
var loader = dhtmlxAjax.getSync("../FeeCodes/TopCtnAdapter.aspx?kindpkgs=" + oldVal + "&val=" + newGuid());
oldVal = loader.xmlDoc.responseText;
//将value写入cell(触发 stage2)
mygrid_recv.cellByIndex(rowIndex, ind).setValue(oldVal);
}
else if (ind == 6 || ind == 7 || ind == 8)//键盘输入浮点数字
{
if (oldVal.trim() != "") {
var bl = isFloat(oldVal);
if (!bl) {
alert("重量或尺码格式出错!");
return false;
}
}
}
else if (ind == 1 || ind == 4)//键盘输入整数
{
if (oldVal.trim() != "") {
var bl = isInt(oldVal);
if (!bl) {
alert("箱量格式出错!"); //或件数
return false;
}
}
}
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;
//Tab键
if (code == 9) {
var colCount = mygrid_recv.getColumnsNum();
var rowCount = mygrid_recv.getRowsNum();
if (ind < colCount) {
isExchange = false;
pressRecord = "";
pressRowIndex = -1;
pressCellIndex = -1;
mygrid_recv.editStop(true);
mygrid_recv.cellByIndex(rowIndex, ind).setLabel(oldVal);
var cInd = ind;
var rId = selectedId;
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, 0, true, true);
mygrid_recv.editCell();
}
else {
return;
}
}
}
}
else if (code == 40)//向下方向键
{
if (ind == 0) {
return true;
}
var rowCount = mygrid_recv.getRowsNum();
mygrid_recv.clearSelection();
mygrid_recv.editStop();
if (rowIndex == (rowCount - 1)) {
addRecvRow();
}
else {
mygrid_recv.selectCell(rowIndex + 1, 0, true, true);
mygrid_recv.editCell();
}
}
else if (code == 38)//向上箭头
{
if (ind == 0) {
return true;
}
if (rowIndex > 0) {
mygrid_recv.clearSelection();
mygrid_recv.editStop();
mygrid_recv.selectCell(rowIndex - 1, 0, true, true);
mygrid_recv.editCell();
}
}
else {
if (ind == 0 || ind == 5) {
for (i = 0; i < document.all.length; i++) {
if (document.all(i).tagName == "TEXTAREA") {
txtEdit = document.all(i);
break;
}
}
if (code >= 65 && code <= 90) {//如果是输入英文字符
if (ind == 0) {
//获取键盘输入字符
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_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") {
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")
// {
// 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;
// }
// }
}
}
else if (ind == 5) {
//获取键盘输入字符
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) {
var dd = pressRecord.length;
if (start != dd) {
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;
}
}
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_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;
//产生效果将检索字母之后的数据进行选黑
var r = document.selection.createRange();
r.collapse(true);
r.moveStart("character", pressRecord.length); //从m位开始
r.moveEnd("character", old_length); //选取n位
r.select();
break;
}
}
//如果检索不能成功 pressCount=2
if (count == 0) {
//关闭编辑
mygrid_recv.editStop();
//将value写入cell(触发 stage2)
mygrid_recv.cellByIndex(rowIndex, ind).setValue(pressRecord);
flagFilter = 0;
//重新打开cell(触发stage0 stage1)
mygrid_recv.selectCell(rowIndex, ind, true, true);
mygrid_recv.editCell();
//产生效果将检索字母之后的数据进行选黑
var r = document.selection.createRange();
r.moveStart("character", pressRecord.length); //从m位开始
r.collapse(true);
r.select();
}
}
//
}
else {
return true;
}
}
else {
return true;
}
return true;
}
});
}
//讲下拉列表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 < arrayRow.length; ++i) {
strBuffer = strBuffer + arrayRow[i];
if (i != arrayRow.length - 1) {
strBuffer = strBuffer + ",";
}
}
alert(strBuffer);
}
//将整行值暂存到数组中
function getGridRowArray(arrayRow, gridObj, RowID) {
var arg = new Array();
var columnCount = gridObj.getColumnsNum();
var rowCount = gridObj.getRowsNum();
alert(columnCount); alert(rowCount);
for (var i = 0; i < columnCount; i++) {
alert(i);
var cellObj = gridObj.cellById(RowID, i);
alert(cellObj);
if (i == 5) { alert("kill"); }
var cell = gridObj.cellById(RowID, i);
if (i == 5) { alert("kill"); }
var rowValue = cell.getValue();
if (i == 5) { alert("kill"); }
if (i == columnCount - 1) {
arg.push(rowValue == 1 ? true : false);
break;
}
//校验获取的值是否为数字,如果是数字记录时不加引号,如果是字符增加引号
var re = /^[-\+]?\d+(\.\d+)?$/;
if (!re.test(rowValue)) {
switch (i) {
case 4:
case 5:
case 6:
case 9:
alert("请正确输入数字");
return;
break;
case 8: //如果是币别 则根据value值获取text值
var curCombo = gridObj.getCustomCombo(RowID, i);
arg.push(curCombo.get(rowValue));
break;
default:
arg.push(rowValue);
break;
}
} else {
if (i == 7) {
//获取单价
var unitPrice = isObjNaN(parseFloat(gridObj.cellById(RowID, 4).getValue()));
//获取数量
var quantityCount = isObjNaN(parseFloat(gridObj.cellById(RowID, 5).getValue()));
//金额
var amount = unitPrice * quantityCount;
arg.push(outputMoney(amount.toString()));
} else {
arg.push(outputMoney(isObjNaN(parseFloat(rowValue)).toString()));
}
}
}
//alert(arg);
return arg;
}
function isObjNaN(Obj) {
if (Obj.toString().toLowerCase() == "nan") {
return 0;
} else {
return Obj;
}
}
function addRecvRow() {
if (mygrid_recv.getRowsNum() > 0) {
var newId = newGuid();
//获取插入新纪录位置
var rowCount = mygrid_recv.getRowsNum();
mygrid_recv.addRow(newId, ["", "", ""], rowCount);
mygrid_recv.clearSelection();
var rId = mygrid_recv.getRowId(rowCount - 1);
//
//重新加载FRT
var combo_frt;
combo_frt = mygrid_recv.getCustomCombo(rId, 0);
setComboByArray(mygrid_recv, combo_frt, newId, 0);
//
combo_frt = mygrid_recv.getCustomCombo(rId, 5);
setComboByArray(mygrid_recv, combo_frt, newId,5);
//
mygrid_recv.editStop(true);
mygrid_recv.selectCell(mygrid_recv.getRowIndex(newId), 0, true, true);
mygrid_recv.editCell();
}
else {
var BSNO = $("dvOrderNumVal").value.trim();
mygrid_recv.loadXML("SeaImportInfoGridSource.aspx?read=add&showcount=1&BSNO=" + BSNO);
}
}
function deleteRecvRow() {
mygrid_recv.editStop();
var selRowID = mygrid_recv.getSelectedRowId();
var selGroup = new Array();
if (selRowID.indexOf(",") > 0) {
selGroup = selRowID.split(",");
}
else {
if (selRowID != null) {
selGroup.push(selRowID);
}
}
//查看是否有被选中的费用项
if (selGroup.length > 0) {
if (selGroup.length > 1) {
var delCount = 0;
if (window.confirm("您确定要将所选数据删除吗?")) {
var dg = new dialog();
dg.html = "<img src=\"../images/icon/progress.gif\" />";
dg.width = 200;
dg.height = 100;
dg.title = "标题";
dg.show();
while (delCount < selGroup.length) {
var rowIndex = mygrid_recv.getRowIndex(selGroup[delCount]);
var TopCtnName = mygrid_recv.cellByIndex(rowIndex, 0).getValue();
var cusName = mygrid_recv.cellByIndex(rowIndex, 1).getValue();
//var urlVal = "TopCtnService.aspx?gid="+selGroup[delCount]+"&handle=delete"+"&no="+newGuid();
var urlVal = "SeaImportInfoGridSource.aspx?read=delete&CTN_ID=" + selGroup[delCount];
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if (loadVal > 0) {
mygrid_recv.deleteRow(selGroup[delCount]);
}
else {
mygrid_recv.deleteSelectedRows();
}
delCount++;
}
dg.close();
}
}
else {
var delCount = 0;
while (delCount < selGroup.length) {
var rowIndex = mygrid_recv.getRowIndex(selGroup[delCount]);
var TopCtnName = mygrid_recv.cellByIndex(rowIndex, 0).getValue();
var cusName = mygrid_recv.cellByIndex(rowIndex, 1).getValue();
if (window.confirm("您确定要将数据(" + TopCtnName + ")删除吗?")) {
var dg = new dialog();
dg.html = "<img src=\"../images/icon/progress.gif\" />";
dg.width = 200;
dg.height = 100;
dg.title = "标题";
dg.show();
//var urlVal = "TopCtnService.aspx?gid="+selGroup[delCount]+"&handle=delete"+"&no="+newGuid();
var urlVal = "SeaImportInfoGridSource.aspx?read=delete&CTN_ID=" + selGroup[delCount];
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if (loadVal > 0) {
mygrid_recv.deleteRow(selGroup[delCount]);
dg.close();
//alert("删除成功");
}
else {
mygrid_recv.deleteSelectedRows();
dg.close();
}
}
delCount++;
}
}
}
else {
alert("未选中要操作的费用项");
}
}
function saveRecvChange() {
mygrid_recv.editStop();
var strError = "";
var strError2 = "";
var strError3 = "";
var BSNO = $("dvOrderNumVal").value.trim();
jsonTopCtnObj = "{\"$type\":\"DSWeb.Models.JsonTopCtnGroupEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",\"JsonTopCtnEntities\":[";
column_count = mygrid_recv.getColumnsNum();
var tempJson = "";
var rowCount = mygrid_recv.getRowsNum();
for (var i = 0; i < rowCount; i++) {
//获取RowID
tempJson = "";
var rId = mygrid_recv.getRowId(i);
tempJson += "\"$type\":\"DSWeb.Models.JsonTopCtnEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",";
tempJson += "\"TopCtn1\":\"" + rId + "\","; //gid
strError = "";
for (var j = 0; j < column_count; j++) {
var cell = mygrid_recv.cellById(rId, j);
var value = "";
//value = cell.cell.innerText; // .getValue();
value = cell.cell.textContent || cell.cell.innerText;
if ((j + 2) == 2) {
if (value.trim() == "") {
value = "";
strError = "集装箱列表中有箱型为空的数据,不能保存集装箱信息!"
continue;
//value = "null";
}
}
else if ((j + 2) == 3) {
if (value.trim() == "") {
value = "1";
strError = "集装箱列表中有箱量为空的数据,不能保存集装箱信息!"
continue;
}
else {
var nb = IsNum(value.trim());
if (nb) {
if (Number(value.trim()) < 1) {
value = "1";
strError = "集装箱列表中有箱量小于1的数据不能保存集装箱信息"
continue;
}
}
else {
value = "1";
strError = "集装箱列表中箱量数据格式错误,不能保存集装箱信息!"
continue;
}
}
}
else if ((j + 2) == 4) {
if (value.trim() != "") {
var svl = value.trim().length;
if (svl == 11) {
var s13 = value.trim().substr(0, 3);
var re = new RegExp("^[A-Za-z]+$");
if (!re.test(s13)) {
strError = "集装箱列表中箱号为“" + value.trim() + "”的数据,格式错误,请按照正确的箱号格式录入!"
continue;
}
//
var s4 = value.trim().substr(3, 1).toUpperCase();
if (s4.trim() != "U") {
strError = "集装箱列表中箱号为“" + value.trim() + "”的数据,格式错误,请按照正确的箱号格式录入!"
continue;
}
//
var s5611 = value.trim().substr(4);
var bl = IsNum(s5611.trim());
if (!bl) {
strError = "集装箱列表中箱号为“" + value.trim() + "”的数据,格式错误,请按照正确的箱号格式录入!"
continue;
}
}
else {
strError = "集装箱列表中箱号为“" + value.trim() + "”的数据,格式错误,请按照正确的箱号格式录入!"
continue;
}
value = value.trim().toUpperCase();
}
}
else if ((j + 2) == 6) {
if (value.trim() == "") {
value = "0";
}
else {
var nb = IsNum(value.trim());
if (nb) {
if (Number(value.trim()) < 0) {
value = "0";
strError = "集装箱列表中有件数小于0的数据不能保存集装箱信息"
continue;
}
}
else {
value = "0";
strError = "集装箱列表中件数格式错误,不能保存集装箱信息!"
continue;
}
}
}
else if ((j + 2) == 8) {
if (value.trim() == "") {
value = "0";
}
else {
var nb = IsNum(value.trim());
if (nb) {
if (Number(value.trim()) < 0) {
value = "0";
strError = "集装箱列表中有箱内货重小于0的数据不能保存集装箱信息"
continue;
}
}
else {
value = "0";
strError = "集装箱列表中箱内货重格式错误,不能保存集装箱信息!"
continue;
}
}
}
else if ((j + 2) == 9) {
if (value.trim() == "") {
value = "0";
}
else {
var nb = IsNum(value.trim());
if (nb) {
if (Number(value.trim()) < 0) {
value = "0";
strError = "集装箱列表中有箱皮重小于0的数据不能保存集装箱信息"
continue;
}
}
else {
value = "0";
strError = "集装箱列表中箱皮重格式错误,不能保存集装箱信息!"
continue;
}
}
}
else if ((j + 2) == 10) {
if (value.trim() == "") {
value = "0";
}
else {
var nb = IsNum(value.trim());
if (nb) {
if (Number(value.trim()) < 0) {
value = "0";
strError = "集装箱列表中有尺码小于0的数据不能保存集装箱信息"
continue;
}
}
else {
value = "0";
strError = "集装箱列表中尺码格式错误,不能保存集装箱信息!"
continue;
}
}
}
else {
if (value.trim() == "") {
value = "";
//value = "null";
}
}
tempJson += "\"TopCtn" + (j + 2) + "\":\"" + value.trim() + "\",";
}
tempJson += "\"TopCtn12\":\"" + BSNO + "\"";
tempJson = "{" + tempJson + "}";
//
if (strError != "") {
strError2 = strError;
continue;
}
else {
strError3 += "," + BSNO
}
//
if (i == rowCount - 1) {
jsonTopCtnObj = jsonTopCtnObj + tempJson;
}
else {
jsonTopCtnObj = jsonTopCtnObj + tempJson + ",";
}
}
//
if (strError2 != "") {
alert(strError2);
strError2 = "";
var dg = new dialog();
dg.close();
return;
}
//
// if(strError3=="")
// {
// var dg=new dialog();
// dg.close();
// return;
// }
jsonTopCtnObj += "]}";
var txt_name = $("recvContainer");
txt_name.value = jsonTopCtnObj;
msgBox();
setTimeout(postEnterTopCtn, 200);
}
function doOnRowSelected(rowID, celInd) {
alert("Selected row ID is " + rowID + "\nUser clicked cell with index " + celInd);
}
function getValue() {
var colLabel = mygrid_recv.getColumnLabel(0);
alert(colLabel);
var colLabel2 = mygrid_recv.getColumnLabel(0, 1);
alert(colLabel2);
}
//post数据
function postEnterTopCtn() {
var myForm = document.getElementById("form1");
myForm.submit();
}
function findRow() {
var colNum = mygrid.getColumnsNum();
//alert(colNum);
var count = mygrid.getRowsNum();
//alert(count);
//var combo = mygrid.getCombo(1);
//combo.put("abc","abc");
}
function initGrid() {
doInitRecvGrid();
//setTimeout(doInitPayGrid,200);
//setTimeout(totalDynamicTopCtnGain,700);
}
//放弃应收费用修改 重新加载页面
function recoverRecvChange() {
mygrid_recv.editStop();
var selRowID = mygrid_recv.getSelectedRowId();
//查看是否有被选中的费用项
if (selRowID != null) {
var rowIndex = mygrid_recv.getRowIndex(selRowID);
var status = mygrid_recv.cellByIndex(rowIndex, 0).getValue();
var TopCtnName = mygrid_recv.cellByIndex(rowIndex, 1).getValue();
var cusName = mygrid_recv.cellByIndex(rowIndex, 2).getValue();
if (window.confirm("您确定放弃当前行的修改吗?")) {
var dg = new dialog();
dg.html = "<img src=\"../../images/icon/progress.gif\" />";
dg.width = 200;
dg.height = 100;
dg.title = "标题";
dg.show();
var urlVal = "SeaImportInfoGridSource.aspx?read=recover&CTN_ID=" + selRowID + "&val=" + newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if (!IsNum(loadVal)) {
var recvArg = new Array();
recvArg = loadVal.split(",");
var selRowIndex = mygrid_recv.getRowIndex(recvArg[0]);
var colCount = mygrid_recv.getColumnsNum();
for (var i = 0; i < colCount; i++) {
mygrid_recv.cellByIndex(selRowIndex, i).setValue(recvArg[i + 1]);
}
dg.close();
//alert("恢复成功");
//refreshRecv();//刷新
}
else {
if (parseInt(loadVal) == -3) {
// mygrid_recv.cellByIndex(rowIndex,1).setValue("");
// mygrid_recv.cellByIndex(rowIndex,2).setValue("");
// mygrid_recv.cellByIndex(rowIndex,3).setValue("");
mygrid_recv.deleteSelectedRows();
}
dg.close();
}
ReShowLabel(mygrid_recv);
}
else {
return;
}
}
else {
alert("未选中要操作的费用项");
}
}
function print_recv() {
alert("正在打印");
}
function amountSum(gridName) {
if (gridName == "recv") {
//计算应收
mygrid_recv
} else {
//计算应付
}
}
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);
}
//获取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() {
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.html+="<input type=button onclick='new dialog().close();' value='确定'>";
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 isIntOrNull(str) {
if (!isObj(str))//判断对象是否存在
return 'undefined';
return isNull(str) || isInt(str);
}
//必需是整数
function isInt(str) {
var reg = /^(-|\+)?\d+$/;
return reg.test(str);
}
//1.2 小数
//小数或者为空
function isFloatOrNull(str) {
if (!isObj(str))//判 断对象是否存在
return 'undefined';
if (isInt(str))
return true;
return isNull(str) || isFloat(str);
}
//必需是小数
function isFloat(str) {
if (isInt(str))
return true;
var reg = /^(-|\+)?\d+\.\d*$/;
return reg.test(str);
}
//1.3 数字大小判断
//数i不能大于数y
function iMinY(i, y) {
if (!isObj(i) || !isObj(y))// 判断对象是否存在
return 'undefined';
if (!(isFloat(i) && isFloat(y)))
return '比较的必须是数字类型'
if (i <= y)
return true;
return false;
}
// 数i不能小于数y
function iMaxY(i, y) {
if (!isObj(i) || !isObj(y))//判断对象是 否存在
return 'undefined';
if (!(isFloat(i) && isFloat(y)))
return '比较的必须是数字类型'
if (i >= y)
return true;
return false;
}
function ConvertToMoney(strObj) {
var result = strObj.replace(",", "");
return result;
}
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 < comboArg.length; i++) {
if (combo.get(comboArg[i]).toUpperCase().trim().indexOf(filterVal.toUpperCase()) == 0) {
alert(combo.get(comboArg[i]).toUpperCase().trim());
gridObj.cellByIndex(rowIndex, colIndex).setValue(combo.get(comboArg[i]));
gridObj.selectCell(rowIndex, colIndex, true, true, true, true);
doCount = 1;
break;
}
}
}
function ReShowLabel(gridObj) {
var columnCount = gridObj.getColumnsNum();
var rowCount = gridObj.getRowsNum();
if (rowCount > 0) {
for (var i = 0; i < rowCount; i++) {
for (var j = 0; j < columnCount; j++) {
if (j == 1 || j == 2) {
var cellCurVal = gridObj.cellByIndex(i, j).getValue();
gridObj.cellByIndex(i, j).setLabel(cellCurVal);
}
}
}
}
}
function clearNoNum(valObj) {
//先把非数字的都替换掉,除了数字和.
valObj = valObj.replace(/[^\d.]/g, "");
//必须保证第一个为数字而不是.
valObj = valObj.replace(/^\./g, "");
//保证只有出现一个.而没有多个.
valObj = valObj.replace(/\.{2,}/g, ".");
//保证.只出现一次,而不能出现两次以上
valObj = valObj.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
return valObj;
}
function markStatusColor(gridObj) {
var count = gridObj.getRowsNum();
for (var i = 0; i < count; i++) {
var status = gridObj.cellByIndex(i, 0).getValue();
var rowId = gridObj.getRowId(i);
}
}
//刷新应收
function refreshRecv() {
doInitRecvGrid();
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------
function nTabs(thisObj,Num){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
if (i == Num)
{
thisObj.className = "active";
document.getElementById(tabObj+"_Content"+i).style.display = "block";
}else{
tabList[i].className = "normal";
document.getElementById(tabObj+"_Content"+i).style.display = "none";
}
}
}
//document.oncontextmenu=new Function("event.returnValue=false;"); //禁止右键功能,单击右键将无任何反应
//document.onselectstart=new Function("event.returnValue=false;"); //禁止先择,也就是无法复制
var comboOP;//操作人员
var comboSALE;//揽货人
var comboCUSTSERVICE;//客服
var comboCUSTOMERNAME;//委托单位
var comboCustContact; //
var comboKINDPKGS;//包装类型
var comboCUSTOMSER;//报关行
var comboINSPECTION; //报检
var comboVESSEL;//船名
var comboVOYNO;//航次
var comboPORTLOAD; //启运港
var comboPORTDISCHARGE; //卸货港交货地
var ComboBSSOURCE;//市场来源大类
var ComboBSSOURCEDETAIL;//市场来源细类
var ComboGOODSNAME;//货物描述类型
var comboSALEDEPT; //所属业务部门
var comboTradingAgency; //贸易代理
var comboGoodsTypeName; //品名类型
var ComboBLTYPE; //装运方式
function $(id)
{
return document.getElementById(id);
}
function initComboOP()//操作人员
{
//生成
var strUserID=$("hdUserID").value;
comboOP = dhtmlXComboFromSelect("ddlOP");
comboOP.loadXML("../FeeCodes/OPAdapter.aspx?mask=0&pos=0&rName=isOperator&userID="+strUserID);
}
function initComboOP2()//操作人员
{
if($("hdEnabled").value == "false")
{
comboOP.disable(true);
}
//
comboOP.attachEvent("onChange", function()
{
comboOP.setComboText($("hd_comboOP").value);
});
comboOP.attachEvent("onBlur", function(){
var s1 = comboOP.getComboText().trim();
var s2 = s1.indexOf("|");
if(s1=="")
{
$("hd_comboOP").value="";
comboOP.setComboText($("hd_comboOP").value);
}
else
{
if(s2>0)
{
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0)
{
comboOP.setComboText(s3);
$("hd_comboOP").value=s3;
}
else
{
comboOP.setComboText($("hd_comboOP").value);
}
}
});
comboOP.setComboText($("hd_comboOP").value);
comboOP.attachEvent("onKeyPressed", function(keyCode)
{
if(keyCode!="8")
{
var arrayArg = new Array();
setTimeout(function()
{
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboOP").value.trim();
if("" != comboOP.getComboText().trim())
{
while("undefined" != typeof comboOP.getOptionByIndex(filterCount))
{
var comboValue = comboOP.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboOP.getComboText().trim().toUpperCase();
$("hd_comboOP").value = comboOP.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0)
{
comboOP.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1)
{
$("hd_comboOP").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboOP.attachEvent("onSelectionChange", function()
{
$("hd_comboOP").value = comboOP.getComboText().trim();
});
}
function initComboSALE()//揽货人
{
//生成
var strUserID=$("hdUserID").value;
comboSALE = dhtmlXComboFromSelect("ddlSALE");
comboSALE.loadXML("../FeeCodes/OPAdapter.aspx?mask=0&pos=0&rName=isSaleMan&userID="+strUserID);
}
function initComboSALE3()//揽货人
{
//生成
comboSALE.loadXML("../FeeCodes/OPAdapter.aspx?mask=0&pos=0&rName=isSaleMan&userID="+strUserID);
}
function initComboSALE2()//揽货人
{
if($("hdEnabled").value == "false")
{
comboSALE.disable(true);
}
//
comboSALE.attachEvent("onChange", function()
{
comboSALE.setComboText($("hd_comboSALE").value);
});
comboSALE.attachEvent("onBlur", function(){
var s1 = comboSALE.getComboText().trim();
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.trim();
if("" != comboSALE.getComboText().trim())
{
while("undefined" != typeof comboSALE.getOptionByIndex(filterCount))
{
var comboValue = comboSALE.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboSALE.getComboText().trim().toUpperCase();
$("hd_comboSALE").value = comboSALE.getComboText().trim().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().trim();
});
}
function initComboCUSTSERVICE()//客服
{
//生成
var strUserID=$("hdUserID").value;
comboCUSTSERVICE = dhtmlXComboFromSelect("ddlCUSTSERVICE");
comboCUSTSERVICE.loadXML("../FeeCodes/OPAdapter.aspx?mask=0&pos=0&rName=isCustomsService&userID="+strUserID);
}
function initComboCUSTSERVICE2()//客服
{
if($("hdEnabled").value == "false")
{
comboCUSTSERVICE.disable(true);
}
//
comboCUSTSERVICE.attachEvent("onChange", function()
{
comboCUSTSERVICE.setComboText($("hd_comboCUSTSERVICE").value);
});
comboCUSTSERVICE.attachEvent("onBlur", function(){
var s1 = comboCUSTSERVICE.getComboText().trim();
var s2 = s1.indexOf("|");
if(s1=="")
{
$("hd_comboCUSTSERVICE").value="";
comboCUSTSERVICE.setComboText($("hd_comboCUSTSERVICE").value);
}
else
{
if(s2>0)
{
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0)
{
comboCUSTSERVICE.setComboText(s3);
$("hd_comboCUSTSERVICE").value=s3;
}
else
{
comboCUSTSERVICE.setComboText($("hd_comboCUSTSERVICE").value);
}
}
});
comboCUSTSERVICE.setComboText($("hd_comboCUSTSERVICE").value);
comboCUSTSERVICE.attachEvent("onKeyPressed", function(keyCode)
{
if(keyCode!="8")
{
var arrayArg = new Array();
setTimeout(function()
{
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboCUSTSERVICE").value.trim();
if("" != comboCUSTSERVICE.getComboText().trim())
{
while("undefined" != typeof comboCUSTSERVICE.getOptionByIndex(filterCount))
{
var comboValue = comboCUSTSERVICE.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboCUSTSERVICE.getComboText().trim().toUpperCase();
$("hd_comboCUSTSERVICE").value = comboCUSTSERVICE.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0)
{
comboCUSTSERVICE.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1)
{
$("hd_comboCUSTSERVICE").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);}});
comboCUSTSERVICE.attachEvent("onSelectionChange", function()
{
$("hd_comboCUSTSERVICE").value = comboCUSTSERVICE.getComboText().trim();
});
}
function initComboCUSTOMERNAME()//委托单位
{
comboCUSTOMERNAME = dhtmlXComboFromSelect("ddlCUSTOMERNAME");
comboCUSTOMERNAME.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISCONTROLLER");
//
comboCustContact = dhtmlXComboFromSelect("ddlCustContact");
var strCUSTOMERNAME = $("hd_comboCUSTOMERNAME").value.trim();
comboCustContact.loadXML("../FeeCodes/InfoClientContactAdapter.aspx?mask=0&pos=0&CUSTOMERNAME=" + escape(strCUSTOMERNAME));
}
function initComboCUSTOMERNAME2()//委托单位
{
if($("hdEnabled").value == "false")
{
comboCUSTOMERNAME.disable(true);
}
comboCUSTOMERNAME.setOptionWidth(200);
comboCUSTOMERNAME.attachEvent("onChange", function()
{
comboCUSTOMERNAME.setComboText($("hd_comboCUSTOMERNAME").value);
});
comboCUSTOMERNAME.attachEvent("onBlur", function () {
var s1 = comboCUSTOMERNAME.getComboText().trim();
var s2 = s1.indexOf("|");
if (s1 == "") {
$("hd_comboCUSTOMERNAME").value = "";
comboCUSTOMERNAME.setComboText($("hd_comboCUSTOMERNAME").value);
//
$("hd_comboCUSTOMERCODE").value = "";
//
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboCUSTOMERNAME.setComboText(s3);
$("hd_comboCUSTOMERNAME").value = s3;
}
else {
comboCUSTOMERNAME.setComboText($("hd_comboCUSTOMERNAME").value);
}
//
$("hd_comboCUSTOMERCODE").value = comboCUSTOMERNAME.getSelectedValue();
//
}
//
if ($("hdHandle").value.trim() == "add" || $("hdHandle").value.trim() == "addfull") {
var loader = dhtmlxAjax.getSync("../FeeCodes/CLIENTCURRENCYIDAdapter.aspx?SALE=SALE&CUSTOMERNAME=" + escape($("hd_comboCUSTOMERNAME").value) + "&val=" + newGuid());
$("hd_comboSALE").value = loader.xmlDoc.responseText;
comboSALE.setComboText($("hd_comboSALE").value);
}
//
//
initComboCustContact();
});
comboCUSTOMERNAME.setComboText($("hd_comboCUSTOMERNAME").value);
comboCUSTOMERNAME.attachEvent("onKeyPressed", function(keyCode)
{
if(keyCode!="8")
{
var arrayArg = new Array();
setTimeout(function()
{
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboCUSTOMERNAME").value.trim();
if("" != comboCUSTOMERNAME.getComboText().trim())
{
while("undefined" != typeof comboCUSTOMERNAME.getOptionByIndex(filterCount))
{
var comboValue = comboCUSTOMERNAME.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboCUSTOMERNAME.getComboText().trim().toUpperCase();
$("hd_comboCUSTOMERNAME").value = comboCUSTOMERNAME.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0)
{
comboCUSTOMERNAME.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1)
{
$("hd_comboCUSTOMERNAME").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboCUSTOMERNAME.attachEvent("onSelectionChange", function()
{
$("hd_comboCUSTOMERNAME").value = comboCUSTOMERNAME.getComboText().trim();
});
}
function initComboCustContact()//客户联系人
{
var strCUSTOMERNAME = $("hd_comboCUSTOMERNAME").value.trim();
comboCustContact.loadXML("../FeeCodes/InfoClientContactAdapter.aspx?mask=0&pos=0&CUSTOMERNAME=" + escape(strCUSTOMERNAME));
comboCustContact.setComboText($("hd_comboCustContact").value);
//
if ($("hdEnabled").value == "false") {
comboCustContact.disable(true);
}
comboCustContact.attachEvent("onBlur", function () {
if ($("hd_comboCustContact").value.trim() != "") {
var loader = dhtmlxAjax.getSync("../FeeCodes/OPERATORCODEAdapter.aspx?CUSTOMERNAME=" + escape(strCUSTOMERNAME) + "&SHOWNAME=" + escape($("hd_comboCustContact").value) + "&val=" + newGuid());
var loadVal = loader.xmlDoc.responseText;
if (loadVal.trim() != "") {
var recvArg = new Array();
recvArg = loadVal.split("");
if (recvArg[0].toString().trim() == "86-0-0" || recvArg[0].toString().trim() == "86--" || recvArg[0].toString().trim() == "86") {
$("tbCustTEL").value = "";
}
else {
$("tbCustTEL").value = recvArg[0].toString();
}
if (recvArg[1].toString().trim() == "86-0-0" || recvArg[1].toString().trim() == "86--" || recvArg[1].toString().trim() == "86") {
$("tbCustFAX").value = "";
}
else {
$("tbCustFAX").value = recvArg[1].toString();
}
$("tbCustEMAIL").value = recvArg[2].toString();
}
}
});
//
comboCustContact.attachEvent("onChange", function () {
comboCustContact.setComboText($("hd_comboCustContact").value);
});
comboCustContact.attachEvent("onKeyPressed", function (keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function () {
var filterCount = 0;
if ("" != comboCustContact.getComboText().trim()) {
while ("undefined" != typeof comboCustContact.getOptionByIndex(filterCount)) {
var comboValue = comboCustContact.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboCustContact.getComboText().trim().toUpperCase();
$("hd_comboCustContact").value = comboCustContact.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboCustContact.selectOption(filterCount, true, true);
break;
}
++filterCount;
}
}
}, 10);
}
});
comboCustContact.attachEvent("onSelectionChange", function () {
$("hd_comboCustContact").value = comboCustContact.getComboText().trim();
});
}
function initComboTradingAgency()//贸易代理
{
comboTradingAgency = dhtmlXComboFromSelect("ddlTradingAgency");
comboTradingAgency.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISTradingAgency");
}
function initComboTradingAgency2()//贸易代理
{
if ($("hdEnabled").value == "false") {
comboTradingAgency.disable(true);
}
comboTradingAgency.setOptionWidth(200);
comboTradingAgency.attachEvent("onChange", function () {
comboTradingAgency.setComboText($("hd_comboTradingAgency").value);
});
comboTradingAgency.attachEvent("onBlur", function () {
var s1 = comboTradingAgency.getComboText().trim();
var s2 = s1.indexOf("|");
if (s1 == "") {
$("hd_comboTradingAgency").value = "";
comboTradingAgency.setComboText($("hd_comboTradingAgency").value);
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboTradingAgency.setComboText(s3);
$("hd_comboTradingAgency").value = s3;
}
else {
comboTradingAgency.setComboText($("hd_comboTradingAgency").value);
}
//
/// $("hd_comboTradingAgency").value = comboTradingAgency.getSelectedValue();
//
}
//
});
comboTradingAgency.setComboText($("hd_comboTradingAgency").value);
comboTradingAgency.attachEvent("onKeyPressed", function (keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function () {
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboTradingAgency").value.trim();
if ("" != comboTradingAgency.getComboText().trim()) {
while ("undefined" != typeof comboTradingAgency.getOptionByIndex(filterCount)) {
var comboValue = comboTradingAgency.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboTradingAgency.getComboText().trim().toUpperCase();
$("hd_comboTradingAgency").value = comboTradingAgency.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboTradingAgency.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("hd_comboTradingAgency").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
});
comboTradingAgency.attachEvent("onSelectionChange", function () {
$("hd_comboTradingAgency").value = comboTradingAgency.getComboText().trim();
});
}
var comboTRUCKER; //车队
function initComboTRUCKER()//车队
{
comboTRUCKER = dhtmlXComboFromSelect("ddlTRUCKER");
comboTRUCKER.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISTRUCK");
}
function initComboTRUCKER2()//车队
{
if ($("hdEnabled").value == "false") {
comboTRUCKER.disable(true);
}
//
comboTRUCKER.setOptionWidth(200);
comboTRUCKER.attachEvent("onChange", function () { comboTRUCKER.setComboText($("hd_comboTRUCKER").value); });
comboTRUCKER.attachEvent("onBlur", function () {
var s1 = comboTRUCKER.getComboText().trim();
var s2 = s1.indexOf("|");
if (s1 == "") {
$("hd_comboTRUCKER").value = "";
comboTRUCKER.setComboText($("hd_comboTRUCKER").value);
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboTRUCKER.setComboText(s3);
$("hd_comboTRUCKER").value = s3;
}
else {
comboTRUCKER.setComboText($("hd_comboTRUCKER").value);
}
}
});
comboTRUCKER.setComboText($("hd_comboTRUCKER").value);
comboTRUCKER.attachEvent("onKeyPressed", function (keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function () {
var is = -1;
var ishd = $("hd_comboTRUCKER").value.trim();
var filterCount = 0;
if ("" != comboTRUCKER.getComboText().trim()) {
while ("undefined" != typeof comboTRUCKER.getOptionByIndex(filterCount)) {
var comboValue = comboTRUCKER.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboTRUCKER.getComboText().trim().toUpperCase();
$("hd_comboTRUCKER").value = comboTRUCKER.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboTRUCKER.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("hd_comboTRUCKER").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
})
comboTRUCKER.attachEvent("onSelectionChange", function () {
$("hd_comboTRUCKER").value = comboTRUCKER.getComboText().trim();
});
}
var comboCARRIER; //船公司
function initComboCARRIER()//船公司
{
comboCARRIER = dhtmlXComboFromSelect("ddlCARRIER");
comboCARRIER.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISCARRIER");
}
function initComboCARRIER2()//船公司
{
if ($("hdEnabled").value == "false") {
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 initComboGOODSNAME()//货物描述类型
{
comboGOODSNAME = dhtmlXComboFromSelect("ddlGOODSNAME");
comboGOODSNAME.loadXML("../FeeCodes/TCodeGoodsAdapter.aspx?mask=0&pos=0");
}
function initComboGOODSNAME2()//货物描述类型
{
if($("hdEnabled").value == "false")
{
comboGOODSNAME.disable(true);
}
//
comboGOODSNAME.setOptionWidth(200);
comboGOODSNAME.attachEvent("onChange", function(){comboGOODSNAME.setComboText($("hd_comboGOODSNAME").value);});
comboGOODSNAME.attachEvent("onBlur", function(){
var s1 = comboGOODSNAME.getComboText().trim();
var s2 = s1.indexOf("|");
var selVal = "";
if(s1=="")
{
$("hd_comboGOODSNAME").value="";
comboGOODSNAME.setComboText($("hd_comboGOODSNAME").value);
}
else
{
if(s2>0)
{
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0)
{
comboGOODSNAME.setComboText(s3);
$("hd_comboGOODSNAME").value=s3;
}
else
{
comboGOODSNAME.setComboText($("hd_comboGOODSNAME").value);
}
}
});
comboGOODSNAME.setComboText($("hd_comboGOODSNAME").value);
comboGOODSNAME.attachEvent("onKeyPressed", function(keyCode)
{
if(keyCode!="8")
{
var arrayArg = new Array();
setTimeout(function(){
var is = -1;
var ishd = $("hd_comboGOODSNAME").value.trim();
var filterCount = 0;
if("" != comboGOODSNAME.getComboText().trim()){
while("undefined" != typeof comboGOODSNAME.getOptionByIndex(filterCount)){
var comboValue = comboGOODSNAME.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboGOODSNAME.getComboText().trim().toUpperCase();
$("hd_comboGOODSNAME").value = comboGOODSNAME.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboGOODSNAME.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1)
{
$("hd_comboGOODSNAME").value = ishd;
alert("无此内容,请重新选择!");
}
}},10);}});
comboGOODSNAME.attachEvent("onSelectionChange", function()
{
$("hd_comboGOODSNAME").value = comboGOODSNAME.getComboText().trim();
});
}
//comboGoodsTypeName
function initComboGoodsTypeName()//货物类型描述
{
comboGoodsTypeName = dhtmlXComboFromSelect("ddlGoodsType");
comboGoodsTypeName.loadXML("../FeeCodes/TCodeGoodsTypeAdapter.aspx?mask=0&pos=0");
}
function initComboGoodsTypeName2()//货物类型
{
if ($("hdEnabled").value == "false") {
comboGoodsTypeName.disable(true);
}
//
comboGoodsTypeName.setOptionWidth(200);
comboGoodsTypeName.attachEvent("onChange", function () { comboGoodsTypeName.setComboText($("hd_comboGoodsTypeName").value); });
comboGoodsTypeName.attachEvent("onBlur", function () {
var s1 = comboGoodsTypeName.getComboText().trim();
var s2 = s1.indexOf("|");
var selVal = "";
if (s1 == "") {
$("hd_comboGoodsTypeName").value = "";
comboGoodsTypeName.setComboText($("hd_comboGoodsTypeName").value);
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboGoodsTypeName.setComboText(s3);
$("hd_comboGoodsTypeName").value = s3;
}
else {
comboGoodsTypeName.setComboText($("hd_comboGoodsTypeName").value);
}
}
});
comboGoodsTypeName.setComboText($("hd_comboGoodsTypeName").value);
comboGoodsTypeName.attachEvent("onKeyPressed", function (keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function () {
var is = -1;
var ishd = $("hd_comboGoodsTypeName").value.trim();
var filterCount = 0;
if ("" != comboGoodsTypeName.getComboText().trim()) {
while ("undefined" != typeof comboGoodsTypeName.getOptionByIndex(filterCount)) {
var comboValue = comboGoodsTypeName.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboGoodsTypeName.getComboText().trim().toUpperCase();
$("hd_comboGoodsTypeName").value = comboGoodsTypeName.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboGoodsTypeName.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("hd_comboGoodsTypeName").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
});
comboGoodsTypeName.attachEvent("onSelectionChange", function () {
$("hd_comboGoodsTypeName").value = comboGoodsTypeName.getComboText().trim();
});
}
//hd_comboTradeType
function initcomboTradeType()//贸易方式
{
comboTradeType = dhtmlXComboFromSelect("ddlTradeType");
var keytype = "贸易方式";
comboTradeType.loadXML("../FeeCodes/TcodeTradeTypeAdapter.aspx?mask=0&pos=0&keytype=" + escape(keytype));
}
function initcomboTradeType2()//贸易方式
{
if ($("hdEnabled").value == "false") {
comboTradeType.disable(true);
}
comboTradeType.setOptionWidth(200);
comboTradeType.attachEvent("onChange", function () { comboTradeType.setComboText($("hd_comboTradeType").value); });
comboTradeType.attachEvent("onBlur", function () {
var s1 = comboTradeType.getComboText().trim();
if (s1 == "") {
$("hd_comboTradeType").value = "";
comboTradeType.setComboText($("hd_comboTradeType").value);
}
else
{
comboTradeType.setComboText(s1);
$("hd_comboTradeType").value = s1;
}
});
comboTradeType.setComboText($("hd_comboTradeType").value);
comboTradeType.attachEvent("onSelectionChange", function () {
$("hd_comboTradeType").value = comboTradeType.getComboText().trim();
});
}
//仓储类型
var comboWMSTYPE;
function initcomboWMSTYPE()//仓储类型
{
comboWMSTYPE = dhtmlXComboFromSelect("ddlWMSTYPE");
var keytype = "仓储类型";
comboWMSTYPE.loadXML("../FeeCodes/TcodeTradeTypeAdapter.aspx?mask=0&pos=0&keytype="+escape(keytype));
}
function initcomboWMSTYPE2()//仓储类型
{
if ($("hdEnabled").value == "false") {
comboWMSTYPE.disable(true);
}
comboWMSTYPE.setOptionWidth(200);
comboWMSTYPE.attachEvent("onChange", function () { comboWMSTYPE.setComboText($("hd_comboWMSTYPE").value); });
comboWMSTYPE.attachEvent("onBlur", function () {
var s1 = comboWMSTYPE.getComboText().trim();
if (s1 == "") {
$("hd_comboWMSTYPE").value = "";
comboWMSTYPE.setComboText($("hd_comboWMSTYPE").value);
}
else {
comboWMSTYPE.setComboText(s1);
$("hd_comboWMSTYPE").value = s1;
}
});
comboWMSTYPE.setComboText($("hd_comboWMSTYPE").value);
comboWMSTYPE.attachEvent("onSelectionChange", function () { $("hd_comboWMSTYPE").value = comboWMSTYPE.getComboText().trim(); });
}
function initComboCUSTOMSER()//报关行
{
comboCUSTOMSER = dhtmlXComboFromSelect("ddlCUSTOMSER");
comboCUSTOMSER.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISCUSTOM");
}
function initComboCUSTOMSER2()//报关行
{
if($("hdEnabled").value == "false")
{
comboCUSTOMSER.disable(true);
}
//
comboCUSTOMSER.setOptionWidth(200);
comboCUSTOMSER.attachEvent("onChange", function(){comboCUSTOMSER.setComboText($("hd_comboCUSTOMSER").value);});
comboCUSTOMSER.attachEvent("onBlur", function(){
var s1 = comboCUSTOMSER.getComboText().trim();
var s2 = s1.indexOf("|");
if(s1=="")
{
$("hd_comboCUSTOMSER").value="";
comboCUSTOMSER.setComboText($("hd_comboCUSTOMSER").value);
}
else
{
if(s2>0)
{
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0)
{
comboCUSTOMSER.setComboText(s3);
$("hd_comboCUSTOMSER").value=s3;
}
else
{
comboCUSTOMSER.setComboText($("hd_comboCUSTOMSER").value);
}
}
});
comboCUSTOMSER.setComboText($("hd_comboCUSTOMSER").value);
comboCUSTOMSER.attachEvent("onKeyPressed", function(keyCode)
{
if(keyCode!="8")
{
var arrayArg = new Array();
setTimeout(function(){
var is = -1;
var ishd = $("hd_comboCUSTOMSER").value.trim();
var filterCount = 0;
if("" != comboCUSTOMSER.getComboText().trim()){
while("undefined" != typeof comboCUSTOMSER.getOptionByIndex(filterCount)){
var comboValue = comboCUSTOMSER.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboCUSTOMSER.getComboText().trim().toUpperCase();
$("hd_comboCUSTOMSER").value = comboCUSTOMSER.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboCUSTOMSER.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1)
{
$("hd_comboCUSTOMSER").value = ishd;
alert("无此内容,请重新选择!");
}
}},10);}});
comboCUSTOMSER.attachEvent("onSelectionChange", function()
{
$("hd_comboCUSTOMSER").value = comboCUSTOMSER.getComboText().trim();
});
}
function initComboINSPECTION()//报检
{
comboINSPECTION = dhtmlXComboFromSelect("ddlINSPECTION");
comboINSPECTION.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISCUSTOM");
}
function initComboINSPECTION2()//报检`
{
if ($("hdEnabled").value == "false") {
comboINSPECTION.disable(true);
}
//
comboINSPECTION.setOptionWidth(200);
comboINSPECTION.attachEvent("onChange", function() { comboINSPECTION.setComboText($("hd_comboINSPECTION").value); });
comboINSPECTION.attachEvent("onBlur", function() {
var s1 = comboINSPECTION.getComboText().trim();
var s2 = s1.indexOf("|");
if (s1 == "") {
$("hd_comboINSPECTION").value = "";
comboINSPECTION.setComboText($("hd_comboINSPECTION").value);
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboINSPECTION.setComboText(s3);
$("hd_comboINSPECTION").value = s3;
}
else {
comboINSPECTION.setComboText($("hd_comboINSPECTION").value);
}
}
});
comboINSPECTION.setComboText($("hd_comboINSPECTION").value);
comboINSPECTION.attachEvent("onKeyPressed", function(keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function() {
var is = -1;
var ishd = $("hd_comboINSPECTION").value.trim();
var filterCount = 0;
if ("" != comboINSPECTION.getComboText().trim()) {
while ("undefined" != typeof comboINSPECTION.getOptionByIndex(filterCount)) {
var comboValue = comboINSPECTION.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboINSPECTION.getComboText().trim().toUpperCase();
$("hd_comboINSPECTION").value = comboINSPECTION.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboINSPECTION.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("hd_comboINSPECTION").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
});
comboINSPECTION.attachEvent("onSelectionChange", function() {
$("hd_comboINSPECTION").value = comboINSPECTION.getComboText().trim();
});
}
function initComboPORTDISCHARGE()//卸货港
{
comboPORTDISCHARGE = dhtmlXComboFromSelect("ddlPORTDISCHARGE");
comboPORTDISCHARGE.loadXML("../FeeCodes/TCodeLoadportAdapter.aspx?mask=0&pos=0");
}
function initComboPORTDISCHARGE2()//卸货港
{
if ($("hdEnabled").value == "false") {
comboPORTDISCHARGE.disable(true);
}
//
comboPORTDISCHARGE.setOptionWidth(200);
comboPORTDISCHARGE.attachEvent("onChange", function () {
comboPORTDISCHARGE.setComboText($("hd_comboPORTDISCHARGE").value);
});
comboPORTDISCHARGE.attachEvent("onBlur", function () {
comboPORTDISCHARGE.setComboText($("hd_comboPORTDISCHARGE").value);
});
comboPORTDISCHARGE.setComboText($("hd_comboPORTDISCHARGE").value);
comboPORTDISCHARGE.attachEvent("onKeyPressed", function (keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function () {
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboPORTDISCHARGE").value.trim();
if ("" != comboPORTDISCHARGE.getComboText().trim()) {
while ("undefined" != typeof comboPORTDISCHARGE.getOptionByIndex(filterCount)) {
var comboValue = comboPORTDISCHARGE.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboPORTDISCHARGE.getComboText().trim().toUpperCase();
$("hd_comboPORTDISCHARGE").value = comboPORTDISCHARGE.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboPORTDISCHARGE.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("hd_comboPORTDISCHARGE").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
});
comboPORTDISCHARGE.attachEvent("onSelectionChange", function () {
$("hd_comboPORTDISCHARGE").value = comboPORTDISCHARGE.getComboText().trim();
});
}
function initComboPORTLOAD()//启运港==装货港
{
comboPORTLOAD = dhtmlXComboFromSelect("ddlPORTLOAD");
}
function initComboPORTLOAD2()//启运港==装货港
{
if ($("hdEnabled").value == "false") {
comboPORTLOAD.disable(true);
}
//
comboPORTLOAD.setOptionWidth(200);
comboPORTLOAD.attachEvent("onOpen", function () {
if (comboPORTLOAD.getOptionByIndex(0) == null) {
comboPORTLOAD.loadXML("../FeeCodes/TCodeDisportAdapter.aspx?mask=0&pos=0&strSel=");
}
});
comboPORTLOAD.attachEvent("onChange", function () {
$("hd_comboPORTLOAD").value = comboPORTLOAD.getComboText().trim().toUpperCase(); //comboPORTLOAD.getSelectedText();
comboPORTLOAD.setComboText($("hd_comboPORTLOAD").value);
});
comboPORTLOAD.attachEvent("onBlur", function () {
comboPORTLOAD.setComboText($("hd_comboPORTLOAD").value);
});
comboPORTLOAD.setComboText($("hd_comboPORTLOAD").value);
//检索
//comboPORTLOAD.enableFilteringMode(true);
comboPORTLOAD.attachEvent("onKeyPressed", function (keyCode) {
var arrayArg = new Array();
setTimeout(function () {
var filterCount = 0;
if ("" != comboPORTLOAD.getComboText().trim()) {
var enterValue = comboPORTLOAD.getComboText().toUpperCase();
comboPORTLOAD.loadXML("../FeeCodes/TCodeDisportAdapter.aspx?mask=0&pos=0&strSel=" + enterValue);
}
}, 10);
});
comboPORTLOAD.attachEvent("onSelectionChange", function () {
$("hd_comboPORTLOAD").value = comboPORTLOAD.getComboText().trim();
});
}
function initComboVESSEL()//船名
{
var strUserID=$("hdUserID").value;
comboVESSEL = dhtmlXComboFromSelect("ddlVESSEL");
comboVESSEL.loadXML("../FeeCodes/TCodeVesselAdapter.aspx?mask=0&pos=0&userID="+strUserID);
//
comboVOYNO = dhtmlXComboFromSelect("ddlVOYNO");
var strVESSEL=$("hd_comboVESSEL").value;
comboVOYNO.loadXML("../FeeCodes/TCodeVoynoAdapter.aspx?mask=0&pos=0&strVESSEL="+strVESSEL);
}
function initComboVESSEL2()//船名
{
if($("hdEnabled").value == "false")
{
comboVESSEL.disable(true);
}
//
comboVESSEL.setOptionWidth(200);
comboVESSEL.setComboText($("hd_comboVESSEL").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();
$("hd_comboVESSEL").value = comboVESSEL.getComboText().toUpperCase();
if(comboValue.indexOf(enterValue) == 0)
{
comboVESSEL.selectOption(filterCount,true,true);
$("hd_comboVESSEL").value = comboVESSEL.getComboText().trim();
break;
}
++filterCount;
}
}
},10);}});
comboVESSEL.attachEvent("onBlur", function()
{
initComboVOYNO();
});
comboVESSEL.attachEvent("onChange", function()
{
comboVESSEL.setComboText($("hd_comboVESSEL").value);
});
comboVESSEL.attachEvent("onSelectionChange", function()
{
$("hd_comboVESSEL").value = comboVESSEL.getComboText().trim();
});
}
function initComboVOYNO()//航次
{
var strVESSEL;
try
{
strVESSEL=comboVESSEL.getSelectedValue().trim();//$("hd_comboVESSEL").value;
}
catch(e)
{
strVESSEL="";
}
comboVOYNO.loadXML("../FeeCodes/TCodeVoynoAdapter.aspx?mask=0&pos=0&strVESSEL="+strVESSEL);
comboVOYNO.setComboText($("hd_comboVOYNO").value);
//
if($("hdEnabled").value == "false")
{
comboVOYNO.disable(true);
}
//
comboVOYNO.attachEvent("onChange", function()
{
comboVOYNO.setComboText($("hd_comboVOYNO").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();
$("hd_comboVOYNO").value = comboVOYNO.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0)
{
comboVOYNO.selectOption(filterCount,true,true);
break;
}
++filterCount;
}
}
},10);}});
comboVOYNO.attachEvent("onSelectionChange", function()
{
$("hd_comboVOYNO").value = comboVOYNO.getComboText().trim();
});
}
function initComboBSSOURCE()//市场来源大类
{
var strUserID=$("hdUserID").value;
comboBSSOURCE = dhtmlXComboFromSelect("ddlBSSOURCE");
comboBSSOURCE.loadXML("../FeeCodes/TCodeSourceAdapter.aspx?mask=0&pos=0&userID="+strUserID);
//
comboBSSOURCEDETAIL = dhtmlXComboFromSelect("ddlBSSOURCEDETAIL");
var strBSSOURCE=$("hd_comboBSSOURCE2").value;
comboBSSOURCEDETAIL.loadXML("../FeeCodes/TCodeSourceDetailAdapter.aspx?mask=0&pos=0&strSOURCEID="+strBSSOURCE);
}
function initComboBSSOURCE2()//市场来源大类
{
if($("hdEnabled").value == "false")
{
comboBSSOURCE.disable(true);
}
//
comboBSSOURCE.readonly(true);
comboBSSOURCE.setComboText($("hd_comboBSSOURCE").value);
comboBSSOURCE.attachEvent("onBlur", function()
{
$("hd_comboBSSOURCEDETAIL").value="";
initComboBSSOURCEDETAIL();
});
comboBSSOURCE.attachEvent("onChange", function()
{
comboBSSOURCE.setComboText($("hd_comboBSSOURCE").value);
});
comboBSSOURCE.attachEvent("onSelectionChange", function()
{
$("hd_comboBSSOURCE").value = comboBSSOURCE.getComboText().trim();
$("hd_comboBSSOURCE2").value = comboBSSOURCE.getSelectedValue().trim();
});
}
function initComboBSSOURCEDETAIL()//市场来源细类
{
var strBSSOURCE;
try
{
strBSSOURCE=comboBSSOURCE.getSelectedValue().trim();//$("hd_comboBSSOURCE").value;
}
catch(e)
{
strBSSOURCE="";
}
comboBSSOURCEDETAIL.loadXML("../FeeCodes/TCodeSourceDetailAdapter.aspx?mask=0&pos=0&strSOURCEID="+strBSSOURCE);
comboBSSOURCEDETAIL.setComboText($("hd_comboBSSOURCEDETAIL").value);
//
if($("hdEnabled").value == "false")
{
comboBSSOURCEDETAIL.disable(true);
}
//
comboBSSOURCEDETAIL.attachEvent("onChange", function()
{
comboBSSOURCEDETAIL.setComboText($("hd_comboBSSOURCEDETAIL").value);
});
comboBSSOURCEDETAIL.attachEvent("onSelectionChange", function()
{
$("hd_comboBSSOURCEDETAIL").value = comboBSSOURCEDETAIL.getComboText().trim();
});
comboBSSOURCEDETAIL.readonly(true);
}
function initComboSALEDEPT()//所属业务部门
{
//生成
var strUserID=$("hdUserID").value;
comboSALEDEPT = dhtmlXComboFromSelect("ddlSALEDEPT");
comboSALEDEPT.loadXML("../FeeCodes/SALEDEPTAdapter.aspx?mask=0&pos=0&userID="+strUserID);
}
function initComboSALEDEPT2()//所属业务部门
{
if($("hdEnabled").value == "false")
{
comboSALEDEPT.disable(true);
}
//
comboSALEDEPT.attachEvent("onChange", function()
{
comboSALEDEPT.setComboText($("hd_comboSALEDEPT").value);
});
comboSALEDEPT.attachEvent("onBlur", function(){
var s1 = comboSALEDEPT.getComboText().trim();
var s2 = s1.indexOf("|");
if(s1=="")
{
$("hd_comboSALEDEPT").value="";
comboSALEDEPT.setComboText($("hd_comboSALEDEPT").value);
}
else
{
if(s2>0)
{
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0)
{
comboSALEDEPT.setComboText(s3);
$("hd_comboSALEDEPT").value=s3;
}
else
{
comboSALEDEPT.setComboText($("hd_comboSALEDEPT").value);
}
}
});
comboSALEDEPT.setComboText($("hd_comboSALEDEPT").value);
comboSALEDEPT.attachEvent("onKeyPressed", function(keyCode)
{
if(keyCode!="8")
{
var arrayArg = new Array();
setTimeout(function()
{
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboSALEDEPT").value.trim();
if("" != comboSALEDEPT.getComboText().trim())
{
while("undefined" != typeof comboSALEDEPT.getOptionByIndex(filterCount))
{
var comboValue = comboSALEDEPT.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboSALEDEPT.getComboText().trim().toUpperCase();
$("hd_comboSALEDEPT").value = comboSALEDEPT.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0)
{
comboSALEDEPT.selectSALEDEPTtion(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1)
{
$("hd_comboSALEDEPT").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboSALEDEPT.attachEvent("onSelectionChange", function()
{
$("hd_comboSALEDEPT").value = comboSALEDEPT.getComboText().trim();
});
}
function initComboBLTYPE()//装运方式
{
comboBLTYPE = dhtmlXComboFromSelect("ddlBLTYPE");
comboBLTYPE.loadXML("../FeeCodes/BLTYPEAdapter.aspx?mask=0&pos=0");
}
function initComboBLTYPE2()//装运方式
{
if ($("hdEnabled").value == "false") {
comboBLTYPE.disable(true);
}
//
if ($("hd_comboBLTYPE").value == "整箱" || $("hd_comboBLTYPE").value == "拼箱主票") {
document.getElementById('divadd').style.display = "";
//document.getElementById('divsave').style.display = "";
document.getElementById('divrefresh').style.display = "";
document.getElementById('divdel').style.display = "";
document.getElementById('divrollback').style.display = "";
document.getElementById('divctn').style.display = "";
document.getElementById('btCTN').style.display = "";
}
else {
document.getElementById('divadd').style.display = "none";
//document.getElementById('divsave').style.display = "none";
document.getElementById('divrefresh').style.display = "none";
document.getElementById('divdel').style.display = "none";
document.getElementById('divrollback').style.display = "none";
document.getElementById('divctn').style.display = "none";
document.getElementById('btCTN').style.display = "none";
}
//
comboBLTYPE.readonly(true);
comboBLTYPE.setComboText($("hd_comboBLTYPE").value);
comboBLTYPE.attachEvent("onSelectionChange", function () {
var spd = comboBLTYPE.getComboText().trim();
if (spd == "拼箱单票" || spd == "拼箱分票") {
var loader = dhtmlxAjax.getSync("../FeeCodes/BLTYPEAdapter.aspx?BSNO=" + $("hdGid").value + "&val=" + newGuid());
var sCount = loader.xmlDoc.responseText;
if (sCount != "0" && sCount != "") {
comboBLTYPE.setComboText($("hd_comboBLTYPE").value);
alert("拼箱单票、拼箱分票是不允许添加集装箱信息的,因此请先删除集装箱信息!");
return;
}
}
//
$("hd_comboBLTYPE").value = comboBLTYPE.getComboText().trim();
//
if ($("hd_comboBLTYPE").value == "整箱" || $("hd_comboBLTYPE").value == "拼箱主票") {
document.getElementById('divadd').style.display = "";
//document.getElementById('divsave').style.display = "";
document.getElementById('divrefresh').style.display = "";
document.getElementById('divdel').style.display = "";
document.getElementById('divrollback').style.display = "";
document.getElementById('divctn').style.display = "";
document.getElementById('btCTN').style.display = "";
}
else {
document.getElementById('divadd').style.display = "none";
//document.getElementById('divsave').style.display = "none";
document.getElementById('divrefresh').style.display = "none";
document.getElementById('divdel').style.display = "none";
document.getElementById('divrollback').style.display = "none";
document.getElementById('divctn').style.display = "none";
document.getElementById('btCTN').style.display = "none";
}
});
}
function printAction(){
var strBSNO = "";
strBSNO = $("hdGid").value;
var printUrl = "";
var companyID = "";
var typeName = "SEAOP";
var dbSourceID = "";
var userID = "";
var url = "../Reports/ReportService.aspx?handle=printseai&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 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 onclickCTN()
{
//http://www.qingdaoport.net/ywzx/qqct/dpcx/cargoDya.jsp?tdh=POBUTAO110901073
var loaderCTN = dhtmlxAjax.getSync("../FeeCodes/QQCTAdapter.aspx?BSNO="+$("hdGid").value+"&val="+newGuid());
var strCTN = loaderCTN.xmlDoc.responseText;
if(strCTN!="")
{
alert(strCTN);
}
else
{
refreshRecv();
window.parent.opener.location.href = window.parent.opener.location.href;
}
return;
}
//--dropdownlist 无刷新 联动-->
function load(state)
{
var drp2 = document.getElementById("ddlBSSOURCEDETAIL");
for (i = drp2.length; i >= 0; i--)
{
drp2.options.remove(i);
}
var oHttpReq = new ActiveXObject("MSXML2.XMLHTTP");
var oDoc = new ActiveXObject("MSXML2.DOMDocument");
// 这里使用escape可以解决中文的问题
oHttpReq.open("POST", "../FeeCodes/TCodeSourceDetailAdapter.aspx?state="+escape(state), false);
oHttpReq.send("");
result = oHttpReq.responseText;
oDoc.loadXML(result);
items = oDoc.selectNodes("//NewDataSet/Table");
for (var item = items.nextNode(); item; item = items.nextNode())
{
var city = item.nodeTypedValue;
var newOption = document.createElement("OPTION");
newOption.text = city;
newOption.value = city;
drp2.options.add(newOption);
}
}
//--数字键盘锁-->
function fun()
{
//"8"退格,"13"回车,"45"负号“46”英文的点“xxx<48 and xxx>57”指数值键
if ((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode != 8) && event.keyCode!=13 && event.keyCode!=45 && event.keyCode!=46)
{ alert("错误,只能填写整数!");return false;}
}
//--件数、重量、平方等计数-->
function IsNumeric(s)
{
var inum = s.replace(/[^\d]/g,'');
var bReturn = true;
if(inum=="" || inum==null || inum==NaN)
{
bReturn = false;
}
return bReturn;
}
function divdadd() {
document.getElementById('divadd').style.display = "";
//document.getElementById('divsave').style.display = "";
document.getElementById('divrefresh').style.display = "";
document.getElementById('divdel').style.display = "none";
document.getElementById('divrollback').style.display = "none";
// document.getElementById('divctn').style.display = "none";
// document.getElementById('btCTN').style.display = "none";
}
function divdisplay() {
document.getElementById('divadd').style.display = "";
//document.getElementById('divsave').style.display = "";
document.getElementById('divrefresh').style.display = "";
document.getElementById('divdel').style.display = "";
document.getElementById('divrollback').style.display = "";
// document.getElementById('divctn').style.display = "";
// document.getElementById('btCTN').style.display = "";
}
function setEnter() {
if ($("tbMBLNO").value.trim() == "") {
alert("主提单号不允许为空!");
return;
}
//
if ($("hd_comboCUSTOMERNAME").value.trim() == "") {
alert("委托单位不允许为空!");
return;
}
//
if ($("hd_comboTradeType").value.trim() == "") {
alert("贸易方式不允许为空!");
return;
}
$("hdEnter").value = "0";
msgBox();
divdisplay();
//saveRateChange();
//saveRecvChange_2();
saveRecvChange();
}
//
function onclickCUSTOMERNAME() {
if ($("hd_comboCUSTOMERNAME").value == "") {
var URLs = "../Shipping/ExchangesUnitEdit.aspx?handle=add";
ret = window.open(URLs, "添加提单", "height=768, width=1024,center:yes,help:no,toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=no");
}
else {
var loader = dhtmlxAjax.getSync("../FeeCodes/CUSTOMERNAMEGIDAdapter.aspx?handle=gid&CUSTOMERNAME=" + escape($("hd_comboCUSTOMERNAME").value) + "&val=" + newGuid());
var selectedId = loader.xmlDoc.responseText;
var URLs = "../Shipping/ExchangesUnitEdit.aspx?handle=edit&id=" + selectedId;
ret = window.open(URLs, "_blank", "height=768, width=1024,center:yes,help:no,toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=no");
}
}
//
function lbCUSTOMERNAMEonMouseOver() {
document.getElementById('lbCUSTOMERNAME').style.color = "#0000FF";
document.getElementById('lbCUSTOMERNAME').style.cursor = "hand";
document.getElementById('lbCUSTOMERNAME').style["textDecoration"] = "underline";
}
function lbCUSTOMERNAMEonMouseOut() {
document.getElementById('lbCUSTOMERNAME').style.color = "#FF0000";
document.getElementById('lbCUSTOMERNAME').style.cursor = "auto";
document.getElementById('lbCUSTOMERNAME').style["textDecoration"] = "";
}
//
function getonload0() {
initComboTradingAgency();
initComboOP();
initComboSALE();
initComboCUSTSERVICE();
initComboCUSTOMERNAME();
initComboGOODSNAME();
initComboCUSTOMSER();
initComboINSPECTION();
initComboVESSEL();
initComboPORTLOAD();
initComboPORTDISCHARGE();
initComboBSSOURCE();
initComboKINDPKGS();
initComboSALEDEPT();
initComboGoodsTypeName();
initcomboTradeType();
initComboBLTYPE();
initComboCARRIER();
initComboTRUCKER();
initcomboWMSTYPE();
getonload();
getCTNNUM();
}
function getonload() {
initComboOP2();
initComboSALE2();
initComboCUSTSERVICE2();
initComboCUSTOMERNAME2();
initComboCustContact();
initComboGOODSNAME2();
initComboCUSTOMSER2();
initComboINSPECTION2();
initComboVESSEL2();
initComboVOYNO();
initComboPORTLOAD2();
initComboPORTDISCHARGE2();
initComboBSSOURCE2();
initComboBSSOURCEDETAIL();
initComboSALEDEPT2();
initComboKINDPKGS2();
initComboTradingAgency2();
initComboGoodsTypeName2();
initcomboTradeType2();
initComboBLTYPE2();
initComboCARRIER2();
initComboTRUCKER2();
initcomboWMSTYPE2();
initGrid();
//initGrid_2();
// FuJianOnload(); lcx
}
//回车键控制
document.onkeypress = function() {
if (event.keyCode == 13) {
if (event.srcElement.tagName == 'TEXTAREA') {
return true;
}
//window.event.keyCode=9;
return false;
}
}
function imgFreshChangePic() {
var pic1 = document.getElementById("imgFresh");
var start = pic1.src.lastIndexOf("/");
var str = pic1.src.substring(start + 1);
if (str == "btnFresh.gif") {
pic1.src = "../images/icons/progress.gif";
//pic1.alt="我是B图片";
}
else if (str == "progress.gif") {
pic1.src = "../images/icons/btnFresh.gif";
//pic1.alt="我是A图片";
}
}
function ShowDetailFresh() {
var strUserID = $("hdUserID").value;
comboOP.loadXML("../FeeCodes/OPAdapter.aspx?mask=0&pos=0&rName=isOperator&userID=" + strUserID);
comboSALE.loadXML("../FeeCodes/OPAdapter.aspx?mask=0&pos=0&rName=isSaleMan&userID=" + strUserID);
comboCUSTSERVICE.loadXML("../FeeCodes/OPAdapter.aspx?mask=0&pos=0&rName=isCustomsService&userID=" + strUserID);
comboCUSTOMERNAME.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISCONTROLLER");
comboCustContact.loadXML("../FeeCodes/InfoClientContactAdapter.aspx?mask=0&pos=0&CUSTOMERNAME=" + strCUSTOMERNAME);
comboGOODSNAME.loadXML("../FeeCodes/TCodeGoodsAdapter.aspx?mask=0&pos=0");
comboCUSTOMSER.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISCUSTOM");
comboINSPECTION.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISCUSTOM");
comboPORTLOAD.loadXML("../FeeCodes/TCodeLoadportAdapter.aspx?mask=0&pos=0");
var enterValue = comboPORTDISCHARGE.getComboText().toUpperCase();
comboPORTDISCHARGE.loadXML("../FeeCodes/TCodeDisportAdapter.aspx?mask=0&pos=0&strSel=" + enterValue);
comboVESSEL.loadXML("../FeeCodes/TCodeVesselAdapter.aspx?mask=0&pos=0&userID=" + strUserID);
comboVOYNO.loadXML("../FeeCodes/TCodeVoynoAdapter.aspx?mask=0&pos=0&strVESSEL=" + $("hd_comboVESSEL").value);
comboBSSOURCE.loadXML("../FeeCodes/TCodeSourceAdapter.aspx?mask=0&pos=0&userID=" + strUserID);
comboBSSOURCEDETAIL.loadXML("../FeeCodes/TCodeSourceDetailAdapter.aspx?mask=0&pos=0&strSOURCEID=" + $("hd_comboBSSOURCE2").value); comboTradingAgency.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISTradingAgency");
comboBLTYPE.loadXML("../FeeCodes/BLTYPEAdapter.aspx?mask=0&pos=0");
}
function getBMDDATE() {
var stretd = $("tbETD").value;
if (stretd.trim() == "") {
return;
}
var strfbp = $("tbFBP").value;
if (strfbp.trim() == "" || strfbp.trim() == "0" || strfbp.trim() == "1") {
$("tbBMDDATE").value = $("tbETD").value;
return;
}
//
var myDate = new Date(Date.parse($("tbETD").value.replace("-", "/")));
myDate.setDate(myDate.getDate() + (parseInt(strfbp) - 1));
myDate.setMonth(myDate.getMonth() + 1);
var lsDate = myDate.Format("yyyy-MM-dd");
if (lsDate.indexOf("-00-") > -1) {
lsDate = (myDate.getFullYear() - 1) + "-12-" + myDate.getDate();
}
$("tbBMDDATE").value = lsDate;
}
function getMDTDATE() {
var stretd = $("tbETD").value;
if (stretd.trim() == "") {
return;
}
var myDate = new Date(Date.parse($("tbETD").value.replace("-", "/")));
myDate.setDate(myDate.getDate() + 9);
myDate.setMonth(myDate.getMonth() + 1);
var lsDate = myDate.Format("yyyy-MM-dd");
if (lsDate.indexOf("-00-")>-1)
{
lsDate = (myDate.getFullYear() - 1) + "-12-" + myDate.getDate();
}
$("tbMDTDATE").value = lsDate;
}
function getBMDDATE2() {
var stretd = $("tbBMDDATE").value;
if (stretd.trim() == "") {
getBMDDATE();
}
}
function getMDTDATE2() {
var stretd = $("tbMDTDATE").value;
if (stretd.trim() == "") {
getMDTDATE();
}
}
function getUNITOFWEIGHT() {
$("ddlUNITOFWEIGHT2").value = $("ddlUNITOFWEIGHT").value;
}
function getUNITOFWEIGHT2() {
$("ddlUNITOFWEIGHT").value = $("ddlUNITOFWEIGHT2").value;
}
function getBSTYPE() {
if ($("hdHandle").value.trim() == "edit") {
if ($("hdBSTYPE").value.trim() == "普通货" && $("ddlBSTYPE").value.trim()=="主单") {
$("hdBSTYPE").value = $("ddlBSTYPE").value;
}
if ($("hdBSTYPE").value.trim() == "主单" && $("ddlBSTYPE").value.trim() == "普通货") {
var strurl = "../SeaiInfo/SeaImportInfoGridSource.aspx?handle=getBSTYPE&BSNO=" + $("hdGid").value.trim() + "&val=" + newGuid()
var loader = dhtmlxAjax.getSync(strurl);
var isOK = loader.xmlDoc.responseText;
if (isOK == 0) {
$("hdBSTYPE").value = $("ddlBSTYPE").value;
}
else {
$("ddlBSTYPE").value = $("hdBSTYPE").value;
}
}
if ($("hdBSTYPE").value.trim() == "分单" && ($("ddlBSTYPE").value.trim() == "普通货" || $("ddlBSTYPE").value.trim()=="主单")) {
// var strurl = "../SeaiInfo/SeaImportInfoGridSource.aspx?handle=getBSTYPE&BSNO=" + $("hdGid").value.trim() + "&val=" + newGuid()
// var loader = dhtmlxAjax.getSync(strurl);
// var isOK = loader.xmlDoc.responseText;
// if (isOK == 0) {
// $("hdBSTYPE").value = $("ddlBSTYPE").value;
// }
// else {
// $("ddlBSTYPE").value = $("hdBSTYPE").value;
// }
$("ddlBSTYPE").value = $("hdBSTYPE").value;
}
if (($("hdBSTYPE").value.trim() == "普通货" || $("hdBSTYPE").value.trim() == "主单") && $("ddlBSTYPE").value.trim()=="分单") {
$("ddlBSTYPE").value = $("hdBSTYPE").value;
}
}
else if ($("hdHandle").value.trim() == "addhblno")
{
$("hdBSTYPE").value = "分单";
$("ddlBSTYPE").value = "分单";
}
else
{
$("hdBSTYPE").value = "普通货";
$("ddlBSTYPE").value = "普通货";
}
}
function initComboKINDPKGS()//包装类型
{
comboKINDPKGS = dhtmlXComboFromSelect("ddlKINDPKGS");
comboKINDPKGS.loadXML("../FeeCodes/TCodePackageAdapter.aspx?mask=0&pos=0");
comboKINDPKGS.setOptionWidth(100);
}
function initComboKINDPKGS2()//包装类型
{
if ($("hdEnabled").value == "false") {
comboKINDPKGS.disable(true);
}
comboKINDPKGS.attachEvent("onChange", function() {
comboKINDPKGS.setComboText($("hd_comboKINDPKGS").value);
});
comboKINDPKGS.attachEvent("onBlur", function() {
comboKINDPKGS.setComboText($("hd_comboKINDPKGS").value);
});
comboKINDPKGS.setComboText($("hd_comboKINDPKGS").value);
comboKINDPKGS.attachEvent("onKeyPressed", function(keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function() {
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboKINDPKGS").value.trim();
if ("" != comboKINDPKGS.getComboText().trim()) {
while ("undefined" != typeof comboKINDPKGS.getOptionByIndex(filterCount)) {
var comboValue = comboKINDPKGS.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboKINDPKGS.getComboText().trim().toUpperCase();
$("hd_comboKINDPKGS").value = comboKINDPKGS.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboKINDPKGS.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
}
}, 10);
}
});
comboKINDPKGS.attachEvent("onSelectionChange", function() {
$("hd_comboKINDPKGS").value = comboKINDPKGS.getComboText().trim().toUpperCase();
});
}
function getCTNNUM() {
var urlVal = "SeaImportInfoGridSource.aspx?read=getCTNNUM&BSNO=" + $("dvOrderNumVal").value.trim() + "&val=" + newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
$("dvCNTRTOTAL").innerText = loadVal;
}
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();
}