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.

550 lines
21 KiB
JavaScript

11 months ago
var commonGridObj_paysettlementedit;
var comboCustomer;//委托单位
//var comboBank;//开户银行
//var comboAccount;//银行账户
//var comboCurrency;//币别
var comboSettleType;//结算方式
var commonGridObj_order;
var commonGridObj_fee;
function $(id){
return document.getElementById(id);
}
function getObj(strClassName){
var tagArgs=document.getElementsByTagName("div");
var resultObj = null;
for(var i = 0;i<tagArgs.length;i++){
if(tagArgs[i].className == strClassName){
resultObj = tagArgs[i];
break;
}
}
return resultObj;
}
function createInfo(){
initComboCustomer();
//initComboBank();
//initComboAccount();
//initComboCurrency();
initComboSettleType();
//createComboCurrency();
//createComboBank();
//createComboAccount();
createComboCustomer();
createComboSettleType();
createOrder();
setDiv();
}
function setDiv() {
if ($("h_ISADVANCE").value.trim() == "True") {
document.getElementById('YFDiv').style.display = "";
txt_disabled();
}
else {
document.getElementById('YFDiv').style.display = "none";
}
}
function showFee(){
createGrid();
}
function pushAction(obj){
if(obj.innerHTML == "+"){
obj.innerHTML = "-";
var parentObj = obj.parentElement;
var bsno = "";
//查看已经选中的行
var selectedObj = getObj("row_select");
if(selectedObj != null){
selectedObj.className = "row";
}
parentObj.className = "row_select";
var nodeObj = parentObj.getElementsByTagName("div");
if(nodeObj.length > 0){
for(var i=0;i<nodeObj.length;i++){
if(nodeObj[i].className == "row_id"){
$("h_bsno").value = nodeObj[i].innerHTML;//alert($("h_bsno").value);
}
}
}
$("dvFee").style.display = "";
createGrid();
}else{
obj.innerHTML = "+";
$("dvFee").style.display = "none";
}
}
//function createOpSeae(){
// var result = "";
// //header
// result += "<div class=\"head\">";
// result += "<div class=\"head_begin\"></div>";
// result += "<div>委托方式</div>";
// result += "<div>主提单号</div>";
// result += "<div>分提单号</div>";
// result += "<div>委托编号</div>";
// result += "<div>录入人</div>";
// result += "<div class=\"head_end\">录入时间</div></div>";
//
//
// var jsonCacheObj = null;
// var tempCache = "";
// tempCache = $("h_opcache").value;
//
// //var dvOpSeae = getObj("row");
// //var dvBottom = getObj("row lastrow");
//
// var dvTable = getObj("table");
// //var result = "";
// //var bottomResult = "";
// if(tempCache != null){
// jsonCacheObj = eval('(' + tempCache + ')');
//
// if(jsonCacheObj.opinfo.length){
//
// if(jsonCacheObj.opinfo.length == 1){
// result += "<div class=\"row lastrow\">"
// result += "<div class=\"row_begin\" onclick=\"pushAction(this);\">+</div>";
// result += "<div class=\"row_id\">"+jsonCacheObj.opinfo[0].bsno+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[0].bsstatus+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[0].mblno+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[0].hblno+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[0].custno+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[0].inputby+"</div>";
// result += "<div class=\"row_end\">"+jsonCacheObj.opinfo[0].ctime+"</div>";
// result += "</div>";
//
//// dvOpSeae.style.display = "none";
//// dvBottom.innerHTML = bottomResult;
// }else{
// for(var i = 0;i<jsonCacheObj.opinfo.length;i++){
// if(i == jsonCacheObj.opinfo.length - 1){
// result += "<div class=\"row lastrow\">"
// result += "<div class=\"row_begin\" onclick=\"pushAction(this);\">+</div>";
// result += "<div class=\"row_id\">"+jsonCacheObj.opinfo[i].bsno+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[i].bsstatus+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[i].mblno+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[i].hblno+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[i].custno+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[i].inputby+"</div>";
// result += "<div class=\"row_end\">"+jsonCacheObj.opinfo[i].ctime+"</div>";
// result += "</div>";
// }else{
// result += "<div class=\"row\">"
// result += "<div class=\"row_begin\" onclick=\"pushAction(this);\">+</div>";
// result += "<div class=\"row_id\">"+jsonCacheObj.opinfo[i].bsno+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[i].bsstatus+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[i].mblno+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[i].hblno+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[i].custno+"</div>";
// result += "<div>"+jsonCacheObj.opinfo[i].inputby+"</div>";
// result += "<div class=\"row_end\">"+jsonCacheObj.opinfo[i].ctime+"</div>";
// result += "</div>";
// }
// }
// //dvOpSeae.innerHTML = result;
// }
// //result += "</div>";
// dvTable.innerHTML = result;
// }
// }
//}
//function createGrid(){
// //header
// var headerArgs_paysettlementedit = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkAll(commonGridObj_invoiceedit)\" />","收/付","费用名称","结算单位","计费标准","单价","数量","金额","币别","汇率","结算金额","未结算金额");
// //width
// var widthArgs_paysettlementedit = new Array("40","40","120","120","70","80","80","80","70","70","80","80");
// //column align
// var colAlignArgs_paysettlementedit = new Array("center","center","center","center","center","center","center","center","center","center","center","center");
// //column sort
// var colSortArgs_paysettlementedit = new Array("na","str","str","str","str","str","str","str","str","str","str","str");
// //column type
// var colTypeArgs_paysettlementedit = new Array("ch","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro");
//
//
// commonGridObj_paysettlementedit = new TGridCommon("mygrid_container_fee","form1",headerArgs_paysettlementedit,widthArgs_paysettlementedit,colAlignArgs_paysettlementedit,colSortArgs_paysettlementedit,colTypeArgs_paysettlementedit);
//
// commonGridObj_paysettlementedit.setResponseUrl("SettlementGridSource.aspx");
// var paySettleGID = $("h_settlementid").value;
// var paySettleBSNO = $("h_bsno").value;
// commonGridObj_paysettlementedit.setRequest("SettlementGridSource.aspx?handle=paysettleeditfee&settlementid="+paySettleGID+"&bsno="+paySettleBSNO);
// commonGridObj_paysettlementedit.setSourceType("json");
// commonGridObj_paysettlementedit.setSkin("xp");
// commonGridObj_paysettlementedit.setImageUrl("../images/");
// commonGridObj_paysettlementedit.initGrid();
// commonGridObj_paysettlementedit.bind();
//
// commonGridObj_paysettlementedit.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
// if(stage == 0){
// if(cInd == 2 || cInd == 3){
// return false;
// }else{
// return true;
// }
// }
// });
//}
function initComboCustomer(){
comboCustomer = dhtmlXComboFromSelect("sel_customer");
}
//function initComboBank(){
// comboBank = dhtmlXComboFromSelect("sel_bank");
//}
function initComboSettleType(){
comboSettleType = dhtmlXComboFromSelect("sel_settletype");
}
//function initComboAccount(){
// comboAccount = dhtmlXComboFromSelect("sel_account");
//}
//function initComboCurrency(){
// comboCurrency = dhtmlXComboFromSelect("sel_currency");
//}
//function createComboCurrency(){
// if($("h_currency").value.trim() != ""){
// comboCurrency.setComboText($("h_currency").value);
// comboCurrency.disable(true);
// }
//}
function createComboSettleType(){
if($("h_settletype").value.trim() != ""){
comboSettleType.setComboValue($("h_settletype").value);
comboSettleType.disable(true);
}
}
//function createComboBank(){
// if($("h_bank").value.trim() != ""){
// comboBank.setComboText($("h_bank").value);
// comboBank.disable(true);
// }
//}
//function createComboAccount(){
// if($("h_account").value.trim() != ""){
// comboAccount.setComboText($("h_account").value);
// comboAccount.disable(true);
// }
//}
function createComboCustomer(){
if($("txt_customerName").value.trim() != ""){
comboCustomer.setComboText($("txt_customerName").value);
comboCustomer.disable(true);
}
}
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
//获取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 printSettlement(){
var strBillNO = "";
var typeName = "";
strBillNO = $("h_billno").value;
if(strBillNO.trim() != ""){
var printUrl = "";
var companyID = "";
var typeName = "PAYSETTLE";
var dbSourceID = "";
var userID = "";
var url = "";
url = "../Reports/ReportService.aspx?handle=printpaysettle&billno="+strBillNO+"&val="+newGuid();
typeName = "PAYSETTLE";
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;
}
}else{
alert("费用未结算不能打印");
return;
}
}
function cancelSettle(){
// var strBillNO = "";
// strBillNO = $("h_billno").value;
//
// if(strBillNO.trim() != ""){
// var url = "SettlementGridSource.aspx?handle=cancelpaysettle&billno="+strBillNO+"&uid="+newGuid();
// var loader = dhtmlxAjax.getSync(url);
//
// var stateInfo = loader.xmlDoc.responseText;
//
// var state = parseInt(stateInfo);
//
// if(state == 1){
// alert("付费结算撤销完成");
// window.parent.opener.location.href = window.parent.opener.location.href;
// window.close();
// }else if(state == -3){
// alert("付费结算撤销已完成,不能重复操作");
// window.parent.opener.location.href = window.parent.opener.location.href;
// window.close();
// }else if(state == -4){
// alert("付费结算信息不存在");
// window.parent.opener.location.href = window.parent.opener.location.href;
// window.close();
// }
//
// }else{
// alert("费用未结算,不能进行撤销操作");
// }
if($("h_checktype").value == "2"){
var success = 0;
var failure = 0;
if(window.confirm("您确定要撤销付费结算,取消结算后结算信息会被删除 继续请按 (确定) 取消请按(取消) ")){
var url = "PaySettlementGridSource.aspx?handle=cancelpaysettle&paysettleid="+$("h_settlementid").value.trim()+"&uid="+commonGridObj_order.newGuid();
var loader = dhtmlxAjax.getSync(url);
var stateVal = loader.xmlDoc.responseText;
if(stateVal == 1) {
alert("撤销付费结算成功");
window.parent.opener.location.href = window.parent.opener.location.href;
window.close();
}
else if(stateVal == -3) {
alert("此“预付支资料”已使用,不允许操作!请先删除已使用的“预付支取用资料”!");
}
else if (stateVal == -4) {
alert("已生成结算凭证,不允许操作!请先删除已生成的“结算凭证”!");
}
else
{
alert("撤销付费结算失败");
}
}
}else{
alert("只能撤销已经结算的付费信息");
}
}
function createOrder(){
previous_id = "";
//header
var headerArgs_order = new Array("", "委托单位", "委托编号", "主提单号", "分提单号", "报关单号", "备案清单号");
//width
var widthArgs_order = new Array("40","100","120","100","100","100","100");
//column align
var colAlignArgs_order = new Array("center","center","center","center","center","center","center");
//column sort
var colSortArgs_order = new Array("na","str","str","str","str","str","str");
//column type
var colTypeArgs_order = new Array("ch","ro","ro","ro","ro","ro","ro");
commonGridObj_order = new TGridCommon("mygrid_container_order","form1",headerArgs_order,widthArgs_order,colAlignArgs_order,colSortArgs_order,colTypeArgs_order);
commonGridObj_order.setResponseUrl("PayApplicationGridSource.aspx");
var paySettleID = $("h_settlementid").value;
var runSettleID = $("h_runsettleid").value;
if($("h_checktype").value == "2"){
commonGridObj_order.setRequest("PayApplicationGridSource.aspx?handle=payasettleopseaelist&paysettleid="+paySettleID);
}else{
$("btn_cancelsettle").disabled = true;
$("btn_cancelsettle").onclick = clickNull;
commonGridObj_order.setRequest("PayApplicationGridSource.aspx?handle=runsettlelist&runsettleid="+runSettleID);
}
commonGridObj_order.setSourceType("json");
commonGridObj_order.setSkin("xp");
commonGridObj_order.setImageUrl("../images/");
commonGridObj_order.initGrid();
commonGridObj_order.bind();
commonGridObj_order.getGridObj().attachEvent("onSelectStateChanged", function(id){
bsno = id;
createFeeList();
});
}
function createFeeList(){
//header
var headerArgs_order = new Array("<input type=\"checkbox\" id=\"ck_allfee\" onclick=\"checkAll(commonGridObj_fee)\" />", "收/付", "费用名称", "结算单位", "计费标准", "单价", "数量", "金额", "币别", "汇率", "结算金额", "未结算金额", "备份");
//width
var widthArgs_order = new Array("40", "25", "120", "70", "70", "70", "70", "70", "70", "70", "70", "70", "300");
//column align
var colAlignArgs_order = new Array("center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center");
//column sort
var colSortArgs_order = new Array("na", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str");
//column type
var colTypeArgs_order = new Array("ch", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro");
commonGridObj_fee = new TGridCommon("mygrid_container_fee","form1",headerArgs_order,widthArgs_order,colAlignArgs_order,colSortArgs_order,colTypeArgs_order);
commonGridObj_fee.setResponseUrl("PayApplicationGridSource.aspx");
var paySettleID = $("h_settlementid").value;
var runSettleID = $("h_runsettleid").value;
if($("h_checktype").value == "2"){
commonGridObj_fee.setRequest("PayApplicationGridSource.aspx?handle=paysettlefeelist&paysettleid="+paySettleID+"&bsno="+bsno);//strPaySettleAppID
}else{
commonGridObj_fee.setRequest("PayApplicationGridSource.aspx?handle=runfeedolist&runsettleid="+runSettleID+"&bsno="+bsno);//strPaySettleAppID
}
commonGridObj_fee.setSourceType("json");
commonGridObj_fee.setSkin("xp");
commonGridObj_fee.setImageUrl("../images/");
commonGridObj_fee.initGrid();
commonGridObj_fee.bind();
}
function clickNull(){
}
function saveRecvChange3() {
if ($("h_isAccess").value.trim() == "1") {
$("h_enter").value = "1";
var fhz = saveRecvChange2();
if (fhz > -1)// && $("recvContainer_2").value != ""
{
msgBox();
setTimeout(postEnter, 200);
}
}
}
function msgBox() {
var dg = new dialog();
dg.html = "正在保存中,请稍等……"; //"<input type=button onclick='new dialog().close();' value='确定'>";
dg.width = 200;
dg.height = 100;
dg.title = "";
dg.show();
}
function dialog() {
this.width = 450;
this.height = 360;
this.title_height = 20;
this.html = '';
this.title = '';
var self = this;
var bgObj, msgObj, titleObj;
this.close = function () {
document.body.removeChild(document.getElementById("bgDiv"));
document.getElementById("msgDiv").removeChild(document.getElementById("msgTitle"));
document.body.removeChild(document.getElementById("msgDiv"));
}
this.show = function () {
var msgw, msgh, bordercolor;
msgw = self.width;
msgh = self.height;
bordercolor = "#336699";
titlecolor = "#99CCFF";
var sWidth, sHeight;
sWidth = document.body.offsetWidth;
sHeight = screen.height;
bgObj = document.createElement("div");
bgObj.setAttribute('id', 'bgDiv');
bgObj.style.position = "absolute";
bgObj.style.top = "0";
bgObj.style.background = "#777";
bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
bgObj.style.opacity = "0.6";
bgObj.style.left = "0";
bgObj.style.width = sWidth + "px";
bgObj.style.height = sHeight + "px";
bgObj.style.zIndex = "10000";
document.body.appendChild(bgObj);
msgObj = document.createElement("div")
msgObj.setAttribute("id", "msgDiv");
msgObj.setAttribute("align", "center");
msgObj.style.background = "white";
msgObj.style.border = "1px solid " + bordercolor;
msgObj.style.position = "absolute";
msgObj.style.left = "50%";
msgObj.style.top = "30%";
msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
msgObj.style.marginLeft = "-225px";
msgObj.style.marginTop = -75 + document.documentElement.scrollTop + "px";
msgObj.style.width = msgw + "px";
msgObj.style.height = msgh + "px";
msgObj.style.textAlign = "center";
msgObj.style.lineHeight = "25px";
msgObj.style.zIndex = "10001";
titleObj = document.createElement("h4");
titleObj.setAttribute("id", "msgTitle");
titleObj.setAttribute("align", "center");
titleObj.style.margin = "0";
titleObj.style.padding = "3px";
titleObj.style.background = bordercolor;
titleObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
titleObj.style.opacity = "0.75";
titleObj.style.border = "1px solid " + bordercolor;
titleObj.style.height = self.title_height + "px";
titleObj.style.font = "12px Verdana, Geneva, Arial, Helvetica, sans-serif";
titleObj.style.color = "white";
titleObj.style.cursor = "pointer";
titleObj.innerHTML = self.title;
//titleObj.onclick=function(){self.close();}
document.body.appendChild(msgObj);
document.getElementById("msgDiv").appendChild(titleObj);
var txt = document.createElement("div");
txt.style.margin = "1em 0"
txt.setAttribute("id", "msgTxt");
txt.innerHTML = self.html;
document.getElementById("msgDiv").appendChild(txt);
}
}