1282 lines
49 KiB
JavaScript
1282 lines
49 KiB
JavaScript
var mygrid_log;
|
|
var pager;
|
|
var jsonPage;
|
|
var jsonPageObj;
|
|
var pageTotal;
|
|
var pageShowCount = 15;
|
|
var curPage = 1;
|
|
|
|
function $(id) {
|
|
return document.getElementById(id);
|
|
}
|
|
|
|
function initWinScreen() {
|
|
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_container_log").style.height = "400px";
|
|
}
|
|
else if (winScreenWidth >= 1366 && winScreenWidth >= 768) {
|
|
document.getElementById("mygrid_container_log").style.height = "310px";
|
|
}
|
|
else if (winScreenWidth >= 1024 && winScreenWidth >= 768) {
|
|
document.getElementById("mygrid_container_log").style.height = "270px";
|
|
}
|
|
}
|
|
|
|
function initLog() {
|
|
//getUserSetting
|
|
getUserGridSetting();
|
|
mygrid_log = new dhtmlXGridObject('mygrid_container_log');
|
|
mygrid_log.setImagePath("../images/");
|
|
mygrid_log.setSkin("xp");
|
|
//
|
|
var arrayHeader = new Array();
|
|
var arrayColWidth = new Array();
|
|
if (jsonPageObj != null) {
|
|
|
|
for (var i = 0; i < jsonPageObj.columns.length; i++) {
|
|
arrayHeader.push(jsonPageObj.columns[i].description.trim());
|
|
arrayColWidth.push(jsonPageObj.columns[i].width);
|
|
|
|
}
|
|
var strHeader = arrayHeader.toString();
|
|
var strWidth = arrayColWidth.toString();
|
|
pageShowCount = jsonPageObj.show;
|
|
mygrid_log.setHeader(strHeader);
|
|
mygrid_log.setInitWidths(strWidth);
|
|
}
|
|
else {
|
|
$("hdNAMES").value = "提单号\t备案清单号\t货主\t仓库名称\t品名\t规格\t【型号/牌号】\t入库单号\t出库单号\t出库明细单号\t入库日期\t出库日期\t入库量\t实际入库量\t出库量\t库存量\t计费单位\t应收仓储费\t应付仓储费\t入库应收装卸费\t入库应付装卸费\t出库应收装卸费\t出库应付装卸费\t免仓储期\t合同号\t件数\t车号\t出库备注\t入库操作人\t入库操作时间\t出库操作人\t出库操作时间";
|
|
mygrid_log.setHeader("<input type='checkbox' id='ck_all' onclick=checkAll('ck_all') />,提单号,备案清单号,货主,仓库名称,品名,型号/牌号,规格,入库单号,出库单号,出库明细单号,入库日期,出库日期,入库量,实际入库量,出库量,库存量,计费单位,应收仓储费,应付仓储费,入库应收装卸费,入库应付装卸费,出库应收装卸费,出库应付装卸费,免仓储期,合同号,件数,车号,出库备注,入库操作人,入库操作时间,出库操作人,出库操作时间");
|
|
mygrid_log.setInitWidths("40,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120");
|
|
}
|
|
mygrid_log.setColAlign("center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center");
|
|
mygrid_log.setColSorting("str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str");
|
|
mygrid_log.setColTypes("ch,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro");
|
|
mygrid_log.init();
|
|
|
|
mygrid_log.load("VwWmsDetailListGridSource.aspx?handle=list&show_page=" + pageShowCount + "&cur_page=1&hid_sel=" + escape($("hid_sel").value), "json");
|
|
//
|
|
setTimeout(function () {
|
|
initPage();
|
|
|
|
}, 300);
|
|
mygrid_log.attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
|
|
if (stage == 0) {
|
|
return false;
|
|
}
|
|
});
|
|
}
|
|
|
|
function getUserGridSetting() {
|
|
var urlVal = "VwWmsDetailListGridSource.aspx?handle=setting&val=" + newGuid() + "&hid_sel=" + escape($("hid_sel").value) + "&val=" + newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
jsonPage = loadVal;
|
|
if (IsNum(jsonPage)) {
|
|
jsonPageObj = null;
|
|
} else {
|
|
jsonPageObj = eval('(' + loadVal + ')');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function PagerView(id) {
|
|
var self = this;
|
|
this.id = id;
|
|
this.container = null;
|
|
this.index = 1; // 当前页码, 从1开始
|
|
this.size = pageShowCount; // 每页显示记录数
|
|
this.maxButtons = 9; // 显示的分页按钮数量
|
|
this.itemCount = 0; // 记录总数
|
|
this.pageCount = 0; // 总页数
|
|
/**
|
|
* 控件使用者重写本方法, 获取翻页事件, 可用来向服务器端发起AJAX请求.
|
|
* @param index: 被点击的页码.
|
|
*/
|
|
this.onclick = function (index) {
|
|
};
|
|
/**
|
|
* 内部方法.
|
|
*/
|
|
this._onclick = function (index) {
|
|
self.index = index;
|
|
self.onclick(index);
|
|
self.render();
|
|
};
|
|
/**
|
|
* 在显示之前计算各种页码变量的值.
|
|
*/
|
|
this.calculate = function () {
|
|
self.pageCount = parseInt(Math.ceil(self.itemCount / self.size));
|
|
self.index = parseInt(self.index);
|
|
if (self.index > self.pageCount) {
|
|
self.index = self.pageCount;
|
|
}
|
|
};
|
|
/**
|
|
* 渲染分页控件.
|
|
*/
|
|
this.render = function () {
|
|
if (self.id != undefined) {
|
|
var div = document.getElementById(self.id);
|
|
div.view = self;
|
|
self.container = div;
|
|
}
|
|
self.calculate();
|
|
var start, end;
|
|
start = Math.max(1, self.index - parseInt(self.maxButtons / 2));
|
|
end = Math.min(self.pageCount, start + self.maxButtons - 1);
|
|
start = Math.max(1, end - self.maxButtons + 1);
|
|
var str = "";
|
|
str += "<div class=\"PagerView\">\n";
|
|
if (self.pageCount > 1) {
|
|
if (self.index != 1) {
|
|
str += '<a href="javascript://1"><span>|<</span></a>';
|
|
str += '<a href="javascript://' + (self.index - 1) + '"><span><<</span></a>';
|
|
} else {
|
|
str += '<span>|<</span>';
|
|
str += '<span><<</span>';
|
|
}
|
|
}
|
|
for (var i = start; i <= end; i++) {
|
|
if (i == this.index) {
|
|
str += '<span class="on">' + i + "</span>";
|
|
} else {
|
|
str += '<a href="javascript://' + i + '"><span>' + i + "</span></a>";
|
|
}
|
|
}
|
|
if (self.pageCount > 1) {
|
|
if (self.index != self.pageCount) {
|
|
str += '<a href="javascript://' + (self.index + 1) + '"><span>>></span></a>';
|
|
str += '<a href="javascript://' + self.pageCount + '"><span>>|</span></a>';
|
|
} else {
|
|
str += '<span>>></span>';
|
|
str += '<span>>|</span>';
|
|
}
|
|
}
|
|
str += ' 一共' + self.pageCount + '页, ' + self.itemCount + '条记录 ' + ' 每页显示: ' + "<select id=\"cusShowCount\" style=\"width:70px;\" onchange=\"changeShowCount('cusShowCount')\">" + getPageOption() + "</select>";
|
|
str += "</div><!-- /.pagerView -->\n";
|
|
self.container.innerHTML = str;
|
|
var a_list = self.container.getElementsByTagName('a');
|
|
for (var i = 0; i < a_list.length; i++) {
|
|
a_list[i].onclick = function () {
|
|
var index = this.getAttribute('href');
|
|
if (index != undefined && index != '') {
|
|
index = parseInt(index.replace('javascript://', ''));
|
|
self._onclick(index)
|
|
}
|
|
return false;
|
|
};
|
|
|
|
}
|
|
};
|
|
}
|
|
//初始化页面
|
|
function initPage() {
|
|
pager = new PagerView('pager');
|
|
|
|
var urlVal = "VwWmsDetailListGridSource.aspx?handle=page&val=" + newGuid() + "&hid_sel=" + escape($("hid_sel").value) + "&val=" + newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
pageTotal = loadVal;
|
|
pager.itemCount = pageTotal;
|
|
pager.size = pageShowCount;
|
|
pager.index = 1;
|
|
pager.onclick = function (index) {
|
|
document.getElementById('info').innerHTML = '现在翻到第' + index + '页';
|
|
getUserGridSetting();
|
|
mygrid_log = new dhtmlXGridObject('mygrid_container_log');
|
|
mygrid_log.setImagePath("../images/");
|
|
mygrid_log.setSkin("xp");
|
|
var arrayHeader = new Array();
|
|
var arrayColWidth = new Array();
|
|
if (jsonPageObj != null) {
|
|
|
|
for (var i = 0; i < jsonPageObj.columns.length; i++) {
|
|
arrayHeader.push(jsonPageObj.columns[i].description.trim());
|
|
arrayColWidth.push(jsonPageObj.columns[i].width);
|
|
|
|
}
|
|
|
|
var strHeader = arrayHeader.toString();
|
|
var strWidth = arrayColWidth.toString();
|
|
pageShowCount = jsonPageObj.show;
|
|
mygrid_log.setHeader(strHeader);
|
|
mygrid_log.setInitWidths(strWidth);
|
|
|
|
|
|
}
|
|
else {
|
|
$("hdNAMES").value = "提单号\t备案清单号\t货主\t仓库名称\t品名\t规格\t【型号/牌号】\t入库单号\t出库单号\t出库明细单号\t入库日期\t出库日期\t入库量\t出库量\t库存量\t计费单位\t应收仓储费\t应付仓储费\t入库应收装卸费\t入库应付装卸费\t出库应收装卸费\t出库应付装卸费\t免仓储期\t合同号\t件数\t车号\t出库备注\t入库操作人\t入库操作时间\t出库操作人\t出库操作时间";
|
|
mygrid_log.setHeader("<input type='checkbox' id='ck_all' onclick=checkAll('ck_all') />,提单号,备案清单号,货主,仓库名称,品名,型号/牌号,规格,入库单号,出库单号,出库明细单号,入库日期,出库日期,入库量,实际入库量,出库量,库存量,计费单位,应收仓储费,应付仓储费,入库应收装卸费,入库应付装卸费,出库应收装卸费,出库应付装卸费,免仓储期,合同号,件数,车号,出库备注,入库操作人,入库操作时间,出库操作人,出库操作时间");
|
|
mygrid_log.setInitWidths("40,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120");
|
|
}
|
|
mygrid_log.setColAlign("center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center");
|
|
mygrid_log.setColSorting("str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str");
|
|
mygrid_log.setColTypes("ch,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro");
|
|
mygrid_log.init();
|
|
|
|
setTimeout(function () {
|
|
mygrid_log.load("VwWmsDetailListGridSource.aspx?handle=list&show_page=" + pager.size.toString() + "&cur_page=" + index + "&hid_sel=" + escape($("hid_sel").value) + "&val=" + newGuid(), "json");
|
|
}, 300);
|
|
mygrid_log.attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
|
|
if (stage == 0) {
|
|
return false;
|
|
}
|
|
});
|
|
|
|
initMenu();
|
|
|
|
|
|
};
|
|
pager.render();
|
|
}
|
|
|
|
//获取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 change() {
|
|
var colCount = mygrid_log.getColumnsNum();
|
|
var jsonFeeObj = "";
|
|
|
|
jsonFeeObj = "{\"$type\":\"DSWeb.Models.JsonColumnGroupEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",\"ShowCount\":" + pageShowCount + ",\"JsonColumnEntities\":[";
|
|
|
|
var tempGroupJson = "";
|
|
for (var i = 0; i < colCount; i++) {
|
|
var tempJson = "";
|
|
var rId = mygrid_log.getRowId(i);
|
|
|
|
tempJson += "\"$type\":\"DSWeb.Models.JsonColumnEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",";
|
|
tempJson += "\"col1\":\"\","; //gid
|
|
tempJson += "\"col2\":\"" + i.toString() + "\","; //column name
|
|
tempJson += "\"col3\":\"" + mygrid_log.getColumnLabel(i) + "\","; //column description
|
|
tempJson += "\"col4\":\"" + i.toString() + "\","; //index
|
|
tempJson += "\"col5\":\"" + mygrid_log.getColWidth(i) + "\","; //width
|
|
tempJson += "\"col6\":-1";
|
|
|
|
tempJson = "{" + tempJson + "}";
|
|
if (i == colCount - 1) {
|
|
tempGroupJson += tempJson;
|
|
} else {
|
|
tempGroupJson += tempJson + ",";
|
|
}
|
|
}
|
|
|
|
|
|
jsonFeeObj += tempGroupJson;
|
|
jsonFeeObj += "]}";
|
|
|
|
$("hid_setting").value = jsonFeeObj;
|
|
jsonFeeObj = null;
|
|
//alert(jsonFeeObj);
|
|
var myForm = document.getElementById("form1");
|
|
myForm.submit();
|
|
}
|
|
function el(id) {
|
|
return document.getElementById(id);
|
|
}
|
|
|
|
function initMenu() {
|
|
el("mygrid_container_log").oncontextmenu = function (ev) {
|
|
showMenu(ev);
|
|
return false;
|
|
};
|
|
document.onmousedown = function () { if (!over) hideMenu(); };
|
|
};
|
|
var over = false;
|
|
var menu = null;
|
|
function showMenu(ev) {
|
|
menu = null;
|
|
ev = ev || window.event;
|
|
|
|
hideMenu();
|
|
|
|
var e = ev.srcElement || ev.target;
|
|
|
|
if (e.tagName == "TH") return;
|
|
|
|
var x = ev.pageX || ev.clientX + document.documentElement.scrollLeft;
|
|
var y = ev.pageY || ev.clientY + document.documentElement.scrollTop;
|
|
|
|
menu = document.createElement("DIV");
|
|
menu.className = "menu";
|
|
menu.style.left = x + 4 + "px";
|
|
menu.style.top = y + "px";
|
|
document.body.appendChild(menu);
|
|
|
|
//alert(e.parentNode.getElementsByTagName("DIV")[1].innerHTML);
|
|
var dvGroup = e.parentNode.getElementsByTagName("DIV");
|
|
var dvGroupCount = dvGroup.length;
|
|
|
|
var id = "";
|
|
if (dvGroupCount == 1) {
|
|
id = dvGroup[0].innerHTML;
|
|
}
|
|
|
|
if (id.trim().length < 1) {
|
|
hideMenu();
|
|
return;
|
|
}
|
|
// = e.parentNode.getElementsByTagName("td")[1].innerHTML;
|
|
|
|
// e.parentNode.id = "tr_"+id;
|
|
|
|
var sname = document.location.pathname.substring(7, location.pathname.length).toString();
|
|
|
|
// var s = "<a href=\"javascript:showInfo({id},'{sname}');\">编辑标题</a>";
|
|
// s += "<a href=\"javascript:refresh('{sname}');\">重新排序</a>";
|
|
// //s += "<a href='javascript:editInfo({id});'>修改用户信息</a>";
|
|
// //s += "<a href='javascript:deleteInfo({id});'>删除该条记录</a>";
|
|
// s = s.replace(/{id}/g, id);
|
|
// s = s.replace(/{sname}/g, sname);
|
|
|
|
// var s = "<input type=\"text\" id=\"txt_label\" style=\"width:90px;\" value=\""+id+"\" /><a style=\"width:30px;\" href=\"javascript:void(0);\" onclick=\"saveLabel('txt_label','"+id+"')\" >保存</a>";
|
|
// var s = "<div style=\"float:left;width:100%;padding-left:120px;\"><div class=\"enterButton\" onclick=\"saveColumnHeader()\">保存</div><div class=\"enterButton\" onclick=\"cancelColumnHeader()\">取消</div></div>";
|
|
var s = "<div class=\"dvMenu\" >修改标题</div><div class=\"dvMenu\" onclick=\"editColumnSetting('dvColumnSet')\">编辑显示</div>";
|
|
menu.innerHTML = s;
|
|
menu.onmouseover = function () { over = true; };
|
|
menu.onmouseout = function () { over = false; };
|
|
}
|
|
|
|
function hideMenu() {
|
|
if (menu) {
|
|
document.body.removeChild(menu);
|
|
menu = null;
|
|
}
|
|
}
|
|
function refresh(sname) {
|
|
var req = getReq();
|
|
req.open("GET", sname + "?refresh=1&id=", true);
|
|
/*req.onreadystatechange = function(){
|
|
if(req.readyState==4)
|
|
{
|
|
el("bod").innerHTML = req.responseText;
|
|
}
|
|
};*/
|
|
req.send(null);
|
|
}
|
|
|
|
function showInfo(id, sname) {
|
|
hideMenu();
|
|
shideBody();
|
|
|
|
el("tit").innerHTML = "查看用户的详细信息";
|
|
el("bod").innerHTML = "<img src='wait.gif' alt='loading...' />";
|
|
el("bot").innerHTML = "<input type='button' value='关闭' onclick='cancelShide()' />";
|
|
|
|
var req = getReq();
|
|
req.open("GET", sname + "?getinfo=1&id=" + id, true);
|
|
req.onreadystatechange = function () {
|
|
if (req.readyState == 4) {
|
|
el("bod").innerHTML = req.responseText;
|
|
}
|
|
};
|
|
req.send(null);
|
|
}
|
|
var shield;
|
|
function shideBody() {
|
|
shield = document.createElement("DIV");
|
|
shield.id = "shield";
|
|
shield.style.position = "absolute";
|
|
shield.style.left = "0px";
|
|
shield.style.top = "0px";
|
|
shield.style.width = "100%";
|
|
shield.style.height = document.documentElement.scrollHeight + "px";
|
|
shield.style.background = "#333333";
|
|
shield.style.textAlign = "center";
|
|
shield.style.zIndex = "10";
|
|
shield.style.filter = "alpha(opacity=0)";
|
|
shield.style.opacity = 0;
|
|
document.body.appendChild(shield);
|
|
|
|
this.setOpacity = function (obj, opacity) {
|
|
if (opacity >= 1) opacity = opacity / 100;
|
|
try { obj.style.opacity = opacity; } catch (e) { }
|
|
try {
|
|
if (obj.filters.length > 0 && obj.filters("alpha")) {
|
|
obj.filters("alpha").opacity = opacity * 150;
|
|
} else {
|
|
obj.style.filter = "alpha(opacity=\"" + (opacity * 150) + "\")";
|
|
}
|
|
} catch (e) { }
|
|
}
|
|
var c = 0;
|
|
this.doAlpha = function () {
|
|
if (++c > 20) { clearInterval(ad); return 0; }
|
|
setOpacity(shield, c);
|
|
}
|
|
var ad = setInterval("doAlpha()", 1);
|
|
|
|
el("divh").style.display = "";
|
|
el("divh").style.marginTop = -75 + document.documentElement.scrollTop + "px";
|
|
}
|
|
function cancelShide() {
|
|
if (el("divh")) {
|
|
el("divh").style.display = "none";
|
|
}
|
|
if (shield) {
|
|
document.body.removeChild(shield);
|
|
shield = null;
|
|
}
|
|
}
|
|
|
|
function getReq() {
|
|
var oHttpReq = null;
|
|
|
|
if (window.ActiveXObject)
|
|
oHttpReq = new ActiveXObject("MSXML2.XMLHTTP");
|
|
else if (window.createRequest)
|
|
oHttpReq = window.createRequest();
|
|
else
|
|
oHttpReq = new XMLHttpRequest();
|
|
|
|
return oHttpReq;
|
|
}
|
|
|
|
function removeRow(e) {
|
|
e.style.backgroundColor = "#ff0000";
|
|
setTimeout(function () { e.style.backgroundColor = "#ffcccc"; }, 100);
|
|
setTimeout(function () { e.style.backgroundColor = "MistyRose"; }, 300);
|
|
setTimeout(function () { e.style.display = "none"; }, 450);
|
|
}
|
|
|
|
//是否为数字
|
|
function IsNum(val) {
|
|
var re = /^[-\+]?\d+(\.\d+)?$/;
|
|
if (!re.test(val)) {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
function getPageOption() {
|
|
var pageCountArg = new Array();
|
|
pageCountArg.push(15);
|
|
pageCountArg.push(30);
|
|
pageCountArg.push(50);
|
|
pageCountArg.push(100);
|
|
pageCountArg.push(200);
|
|
|
|
var optionStr = "";
|
|
for (var i = 0; i < pageCountArg.length; i++) {
|
|
if (pageShowCount == parseInt(pageCountArg[i])) {
|
|
optionStr += "<option value=\"" + pageCountArg[i] + "\" selected=\"1\">" + pageCountArg[i] + "</option>";
|
|
} else {
|
|
optionStr += "<option value=\"" + pageCountArg[i] + "\">" + pageCountArg[i] + "</option>";
|
|
}
|
|
}
|
|
|
|
return optionStr;
|
|
;
|
|
}
|
|
|
|
function changeShowCount(id) {
|
|
var selectObj = $(id);
|
|
|
|
var selVal = selectObj.options[selectObj.selectedIndex].value;
|
|
pageShowCount = selVal;
|
|
|
|
openNewDiv();
|
|
|
|
}
|
|
var docEle = function () {
|
|
return document.getElementById(arguments[0]) || false;
|
|
}
|
|
function openNewDiv(_id) {
|
|
var m = "mask";
|
|
if (docEle(_id)) document.removeChild(docEle(_id));
|
|
if (docEle(m)) document.removeChild(docEle(m));
|
|
// 新激活图层
|
|
var newDiv = document.createElement("div");
|
|
newDiv.id = _id;
|
|
newDiv.style.position = "absolute";
|
|
newDiv.style.zIndex = "9999";
|
|
newDiv.style.width = "200px";
|
|
newDiv.style.height = "100px";
|
|
newDiv.style.top = "100px";
|
|
newDiv.style.left = (parseInt(document.body.scrollWidth) - 300) / 2 + "px"; // 屏幕居中
|
|
newDiv.style.background = "#EFEFEF";
|
|
newDiv.style.border = "1px solid #860001";
|
|
newDiv.style.padding = "5px";
|
|
newDiv.innerHTML = "<br/> 您已更改了视图设置 是否保存<br/><br/><br/> ";
|
|
document.body.appendChild(newDiv);
|
|
// mask图层
|
|
var newMask = document.createElement("div");
|
|
newMask.id = m;
|
|
newMask.style.position = "absolute";
|
|
newMask.style.zIndex = "1";
|
|
newMask.style.width = document.body.scrollWidth + "px";
|
|
newMask.style.height = document.body.scrollHeight + "px";
|
|
newMask.style.top = "0px";
|
|
newMask.style.left = "0px";
|
|
newMask.style.background = "#000";
|
|
newMask.style.filter = "alpha(opacity=40)";
|
|
newMask.style.opacity = "0.40";
|
|
document.body.appendChild(newMask);
|
|
// 关闭mask和新图层
|
|
var saveButton = document.createElement("a");
|
|
saveButton.href = "#";
|
|
saveButton.innerHTML = "确定";
|
|
saveButton.className = "regular";
|
|
saveButton.onclick = function () {
|
|
change();
|
|
//document.body.removeChild(docEle(_id));
|
|
//document.body.removeChild(docEle(m));
|
|
//return false;
|
|
}
|
|
newDiv.appendChild(saveButton);
|
|
|
|
//newDiv.innerHTML += " ";
|
|
|
|
var cancelButton = document.createElement("a");
|
|
cancelButton.href = "#";
|
|
cancelButton.innerHTML = "取消";
|
|
cancelButton.className = "regular";
|
|
cancelButton.onclick = function () {
|
|
document.body.removeChild(docEle(_id));
|
|
document.body.removeChild(docEle(m));
|
|
unSaveGrid();
|
|
return false;
|
|
}
|
|
newDiv.appendChild(cancelButton);
|
|
}
|
|
|
|
function unSaveGrid() {
|
|
mygrid_log = new dhtmlXGridObject('mygrid_container_log');
|
|
mygrid_log.setImagePath("../images/");
|
|
mygrid_log.setSkin("xp");
|
|
$("hdNAMES").value = "提单号\t备案清单号\t货主\t仓库名称\t品名\t规格\t【型号/牌号】\t入库单号\t出库单号\t出库明细单号\t入库日期\t出库日期\t入库量\t出库量\t库存量\t计费单位\t应收仓储费\t应付仓储费\t入库应收装卸费\t入库应付装卸费\t出库应收装卸费\t出库应付装卸费\t免仓储期\t合同号\t件数\t车号\t出库备注\t入库操作人\t入库操作时间\t出库操作人\t出库操作时间";
|
|
mygrid_log.setHeader("<input type='checkbox' id='ck_all' onclick=checkAll('ck_all') />,提单号,备案清单号,货主,仓库名称,品名,型号/牌号,规格,入库单号,出库单号,出库明细单号,入库日期,出库日期,入库量,实际入库量,出库量,库存量,计费单位,应收仓储费,应付仓储费,入库应收装卸费,入库应付装卸费,出库应收装卸费,出库应付装卸费,免仓储期,合同号,件数,车号,出库备注,入库操作人,入库操作时间,出库操作人,出库操作时间");
|
|
mygrid_log.setInitWidths("40,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120");
|
|
mygrid_log.setColAlign("center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center");
|
|
mygrid_log.setColSorting("str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str");
|
|
mygrid_log.setColTypes("ch,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro");
|
|
mygrid_log.init();
|
|
// mygrid_log.enableDragAndDrop(true);
|
|
// mygrid_log.enableDragOrder(true);
|
|
// mygrid_log.enableColumnMove(true);
|
|
|
|
setTimeout(function () {
|
|
mygrid_log.load("VwWmsDetailListGridSource.aspx?handle=list&show_page=" + pageShowCount + "&cur_page=1&hid_sel=" + escape($("hid_sel").value) + "&val=" + newGuid(), "json");
|
|
}, 300);
|
|
mygrid_log.attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
|
|
if (stage == 0) {
|
|
return false;
|
|
}
|
|
});
|
|
|
|
initPage();
|
|
initMenu();
|
|
|
|
}
|
|
|
|
function editColumnSetting(_id) {
|
|
hideMenu();
|
|
var m = "mask";
|
|
if (docEle(_id)) document.removeChild(docEle(_id));
|
|
if (docEle(m)) document.removeChild(docEle(m));
|
|
// 新激活图层
|
|
var newDiv = document.createElement("div");
|
|
newDiv.id = _id;
|
|
newDiv.style.position = "absolute";
|
|
newDiv.style.zIndex = "9999";
|
|
newDiv.style.width = "700px";
|
|
newDiv.style.height = "340px";
|
|
newDiv.style.top = "100px";
|
|
newDiv.style.left = (parseInt(document.body.scrollWidth) - 560) / 2 + "px"; // 屏幕居中
|
|
newDiv.style.background = "#EFEFEF";
|
|
newDiv.style.border = "1px solid #860001";
|
|
newDiv.style.padding = "5px";
|
|
getUserGridSetting();
|
|
var TargeVal = "";
|
|
if (jsonPageObj != null) {
|
|
for (var i = 0; i < jsonPageObj.columns.length; i++) {
|
|
TargeVal += "<option value=\"" + jsonPageObj.columns[i].name + "\">" + jsonPageObj.columns[i].description + "</option>";
|
|
}
|
|
}
|
|
var editObj = "<div style=\"float:left\"><select id=\"sel_LogColumns\" multiple=\"multiple\" style=\"width:200px;height:300px;\">"
|
|
+ "<option value=\"CLIENTNAME\">货主</option>"
|
|
+ "<option value=\"GOODSNAME\">品名</option>"
|
|
+ "<option value=\"hj_GOODSRKSL\">入库数量</option>"
|
|
+ "<option value=\"hj_GOODSPFSL_OUT\">出库数量</option>"
|
|
+ "<option value=\"hj_GOODSSTOCK\">库存数量</option>"
|
|
+ "<option value=\"hj_GOODSPACK\">入库件数</option>"
|
|
+ "<option value=\"hj_GOODSPACKPFSL\">出库件数</option>"
|
|
+ "<option value=\"hj_GOODSPACKSTOCK\">库存件数</option></select></div>"
|
|
+ "<div style=\"float:left; width:60px;height:210px;margin:0 auto;text-align:center;vertical-align:middle;line-height:300px; padding-top:90px\">"
|
|
+ "<div class=\"imgLeftButton\" onmousemove=\"this.className='imgLeftHoverButton'\" onmouseout=\"this.className='imgLeftButton'\" title=\"添加\" onclick=\"add()\"></div>"
|
|
+ "<div class=\"imgRightButton\" onmousemove=\"this.className='imgRightHoverButton'\" onmouseout=\"this.className='imgRightButton'\" title=\"移除\" onclick=\"remove()\"></div>"
|
|
+ "</div><div style=\"float:left;\"><select id=\"sel_VisiableColumns\" multiple=\"multiple\" style=\"width:200px;height:300px;\">" + TargeVal + "</select></div>"
|
|
+ "<div style=\"float:left; width:60px;height:210px;margin:0 auto;text-align:center;vertical-align:middle;line-height:300px; padding-top:90px\">"
|
|
+ "<div class=\"imgUpButton\" onmousemove=\"this.className='imgUpHoverButton'\" onmouseout=\"this.className='imgUpButton'\" title=\"向上\" onclick=\"up()\"></div>"
|
|
+ "<div class=\"imgDownButton\" onmousemove=\"this.className='imgDownHoverButton'\" onmouseout=\"this.className='imgDownButton'\" title=\"向下\" onclick=\"down()\"></div></div>"
|
|
+ "<div><div style=\"float:left\"><input type=\"text\" id=\"txt_rename\" style=\"height:20px;width:110px; \"/></div>"
|
|
+ "<div class=\"enterButton\" style=\"width:30px; \" onclick=\"saveRename()\">保存</div></div>"
|
|
+ "<div style=\"float:left; width:70px;\"><div class=\"enterButton\" onclick=\"pushRename()\">重命名</div></div>"
|
|
+ "<div style=\"float:left;width:100%;padding-left:120px;\"><div class=\"enterButton\" onclick=\"saveColumnHeader()\">保存</div><div class=\"enterButton\" onclick=\"cancelColumnHeader()\">取消</div></div>";
|
|
newDiv.innerHTML = editObj;
|
|
document.body.appendChild(newDiv);
|
|
// mask图层
|
|
var newMask = document.createElement("div");
|
|
newMask.id = m;
|
|
newMask.style.position = "absolute";
|
|
newMask.style.zIndex = "1";
|
|
newMask.style.width = document.body.scrollWidth + "px";
|
|
newMask.style.height = document.body.scrollHeight + "px";
|
|
newMask.style.top = "0px";
|
|
newMask.style.left = "0px";
|
|
newMask.style.background = "#000";
|
|
newMask.style.filter = "alpha(opacity=40)";
|
|
newMask.style.opacity = "0.40";
|
|
document.body.appendChild(newMask);
|
|
// 关闭mask和新图层
|
|
}
|
|
|
|
var sourceObj;
|
|
var targetObj;
|
|
/*
|
|
function $(id){
|
|
return document.getElementById(id);
|
|
}
|
|
*/
|
|
function add() {
|
|
sourceObj = $("sel_LogColumns");
|
|
targetObj = $("sel_VisiableColumns");
|
|
|
|
for (var i = 0; i < sourceObj.options.length; i++) {
|
|
if (sourceObj.options[i].selected) {
|
|
if (!isExistVal(targetObj, sourceObj.options[i].value)) {
|
|
var optionObj = document.createElement("option");
|
|
optionObj.text = sourceObj.options[i].text;
|
|
optionObj.value = sourceObj.options[i].value;
|
|
|
|
targetObj.add(optionObj);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function remove() {
|
|
sourceObj = $("sel_VisiableColumns");
|
|
|
|
for (var i = 0; i < sourceObj.options.length; i++) {
|
|
if (sourceObj.options[i].selected) {
|
|
sourceObj.remove(i);
|
|
i = -1;
|
|
}
|
|
}
|
|
}
|
|
|
|
function up() {
|
|
sourceObj = $("sel_VisiableColumns");
|
|
|
|
var cacheArg = new Array();
|
|
for (var i = 0; i < sourceObj.options.length; i++) {
|
|
if (sourceObj.options[i].selected) {
|
|
var optionObj = sourceObj.options[i];
|
|
|
|
if (i > 1) {
|
|
sourceObj.remove(i);
|
|
sourceObj.add(optionObj, i - 1);
|
|
} else {
|
|
sourceObj.remove(i);
|
|
sourceObj.add(optionObj, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function down() {
|
|
sourceObj = $("sel_VisiableColumns");
|
|
|
|
var cacheArg = new Array();
|
|
for (var i = 0; i < sourceObj.options.length; i++) {
|
|
if (sourceObj.options[i].selected) {
|
|
var optionObj = sourceObj.options[i];
|
|
|
|
if (i < sourceObj.options.length) {
|
|
sourceObj.remove(i);
|
|
sourceObj.add(optionObj, i + 1);
|
|
i = i + 1;
|
|
} else {
|
|
sourceObj.remove(i);
|
|
sourceObj.add(optionObj, sourceObj.options.length);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
function isExistVal(tagObj, val) {
|
|
var isExist = false;
|
|
for (var i = 0; i < tagObj.options.length; i++) {
|
|
if (tagObj.options[i].value == val) {
|
|
isExist = true;
|
|
break;
|
|
}
|
|
}
|
|
return isExist;
|
|
}
|
|
|
|
function getColumnWidth(gridObj, txtVal) {
|
|
var colWidth = 50;
|
|
var colCount = gridObj.getColumnsNum();
|
|
|
|
for (var i = 0; i < colCount; i++) {
|
|
var rId = mygrid_log.getRowId(i);
|
|
var colLab = mygrid_log.getColumnLabel(i);
|
|
if (colLab.trim() == txtVal) {
|
|
colWidth = mygrid_log.getColWidth(i);
|
|
}
|
|
}
|
|
|
|
return colWidth;
|
|
}
|
|
|
|
function getColumnIndex(tagObj, val) {
|
|
var colIndex = 0;
|
|
|
|
for (var i = 0; i < tagObj.options.length; i++) {
|
|
if (tagObj.options[i].value == val) {
|
|
colIndex = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return colIndex;
|
|
}
|
|
|
|
function saveColumnHeader() {
|
|
var sel_VisibleObj = $("sel_VisiableColumns");
|
|
sourceObj = $("sel_LogColumns");
|
|
|
|
if (sel_VisibleObj.options.length > 0) {
|
|
document.body.removeChild(docEle("dvColumnSet"));
|
|
document.body.removeChild(docEle("mask"));
|
|
} else {
|
|
document.body.removeChild(docEle("dvColumnSet"));
|
|
document.body.removeChild(docEle("mask"));
|
|
return
|
|
}
|
|
|
|
var jsonLogObj = "";
|
|
|
|
jsonLogObj = "{\"$type\":\"DSWeb.Models.JsonColumnGroupEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",\"ShowCount\":" + pageShowCount + ",\"JsonColumnEntities\":[";
|
|
|
|
var tempGroupJson = "";
|
|
for (var i = 0; i < sourceObj.options.length; i++) {
|
|
var tempJson = "";
|
|
|
|
tempJson += "\"$type\":\"DSWeb.Models.JsonColumnEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",";
|
|
|
|
tempJson += "\"col1\":\"\","; //gid
|
|
tempJson += "\"col2\":\"" + sourceObj.options[i].value + "\","; //column name
|
|
tempJson += "\"col3\":\"" + sourceObj.options[i].text + "\","; //column description
|
|
tempJson += "\"col4\":\"" + getColumnIndex(sel_VisibleObj, sourceObj.options[i].value).toString() + "\","; //index
|
|
tempJson += "\"col5\":\"" + getColumnWidth(mygrid_log, sourceObj.options[i].text) + "\","; //width
|
|
tempJson += "\"col6\":" + (isExistVal(sel_VisibleObj, sourceObj.options[i].value) ? 1 : 0).toString();
|
|
|
|
tempJson = "{" + tempJson + "}";
|
|
if (i == sourceObj.options.length - 1) {
|
|
tempGroupJson += tempJson;
|
|
} else {
|
|
tempGroupJson += tempJson + ",";
|
|
}
|
|
}
|
|
|
|
jsonLogObj += tempGroupJson;
|
|
jsonLogObj += "]}";
|
|
|
|
$("hid_header").value = jsonLogObj;
|
|
jsonFeeObj = null;
|
|
//alert(jsonFeeObj);
|
|
var myForm = document.getElementById("form1");
|
|
myForm.submit();
|
|
}
|
|
|
|
function cancelColumnHeader() {
|
|
document.body.removeChild(docEle("dvColumnSet"));
|
|
document.body.removeChild(docEle("mask"));
|
|
}
|
|
|
|
|
|
var selIndex = -1;
|
|
function pushRename() {
|
|
var selObj = $("sel_VisiableColumns");
|
|
var iSelectCount = 0;
|
|
selIndex = 0;
|
|
for (var i = 0; i < selObj.options.length; i++) {
|
|
if (selObj.options[i].selected) {
|
|
iSelectCount++;
|
|
selIndex = i;
|
|
}
|
|
}
|
|
|
|
if (iSelectCount > 1) {
|
|
alert("请单选要重命名的项");
|
|
} else if (iSelectCount < 1) {
|
|
alert("未选中要重命名的项");
|
|
} else {
|
|
$("txt_rename").value = selObj.options[selIndex].text;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
function saveRename() {
|
|
|
|
var selObj = $("sel_VisiableColumns");
|
|
var txtRenameVal = $("txt_rename").value;
|
|
|
|
if (txtRenameVal.trim() != "") {
|
|
if (selIndex >= 0) {
|
|
var urlVal = "VwWmsDetailListGridSource.aspx?handle=rename&old_header=" + escape(selObj.options[selIndex].text.trim()) + "&new_header=" + escape(txtRenameVal.trim()) + "&hid_sel=" + escape($("hid_sel").value) + "&val=" + newGuid();
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
var saveState = loadVal;
|
|
if (saveState == 1) {
|
|
selObj.options[selIndex].text = txtRenameVal.trim();
|
|
}
|
|
else {
|
|
alert("重命名失败");
|
|
}
|
|
|
|
}
|
|
}
|
|
initLog();
|
|
}
|
|
|
|
function time_custom(a, b, order) {
|
|
a = a.split(":")
|
|
b = a.split(":")
|
|
if (a[0] == b[0])
|
|
return (a[1] > b[1] ? 1 : -1) * (order == "asc" ? 1 : -1);
|
|
else
|
|
return (a[0] > b[0] ? 1 : -1) * (order == "asc" ? 1 : -1);
|
|
}
|
|
|
|
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
|
|
|
|
//-----------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
//校验时间格式
|
|
function validateDateTime(dateTimeObj) {
|
|
var isValid = false;
|
|
|
|
var parseToObj = new Date(dateTimeObj.replace(/-/g, "/"));
|
|
if (!isNaN(parseToObj)) {
|
|
isValid = true;
|
|
}
|
|
|
|
return isValid;
|
|
}
|
|
|
|
function ShowDetailFresh() {
|
|
$("hid_sel").value = " and 1=1";
|
|
var _begintime = $("txt_beginetd").value.trim();
|
|
if (_begintime.trim() != "") {
|
|
if (!validateDateTime(_begintime)) {
|
|
alert("起始时间格式错误");
|
|
return;
|
|
}
|
|
}
|
|
var _endtime = $("txt_endetd").value.trim();
|
|
if (_endtime.trim() != "") {
|
|
if (!validateDateTime(_endtime)) {
|
|
alert("结束时间格式错误");
|
|
return;
|
|
}
|
|
}
|
|
|
|
var _begintime2 = $("txt_beginetd2").value.trim();
|
|
|
|
if (_begintime2.trim() != "") {
|
|
if (!validateDateTime(_begintime2)) {
|
|
alert("起始时间格式错误");
|
|
return;
|
|
}
|
|
}
|
|
var _endtime2 = $("txt_endetd2").value.trim();
|
|
if (_endtime2.trim() != "") {
|
|
if (!validateDateTime(_endtime2)) {
|
|
alert("结束时间格式错误");
|
|
return;
|
|
}
|
|
}
|
|
|
|
var _customer = $("hd_comboCLIENTNAME").value.trim();
|
|
var _GOODSNAME = $("hd_comboGOODSNAME").value.trim();
|
|
var _STORAGENAME = $("hd_comboSTORAGENAME").value.trim();
|
|
var _checkno = $("txt_no").value.trim();
|
|
//var _chargeunit = $("ddlCHARGEUNIT").value.trim();
|
|
|
|
var searchJson = "";
|
|
//begin
|
|
searchJson += "{";
|
|
searchJson += "[";
|
|
|
|
//如果查询条件设置了起始时间和结束时间则判断结束时间是否大于等于起始时间
|
|
if (_begintime != "" && _endtime != "") {
|
|
if (_begintime.length > 9 && _endtime.length > 9) {
|
|
var status = DateTimeEqual(_begintime, _endtime);
|
|
if (status == 0) {
|
|
searchJson += "\"btime\":\"" + _begintime + "\","
|
|
searchJson += "\"etime\":\"" + _endtime + "\","
|
|
} else if (status == -1) {
|
|
alert("时间设置错误,起始时间不能大于结束时间,请修改!");
|
|
return;
|
|
}
|
|
}
|
|
else {
|
|
alert("时间格式有问题,长度应大于9个字符,请修改!");
|
|
return;
|
|
}
|
|
} else {
|
|
searchJson += "\"btime\":\"" + _begintime + "\","
|
|
searchJson += "\"etime\":\"" + _endtime + "\","
|
|
}
|
|
|
|
//如果查询条件设置了起始时间和结束时间则判断结束时间是否大于起始时间
|
|
if (_begintime2 != "" && _endtime2 != "") {
|
|
if (_begintime2.length > 9 && _endtime2.length > 9) {
|
|
var status2 = DateTimeEqual(_begintime2, _endtime2);
|
|
if (status2 == 0) {
|
|
searchJson += "\"btime2\":\"" + _begintime2 + "\","
|
|
searchJson += "\"etime2\":\"" + _endtime2 + "\","
|
|
} else if (status == -1) {
|
|
alert("时间设置错误,起始时间不能大于结束时间,请修改!");
|
|
return;
|
|
}
|
|
}
|
|
else {
|
|
alert("时间格式有问题,长度应大于9个字符,请修改!");
|
|
return;
|
|
}
|
|
} else {
|
|
searchJson += "\"btime2\":\"" + _begintime2 + "\","
|
|
searchJson += "\"etime2\":\"" + _endtime2 + "\","
|
|
}
|
|
|
|
searchJson += "\"cus\":\"" + _customer + "\",";
|
|
searchJson += "\"goodsname\":\"" + _GOODSNAME + "\",";
|
|
searchJson += "\"storagename\":\"" + _STORAGENAME + "\",";
|
|
//searchJson += "\"chargeunit\":\"" + _chargeunit + "\",";
|
|
searchJson += "\"no\":\"" + _checkno + "\"";
|
|
searchJson += "]";
|
|
searchJson += "}";
|
|
$("hid_sel").value = searchJson;
|
|
//
|
|
initLog();
|
|
initMenu();
|
|
}
|
|
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 getonload() {
|
|
initWinScreen();
|
|
initLog();
|
|
initMenu();
|
|
initComboCLIENTNAME();
|
|
initComboGOODSNAME(); //货物描述类型
|
|
initComboSTORAGENAME(); //仓库名称
|
|
}
|
|
//
|
|
function initSearch() {
|
|
$("hd_comboCLIENTNAME").value = "";
|
|
comboCLIENTNAME.setComboText($("hd_comboCLIENTNAME").value);
|
|
$("hd_comboGOODSNAME").value = "";
|
|
comboGOODSNAME.setComboText($("hd_comboGOODSNAME").value);
|
|
$("hd_comboSTORAGENAME").value = "";
|
|
comboSTORAGENAME.setComboText($("hd_comboSTORAGENAME").value);
|
|
$("txt_no").value = "";
|
|
$("txt_beginetd").value = "";
|
|
$("txt_endetd").value = "";
|
|
$("txt_beginetd2").value = "";
|
|
$("txt_endetd2").value = "";
|
|
$("hid_sel").value = "";
|
|
//
|
|
initLog();
|
|
initMenu();
|
|
}
|
|
|
|
function DateTimeEqual(beginObj, endObj) {
|
|
var isEqual = 0;
|
|
var begin = new Date(beginObj.replace(/-/g, "/"));
|
|
var end = new Date(endObj.replace(/-/g, "/"));
|
|
|
|
if (Date.parse(begin) - Date.parse(end) > 0) {
|
|
isEqual = -1; //起始时间大于结束时间
|
|
}
|
|
// else if (Date.parse(begin) - Date.parse(end) == 0) {
|
|
// isEqual = -2; //起始时间与结束时间相等
|
|
// }
|
|
return isEqual;
|
|
}
|
|
|
|
var comboCLIENTNAME; //委托单位
|
|
function initComboCLIENTNAME()//委托单位
|
|
{
|
|
comboCLIENTNAME = dhtmlXComboFromSelect("sel_customer");
|
|
comboCLIENTNAME.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0"); //&strIS=ISCONTROLLER
|
|
comboCLIENTNAME.setOptionWidth(200);
|
|
comboCLIENTNAME.attachEvent("onChange", function () {
|
|
comboCLIENTNAME.setComboText($("hd_comboCLIENTNAME").value);
|
|
});
|
|
comboCLIENTNAME.attachEvent("onBlur", function () {
|
|
var s1 = comboCLIENTNAME.getComboText().trim();
|
|
var s2 = s1.indexOf("|");
|
|
if (s1 == "") {
|
|
$("hd_comboCLIENTNAME").value = "";
|
|
comboCLIENTNAME.setComboText($("hd_comboCLIENTNAME").value);
|
|
}
|
|
else {
|
|
if (s2 > 0) {
|
|
s2 = s2 + 2;
|
|
}
|
|
var s3 = s1.substring(s2);
|
|
if (s2 > 0) {
|
|
comboCLIENTNAME.setComboText(s3);
|
|
$("hd_comboCLIENTNAME").value = s3;
|
|
}
|
|
else {
|
|
comboCLIENTNAME.setComboText($("hd_comboCLIENTNAME").value);
|
|
}
|
|
}
|
|
});
|
|
comboCLIENTNAME.setComboText($("hd_comboCLIENTNAME").value);
|
|
comboCLIENTNAME.attachEvent("onKeyPressed", function (keyCode) {
|
|
if (keyCode != "8") {
|
|
var arrayArg = new Array();
|
|
setTimeout(function () {
|
|
var filterCount = 0;
|
|
var is = -1;
|
|
var ishd = $("hd_comboCLIENTNAME").value.trim();
|
|
if ("" != comboCLIENTNAME.getComboText().trim()) {
|
|
while ("undefined" != typeof comboCLIENTNAME.getOptionByIndex(filterCount)) {
|
|
var comboValue = comboCLIENTNAME.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
|
|
var enterValue = comboCLIENTNAME.getComboText().trim().toUpperCase();
|
|
$("hd_comboCLIENTNAME").value = comboCLIENTNAME.getComboText().trim().toUpperCase();
|
|
if (comboValue.indexOf(enterValue) == 0) {
|
|
comboCLIENTNAME.selectOption(filterCount, true, true);
|
|
is = filterCount;
|
|
break;
|
|
}
|
|
++filterCount;
|
|
}
|
|
if (is == -1) {
|
|
$("hd_comboCLIENTNAME").value = ishd;
|
|
alert("无此内容,请重新选择!");
|
|
}
|
|
}
|
|
}, 10);
|
|
}
|
|
});
|
|
comboCLIENTNAME.attachEvent("onSelectionChange", function () {
|
|
$("hd_comboCLIENTNAME").value = comboCLIENTNAME.getComboText().trim();
|
|
});
|
|
}
|
|
|
|
var comboGOODSNAME; //货物描述类型
|
|
function initComboGOODSNAME()//货物描述类型
|
|
{
|
|
comboGOODSNAME = dhtmlXComboFromSelect("ddlGOODSNAME");
|
|
comboGOODSNAME.loadXML("../FeeCodes/TCodeGoodsAdapter.aspx?mask=0&pos=0");
|
|
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();
|
|
});
|
|
}
|
|
|
|
var comboSTORAGENAME; //仓库名称
|
|
function initComboSTORAGENAME()//仓库名称
|
|
{
|
|
comboSTORAGENAME = dhtmlXComboFromSelect("ddlSTORAGENAME");
|
|
comboSTORAGENAME.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISWAREHOUSE");
|
|
comboSTORAGENAME.setOptionWidth(200);
|
|
comboSTORAGENAME.attachEvent("onChange", function () {
|
|
comboSTORAGENAME.setComboText($("hd_comboSTORAGENAME").value);
|
|
});
|
|
comboSTORAGENAME.attachEvent("onBlur", function () {
|
|
var s1 = comboSTORAGENAME.getComboText().trim();
|
|
var s2 = s1.indexOf("|");
|
|
if (s1 == "") {
|
|
$("hd_comboSTORAGENAME").value = "";
|
|
comboSTORAGENAME.setComboText($("hd_comboSTORAGENAME").value);
|
|
}
|
|
else {
|
|
if (s2 > 0) {
|
|
s2 = s2 + 2;
|
|
}
|
|
var s3 = s1.substring(s2);
|
|
if (s2 > 0) {
|
|
comboSTORAGENAME.setComboText(s3);
|
|
$("hd_comboSTORAGENAME").value = s3;
|
|
}
|
|
else {
|
|
comboSTORAGENAME.setComboText($("hd_comboSTORAGENAME").value);
|
|
}
|
|
}
|
|
});
|
|
comboSTORAGENAME.setComboText($("hd_comboSTORAGENAME").value);
|
|
comboSTORAGENAME.attachEvent("onKeyPressed", function (keyCode) {
|
|
if (keyCode != "8") {
|
|
var arrayArg = new Array();
|
|
setTimeout(function () {
|
|
var filterCount = 0;
|
|
var is = -1;
|
|
var ishd = $("hd_comboSTORAGENAME").value.trim();
|
|
if ("" != comboSTORAGENAME.getComboText().trim()) {
|
|
while ("undefined" != typeof comboSTORAGENAME.getOptionByIndex(filterCount)) {
|
|
var comboValue = comboSTORAGENAME.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
|
|
var enterValue = comboSTORAGENAME.getComboText().trim().toUpperCase();
|
|
$("hd_comboSTORAGENAME").value = comboSTORAGENAME.getComboText().trim().toUpperCase();
|
|
if (comboValue.indexOf(enterValue) == 0) {
|
|
comboSTORAGENAME.selectOption(filterCount, true, true);
|
|
is = filterCount;
|
|
break;
|
|
}
|
|
++filterCount;
|
|
}
|
|
if (is == -1) {
|
|
$("hd_comboSTORAGENAME").value = ishd;
|
|
alert("无此内容,请重新选择!");
|
|
}
|
|
}
|
|
}, 10);
|
|
}
|
|
});
|
|
comboSTORAGENAME.attachEvent("onSelectionChange", function () {
|
|
$("hd_comboSTORAGENAME").value = comboSTORAGENAME.getComboText().trim();
|
|
});
|
|
}
|
|
|
|
function setExcel() {
|
|
if (confirm('确定要导出报表吗?')) {
|
|
var loader = dhtmlxAjax.getSync("VwWmsDetailListGridSource.aspx?handle=excel&hid_sel=" + escape($("hid_sel").value) + "&val=" + newGuid());
|
|
$("hdSQL").value = loader.xmlDoc.responseText;
|
|
//
|
|
document.getElementById("ibExcel").click();
|
|
}
|
|
}
|
|
//打印列表
|
|
function printStock() {
|
|
if (window.confirm("确定要打印报表吗?")) {
|
|
var printUrl = "";
|
|
var companyID = "";
|
|
var typeName = "WMSDETAILSTOCK";
|
|
var dbSourceID = "";
|
|
var userID = "";
|
|
var url = "../Reports/ReportService.aspx?handle=printwmsDetailstock&search=" + escape($("hid_sel").value) + "&val=" + newGuid(); //&bsno=" + strBSNO + "
|
|
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;
|
|
}
|
|
}
|
|
}
|