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.

899 lines
40 KiB
JavaScript

var commonGridObj_opseae;
var commonGridObj_recv;
var commonGridObj_pay;
var stroplb;//业务类别
function $(id){
return document.getElementById(id);
}
function createOpSeaeGrid(){
stroplb= $("h_oplb").value;
//header
var headerArgs_opseae = new Array("","主提单号","分提单号","委托编号","委托单位","订舱代理","船名","航次","开船日期","装货港","卸货港","集装箱","录入人","录入时间","操作","揽货人");
//width
var widthArgs_opseae = new Array("40","100","80","120","120","120","120","120","120","120","120","120","120","120","120","120");
//column align
var colAlignArgs_opseae = new Array("center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_opseae = new Array("na","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str");
//column type
var colTypeArgs_opseae = new Array("ch","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro");
commonGridObj_opseae = new TGridCommon("mygrid_container_opseae","form1",headerArgs_opseae,widthArgs_opseae,colAlignArgs_opseae,colSortArgs_opseae,colTypeArgs_opseae);
commonGridObj_opseae.setResponseUrl("FeeService.aspx");
//var type = parseInt($("h_type").value);
commonGridObj_opseae.setRequest("FeeService.aspx?handle=getopseae&oplb=" + $("h_oplb").value.trim() + "&show_page=15&cur_page=1&search="+escape($("h_searchJson").value.trim())+"&uid=" + commonGridObj_opseae.newGuid());
commonGridObj_opseae.setSourceType("json");
commonGridObj_opseae.setSkin("xp");
commonGridObj_opseae.setImageUrl("../images/");
commonGridObj_opseae.initGrid();
commonGridObj_opseae.loadafter = true;
commonGridObj_opseae.isOnCheckBox = true;
commonGridObj_opseae.after = function(){
finishLoading();
}
commonGridObj_opseae.bind();
commonGridObj_opseae.setSearch($("h_searchJson").value.trim());
commonGridObj_opseae.initPageByHandle("getopseae");
commonGridObj_opseae.getGridObj().attachEvent("onRowSelect", function(id,ind){
$("h_bsno").value = id;
var type = parseInt($("h_type").value);
if(type == 1){
createRecvFeeGrid();
}else if(type == 2){
createPayFeeGrid();
}
});
commonGridObj_opseae.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){
$("h_bsno").value = rId;
var cacheName = "";
var type = parseInt($("h_type").value);
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}else{
$("h_cachename").value = commonGridObj_opseae.newGuid();
cacheName = "&cachename="+$("h_cachename").value.trim();
}
var orderRowIndex = commonGridObj_opseae.getGridObj().getRowIndex(rId);
var checkBox = commonGridObj_opseae.getGridObj().cellByIndex(orderRowIndex,0).getValue();
var url = "";
var parentObj = window.parent.opener.location;//alert(parentObj);
var oldUrl = parentObj.href;
if(checkBox == 1){//委托选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkopseae&feetype=" + type + "&op=check&bsno=" + rId + "&oldcache=" + oldCacheName + "&val=" + commonGridObj_opseae.newGuid() + cacheName + "&oplb=" + $("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkopseae&feetype=" + type + "&op=check&bsno=" + rId + "&val=" + commonGridObj_opseae.newGuid() + cacheName + "&oplb=" + $("h_oplb").value.trim();
}
}else{//委托取消选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkopseae&feetype=" + type + "&op=uncheck&bsno=" + rId + "&oldcache=" + oldCacheName + "&val=" + commonGridObj_opseae.newGuid() + cacheName + "&oplb=" + $("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkopseae&feetype=" + type + "&op=uncheck&bsno=" + rId + "&val=" + commonGridObj_opseae.newGuid() + cacheName + "&oplb=" + $("h_oplb").value.trim();
}
}
var loader = dhtmlxAjax.getSync(url);
var cacheTotal = "";
var cacheTotalObj = null;
var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
var cacheState = parseInt(cacheVal);
if(type == 1){
createRecvFeeGrid();
}else if(type == 2){
createPayFeeGrid();
}
});
commonGridObj_opseae.onCheckBox = function(){
commonGridObj_opseae.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){
$("h_bsno").value = rId;
var cacheName = "";
var type = parseInt($("h_type").value);
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}else{
$("h_cachename").value = commonGridObj_opseae.newGuid();
cacheName = "&cachename="+$("h_cachename").value.trim();
}
var orderRowIndex = commonGridObj_opseae.getGridObj().getRowIndex(rId);
var checkBox = commonGridObj_opseae.getGridObj().cellByIndex(orderRowIndex,0).getValue();
var url = "";
var parentObj = window.parent.opener.location;//alert(parentObj);
var oldUrl = parentObj.href;
if(checkBox == 1){//费用选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkopseae&feetype=" + type + "&op=check&bsno=" + rId + "&oldcache=" + oldCacheName + "&val=" + commonGridObj_opseae.newGuid() + cacheName + "&oplb=" + $("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkopseae&feetype=" + type + "&op=check&bsno=" + rId + "&val=" + commonGridObj_opseae.newGuid() + cacheName + "&oplb=" + $("h_oplb").value.trim();
}
}else{//费用取消选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkopseae&feetype=" + type + "&op=uncheck&bsno=" + rId + "&oldcache=" + oldCacheName + "&val=" + commonGridObj_opseae.newGuid() + cacheName + "&oplb=" + $("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkopseae&feetype=" + type + "&op=uncheck&bsno=" + rId + "&val=" + commonGridObj_opseae.newGuid() + cacheName + "&oplb=" + $("h_oplb").value.trim();
}
}
var loader = dhtmlxAjax.getSync(url);
var cacheTotal = "";
var cacheTotalObj = null;
var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
var cacheState = parseInt(cacheVal);
if(type == 1){
createRecvFeeGrid();
}else if(type == 2){
createPayFeeGrid();
}
});
}
commonGridObj_opseae.clickEvent = function(){
commonGridObj_opseae.getGridObj().attachEvent("onRowSelect", function(id,ind){
$("h_bsno").value = id;
var type = parseInt($("h_type").value);
if(type == 1){
createRecvFeeGrid();
}else if(type == 2){
createPayFeeGrid();
}
});
}
}
function createRecvFeeGrid(){
initLoading();
//header
var headerArgs_recv = new Array("<input type=\"checkbox\" id=\"ck_recvall\" onclick=\"checkall(1)\" />","应收费用名称","结算单位","计费标准","单价","数量","佣金比例","金额","币别","汇率","FRT","费用备注","是否垫付","录入人","录入时间");
//width
var widthArgs_recv = new Array("40","110","150","70","80","80","90","90","50","70","70","70","120","80","120");
//column align
var colAlignArgs_recv = new Array("center","center","center","center","center","center","center","center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_recv = new Array("na","str","str","str","int","int","int","int","int","int","int","int","str","str","str");
//column type
var colTypeArgs_recv = new Array("ch","ro","co","co","co","ro","ro","ro","ro","ro","ro","ro","ch","ro","ro");
commonGridObj_recv = new TGridCommon("mygrid_container_recvfee","form1",headerArgs_recv,widthArgs_recv,colAlignArgs_recv,colSortArgs_recv,colTypeArgs_recv);
commonGridObj_recv.setResponseUrl("FeeService.aspx");
var bsno = $("h_bsno").value;
var cacheName = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}
commonGridObj_recv.setRequest("FeeService.aspx?handle=getfee&feetype=1&bsno=" + bsno + "&show_page=5&cur_page=1&uid=" + commonGridObj_recv.newGuid() + cacheName) + "&oplb=" + $("h_oplb").value.trim();
commonGridObj_recv.setSourceType("json");
commonGridObj_recv.setSkin("xp");
commonGridObj_recv.setImageUrl("../images/");
commonGridObj_recv.setPagerCount(5);
commonGridObj_recv.initGrid();
commonGridObj_recv.isOnCheckBox = true;
commonGridObj_recv.loadafter = true;
commonGridObj_recv.after = function(){
finishLoading();
}
commonGridObj_recv.bind();
commonGridObj_recv.setPagerName("pager_recv");
commonGridObj_recv.setPagerInfo("info_recv");
commonGridObj_recv.initCommonPager("getfee","&feetype=1&bsno="+bsno+cacheName);
commonGridObj_recv.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
if(stage == 0){
if(cInd == 0){
return true;
}else{
return false;
}
}
});
commonGridObj_recv.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){
var cacheName = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}else{
$("h_cachename").value = commonGridObj_recv.newGuid();
cacheName = "&cachename="+$("h_cachename").value.trim();
}
var orderRowIndex = commonGridObj_recv.getGridObj().getRowIndex(rId);
var checkBox = commonGridObj_recv.getGridObj().cellByIndex(orderRowIndex,0).getValue();
var url = "";
var parentObj = window.parent.opener.location;
var oldUrl = parentObj.href;
if(checkBox == 1){//费用选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkfee&feetype=1&op=check&gid=" + rId + "&oldcache=" + oldCacheName + "&val=" + commonGridObj_recv.newGuid() + cacheName + "&oplb=" + $("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkfee&feetype=1&op=check&gid=" + rId + "&val=" + commonGridObj_recv.newGuid() + cacheName + "&oplb=" + $("h_oplb").value.trim(); //alert(url);
}
}else{//费用取消选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkfee&op=uncheck&gid=" + rId + "&oldcache=" + oldCacheName + "&val=" + commonGridObj_recv.newGuid() + cacheName + "&oplb=" + $("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkfee&op=uncheck&gid=" + rId + "&val=" + commonGridObj_recv.newGuid() + cacheName + "&oplb=" + $("h_oplb").value.trim();
}
}
var loader = dhtmlxAjax.getSync(url);
var cacheTotal = "";
var cacheTotalObj = null;
var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
var cacheState = parseInt(cacheVal);
});
commonGridObj_recv.onCheckBox = function(){
commonGridObj_recv.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){
var cacheName = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}else{
$("h_cachename").value = commonGridObj_recv.newGuid();
cacheName = "&cachename="+$("h_cachename").value.trim();
}
var orderRowIndex = commonGridObj_recv.getGridObj().getRowIndex(rId);
var checkBox = commonGridObj_recv.getGridObj().cellByIndex(orderRowIndex,0).getValue();
var url = "";
var parentObj = window.parent.opener.location;
var oldUrl = parentObj.href;
if(checkBox == 1){//费用选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkfee&feetype=1&op=check&gid="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_recv.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkfee&feetype=1&op=check&gid="+rId+"&val="+commonGridObj_recv.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();//alert(url);
}
}else{//费用取消选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkfee&op=uncheck&gid="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_recv.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkfee&op=uncheck&gid="+rId+"&val="+commonGridObj_recv.newGuid()+cacheName;
}
}
var loader = dhtmlxAjax.getSync(url);
var cacheTotal = "";
var cacheTotalObj = null;
var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
var cacheState = parseInt(cacheVal);
});
}
}
function createPayFeeGrid(){
initLoading();
//header
var headerArgs_pay = new Array("<input type=\"checkbox\" id=\"ck_payall\" onclick=\"checkall(2)\" />","应付费用名称","结算单位","计费标准","单价","数量","佣金比例","金额","币别","汇率","FRT","费用备注","是否垫付","录入人","录入时间");
//width
var widthArgs_pay = new Array("40","110","150","70","80","80","90","90","50","70","70","70","120","80","120");
//column align
var colAlignArgs_pay = new Array("center","center","center","center","center","center","center","center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_pay = new Array("na","str","str","str","int","int","int","int","int","int","int","int","str","str","str");
//column type
var colTypeArgs_pay = new Array("ch","ro","co","co","co","ro","ro","ro","ro","ro","ro","ro","ch","ro","ro");
commonGridObj_pay = new TGridCommon("mygrid_container_payfee","form1",headerArgs_pay,widthArgs_pay,colAlignArgs_pay,colSortArgs_pay,colTypeArgs_pay);
commonGridObj_pay.setResponseUrl("FeeService.aspx");
var bsno = $("h_bsno").value;
var cacheName = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}
commonGridObj_pay.setRequest("FeeService.aspx?handle=getfee&feetype=2&bsno="+bsno+"&show_page=5&cur_page=1&uid="+commonGridObj_pay.newGuid()+cacheName)+"&oplb="+$("h_oplb").value.trim();
commonGridObj_pay.setSourceType("json");
commonGridObj_pay.setSkin("xp");
commonGridObj_pay.setImageUrl("../images/");
commonGridObj_pay.setPagerCount(5);
commonGridObj_pay.initGrid();
commonGridObj_pay.isOnCheckBox = true;
commonGridObj_pay.loadafter = true;
commonGridObj_pay.after = function(){
finishLoading();
}
commonGridObj_pay.bind();
commonGridObj_pay.setPagerName("pager_pay");
commonGridObj_pay.setPagerInfo("info_pay");
commonGridObj_pay.initCommonPager("getfee","&feetype=2&bsno="+bsno+cacheName);
commonGridObj_pay.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
if(cInd == 0){
return true;
}else{
return false;
}
});
commonGridObj_pay.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){
var cacheName = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}else{
$("h_cachename").value = commonGridObj_pay.newGuid();
cacheName = "&cachename="+$("h_cachename").value.trim();
}
var orderRowIndex = commonGridObj_pay.getGridObj().getRowIndex(rId);
var checkBox = commonGridObj_pay.getGridObj().cellByIndex(orderRowIndex,0).getValue();
var url = "";
var parentObj = window.parent.opener.location;//alert(parentObj);
var oldUrl = parentObj.href;
if(checkBox == 1){//费用选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkfee&feetype=2&op=check&gid="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_pay.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkfee&feetype=2&op=check&gid="+rId+"&val="+commonGridObj_pay.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}
}else{//费用取消选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkfee&feetype=2&op=uncheck&gid="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_pay.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkfee&feetype=2&op=uncheck&gid="+rId+"&val="+commonGridObj_pay.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}
}
var loader = dhtmlxAjax.getSync(url);
var cacheTotal = "";
var cacheTotalObj = null;
var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
var cacheState = parseInt(cacheVal);
});
commonGridObj_pay.onCheckBox = function(){
commonGridObj_pay.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){
var cacheName = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}else{
$("h_cachename").value = commonGridObj_pay.newGuid();
cacheName = "&cachename="+$("h_cachename").value.trim();
}
var orderRowIndex = commonGridObj_pay.getGridObj().getRowIndex(rId);
var checkBox = commonGridObj_pay.getGridObj().cellByIndex(orderRowIndex,0).getValue();
var url = "";
var parentObj = window.parent.opener.location;//alert(parentObj);
var oldUrl = parentObj.href;
if(checkBox == 1){//费用选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkfee&feetype=2&op=check&gid="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_pay.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkfee&feetype=2&op=check&gid="+rId+"&val="+commonGridObj_pay.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}
}else{//费用取消选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkfee&feetype=2&op=uncheck&gid="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_pay.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkfee&feetype=2&op=uncheck&gid="+rId+"&val="+commonGridObj_pay.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}
}
var loader = dhtmlxAjax.getSync(url);
var cacheTotal = "";
var cacheTotalObj = null;
var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
var cacheState = parseInt(cacheVal);
});
}
}
function createFeeGrid(){
var type = parseInt($("h_type").value);
if(type == 1){
createRecvFeeGrid();
$("recvContainer").style.display = "";
$("payContainer").style.display = "none";
}else if(type == 2){
createPayFeeGrid();
$("payContainer").style.display = "";
$("recvContainer").style.display = "none";
}
}
function importFee(){
initLoading();
var url = "";
var oldCacheName = "";
var cacheName = "";
var historyCache = "";
var newUrl = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
historyCache = "&historycache="+$("h_cachename").value.trim();
}else{
$("h_cachename").value = commonGridObj_opseae.newGuid();
cacheName = "&cachename="+$("h_cachename").value.trim();
historyCache = "&historycache="+$("h_cachename").value.trim();
}
var opType = "";
if($("ck_all").checked){
opType = "&op=1";
}else{
opType = "&op=2";
}
var type = parseInt($("h_type").value);
var parentObj = window.parent.opener.location;//alert(parentObj);
var oldUrl = parentObj.href;
//alert("importFee oldUrl "+oldUrl);
if(oldUrl.indexOf("&historycache") > 0){
if(oldUrl.indexOf("&op") >= 0){
newUrl = oldUrl.substr(0,oldUrl.indexOf("&op"))+opType+historyCache+"&historytype="+type;
}else{
newUrl = oldUrl.substr(0,oldUrl.indexOf("&historycache"))+opType+historyCache+"&historytype="+type;
}
oldCacheName = newUrl.substring(newUrl.indexOf("&historycache=")+14,newUrl.indexOf("&historytype"));
url = "FeeService.aspx?handle=importhistory"+cacheName+"&oldcache="+oldCacheName+"&uid="+commonGridObj_opseae.newGuid()+"&oplb="+$("h_oplb").value.trim();
}else{
newUrl = oldUrl+opType+historyCache+"&historytype="+type;
url = "FeeService.aspx?handle=importhistory"+cacheName+"&uid="+commonGridObj_opseae.newGuid()+"&oplb="+$("h_oplb").value.trim();
}
//alert("importFee newUrl "+newUrl);
//alert("importFee url "+url);
//alert(newUrl);
var loader = dhtmlxAjax.getSync(url);
var cacheTotal = "";
var cacheTotalObj = null;
var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
var cacheState = parseInt(cacheVal);
if(cacheState == 1){
window.parent.opener.location.href = window.parent.opener.location.href;
parentObj.href = newUrl;
finishLoading();
window.close();
}
}
function cancelImport(){
window.close();
}
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
function initLoading(){
$("progressBar").style.display = "";
}
function finishLoading(){
$("progressBar").style.display = "none";
}
//根据条件查询付费申请信息
function search(){
var _begintime = $("txt_begin").value.trim();
if(_begintime.trim() != ""){
if(!validateDateTime(_begintime)){
alert("起始时间格式错误");
return;
}
}
var _endtime = $("txt_end").value.trim();
if(_endtime.trim() != ""){
if(!validateDateTime(_endtime)){
alert("结束时间格式错误");
return;
}
}
// var _customer = $("hd_comboCUSTOMERNAME").value.trim();
// var _vessel = $("hd_comboVESSEL").value.trim();
// var _voyno = $("hd_comboVOYNO").value.trim();
// var _op = $("hd_comboOP").value.trim();
var _checkno = $("txt_no").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 if(status == -2){
// alert("时间设置错误,起始时间不能等于结束时间,请修改!");
// return;
// }
}
else{
alert("时间格式有问题,长度应大于9个字符,请修改!");
return;
}
}else{
searchJson += "\"btime\":\""+_begintime+"\","
searchJson += "\"etime\":\""+_endtime+"\","
}
// searchJson += "\"cus\":\""+_customer+"\",";
// searchJson += "\"vessel\":\""+_vessel+"\",";
// searchJson += "\"voyno\":\""+_voyno+"\",";
// searchJson += "\"op\":\""+_op+"\",";
searchJson += "\"no\":\""+_checkno+"\",";
searchJson += "\"oplb\":\"" + $("h_oplb").value.trim() + "\"";
searchJson += "]";
searchJson += "}"; //alert(searchJson);
$("h_searchJson").value = searchJson;
//
createOpSeaeGrid();
// commonGridObj_opseae.initGrid();
// var cacheName = "";
// if($("h_cachename").value.trim() != ""){
// cacheName = "&cachename="+$("h_cachename").value.trim();
// }
// commonGridObj_opseae.setRequest("FeeService.aspx?handle=getopseae&oplb="+$("h_oplb").value.trim()+"&show_page=15&cur_page=1&search="+escape($("h_searchJson").value.trim())+"&uid="+commonGridObj_opseae.newGuid()+cacheName);
// commonGridObj_opseae.bind();
// commonGridObj_opseae.setSearch(searchJson);
//
// commonGridObj_opseae.initPageByHandle("getopseae");
// commonGridObj_opseae.isDBClickEvent = true;
// commonGridObj_opseae.getGridObj().attachEvent("onRowSelect", function(id,ind){
// $("h_bsno").value = id;
// var type = parseInt($("h_type").value);
//
// if(type == 1){
// createRecvFeeGrid();
// }else if(type == 2){
// createPayFeeGrid();
// }
// });
// commonGridObj_opseae.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){
// $("h_bsno").value = rId;
// var cacheName = "";
// var type = parseInt($("h_type").value);
// if($("h_cachename").value.trim() != ""){
// cacheName = "&cachename="+$("h_cachename").value.trim();
// }else{
// $("h_cachename").value = commonGridObj_opseae.newGuid();
// cacheName = "&cachename="+$("h_cachename").value.trim();
// }
//
// var orderRowIndex = commonGridObj_opseae.getGridObj().getRowIndex(rId);
// var checkBox = commonGridObj_opseae.getGridObj().cellByIndex(orderRowIndex,0).getValue();
// var url = "";
//
// var parentObj = window.parent.opener.location;//alert(parentObj);
// var oldUrl = parentObj.href;
//
// if(checkBox == 1){//费用选中状态
// if(oldUrl.indexOf("&cachename") > 0){
// oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
// url = "FeeService.aspx?handle=checkopseae&feetype="+type+"&op=check&bsno="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_opseae.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
// }else{
// url = "FeeService.aspx?handle=checkopseae&feetype="+type+"&op=check&bsno="+rId+"&val="+commonGridObj_opseae.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
// }
// }else{//费用取消选中状态
// if(oldUrl.indexOf("&cachename") > 0){
// oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
// url = "FeeService.aspx?handle=checkopseae&feetype="+type+"&op=uncheck&bsno="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_opseae.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
// }else{
// url = "FeeService.aspx?handle=checkopseae&feetype="+type+"&op=uncheck&bsno="+rId+"&val="+commonGridObj_opseae.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
// }
// }
//
// var loader = dhtmlxAjax.getSync(url);
// var cacheTotal = "";
// var cacheTotalObj = null;
// var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
//
// var cacheState = parseInt(cacheVal);
//
//
// if(type == 1){
// createRecvFeeGrid();
// }else if(type == 2){
// createPayFeeGrid();
// }
// });
// commonGridObj_opseae.onCheckBox = function(){
// commonGridObj_opseae.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){
// $("h_bsno").value = rId;
// var cacheName = "";
// var type = parseInt($("h_type").value);
// if($("h_cachename").value.trim() != ""){
// cacheName = "&cachename="+$("h_cachename").value.trim();
// }else{
// $("h_cachename").value = commonGridObj_opseae.newGuid();
// cacheName = "&cachename="+$("h_cachename").value.trim();
// }
//
// var orderRowIndex = commonGridObj_opseae.getGridObj().getRowIndex(rId);
// var checkBox = commonGridObj_opseae.getGridObj().cellByIndex(orderRowIndex,0).getValue();
// var url = "";
//
// var parentObj = window.parent.opener.location;//alert(parentObj);
// var oldUrl = parentObj.href;
//
// if(checkBox == 1){//费用选中状态
// if(oldUrl.indexOf("&cachename") > 0){
// oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
// url = "FeeService.aspx?handle=checkopseae&feetype="+type+"&op=check&bsno="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_opseae.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
// }else{
// url = "FeeService.aspx?handle=checkopseae&feetype="+type+"&op=check&bsno="+rId+"&val="+commonGridObj_opseae.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
// }
// }else{//费用取消选中状态
// if(oldUrl.indexOf("&cachename") > 0){
// oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
// url = "FeeService.aspx?handle=checkopseae&feetype="+type+"&op=uncheck&bsno="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_opseae.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
// }else{
// url = "FeeService.aspx?handle=checkopseae&feetype="+type+"&op=uncheck&bsno="+rId+"&val="+commonGridObj_opseae.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
// }
// }
//
// var loader = dhtmlxAjax.getSync(url);
// var cacheTotal = "";
// var cacheTotalObj = null;
// var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
//
// var cacheState = parseInt(cacheVal);
//
//
// if(type == 1){
// createRecvFeeGrid();
// }else if(type == 2){
// createPayFeeGrid();
// }
// });
// }
// commonGridObj_opseae.clickEvent = function(){
// commonGridObj_opseae.getGridObj().attachEvent("onRowSelect", function(id,ind){
// $("h_bsno").value = id;
// var type = parseInt($("h_type").value);
// if(type == 1){
// createRecvFeeGrid();
// }else if(type == 2){
// createPayFeeGrid();
// }
// });
// }
}
//全选框
function checkall(type){
if(type == 1){
var checkStatus = $("ck_recvall").checked;
var iCount = commonGridObj_recv.getGridObj().getRowsNum();
for(var i=0;i < iCount;i++){
var rId = commonGridObj_recv.getGridObj().getRowId(i);
var cacheName = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}else{
$("h_cachename").value = commonGridObj_recv.newGuid();
cacheName = "&cachename="+$("h_cachename").value.trim();
}
var orderRowIndex = commonGridObj_recv.getGridObj().getRowIndex(rId);
var checkBox = commonGridObj_recv.getGridObj().cellByIndex(orderRowIndex,0).getValue();
var url = "";
var parentObj = window.parent.opener.location;
var oldUrl = parentObj.href;
if(checkStatus == 1){//费用选中状态
commonGridObj_recv.getGridObj().cellByIndex(i,0).setValue(1);
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkfee&feetype=1&op=check&gid="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_recv.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkfee&feetype=1&op=check&gid="+rId+"&val="+commonGridObj_recv.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();//alert(url);
}
}else{//费用取消选中状态
commonGridObj_recv.getGridObj().cellByIndex(i,0).setValue(0);
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkfee&op=uncheck&gid="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_recv.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkfee&op=uncheck&gid="+rId+"&val="+commonGridObj_recv.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}
}
var loader = dhtmlxAjax.getSync(url);
var cacheTotal = "";
var cacheTotalObj = null;
var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
var cacheState = parseInt(cacheVal);
}
}else if(type == 2){
var checkStatus = $("ck_payall").checked;
var iCount = commonGridObj_pay.getGridObj().getRowsNum();
for(var i=0;i < iCount;i++){
var rId = commonGridObj_pay.getGridObj().getRowId(i);
var cacheName = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}else{
$("h_cachename").value = commonGridObj_pay.newGuid();
cacheName = "&cachename="+$("h_cachename").value.trim();
}
var orderRowIndex = commonGridObj_pay.getGridObj().getRowIndex(rId);
var checkBox = commonGridObj_pay.getGridObj().cellByIndex(orderRowIndex,0).getValue();
var url = "";
var parentObj = window.parent.opener.location;//alert(parentObj);
var oldUrl = parentObj.href;
if(checkStatus == 1){//费用选中状态
commonGridObj_pay.getGridObj().cellByIndex(i,0).setValue(1);
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkfee&feetype=2&op=check&gid="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_pay.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkfee&feetype=2&op=check&gid="+rId+"&val="+commonGridObj_pay.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}
}else{//费用取消选中状态
commonGridObj_pay.getGridObj().cellByIndex(i,0).setValue(0);
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "FeeService.aspx?handle=checkfee&feetype=2&op=uncheck&gid="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_pay.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}else{
url = "FeeService.aspx?handle=checkfee&feetype=2&op=uncheck&gid="+rId+"&val="+commonGridObj_pay.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
}
}
var loader = dhtmlxAjax.getSync(url);
var cacheTotal = "";
var cacheTotalObj = null;
var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
var cacheState = parseInt(cacheVal);
}
}
}
function initSearch(){
$("txt_begin").value = "";
$("txt_end").value = "";
$("txt_no").value = "";
var cacheName = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
var initUrl = "FeeService.aspx?handle=inithistory&val="+commonGridObj_opseae.newGuid()+cacheName+"&oplb="+$("h_oplb").value.trim();
var loader = dhtmlxAjax.getSync(initUrl);
var cacheTotal = "";
var cacheTotalObj = null;
var cacheVal = loader.xmlDoc.responseText;
var cacheState = parseInt(cacheVal);
if(cacheState == 1){
createOpSeaeGrid();
var type = parseInt($("h_type").value);
$("h_bsno").value = "";
if(type == 1){
createRecvFeeGrid();
}else if(type == 2){
createPayFeeGrid();
}
}
}else{
createOpSeaeGrid();
var type = parseInt($("h_type").value);
$("h_bsno").value = "";
if(type == 1){
createRecvFeeGrid();
}else if(type == 2){
createPayFeeGrid();
}
}
}
//校验时间格式
function validateDateTime(dateTimeObj){
var isValid = false;
var parseToObj = new Date(dateTimeObj.replace(/-/g, "/"));
if(!isNaN(parseToObj)){
isValid = true;
}
return isValid;
}
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;
}
function checkBoxClick(targetName,otherName){
$(targetName).checked = true;
$(otherName).checked = false;
}