var commonGridObj_feelist;
var commonGridObj_recv;
var comboCustomer;//委托单位
function $(id){
return document.getElementById(id);
}
function createRecvGrid(){
//header
var headerArgs_recv = new Array("","付款单位","币别","结算金额","未结金额");
//width
var widthArgs_recv = new Array("40","110","60","80","80");
//column align
var colAlignArgs_recv = new Array("center","center","center","center","center");
//column sort
var colSortArgs_recv = new Array("str","str","str","str","str");
//column type
var colTypeArgs_recv = new Array("ch","ro","ro","ed","ro");
commonGridObj_recv = new TGridCommon("mygrid_container_recv","form1",headerArgs_recv,widthArgs_recv,colAlignArgs_recv,colSortArgs_recv,colTypeArgs_recv);
commonGridObj_recv.setResponseUrl("SettlementGridSourceApp.aspx");
var _verifycacheName = $("h_verifycache").value;
commonGridObj_recv.setRequest("../Settlements/SettlementGridSourceApp.aspx?handle=getverifycache&verifycachename="+_verifycacheName+"&uid="+commonGridObj_recv.newGuid());
commonGridObj_recv.setSourceType("json");
commonGridObj_recv.setSkin("xp");
commonGridObj_recv.setImageUrl("../images/");
commonGridObj_recv.initGrid();
commonGridObj_recv.loadafter = true;
commonGridObj_recv.after = function(){
var doCurrency = "";
for(var i=0;i 0){
if(ustl == 0){
if(cstl > (ustl+oldValue)){
return false;
}else{
totalCstl = oldValue+ustl;
tempUstl = totalCstl - newValue;
tempCstl = newValue;
}
}else if(oldValue != ustl){
totalCstl = oldValue+ustl;
tempUstl = totalCstl - newValue;
tempCstl = newValue;
}else if(oldValue == ustl){
totalCstl = oldValue;
if(totalCstl < newValue){
return false;
}
tempUstl = totalCstl - newValue;
tempCstl = newValue;
}
}else{
return false;
}
commonGridObj_recv.getGridObj().cellByIndex(rowIndex,3).setValue(ConvertToMoney(outputMoney(tempCstl.toString())));
commonGridObj_recv.getGridObj().cellByIndex(rowIndex,4).setValue(ConvertToMoney(outputMoney(tempUstl.toString())));
return true;
}
});
}
function createGrid(){
//header
var headerArgs_feelist = new Array("","委托编号","主提单号","分提单号","结算单位","费用名称","收/付","结算金额","未结算金额","开票金额","计费标准","单价","数量","金额","币别","汇率","录入时间","BSNO");
//width
var widthArgs_feelist = new Array("40","150","150","150","100","100","40","100","100","100","100","100","100","100","90","70","120","0");
//column align
var colAlignArgs_feelist = new Array("center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_feelist = new Array("na","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str");
//column type
var colTypeArgs_feelist = new Array("ch","ro","ro","ro","ro","ro","ro","ed","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro");
commonGridObj_feelist = new TGridCommon("mygrid_container_feelist","form1",headerArgs_feelist,widthArgs_feelist,colAlignArgs_feelist,colSortArgs_feelist,colTypeArgs_feelist);
commonGridObj_feelist.setResponseUrl("InvoiceApplicationGridSource.aspx");
var invoiceId = $("h_invoiceid").value;
if($("h_cacheid").value.trim() == ""){
$("h_cacheid").value = commonGridObj_feelist.newGuid();
}
var cacheName = $("h_cacheid").value;
commonGridObj_feelist.setRequest("InvoiceApplicationGridSource.aspx?handle=unverificationfee&show_page=15&cur_page=1&invoiceid="+invoiceId+"&cachename="+cacheName+"&uid="+commonGridObj_feelist.newGuid());
commonGridObj_feelist.setSourceType("json");
commonGridObj_feelist.setSkin("xp");
commonGridObj_feelist.setImageUrl("../images/");
commonGridObj_feelist.initGrid();
commonGridObj_feelist.loadafter = true;
commonGridObj_feelist.after = function(){
var urlVal = "../feecodes/CurrencyAdapter.aspx?handle=drate&val="+commonGridObj_feelist.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
loader = null;
var jsonCacheObj;
var rmbRate = 0.0;
var usdRate = 0.0;
if(loadVal.length > 0){
jsonCacheObj = eval('(' + loadVal + ')');
if(jsonCacheObj != null){
for(var i = 0;i 0){
if(totalObj.verify[0].state == 1){
$("txt_rmbtotal").value = totalObj.verify[0].rmb;
$("txt_usdtotal").value = totalObj.verify[0].usd;
}
}
}
};
commonGridObj_feelist.bind();
commonGridObj_feelist.initPageByGID("unverificationfee","&invoiceid="+invoiceId+"&cachename="+cacheName);
// commonGridObj_invoicelist.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
// if(stage == 0){
// if(cInd == 2 || cInd == 3){
// return false;
// }else{
// return true;
// }
// }
// });
// commonGridObj_invoicelist.getGridObj().attachEvent("onRowSelect", function(id,ind){
// var openSet = "height=490, width=1000, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-490)/2 + ",Left= "+(screen.width-900)/2
// var openType = "_blank";
//
// var openUrl = "InvoiceMakeOutEdit.aspx?handle=edit&id="+id;
// window.open (openUrl,openType,openSet);
//
// });
//
// commonGridObj_invoicelist.clickEvent = function(){
// commonGridObj_invoicelist.getGridObj().attachEvent("onRowSelect", function(id,ind){
// var openSet = "height=490, width=1000, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-490)/2 + ",Left= "+(screen.width-900)/2
// var openType = "_blank";
//
// var openUrl = "InvoiceMakeOutEdit.aspx?handle=edit&id="+id;
// window.open (openUrl,openType,openSet);
//
// });
// }
commonGridObj_feelist.getGridObj().enableEditEvents(true,false,true);
commonGridObj_feelist.onEditEvent = function(){
commonGridObj_feelist.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
if(stage == 0){
if(cInd == 0){
return true;
}
}
if(stage == 1){
for(var i = 0; i < document.all.length; i++){
if(document.all(i).tagName == "TEXTAREA"){
txtEdit = document.all(i);
txtEdit.focus();
txtEdit.select();
break;
}
}
}
if(stage == 2){
var rowIndex = commonGridObj_feelist.getGridObj().getRowIndex(rId);
var stl = 0.0;
var cstl = 0.0;
var ustl = 0.0;
stl = parseFloat(clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_feelist.getGridObj().cellByIndex(rowIndex,13).getValue()))));
cstl = parseFloat(clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_feelist.getGridObj().cellByIndex(rowIndex,7).getValue()))));
ustl = parseFloat(clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_feelist.getGridObj().cellByIndex(rowIndex,8).getValue()))));
var rustl = 0.0;
var newCstl = parseFloat(nValue);
var oldCstl = parseFloat(oValue);
if(newCstl < 0){
return false;
}else if(newCstl > oldCstl && newCstl > (oldCstl + ustl)){
return false;
}else if(newCstl == 0){
return false;
}
var newStl = 0.0;
if(oldCstl != ustl){
newStl = (ustl+oldCstl) - newCstl;
}else{
newStl = ustl - newCstl;
}
commonGridObj_feelist.getGridObj().cellByIndex(rowIndex,0).setValue(1);
commonGridObj_feelist.getGridObj().cellByIndex(rowIndex,7).setValue(ConvertToMoney(outputMoney(cstl.toString())));
commonGridObj_feelist.getGridObj().cellByIndex(rowIndex,8).setValue(ConvertToMoney(outputMoney(newStl.toString())));
var customerName = commonGridObj_feelist.getGridObj().cellByIndex(rowIndex,4).getValue();
if($("txt_customer").value.trim() == ""){
$("txt_customer").value = customerName;
}
var invoiceId = $("h_invoiceid").value;
var doAmount = ConvertToMoney(outputMoney(cstl.toString()));
var unDoAmount = ConvertToMoney(outputMoney(newStl.toString()));
var rate = $("txt_rate").value.trim() == "" ? 0 : parseFloat($("txt_rate").value.trim());
var settleType = 0;
if($("ck_rmb").checked){
settleType = 1;
}else if($("ck_usd").checked){
settleType = 2;
}else{
settleType = 3;
}
var urlVal = "InvoiceApplicationGridSource.aspx?handle=editverifyfee&invoiceid="+invoiceId+"&cachename="+cacheName+"&verifyfee="+rId+"&doamount="+doAmount+"&unamount="+unDoAmount+"&rate="+rate+"&settletype="+settleType+"&val="+commonGridObj_feelist.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if(loadVal.trim() != ""){
var totalObj = eval('(' + loadVal + ')');
if(totalObj.verify.length > 0){
if(totalObj.verify[0].state == 1){
$("txt_rmbtotal").value = totalObj.verify[0].rmb;
$("txt_usdtotal").value = totalObj.verify[0].usd;
// commonGridObj_feelist.initGrid();
// commonGridObj_feelist.bind();
}
}
}
return true;
}
});
}
commonGridObj_feelist.onEditEvent();
commonGridObj_feelist.isOnEditCell = true;
commonGridObj_feelist.onCheckBox = function(){
commonGridObj_feelist.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){
var totalRmb = 0;
var totalUsd = 0;
var rowIndex = commonGridObj_feelist.getGridObj().getRowIndex(rId);
totalRmb = $("txt_rmbtotal").value.trim() == "" ? 0 : parseFloat($("txt_rmbtotal").value.trim());
totalUsd = $("txt_usdtotal").value.trim() == "" ? 0 : parseFloat($("txt_usdtotal").value.trim());
var doAmount = parseFloat(commonGridObj_feelist.getGridObj().cellByIndex(rowIndex,7).getValue());
var currency = commonGridObj_feelist.getGridObj().cellByIndex(rowIndex,14).getValue();
//var rate = parseFloat(commonGridObj_feelist.getGridObj().cellByIndex(rowIndex,15).getValue());
var rate = parseFloat($("txt_rate").value.trim());
var customerName = commonGridObj_feelist.getGridObj().cellByIndex(rowIndex,4).getValue();
//cache name
if($("h_cacheid").value.trim() == ""){
$("h_cacheid").value = commonGridObj_feelist.newGuid();
}
var cacheName = $("h_cacheid").value;
if(state){
if($("txt_customer").value.trim() == ""){
$("txt_customer").value = customerName;
}
// if($("txt_customer").value.trim() == ""){
// $("txt_customer").value = customerName;
// }
// if($("ck_rmb").checked){
// if(currency == "USD"){
// totalRmb += ForDight((doAmount/rate),2);
// }else if(currency == "RMB"){
// totalRmb += doAmount;
// }
// }else if($("ck_usd").checked){
// if(currency == "RMB"){
// totalUsd += ForDight((doAmount/rate),2);
// }else if(currency == "USD"){
// totalUsd += doAmount;
// }
// }else{
// if(currency == "USD"){
// totalUsd += doAmount;
// }else if(currency == "RMB"){
// totalRmb += doAmount;
// }
// }
//
// $("txt_rmbtotal").value = totalRmb;
// $("txt_usdtotal").value = totalUsd;
//
// var invoiceId = $("h_invoiceid").value;
// var urlVal = "InvoiceApplicationGridSource.aspx?handle=checkverifyfee&invoiceid="+invoiceId+"&checktype=1&cachename="+cacheName+"&verifyfee="+rId+"&val="+commonGridObj_feelist.newGuid();
// var loader = dhtmlxAjax.getSync(urlVal);
// var loadVal = loader.xmlDoc.responseText;
var invoiceId = $("h_invoiceid").value;
var rate = $("txt_rate").value.trim() == "" ? 0 : parseFloat($("txt_rate").value.trim());
var settleType = 0;
if($("ck_rmb").checked){
settleType = 1;
}else if($("ck_usd").checked){
settleType = 2;
}else{
settleType = 3;
}
var urlVal = "InvoiceApplicationGridSource.aspx?handle=checkverifyfee&invoiceid="+invoiceId+"&checktype=1&cachename="+cacheName+"&rate="+rate+"&settletype="+settleType+"&verifyfee="+rId+"&val="+commonGridObj_feelist.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if(loadVal.trim() != ""){
var totalObj = eval('(' + loadVal + ')');
if(totalObj.verify.length > 0){
if(totalObj.verify[0].state == 1){
$("txt_rmbtotal").value = totalObj.verify[0].rmb;
$("txt_usdtotal").value = totalObj.verify[0].usd;
// commonGridObj_feelist.initGrid();
// commonGridObj_feelist.bind();
}
}
}
}else{
// if($("ck_rmb").checked){
// if(currency == "USD"){
// totalRmb -= ForDight((doAmount*rate),2);
// }else if(currency == "RMB"){
// totalRmb -= doAmount;
// }
// }else if($("ck_usd").checked){
// if(currency == "RMB"){alert(totalUsd);
// totalUsd = ForDight(totalUsd - ForDight((doAmount/rate),2),2);
// }else if(currency == "USD"){
// totalUsd -= doAmount;
// }
// }else{
// if(currency == "USD"){
// totalUsd -= doAmount;
// }else if(currency == "RMB"){
// totalRmb -= doAmount;
// }
// }
// $("txt_rmbtotal").value = totalRmb;
// $("txt_usdtotal").value = totalUsd;
// var invoiceId = $("h_invoiceid").value;
// var urlVal = "InvoiceApplicationGridSource.aspx?handle=checkverifyfee&invoiceid="+invoiceId+"&checktype=2&cachename="+cacheName+"&verifyfee="+rId+"&val="+commonGridObj_feelist.newGuid();
// var loader = dhtmlxAjax.getSync(urlVal);
// var loadVal = loader.xmlDoc.responseText;
var invoiceId = $("h_invoiceid").value;
var rate = $("txt_rate").value.trim() == "" ? 0 : parseFloat($("txt_rate").value.trim());
var settleType = 0;
if($("ck_rmb").checked){
settleType = 1;
}else if($("ck_usd").checked){
settleType = 2;
}else{
settleType = 3;
}
var urlVal = "InvoiceApplicationGridSource.aspx?handle=checkverifyfee&invoiceid="+invoiceId+"&checktype=2&cachename="+cacheName+"&rate="+rate+"&settletype="+settleType+"&verifyfee="+rId+"&val="+commonGridObj_feelist.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if(loadVal.trim() != ""){
var totalObj = eval('(' + loadVal + ')');
if(totalObj.verify.length > 0){
if(totalObj.verify[0].state == 1){
$("txt_rmbtotal").value = totalObj.verify[0].rmb;
$("txt_usdtotal").value = totalObj.verify[0].usd;
// commonGridObj_feelist.initGrid();
// commonGridObj_feelist.bind();
}
}
}
}
});
}
commonGridObj_feelist.onCheckBox();
commonGridObj_feelist.isOnCheckBox = true;
}
function initCombo(){
createComboCustomer();//结算单位
}
function refreshList(){
createGrid();
}
//根据条件查询付费申请信息
function search(){
var _begintime = $("txt_beginDate").value.trim();
if(_begintime.trim() != ""){
if(!validateDateTime(_begintime)){
alert("起始时间格式错误");
return;
}
}
var _endtime = $("txt_endDate").value.trim();
if(_endtime.trim() != ""){
if(!validateDateTime(_endtime)){
alert("结束时间格式错误");
return;
}
}
var _customer = $("h_customer").value.trim();
var _checkno = $("txt_billno").value.trim();
var searchJson = "";
//begin
searchJson +="{";
searchJson += "[";
//如果查询条件设置了起始时间和结束时间则判断结束时间是否大于起始时间
if(_begintime != "" && _endtime != ""){
if(_begintime.length > 9 && _endtime.length > 9){
var status = DateTimeEqual(_begintime,_endtime);
if(status == 0){
searchJson += "\"btime\":\""+_begintime+"\","
searchJson += "\"etime\":\""+_endtime+"\","
}else if(status == -1){
alert("时间设置错误,起始时间不能大于结束时间,请修改!");
return;
}
// else if(status == -2){
// alert("时间设置错误,起始时间不能等于结束时间,请修改!");
// return;
// }
}
else{
alert("时间格式有问题,长度应大于9个字符,请修改!");
return;
}
}else{
searchJson += "\"btime\":\""+_begintime+"\","
searchJson += "\"etime\":\""+_endtime+"\","
}
searchJson += "\"cus\":\""+_customer+"\",";
searchJson += "\"no\":\""+_checkno+"\"";
searchJson += "]";
searchJson +="}";//alert(searchJson);
commonGridObj_invoicelist.initGrid();
commonGridObj_invoicelist.setRequest("InvoiceApplicationGridSource.aspx?handle=makeoutlist&show_page=15&cur_page=1&search="+escape(searchJson)+"&uid="+commonGridObj_invoicelist.newGuid());
commonGridObj_invoicelist.bind();
commonGridObj_invoicelist.setSearch(searchJson);
commonGridObj_invoicelist.initPageByHandle("makeoutlist");
commonGridObj_invoicelist.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
if(stage == 0){
if(cInd == 2 || cInd == 3){
return false;
}else{
return true;
}
}
});
commonGridObj_invoicelist.getGridObj().attachEvent("onRowDblClicked", function(rId,cInd){
var rId = commonGridObj_invoicelist.getGridObj().getSelectedRowId();
var openSet = "height=500, width=960, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-710)/2 + ",Left= "+(screen.width-960)/2
var openType = "_blank";
var openUrl = "InvoiceMakeOutEdit.aspx?id="+rId+"&handle=edit";
window.open (openUrl,openType,openSet);
});
}
//校验时间格式
function validateDateTime(dateTimeObj){
var isValid = false;
var parseToObj = new Date(dateTimeObj.replace(/-/g, "/"));
if(!isNaN(parseToObj)){
isValid = true;
}
return isValid;
}
function DateTimeEqual(beginObj,endObj){
var isEqual = 0;
var begin = new Date(beginObj.replace(/-/g, "/"));
var end = new Date(endObj.replace(/-/g, "/"));
if(Date.parse(begin) - Date.parse(end) > 0){
isEqual = -1;//起始时间大于结束时间
}else if(Date.parse(begin) - Date.parse(end) == 0){
isEqual = -2;//起始时间与结束时间相等
}
return isEqual;
}
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
function createComboCustomer(){//委托单位
comboCustomer = dhtmlXComboFromSelect("sel_customer");
comboCustomer.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0");
comboCustomer.attachEvent("onChange", function(){
comboCustomer.setComboText($("h_customer").value);
});
comboCustomer.attachEvent("onBlur", function(){
var s1 = comboCustomer.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboCustomer.setComboText(s3);
$("h_customer").value=s3;
}
else
{
comboCustomer.setComboText($("h_customer").value);
}
});
comboCustomer.setComboText($("h_customer").value);
comboCustomer.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_customer").value.trim();
if("" != comboCustomer.getComboText().trim()){
while("undefined" != typeof comboCustomer.getOptionByIndex(filterCount)){
var comboValue = comboCustomer.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboCustomer.getComboText().trim().toUpperCase();
$("h_customer").value = comboCustomer.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboCustomer.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_customer").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboCustomer.attachEvent("onSelectionChange", function(){
$("h_customer").value = comboCustomer.getComboText().trim();
});
}
//初始化界面
function initGrid(){
$("h_customer").value = "";
comboCustomer.setComboText($("h_customer").value);
$("txt_beginDate").value = "";
$("txt_endDate").value = "";
$("txt_billno").value = "";
createGrid();
}
function checkAll(){
var checkState = $("ck_all").checked;
var totalRmb = 0;
var totalUsd = 0;
totalRmb = $("txt_rmbtotal").value.trim() == "" ? 0 : parseFloat($("txt_rmbtotal").value.trim());
totalUsd = $("txt_usdtotal").value.trim() == "" ? 0 : parseFloat($("txt_usdtotal").value.trim());
var customerName = commonGridObj_feelist.getGridObj().cellByIndex(0,4).getValue();
if($("txt_customer").value.trim() == ""){
$("txt_customer").value = customerName;
}
if($("h_cacheid").value.trim() == ""){
$("h_cacheid").value = commonGridObj_feelist.newGuid();
}
var cacheName = $("h_cacheid").value;
if(checkState){
// for(var i=0;i 0){
if(totalObj.verify[0].state == 1){
$("txt_rmbtotal").value = totalObj.verify[0].rmb;
$("txt_usdtotal").value = totalObj.verify[0].usd;
createGrid();
$("ck_all").checked = true;
}
}
}
}else{
// for(var i=0;i 0){
if(totalObj.verify[0].state == 1){
$("txt_rmbtotal").value = totalObj.verify[0].rmb;
$("txt_usdtotal").value = totalObj.verify[0].usd;
createGrid();
}
}
}
}
}
function saveVerification(){
// var feeObj = null;
var iCount = 0;
var rmbTotal = 0;
var usdTotal = 0;
var recvRmbTotal = 0;
var recvUsdTotal = 0;
var recvRmbCount = 0;
var recvUsdCount = 0;
rmbTotal = $("txt_rmbtotal").value;
usdTotal = $("txt_usdtotal").value;
// for(var i=0;i recvRmbTotal){
if(window.confirm("收费结算RMB费用大于实收RMB费用")){
isDoRmb = true;
return;
}else{
return;
}
}
if(usdTotal > recvUsdTotal){
if(window.confirm("收费结算USD费用大于实收USD费用")){
isDoUsd = true;
return;
}else{
return;
}
}
if(recvRmbTotal > rmbTotal){
if(recvRmbCount > 1){
alert("多笔实收费用需指定结算金额");
return;
}else{
for(var j = 0;j 0){
if(ustl == 0){
if(cstl > (ustl+oldValue)){
return false;
}else{
totalCstl = oldValue+ustl;
tempUstl = totalCstl - newValue;
tempCstl = newValue;
}
}else if(oldValue != ustl){
totalCstl = oldValue+ustl;
tempUstl = totalCstl - newValue;
tempCstl = newValue;
}else if(oldValue == ustl){
totalCstl = oldValue;
tempUstl = totalCstl - newValue;
tempCstl = newValue;
}
}
commonGridObj_recv.getGridObj().cellByIndex(rowIndex,3).setValue(ConvertToMoney(outputMoney(tempCstl.toString())));
commonGridObj_recv.getGridObj().cellByIndex(rowIndex,4).setValue(ConvertToMoney(outputMoney(tempUstl.toString())));
var tempRecvAmount = $("h_recvamount").value;
jsonRecvAmountObj = eval('(' + tempRecvAmount + ')');
for(var k=0;k usdTotal){
if(recvRmbCount > 1){
alert("多笔实收费用需指定结算金额");
return;
}else{
for(var j = 0;j 0){
if(ustl == 0){
if(cstl > (ustl+oldValue)){
return false;
}else{
totalCstl = oldValue+ustl;
tempUstl = totalCstl - newValue;
tempCstl = newValue;
}
}else if(oldValue != ustl){
totalCstl = oldValue+ustl;
tempUstl = totalCstl - newValue;
tempCstl = newValue;
}else if(oldValue == ustl){
totalCstl = oldValue;
tempUstl = totalCstl - newValue;
tempCstl = newValue;
}
}
commonGridObj_recv.getGridObj().cellByIndex(rowIndex,3).setValue(ConvertToMoney(outputMoney(tempCstl.toString())));
commonGridObj_recv.getGridObj().cellByIndex(rowIndex,4).setValue(ConvertToMoney(outputMoney(tempUstl.toString())));
var tempRecvAmount = $("h_recvamount").value;
jsonRecvAmountObj = eval('(' + tempRecvAmount + ')');
for(var k=0;k 0){
for(var i=0;i 0){
// totalUsd += ForDight((totalRmb/rate),2);
// totalRmb = 0;
// }
// }else if(id == "ck_rmb"){
// if(totalUsd > 0){
// totalRmb += ForDight((totalUsd/rate),1);
// totalUsd = 0;
// }
// }else{
// $("rate").value = "";
// }
initExchangeRate();
//var invoiceId = $("h_invoiceid").value;
//var doAmount = ConvertToMoney(outputMoney(cstl.toString()));
//var unDoAmount = ConvertToMoney(outputMoney(newStl.toString()));
var rate = $("txt_rate").value.trim() == "" ? 0 : parseFloat($("txt_rate").value.trim());
var settleType = 0;
if($("ck_rmb").checked){
settleType = 1;
}else if($("ck_usd").checked){
settleType = 2;
}else{
settleType = 3;
}
if($("h_cacheid").value.trim() == ""){
$("h_cacheid").value = commonGridObj_feelist.newGuid();
}
var cacheName = $("h_cacheid").value;
var urlVal = "InvoiceApplicationGridSource.aspx?handle=verifyfeerate&cachename="+cacheName+"&rate="+rate+"&settletype="+settleType+"&val="+commonGridObj_feelist.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
if(loadVal.trim() != ""){
var totalObj = eval('(' + loadVal + ')');
if(totalObj.verify.length > 0){
if(totalObj.verify[0].state == 1){
$("txt_rmbtotal").value = totalObj.verify[0].rmb;
$("txt_usdtotal").value = totalObj.verify[0].usd;
// commonGridObj_feelist.initGrid();
// commonGridObj_feelist.bind();
}
}
}else{
$("txt_rmbtotal").value = "0";
$("txt_usdtotal").value = "0";
}
// $("txt_rmbtotal").value = totalRmb;
// $("txt_usdtotal").value = totalUsd;
}
function initExchangeRate(){
var urlVal = "../feecodes/CurrencyAdapter.aspx?handle=drate&val="+commonGridObj_feelist.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
loader = null;
var jsonCacheObj;
var rmbRate = 0.0;
var usdRate = 0.0;
if(loadVal.length > 0){
jsonCacheObj = eval('(' + loadVal + ')');
if(jsonCacheObj != null){
for(var i = 0;i 0){
if(totalObj.verify[0].state == 1){
$("txt_rmbtotal").value = totalObj.verify[0].rmb;
$("txt_usdtotal").value = totalObj.verify[0].usd;
}
}
}else{
$("txt_rmbtotal").value = "0";
$("txt_usdtotal").value = "0";
}
}