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.

243 lines
8.9 KiB
JavaScript

10 months ago
var commonGridObj_invoicepayedit;
var comboCustomer;//委托单位
//var comboBank;//开户银行
//var comboAccount;//银行账户
var comboCurrency;//币别
var pressRecord;
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();
createComboCurrency();
// createComboBank();
// createComboAccount();
createComboCustomer();
createOpSeae();
}
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){
result += "<div class=\"head\">";
result += "<div class=\"head_begin\">"+jsonCacheObj.opinfo[0].oplb+"</div>";
result += "<div>委托方式</div>";
result += "<div>主提单号</div>";
result += "<div>分提单号</div>";
result += "<div>委托编号</div>";
result += "<div>录入人</div>";
result += "<div class=\"head_end\">录入时间</div></div>";
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_invoiceappedit = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkAll(commonGridObj_invoiceedit)\" />","收/付","费用名称","结算单位","计费标准","单价","数量","金额","币别","汇率","申请开票金额","未申请开票金额");
//width
var widthArgs_invoiceappedit = new Array("40","40","120","120","70","80","80","80","70","70","100","100");
//column align
var colAlignArgs_invoiceappedit = new Array("center","center","center","center","center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_invoiceappedit = new Array("na","str","str","str","str","str","str","str","str","str","str","str");
//column type
var colTypeArgs_invoiceappedit = new Array("ch","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro");
commonGridObj_invoicepayedit = new TGridCommon("mygrid_container_fee","form1",headerArgs_invoiceappedit,widthArgs_invoiceappedit,colAlignArgs_invoiceappedit,colSortArgs_invoiceappedit,colTypeArgs_invoiceappedit);
commonGridObj_invoicepayedit.setResponseUrl("InvoiceApplicationGridSource.aspx");
var invoiceAppGID = $("h_invoiceappid").value;
var invoiceBSNO = $("h_bsno").value;
commonGridObj_invoicepayedit.setRequest("InvoiceApplicationGridSource.aspx?handle=invoiceappeditfee&invoiceappid="+invoiceAppGID+"&bsno="+invoiceBSNO);
commonGridObj_invoicepayedit.setSourceType("json");
commonGridObj_invoicepayedit.setSkin("xp");
commonGridObj_invoicepayedit.setImageUrl("../images/");
commonGridObj_invoicepayedit.initGrid();
commonGridObj_invoicepayedit.bind();
commonGridObj_invoicepayedit.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 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);
}
}
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }