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.
DS7/DSWeb/js/FeeAudit.js

1735 lines
71 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

var commonGridObj_total;
var commonGridObj_recv;
var commonGridObj_pay;
var searchCondition = "";
var strBSNO = "";
var SelectRowOplb="";//选中行的业务类别
function $(id){
return document.getElementById(id);
}
function createGrid(){
//header
var headerArgs_total = new Array("<input type=\"checkbox\" id=\"ck_all_opseae\" onclick=\"checkAll('opeseae')\" />","业务类别","委托编号","费用状态","主提单号","分提单号","委托单位","船名航次","开船日期","会计期间","目的港");
//width
var widthArgs_total = new Array("20","60","100","150","100","100","100","100","150","150","150");
//column align
var colAlignArgs_total = new Array("center","center","center","center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_total = new Array("na","str","str","str","str","str","str","str","str","str","str");
//column type
var colTypeArgs_total = new Array("ch","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro");
commonGridObj_total = new TGridCommon("mygrid_container_total","form1",headerArgs_total,widthArgs_total,colAlignArgs_total,colSortArgs_total,colTypeArgs_total);
commonGridObj_total.setResponseUrl("FeeAuditGridSource.aspx");
commonGridObj_total.setRequest("FeeAuditGridSource.aspx?handle=list&type=1&init=1&uid="+commonGridObj_total.newGuid());
commonGridObj_total.setSourceType("json");
commonGridObj_total.setSkin("xp");
commonGridObj_total.setImageUrl("../images/");
commonGridObj_total.initGrid();
commonGridObj_total.bind();
var headerArgs_recv = new Array("<input type=\"checkbox\" id=\"ck_all_recv\" onclick=\"checkAll('recv')\" />","费用状态","应收费用名称","结算单位","计费标准","单价","数量","佣金比例","金额","币别","汇率","FRT","费用备注","是否垫付");
var widthArgs_recv = new Array("20","100","150","100","100","80","50","60","70","70","70","70","70","80");
var colAlignArgs_recv = new Array("center","center","center","center","center","center","center","center","center","center","center","center","center","center");
var colSortArgs_recv = new Array("na","str","str","str","str","str","str","str","str","str","str","str","str","str");
var colTypeArgs_recv = new Array("ch","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ch");
commonGridObj_recv = new TGridCommon("mygrid_container_recv","form1",headerArgs_recv,widthArgs_recv,colAlignArgs_recv,colSortArgs_recv,colTypeArgs_recv);
commonGridObj_recv.setResponseUrl("FeeAuditGridSource.aspx");
commonGridObj_recv.setSourceType("json");
commonGridObj_recv.setSkin("xp");
commonGridObj_recv.setImageUrl("../images/");
commonGridObj_recv.initGrid();
var headerArgs_pay = new Array("<input type=\"checkbox\" id=\"ck_all_pay\" onclick=\"checkAll('pay')\" />","费用状态","应付费用名称","结算单位","计费标准","单价","数量","佣金比例","金额","币别","汇率","FRT","费用备注","是否垫付");
var widthArgs_pay = new Array("20","100","150","100","100","80","50","60","70","70","70","70","70","80");
var colAlignArgs_pay = new Array("center","center","center","center","center","center","center","center","center","center","center","center","center","center");
var colSortArgs_pay = new Array("na","str","str","str","str","str","str","str","str","str","str","str","str","str");
var colTypeArgs_pay = new Array("ch","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ch");
commonGridObj_pay = new TGridCommon("mygrid_container_pay","form1",headerArgs_pay,widthArgs_pay,colAlignArgs_pay,colSortArgs_pay,colTypeArgs_pay);
commonGridObj_pay.setResponseUrl("FeeAuditGridSource.aspx");
commonGridObj_pay.setSourceType("json");
commonGridObj_pay.setSkin("xp");
commonGridObj_pay.setImageUrl("../images/");
commonGridObj_pay.initGrid();
commonGridObj_total.getGridObj().enableEditEvents(true,false,true);
commonGridObj_total.getGridObj().enableKeyboardSupport(true);
commonGridObj_total.getGridObj().enableMultiselect(true);
commonGridObj_total.getGridObj().attachEvent("onRowDblClicked", function (rId, cInd) {
var rowIndex = commonGridObj_total.getGridObj().getRowIndex(rId);
var oplb = commonGridObj_total.getGridObj().cellByIndex(rowIndex, 1).getValue();
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl;
if (oplb == "海运出口") {
SelectRowOplb = "op_Seae";
openUrl = "../baseinfo/opseaebaseinfo.aspx?handle=check&bsno=" + rId;
} else if (oplb == "海运进口") {
SelectRowOplb = "op_Seai";
openUrl = "../baseinfo/opseaibaseinfo.aspx?handle=check&bsno=" + rId;
} else if (oplb == "内贸海运") {
SelectRowOplb = "op_Sean";
openUrl = "../baseinfo/opseaibaseinfo.aspx?handle=check&bsno="+rId;
} else if (oplb == "报关业务") {
SelectRowOplb = "op_Apply";
openUrl = "../MvcShipping/MsOpApply/ApplyFeeView?handle=check&bsno=" + rId;
} else if (oplb == "大宗散货") {
SelectRowOplb = "op_Bulk";
openUrl = "../MvcShipping/MsOpBulk/BulkFeeView?handle=check&bsno=" + rId;
} else if (oplb == "散杂运输") {
SelectRowOplb = "op_Other";
openUrl = "../MvcShipping/MsOpOther/OtherFeeView?handle=check&bsno=" + rId;
}
window.open(openUrl, openType, openSet);
});
commonGridObj_total.getGridObj().attachEvent("onSelectStateChanged", function (id) {
strBSNO = id;
var rowIndex = commonGridObj_total.getGridObj().getRowIndex(id);
var oplb = commonGridObj_total.getGridObj().cellByIndex(rowIndex, 1).getValue();
if (oplb == "海运出口") {
SelectRowOplb = "op_Seae";
} else if (oplb == "海运进口") {
SelectRowOplb = "op_Seai";
} else if (oplb == "内贸海运") {
SelectRowOplb = "op_Sean";
} else if (oplb == "报关业务") {
SelectRowOplb = "op_Apply";
} else if (oplb == "大宗散货") {
SelectRowOplb = "op_Bulk";
} else if (oplb == "散杂运输") {
SelectRowOplb = "op_Other";
}
commonGridObj_recv.loadafter = true;
commonGridObj_recv.after = function () {
markStatusColor(commonGridObj_recv.getGridObj());
}
commonGridObj_recv.initGrid();
commonGridObj_recv.setRequest("FeeAuditGridSource.aspx?handle=" + SelectRowOplb + "&type=2&bsno=" + id);
commonGridObj_recv.bind();
commonGridObj_recv.enableMultiselect(true);
commonGridObj_pay.loadafter = true;
commonGridObj_pay.after = function () {
markStatusColor(commonGridObj_pay.getGridObj());
}
commonGridObj_pay.initGrid();
commonGridObj_pay.setRequest("FeeAuditGridSource.aspx?handle=" + SelectRowOplb + "&type=3&bsno=" + id);
commonGridObj_pay.bind();
commonGridObj_pay.enableMultiselect(true);
getFeeProfit(id);
commonGridObj_recv.getGridObj().attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
if (stage == 0) {
if (cInd != 0) {
return false;
} else {
return true;
}
}
if (stage == 1) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
});
commonGridObj_pay.getGridObj().attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
if (stage == 0) {
if (cInd != 0) {
return false;
} else {
return true;
}
}
if (stage == 1) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
});
// setTimeout(function(){
// //checkAll("recv",1);
// markStatusColor(commonGridObj_recv.getGridObj());
// },200);
//
// setTimeout(function(){
// //checkAll("pay",1);
// markStatusColor(commonGridObj_pay.getGridObj());
// },300);
$("ck_all_recv").checked = 1;
$("ck_all_pay").checked = 1;
});
}
function markStatusColor(gridObj){
var count = gridObj.getRowsNum();
for(var i = 0;i<count;i++){
var status = gridObj.cellByIndex(i,1).getValue();
var rowId = gridObj.getRowId(i);
switch(status){
case "审核通过":
case "结算完毕":
case "部分结算":
gridObj.setRowColor(rowId,"#7FDF00");
break;
case "提交审核":
case "申请修改":
gridObj.setRowColor(rowId,"#ebf48a");
break;
case "驳回申请":
case "驳回提交":
gridObj.setRowColor(rowId,"#f53939");
break;
case "申请删除":
gridObj.setRowColor(rowId,"#9f9e9e");
break;
default:
break;
}
}
}
//function markSimpleStatusColor(gridObj,rowId,status,rowIndex){
// switch(status){
// case 0:alert();
// gridObj.setRowColor(rowId,"#7FDF00");alert();
// gridObj.cellByIndex(rowIndex,1).setValue("审核通过");
//
// break;
// case 2:
// gridObj.setRowColor(rowId,"#ebf48a");
// gridObj.cellByIndex(rowIndex,1).setValue("提交审核");
// break;
// case 6:
// case 7:
// gridObj.setRowColor(rowId,"#f53939");
// gridObj.cellByIndex(rowIndex,1).setValue("驳回提交");
// break;
// case 4:
// gridObj.setRowColor(rowId,"#9f9e9e");
// break;
// default:
// break;
// }
//}
//应收费用审核通过
function AuditingRecvAccepted(){
var selectCount = 0;
var auditCount = 0;
var unauditCount = 0;
var postBillNO = "";
var selectGroup = new Array();
for(var i = 0;i<commonGridObj_recv.getGridObj().getRowsNum();i++){
var ckbox = commonGridObj_recv.getGridObj().cellByIndex(i,0).getValue();
var status = commonGridObj_recv.getGridObj().cellByIndex(i,1).getValue();
var rowId = commonGridObj_recv.getGridObj().getRowId(i);
if(ckbox == 1){
if(status == "提交审核"){
selectGroup.push(rowId);
selectCount++;
}else{
unauditCount++;
}
}
}
// SelectRowOplb选中行的业务类别
if(selectCount > 0){
if(window.confirm("您确定批准通过所选应收费用")){
for(var j = 0;j<selectGroup.length;j++){
var urlVal = "";
urlVal = "AuditService.aspx?handle=auditpass&id="+selectGroup[j]+"&type=1&oplb="+SelectRowOplb+"&val="+commonGridObj_recv.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if(loadVal >= 0 ){
auditCount++;
if(auditCount == 1){
postBillNO = selectGroup[j];
}
var rowIndex = commonGridObj_recv.getGridObj().getRowIndex(selectGroup[j]);
//markSimpleStatusColor(commonGridObj_recv.getGridObj(),selectGroup[j],loadVal,rowIndex);
if(loadVal == 0){
commonGridObj_recv.getGridObj().setRowColor(selectGroup[j],"#7FDF00");
commonGridObj_recv.getGridObj().cellByIndex(rowIndex,1).setValue("审核通过");
}else if(loadVal == 1){
commonGridObj_recv.getGridObj().setRowColor(selectGroup[j],"#ebf48a");
commonGridObj_recv.getGridObj().cellByIndex(rowIndex,1).setValue("提交审核");
}else if(loadVal == 6 || loadVal == 7){
commonGridObj_recv.getGridObj().setRowColor(rowId,"#f53939");
commonGridObj_recv.getGridObj().cellByIndex(rowIndex,1).setValue("驳回提交");
}
}
}
// //commonGridObj_recv.setRequest("FeeAuditGridSource.aspx?handle=list&type=2&init=2&bsno="+id);
// commonGridObj_recv.setRequest("FeeAuditGridSource.aspx?handle=list&type=2&init=2&bsno="+strBSNO);
// commonGridObj_recv.loadafter = true;
// commonGridObj_recv.after = function(){
// markStatusColor(commonGridObj_recv.getGridObj());
// }
// commonGridObj_recv.reload();
// commonGridObj_recv.initGrid();
// commonGridObj_recv.bind();
// commonGridObj_recv.enableMultiselect(true);
//
// setTimeout(function(){
// markStatusColor(commonGridObj_recv.getGridObj());
// markStatusColor(commonGridObj_pay.getGridObj());
// },300);
if(auditCount > 0){
//向审核人发送申请消息
var postUrlVal = "../message/messageservice.aspx?billno="+postBillNO+"&type=7&oplb="+SelectRowOplb+"&handle=postmessage"+"&uid="+commonGridObj_recv.newGuid();;
var loader = dhtmlxAjax.getSync(postUrlVal);
var loadVal = loader.xmlDoc.responseText;
alert("审核成功");
}
//createGrid();
//setRefresh();
}
}
else{
if(unauditCount == 0){
alert("您没有选择要审核的费用内容");
}
}
}
//应付费用审核通过
function AuditingPayAllAccepted(){
var selectCount = 0;
var auditCount = 0;
var unauditCount = 0;
var postBillNO = "";
var selectGroup = new Array();
for(var i = 0;i<commonGridObj_pay.getGridObj().getRowsNum();i++){
var ckbox = commonGridObj_pay.getGridObj().cellByIndex(i,0).getValue();
var status = commonGridObj_pay.getGridObj().cellByIndex(i,1).getValue();
var rowId = commonGridObj_pay.getGridObj().getRowId(i);
if(ckbox == 1){
if(status == "提交审核"){
selectGroup.push(rowId);
selectCount++;
}else{
unauditCount++;
}
}
}
// SelectRowOplb选中行的业务类别
if(selectCount > 0){
if(window.confirm("您确定批准通过所选应付费用")){
for(var j = 0;j<selectGroup.length;j++){
var urlVal = "";
urlVal = "AuditService.aspx?handle=auditpass&id="+selectGroup[j]+"&type=2&oplb="+SelectRowOplb+"&val="+commonGridObj_recv.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if(loadVal >= 0 ){
auditCount++;
if(auditCount == 1){
postBillNO = selectGroup[j];
}
var rowIndex = commonGridObj_pay.getGridObj().getRowIndex(selectGroup[j]);
if(loadVal == 0){
commonGridObj_pay.getGridObj().setRowColor(selectGroup[j],"#7FDF00");
commonGridObj_pay.getGridObj().cellByIndex(rowIndex,1).setValue("审核通过");
}else if(loadVal == 1){
commonGridObj_pay.getGridObj().setRowColor(selectGroup[j],"#ebf48a");
commonGridObj_pay.getGridObj().cellByIndex(rowIndex,1).setValue("提交审核");
}else if(loadVal == 6 || loadVal == 7){
commonGridObj_pay.getGridObj().setRowColor(rowId,"#f53939");
commonGridObj_pay.getGridObj().cellByIndex(rowIndex,1).setValue("驳回提交");
}
}
}
// commonGridObj_pay.initGrid();
// commonGridObj_pay.bind();
// commonGridObj_pay.enableMultiselect(true);
//
// setTimeout(function(){
// markStatusColor(commonGridObj_recv.getGridObj());
// markStatusColor(commonGridObj_pay.getGridObj());
// },300);
// commonGridObj_pay.setRequest("FeeAuditGridSource.aspx?handle=list&type=3&init=2&bsno="+strBSNO);
// commonGridObj_pay.loadafter = true;
// commonGridObj_pay.after = function(){
// markStatusColor(commonGridObj_pay.getGridObj());
// }
// commonGridObj_pay.reload();
//
if(auditCount > 0){
var postUrlVal = "../message/messageservice.aspx?billno="+postBillNO+"&type=7&oplb="+SelectRowOplb+"&handle=postmessage"+"&uid="+commonGridObj_recv.newGuid();;
var loader = dhtmlxAjax.getSync(postUrlVal);
var loadVal = loader.xmlDoc.responseText;
alert("审核成功");
}
//createGrid();
//setRefresh();
}
}
else{
if(unauditCount == 0){
alert("您没有选择要审核的费用内容");
}
}
}
//刷新应收应付列表信息
function setRefresh() {
var id = commonGridObj_total.getGridObj().getSelectedRowId();
var rowIndex = commonGridObj_total.getGridObj().getRowIndex(id);
var oplb = commonGridObj_total.getGridObj().cellByIndex(rowIndex, 1).getValue();
if (oplb == "海运出口") {
SelectRowOplb = "op_Seae";
} else if (oplb == "海运进口") {
SelectRowOplb = "op_Seai";
} else if (oplb == "内贸海运") {
SelectRowOplb = "op_Sean";
} else if (oplb == "报关业务") {
SelectRowOplb = "op_Apply";
} else if (oplb == "大宗散货") {
SelectRowOplb = "op_Bulk";
} else if (oplb == "散杂运输") {
SelectRowOplb = "op_Other";
}
commonGridObj_recv.loadafter = true;
commonGridObj_recv.after = function () {
markStatusColor(commonGridObj_recv.getGridObj());
}
commonGridObj_recv.initGrid();
commonGridObj_recv.setRequest("FeeAuditGridSource.aspx?handle=" + SelectRowOplb + "&type=2&bsno=" + id);
commonGridObj_recv.bind();
commonGridObj_recv.enableMultiselect(true);
commonGridObj_pay.loadafter = true;
commonGridObj_pay.after = function () {
markStatusColor(commonGridObj_pay.getGridObj());
}
commonGridObj_pay.initGrid();
commonGridObj_pay.setRequest("FeeAuditGridSource.aspx?handle=" + SelectRowOplb + "&type=3&bsno=" + id);
commonGridObj_pay.bind();
commonGridObj_pay.enableMultiselect(true);
getFeeProfit(id);
commonGridObj_recv.getGridObj().attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
if (stage == 0) {
if (cInd != 0) {
return false;
} else {
return true;
}
}
if (stage == 1) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
});
commonGridObj_pay.getGridObj().attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
if (stage == 0) {
if (cInd != 0) {
return false;
} else {
return true;
}
}
if (stage == 1) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
});
}
//获取利润信息
function getFeeProfit(strBSNO){
if(strBSNO.trim() != ""){
var urlVal = "FeeAuditGridSource.aspx?handle="+SelectRowOplb+"&type=4&bsno="+strBSNO+"&val="+commonGridObj_recv.newGuid();
var loader = "";
loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
var jsonProfitObj = loadVal;
if(commonGridObj_total.IsNum(jsonProfitObj)){
jsonPageObj = null;
commonGridObj_total.$("dvRecvRMBVal").innerHTML = "";
commonGridObj_total.$("dvPayRMBVal").innerHTML = "";
commonGridObj_total.$("dvRMBProfitVal").innerHTML = "";
commonGridObj_total.$("dvUSRecvVal").innerHTML = "";
commonGridObj_total.$("dvUSPayVal").innerHTML = "";
commonGridObj_total.$("dvUSProfitVal").innerHTML = "";
commonGridObj_total.$("dvOtherCurrencyRecvVal").innerHTML = "";
commonGridObj_total.$("dvOtherCurrencyPayVal").innerHTML = "";
commonGridObj_total.$("dvOtherCurrencyProfitVal").innerHTML = "";
commonGridObj_total.$("dvRecvTotalVal").innerHTML = "";
commonGridObj_total.$("dvPaySumVal").innerHTML = "";
commonGridObj_total.$("dvProfitTotalVal").innerHTML = "";
commonGridObj_total.$("dvProfitRateVal").innerHTML = "";
}else{
jsonProfitObj = eval('(' + loadVal + ')');
commonGridObj_total.$("dvRecvRMBVal").innerHTML = jsonProfitObj.columns[0].rmbdr;
commonGridObj_total.$("dvPayRMBVal").innerHTML = jsonProfitObj.columns[0].rmbcr;
commonGridObj_total.$("dvRMBProfitVal").innerHTML = jsonProfitObj.columns[0].rmbprofit;
commonGridObj_total.$("dvUSRecvVal").innerHTML = jsonProfitObj.columns[0].usddr;
commonGridObj_total.$("dvUSPayVal").innerHTML = jsonProfitObj.columns[0].usdcr;
commonGridObj_total.$("dvUSProfitVal").innerHTML = jsonProfitObj.columns[0].usdprofit;
commonGridObj_total.$("dvOtherCurrencyRecvVal").innerHTML = jsonProfitObj.columns[0].otdr;
commonGridObj_total.$("dvOtherCurrencyPayVal").innerHTML = jsonProfitObj.columns[0].otcr;
commonGridObj_total.$("dvOtherCurrencyProfitVal").innerHTML = jsonProfitObj.columns[0].otprofit;
commonGridObj_total.$("dvRecvTotalVal").innerHTML = jsonProfitObj.columns[0].drttl;
commonGridObj_total.$("dvPaySumVal").innerHTML = jsonProfitObj.columns[0].crttl;
commonGridObj_total.$("dvProfitTotalVal").innerHTML = jsonProfitObj.columns[0].ttlprofit;
commonGridObj_total.$("dvProfitRateVal").innerHTML = jsonProfitObj.columns[0].profitrate;
}
}else{
commonGridObj_total.$("dvRecvRMBVal").innerHTML = "";
commonGridObj_total.$("dvPayRMBVal").innerHTML = "";
commonGridObj_total.$("dvRMBProfitVal").innerHTML = "";
commonGridObj_total.$("dvUSRecvVal").innerHTML = "";
commonGridObj_total.$("dvUSPayVal").innerHTML = "";
commonGridObj_total.$("dvUSProfitVal").innerHTML = "";
commonGridObj_total.$("dvOtherCurrencyRecvVal").innerHTML = "";
commonGridObj_total.$("dvOtherCurrencyPayVal").innerHTML = "";
commonGridObj_total.$("dvOtherCurrencyProfitVal").innerHTML = "";
commonGridObj_total.$("dvRecvTotalVal").innerHTML = "";
commonGridObj_total.$("dvPaySumVal").innerHTML = "";
commonGridObj_total.$("dvProfitTotalVal").innerHTML = "";
commonGridObj_total.$("dvProfitRateVal").innerHTML = "";
}
}
//驳回应收费用提交
function RejectRecvApply(){
var selectCount = 0;
var auditCount = 0;
var unauditCount = 0;
var auditSuccess = 0;
var runCount = 0;
var noPower = 0;
var errorCount = 0;
var selectGroup = new Array();
var postBillNO = "";
for(var i = 0;i<commonGridObj_recv.getGridObj().getRowsNum();i++){
var ckbox = commonGridObj_recv.getGridObj().cellByIndex(i,0).getValue();
var status = commonGridObj_recv.getGridObj().cellByIndex(i,1).getValue();
var rowId = commonGridObj_recv.getGridObj().getRowId(i);
if(ckbox == 1){
if(status == "提交审核" || status == "审核通过"){
selectGroup.push(rowId);
selectCount++;
}else{
unauditCount++;
}
}
}
//SelectRowOplb 选中行的业务类别
if(selectCount > 0){
if(window.confirm("您确定批准通过所选应收费用")){
for(var j = 0;j<selectGroup.length;j++){
var urlVal = "";
urlVal = "AuditService.aspx?handle=reject&id="+selectGroup[j]+"&type=1&oplb="+SelectRowOplb+"&val="+commonGridObj_recv.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if(loadVal >= 0 ){
auditCount++;
if(auditCount == 1){
postBillNO = selectGroup[j];
}
var rowIndex = commonGridObj_recv.getGridObj().getRowIndex(selectGroup[j]);
//commonGridObj_recv.getGridObj().cellByIndex(rowIndex,1).setValue("驳回提交");
if(loadVal == 0){
commonGridObj_recv.getGridObj().setRowColor(selectGroup[j],"#7FDF00");
commonGridObj_recv.getGridObj().cellByIndex(rowIndex,1).setValue("审核通过");
}else if(loadVal == 1){
commonGridObj_recv.getGridObj().setRowColor(selectGroup[j],"#ebf48a");
commonGridObj_recv.getGridObj().cellByIndex(rowIndex,1).setValue("提交审核");
}else if(loadVal == 6 || loadVal == 7){
commonGridObj_recv.getGridObj().setRowColor(rowId,"#f53939");
commonGridObj_recv.getGridObj().cellByIndex(rowIndex,1).setValue("驳回提交");
}
}else{
if(loadVal == -6){
runCount++;
}else if(loadVal == -3){
noPower++;
}else{
errorCount++;
}
}
}
// commonGridObj_recv.initGrid();
// commonGridObj_recv.bind();
// commonGridObj_recv.enableMultiselect(true);
// setTimeout(function(){
// markStatusColor(commonGridObj_recv.getGridObj());
// markStatusColor(commonGridObj_pay.getGridObj());
// },300);
//alert("审核 共计"+selectCount+"条 成功"+auditCount+"条 没有权限审核 "+noPower+"条 异常错误 "+errorCount+"条 费用已进行结算不能审核 "+runCount+" 条");
if(auditCount > 0){
//向审核人发送申请消息
var postUrlVal = "../message/messageservice.aspx?billno="+postBillNO+"&type=8&oplb="+SelectRowOplb+"&handle=postmessage"+"&uid="+commonGridObj_recv.newGuid();;
var loader = dhtmlxAjax.getSync(postUrlVal);
var loadVal = loader.xmlDoc.responseText;
alert("驳回完成");
}
}
}
else{
if(unauditCount == 0){
alert("您没有选择要审核的费用内容");
}
}
//createGrid();
//setRefresh();
}
//驳回应付费用提交
function RejectPayApply(){
var selectCount = 0;
var auditCount = 0;
var unauditCount = 0;
var auditSuccess = 0;
var runCount = 0;
var noPower = 0;
var errorCount = 0;
var postBillNO = "";
var selectGroup = new Array();
for(var i = 0;i<commonGridObj_pay.getGridObj().getRowsNum();i++){
var ckbox = commonGridObj_pay.getGridObj().cellByIndex(i,0).getValue();
var status = commonGridObj_pay.getGridObj().cellByIndex(i,1).getValue();
var rowId = commonGridObj_pay.getGridObj().getRowId(i);
if(ckbox == 1){
if(status == "提交审核"|| status == "审核通过"){
selectGroup.push(rowId);
selectCount++;
}else{
unauditCount++;
}
}
}
//SelectRowOplb 选中行的业务类别
if(selectCount > 0){
if (window.confirm("您确定操作所选应付费用")) {//批准通过
var iError = 0;
for(var j = 0;j<selectGroup.length;j++){
var urlVal = "AuditService.aspx?handle=reject&id="+selectGroup[j]+"&type=2&oplb="+SelectRowOplb+"&val="+commonGridObj_recv.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if(loadVal >= 0 ){
auditCount++;
if(auditCount == 1){
postBillNO = selectGroup[j];
}
var rowIndex = commonGridObj_pay.getGridObj().getRowIndex(selectGroup[j]);
//commonGridObj_pay.getGridObj().cellByIndex(rowIndex,1).setValue("驳回提交");
if(loadVal == 0){
commonGridObj_pay.getGridObj().setRowColor(selectGroup[j],"#7FDF00");
commonGridObj_pay.getGridObj().cellByIndex(rowIndex,1).setValue("审核通过");
}else if(loadVal == 1){
commonGridObj_pay.getGridObj().setRowColor(selectGroup[j],"#ebf48a");
commonGridObj_pay.getGridObj().cellByIndex(rowIndex,1).setValue("提交审核");
}else if(loadVal == 6 || loadVal == 7){
commonGridObj_pay.getGridObj().setRowColor(rowId,"#f53939");
commonGridObj_pay.getGridObj().cellByIndex(rowIndex,1).setValue("驳回提交");
}
}else{
if(loadVal == -6){
runCount++;
}else if(loadVal == -3){
noPower++;
}else if(loadVal == -10){
iError++;
}else{
errorCount++;
}
}
}
//
if (iError > 0) {
alert("注意:已经做收付费申请或发票申请的费用,不允许驳回申请!");
}
//
if(auditCount > 0){
//向审核人发送申请消息
var postUrlVal = "../message/messageservice.aspx?billno="+postBillNO+"&type=8&oplb="+SelectRowOplb+"&handle=postmessage"+"&uid="+commonGridObj_recv.newGuid();;
var loader = dhtmlxAjax.getSync(postUrlVal);
var loadVal = loader.xmlDoc.responseText;
alert("操作完成");//驳回完成
}
}
}
else{
if(unauditCount == 0){
alert("您没有选择要审核的费用内容");
}
}
//createGrid();
//setRefresh();
}
function orderRecvModify(){//应收费用“禁开发票”
}
function orderRecvAudit(){//应收费用解禁发票
}
function query(){
openNewDiv("kl");
}
function applyRecvHistory(){
var iCount = 0;
var recvArg = new Array();
var bsno = "";
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){
if(recvArg.length > 0){
var exsitHistory = 0;
var url = "AuditService.aspx?id="+recvArg[0]+"&handle=history&uid="+commonGridObj_recv.newGuid();
var loader = dhtmlxAjax.getSync(url);
var exsitHistory = loader.xmlDoc.responseText;
// if(status.trim() == "申请修改" || status.trim() == "驳回申请" || status.trim() == "申请通过"){
if(exsitHistory > 0){
var openUrl = "../Shipping/FeeModify.aspx?id="+recvArg[0]+"&oplb="+SelectRowOplb+"&type=1&bsno="+bsno+"&handle=3";
window.open (openUrl, "_blank", "height=470, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=no,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();
var bsno = "";
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){
if(recvArg.length > 0){
var exsitHistory = 0;
var url = "AuditService.aspx?id="+recvArg[0]+"&handle=history&uid="+commonGridObj_pay.newGuid();
var loader = dhtmlxAjax.getSync(url);
var exsitHistory = loader.xmlDoc.responseText;
//if(status.trim() == "申请修改" || status.trim() == "驳回申请" || status.trim() == "申请通过"){
if(exsitHistory > 0){
var openUrl = "../Shipping/FeeModify.aspx?id="+recvArg[0]+"&oplb"+SelectRowOplb+"&type=2&bsno="+bsno+"&handle=3";
window.open (openUrl, "_blank", "height=470, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-470)/2 + ",Left= "+(screen.width-900)/2);
}else{
alert("没有申请历史记录");
}
}
}else if(iCount > 1){
alert("每次只能查看一条费用历史记录,请重新选择要查看的费用");
}else{
alert("未选中要操作的费用项");
}
}
function search(){
var selCustNo = $("sel_custno").value.trim();
var txtCustNo = $("txt_custno").value.trim();
var selMblno = $("sel_mblno").value.trim();
var txtMblno = $("txt_mblno").value.trim();
var selHblno = $("sel_hblno").value.trim();
var txtHblno = $("txt_hblno").value.trim();
var selCustname = $("sel_custname").value.trim();
var txtCustname = $("txt_custname").value.trim();
var selVessel = $("sel_vessel").value.trim();
var txtVessel = $("txt_vessel").value.trim();
var selDestination = $("sel_destination").value.trim();
var txtDestination = $("txt_destination").value.trim();
var txtBeginEtd = $("txt_beginetd").value.trim();
var txtEndEtd = $("txt_endetd").value.trim();
var txtBeginAcc = $("txt_beginacc").value.trim();
var txtEndAcc = $("txt_endacc").value.trim();
var searchJson = "";
//begin
searchJson +="{";
searchJson += "[";
searchJson += "\"cusno\":\""+ txtCustNo +"\",";
searchJson += "\"cusno2\":\""+ selCustNo +"\",";
searchJson += "\"mblno\":\""+ txtMblno +"\",";
searchJson += "\"mblno2\":\""+ selMblno +"\",";
searchJson += "\"hblno\":\""+ txtHblno +"\",";
searchJson += "\"hblno2\":\""+ selHblno +"\",";
searchJson += "\"cus\":\""+ txtCustname +"\",";
searchJson += "\"cus2\":\""+ selCustname +"\",";
searchJson += "\"vessel\":\""+ txtVessel +"\",";
searchJson += "\"vessel2\":\""+ selVessel +"\",";
searchJson += "\"dest\":\""+ txtDestination +"\",";
searchJson += "\"dest2\":\""+ selDestination +"\",";
searchJson += "\"etdb\":\""+ txtBeginEtd +"\",";
searchJson += "\"etde\":\""+ txtEndEtd +"\",";
searchJson += "\"accb\":\""+ txtBeginAcc +"\",";
searchJson += "\"acce\":\""+ txtEndAcc +"\"";
searchJson += "]";
searchJson +="}";
searchCondition = searchJson;
commonGridObj_total.setRequest("FeeAuditGridSource.aspx?handle=list&type=1&init=2&search="+escape(searchJson)+"&uid="+commonGridObj_total.newGuid());
// commonGridObj_total.setRequest("FeeAuditGridSource.aspx?handle=list&type=1&init=1&search="+escape(searchJson)+"&uid="+commonGridObj_total.newGuid());
commonGridObj_total.initGrid();
commonGridObj_total.bind();
commonGridObj_pay.initGrid();
commonGridObj_recv.initGrid();
commonGridObj_total.getGridObj().attachEvent("onRowDblClicked", function (rId, cInd) {
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
var rowIndex = commonGridObj_total.getGridObj().getRowIndex(rId);
var oplb = commonGridObj_total.getGridObj().cellByIndex(rowIndex, 1).getValue();
if (oplb == "海运出口") {
SelectRowOplb = "op_Seae";
openUrl = "../baseinfo/opseaebaseinfo.aspx?handle=check&bsno=" + rId;
} else if (oplb == "海运进口") {
SelectRowOplb = "op_Seai";
//openUrl = "../baseinfo/opseaibaseinfo.aspx?handle=check&bsno=" + rId;
openUrl = "../MvcShipping/MsOpOther/OtherFeeView?handle=check&bsno=" + rId;
} else if (oplb == "内贸海运") {
SelectRowOplb = "op_Sean";
openUrl = "../baseinfo/opseaibaseinfo.aspx?handle=check&bsno="+rId;
} else if (oplb == "报关业务") {
SelectRowOplb = "op_Apply";
openUrl = "../MvcShipping/MsOpApply/ApplyFeeView?handle=check&bsno=" + rId;
} else if (oplb == "大宗散货") {
SelectRowOplb = "op_Bulk";
openUrl = "../MvcShipping/MsOpBulk/BulkFeeView?handle=check&bsno=" + rId;
} else if (oplb == "散杂运输") {
SelectRowOplb = "op_Other";
openUrl = "../MvcShipping/MsOpOther/OtherFeeView?handle=check&bsno=" + rId;
}
window.open(openUrl, openType, openSet);
});
commonGridObj_total.getGridObj().attachEvent("onSelectStateChanged", function (id) {
var rowIndex = commonGridObj_total.getGridObj().getRowIndex(id);
var oplb = commonGridObj_total.getGridObj().cellByIndex(rowIndex, 1).getValue();
if (oplb == "海运出口") {
SelectRowOplb = "op_Seae";
} else if (oplb == "海运进口") {
SelectRowOplb = "op_Seai";
} else if (oplb == "内贸海运") {
SelectRowOplb = "op_Sean";
} else if (oplb == "报关业务") {
SelectRowOplb = "op_Apply";
} else if (oplb == "大宗散货") {
SelectRowOplb = "op_Bulk";
} else if (oplb == "散杂运输") {
SelectRowOplb = "op_Other";
}
commonGridObj_recv.loadafter = true;
commonGridObj_recv.after = function () {
markStatusColor(commonGridObj_recv.getGridObj());
}
commonGridObj_recv.initGrid();
commonGridObj_recv.setRequest("FeeAuditGridSource.aspx?handle=" + SelectRowOplb + "&type=2&init=2&bsno=" + id);
commonGridObj_recv.bind();
commonGridObj_recv.enableMultiselect(true);
commonGridObj_pay.loadafter = true;
commonGridObj_pay.after = function () {
markStatusColor(commonGridObj_pay.getGridObj());
}
commonGridObj_pay.initGrid();
commonGridObj_pay.setRequest("FeeAuditGridSource.aspx?handle=" + SelectRowOplb + "&type=3&init=2&bsno=" + id);
commonGridObj_pay.bind();
commonGridObj_pay.enableMultiselect(true);
getFeeProfit(id);
commonGridObj_recv.getGridObj().attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
if (cInd == 0) {
return true;
} else {
return false;
}
if (stage == 1) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
});
commonGridObj_pay.getGridObj().attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
if (stage == 0) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
if (stage == 1) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
});
setTimeout(function () {
markStatusColor(commonGridObj_recv.getGridObj());
markStatusColor(commonGridObj_pay.getGridObj());
}, 100);
// checkAll("recv",1);
// checkAll("pay",1);
$("ck_all_recv").checked = 1;
$("ck_all_pay").checked = 1;
});
getFeeProfit("");//清空利润信息
closeSearch("kl");
}
function closeSearch(id){
document.body.removeChild(docEle(id));
document.body.removeChild(docEle("mask"));
}
var docEle = function() {
return document.getElementById(arguments[0]) || false;
}
function openNewDiv(_id) {
var m = "mask";
if (docEle(_id)) document.removeChild(docEle(_id));
if (docEle(m)) document.removeChild(docEle(m));
// 新激活图层
var newDiv = document.createElement("div");
newDiv.id = _id;
newDiv.style.position = "absolute";
newDiv.style.zIndex = "9999";
newDiv.style.width = "500px";
newDiv.style.height = "200px";
newDiv.style.top = "100px";
newDiv.style.left = (parseInt(document.body.scrollWidth) - 600) / 2 + "px"; // 屏幕居中
newDiv.style.background = "#EFEFEF";
newDiv.style.border = "1px solid #860001";
newDiv.style.padding = "5px";
newDiv.innerHTML = "<div style=\"font-size:12px; height:30px;\">信息检索</div>"
+"<table style=\"width:400px; padding:0; border:0;\"><tr>"
+"<td width=\"60px\"><div id=\"dvCustno\" style=\"width:60px; text-align:right;font-size:12px;\">委托编号:</div></td>"
+"<td width=\"40px\"><select id=\"sel_custno\" class=\"txtTab\"><option value=\"0\">模糊</option><option value=\"1\">等于</option></select></td>"
+"<td width=\"120px\"><input type=\"text\" id=\"txt_custno\" style=\"width:120px;\" class=\"txtTab\"/></td>"
+"<td width=\"60px\" align=\"right\"><div id=\"dvMBLNO\" style=\"width:60px; text-align:right;font-size:12px;\">主提单号:</div></td>"
+"<td width=\"40px\"><select id=\"sel_mblno\" class=\"txtTab\"><option value=\"0\">模糊</option><option value=\"1\">等于</option></select></td>"
+"<td width=\"120px\"><input type=\"text\" id=\"txt_mblno\" style=\"width:120px;\" class=\"txtTab\"/></td>"
+"</tr><tr>"
+"<td width=\"60px\"><div id=\"dvHBLNO\" style=\"width:60px; text-align:right;font-size:12px;\">分提单号:</div></td>"
+"<td width=\"40px\"><select id=\"sel_hblno\" class=\"txtTab\"><option value=\"0\">模糊</option><option value=\"1\">等于</option></select></td>"
+"<td width=\"120px\"><input type=\"text\" id=\"txt_hblno\" style=\"width:120px\" class=\"txtTab\"/></td>"
+"<td width=\"60px\"><div id=\"dvCustname\" style=\"width:60px; text-align:right;font-size:12px;\">委托单位:</div></td>"
+"<td width=\"40px\"><select id=\"sel_custname\" class=\"txtTab\"><option value=\"0\">模糊</option><option value=\"1\">等于</option></select></td>"
+"<td width=\"120px\"><input type=\"text\" id=\"txt_custname\" style=\"width:120px\" class=\"txtTab\"/></td>"
+"</tr><tr>"
+"<td width=\"60px\"><div id=\"dvVessel\" style=\"width:60px; text-align:right;font-size:12px;\">船名航次:</div></td>"
+"<td width=\"40px\"><select id=\"sel_vessel\" class=\"txtTab\"><option value=\"0\">模糊</option><option value=\"1\">等于</option></select></td>"
+"<td width=\"120px\"><input type=\"text\" id=\"txt_vessel\" style=\"width:120px\" class=\"txtTab\"/></td>"
+"<td width=\"60px\"><div id=\"dvDestination\" style=\"width:60px; text-align:right;font-size:12px;\">目的港:</div></td>"
+"<td width=\"40px\"><select id=\"sel_destination\" class=\"txtTab\"><option value=\"0\">模糊</option><option value=\"1\">等于</option></select></td>"
+"<td width=\"120px\"><input type=\"text\" id=\"txt_destination\" style=\"width:120px\" class=\"txtTab\"/></td>"
+"</tr><tr>"
+"<td width=\"60px\"><div id=\"dvCustname\" style=\"width:60px; text-align:right;font-size:12px;\">开船日期:</div></td>"
+"<td width=\"160px\" colspan=\"2\"><div style=\"width:70px; padding:0; margin:0; float:left\"><input type=\"text\" id=\"txt_beginetd\" style=\"width:70px\" class=\"txtTab\" onclick=\"WdatePicker()\" /></div>"
+"<div style=\"width:20px; padding:0; margin:0; float:left; text-align:center;\"></div>"
+"<div style=\"width:70px; padding:0; margin:0; float:left\"><input type=\"text\" id=\"txt_endetd\" style=\"width:70px\" class=\"txtTab\" onclick=\"WdatePicker()\"/></div></td>"
+"<td width=\"60px\"><div id=\"dvAccdate\" style=\"width:60px; text-align:righ;font-size:12px;\">会计期间</div></td>"
+ "<td width=\"160px\" colspan=\"2\"><div style=\"width:70px; padding:0; margin:0; float:left\"><input type=\"text\" id=\"txt_beginacc\" style=\"width:70px\" class=\"txtTab\" onclick=\"WdatePicker({dateFmt:'yyyy-M'});\"/></div>"
+"<div style=\"width:20px; padding:0; margin:0; float:left; text-align:center;\"></div>"
+ "<div style=\"width:70px; padding:0; margin:0; float:left\"><input type=\"text\" id=\"txt_endacc\" style=\"width:70px\" class=\"txtTab\" onclick=\"WdatePicker({dateFmt:'yyyy-M'});\"/></div>"
+"</td></tr><tr><td colspan=\"6\"><div style=\"float:left;width:100px;\"></div><div style=\"float:left;padding-top:20px;\" >"
+"<input type=\"button\" id=\"btn_search\" value=\"查询\" class=\"btn\" onclick=\"search()\"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"button\" id=\"btn_search\" value=\"退出\" onclick=\"closeSearch('kl')\" class=\"btn\"/></div>"
+"</td></tr></table>";
document.body.appendChild(newDiv);
// mask图层
var newMask = document.createElement("div");
newMask.id = m;
newMask.style.position = "absolute";
newMask.style.zIndex = "1";
newMask.style.width = document.body.scrollWidth + "px";
newMask.style.height = document.body.scrollHeight + "px";
newMask.style.top = "0px";
newMask.style.left = "0px";
newMask.style.background = "#000";
newMask.style.filter = "alpha(opacity=40)";
newMask.style.opacity = "0.40";
document.body.appendChild(newMask);
// 关闭mask和新图层
// var saveButton = document.createElement("a");
// saveButton.href = "#";
// saveButton.innerHTML = "确定";
// saveButton.className="regular";
// saveButton.onclick = function() {
//
// //document.body.removeChild(docEle(_id));
// //document.body.removeChild(docEle(m));
// //return false;
// }
// newDiv.appendChild(saveButton);
//
// //newDiv.innerHTML += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
//
// var cancelButton = document.createElement("a");
// cancelButton.href = "#";
// cancelButton.innerHTML = "取消";
// cancelButton.className="regular";
// cancelButton.onclick = function() {
// document.body.removeChild(docEle(_id));
// document.body.removeChild(docEle(m));
//
// return false;
// }
// newDiv.appendChild(cancelButton);
}
function refreshList(){
createGrid();
commonGridObj_total.$("dvRecvRMBVal").innerHTML = "";
commonGridObj_total.$("dvPayRMBVal").innerHTML = "";
commonGridObj_total.$("dvRMBProfitVal").innerHTML = "";
commonGridObj_total.$("dvUSRecvVal").innerHTML = "";
commonGridObj_total.$("dvUSPayVal").innerHTML = "";
commonGridObj_total.$("dvUSProfitVal").innerHTML = "";
commonGridObj_total.$("dvOtherCurrencyRecvVal").innerHTML = "";
commonGridObj_total.$("dvOtherCurrencyPayVal").innerHTML = "";
commonGridObj_total.$("dvOtherCurrencyProfitVal").innerHTML = "";
commonGridObj_total.$("dvRecvTotalVal").innerHTML = "";
commonGridObj_total.$("dvPaySumVal").innerHTML = "";
commonGridObj_total.$("dvProfitTotalVal").innerHTML = "";
commonGridObj_total.$("dvProfitRateVal").innerHTML = "";
}
function checkAll(objName,iType){
if(objName == "recv"){
if(commonGridObj_recv != null){
if(commonGridObj_recv.getGridObj().getRowsNum() > 0){
if(iType != null){
for(var i = 0;i<commonGridObj_recv.getGridObj().getRowsNum();i++){
commonGridObj_recv.getGridObj().cellByIndex(i,0).setValue(1);
}
}else{
if($("ck_all_recv").checked){
for(var i = 0;i<commonGridObj_recv.getGridObj().getRowsNum();i++){
commonGridObj_recv.getGridObj().cellByIndex(i,0).setValue(1);
}
}else{
for(var i = 0;i<commonGridObj_recv.getGridObj().getRowsNum();i++){
commonGridObj_recv.getGridObj().cellByIndex(i,0).setValue(0);
}
}
}
}
}
}
if(objName == "pay"){
if(commonGridObj_pay != null){
if(commonGridObj_pay.getGridObj().getRowsNum() > 0){
if(iType != null){
for(var i = 0;i<commonGridObj_pay.getGridObj().getRowsNum();i++){
commonGridObj_pay.getGridObj().cellByIndex(i,0).setValue(1);
}
}else{
if($("ck_all_pay").checked){
for(var i = 0;i<commonGridObj_pay.getGridObj().getRowsNum();i++){
commonGridObj_pay.getGridObj().cellByIndex(i,0).setValue(1);
}
}else{
for(var i = 0;i<commonGridObj_pay.getGridObj().getRowsNum();i++){
commonGridObj_pay.getGridObj().cellByIndex(i,0).setValue(0);
}
}
}
}
}
}
if(objName == "opeseae"){
if(commonGridObj_total != null){
if(commonGridObj_total.getGridObj().getRowsNum() > 0){
if(iType != null){
for(var i = 0;i<commonGridObj_total.getGridObj().getRowsNum();i++){
commonGridObj_total.getGridObj().cellByIndex(i,0).setValue(1);
}
}else{
if($("ck_all_opseae").checked){
for(var i = 0;i<commonGridObj_total.getGridObj().getRowsNum();i++){
commonGridObj_total.getGridObj().cellByIndex(i,0).setValue(1);
}
}else{
for(var i = 0;i<commonGridObj_total.getGridObj().getRowsNum();i++){
commonGridObj_total.getGridObj().cellByIndex(i,0).setValue(0);
}
}
}
}
}
}
}
//批量审核通过
function batchAuditPass(){
var selectCount = 0;
var auditCount = 0;
var unauditCount = 0;
var selectGroup = new Array();
var selectGroupoplb = new Array();
var stroplb="";//业务类型
for(var i = 0;i<commonGridObj_total.getGridObj().getRowsNum();i++){
var ckbox = commonGridObj_total.getGridObj().cellByIndex(i,0).getValue();
var oplb = commonGridObj_total.getGridObj().cellByIndex(i,1).getValue();
if (oplb == "海运进口") {
stroplb = "op_Seai";
} else if (oplb == "海运出口") {
stroplb = "op_Seae";
} else if (oplb == "内贸海运") {
stroplb = "op_Sean";
}else if (oplb == "报关业务") {
stroplb = "op_Apply";
}else if (oplb == "大宗散货") {
stroplb = "op_Bulk";
} else if (oplb == "散杂运输") {
stroplb = "op_Other";
}
var rowId = commonGridObj_total.getGridObj().getRowId(i);
if(ckbox == 1){
selectGroup.push(rowId);
selectGroupoplb.push(stroplb);
selectCount++;
}else{
unauditCount++;
}
}
if(selectCount > 0){
if(window.confirm("您确定批准通过所选委托业务内所有待审核的费用")){
for(var j = 0;j<selectGroup.length;j++){
var urlVal = "";
urlVal = "AuditService.aspx?handle=batchpass&bsno="+selectGroup[j]+"&oplb="+selectGroupoplb[j]+"&val="+commonGridObj_total.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if(loadVal > 0 ){
auditCount++;
}
}
// for(var i = 0;i<commonGridObj_recv.getGridObj().getRowsNum();i++){
// var rowId = commonGridObj_recv.getGridObj().getRowId(i);
// var rowIndex = commonGridObj_recv.getGridObj().getRowIndex(rowId);
// var urlVal = "";
// urlVal = "AuditService.aspx?handle=getstatus&id="+rowId+"&val="+commonGridObj_recv.newGuid();
// var loader = dhtmlxAjax.getSync(urlVal);
// var loadVal = loader.xmlDoc.responseText;
// if(loadVal >= 0 ){
// if(loadVal == 0){
// commonGridObj_recv.getGridObj().setRowColor(rowId,"#7FDF00");
// commonGridObj_recv.getGridObj().cellByIndex(rowIndex,1).setValue("审核通过");
// }else if(loadVal == 1){
// commonGridObj_recv.getGridObj().setRowColor(rowId,"#ebf48a");
// commonGridObj_recv.getGridObj().cellByIndex(rowIndex,1).setValue("提交审核");
// }else if(loadVal == 6 || loadVal == 7){
// commonGridObj_recv.getGridObj().setRowColor(rowId,"#f53939");
// commonGridObj_recv.getGridObj().cellByIndex(rowIndex,1).setValue("驳回提交");
// }
// }
// }
//
// for(var i = 0;i<commonGridObj_pay.getGridObj().getRowsNum();i++){
// var rowId = commonGridObj_pay.getGridObj().getRowId(i);
// var rowIndex = commonGridObj_pay.getGridObj().getRowIndex(rowId);
// var urlVal = "";
// urlVal = "AuditService.aspx?handle=getstatus&id="+rowId+"&val="+commonGridObj_pay.newGuid();
// var loader = dhtmlxAjax.getSync(urlVal);
// var loadVal = loader.xmlDoc.responseText;
// if(loadVal >= 0 ){
// if(loadVal == 0){
// commonGridObj_pay.getGridObj().setRowColor(rowId,"#7FDF00");
// commonGridObj_pay.getGridObj().cellByIndex(rowIndex,1).setValue("审核通过");
// }else if(loadVal == 2){
// commonGridObj_pay.getGridObj().setRowColor(rowId,"#ebf48a");
// commonGridObj_pay.getGridObj().cellByIndex(rowIndex,1).setValue("提交审核");
// }else if(loadVal == 6 || loadVal == 7){
// commonGridObj_pay.getGridObj().setRowColor(rowId,"#f53939");
// commonGridObj_pay.getGridObj().cellByIndex(rowIndex,1).setValue("驳回提交");
// }
// }
// }
//reloadInfo();
// commonGridObj_total.getGridObj().attachEvent("onSelectStateChanged", function(id){
// var rowIndex = commonGridObj_total.getGridObj().getRowIndex(id);
// var oplb=commonGridObj_total.getGridObj().cellByIndex(rowIndex,1).getValue();
//
// if(oplb=="海运出口"){ SelectRowOplb="op_Seae";
// }else if(oplb=="海运进口"){SelectRowOplb="op_Seai";
// }
//
// commonGridObj_recv.loadafter = true;
// commonGridObj_recv.after = function(){
// markStatusColor(commonGridObj_recv.getGridObj());
// }
// commonGridObj_recv.initGrid();
// commonGridObj_recv.setRequest("FeeAuditGridSource.aspx?handle="+SelectRowOplb+"&type=2&init=2&bsno="+id);
// commonGridObj_recv.bind();
// commonGridObj_recv.enableMultiselect(true);
//
// commonGridObj_pay.loadafter = true;
// commonGridObj_pay.after = function(){
// markStatusColor(commonGridObj_pay.getGridObj());
// }
//
// commonGridObj_pay.initGrid();
// commonGridObj_pay.setRequest("FeeAuditGridSource.aspx?handle="+SelectRowOplb+"&type=3&init=2&bsno="+id);
// commonGridObj_pay.bind();
//
// commonGridObj_pay.enableMultiselect(true);
//
//
// getFeeProfit(id);
//// commonGridObj_recv.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
//// if(cInd == 0){
//// return true;
//// }else{
//// return false;
//// }
//// if(stage == 1){
//// if(cInd == 0){
//// return true;
//// }else{
//// return false;
//// }
//// }
//// });
//// commonGridObj_pay.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
//// if(stage == 0){
//// if(cInd == 0){
//// return true;
//// }else{
//// return false;
//// }
//// }
//// if(stage == 1){
//// if(cInd == 0){
//// return true;
//// }else{
//// return false;
//// }
//// }
//// });
//
//// setTimeout(function(){
//// markStatusColor(commonGridObj_recv.getGridObj());
//// markStatusColor(commonGridObj_pay.getGridObj());
//// },100);
//
// // checkAll("recv",1);
// // checkAll("pay",1);
// $("ck_all_recv").checked = 1;
// $("ck_all_pay").checked = 1;
// });
if(auditCount>=1){
alert("批量审核成功!");
createGrid();
}
}
}
else {
if(unauditCount == 0||unauditCount==1){
alert("您没有选择要审核的费用内容");
}
}
}
//批量加锁
function batchtLock(){
var selectCount = 0;
var auditCount = 0;
var unauditCount = 0;
var unfinishfee = 0;
var selectGroup = new Array();
var selectGroupoplb = new Array();
for(var i = 0;i<commonGridObj_total.getGridObj().getRowsNum();i++){
var ckbox = commonGridObj_total.getGridObj().cellByIndex(i,0).getValue();
var rowId = commonGridObj_total.getGridObj().getRowId(i);
var oplb = commonGridObj_total.getGridObj().cellByIndex(i,1).getValue();
var stroplb="";
if (oplb == "海运进口") {
stroplb = "op_Seai";
} else if (oplb == "海运出口") {
stroplb = "op_Seae";
} else if (oplb == "内贸海运") {
stroplb = "op_Sean";
}else if (oplb == "报关业务") {
stroplb = "op_Apply";
} else if (oplb == "散杂运输") {
stroplb = "op_Other";
}
if(ckbox == 1){
selectGroup.push(rowId);
selectGroupoplb.push(stroplb);
selectCount++;
}
}
if(selectCount > 0){
if(window.confirm("您确定批准通过所选委托业务内所有待审核的费用")){
for(var j = 0;j<selectGroup.length;j++){
var urlVal = "";
urlVal = "AuditService.aspx?handle=lockfee&bsno="+selectGroup[j]+"&oplb="+selectGroupoplb[j]+"&val="+commonGridObj_total.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if(loadVal > 0 ){
var rowIndex = commonGridObj_total.getGridObj().getRowIndex(selectGroup[j]);
if(loadVal == 2){
commonGridObj_total.getGridObj().cellByIndex(rowIndex,3).setValue("锁定");
}else if(loadVal == 3){
commonGridObj_total.getGridObj().cellByIndex(rowIndex,3).setValue("未锁定");
}
auditCount++;
}else{
if(loadVal == -2){
unfinishfee++;
}
unauditCount++;
}
}
//reloadInfo();
commonGridObj_total.getGridObj().attachEvent("onSelectStateChanged", function (id) {
var rowIndex = commonGridObj_total.getGridObj().getRowIndex(id);
var oplb = commonGridObj_total.getGridObj().cellByIndex(rowIndex, 1).getValue();
if (oplb == "海运出口") {
SelectRowOplb = "op_Seae";
} else if (oplb == "海运进口") {
SelectRowOplb = "op_Seai";
} else if (oplb == "内贸海运") {
SelectRowOplb = "op_Sean";
} else if (oplb == "报关业务") {
SelectRowOplb = "op_Apply";
} else if (oplb == "大宗散货") {
SelectRowOplb = "op_Bulk";
} else if (oplb == "散杂运输") {
SelectRowOplb = "op_Other";
}
commonGridObj_recv.loadafter = true;
commonGridObj_recv.after = function () {
markStatusColor(commonGridObj_recv.getGridObj());
}
commonGridObj_recv.initGrid();
commonGridObj_recv.setRequest("FeeAuditGridSource.aspx?handle=" + SelectRowOplb + "&type=2&init=2&bsno=" + id);
commonGridObj_recv.bind();
commonGridObj_recv.enableMultiselect(true);
commonGridObj_pay.loadafter = true;
commonGridObj_pay.after = function () {
markStatusColor(commonGridObj_pay.getGridObj());
}
commonGridObj_pay.initGrid();
commonGridObj_pay.setRequest("FeeAuditGridSource.aspx?handle=" + SelectRowOplb + "&type=3&init=2&bsno=" + id);
commonGridObj_pay.bind();
commonGridObj_pay.enableMultiselect(true);
getFeeProfit(id);
commonGridObj_recv.getGridObj().attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
if (cInd == 0) {
return true;
} else {
return false;
}
if (stage == 1) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
});
commonGridObj_pay.getGridObj().attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
if (stage == 0) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
if (stage == 1) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
});
setTimeout(function () {
markStatusColor(commonGridObj_recv.getGridObj());
markStatusColor(commonGridObj_pay.getGridObj());
}, 100);
// checkAll("recv",1);
// checkAll("pay",1);
$("ck_all_recv").checked = 1;
$("ck_all_pay").checked = 1;
});
if(unfinishfee > 0){
alert("批量加锁 共 "+selectCount+" 条 成功加锁 "+auditCount+" 条 未能完成加锁 "+unauditCount+" 条 错误原因:存在未审核的费用信息无法锁定");
}else{
alert("批量加锁 共 "+selectCount+" 条 成功加锁 "+auditCount+" 条 未能完成加锁 "+unauditCount+" 条");
}
}
}
else{
if(unauditCount == 0){
alert("您没有选择要审核的费用内容");
}
}
}
//解锁
function batchUnlock(){
var selectCount = 0;
var auditCount = 0;
var unauditCount = 0;
var selectGroup = new Array();
var selectGroupoplb = new Array();
for(var i = 0;i<commonGridObj_total.getGridObj().getRowsNum();i++){
var ckbox = commonGridObj_total.getGridObj().cellByIndex(i,0).getValue();
var rowId = commonGridObj_total.getGridObj().getRowId(i);
var oplb = commonGridObj_total.getGridObj().cellByIndex(i,1).getValue();
var stroplb="";
if (oplb == "海运进口") {
stroplb = "op_Seai";
} else if (oplb == "海运出口") {
stroplb = "op_Seae";
} else if (oplb == "内贸海运") {
stroplb = "op_Sean";
} else if (oplb == "报关业务") {
stroplb = "op_Apply";
} else if (oplb == "大宗散货") {
stroplb = "op_Bulk";
} else if (oplb == "散杂运输") {
stroplb = "op_Other";
}
if(ckbox == 1){
selectGroup.push(rowId);
selectGroupoplb.push(stroplb);
selectCount++;
}
}
if(selectCount > 0){
if(window.confirm("您确定批准通过所选委托业务内所有待审核的费用")){
for(var j = 0;j<selectGroup.length;j++){
var urlVal = "";
urlVal = "AuditService.aspx?handle=unlockfee&bsno="+selectGroup[j]+"&oplb="+selectGroupoplb[j]+"&val="+commonGridObj_total.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if(loadVal > 0 ){
var rowIndex = commonGridObj_total.getGridObj().getRowIndex(selectGroup[j]);
if(loadVal == 2){
commonGridObj_total.getGridObj().cellByIndex(rowIndex,3).setValue("锁定");
}else if(loadVal == 3){
commonGridObj_total.getGridObj().cellByIndex(rowIndex,3).setValue("未锁定");
}
auditCount++;
}else{
unauditCount++;
}
}
//reloadInfo();
commonGridObj_total.getGridObj().attachEvent("onSelectStateChanged", function (id) {
var rowIndex = commonGridObj_total.getGridObj().getRowIndex(id);
var oplb = commonGridObj_total.getGridObj().cellByIndex(rowIndex, 1).getValue();
if (oplb == "海运出口") {
SelectRowOplb = "op_Seae";
} else if (oplb == "海运进口") {
SelectRowOplb = "op_Seai";
} else if (oplb == "内贸海运") {
SelectRowOplb = "op_Sean";
} else if (oplb == "报关业务") {
SelectRowOplb = "op_Apply";
} else if (oplb == "大宗散货") {
SelectRowOplb = "op_Bulk";
} else if (oplb == "散杂运输") {
SelectRowOplb = "op_Other";
}
commonGridObj_recv.loadafter = true;
commonGridObj_recv.after = function () {
markStatusColor(commonGridObj_recv.getGridObj());
}
commonGridObj_recv.initGrid();
commonGridObj_recv.setRequest("FeeAuditGridSource.aspx?handle=" + SelectRowOplb + "&type=2&init=2&bsno=" + id);
commonGridObj_recv.bind();
commonGridObj_recv.enableMultiselect(true);
commonGridObj_pay.loadafter = true;
commonGridObj_pay.after = function () {
markStatusColor(commonGridObj_pay.getGridObj());
}
commonGridObj_pay.initGrid();
commonGridObj_pay.setRequest("FeeAuditGridSource.aspx?handle=" + SelectRowOplb + "&type=3&init=2&bsno=" + id);
commonGridObj_pay.bind();
commonGridObj_pay.enableMultiselect(true);
getFeeProfit(id);
commonGridObj_recv.getGridObj().attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
if (cInd == 0) {
return true;
} else {
return false;
}
if (stage == 1) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
});
commonGridObj_pay.getGridObj().attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
if (stage == 0) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
if (stage == 1) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
});
setTimeout(function () {
markStatusColor(commonGridObj_recv.getGridObj());
markStatusColor(commonGridObj_pay.getGridObj());
}, 100);
// checkAll("recv",1);
// checkAll("pay",1);
$("ck_all_recv").checked = 1;
$("ck_all_pay").checked = 1;
});
alert("批量加锁 共 "+selectCount+" 条 成功加锁 "+auditCount+" 条 未能完成加锁 "+unauditCount+" 条");
}
}
else{
if(unauditCount == 0){
alert("您没有选择要审核的费用内容");
}
}
}
function reloadInfo(){
commonGridObj_total.setRequest("FeeAuditGridSource.aspx?handle=list&type=1&init=2&search="+escape(searchCondition)+"&uid="+commonGridObj_total.newGuid());
commonGridObj_total.initGrid();
commonGridObj_total.bind();
commonGridObj_pay.initGrid();
commonGridObj_recv.initGrid();
commonGridObj_total.getGridObj().attachEvent("onRowDblClicked", function (rId, cInd) {
var openSet = "height=600, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " + (screen.height - 600) / 2 + ",Left= " + (screen.width - 800) / 2
var openType = "_blank";
var openUrl = "";
var rowIndex = commonGridObj_total.getGridObj().getRowIndex(rId);
var oplb = commonGridObj_total.getGridObj().cellByIndex(rowIndex, 1).getValue();
if (oplb == "海运出口") {
SelectRowOplb = "op_Seae";
openUrl = "../shipping/SeaExportInfo.aspx?handle=edit&id=" + rId + "&hdenabled=false&opstatus=op_seae";
} else if (oplb == "海运进口") {
SelectRowOplb = "op_Seai";
openUrl = "../SeaiInfo/SeaImportInfo.aspx?handle=edit&id=" + rId + "&hdenabled=false&opstatus=op_seai";
} else if (oplb == "内贸海运") {
SelectRowOplb = "op_Sean";
openUrl = "../SeaiInfo/SeaImportInfo.aspx?handle=edit&id=" + rId + "&&hdenabled=false&opstatus=op_seai";
}else if (oplb == "大宗散货") {
SelectRowOplb = "op_Bulk";
openUrl = "../SeaiInfo/SeaImportInfo.aspx?handle=edit&id=" + rId + "&&hdenabled=false&opstatus=op_seai";
}
window.open(openUrl, openType, openSet);
});
commonGridObj_total.getGridObj().attachEvent("onSelectStateChanged", function (id) {
strBSNO = id;
var rowIndex = commonGridObj_total.getGridObj().getRowIndex(id);
var oplb = commonGridObj_total.getGridObj().cellByIndex(rowIndex, 1).getValue();
if (oplb == "海运出口") {
SelectRowOplb = "op_Seae";
} else if (oplb == "海运进口") {
SelectRowOplb = "op_Seai";
} else if (oplb == "内贸海运") {
SelectRowOplb = "op_Sean";
} else if (oplb == "报关业务") {
SelectRowOplb = "op_Apply";
} else if (oplb == "大宗散货") {
SelectRowOplb = "op_Bulk";
} else if (oplb == "散杂运输") {
SelectRowOplb = "op_Other";
}
commonGridObj_recv.initGrid();
commonGridObj_recv.setRequest("FeeAuditGridSource.aspx?handle=" + SelectRowOplb + "&type=2&init=2&bsno=" + id);
commonGridObj_recv.bind();
commonGridObj_recv.enableMultiselect(true);
commonGridObj_pay.initGrid();
commonGridObj_pay.setRequest("FeeAuditGridSource.aspx?handle=" + SelectRowOplb + "&type=3&init=2&bsno=" + id);
commonGridObj_pay.bind();
commonGridObj_pay.enableMultiselect(true);
getFeeProfit(id);
commonGridObj_recv.getGridObj().attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
if (cInd == 0) {
return true;
} else {
return false;
}
if (stage == 1) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
});
commonGridObj_pay.getGridObj().attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
if (stage == 0) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
if (stage == 1) {
if (cInd == 0) {
return true;
} else {
return false;
}
}
});
setTimeout(function () {
markStatusColor(commonGridObj_recv.getGridObj());
markStatusColor(commonGridObj_pay.getGridObj());
}, 100);
checkAll("recv", 1);
checkAll("pay", 1);
$("ck_all_recv").checked = 1;
$("ck_all_pay").checked = 1;
});
getFeeProfit("");//清空利润信息
}
function initButton(){
var isOperatorState = $("h_isoperator").value;
var isFinancialState = $("h_isfinancial").value;
if(isOperatorState == "1" && isFinancialState != "1"){
$("btn_forbidrecvinvoice").style.display = "none";
$("btn_unforbidrecvinvoice").style.display = "none";
$("btn_forbidpayinvoice").style.display = "none";
$("btn_unforbidpayinvoice").style.display = "none";
$("btn_batchlock").style.display = "none";
$("btn_batchunlock").style.display = "none";
}
}