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.
HENGCHENG/DSWeb/js/PaySettlementApplicationEdi...

382 lines
14 KiB
JavaScript

11 months ago
var commonGridObj_settlementedit;
var comboCustomer;//委托单位
//var comboBank;//开户银行
//var comboAccount;//银行账户
//var comboCurrency;//币别
var comboSettleType;//结算方式
var bsno;
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();
initComboSettleType();
//initComboBank();
//initComboAccount();
//initComboCurrency();
//createComboCurrency();
// createComboBank();
//createComboAccount();
createComboCustomer();
createComboSettleType();
createOrder();
}
//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_paysettleappedit = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkAll(commonGridObj_invoiceedit)\" />","收/付","费用名称","结算单位","计费标准","单价","数量","金额","币别","汇率","申请金额","未申请金额");
// //width
// var widthArgs_paysettleappedit = new Array("40","40","120","120","70","80","80","80","70","70","80","80");
// //column align
// var colAlignArgs_paysettleappedit = new Array("center","center","center","center","center","center","center","center","center","center","center","center");
// //column sort
// var colSortArgs_paysettleappedit = new Array("na","str","str","str","str","str","str","str","str","str","str","str");
// //column type
// var colTypeArgs_paysettleappedit = new Array("ch","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro");
//
//
// commonGridObj_settlementedit = new TGridCommon("mygrid_container_fee","form1",headerArgs_paysettleappedit,widthArgs_paysettleappedit,colAlignArgs_paysettleappedit,colSortArgs_paysettleappedit,colTypeArgs_paysettleappedit);
//
// commonGridObj_settlementedit.setResponseUrl("PayApplicationGridSource.aspx");
// var paySettleAppID = $("h_paysettleappid").value;
// var paySettleAppBSNO = $("h_bsno").value;
// commonGridObj_settlementedit.setRequest("PayApplicationGridSource.aspx?handle=payappeditfee&paysettleappid="+paySettleAppID+"&bsno="+paySettleAppBSNO);
// 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 initComboSettleType(){
comboSettleType = dhtmlXComboFromSelect("sel_settletype");
}
//function initComboBank(){
// comboBank = dhtmlXComboFromSelect("sel_bank");
//}
//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 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($("h_customer").value.trim() != ""){
comboCustomer.setComboText($("h_customer").value);
comboCustomer.disable(true);
}
}
function createComboSettleType(){
if($("h_settletype").value.trim() != ""){
comboSettleType.setComboValue($("h_settletype").value);
comboSettleType.disable(true);
}
}
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
function printApplication(){
var strBillNO = "";
var typeName = "";
strBillNO = $("h_billno").value;
if(strBillNO.trim() != ""){
var printUrl = "";
var companyID = "";
var typeName = "PAYAPPSETTLE";
var dbSourceID = "";
var userID = "";
var url = "";
//alert(strBillNO);
url = "../Reports/ReportService.aspx?handle=printpayappsettle&billno="+strBillNO+"&val="+newGuid();
typeName = "PAYAPPSETTLE";
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;
}
}
//获取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 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 paySettleAppID = $("h_paysettleappid").value;
var runSettleID = $("h_runsettleid").value;
if($("h_checktype").value == "2"){
commonGridObj_order.setRequest("PayApplicationGridSource.aspx?handle=payappopseaelist&paysettleappid="+paySettleAppID);
}else{
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");
//column align
var colAlignArgs_order = new Array("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");
//column type
var colTypeArgs_order = new Array("ch","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 paySettleAppID = $("h_paysettleappid").value;
var runSettleID = $("h_runsettleid").value;
if($("h_checktype").value == "2"){
commonGridObj_fee.setRequest("PayApplicationGridSource.aspx?handle=payappfeelist&paysettleappid="+paySettleAppID+"&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();
}