729 lines
26 KiB
JavaScript
729 lines
26 KiB
JavaScript
var mygrid_recv_2;
|
|
var page_count = 5;
|
|
var column_count;
|
|
var jsonWmsZXInfoObj;
|
|
var changeCount = 0;
|
|
|
|
//两端去空格函数
|
|
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
|
|
|
|
function $(id) {
|
|
return document.getElementById(id);
|
|
}
|
|
|
|
function initWinScreen2() {
|
|
var winScreenHeight = 0;
|
|
var winScreenWidth = 0;
|
|
if (window.screen.height) {
|
|
winScreenHeight = window.screen.height;
|
|
}
|
|
if (window.screen.width) {
|
|
winScreenWidth = window.screen.width;
|
|
}
|
|
if (winScreenWidth >= 1440 && winScreenWidth >= 900) {
|
|
document.getElementById("mygrid_recv_2").style.height = "580px";
|
|
}
|
|
else if (winScreenWidth >= 1366 && winScreenWidth >= 768) {
|
|
document.getElementById("mygrid_recv_2").style.height = "340px";
|
|
}
|
|
else if (winScreenWidth >= 1024 && winScreenWidth >= 768) {
|
|
document.getElementById("mygrid_recv_2").style.height = "300px";
|
|
}
|
|
}
|
|
|
|
function doInitRecvGrid2() {
|
|
|
|
mygrid_recv_2 = new dhtmlXGridObject('mygrid_recv_2');
|
|
mygrid_recv_2.setImagePath("../images/");
|
|
mygrid_recv_2.setSkin("xp");
|
|
// 0 1 2 3 4 5 6 7 8 9 10 11
|
|
//mygrid_recv_2.setHeader("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkall2()\" />,计费等级,费用类别,计费区间,单价,增值价,单位,结束计费日期,备注,创建人,创建时间,委托单号");
|
|
|
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13
|
|
mygrid_recv_2.setHeader("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkall2()\" />,计费等级,费用类别,开始计费日期,结束计费日期,计费区间,单位,单价,出库量,仓储费,备注,创建人,创建时间,关联出库明细GID");
|
|
mygrid_recv_2.setInitWidths("30,80,80,100,100,80,80,80,80,80,120,80,120,0");
|
|
mygrid_recv_2.setColAlign("center,center,center,center,center,center,center,center,center,center,center,center,center,center");
|
|
mygrid_recv_2.setColSorting("na,str,str,str,str,str,str,str,str,str,str,str,str,str");
|
|
mygrid_recv_2.setColTypes("ch,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro");
|
|
//mygrid_recv_2.setColTypes("ch,ro,co,ed,ed,ed,co,ed,ro,ed,ed,ro,ro,ro");
|
|
|
|
var ASSOCIATEDNO = ASSOCIATEDNO = commonGridObj_wmsin.getGridObj().getSelectedRowId();
|
|
if (ASSOCIATEDNO == null) {
|
|
ASSOCIATEDNO = "";
|
|
}
|
|
|
|
var urlVal = "../SeaiFee/WmsRateDetailGridSource.aspx?read=exist&showcount=1&id=" + $("h_outgid").value + "&associatedno=" + ASSOCIATEDNO + "&val=" + newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
loader = null;
|
|
|
|
if (parseInt(loadVal) == 1) {
|
|
mygrid_recv_2.loadXML("../SeaiFee/WmsRateDetailGridSource.aspx?read=init&showcount=1&id=" + $("h_outgid").value + "&associatedno=" + ASSOCIATEDNO + "&val=" + newGuid());
|
|
setTimeout(function() {
|
|
//ReShowLabel2(mygrid_recv_2);
|
|
}, 200);
|
|
}
|
|
mygrid_recv_2.init();
|
|
mygrid_recv_2.enableEditEvents(true, false, true);
|
|
mygrid_recv_2.enableMultiselect(true);
|
|
mygrid_recv_2.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;
|
|
|
|
mygrid_recv_2.attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
|
|
if (cInd == 0) {
|
|
return true;
|
|
}
|
|
return false;
|
|
});
|
|
|
|
/*
|
|
//手动编写Grid控件编辑事件,由于免费控件没有提供完整的编辑判断功能,现特此做更改
|
|
mygrid_recv_2.attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
|
|
var newCheckValue = false;
|
|
//初始化状态
|
|
if (stage == 0) {
|
|
var selectedId = mygrid_recv_2.getSelectedRowId();
|
|
var rowIndex = mygrid_recv_2.getRowIndex(selectedId);
|
|
var oldVal = mygrid_recv_2.cellByIndex(rowIndex, 0).getValue().trim();
|
|
return true;
|
|
}
|
|
if (stage == 1) {
|
|
var rowIndex = mygrid_recv_2.getRowIndex(rId);
|
|
var txtEdit;
|
|
for (i = 0; i < document.all.length; i++) {
|
|
if (document.all(i).tagName == "TEXTAREA") {
|
|
txtEdit = document.all(i);
|
|
txtEdit.focus();
|
|
txtEdit.select();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
//如果编辑结束
|
|
if (stage == 2) {
|
|
//获取当前RowID
|
|
var selectedId = mygrid_recv_2.getSelectedRowId();
|
|
//获取当前RowIndex
|
|
var rowIndex = mygrid_recv_2.getRowIndex(selectedId);
|
|
//获取当前CellIndex(ind)
|
|
var ind = mygrid_recv_2.getSelectedCellIndex();
|
|
//触发操作事件前获取单元值
|
|
var oldVal = mygrid_recv_2.cellByIndex(rowIndex, ind).getValue();
|
|
|
|
if (cInd == 5) {
|
|
var cellVal = mygrid_recv_2.cellByIndex(rowIndex, cInd).getValue();
|
|
if (cellVal.trim() != "") {
|
|
var isint = IsNum(cellVal);
|
|
if (!isint) {
|
|
mygrid_recv_2.cellByIndex(rowIndex, cInd).setLabel("");
|
|
//alert("计费区间格式有误!");
|
|
return true;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
else if (cInd == 7 || cInd == 9) {
|
|
var cellVal = mygrid_recv_2.cellByIndex(rowIndex, cInd).getValue();
|
|
if (cellVal.trim() != "") {
|
|
var isint = IsNum(cellVal);
|
|
if (!isint) {
|
|
mygrid_recv_2.cellByIndex(rowIndex, cInd).setLabel("0.00");
|
|
//alert("单价或出库量或仓储费用格式有误!");
|
|
return true;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
else if (cInd == 3 || cInd == 4) {
|
|
var cellVal = mygrid_recv_2.cellByIndex(rowIndex, cInd).getValue();
|
|
//日期完整检查
|
|
if (cellVal.trim() != "") {
|
|
var isint = CheckDate(cellVal);
|
|
if (!isint) {
|
|
mygrid_recv_2.cellByIndex(rowIndex, cInd).setLabel("");
|
|
alert("日期格式有误!");
|
|
return true;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
else {
|
|
return true;
|
|
}
|
|
}
|
|
});
|
|
|
|
//键盘操作事件
|
|
mygrid_recv_2.attachEvent("onKeyPress", function (code, cFlag, sFlag) {
|
|
// if ($("hdEnabled").value.trim() == "false") {
|
|
// return false;
|
|
// }
|
|
//
|
|
//onKeyPress begin
|
|
//获取当前RowID
|
|
var selectedId = mygrid_recv_2.getSelectedRowId();
|
|
//获取当前RowIndex
|
|
var rowIndex = mygrid_recv_2.getRowIndex(selectedId);
|
|
//获取当前CellIndex(ind)
|
|
var ind = mygrid_recv_2.getSelectedCellIndex();
|
|
|
|
//触发操作事件前获取单元值
|
|
var oldVal = mygrid_recv_2.cellByIndex(rowIndex, ind).getValue();
|
|
//获取编辑单元
|
|
var txtEdit;
|
|
|
|
for (i = 0; i < document.all.length; i++) {
|
|
if (document.all(i).tagName == "TEXTAREA") {
|
|
txtEdit = document.all(i);
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (code == 9)//Tab键
|
|
{
|
|
var colCount = mygrid_recv_2.getColumnsNum();
|
|
var rowCount = mygrid_recv_2.getRowsNum();
|
|
|
|
if (ind == 5) {
|
|
var cellVal = mygrid_recv_2.cellByIndex(rowIndex, ind).getValue();
|
|
if (cellVal.trim() != "") {
|
|
var isint = IsNum(cellVal);
|
|
if (!isint) {
|
|
mygrid_recv_2.cellByIndex(rowIndex, ind).setLabel("");
|
|
//alert("计费区间格式有误!");
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
else if (ind == 7 || ind == 9) {
|
|
var cellVal = mygrid_recv_2.cellByIndex(rowIndex, ind).getValue();
|
|
if (cellVal.trim() != "") {
|
|
var isint = IsNum(cellVal);
|
|
if (!isint) {
|
|
mygrid_recv_2.cellByIndex(rowIndex, ind).setLabel("0.00");
|
|
//alert("单价或出库量或仓储费格式有误!");
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
else if (ind == 3 || ind == 4) {
|
|
var cellVal = mygrid_recv_2.cellByIndex(rowIndex, ind).getValue();
|
|
if (cellVal.trim() != "") {
|
|
//日期完整检查
|
|
var isint = CheckDate(cellVal);
|
|
if (!isint) {
|
|
mygrid_recv_2.cellByIndex(rowIndex, ind).setLabel("");
|
|
//alert("日期格式有误!");
|
|
return true;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
if (ind < colCount) {
|
|
isExchange = false;
|
|
pressRecord = "";
|
|
pressRowIndex = -1;
|
|
pressCellIndex = -1;
|
|
|
|
var cInd = ind;
|
|
var rId = selectedId;
|
|
mygrid_recv_2.selectCell(rowIndex, ind + 1, true, true);
|
|
mygrid_recv_2.editCell();
|
|
if (ind == colCount - 1) {
|
|
if (rowIndex < rowCount) {
|
|
mygrid_recv_2.editStop(true);
|
|
mygrid_recv_2.clearSelection();
|
|
mygrid_recv_2.selectCell(rowIndex + 1, 2, true, true);
|
|
mygrid_recv_2.editCell();
|
|
}
|
|
else {
|
|
return;
|
|
}
|
|
}
|
|
else {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
else if (code >= 65 && code <= 90) {//如果是输入英文字符
|
|
if (ind == 8) {
|
|
return true;
|
|
}
|
|
}
|
|
else if (code == 8)//delete
|
|
{
|
|
return true;
|
|
}
|
|
else if (code == 40)//向下方向键
|
|
{
|
|
if (ind == 2 || ind == 6) {
|
|
return true;
|
|
}
|
|
var rowCount = mygrid_recv_2.getRowsNum();
|
|
mygrid_recv_2.clearSelection();
|
|
mygrid_recv_2.editStop();
|
|
if (rowIndex == (rowCount - 1)) {
|
|
addRecvRow2();
|
|
}
|
|
else {
|
|
mygrid_recv_2.selectCell(rowIndex + 1, 2, true, true);
|
|
mygrid_recv_2.editCell();
|
|
}
|
|
}
|
|
else if (code == 38)//向上箭头
|
|
{
|
|
if (ind == 2 || ind == 6) {
|
|
return true;
|
|
}
|
|
if (rowIndex > 0) {
|
|
mygrid_recv_2.clearSelection();
|
|
mygrid_recv_2.editStop();
|
|
mygrid_recv_2.selectCell(rowIndex - 1, 2, true, true);
|
|
mygrid_recv_2.editCell();
|
|
}
|
|
}
|
|
else {
|
|
return true;
|
|
}
|
|
});
|
|
*/
|
|
|
|
setTimeout(function() {
|
|
markStatusColor2(mygrid_recv_2);
|
|
}, 400);
|
|
}
|
|
|
|
//讲下拉列表Combo所有生成Array数组
|
|
function setComboByArray2(gridNewObj, comboObj, rowGID, colIndex) {
|
|
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 addRecvRow2() {
|
|
var ASSOCIATEDNO = commonGridObj_wmsin.getGridObj().getSelectedRowId();
|
|
if (ASSOCIATEDNO == null) {
|
|
$("recvContainer_2").value = "";
|
|
alert("请先选择要添加费率的出库明细!");
|
|
return -1;
|
|
}
|
|
//
|
|
if (mygrid_recv_2.getRowsNum() > 0) {
|
|
var newId = newGuid();
|
|
//获取插入新纪录位置
|
|
var rowCount = mygrid_recv_2.getRowsNum();
|
|
//
|
|
// 1 2 3 4 5 6 7 8 9 10 11
|
|
//计费等级,费用类别,计费区间,单价,增值价,单位,结束计费日期,备注,创建人,创建时间,委托单号
|
|
// 1 2 3 4 5 6 7 8 9 10 11 12
|
|
//计费等级,费用类别,开始计费日期,结束计费日期,计费区间,单位,单价,出库量,仓储费,备注,创建人,创建时间
|
|
//
|
|
var fylb = "收";
|
|
var dw = "吨天";
|
|
if (rowCount > 0) {
|
|
fylb = mygrid_recv_2.cellByIndex(rowCount - 1, 2).getValue();
|
|
if (fylb == 1) {
|
|
fylb = "收"; //费用类别
|
|
}
|
|
else if (fylb == 2) {
|
|
fylb = "付"; //费用类别
|
|
}
|
|
dw = mygrid_recv_2.cellByIndex(rowCount - 1, 6).getValue();
|
|
}
|
|
mygrid_recv_2.addRow(newId, [0, rowCount + 1, fylb, "", "", "", dw, "0.00", "0.00", "0.00", "", "", "", ASSOCIATEDNO], rowCount);
|
|
//
|
|
mygrid_recv_2.clearSelection();
|
|
var rId = mygrid_recv_2.getRowId(rowCount - 1);
|
|
|
|
var combo_customer;
|
|
combo_customer = mygrid_recv_2.getCustomCombo(rId, 2);
|
|
setComboByArray2(mygrid_recv_2, combo_customer, newId, 2);
|
|
|
|
combo_customer = mygrid_recv_2.getCustomCombo(rId, 6);
|
|
setComboByArray2(mygrid_recv_2, combo_customer, newId, 6);
|
|
//
|
|
mygrid_recv_2.editStop(true);
|
|
mygrid_recv_2.selectCell(mygrid_recv_2.getRowIndex(newId), 2, true, true);
|
|
mygrid_recv_2.editCell();
|
|
}
|
|
else
|
|
{
|
|
var ASSOCIATEDNO = commonGridObj_wmsin.getGridObj().getSelectedRowId();
|
|
if (ASSOCIATEDNO == null) {
|
|
$("recvContainer_2").value = "";
|
|
alert("请先选择要添加费率的出库明细!");
|
|
return -1;
|
|
}
|
|
mygrid_recv_2.loadXML("../SeaiFee/WmsRateDetailGridSource.aspx?read=add&showcount=1&id=" + $("h_outgid").value + "&associatedno=" + ASSOCIATEDNO + "&val=" + newGuid());
|
|
}
|
|
}
|
|
|
|
function deleteRecvRow2() {
|
|
mygrid_recv_2.editStop();
|
|
//
|
|
var selRowID = mygrid_recv_2.getCheckedRows(0); //所有选中的grid的id编号
|
|
var selGroup = new Array();
|
|
if (selRowID.indexOf(",") > 0) {
|
|
selGroup = selRowID.split(",");
|
|
}
|
|
else {
|
|
if (selRowID != null) {
|
|
selGroup.push(selRowID);
|
|
}
|
|
}
|
|
//查看是否有被选中的币别项
|
|
if (selGroup.length > 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();
|
|
for (var i = 0; i < selGroup.length; i++)
|
|
{
|
|
var rowIndex = mygrid_recv_2.getRowIndex(selGroup[i]);
|
|
var cusName = mygrid_recv_2.cellByIndex(rowIndex, 1).getValue();
|
|
var urlVal = "../SeaiFee/WmsRateDetailGridSource.aspx?read=delete&gid=" + selGroup[i] + "&val=" + newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
if (loadVal > 0) {
|
|
mygrid_recv_2.deleteRow(selGroup[i]);
|
|
}
|
|
else {
|
|
mygrid_recv_2.deleteSelectedRows();
|
|
}
|
|
}
|
|
dg.close();
|
|
}
|
|
}
|
|
else {
|
|
alert("未选中要操作的币别项");
|
|
}
|
|
}
|
|
|
|
function saveRecvChange2() {
|
|
var BSNO = "";
|
|
BSNO = $("h_outgid").value.trim();
|
|
// if (BSNO == "") {
|
|
// alert("请先保存入库信息!");
|
|
// return;
|
|
// }
|
|
//
|
|
var cus = "";
|
|
if ($("txt_customer").value != null) {
|
|
cus = $("txt_customer").value;
|
|
}
|
|
if (cus == "") {
|
|
alert("货主不能为空");
|
|
return -1;
|
|
}
|
|
//
|
|
mygrid_recv_2.editStop();
|
|
var jsonRateObj = null;
|
|
for (var i = 0; i < mygrid_recv_2.getRowsNum(); i++) {
|
|
var rowId = mygrid_recv_2.getRowId(i);
|
|
|
|
var FEEGRADE = mygrid_recv_2.cellByIndex(i, 1).getValue(); //计费等级
|
|
//var FEEGRADE = i+1; //计费等级
|
|
var FEETYPE = mygrid_recv_2.cellByIndex(i, 2).getValue(); //费用类别
|
|
if (FEETYPE == "收") {
|
|
FEETYPE = 1; //费用类别
|
|
}
|
|
else if (FEETYPE == "付") {
|
|
FEETYPE = 2; //费用类别
|
|
}
|
|
var STARTBILLINGDATE = mygrid_recv_2.cellByIndex(i, 3).getValue(); //开始计费日期
|
|
var ENDBILLINGDATE = mygrid_recv_2.cellByIndex(i, 4).getValue(); //结束计费日期
|
|
var FEESCALE = mygrid_recv_2.cellByIndex(i, 5).getValue(); //计费区间
|
|
var FEEUNIT = mygrid_recv_2.cellByIndex(i, 6).getValue(); //计费单位
|
|
var FEEPRICE = mygrid_recv_2.cellByIndex(i, 7).getValue(); //单价
|
|
var GOODSPFSL = mygrid_recv_2.cellByIndex(i, 8).getValue(); //出库量
|
|
var OUTFEE = mygrid_recv_2.cellByIndex(i, 9).getValue(); //仓储费
|
|
var REMARK = mygrid_recv_2.cellByIndex(i, 10).getValue(); //备注
|
|
var ASSOCIATEDNO = mygrid_recv_2.cellByIndex(i, 13).getValue(); //
|
|
//
|
|
|
|
if (FEEUNIT.trim() == "") {
|
|
$("recvContainer_2").value = "";
|
|
alert("费用类别不能为空");
|
|
return -1;
|
|
}
|
|
|
|
if (i == 0 && FEEPRICE == "") {
|
|
FEEPRICE = 0;
|
|
}
|
|
|
|
if (parseInt(FEESCALE) == 0) {
|
|
$("recvContainer_2").value = "";
|
|
alert("计费区间不能为零");
|
|
return -1;
|
|
}
|
|
|
|
if (STARTBILLINGDATE.trim() == "") {
|
|
$("recvContainer_2").value = "";
|
|
alert("开始计费日期不能为空");
|
|
return -1;
|
|
}
|
|
|
|
if (ENDBILLINGDATE.trim() == "") {
|
|
$("recvContainer_2").value = "";
|
|
alert("结束计费日期不能为空");
|
|
return -1;
|
|
}
|
|
//
|
|
if (jsonRateObj == null) {
|
|
var cacheBuffer = "";
|
|
cacheBuffer += "{";
|
|
cacheBuffer += "\"id\":\"" + rowId + "\",";
|
|
cacheBuffer += "\"cus\":\"" + cus + "\",";
|
|
cacheBuffer += "\"fgrade\":\"" + FEEGRADE + "\",";
|
|
cacheBuffer += "\"feetype\":\"" + FEETYPE + "\",";
|
|
cacheBuffer += "\"startbillingdate\":\"" + STARTBILLINGDATE + "\",";
|
|
cacheBuffer += "\"endbillingdate\":\"" + ENDBILLINGDATE + "\",";
|
|
cacheBuffer += "\"fscale\":\"" + FEESCALE + "\",";
|
|
cacheBuffer += "\"funit\":\"" + FEEUNIT + "\",";
|
|
cacheBuffer += "\"fprice\":\"" + FEEPRICE + "\",";
|
|
cacheBuffer += "\"goodspfsl\":\"" + GOODSPFSL + "\",";
|
|
cacheBuffer += "\"outfee\":\"" + OUTFEE + "\",";
|
|
cacheBuffer += "\"remark\":\"" + REMARK + "\",";
|
|
cacheBuffer += "\"associatedno\":\"" + ASSOCIATEDNO + "\"";
|
|
cacheBuffer += "}";
|
|
var result = "";
|
|
result += "{\"rates\":[";
|
|
result += cacheBuffer;
|
|
result += "]}";
|
|
jsonRateObj = eval('(' + result + ')');
|
|
} else {
|
|
var newRateRow = jsonRateObj.rates;
|
|
newRateRow = { id: rowId, cus: cus, fgrade: FEEGRADE, feetype: FEETYPE, startbillingdate: STARTBILLINGDATE, endbillingdate: ENDBILLINGDATE, fscale: FEESCALE, funit: FEEUNIT, fprice: FEEPRICE, goodspfsl: GOODSPFSL, outfee: OUTFEE, remark: REMARK, associatedno: ASSOCIATEDNO };
|
|
jsonRateObj.rates.push(newRateRow);
|
|
}
|
|
}
|
|
$("recvContainer_2").value = JSON.stringify(jsonRateObj);
|
|
return 1;
|
|
}
|
|
|
|
function saveRecvChange3() {
|
|
var fhz = saveRecvChange2();
|
|
if (fhz > -1) {
|
|
$("h_post_2").value = 4;
|
|
msgBox();
|
|
setTimeout(postEnter, 200);
|
|
}
|
|
}
|
|
|
|
//post数据
|
|
function postEnter() {
|
|
var myForm = document.getElementById("form1");
|
|
myForm.submit();
|
|
}
|
|
|
|
function initGrid2() {
|
|
doInitRecvGrid2();
|
|
}
|
|
|
|
//放弃应收币别修改 重新加载页面
|
|
function recoverRecvChange2() {
|
|
mygrid_recv_2.editStop();
|
|
var selRowID = mygrid_recv_2.getSelectedRowId();
|
|
//查看是否有被选中的项
|
|
if (selRowID != null) {
|
|
var rowIndex = mygrid_recv_2.getRowIndex(selRowID);
|
|
var status = mygrid_recv_2.cellByIndex(rowIndex, 0).getValue();
|
|
var cusName = mygrid_recv_2.cellByIndex(rowIndex, 1).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 = "../SeaiFee/WmsRateDetailGridSource.aspx?read=recovergid=" + 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_2.getRowIndex(recvArg[0]);
|
|
var colCount = mygrid_recv_2.getColumnsNum();
|
|
for (var i = 0; i < colCount; i++) {
|
|
mygrid_recv_2.cellByIndex(selRowIndex, i).setValue(recvArg[i + 1]);
|
|
}
|
|
dg.close();
|
|
//alert("恢复成功");
|
|
//refreshRecv2();//刷新
|
|
}
|
|
else {
|
|
if (parseInt(loadVal) == -3) {
|
|
mygrid_recv_2.deleteSelectedRows();
|
|
}
|
|
dg.close();
|
|
}
|
|
//ReShowLabel2(mygrid_recv_2);
|
|
} else {
|
|
return;
|
|
}
|
|
} else {
|
|
alert("未选中要操作的币别项");
|
|
|
|
}
|
|
}
|
|
|
|
//下拉框内容显示value的值
|
|
function ReShowLabel2(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 == 3) {
|
|
// var cellCurVal = gridObj.cellByIndex(i, j).getValue();
|
|
// gridObj.cellByIndex(i, j).setLabel(cellCurVal);
|
|
// }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function markStatusColor2(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 refreshRecv2() {
|
|
doInitRecvGrid2();
|
|
}
|
|
|
|
//全选框
|
|
function checkall2() {
|
|
var checkStatus = $("ck_all").checked;
|
|
if (checkStatus == 1) {
|
|
var iCount = mygrid_recv_2.getRowsNum();
|
|
for (var i = 0; i < iCount; i++) {
|
|
mygrid_recv_2.cellByIndex(i, 0).setValue(1);
|
|
}
|
|
}
|
|
else {
|
|
var iCount = mygrid_recv_2.getRowsNum();
|
|
for (var i = 0; i < iCount; i++) {
|
|
mygrid_recv_2.cellByIndex(i, 0).setValue(0);
|
|
}
|
|
}
|
|
}
|
|
|
|
//获取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 clearNoNum2(valObj) {
|
|
//先把非数字的都替换掉,除了数字和.
|
|
valObj = valObj.replace(/[^\d.]/g, "");
|
|
//必须保证第一个为数字而不是.
|
|
valObj = valObj.replace(/^\./g, "");
|
|
//保证只有出现一个.而没有多个.
|
|
valObj = valObj.replace(/\.{2,}/g, ".");
|
|
//保证.只出现一次,而不能出现两次以上
|
|
valObj = valObj.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
|
|
return valObj;
|
|
}
|
|
|
|
//是否为数字
|
|
function IsNum(val) {
|
|
var re = /^[-\+]?\d+(\.\d+)?$/;
|
|
if (!re.test(val)) {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
//是否为数字,且数值格式是否正确
|
|
function IsNumFormat(val) {
|
|
var re = /^[-\+]?\d+(\.\d+)?$/;
|
|
if (!re.test(val)) {
|
|
return false;
|
|
}
|
|
else {
|
|
if (val.toString().indexOf(".") > 0) {
|
|
val.toString().replace("-", "");
|
|
val.toString().replace("+", "");
|
|
if (val.toString().substr(0, 1) == "0" && val.toString().substr(0, 2) != "0.") {
|
|
return false;
|
|
}
|
|
}
|
|
else {
|
|
var re1 = /^[-\+]+[1-9]+[0-9]*]*$/;
|
|
if (!re1.test(val)) {
|
|
re1 = /^[1-9]+[0-9]*]*$/;
|
|
if (!re1.test(val)) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
//是否为整数
|
|
function IsIntFormat(val) {
|
|
re1 = /^[1-9]+[0-9]*]*$/;
|
|
if (!re1.test(val)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
//
|
|
function getIsNum(x) {
|
|
var str = x.value.trim();
|
|
if (str == "0") {
|
|
return;
|
|
}
|
|
else if (str == "") {
|
|
str = 0;
|
|
x.value = 0;
|
|
}
|
|
else {
|
|
var bl = IsNumFormat(str);
|
|
if (!bl) {
|
|
alert("数值格式错误!");
|
|
x.focus();
|
|
x.select();
|
|
}
|
|
}
|
|
}
|