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.

316 lines
14 KiB
JavaScript

12 months ago
var commonGridObj_recvfee;
var commonGridObj_payfee;
function $(id){
return document.getElementById(id);
}
function initGrid(){
createRecvGrid();
createPayGrid();
getFeeProfit();
}
function createRecvGrid(){
//header
var headerArgs_recv = new Array("","费用状态","应收费用名称","结算单位","计费标准","单价","数量","佣金比例","金额","币别","汇率","FRT","费用备注","是否垫付","结算金额","开票金额","发票号码","录入人","录入时间");
//width
var widthArgs_recv = new Array("40","70","110","150","70","80","80","90","90","50","70","70","70","70","70","70","120","80","120");
//column align
var colAlignArgs_recv = new Array("center","center","right","right","right","right","right","right","right","right","right","right","right","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","int","str","int","int","str","str","str");
//column type
var colTypeArgs_recv = new Array("ch","ro","co","co","co","ro","ro","ro","ro","ro","ro","ro","ro","ch","ro","ro","ro","ro","ro");
commonGridObj_recv = new TGridCommon("mygrid_container_recvfee","form1",headerArgs_recv,widthArgs_recv,colAlignArgs_recv,colSortArgs_recv,colTypeArgs_recv);
commonGridObj_recv.setResponseUrl("OpSeaiBaseInfoGridSource.aspx");
var bsno = $("h_bsno").value;
commonGridObj_recv.setRequest("OpSeaiBaseInfoGridSource.aspx?handle=getfee&feetype=1&bsno="+bsno+"&show_page=5&cur_page=1&oplb=op_Seai&uid="+commonGridObj_recv.newGuid());
commonGridObj_recv.setSourceType("json");
commonGridObj_recv.setSkin("xp");
commonGridObj_recv.setImageUrl("../images/");
commonGridObj_recv.setPagerCount(5);
commonGridObj_recv.initGrid();
commonGridObj_recv.bind();
commonGridObj_recv.setPagerName("pager_recv");
commonGridObj_recv.setPagerInfo("info_recv");
commonGridObj_recv.initCommonPager("getfee","&feetype=1&bsno="+bsno);
commonGridObj_recv.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
if(stage == 0){
if(cInd == 0){
return true;
}else{
return false;
}
}
});
}
function createPayGrid(){
//header
var headerArgs_pay = new Array("","费用状态","应收费用名称","结算单位","计费标准","单价","数量","佣金比例","金额","币别","汇率","FRT","费用备注","是否垫付","结算金额","开票金额","发票号码","录入人","录入时间");
//width
var widthArgs_pay = new Array("40","70","110","150","70","80","80","90","90","50","70","70","70","70","70","70","120","80","120");
//column align
var colAlignArgs_pay = new Array("center","center","right","right","right","right","right","right","right","right","right","right","right","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","int","str","int","int","str","str","str");
//column type
var colTypeArgs_pay = new Array("ch","ro","co","co","co","ro","ro","ro","ro","ro","ro","ro","ro","ch","ro","ro","ro","ro","ro");
commonGridObj_pay = new TGridCommon("mygrid_container_payfee","form1",headerArgs_pay,widthArgs_pay,colAlignArgs_pay,colSortArgs_pay,colTypeArgs_pay);
commonGridObj_pay.setResponseUrl("OpSeaiBaseInfoGridSource.aspx");
var bsno = $("h_bsno").value;
commonGridObj_pay.setRequest("OpSeaiBaseInfoGridSource.aspx?handle=getfee&feetype=2&bsno="+bsno+"&show_page=5&cur_page=1&oplb=op_Seai&uid="+commonGridObj_pay.newGuid());
commonGridObj_pay.setSourceType("json");
commonGridObj_pay.setSkin("xp");
commonGridObj_pay.setImageUrl("../images/");
commonGridObj_pay.setPagerCount(5);
commonGridObj_pay.initGrid();
commonGridObj_pay.bind();
commonGridObj_pay.setPagerName("pager_pay");
commonGridObj_pay.setPagerInfo("info_pay");
commonGridObj_pay.initCommonPager("getfee","&feetype=2&bsno="+bsno);
commonGridObj_pay.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
if(cInd == 0){
return true;
}else{
return false;
}
});
}
//获取利润信息
function getFeeProfit(){
var strBSNO = $("h_bsno").value;
if(strBSNO.trim() != ""){
var urlVal = "../AuditProcess/FeeAuditGridSource.aspx?type=4&bsno="+strBSNO+"&oplb=op_Seai&val="+newGuid();
var loader = "";
loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
var jsonProfitObj = loadVal;
if(IsNum(jsonProfitObj)){
jsonPageObj = null;
$("dvRecvRMBVal").innerHTML = "";
$("dvPayRMBVal").innerHTML = "";
$("dvRMBProfitVal").innerHTML = "";
$("dvUSRecvVal").innerHTML = "";
$("dvUSPayVal").innerHTML = "";
$("dvUSProfitVal").innerHTML = "";
$("dvOtherCurrencyRecvVal").innerHTML = "";
$("dvOtherCurrencyPayVal").innerHTML = "";
$("dvOtherCurrencyProfitVal").innerHTML = "";
$("dvRecvTotalVal").innerHTML = "";
$("dvPaySumVal").innerHTML = "";
$("dvProfitTotalVal").innerHTML = "";
$("dvProfitRateVal").innerHTML = "";
}else{
// if(parseInt($("h_recvauthority").value) <= 0 || parseInt($("h_payauthority").value) <= 0){
// $("dvRecvRMBVal").innerHTML = "0";
// $("dvPayRMBVal").innerHTML = "0";
// $("dvRMBProfitVal").innerHTML = "0";
//
// $("dvUSRecvVal").innerHTML = "0";
// $("dvUSPayVal").innerHTML = "0";
// $("dvUSProfitVal").innerHTML = "0";
//
// $("dvOtherCurrencyRecvVal").innerHTML = "0";
// $("dvOtherCurrencyPayVal").innerHTML = "0";
// $("dvOtherCurrencyProfitVal").innerHTML = "0";
//
// $("dvRecvTotalVal").innerHTML = "0";
// $("dvPaySumVal").innerHTML = "0";
// $("dvProfitTotalVal").innerHTML = "0";
//
// $("dvProfitRateVal").innerHTML = "0";
// }else{
jsonProfitObj = eval('(' + loadVal + ')');
$("dvRecvRMBVal").innerHTML = jsonProfitObj.columns[0].rmbdr;
$("dvPayRMBVal").innerHTML = jsonProfitObj.columns[0].rmbcr;
$("dvRMBProfitVal").innerHTML = jsonProfitObj.columns[0].rmbprofit;
$("dvUSRecvVal").innerHTML = jsonProfitObj.columns[0].usddr;
$("dvUSPayVal").innerHTML = jsonProfitObj.columns[0].usdcr;
$("dvUSProfitVal").innerHTML = jsonProfitObj.columns[0].usdprofit;
$("dvOtherCurrencyRecvVal").innerHTML = jsonProfitObj.columns[0].otdr;
$("dvOtherCurrencyPayVal").innerHTML = jsonProfitObj.columns[0].otcr;
$("dvOtherCurrencyProfitVal").innerHTML = jsonProfitObj.columns[0].otprofit;
$("dvRecvTotalVal").innerHTML = jsonProfitObj.columns[0].drttl;
$("dvPaySumVal").innerHTML = jsonProfitObj.columns[0].crttl;
$("dvProfitTotalVal").innerHTML = jsonProfitObj.columns[0].ttlprofit;
$("dvProfitRateVal").innerHTML = jsonProfitObj.columns[0].profitrate;
// }
}
}else{
$("dvRecvRMBVal").innerHTML = "";
$("dvPayRMBVal").innerHTML = "";
$("dvRMBProfitVal").innerHTML = "";
$("dvUSRecvVal").innerHTML = "";
$("dvUSPayVal").innerHTML = "";
$("dvUSProfitVal").innerHTML = "";
$("dvOtherCurrencyRecvVal").innerHTML = "";
$("dvOtherCurrencyPayVal").innerHTML = "";
$("dvOtherCurrencyProfitVal").innerHTML = "";
$("dvRecvTotalVal").innerHTML = "";
$("dvPaySumVal").innerHTML = "";
$("dvProfitTotalVal").innerHTML = "";
$("dvProfitRateVal").innerHTML = "";
}
}
//获取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 IsNum(val){
var re = /^[-\+]?\d+(\.\d+)?$/;
if (!re.test(val)){
return false;
}else{
return true;
}
}
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
function applyRecvHistory(){
var iCount = 0;
var recvArg = new Array();
for(var i=0;i<commonGridObj_recv.getGridObj().getRowsNum();i++){
var checkState = commonGridObj_recv.getGridObj().cellByIndex(i,0).getValue();
var feeState = commonGridObj_recv.getGridObj().cellByIndex(i,1).getValue();
var rowID = commonGridObj_recv.getGridObj().getRowId(i);
if(checkState == 1){
recvArg.push(rowID);
iCount++;
}
}
if(iCount == 1){
var rowIndex = commonGridObj_recv.getGridObj().getRowIndex(recvArg[0]);
var status = commonGridObj_recv.getGridObj().cellByIndex(rowIndex,1).getValue();
var feeName = commonGridObj_recv.getGridObj().cellByIndex(rowIndex,2).getValue();
var cusName = commonGridObj_recv.getGridObj().cellByIndex(rowIndex,3).getValue();
var bsno = $("h_bsno").value;
if(status.trim() == "申请修改" || status.trim() == "驳回申请" || status.trim() == "申请通过"){
var openUrl = "FeeModify.aspx?id="+recvArg[0]+"&bsno="+bsno+"&handle=2";
window.open (openUrl, "_blank", "height=470, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-470)/2 + ",Left= "+(screen.width-900)/2);
}else{
var urlVal = "../auditprocess/AuditService.aspx?handle=existmodify&oplb=op_Seai&id="+recvArg[0]+"&val="+commonGridObj_recv.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
loader = null;
if(parseInt(loadVal) == 1){
var openUrl = "FeeModify.aspx?id="+recvArg[0]+"&oplb=op_Seai&bsno="+bsno+"&handle=2";
window.open (openUrl, "_blank", "height=470, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-470)/2 + ",Left= "+(screen.width-900)/2);
}else{
alert("没有申请历史记录");
}
}
}else if(iCount > 1){
alert("每次只能查看一项费用信息");
}else{
alert("未选中要操作的费用项");
}
}
function applyPayHistory(){
var iCount = 0;
var recvArg = new Array();
for(var i=0;i<commonGridObj_pay.getGridObj().getRowsNum();i++){
var checkState = commonGridObj_pay.getGridObj().cellByIndex(i,0).getValue();
var feeState = commonGridObj_pay.getGridObj().cellByIndex(i,1).getValue();
var rowID = commonGridObj_pay.getGridObj().getRowId(i);
if(checkState == 1){
recvArg.push(rowID);
iCount++;
}
}
if(iCount == 1){
var rowIndex = commonGridObj_pay.getGridObj().getRowIndex(recvArg[0]);
var status = commonGridObj_pay.getGridObj().cellByIndex(rowIndex,1).getValue();
var feeName = commonGridObj_pay.getGridObj().cellByIndex(rowIndex,2).getValue();
var cusName = commonGridObj_pay.getGridObj().cellByIndex(rowIndex,3).getValue();
var bsno = $("h_bsno").value;
if(status.trim() == "申请修改" || status.trim() == "驳回申请" || status.trim() == "申请通过"){
var openUrl = "FeeModify.aspx?id="+recvArg[0]+"&bsno="+bsno+"&handle=2";
window.open (openUrl, "_blank", "height=470, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-470)/2 + ",Left= "+(screen.width-900)/2);
}else{
var urlVal = "../auditprocess/AuditService.aspx?handle=existmodify&oplb=op_Seai&id="+recvArg[0]+"&val="+commonGridObj_pay.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
loader = null;
if(parseInt(loadVal) == 1){
var openUrl = "FeeModify.aspx?id="+recvArg[0]+"&oplb=op_Seai&bsno="+bsno+"&handle=2";
window.open (openUrl, "_blank", "height=470, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-470)/2 + ",Left= "+(screen.width-900)/2);
}else{
alert("没有申请历史记录");
}
}
}else if(iCount > 1){
alert("每次只能查看一项费用信息");
}else{
alert("未选中要操作的费用项");
}
}
function checkRecvHistory(){
var strBSNO = $("h_bsno").value;
var openSet = "height=540, width=890, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-540)/2 + ",Left= "+(screen.width-890)/2
var openType = "_blank";
var openUrl = "../Shipping/FeeHistory.aspx?bsno="+strBSNO+"&type=1&oplb=op_Seai";
window.open (openUrl,openType,openSet);
}
function checkPayHistory(){
var strBSNO = $("h_bsno").value;
var openSet = "height=540, width=890, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-540)/2 + ",Left= "+(screen.width-890)/2
var openType = "_blank";
var openUrl = "../Shipping/FeeHistory.aspx?bsno="+strBSNO+"&type=2&oplb=op_Seai";
window.open (openUrl,openType,openSet);
}