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.

458 lines
16 KiB
JavaScript

11 months ago
var commonGridObj_settlementedit;
var comboCustomer;//委托单位
//var comboBank;//开户银行
//var comboAccount;//银行账户
//var comboCurrency;//币别
var comboSettleType;//结算方式
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();
createOpSeae();
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_settlementedit = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkAll(commonGridObj_invoiceedit)\" />","收/付","费用名称","结算单位","计费标准","单价","数量","金额","币别","汇率","结算金额","未结算金额");
//width
var widthArgs_settlementedit = new Array("40","40","120","120","70","80","80","80","70","70","80","80");
//column align
var colAlignArgs_settlementedit = new Array("center","center","center","center","center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_settlementedit = new Array("na","str","str","str","str","str","str","str","str","str","str","str");
//column type
var colTypeArgs_settlementedit = new Array("ch","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro");
commonGridObj_settlementedit = new TGridCommon("mygrid_container_fee","form1",headerArgs_settlementedit,widthArgs_settlementedit,colAlignArgs_settlementedit,colSortArgs_settlementedit,colTypeArgs_settlementedit);
commonGridObj_settlementedit.setResponseUrl("SettlementGridSourceApp.aspx");
var settleGID = $("h_settlementid").value;
var settleBSNO = $("h_bsno").value;
commonGridObj_settlementedit.setRequest("SettlementGridSourceApp.aspx?handle=settleeditfee&settlementid="+settleGID+"&bsno="+settleBSNO);
commonGridObj_settlementedit.setSourceType("json");
commonGridObj_settlementedit.setSkin("xp");
commonGridObj_settlementedit.setImageUrl("../images/");
commonGridObj_settlementedit.initGrid();
commonGridObj_settlementedit.bind();
commonGridObj_settlementedit.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);
}
}
function printSettlement(){
var strBillNO = "";
var typeName = "";
strBillNO = $("h_billno").value;
if(strBillNO.trim() != ""){
var printUrl = "";
var companyID = "";
var typeName = "RECVSETTLE";
var dbSourceID = "";
var userID = "";
var url = "";
url = "../Reports/ReportService.aspx?handle=printrecvsettle&billno="+strBillNO+"&val="+newGuid();
typeName = "RECVSETTLE";
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;
}
}
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 cancelSettle(){
var strBillNO = "";
strBillNO = $("h_billno").value;
if (strBillNO.trim() != "")
{
var url = "SettlementGridSourceApp.aspx?handle=cancelrecvsettle&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 if (state == -5) {
alert("此“预付支资料”已使用,不允许操作!请先删除已使用的“预付支取用资料”!");
}
else if (state == -6) {
alert("已生成结算凭证,不允许操作!请先删除已生成的“结算凭证”!");
}
}
else {
alert("费用未结算,不能进行撤销操作");
}
}
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);
}
}