|
|
|
|
var mygrid_recv;
|
|
|
|
|
var mygrid_pay;
|
|
|
|
|
var page_count = 5;
|
|
|
|
|
var column_count;
|
|
|
|
|
var jsonFeeObj;
|
|
|
|
|
var jsonPayObj;
|
|
|
|
|
var changeCount = 0;
|
|
|
|
|
var authoriyStatus;
|
|
|
|
|
var changeFeeRecvCount = 0;
|
|
|
|
|
var changeFeePayCount = 0;
|
|
|
|
|
var newFeeRecvCount = 0;
|
|
|
|
|
var newFeePayCount = 0;
|
|
|
|
|
|
|
|
|
|
function $(id){
|
|
|
|
|
return document.getElementById(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function document.onkeydown(){
|
|
|
|
|
if(event.keyCode == 8){
|
|
|
|
|
if(document.selection){
|
|
|
|
|
var range = document.selection.createRange();;
|
|
|
|
|
|
|
|
|
|
if(range.parentElement().name == null){
|
|
|
|
|
return false;
|
|
|
|
|
}else{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function clickNull(){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function doInitRecvGrid(){
|
|
|
|
|
|
|
|
|
|
mygrid_recv = new dhtmlXGridObject('mygrid_container_recv');
|
|
|
|
|
mygrid_recv.setImagePath("../images/");
|
|
|
|
|
mygrid_recv.setSkin("xp");
|
|
|
|
|
mygrid_recv.setHeader("<input type=\"checkbox\" id=\"ck_all_recv\" onclick=\"checkAll('recv')\" />,费用状态,应收费用名称,结算单位,计费标准,单价,数量,佣金比例,金额,币别,汇率,FRT,费用备注,是否垫付");
|
|
|
|
|
mygrid_recv.setInitWidths("40,70,110,150,70,80,80,90,90,50,70,70,70,70");
|
|
|
|
|
mygrid_recv.setColAlign("center,center,right,right,right,right,right,right,right,right,right,right,right,center");
|
|
|
|
|
// mygrid_recv.setSkin("light");
|
|
|
|
|
mygrid_recv.setColSorting("na,str,str,str,int,int,int,int,int,int,int,int,int,str");
|
|
|
|
|
mygrid_recv.setColTypes("ch,ro,co,co,co,ed,ed,ed,ed,co,ed,co,txt,ch");
|
|
|
|
|
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
var urlVal = "CrmOrderFeeGridSource.aspx?type=1&read=exist&showcount=1&bsno="+bsno+"&val="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
loader = null;
|
|
|
|
|
|
|
|
|
|
if(parseInt(loadVal) == 1){
|
|
|
|
|
|
|
|
|
|
mygrid_recv.loadXML("CrmOrderFeeGridSource.aspx?type=1&read=init&showcount=1&bsno="+bsno,function(){
|
|
|
|
|
ReShowLabel(mygrid_recv);
|
|
|
|
|
doInitPayGrid();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
ReShowLabel(mygrid_recv);
|
|
|
|
|
},200);
|
|
|
|
|
}else{
|
|
|
|
|
doInitPayGrid();
|
|
|
|
|
}
|
|
|
|
|
mygrid_recv.init();
|
|
|
|
|
mygrid_recv.enableEditEvents(true,false,true);
|
|
|
|
|
//mygrid_recv.enableMultiselect(true);
|
|
|
|
|
//mygrid_recv.setTabOrder("1,2,3,4,5,6,7,8,9,10,11,12");
|
|
|
|
|
//mygrid_recv.enableLightMouseNavigation(true);
|
|
|
|
|
mygrid_recv.enableKeyboardSupport(true);
|
|
|
|
|
|
|
|
|
|
var url = "CrmOrderFeeGridSource.aspx?handle=getauditstatus&bsno="+bsno+"&val="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
|
|
|
|
|
curStatus = parseInt(loader.xmlDoc.responseText);
|
|
|
|
|
|
|
|
|
|
if(curStatus == 9 || curStatus == 2){
|
|
|
|
|
mygrid_recv.enableEditEvents(true,false,true);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
$("btn_audit").disabled = true;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
mygrid_recv.enableEditEvents(false,false,false);
|
|
|
|
|
$("btn_addrecv").onclick = clickNull;
|
|
|
|
|
$("btn_saverecv").onclick = clickNull;
|
|
|
|
|
$("btn_delrecv").onclick = clickNull;
|
|
|
|
|
$("btn_abanrecv").onclick = clickNull;
|
|
|
|
|
$("btn_refreshrecv").onclick = clickNull;
|
|
|
|
|
$("btn_printrecv").onclick = clickNull;
|
|
|
|
|
$("btn_audit").disabled = true;
|
|
|
|
|
}
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
// for(var i=0;i<mygrid_recv.getRowsNum();i++){
|
|
|
|
|
// var rId = mygrid_recv.getRowId(i);
|
|
|
|
|
//
|
|
|
|
|
// var stateVal = mygrid_recv.cellByIndex(i,0).getValue().trim();
|
|
|
|
|
// if(stateVal == "录入状态"){
|
|
|
|
|
// var combo_feename;
|
|
|
|
|
// combo_feename = mygrid_recv.getCustomCombo(rId,1);
|
|
|
|
|
// setFeeNameCombo(combo_feename);
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// var combo_cust;
|
|
|
|
|
// combo_cust = mygrid_recv.getCustomCombo(rId,2);
|
|
|
|
|
// setCustomerCombo(combo_cust);
|
|
|
|
|
//
|
|
|
|
|
// var combo_unit;
|
|
|
|
|
// combo_unit = mygrid_recv.getCustomCombo(rId,3);
|
|
|
|
|
// setUnitCombo(combo_unit);
|
|
|
|
|
//
|
|
|
|
|
// var combo_currency;
|
|
|
|
|
// combo_currency = mygrid_recv.getCustomCombo(rId,8);
|
|
|
|
|
// setCurrencyCombo(combo_currency);
|
|
|
|
|
//
|
|
|
|
|
// var combo_frt;
|
|
|
|
|
// combo_frt = mygrid_recv.getCustomCombo(rId,10);
|
|
|
|
|
// setFrtCombo(combo_frt);
|
|
|
|
|
//
|
|
|
|
|
// var combo_currency;
|
|
|
|
|
// combo_currency = mygrid_recv.getCustomCombo(rId,8);
|
|
|
|
|
// setCurrencyCombo(combo_currency);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
var cacheTemplate = $("h_cachetemplate").value;
|
|
|
|
|
var importType = parseInt($("h_importtype").value);
|
|
|
|
|
if(cacheTemplate != ""){
|
|
|
|
|
var jsonCacheObj = null;
|
|
|
|
|
|
|
|
|
|
jsonCacheObj = eval('(' + cacheTemplate + ')');
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<jsonCacheObj.templates.length;i++){
|
|
|
|
|
var newId = newGuid();
|
|
|
|
|
//获取插入新纪录位置
|
|
|
|
|
//初始化变量
|
|
|
|
|
var rowCount = mygrid_recv.getRowsNum();
|
|
|
|
|
var feeName = "";
|
|
|
|
|
var customerName = "";
|
|
|
|
|
var unit = "";
|
|
|
|
|
var unitprice = 0;
|
|
|
|
|
var quantity = 0;
|
|
|
|
|
var currency = "";
|
|
|
|
|
var exchangeRate = 1;
|
|
|
|
|
var remark = "";
|
|
|
|
|
var isAdvancePay = false;
|
|
|
|
|
var client = "";
|
|
|
|
|
|
|
|
|
|
if(jsonCacheObj.templates[i].type == 1){
|
|
|
|
|
//赋值
|
|
|
|
|
feeName = jsonCacheObj.templates[i].fname;
|
|
|
|
|
customerName = jsonCacheObj.templates[i].cust;
|
|
|
|
|
unit = jsonCacheObj.templates[i].unit;
|
|
|
|
|
unitprice = jsonCacheObj.templates[i].uprice;
|
|
|
|
|
currency = jsonCacheObj.templates[i].cur;
|
|
|
|
|
exchangeRate = jsonCacheObj.templates[i].exrate == 0?1:jsonCacheObj.templates[i].exrate;
|
|
|
|
|
remark = jsonCacheObj.templates[i].remark;
|
|
|
|
|
client = jsonCacheObj.templates[i].client;
|
|
|
|
|
if(customerName.trim() != ""){
|
|
|
|
|
mygrid_recv.addRow(newId,[0,"录入状态",feeName,customerName,unit,unitprice,0,0,0,currency,exchangeRate,"PP",remark,isAdvancePay],rowCount);
|
|
|
|
|
}else{
|
|
|
|
|
var debitObj = null;
|
|
|
|
|
var clientName = "";
|
|
|
|
|
debitObj = getDebitType(client);
|
|
|
|
|
clientName = debitObj.debit[0].value.trim() == null?"":debitObj.debit[0].value.trim();
|
|
|
|
|
|
|
|
|
|
mygrid_recv.addRow(newId,[0,"录入状态",feeName,clientName,unit,unitprice,0,0,0,currency,exchangeRate,"PP",remark,isAdvancePay],rowCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var combo_feename;
|
|
|
|
|
combo_feename = mygrid_recv.getCustomCombo(newId,2);
|
|
|
|
|
setFeeNameCombo(combo_feename);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var combo_cust;
|
|
|
|
|
combo_cust = mygrid_recv.getCustomCombo(newId,3);
|
|
|
|
|
setCustomerCombo(combo_cust);
|
|
|
|
|
|
|
|
|
|
var combo_unit;
|
|
|
|
|
combo_unit = mygrid_recv.getCustomCombo(newId,4);
|
|
|
|
|
setUnitCombo(combo_unit);
|
|
|
|
|
|
|
|
|
|
var combo_currency;
|
|
|
|
|
combo_currency = mygrid_recv.getCustomCombo(newId,9);
|
|
|
|
|
setCurrencyCombo(combo_currency);
|
|
|
|
|
|
|
|
|
|
var combo_frt;
|
|
|
|
|
combo_frt = mygrid_recv.getCustomCombo(rId,11);
|
|
|
|
|
setFrtCombo(combo_frt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},240);
|
|
|
|
|
var pushVal = "";
|
|
|
|
|
var pressRecord = "";
|
|
|
|
|
var pressRowIndex = -1;
|
|
|
|
|
var pressCellIndex = -1;
|
|
|
|
|
var pressCount = 0;
|
|
|
|
|
var isExchange = false;
|
|
|
|
|
var shiftCount = 0;
|
|
|
|
|
var isDelete = 0;
|
|
|
|
|
|
|
|
|
|
var flagFilter = 0;
|
|
|
|
|
var flagTab = 0;
|
|
|
|
|
var flagEnter = 0;
|
|
|
|
|
var flagDelete = 0;
|
|
|
|
|
|
|
|
|
|
// mygrid_recv.attachEvent("onSelectStateChanged", function(id){
|
|
|
|
|
// var rowIndex = mygrid_recv.getRowIndex(id);
|
|
|
|
|
// var checkState = mygrid_recv.cellByIndex(rowIndex,0).getValue();
|
|
|
|
|
//
|
|
|
|
|
// if(checkState == 0){
|
|
|
|
|
// mygrid_recv.cellByIndex(rowIndex,0).setValue(1);
|
|
|
|
|
// }else{
|
|
|
|
|
// mygrid_recv.cellByIndex(rowIndex,0).setValue(0);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
mygrid_recv.attachEvent("onSelectStateChanged", function(id){
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(id);
|
|
|
|
|
|
|
|
|
|
if(rowIndex >= 0){
|
|
|
|
|
var stateVal = mygrid_recv.cellByIndex(rowIndex,1).getValue().trim();
|
|
|
|
|
|
|
|
|
|
if(stateVal == "录入状态"|| stateVal == "驳回提交"){
|
|
|
|
|
var combo_currency;
|
|
|
|
|
combo_currency = mygrid_recv.getCustomCombo(id,9);
|
|
|
|
|
if(combo_currency.getKeys.length <= 1){
|
|
|
|
|
setCurrencyCombo(combo_currency);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var combo_feename;
|
|
|
|
|
combo_feename = mygrid_recv.getCustomCombo(id,2);
|
|
|
|
|
if(combo_feename.getKeys.length <= 1){
|
|
|
|
|
setFeeNameCombo(combo_feename);
|
|
|
|
|
}
|
|
|
|
|
var combo_cust;
|
|
|
|
|
|
|
|
|
|
combo_cust = mygrid_recv.getCustomCombo(id,3);
|
|
|
|
|
if(combo_cust.getKeys.length <= 1){
|
|
|
|
|
setCustomerCombo(combo_cust);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var combo_unit;
|
|
|
|
|
combo_unit = mygrid_recv.getCustomCombo(id,4);
|
|
|
|
|
|
|
|
|
|
if(combo_unit.getKeys.length <= 1){
|
|
|
|
|
setUnitCombo(combo_unit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var combo_frt;
|
|
|
|
|
combo_frt = mygrid_recv.getCustomCombo(id,11);
|
|
|
|
|
|
|
|
|
|
if(combo_frt.getKeys.length <= 1){
|
|
|
|
|
setFrtCombo(combo_frt);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//手动编写Grid控件编辑事件,由于免费控件没有提供完整的编辑判断功能,现特此做更改
|
|
|
|
|
mygrid_recv.attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
|
|
|
|
|
var newCheckValue = false;
|
|
|
|
|
//初始化状态
|
|
|
|
|
if(stage == 0){
|
|
|
|
|
//alert();
|
|
|
|
|
//return true;
|
|
|
|
|
//var cell = mygrid_recv.cellById(rId,cInd);
|
|
|
|
|
//alert(cell.getValue());
|
|
|
|
|
//var selectedId = mygrid_recv.getSelectedRowId();
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(rId);
|
|
|
|
|
|
|
|
|
|
var oldVal = mygrid_recv.cellByIndex(rowIndex,1).getValue().trim();
|
|
|
|
|
// alert(cInd)
|
|
|
|
|
// if(cInd == 0){
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
var crmStatus = parseInt($("h_crmstatus").value);
|
|
|
|
|
|
|
|
|
|
if(crmStatus != 9 && crmStatus != 2){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if(oldVal == "录入状态"){
|
|
|
|
|
if(parseInt($("h_authority").value) > 0){
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//return true;
|
|
|
|
|
}else{
|
|
|
|
|
if(parseInt($("h_authority").value) > 0){
|
|
|
|
|
if(cInd == 0){
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//return false;
|
|
|
|
|
//return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(stage == 1){
|
|
|
|
|
var selectedId = mygrid_recv.getSelectedRowId();
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(selectedId);
|
|
|
|
|
|
|
|
|
|
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(cInd == 2 || cInd == 3){
|
|
|
|
|
if(flagFilter == 0){
|
|
|
|
|
//alert(txtEdit.value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//如果编辑结束
|
|
|
|
|
if(stage == 2){
|
|
|
|
|
changeFeeRecvCount++;
|
|
|
|
|
if(cInd == 5){
|
|
|
|
|
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(rId);
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,5).setValue(outputMoney(unitPrice.toString()));
|
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,6).setValue(outputMoney(quantityCount.toString()));
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}else if(cInd == 6){
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(rId);
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityOrig = mygrid_recv.cellByIndex(rowIndex,6).getValue();
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
|
|
|
|
|
if(!isDigit(quantityOrig)){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,5).setValue(outputMoney(unitPrice.toString()));
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,6).setValue(outputMoney(quantityCount.toString()));
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
}else if(cInd == 9){
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(rId);
|
|
|
|
|
|
|
|
|
|
//filterComboCustomerPress(mygrid_recv,rId,rowIndex,9,nValue,oValue);
|
|
|
|
|
|
|
|
|
|
var curValue = mygrid_recv.cellByIndex(rowIndex,9).getValue();//alert(curValue);
|
|
|
|
|
//alert(curValue);
|
|
|
|
|
//alert(rId);alert(curValue);
|
|
|
|
|
//var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+curValue;
|
|
|
|
|
var bsno = $("h_bsno").value;
|
|
|
|
|
var urlVal = "../FeeCodes/CurrencyCodeService.aspx?bsno="+bsno+"&type=2¤cy="+feeCodeObj.feecode[0].cur+"&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,10).setValue(loadVal);
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
loader == null;
|
|
|
|
|
return true;
|
|
|
|
|
}else if(cInd == 10){
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(rId);
|
|
|
|
|
var currency = mygrid_recv.cellByIndex(rowIndex,9).getValue();
|
|
|
|
|
var rate = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,10).getValue())));
|
|
|
|
|
if(currency == "RMB"){
|
|
|
|
|
if(rate != 1){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}else if(currency == "USD"){
|
|
|
|
|
if(rate <= 1){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}else if(cInd == 8){
|
|
|
|
|
return;
|
|
|
|
|
}else if(cInd == 4){
|
|
|
|
|
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(rId);
|
|
|
|
|
var unitVal = mygrid_recv.cellByIndex(rowIndex,4).getValue();
|
|
|
|
|
var quantityObj = null;
|
|
|
|
|
quantityObj = getTypeNameQuantity(unitVal);
|
|
|
|
|
|
|
|
|
|
if(quantityObj.quantity.length > 0){
|
|
|
|
|
if(quantityObj.quantity[0].value > 0){
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,4).setValue(quantityObj.quantity[0].name);
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,6).setValue(quantityObj.quantity[0].value);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}else{
|
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,4).setValue("");
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,6).setValue(1);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = 1;//clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//重新计算利润
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if(cInd == 2 || cInd == 3)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(rId);
|
|
|
|
|
if(pressCount == 1)
|
|
|
|
|
{
|
|
|
|
|
if(flagFilter == 1)
|
|
|
|
|
{
|
|
|
|
|
//mygrid_recv.editStop();
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setLabel(oValue);//alert(oValue);
|
|
|
|
|
//alert(mygrid_recv.cellByIndex(rowIndex,cInd).getValue());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// if(pressRowIndex == rowIndex && pressCellIndex == cInd){
|
|
|
|
|
var cellVal = mygrid_recv.cellByIndex(rowIndex,cInd).getValue();
|
|
|
|
|
|
|
|
|
|
var combo = mygrid_recv.getCustomCombo(rId,cInd);
|
|
|
|
|
var comboArg = combo.getKeys();
|
|
|
|
|
var tempCount = 0;
|
|
|
|
|
if(cellVal.indexOf(" ") >0 && cellVal.indexOf(" ") < cellVal.length){
|
|
|
|
|
cellVal = cellVal.substring(0,cellVal.indexOf(" "));
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
|
|
|
|
|
if(combo.get(comboArg[i]).trim().indexOf(cellVal) == 0){
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]);
|
|
|
|
|
tempCount++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
if(comboArg[i] == cellVal){
|
|
|
|
|
if(combo.get(comboArg[i]).trim().indexOf(cellVal) > 0){
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]);
|
|
|
|
|
tempCount++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}//alert(tempCount)
|
|
|
|
|
if(tempCount == 0){
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setValue("");
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setLabel("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isExchange = false;
|
|
|
|
|
pressRecord = "";
|
|
|
|
|
pressRowIndex = -1;
|
|
|
|
|
pressCellIndex = -1;
|
|
|
|
|
pressCount = 0;
|
|
|
|
|
flagFilter = 0;
|
|
|
|
|
// var url = "";
|
|
|
|
|
// var feeCodeObj = null;
|
|
|
|
|
// var feeName = mygrid_recv.cellByIndex(rowIndex,1).getValue();
|
|
|
|
|
//
|
|
|
|
|
// if(feeName.trim() != ""){
|
|
|
|
|
// url = "../FeeCodes/FeeCodeService.aspx?handle=getcurrency&feename="+escape(feeName)+"&uid="+newGuid();alert(url);
|
|
|
|
|
//
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
//
|
|
|
|
|
// var feeCodeInfo = loader.xmlDoc.responseText;
|
|
|
|
|
// feeCodeObj = eval('(' + feeCodeInfo + ')');
|
|
|
|
|
//
|
|
|
|
|
// if(feeCodeObj.feecode.length > 0){
|
|
|
|
|
// mygrid_recv.cellByIndex(rowIndex,8).setValue(feeCodeObj.feecode[0].cur);
|
|
|
|
|
// var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+feeCodeObj.feecode[0].cur;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
// mygrid_recv.cellByIndex(rowIndex,9).setValue(loadVal);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
// }else{
|
|
|
|
|
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(pressCount == 2)
|
|
|
|
|
{
|
|
|
|
|
if(flagFilter == 1)
|
|
|
|
|
{
|
|
|
|
|
mygrid_recv.editStop();
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setLabel(oValue);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if(pressRowIndex != rowIndex && pressCellIndex != cInd)
|
|
|
|
|
{
|
|
|
|
|
//alert(mygrid_recv.cellByIndex(rowIndex,cInd).getValue());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
isExchange = false;
|
|
|
|
|
pressRecord = "";
|
|
|
|
|
pressRowIndex = -1;
|
|
|
|
|
pressCellIndex = -1;
|
|
|
|
|
pressCount = 0;
|
|
|
|
|
flagFilter = 0;
|
|
|
|
|
|
|
|
|
|
var cellVal = mygrid_recv.cellByIndex(rowIndex,cInd).getValue();
|
|
|
|
|
var combo = mygrid_recv.getCustomCombo(rId,cInd);
|
|
|
|
|
var comboArg = combo.getKeys();
|
|
|
|
|
var tempCount = 0;
|
|
|
|
|
if(cellVal.indexOf(" ") >0 && cellVal.indexOf(" ") < cellVal.length){
|
|
|
|
|
cellVal = cellVal.substring(0,cellVal.indexOf(" "));
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
if(combo.get(comboArg[i]).trim().indexOf(cellVal) == 0){
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]);
|
|
|
|
|
tempCount++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(tempCount == 0){
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setValue("");
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setLabel("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//alert(mygrid_recv.cellByIndex(rowIndex,cInd).getValue());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var cellVal = mygrid_recv.cellByIndex(rowIndex,cInd).getValue();
|
|
|
|
|
var combo = mygrid_recv.getCustomCombo(rId,cInd);
|
|
|
|
|
var comboArg = combo.getKeys();
|
|
|
|
|
|
|
|
|
|
if(cellVal.indexOf(" ") >0 && cellVal.indexOf(" ") < cellVal.length)
|
|
|
|
|
{
|
|
|
|
|
cellVal = cellVal.substring(0,cellVal.indexOf(" "));
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(combo.get(comboArg[i]).trim().indexOf(cellVal) == 0)
|
|
|
|
|
{
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++)
|
|
|
|
|
{
|
|
|
|
|
if(combo.get(comboArg[i]).trim().indexOf(cellVal) > 0)
|
|
|
|
|
{
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(cInd == 2){
|
|
|
|
|
var url = "";
|
|
|
|
|
var feeCodeObj = null;
|
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,2).getValue().trim();
|
|
|
|
|
|
|
|
|
|
if(feeName != ""){
|
|
|
|
|
url = "../FeeCodes/FeeCodeService.aspx?handle=getcurrency&feename="+escape(feeName)+"&uid="+newGuid();
|
|
|
|
|
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
|
|
|
|
|
var feeCodeInfo = loader.xmlDoc.responseText;
|
|
|
|
|
|
|
|
|
|
feeCodeObj = eval('(' + feeCodeInfo + ')');
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode.length > 0){
|
|
|
|
|
if(feeCodeObj.feecode[0].cur.trim() != ""){
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,9).setValue(feeCodeObj.feecode[0].cur);
|
|
|
|
|
//var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+feeCodeObj.feecode[0].cur;
|
|
|
|
|
var bsno = $("h_bsno").value;
|
|
|
|
|
var urlVal = "../FeeCodes/CurrencyCodeService.aspx?bsno="+bsno+"&type=2¤cy="+feeCodeObj.feecode[0].cur+"&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,10).setValue(loadVal);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode[0].unit != 0){
|
|
|
|
|
quantityObj = getUnitType(feeCodeObj.feecode[0].unit);
|
|
|
|
|
|
|
|
|
|
if(quantityObj.quantity.length > 0){
|
|
|
|
|
if(quantityObj.quantity[0].value > 0){
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,4).setValue(quantityObj.quantity[0].name);
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,6).setValue(quantityObj.quantity[0].value);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,4).setValue("");
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,6).setValue(1);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
|
|
|
|
|
var quantityCount = 1;
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode[0].debit > 0){
|
|
|
|
|
var debitObj = null;
|
|
|
|
|
debitObj = getDebitType(feeCodeObj.feecode[0].debit);
|
|
|
|
|
|
|
|
|
|
if(debitObj.debit.length > 0){
|
|
|
|
|
|
|
|
|
|
if(debitObj.debit[0].value.trim() != ""){
|
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,3).setLabel(debitObj.debit[0].value);
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,3).setValue(debitObj.debit[0].value);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ReShowLabel(mygrid_recv);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// mygrid_recv.attachEvent("onSelectStateChanged", function(id){
|
|
|
|
|
// var combo_feename;
|
|
|
|
|
// combo_feename = mygrid_recv.getCustomCombo(id,1);
|
|
|
|
|
// setFeeNameCombo(combo_feename);
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// var combo_cust;
|
|
|
|
|
// combo_cust = mygrid_recv.getCustomCombo(id,2);
|
|
|
|
|
// setCustomerCombo(combo_cust);
|
|
|
|
|
//
|
|
|
|
|
// var combo_unit;
|
|
|
|
|
// combo_unit = mygrid_recv.getCustomCombo(id,3);
|
|
|
|
|
// setUnitCombo(combo_unit);
|
|
|
|
|
//
|
|
|
|
|
// var combo_currency;
|
|
|
|
|
// combo_currency = mygrid_recv.getCustomCombo(id,8);
|
|
|
|
|
// setCurrencyCombo(combo_currency);
|
|
|
|
|
//
|
|
|
|
|
// var combo_frt;
|
|
|
|
|
// combo_frt = mygrid_recv.getCustomCombo(id,10);
|
|
|
|
|
// setFrtCombo(combo_frt);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// mygrid_recv.attachEvent("onRowSelect", function(id,ind){
|
|
|
|
|
//
|
|
|
|
|
// var combo_feename;
|
|
|
|
|
// combo_feename = mygrid_recv.getCustomCombo(id,1);
|
|
|
|
|
// setFeeNameCombo(combo_feename);
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// var combo_cust;
|
|
|
|
|
// combo_cust = mygrid_recv.getCustomCombo(id,2);
|
|
|
|
|
// setCustomerCombo(combo_cust);
|
|
|
|
|
//
|
|
|
|
|
// var combo_unit;
|
|
|
|
|
// combo_unit = mygrid_recv.getCustomCombo(id,3);
|
|
|
|
|
// setUnitCombo(combo_unit);
|
|
|
|
|
//
|
|
|
|
|
// var combo_currency;
|
|
|
|
|
// combo_currency = mygrid_recv.getCustomCombo(id,8);
|
|
|
|
|
// setCurrencyCombo(combo_currency);
|
|
|
|
|
//
|
|
|
|
|
// var combo_frt;
|
|
|
|
|
// combo_frt = mygrid_recv.getCustomCombo(id,10);
|
|
|
|
|
// setFrtCombo(combo_frt);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
//键盘操作事件
|
|
|
|
|
mygrid_recv.attachEvent("onKeyPress", function(code,cFlag,sFlag){
|
|
|
|
|
//onKeyPress begin
|
|
|
|
|
var crmStatus = parseInt($("h_crmstatus").value);
|
|
|
|
|
|
|
|
|
|
if(crmStatus != 9 && crmStatus != 2){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//获取当前RowID
|
|
|
|
|
var selectedId = mygrid_recv.getSelectedRowId();
|
|
|
|
|
//获取当前RowIndex
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(selectedId);
|
|
|
|
|
//获取当前CellIndex(ind)
|
|
|
|
|
var ind = mygrid_recv.getSelectedCellIndex();
|
|
|
|
|
|
|
|
|
|
//触发操作事件前获取单元值
|
|
|
|
|
var oldVal = mygrid_recv.cellByIndex(rowIndex,ind).getValue();
|
|
|
|
|
//获取编辑单元
|
|
|
|
|
var txtEdit;
|
|
|
|
|
|
|
|
|
|
for(i = 0; i < document.all.length; i++){
|
|
|
|
|
if(document.all(i).tagName == "TEXTAREA"){
|
|
|
|
|
txtEdit = document.all(i);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(code == 13){
|
|
|
|
|
if(ind == 5){
|
|
|
|
|
|
|
|
|
|
// var rowIndex = mygrid_recv.getRowIndex(selectedId);
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,5).setValue(outputMoney(unitPrice.toString()));
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if(ind == 2 || ind == 3 ||ind == 4||ind == 11){
|
|
|
|
|
//如果是检索失败,
|
|
|
|
|
if(pressCount == 2){
|
|
|
|
|
mygrid_recv.editStop();
|
|
|
|
|
//将value写入cell(触发 stage2)
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,ind).setValue(oldVal);
|
|
|
|
|
//重新打开cell(触发stage0 stage1)
|
|
|
|
|
mygrid_recv.selectCell(rowIndex,ind,true,true);
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,ind).setLabel(oldVal);
|
|
|
|
|
mygrid_recv.editCell();
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(ind == 2){
|
|
|
|
|
var url = "";
|
|
|
|
|
var feeCodeObj = null;
|
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,2).getValue().trim();
|
|
|
|
|
|
|
|
|
|
if(feeName != ""){
|
|
|
|
|
url = "../FeeCodes/FeeCodeService.aspx?handle=getcurrency&feename="+escape(feeName)+"&uid="+newGuid();
|
|
|
|
|
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
|
|
|
|
|
var feeCodeInfo = loader.xmlDoc.responseText;
|
|
|
|
|
|
|
|
|
|
feeCodeObj = eval('(' + feeCodeInfo + ')');
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode.length > 0){
|
|
|
|
|
if(feeCodeObj.feecode[0].cur.trim() != ""){
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,9).setValue(feeCodeObj.feecode[0].cur);
|
|
|
|
|
//var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+feeCodeObj.feecode[0].cur;
|
|
|
|
|
var bsno = $("h_bsno").value;
|
|
|
|
|
var urlVal = "../FeeCodes/CurrencyCodeService.aspx?bsno="+bsno+"&type=2¤cy="+feeCodeObj.feecode[0].cur+"&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,10).setValue(loadVal);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode[0].unit != 0){
|
|
|
|
|
quantityObj = getUnitType(feeCodeObj.feecode[0].unit);
|
|
|
|
|
|
|
|
|
|
if(quantityObj.quantity.length > 0){
|
|
|
|
|
if(quantityObj.quantity[0].value > 0){
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,4).setValue(quantityObj.quantity[0].name);
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,6).setValue(quantityObj.quantity[0].value);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,4).setValue("");
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,6).setValue(1);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
|
|
|
|
|
var quantityCount = 1;
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode[0].debit > 0){
|
|
|
|
|
var debitObj = null;
|
|
|
|
|
debitObj = getDebitType(feeCodeObj.feecode[0].debit);
|
|
|
|
|
|
|
|
|
|
if(debitObj.debit.length > 0){
|
|
|
|
|
|
|
|
|
|
if(debitObj.debit[0].value.trim() != ""){
|
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,2).setLabel(debitObj.debit[0].value);
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,3).setValue(debitObj.debit[0].value);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ReShowLabelForEnter(mygrid_recv);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Tab键
|
|
|
|
|
if(code == 9){
|
|
|
|
|
|
|
|
|
|
//code9 begin
|
|
|
|
|
var colCount = mygrid_recv.getColumnsNum();
|
|
|
|
|
var rowCount = mygrid_recv.getRowsNum();
|
|
|
|
|
|
|
|
|
|
if(ind < colCount){
|
|
|
|
|
isExchange = false;
|
|
|
|
|
pressRecord = "";
|
|
|
|
|
pressRowIndex = -1;
|
|
|
|
|
pressCellIndex = -1;
|
|
|
|
|
mygrid_recv.editStop(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,ind).setLabel(oldVal);
|
|
|
|
|
|
|
|
|
|
var cInd = ind;
|
|
|
|
|
|
|
|
|
|
// if(cInd == 2){
|
|
|
|
|
// //var combo = mygrid_recv.getCustomCombo(rId,cInd);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
var rId = selectedId;
|
|
|
|
|
if(cInd == 5){
|
|
|
|
|
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(rId);
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,5).setValue(outputMoney(unitPrice.toString()));
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if(cInd == 6){
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(rId);
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,5).setValue(outputMoney(unitPrice.toString()));
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,6).setValue(outputMoney(quantityCount.toString()));
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
}else if(cInd == 9){
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(rId);
|
|
|
|
|
|
|
|
|
|
//filterComboCustomerPress(mygrid_recv,rId,rowIndex,8,nValue,oValue);
|
|
|
|
|
|
|
|
|
|
var curValue = mygrid_recv.cellByIndex(rowIndex,9).getValue();
|
|
|
|
|
//var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+curValue+"&val="+newGuid()+"&uid="+newGuid();
|
|
|
|
|
var bsno = $("h_bsno").value;
|
|
|
|
|
var urlVal = "../FeeCodes/CurrencyCodeService.aspx?bsno="+bsno+"&type=2¤cy="+feeCodeObj.feecode[0].cur+"&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,10).setValue(loadVal);
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
loader == null;
|
|
|
|
|
}else if(cInd == 2){
|
|
|
|
|
var url = "";
|
|
|
|
|
var feeCodeObj = null;
|
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,2).getValue().trim();
|
|
|
|
|
|
|
|
|
|
if(feeName != ""){
|
|
|
|
|
url = "../FeeCodes/FeeCodeService.aspx?handle=getcurrency&feename="+escape(feeName)+"&uid="+newGuid();
|
|
|
|
|
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
|
|
|
|
|
var feeCodeInfo = loader.xmlDoc.responseText;
|
|
|
|
|
feeCodeObj = eval('(' + feeCodeInfo + ')');
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode.length > 0){
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,9).setValue(feeCodeObj.feecode[0].cur);
|
|
|
|
|
//var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+feeCodeObj.feecode[0].cur;
|
|
|
|
|
var bsno = $("h_bsno").value;
|
|
|
|
|
var urlVal = "../FeeCodes/CurrencyCodeService.aspx?bsno="+bsno+"&type=2¤cy="+feeCodeObj.feecode[0].cur+"&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,10).setValue(loadVal);
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode[0].unit != 0){
|
|
|
|
|
quantityObj = getUnitType(feeCodeObj.feecode[0].unit);
|
|
|
|
|
|
|
|
|
|
if(quantityObj.quantity.length > 0){
|
|
|
|
|
if(quantityObj.quantity[0].value >= 0){
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,4).setValue(quantityObj.quantity[0].name);
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,6).setValue(quantityObj.quantity[0].value);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,7).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,4).setValue("");
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,6).setValue(1);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = 1;//clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
if(feeCodeObj.feecode[0].debit > 0){
|
|
|
|
|
var debitObj = null;
|
|
|
|
|
debitObj = getDebitType(feeCodeObj.feecode[0].debit);
|
|
|
|
|
|
|
|
|
|
if(debitObj.debit.length > 0){
|
|
|
|
|
|
|
|
|
|
if(debitObj.debit[0].value.trim() != ""){
|
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,3).setLabel(debitObj.debit[0].value);
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,3).setValue(debitObj.debit[0].value);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mygrid_recv.selectCell(rowIndex,ind+1,true,true);
|
|
|
|
|
mygrid_recv.editCell();
|
|
|
|
|
if(ind == colCount - 2){
|
|
|
|
|
if(rowIndex < rowCount){
|
|
|
|
|
mygrid_recv.editStop(true);
|
|
|
|
|
mygrid_recv.clearSelection();
|
|
|
|
|
mygrid_recv.selectCell(rowIndex+1,1,true,true);
|
|
|
|
|
mygrid_recv.editCell();
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//cdoe9 end
|
|
|
|
|
}
|
|
|
|
|
if((code>=65&&code<=90) || (code>=48 && code <=57)||(code>=96 && code<=105)){//如果是输入英文字符
|
|
|
|
|
|
|
|
|
|
if(ind == 2 || ind == 3 ||ind == 4||ind == 11){
|
|
|
|
|
//获取键盘输入字符
|
|
|
|
|
var pressVal = String.fromCharCode(code);
|
|
|
|
|
var start=0;
|
|
|
|
|
var end=0;
|
|
|
|
|
if(document.selection){
|
|
|
|
|
var range = document.selection.createRange();
|
|
|
|
|
|
|
|
|
|
if(range.parentElement().className == txtEdit.className){
|
|
|
|
|
// create a selection of the whole textarea
|
|
|
|
|
var range_all = document.body.createTextRange();
|
|
|
|
|
range_all.moveToElementText(txtEdit);
|
|
|
|
|
|
|
|
|
|
for (start=0; range_all.compareEndPoints("StartToStart", range) < 0; start++){
|
|
|
|
|
range_all.moveStart('character', 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i <= start; i ++){
|
|
|
|
|
if (txtEdit.value.charAt(i) == '\n')
|
|
|
|
|
start++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var range_all = document.body.createTextRange();
|
|
|
|
|
range_all.moveToElementText(txtEdit);
|
|
|
|
|
|
|
|
|
|
for (end = 0; range_all.compareEndPoints('StartToEnd', range) < 0; end ++)
|
|
|
|
|
range_all.moveStart('character', 1);
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i <= end; i ++){
|
|
|
|
|
if (txtEdit.value.charAt(i) == '\n')
|
|
|
|
|
end ++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//如果是当前检索位置
|
|
|
|
|
if(rowIndex == pressRowIndex && ind == pressCellIndex){
|
|
|
|
|
//未选中多个字符
|
|
|
|
|
if(start == end){
|
|
|
|
|
if(start != pressRecord.length){
|
|
|
|
|
if(start != 0){
|
|
|
|
|
var firstVal = pressRecord.substring(0,start - 1);
|
|
|
|
|
var endVal = pressRecord.substring(start + 1,txtEdit.value.length - 1);
|
|
|
|
|
// alert(firstVal);alert(endVal);
|
|
|
|
|
pressRecord = firstVal+pressVal+endVal;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
pressRecord = pressRecord+pressVal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//选中多个字符
|
|
|
|
|
if(start != end){
|
|
|
|
|
var firstVal = pressRecord.substring(0,start);
|
|
|
|
|
var endVal = pressRecord.substring(end - 1,txtEdit.value.length - 1);
|
|
|
|
|
// alert(firstVal);alert(endVal);
|
|
|
|
|
pressRecord = firstVal+pressVal+endVal;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
pressRecord = pressVal;
|
|
|
|
|
pressRowIndex = rowIndex;
|
|
|
|
|
pressCellIndex = ind;
|
|
|
|
|
}
|
|
|
|
|
// alert(pressRecord);alert(start);alert(end);alert(txtEdit.value);
|
|
|
|
|
//获取combo下拉列表
|
|
|
|
|
var combo = mygrid_recv.getCustomCombo(selectedId,ind);
|
|
|
|
|
var comboArg = combo.getKeys();
|
|
|
|
|
var count = 0;
|
|
|
|
|
|
|
|
|
|
//开始遍历检索
|
|
|
|
|
//如果检索成功 状态pressCount=1 如果不成功应为pressCount=2
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
if(combo.get(comboArg[i]).toUpperCase().trim().indexOf(pressRecord) == 0){
|
|
|
|
|
//计数
|
|
|
|
|
count++;
|
|
|
|
|
//获取value
|
|
|
|
|
var oldVal = comboArg[i];
|
|
|
|
|
//获取label
|
|
|
|
|
var oldLab = combo.get(comboArg[i]);
|
|
|
|
|
|
|
|
|
|
//记录状态值 检索到数据项
|
|
|
|
|
pressCount = 1;
|
|
|
|
|
flagFilter = 1;
|
|
|
|
|
//关闭编辑
|
|
|
|
|
mygrid_recv.editStop();
|
|
|
|
|
//将value写入cell(触发 stage2)
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,ind).setValue(oldVal);
|
|
|
|
|
flagFilter = 0;
|
|
|
|
|
//重新打开cell(触发stage0 stage1)
|
|
|
|
|
mygrid_recv.selectCell(rowIndex,ind,true,true);
|
|
|
|
|
mygrid_recv.editCell();
|
|
|
|
|
|
|
|
|
|
var old_length = oldLab.length;
|
|
|
|
|
//产生效果将检索字母之后的数据进行选黑
|
|
|
|
|
for(i = 0; i < document.all.length; i++){
|
|
|
|
|
if(document.all(i).tagName == "TEXTAREA"){
|
|
|
|
|
txtEdit = document.all(i);
|
|
|
|
|
|
|
|
|
|
var rt = txtEdit.createTextRange();
|
|
|
|
|
rt.collapse();
|
|
|
|
|
rt.select();//光标置最前
|
|
|
|
|
|
|
|
|
|
var r = document.selection.createRange();
|
|
|
|
|
r.collapse(false);
|
|
|
|
|
r.moveStart("character", pressRecord.length);//从m位开始
|
|
|
|
|
r.moveEnd("character", old_length);//选取n位
|
|
|
|
|
r.select();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//如果检索不能成功 pressCount=2
|
|
|
|
|
if(count == 0){
|
|
|
|
|
pressCount = 2;
|
|
|
|
|
txtEdit.value = pressRecord;
|
|
|
|
|
for(i = 0; i < document.all.length; i++){
|
|
|
|
|
if(document.all(i).tagName == "TEXTAREA"){
|
|
|
|
|
txtEdit = document.all(i);
|
|
|
|
|
|
|
|
|
|
var rt = txtEdit.createTextRange();
|
|
|
|
|
rt.collapse();
|
|
|
|
|
rt.select();//光标置最前
|
|
|
|
|
|
|
|
|
|
var r = document.selection.createRange();
|
|
|
|
|
r.collapse(true);
|
|
|
|
|
r.moveStart("character", pressRecord.length);//从m位开始
|
|
|
|
|
r.moveEnd("character", pressRecord.length);//选取n位
|
|
|
|
|
|
|
|
|
|
r.select();
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if((code>=48 && code <=57)||(code>=96 && code<=105)){
|
|
|
|
|
if(ind == 5 ||ind == 6 ||ind == 7 ||ind == 10){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//delete
|
|
|
|
|
if(code == 8){
|
|
|
|
|
//code8 begin
|
|
|
|
|
if(ind == 2 || ind == 3 ||ind == 4||ind == 11){
|
|
|
|
|
var start=0;
|
|
|
|
|
var end=0;
|
|
|
|
|
if(document.selection){
|
|
|
|
|
var range = document.selection.createRange();
|
|
|
|
|
|
|
|
|
|
if(range.parentElement().className == txtEdit.className){
|
|
|
|
|
var range_all = document.body.createTextRange();
|
|
|
|
|
range_all.moveToElementText(txtEdit);
|
|
|
|
|
|
|
|
|
|
for (start=0; range_all.compareEndPoints("StartToStart", range) < 0; start++){
|
|
|
|
|
range_all.moveStart('character', 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i <= start; i ++){
|
|
|
|
|
if (txtEdit.value.charAt(i) == '\n')
|
|
|
|
|
start++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var range_all = document.body.createTextRange();
|
|
|
|
|
range_all.moveToElementText(txtEdit);
|
|
|
|
|
|
|
|
|
|
for (end = 0; range_all.compareEndPoints('StartToEnd', range) < 0; end ++)
|
|
|
|
|
range_all.moveStart('character', 1);
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i <= end; i ++){
|
|
|
|
|
if (txtEdit.value.charAt(i) == '\n')
|
|
|
|
|
end ++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// alert(start);alert(end);
|
|
|
|
|
//未选中多个字符
|
|
|
|
|
if(start == end){
|
|
|
|
|
if(start != 0){
|
|
|
|
|
var firstVal = pressRecord.substring(0,start - 1);
|
|
|
|
|
var endVal = pressRecord.substring(start + 1,txtEdit.value.length - 1);
|
|
|
|
|
pressRecord = firstVal;
|
|
|
|
|
// alert(firstVal);alert(endVal);alert(pressRecord);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//选中多个字符
|
|
|
|
|
if(start != end){
|
|
|
|
|
var firstVal = pressRecord.substring(0,start);
|
|
|
|
|
var endVal = pressRecord.substring(end - 1,txtEdit.value.length - 1);
|
|
|
|
|
pressRecord = firstVal+endVal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
if(pressRecord.trim().length > 0){
|
|
|
|
|
var combo = mygrid_recv.getCustomCombo(selectedId,ind);
|
|
|
|
|
var comboArg = combo.getKeys();
|
|
|
|
|
var count = 0;
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
|
|
|
|
|
if(combo.get(comboArg[i]).toUpperCase().trim().indexOf(pressRecord) == 0){
|
|
|
|
|
count++;
|
|
|
|
|
var oldVal = comboArg[i];
|
|
|
|
|
var oldLab = combo.get(comboArg[i]);
|
|
|
|
|
pressCount = 3;
|
|
|
|
|
mygrid_recv.editStop();
|
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,ind).setValue(oldVal);
|
|
|
|
|
|
|
|
|
|
mygrid_recv.selectCell(rowIndex,ind,true,true);
|
|
|
|
|
mygrid_recv.editCell();
|
|
|
|
|
var old_length = oldLab.length;
|
|
|
|
|
|
|
|
|
|
for(i = 0; i < document.all.length; i++){
|
|
|
|
|
if(document.all(i).tagName == "TEXTAREA"){
|
|
|
|
|
txtEdit = document.all(i);
|
|
|
|
|
|
|
|
|
|
var rt = txtEdit.createTextRange();
|
|
|
|
|
rt.collapse();
|
|
|
|
|
rt.select();//光标置最前
|
|
|
|
|
|
|
|
|
|
var r = document.selection.createRange();
|
|
|
|
|
r.collapse(false);
|
|
|
|
|
|
|
|
|
|
r.moveStart("character", pressRecord.length);//从m位开始
|
|
|
|
|
r.moveEnd("character", old_length);//选取n位
|
|
|
|
|
//txtEdit.focus();
|
|
|
|
|
r.select();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},500);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//code8 end
|
|
|
|
|
}
|
|
|
|
|
//向下方向键
|
|
|
|
|
if(code == 40){
|
|
|
|
|
//code40 begin
|
|
|
|
|
|
|
|
|
|
if(ind == 1 || ind == 13|| ind == 5|| ind == 6|| ind == 7|| ind == 8|| ind == 10){
|
|
|
|
|
var rowCount = mygrid_recv.getRowsNum();
|
|
|
|
|
mygrid_recv.clearSelection();
|
|
|
|
|
mygrid_recv.editStop();
|
|
|
|
|
if(rowIndex == (rowCount - 1)){
|
|
|
|
|
addRecvRow();
|
|
|
|
|
}else{
|
|
|
|
|
mygrid_recv.selectCell(rowIndex+1,1,true,true);
|
|
|
|
|
mygrid_recv.editCell();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
pressCount = 0;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//code40 end
|
|
|
|
|
}
|
|
|
|
|
//向上箭头
|
|
|
|
|
if(code == 38){
|
|
|
|
|
//code38 begin
|
|
|
|
|
|
|
|
|
|
if(ind == 1 || ind == 13|| ind == 5|| ind == 6|| ind == 7|| ind == 8|| ind == 10){
|
|
|
|
|
if(rowIndex > 0){
|
|
|
|
|
mygrid_recv.clearSelection();
|
|
|
|
|
mygrid_recv.editStop();
|
|
|
|
|
mygrid_recv.selectCell(rowIndex-1,1,true,true);
|
|
|
|
|
mygrid_recv.editCell();
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
pressCount = 0;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//code38 end
|
|
|
|
|
}
|
|
|
|
|
//键盘输入数字code >= 48 && code <= 57|| code >= 96 && code <= 105 ||
|
|
|
|
|
if(code == 188|| code == 110|| code == 190){
|
|
|
|
|
if( ind == 2|| ind == 3|| ind == 4||ind == 5|| ind == 6|| ind == 7|| ind == 8|| ind == 10||ind == 12){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(code == 189 || code == 109){
|
|
|
|
|
if(ind == 5){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//onKeyPress end
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// var pressVal = "";
|
|
|
|
|
// var pressColIndex = 0;
|
|
|
|
|
// var pressRowIndex = 0;
|
|
|
|
|
// var pressGridType = 1;//recv
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
markStatusColor(mygrid_recv);
|
|
|
|
|
},460);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//讲下拉列表Combo所有生成Array数组
|
|
|
|
|
function setComboByArray(gridNewObj,comboObj,rowGID,colIndex){
|
|
|
|
|
//var comboTxt_arg = new Array();
|
|
|
|
|
var comboVal_arg = new Array();
|
|
|
|
|
|
|
|
|
|
comboVal_arg = comboObj.getKeys();
|
|
|
|
|
var newCombo = gridNewObj.getCustomCombo(rowGID,colIndex);
|
|
|
|
|
|
|
|
|
|
for(var i = 0;i < comboVal_arg.length;i++){
|
|
|
|
|
var txtValue = comboObj.get(comboVal_arg[i]);
|
|
|
|
|
|
|
|
|
|
newCombo.put(comboVal_arg[i],txtValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function spliceBuffer(arrayRow){
|
|
|
|
|
var strBuffer = "";
|
|
|
|
|
for(var i = 0;i<arrayRow.length;++i){
|
|
|
|
|
strBuffer = strBuffer + arrayRow[i];
|
|
|
|
|
|
|
|
|
|
if(i != arrayRow.length - 1){
|
|
|
|
|
strBuffer = strBuffer + ",";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//alert(strBuffer);
|
|
|
|
|
}
|
|
|
|
|
//将整行值暂存到数组中
|
|
|
|
|
function getGridRowArray(arrayRow,gridObj,RowID){
|
|
|
|
|
var arg = new Array();
|
|
|
|
|
var columnCount = gridObj.getColumnsNum();
|
|
|
|
|
var rowCount = gridObj.getRowsNum();
|
|
|
|
|
//alert(columnCount);alert(rowCount);
|
|
|
|
|
for(var i = 0;i < columnCount;i++){
|
|
|
|
|
//alert(i);
|
|
|
|
|
|
|
|
|
|
var cellObj = gridObj.cellById(RowID, i);
|
|
|
|
|
//alert(cellObj);
|
|
|
|
|
//if(i==5){alert("kill");}
|
|
|
|
|
var cell = gridObj.cellById(RowID,i);
|
|
|
|
|
//if(i==5){alert("kill");}
|
|
|
|
|
var rowValue = cell.getValue();
|
|
|
|
|
//if(i==5){alert("kill");}
|
|
|
|
|
if(i == columnCount - 1){
|
|
|
|
|
arg.push(rowValue == 1?true:false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
//校验获取的值是否为数字,如果是数字记录时不加引号,如果是字符增加引号
|
|
|
|
|
var re = /^[-\+]?\d+(\.\d+)?$/;
|
|
|
|
|
if (!re.test(rowValue)){
|
|
|
|
|
switch(i){
|
|
|
|
|
case 4:
|
|
|
|
|
case 5:
|
|
|
|
|
case 6:
|
|
|
|
|
case 9:
|
|
|
|
|
alert("请正确输入数字");
|
|
|
|
|
return;
|
|
|
|
|
break;
|
|
|
|
|
case 8://如果是币别 则根据value值获取text值
|
|
|
|
|
var curCombo = gridObj.getCustomCombo(RowID,i);
|
|
|
|
|
arg.push(curCombo.get(rowValue));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
arg.push(rowValue);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if(i == 7){
|
|
|
|
|
//获取单价
|
|
|
|
|
var unitPrice = isObjNaN(parseFloat(gridObj.cellById(RowID,4).getValue()));
|
|
|
|
|
//获取数量
|
|
|
|
|
var quantityCount = isObjNaN(parseFloat(gridObj.cellById(RowID,5).getValue()));
|
|
|
|
|
//金额
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
arg.push(outputMoney(amount.toString()));
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
arg.push(outputMoney(isObjNaN(parseFloat(rowValue)).toString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//alert(arg);
|
|
|
|
|
return arg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isObjNaN(Obj){
|
|
|
|
|
if(Obj.toString().toLowerCase() == "nan"){
|
|
|
|
|
return 0;
|
|
|
|
|
}else{
|
|
|
|
|
return Obj;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function doInitPayGrid(){
|
|
|
|
|
|
|
|
|
|
mygrid_pay = new dhtmlXGridObject('mygrid_container_pay');
|
|
|
|
|
mygrid_pay.setImagePath("../images/");
|
|
|
|
|
mygrid_pay.setSkin("xp");
|
|
|
|
|
mygrid_pay.setHeader("<input type=\"checkbox\" id=\"ck_all_pay\" onclick=\"checkAll('pay')\" />,费用状态,应付费用名称,结算单位,计费标准,单价,数量,佣金比例,金额,币别,汇率,FRT,费用备注,是否垫付");
|
|
|
|
|
mygrid_pay.setInitWidths("40,70,110,150,70,80,80,90,90,50,70,70,70,70");
|
|
|
|
|
mygrid_pay.setColAlign("center,center,right,right,right,right,right,right,right,right,right,right,right,center");
|
|
|
|
|
// mygrid_pay.setSkin("light");
|
|
|
|
|
mygrid_pay.setColSorting("na,str,str,str,int,int,int,int,int,int,int,int,int,str");
|
|
|
|
|
mygrid_pay.setColTypes("ch,ro,co,co,co,ed,ed,ed,ed,co,ed,co,txt,ch");
|
|
|
|
|
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
var urlVal = "CrmOrderFeeGridSource.aspx?type=2&read=exist&showcount=1&bsno="+bsno+"&val="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
loader = null;
|
|
|
|
|
|
|
|
|
|
if(parseInt(loadVal) == 1){
|
|
|
|
|
|
|
|
|
|
mygrid_pay.loadXML("CrmOrderFeeGridSource.aspx?type=2&read=init&showcount=1&bsno="+bsno,function(){
|
|
|
|
|
ReShowLabel(mygrid_pay);
|
|
|
|
|
getFeeProfit(bsno);
|
|
|
|
|
});
|
|
|
|
|
}else{
|
|
|
|
|
getFeeProfit(bsno);
|
|
|
|
|
}
|
|
|
|
|
mygrid_pay.init();
|
|
|
|
|
mygrid_pay.enableEditEvents(true,false,true);
|
|
|
|
|
mygrid_pay.enableMultiselect(true);
|
|
|
|
|
//mygrid_pay.setTabOrder("1,2,3,4,5,6,7,8,9,10,11,12");
|
|
|
|
|
//mygrid_pay.enableLightMouseNavigation(true);
|
|
|
|
|
mygrid_pay.enableKeyboardSupport(true);
|
|
|
|
|
|
|
|
|
|
var url = "CrmOrderFeeGridSource.aspx?handle=getauditstatus&bsno="+bsno+"&val="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
|
|
|
|
|
curStatus = parseInt(loader.xmlDoc.responseText);
|
|
|
|
|
|
|
|
|
|
if(curStatus == 9 || curStatus == 2){
|
|
|
|
|
mygrid_pay.enableEditEvents(true,false,true);
|
|
|
|
|
}else{
|
|
|
|
|
mygrid_pay.enableEditEvents(false,false,false);
|
|
|
|
|
$("btn_addpay").onclick = clickNull;
|
|
|
|
|
$("btn_savepay").onclick = clickNull;
|
|
|
|
|
$("btn_delpay").onclick = clickNull;
|
|
|
|
|
$("btn_abanpay").onclick = clickNull;
|
|
|
|
|
$("btn_refreshpay").onclick = clickNull;
|
|
|
|
|
$("btn_printpay").onclick = clickNull;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var cacheTemplate = $("h_cachetemplate").value;
|
|
|
|
|
var importType = parseInt($("h_importtype").value);
|
|
|
|
|
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
// for(var i=0;i<mygrid_pay.getRowsNum();i++){
|
|
|
|
|
// var rId = mygrid_pay.getRowId(i);
|
|
|
|
|
// var combo_feename;
|
|
|
|
|
//
|
|
|
|
|
// var stateVal = mygrid_pay.cellByIndex(i,0).getValue().trim();
|
|
|
|
|
// if(stateVal == "录入状态"){
|
|
|
|
|
// combo_feename = mygrid_pay.getCustomCombo(rId,1);
|
|
|
|
|
// setFeeNameCombo(combo_feename);
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// var combo_cust;
|
|
|
|
|
// combo_cust = mygrid_pay.getCustomCombo(rId,2);
|
|
|
|
|
// setCustomerCombo(combo_cust);
|
|
|
|
|
//
|
|
|
|
|
// var combo_unit;
|
|
|
|
|
// combo_unit = mygrid_pay.getCustomCombo(rId,3);
|
|
|
|
|
// setUnitCombo(combo_unit);
|
|
|
|
|
//
|
|
|
|
|
// var combo_currency;
|
|
|
|
|
// combo_currency = mygrid_pay.getCustomCombo(rId,8);
|
|
|
|
|
// setCurrencyCombo(combo_currency);
|
|
|
|
|
//
|
|
|
|
|
// var combo_frt;
|
|
|
|
|
// combo_frt = mygrid_pay.getCustomCombo(rId,10);
|
|
|
|
|
// setFrtCombo(combo_frt);
|
|
|
|
|
//
|
|
|
|
|
// var combo_currency;
|
|
|
|
|
// combo_currency = mygrid_pay.getCustomCombo(rId,8);
|
|
|
|
|
// setCurrencyCombo(combo_currency);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
var cacheTemplate = $("h_cachetemplate").value;
|
|
|
|
|
var importType = parseInt($("h_importtype").value);
|
|
|
|
|
|
|
|
|
|
if(cacheTemplate != ""){
|
|
|
|
|
var jsonCacheObj = null;
|
|
|
|
|
|
|
|
|
|
jsonCacheObj = eval('(' + cacheTemplate + ')');
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<jsonCacheObj.templates.length;i++){
|
|
|
|
|
var newId = newGuid();
|
|
|
|
|
//获取插入新纪录位置
|
|
|
|
|
//初始化变量
|
|
|
|
|
var rowCount = mygrid_pay.getRowsNum();
|
|
|
|
|
var feeName = "";
|
|
|
|
|
var customerName = "";
|
|
|
|
|
var unit = "";
|
|
|
|
|
var unitprice = 0;
|
|
|
|
|
var quantity = 0;
|
|
|
|
|
var currency = "";
|
|
|
|
|
var exchangeRate = 1;
|
|
|
|
|
var remark = "";
|
|
|
|
|
var isAdvancePay = false;
|
|
|
|
|
var client = "";
|
|
|
|
|
|
|
|
|
|
if(jsonCacheObj.templates[i].type == 2){
|
|
|
|
|
//赋值
|
|
|
|
|
feeName = jsonCacheObj.templates[i].fname;
|
|
|
|
|
customerName = jsonCacheObj.templates[i].cust;
|
|
|
|
|
unit = jsonCacheObj.templates[i].unit;
|
|
|
|
|
unitprice = jsonCacheObj.templates[i].uprice;
|
|
|
|
|
currency = jsonCacheObj.templates[i].cur;
|
|
|
|
|
exchangeRate = jsonCacheObj.templates[i].exrate == 0?1:jsonCacheObj.templates[i].exrate;
|
|
|
|
|
remark = jsonCacheObj.templates[i].remark;
|
|
|
|
|
|
|
|
|
|
client = jsonCacheObj.templates[i].client;
|
|
|
|
|
if(customerName.trim() != ""){
|
|
|
|
|
mygrid_pay.addRow(newId,[0,"录入状态",feeName,customerName,unit,unitprice,0,0,0,currency,exchangeRate,"PP",remark,isAdvancePay],rowCount);
|
|
|
|
|
}else{
|
|
|
|
|
var debitObj = null;
|
|
|
|
|
var clientName = "";
|
|
|
|
|
debitObj = getDebitType(client);
|
|
|
|
|
clientName = debitObj.debit[0].value.trim() == null?"":debitObj.debit[0].value.trim();
|
|
|
|
|
|
|
|
|
|
mygrid_pay.addRow(newId,[0,"录入状态",feeName,clientName,unit,unitprice,0,0,0,currency,exchangeRate,"PP",remark,isAdvancePay],rowCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var combo_feename;
|
|
|
|
|
combo_feename = mygrid_pay.getCustomCombo(newId,2);
|
|
|
|
|
setFeeNameCombo(combo_feename);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var combo_cust;
|
|
|
|
|
combo_cust = mygrid_pay.getCustomCombo(newId,3);
|
|
|
|
|
setCustomerCombo(combo_cust);
|
|
|
|
|
|
|
|
|
|
var combo_unit;
|
|
|
|
|
combo_unit = mygrid_pay.getCustomCombo(newId,4);
|
|
|
|
|
setUnitCombo(combo_unit);
|
|
|
|
|
|
|
|
|
|
var combo_currency;
|
|
|
|
|
combo_currency = mygrid_pay.getCustomCombo(newId,9);
|
|
|
|
|
setCurrencyCombo(combo_currency);
|
|
|
|
|
|
|
|
|
|
var combo_frt;
|
|
|
|
|
combo_frt = mygrid_pay.getCustomCombo(newId,11);
|
|
|
|
|
setFrtCombo(combo_frt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},240);
|
|
|
|
|
|
|
|
|
|
var pushVal = "";
|
|
|
|
|
var pressRecord = "";
|
|
|
|
|
var pressRowIndex = -1;
|
|
|
|
|
var pressCellIndex = -1;
|
|
|
|
|
var pressCount = 0;
|
|
|
|
|
var isExchange = false;
|
|
|
|
|
var shiftCount = 0;
|
|
|
|
|
var isDelete = 0;
|
|
|
|
|
|
|
|
|
|
var flagFilter = 0;
|
|
|
|
|
var flagTab = 0;
|
|
|
|
|
var flagEnter = 0;
|
|
|
|
|
var flagDelete = 0;
|
|
|
|
|
|
|
|
|
|
// mygrid_pay.attachEvent("onSelectStateChanged", function(id){
|
|
|
|
|
// var rowIndex = mygrid_pay.getRowIndex(id);
|
|
|
|
|
// var checkState = mygrid_pay.cellByIndex(rowIndex,0).getValue();
|
|
|
|
|
//
|
|
|
|
|
// if(checkState == 0){
|
|
|
|
|
// mygrid_pay.cellByIndex(rowIndex,0).setValue(1);
|
|
|
|
|
// }else{
|
|
|
|
|
// mygrid_pay.cellByIndex(rowIndex,0).setValue(0);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
mygrid_pay.attachEvent("onSelectStateChanged", function(id){
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(id);
|
|
|
|
|
|
|
|
|
|
if(rowIndex >= 0){
|
|
|
|
|
var stateVal = mygrid_pay.cellByIndex(rowIndex,1).getValue().trim();
|
|
|
|
|
|
|
|
|
|
if(stateVal == "录入状态"|| stateVal == "驳回提交"){
|
|
|
|
|
var combo_currency;
|
|
|
|
|
combo_currency = mygrid_pay.getCustomCombo(id,9);
|
|
|
|
|
if(combo_currency.getKeys.length <= 1){
|
|
|
|
|
setCurrencyCombo(combo_currency);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var combo_feename;
|
|
|
|
|
combo_feename = mygrid_pay.getCustomCombo(id,2);
|
|
|
|
|
if(combo_feename.getKeys.length <= 1){
|
|
|
|
|
setFeeNameCombo(combo_feename);
|
|
|
|
|
}
|
|
|
|
|
var combo_cust;
|
|
|
|
|
|
|
|
|
|
combo_cust = mygrid_pay.getCustomCombo(id,3);
|
|
|
|
|
if(combo_cust.getKeys.length <= 1){
|
|
|
|
|
setCustomerCombo(combo_cust);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var combo_unit;
|
|
|
|
|
combo_unit = mygrid_pay.getCustomCombo(id,4);
|
|
|
|
|
|
|
|
|
|
if(combo_unit.getKeys.length <= 1){
|
|
|
|
|
setUnitCombo(combo_unit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var combo_frt;
|
|
|
|
|
combo_frt = mygrid_pay.getCustomCombo(id,11);
|
|
|
|
|
|
|
|
|
|
if(combo_frt.getKeys.length <= 1){
|
|
|
|
|
setFrtCombo(combo_frt);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//手动编写Grid控件编辑事件,由于免费控件没有提供完整的编辑判断功能,现特此做更改
|
|
|
|
|
mygrid_pay.attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
|
|
|
|
|
var newCheckValue = false;
|
|
|
|
|
//初始化状态
|
|
|
|
|
if(stage == 0){
|
|
|
|
|
//alert();
|
|
|
|
|
//return true;
|
|
|
|
|
//var cell = mygrid_pay.cellById(rId,cInd);
|
|
|
|
|
//alert(cell.getValue());
|
|
|
|
|
//var selectedId = mygrid_pay.getSelectedRowId();
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(rId);
|
|
|
|
|
|
|
|
|
|
var oldVal = mygrid_pay.cellByIndex(rowIndex,1).getValue().trim();
|
|
|
|
|
|
|
|
|
|
// if(newFeeRecvCount > 0 || changeFeeRecvCount > 0){
|
|
|
|
|
// alert("应收费用未保存,请先将应收费用保存,再添加应付费用");
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if(cInd == 0){
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
var crmStatus = parseInt($("h_crmstatus").value);
|
|
|
|
|
|
|
|
|
|
if(crmStatus != 9 && crmStatus != 2){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if(oldVal == "录入状态"){
|
|
|
|
|
if(parseInt($("h_authority").value) > 0){
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//return true;
|
|
|
|
|
}else{
|
|
|
|
|
if(parseInt($("h_authority").value) > 0){
|
|
|
|
|
if(cInd == 0){
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//return false;
|
|
|
|
|
//return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(stage == 1){
|
|
|
|
|
var selectedId = mygrid_pay.getSelectedRowId();
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(selectedId);
|
|
|
|
|
|
|
|
|
|
var txtEdit
|
|
|
|
|
for(i = 0; i < document.all.length; i++){
|
|
|
|
|
if(document.all(i).tagName == "TEXTAREA"){
|
|
|
|
|
txtEdit = document.all(i);
|
|
|
|
|
|
|
|
|
|
txtEdit.focus();
|
|
|
|
|
txtEdit.select();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(cInd == 2 || cInd == 3){
|
|
|
|
|
if(flagFilter == 0){
|
|
|
|
|
//alert(txtEdit.value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//如果编辑结束
|
|
|
|
|
if(stage == 2){
|
|
|
|
|
changeFeePayCount++;
|
|
|
|
|
if(cInd == 5){
|
|
|
|
|
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(rId);
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,5).setValue(outputMoney(unitPrice.toString()));
|
|
|
|
|
//mygrid_pay.cellByIndex(rowIndex,6).setValue(outputMoney(quantityCount.toString()));
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}else if(cInd == 6){
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(rId);
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityOrig = mygrid_pay.cellByIndex(rowIndex,6).getValue();
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
|
|
|
|
|
if(!isDigit(quantityOrig)){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
//mygrid_pay.cellByIndex(rowIndex,5).setValue(outputMoney(unitPrice.toString()));
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,6).setValue(outputMoney(quantityCount.toString()));
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
}else if(cInd == 9){
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(rId);
|
|
|
|
|
|
|
|
|
|
//filterComboCustomerPress(mygrid_pay,rId,rowIndex,9,nValue,oValue);
|
|
|
|
|
|
|
|
|
|
var curValue = mygrid_pay.cellByIndex(rowIndex,9).getValue();
|
|
|
|
|
//alert(curValue);
|
|
|
|
|
//alert(rId);alert(curValue);
|
|
|
|
|
//var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+curValue;
|
|
|
|
|
var bsno = $("h_bsno").value;
|
|
|
|
|
var urlVal = "../FeeCodes/CurrencyCodeService.aspx?bsno="+bsno+"&type=2¤cy="+curValue+"&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,10).setValue(loadVal);
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
loader == null;
|
|
|
|
|
return true;
|
|
|
|
|
}else if(cInd == 10){
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(rId);
|
|
|
|
|
var currency = mygrid_pay.cellByIndex(rowIndex,9).getValue();
|
|
|
|
|
var rate = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,10).getValue())));
|
|
|
|
|
if(currency == "RMB"){
|
|
|
|
|
if(rate != 1){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}else if(currency == "USD"){
|
|
|
|
|
if(rate <= 1){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
}else if(cInd == 8){
|
|
|
|
|
return;
|
|
|
|
|
}else if(cInd == 4){
|
|
|
|
|
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(rId);
|
|
|
|
|
var unitVal = mygrid_pay.cellByIndex(rowIndex,4).getValue();
|
|
|
|
|
var quantityObj = null;
|
|
|
|
|
quantityObj = getTypeNameQuantity(unitVal);
|
|
|
|
|
|
|
|
|
|
if(quantityObj.quantity.length > 0){
|
|
|
|
|
if(quantityObj.quantity[0].value > 0){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,4).setValue(quantityObj.quantity[0].name);
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,6).setValue(quantityObj.quantity[0].value);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}else{
|
|
|
|
|
//mygrid_pay.cellByIndex(rowIndex,4).setValue("");
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,6).setValue(0);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//重新计算利润
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
}else if(cInd == 2 || cInd == 3){
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(rId);
|
|
|
|
|
if(pressCount == 1){
|
|
|
|
|
if(flagFilter == 1){
|
|
|
|
|
//mygrid_recv.editStop();
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setLabel(oValue);
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
// if(pressRowIndex == rowIndex && pressCellIndex == cInd){
|
|
|
|
|
var cellVal = mygrid_pay.cellByIndex(rowIndex,cInd).getValue();
|
|
|
|
|
|
|
|
|
|
var combo = mygrid_pay.getCustomCombo(rId,cInd);
|
|
|
|
|
var comboArg = combo.getKeys();
|
|
|
|
|
var tempCount = 0;
|
|
|
|
|
if(cellVal.indexOf(" ") >0 && cellVal.indexOf(" ") < cellVal.length){
|
|
|
|
|
cellVal = cellVal.substring(0,cellVal.indexOf(" "));
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
|
|
|
|
|
if(combo.get(comboArg[i]).trim().indexOf(cellVal) == 0){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]);
|
|
|
|
|
tempCount++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
if(comboArg[i] == cellVal){
|
|
|
|
|
if(combo.get(comboArg[i]).trim().indexOf(cellVal) > 0){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]);
|
|
|
|
|
tempCount++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}//alert(tempCount)
|
|
|
|
|
if(tempCount == 0){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setValue("");
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setLabel("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isExchange = false;
|
|
|
|
|
pressRecord = "";
|
|
|
|
|
pressRowIndex = -1;
|
|
|
|
|
pressCellIndex = -1;
|
|
|
|
|
pressCount = 0;
|
|
|
|
|
flagFilter = 0;
|
|
|
|
|
// var url = "";
|
|
|
|
|
// var feeCodeObj = null;
|
|
|
|
|
// var feeName = mygrid_pay.cellByIndex(rowIndex,1).getValue().trim();
|
|
|
|
|
//
|
|
|
|
|
// if(feeName != ""){
|
|
|
|
|
// url = "../FeeCodes/FeeCodeService.aspx?handle=getcurrency&feename="+escape(feeName)+"&uid="+newGuid();
|
|
|
|
|
//
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
//
|
|
|
|
|
// var feeCodeInfo = loader.xmlDoc.responseText;
|
|
|
|
|
// feeCodeObj = eval('(' + feeCodeInfo + ')');
|
|
|
|
|
//
|
|
|
|
|
// if(feeCodeObj.feecode.length > 0){
|
|
|
|
|
// mygrid_pay.cellByIndex(rowIndex,8).setValue(feeCodeObj.feecode[0].cur);
|
|
|
|
|
// var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+feeCodeObj.feecode[0].cur;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
// mygrid_pay.cellByIndex(rowIndex,9).setValue(loadVal);
|
|
|
|
|
// totalDynamicFeeGain();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
return true;
|
|
|
|
|
// }else{
|
|
|
|
|
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}else if(pressCount == 2){
|
|
|
|
|
if(flagFilter == 1){
|
|
|
|
|
mygrid_pay.editStop();
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setLabel(oValue);
|
|
|
|
|
}else{
|
|
|
|
|
if(pressRowIndex != rowIndex && pressCellIndex != cInd){//alert(11)
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
isExchange = false;
|
|
|
|
|
pressRecord = "";
|
|
|
|
|
pressRowIndex = -1;
|
|
|
|
|
pressCellIndex = -1;
|
|
|
|
|
pressCount = 0;
|
|
|
|
|
flagFilter = 0;
|
|
|
|
|
|
|
|
|
|
var cellVal = mygrid_pay.cellByIndex(rowIndex,cInd).getValue();//alert(cellVal)
|
|
|
|
|
var combo = mygrid_pay.getCustomCombo(rId,cInd);
|
|
|
|
|
var comboArg = combo.getKeys();
|
|
|
|
|
var tempCount = 0;
|
|
|
|
|
if(cellVal.indexOf(" ") >0 && cellVal.indexOf(" ") < cellVal.length){
|
|
|
|
|
cellVal = cellVal.substring(0,cellVal.indexOf(" "));
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
//alert(3333);
|
|
|
|
|
if(combo.get(comboArg[i]).trim().indexOf(cellVal) == 0){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]);
|
|
|
|
|
tempCount++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// }else{
|
|
|
|
|
// for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
//
|
|
|
|
|
// if(combo.get(comboArg[i]).trim().indexOf(cellVal) > 0){
|
|
|
|
|
// mygrid_recv.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
|
|
|
// mygrid_recv.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]);
|
|
|
|
|
// tempCount++;
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}//alert(tempCount)
|
|
|
|
|
if(tempCount == 0){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setValue("");
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setLabel("");
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
var cellVal = mygrid_pay.cellByIndex(rowIndex,cInd).getValue();
|
|
|
|
|
var combo = mygrid_pay.getCustomCombo(rId,cInd);
|
|
|
|
|
var comboArg = combo.getKeys();
|
|
|
|
|
|
|
|
|
|
if(cellVal.indexOf(" ") >0 && cellVal.indexOf(" ") < cellVal.length){
|
|
|
|
|
cellVal = cellVal.substring(0,cellVal.indexOf(" "));
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
|
|
|
|
|
if(combo.get(comboArg[i]).trim().indexOf(cellVal) == 0){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
|
|
|
|
|
if(combo.get(comboArg[i]).trim().indexOf(cellVal) > 0){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(cInd == 2){
|
|
|
|
|
var url = "";
|
|
|
|
|
var feeCodeObj = null;
|
|
|
|
|
var feeName = mygrid_pay.cellByIndex(rowIndex,2).getValue().trim();
|
|
|
|
|
|
|
|
|
|
if(feeName != ""){
|
|
|
|
|
url = "../FeeCodes/FeeCodeService.aspx?handle=getcurrency&feename="+escape(feeName)+"&uid="+newGuid();
|
|
|
|
|
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
|
|
|
|
|
var feeCodeInfo = loader.xmlDoc.responseText;
|
|
|
|
|
|
|
|
|
|
feeCodeObj = eval('(' + feeCodeInfo + ')');
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode.length > 0){
|
|
|
|
|
if(feeCodeObj.feecode[0].cur.trim() != ""){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,9).setValue(feeCodeObj.feecode[0].cur);
|
|
|
|
|
//var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+feeCodeObj.feecode[0].cur;
|
|
|
|
|
var bsno = $("h_bsno").value;
|
|
|
|
|
var urlVal = "../FeeCodes/CurrencyCodeService.aspx?bsno="+bsno+"&type=2¤cy="+feeCodeObj.feecode[0].cur+"&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,10).setValue(loadVal);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode[0].unit != 0){
|
|
|
|
|
quantityObj = getUnitType(feeCodeObj.feecode[0].unit);
|
|
|
|
|
|
|
|
|
|
if(quantityObj.quantity.length > 0){
|
|
|
|
|
if(quantityObj.quantity[0].value > 0){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,4).setValue(quantityObj.quantity[0].name);
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,6).setValue(quantityObj.quantity[0].value);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
//mygrid_pay.cellByIndex(rowIndex,4).setValue("");
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,6).setValue(1);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = 1;//clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(feeCodeObj.feecode[0].credit > 0){
|
|
|
|
|
var debitObj = null;
|
|
|
|
|
debitObj = getDebitType(feeCodeObj.feecode[0].credit);
|
|
|
|
|
|
|
|
|
|
if(debitObj.debit.length > 0){
|
|
|
|
|
if(debitObj.debit[0].value.trim() != ""){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,3).setValue(debitObj.debit[0].value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ReShowLabel(mygrid_pay);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// mygrid_pay.attachEvent("onSelectStateChanged", function(id){
|
|
|
|
|
// var combo_feename;
|
|
|
|
|
// combo_feename = mygrid_pay.getCustomCombo(id,1);
|
|
|
|
|
// setFeeNameCombo(combo_feename);
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// var combo_cust;
|
|
|
|
|
// combo_cust = mygrid_pay.getCustomCombo(id,2);
|
|
|
|
|
// setCustomerCombo(combo_cust);
|
|
|
|
|
//
|
|
|
|
|
// var combo_unit;
|
|
|
|
|
// combo_unit = mygrid_pay.getCustomCombo(id,3);
|
|
|
|
|
// setUnitCombo(combo_unit);
|
|
|
|
|
//
|
|
|
|
|
// var combo_currency;
|
|
|
|
|
// combo_currency = mygrid_pay.getCustomCombo(id,8);
|
|
|
|
|
// setCurrencyCombo(combo_currency);
|
|
|
|
|
//
|
|
|
|
|
// var combo_frt;
|
|
|
|
|
// combo_frt = mygrid_pay.getCustomCombo(id,10);
|
|
|
|
|
// setFrtCombo(combo_frt);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// mygrid_pay.attachEvent("onRowSelect", function(id,ind){
|
|
|
|
|
//
|
|
|
|
|
// var combo_feename;
|
|
|
|
|
// combo_feename = mygrid_pay.getCustomCombo(id,1);
|
|
|
|
|
// setFeeNameCombo(combo_feename);
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// var combo_cust;
|
|
|
|
|
// combo_cust = mygrid_pay.getCustomCombo(id,2);
|
|
|
|
|
// setCustomerCombo(combo_cust);
|
|
|
|
|
//
|
|
|
|
|
// var combo_unit;
|
|
|
|
|
// combo_unit = mygrid_pay.getCustomCombo(id,3);
|
|
|
|
|
// setUnitCombo(combo_unit);
|
|
|
|
|
//
|
|
|
|
|
// var combo_currency;
|
|
|
|
|
// combo_currency = mygrid_pay.getCustomCombo(id,8);
|
|
|
|
|
// setCurrencyCombo(combo_currency);
|
|
|
|
|
//
|
|
|
|
|
// var combo_frt;
|
|
|
|
|
// combo_frt = mygrid_pay.getCustomCombo(id,10);
|
|
|
|
|
// setFrtCombo(combo_frt);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
//键盘操作事件
|
|
|
|
|
mygrid_pay.attachEvent("onKeyPress", function(code,cFlag,sFlag){
|
|
|
|
|
//onKeyPress begin
|
|
|
|
|
|
|
|
|
|
var crmStatus = parseInt($("h_crmstatus").value);
|
|
|
|
|
|
|
|
|
|
if(crmStatus != 9 && crmStatus != 2){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//获取当前RowID
|
|
|
|
|
var selectedId = mygrid_pay.getSelectedRowId();
|
|
|
|
|
//获取当前RowIndex
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(selectedId);
|
|
|
|
|
//获取当前CellIndex(ind)
|
|
|
|
|
var ind = mygrid_pay.getSelectedCellIndex();
|
|
|
|
|
|
|
|
|
|
//触发操作事件前获取单元值
|
|
|
|
|
var oldVal = mygrid_pay.cellByIndex(rowIndex,ind).getValue();
|
|
|
|
|
//获取编辑单元
|
|
|
|
|
var txtEdit;
|
|
|
|
|
|
|
|
|
|
for(i = 0; i < document.all.length; i++){
|
|
|
|
|
if(document.all(i).tagName == "TEXTAREA"){
|
|
|
|
|
txtEdit = document.all(i);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(code == 13){
|
|
|
|
|
if(ind == 5){
|
|
|
|
|
|
|
|
|
|
// var rowIndex = mygrid_recv.getRowIndex(selectedId);
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,5).setValue(outputMoney(unitPrice.toString()));
|
|
|
|
|
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if(ind == 2 || ind == 3 ||ind == 4||ind == 11){
|
|
|
|
|
//如果是检索失败,
|
|
|
|
|
if(pressCount == 2){
|
|
|
|
|
mygrid_pay.editStop();
|
|
|
|
|
//将value写入cell(触发 stage2)
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,ind).setValue(oldVal);
|
|
|
|
|
//重新打开cell(触发stage0 stage1)
|
|
|
|
|
mygrid_pay.selectCell(rowIndex,ind,true,true);
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,ind).setLabel(oldVal);
|
|
|
|
|
mygrid_pay.editCell();
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(ind == 2){
|
|
|
|
|
var url = "";
|
|
|
|
|
var feeCodeObj = null;
|
|
|
|
|
var feeName = mygrid_pay.cellByIndex(rowIndex,2).getValue().trim();
|
|
|
|
|
|
|
|
|
|
if(feeName != ""){
|
|
|
|
|
url = "../FeeCodes/FeeCodeService.aspx?handle=getcurrency&feename="+escape(feeName)+"&uid="+newGuid();
|
|
|
|
|
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
|
|
|
|
|
var feeCodeInfo = loader.xmlDoc.responseText;
|
|
|
|
|
|
|
|
|
|
feeCodeObj = eval('(' + feeCodeInfo + ')');
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode.length > 0){
|
|
|
|
|
if(feeCodeObj.feecode[0].cur.trim() != ""){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,9).setValue(feeCodeObj.feecode[0].cur);
|
|
|
|
|
//var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+feeCodeObj.feecode[0].cur;
|
|
|
|
|
var bsno = $("h_bsno").value;
|
|
|
|
|
var urlVal = "../FeeCodes/CurrencyCodeService.aspx?bsno="+bsno+"&type=2¤cy="+feeCodeObj.feecode[0].cur+"&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,10).setValue(loadVal);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode[0].unit != 0){
|
|
|
|
|
quantityObj = getUnitType(feeCodeObj.feecode[0].unit);
|
|
|
|
|
|
|
|
|
|
if(quantityObj.quantity.length > 0){
|
|
|
|
|
if(quantityObj.quantity[0].value > 0){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,4).setValue(quantityObj.quantity[0].name);
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,6).setValue(quantityObj.quantity[0].value);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
//mygrid_pay.cellByIndex(rowIndex,4).setValue("");
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,6).setValue(1);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = 1;//clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(feeCodeObj.feecode[0].credit > 0){
|
|
|
|
|
var debitObj = null;
|
|
|
|
|
debitObj = getDebitType(feeCodeObj.feecode[0].credit);
|
|
|
|
|
|
|
|
|
|
if(debitObj.debit.length > 0){
|
|
|
|
|
if(debitObj.debit[0].value.trim() != ""){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,3).setValue(debitObj.debit[0].value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ReShowLabelForEnter(mygrid_pay);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//Tab键
|
|
|
|
|
if(code == 9){
|
|
|
|
|
|
|
|
|
|
//code9 begin
|
|
|
|
|
var colCount = mygrid_pay.getColumnsNum();
|
|
|
|
|
var rowCount = mygrid_pay.getRowsNum();
|
|
|
|
|
|
|
|
|
|
if(ind < colCount){
|
|
|
|
|
isExchange = false;
|
|
|
|
|
pressRecord = "";
|
|
|
|
|
pressRowIndex = -1;
|
|
|
|
|
pressCellIndex = -1;
|
|
|
|
|
mygrid_pay.editStop(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,ind).setLabel(oldVal);
|
|
|
|
|
|
|
|
|
|
var cInd = ind;
|
|
|
|
|
var rId = selectedId;
|
|
|
|
|
if(cInd == 5){
|
|
|
|
|
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(rId);
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,5).setValue(outputMoney(unitPrice.toString()));
|
|
|
|
|
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
|
|
|
|
|
}else if(cInd == 6){
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(rId);
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,5).setValue(outputMoney(unitPrice.toString()));
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,6).setValue(outputMoney(quantityCount.toString()));
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
}else if(cInd == 9){
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(rId);
|
|
|
|
|
|
|
|
|
|
//filterComboCustomerPress(mygrid_recv,rId,rowIndex,8,nValue,oValue);
|
|
|
|
|
|
|
|
|
|
var curValue = mygrid_pay.cellByIndex(rowIndex,9).getValue();
|
|
|
|
|
//alert(curValue);
|
|
|
|
|
//alert(rId);alert(curValue);
|
|
|
|
|
//var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+curValue+"&val="+newGuid();
|
|
|
|
|
var bsno = $("h_bsno").value;
|
|
|
|
|
var urlVal = "../FeeCodes/CurrencyCodeService.aspx?bsno="+bsno+"&type=2¤cy="+curValue+"&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,10).setValue(loadVal);
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
loader == null;
|
|
|
|
|
}else if(cInd == 2){
|
|
|
|
|
var url = "";
|
|
|
|
|
var feeCodeObj = null;
|
|
|
|
|
var feeName = mygrid_pay.cellByIndex(rowIndex,2).getValue().trim();
|
|
|
|
|
|
|
|
|
|
if(feeName != ""){
|
|
|
|
|
url = "../FeeCodes/FeeCodeService.aspx?handle=getcurrency&feename="+escape(feeName)+"&uid="+newGuid();
|
|
|
|
|
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
|
|
|
|
|
var feeCodeInfo = loader.xmlDoc.responseText;
|
|
|
|
|
feeCodeObj = eval('(' + feeCodeInfo + ')');
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode.length > 0){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,9).setValue(feeCodeObj.feecode[0].cur);
|
|
|
|
|
//var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+feeCodeObj.feecode[0].cur;
|
|
|
|
|
var bsno = $("h_bsno").value;
|
|
|
|
|
var urlVal = "../FeeCodes/CurrencyCodeService.aspx?bsno="+bsno+"&type=2¤cy="+feeCodeObj.feecode[0].cur+"&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,10).setValue(loadVal);
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode[0].unit != 0){
|
|
|
|
|
quantityObj = getUnitType(feeCodeObj.feecode[0].unit);
|
|
|
|
|
|
|
|
|
|
if(quantityObj.quantity.length > 0){
|
|
|
|
|
if(quantityObj.quantity[0].value > 0){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,4).setValue(quantityObj.quantity[0].name);
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,6).setValue(quantityObj.quantity[0].value);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
//mygrid_pay.cellByIndex(rowIndex,4).setValue("");
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,6).setValue(1);
|
|
|
|
|
|
|
|
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var quantityCount = 1;//clearNoNum(isObjNaN(ConvertToMoney(quantityObj.quantity[0].value.toString())));
|
|
|
|
|
|
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
|
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,8).setValue(outputMoney(amount.toString()));
|
|
|
|
|
}
|
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
|
|
|
|
|
|
if(feeCodeObj.feecode[0].credit > 0){
|
|
|
|
|
var debitObj = null;
|
|
|
|
|
debitObj = getDebitType(feeCodeObj.feecode[0].credit);
|
|
|
|
|
if(debitObj.debit.length > 0){
|
|
|
|
|
if(debitObj.debit[0].value.trim() != ""){
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,3).setValue(debitObj.debit[0].value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mygrid_pay.selectCell(rowIndex,ind+1,true,true);
|
|
|
|
|
mygrid_pay.editCell();
|
|
|
|
|
if(ind == colCount - 2){
|
|
|
|
|
if(rowIndex < rowCount){
|
|
|
|
|
mygrid_pay.editStop(true);
|
|
|
|
|
mygrid_pay.clearSelection();
|
|
|
|
|
mygrid_pay.selectCell(rowIndex+1,1,true,true);
|
|
|
|
|
mygrid_pay.editCell();
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//cdoe9 end
|
|
|
|
|
}
|
|
|
|
|
if((code>=65&&code<=90) || (code>=48 && code <=57)||(code>=96 && code<=105)){//如果是输入英文字符
|
|
|
|
|
|
|
|
|
|
if(ind == 2 || ind == 3 ||ind == 4||ind == 11){
|
|
|
|
|
//获取键盘输入字符
|
|
|
|
|
var pressVal = String.fromCharCode(code);
|
|
|
|
|
var start=0;
|
|
|
|
|
var end=0;
|
|
|
|
|
if(document.selection){
|
|
|
|
|
var range = document.selection.createRange();
|
|
|
|
|
|
|
|
|
|
if(range.parentElement().className == txtEdit.className){
|
|
|
|
|
// create a selection of the whole textarea
|
|
|
|
|
var range_all = document.body.createTextRange();
|
|
|
|
|
range_all.moveToElementText(txtEdit);
|
|
|
|
|
|
|
|
|
|
for (start=0; range_all.compareEndPoints("StartToStart", range) < 0; start++){
|
|
|
|
|
range_all.moveStart('character', 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i <= start; i ++){
|
|
|
|
|
if (txtEdit.value.charAt(i) == '\n')
|
|
|
|
|
start++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var range_all = document.body.createTextRange();
|
|
|
|
|
range_all.moveToElementText(txtEdit);
|
|
|
|
|
|
|
|
|
|
for (end = 0; range_all.compareEndPoints('StartToEnd', range) < 0; end ++)
|
|
|
|
|
range_all.moveStart('character', 1);
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i <= end; i ++){
|
|
|
|
|
if (txtEdit.value.charAt(i) == '\n')
|
|
|
|
|
end ++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//如果是当前检索位置
|
|
|
|
|
if(rowIndex == pressRowIndex && ind == pressCellIndex){
|
|
|
|
|
//未选中多个字符
|
|
|
|
|
if(start == end){
|
|
|
|
|
if(start != pressRecord.length){
|
|
|
|
|
if(start != 0){
|
|
|
|
|
var firstVal = pressRecord.substring(0,start - 1);
|
|
|
|
|
var endVal = pressRecord.substring(start + 1,txtEdit.value.length - 1);
|
|
|
|
|
// alert(firstVal);alert(endVal);
|
|
|
|
|
pressRecord = firstVal+pressVal+endVal;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
pressRecord = pressRecord+pressVal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//选中多个字符
|
|
|
|
|
if(start != end){
|
|
|
|
|
var firstVal = pressRecord.substring(0,start);
|
|
|
|
|
var endVal = pressRecord.substring(end - 1,txtEdit.value.length - 1);
|
|
|
|
|
// alert(firstVal);alert(endVal);
|
|
|
|
|
pressRecord = firstVal+pressVal+endVal;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
pressRecord = pressVal;
|
|
|
|
|
pressRowIndex = rowIndex;
|
|
|
|
|
pressCellIndex = ind;
|
|
|
|
|
}
|
|
|
|
|
// alert(pressRecord);alert(start);alert(end);alert(txtEdit.value);
|
|
|
|
|
//获取combo下拉列表
|
|
|
|
|
var combo = mygrid_pay.getCustomCombo(selectedId,ind);
|
|
|
|
|
var comboArg = combo.getKeys();
|
|
|
|
|
var count = 0;
|
|
|
|
|
|
|
|
|
|
//开始遍历检索
|
|
|
|
|
//如果检索成功 状态pressCount=1 如果不成功应为pressCount=2
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
if(combo.get(comboArg[i]).toUpperCase().trim().indexOf(pressRecord) == 0){
|
|
|
|
|
//计数
|
|
|
|
|
count++;
|
|
|
|
|
//获取value
|
|
|
|
|
var oldVal = comboArg[i];
|
|
|
|
|
//获取label
|
|
|
|
|
var oldLab = combo.get(comboArg[i]);
|
|
|
|
|
|
|
|
|
|
//记录状态值 检索到数据项
|
|
|
|
|
pressCount = 1;
|
|
|
|
|
flagFilter = 1;
|
|
|
|
|
//关闭编辑
|
|
|
|
|
mygrid_pay.editStop();
|
|
|
|
|
//将value写入cell(触发 stage2)
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,ind).setValue(oldVal);
|
|
|
|
|
flagFilter = 0;
|
|
|
|
|
//重新打开cell(触发stage0 stage1)
|
|
|
|
|
mygrid_pay.selectCell(rowIndex,ind,true,true);
|
|
|
|
|
mygrid_pay.editCell();
|
|
|
|
|
|
|
|
|
|
var old_length = oldLab.length;
|
|
|
|
|
//产生效果将检索字母之后的数据进行选黑
|
|
|
|
|
for(i = 0; i < document.all.length; i++){
|
|
|
|
|
if(document.all(i).tagName == "TEXTAREA"){
|
|
|
|
|
txtEdit = document.all(i);
|
|
|
|
|
|
|
|
|
|
var rt = txtEdit.createTextRange();
|
|
|
|
|
rt.collapse();
|
|
|
|
|
rt.select();//光标置最前
|
|
|
|
|
|
|
|
|
|
var r = document.selection.createRange();
|
|
|
|
|
r.collapse(false);
|
|
|
|
|
r.moveStart("character", pressRecord.length);//从m位开始
|
|
|
|
|
r.moveEnd("character", old_length);//选取n位
|
|
|
|
|
r.select();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//如果检索不能成功 pressCount=2
|
|
|
|
|
if(count == 0){
|
|
|
|
|
pressCount = 2;
|
|
|
|
|
txtEdit.value = pressRecord;
|
|
|
|
|
for(i = 0; i < document.all.length; i++){
|
|
|
|
|
if(document.all(i).tagName == "TEXTAREA"){
|
|
|
|
|
txtEdit = document.all(i);
|
|
|
|
|
|
|
|
|
|
var rt = txtEdit.createTextRange();
|
|
|
|
|
rt.collapse();
|
|
|
|
|
rt.select();//光标置最前
|
|
|
|
|
|
|
|
|
|
var r = document.selection.createRange();
|
|
|
|
|
r.collapse(true);
|
|
|
|
|
r.moveStart("character", pressRecord.length);//从m位开始
|
|
|
|
|
r.moveEnd("character", pressRecord.length);//选取n位
|
|
|
|
|
|
|
|
|
|
r.select();
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if((code>=48 && code <=57)||(code>=96 && code<=105)){
|
|
|
|
|
if(ind == 5 ||ind == 6 ||ind == 7 ||ind == 10){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//delete
|
|
|
|
|
if(code == 8){
|
|
|
|
|
//code8 begin
|
|
|
|
|
if(ind == 2 || ind == 3 ||ind == 4||ind == 11){
|
|
|
|
|
var start=0;
|
|
|
|
|
var end=0;
|
|
|
|
|
if(document.selection){
|
|
|
|
|
var range = document.selection.createRange();
|
|
|
|
|
|
|
|
|
|
if(range.parentElement().className == txtEdit.className){
|
|
|
|
|
var range_all = document.body.createTextRange();
|
|
|
|
|
range_all.moveToElementText(txtEdit);
|
|
|
|
|
|
|
|
|
|
for (start=0; range_all.compareEndPoints("StartToStart", range) < 0; start++){
|
|
|
|
|
range_all.moveStart('character', 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i <= start; i ++){
|
|
|
|
|
if (txtEdit.value.charAt(i) == '\n')
|
|
|
|
|
start++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var range_all = document.body.createTextRange();
|
|
|
|
|
range_all.moveToElementText(txtEdit);
|
|
|
|
|
|
|
|
|
|
for (end = 0; range_all.compareEndPoints('StartToEnd', range) < 0; end ++)
|
|
|
|
|
range_all.moveStart('character', 1);
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i <= end; i ++){
|
|
|
|
|
if (txtEdit.value.charAt(i) == '\n')
|
|
|
|
|
end ++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// alert(start);alert(end);
|
|
|
|
|
//未选中多个字符
|
|
|
|
|
if(start == end){
|
|
|
|
|
if(start != 0){
|
|
|
|
|
var firstVal = pressRecord.substring(0,start - 1);
|
|
|
|
|
var endVal = pressRecord.substring(start + 1,txtEdit.value.length - 1);
|
|
|
|
|
pressRecord = firstVal;
|
|
|
|
|
// alert(firstVal);alert(endVal);alert(pressRecord);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//选中多个字符
|
|
|
|
|
if(start != end){
|
|
|
|
|
var firstVal = pressRecord.substring(0,start);
|
|
|
|
|
var endVal = pressRecord.substring(end - 1,txtEdit.value.length - 1);
|
|
|
|
|
pressRecord = firstVal+endVal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
if(pressRecord.trim().length > 0){
|
|
|
|
|
var combo = mygrid_pay.getCustomCombo(selectedId,ind);
|
|
|
|
|
var comboArg = combo.getKeys();
|
|
|
|
|
var count = 0;
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
|
|
|
|
|
if(combo.get(comboArg[i]).toUpperCase().trim().indexOf(pressRecord) == 0){
|
|
|
|
|
count++;
|
|
|
|
|
var oldVal = comboArg[i];
|
|
|
|
|
var oldLab = combo.get(comboArg[i]);
|
|
|
|
|
pressCount = 3;
|
|
|
|
|
mygrid_pay.editStop();
|
|
|
|
|
mygrid_pay.cellByIndex(rowIndex,ind).setValue(oldVal);
|
|
|
|
|
|
|
|
|
|
mygrid_pay.selectCell(rowIndex,ind,true,true);
|
|
|
|
|
mygrid_pay.editCell();
|
|
|
|
|
var old_length = oldLab.length;
|
|
|
|
|
|
|
|
|
|
for(i = 0; i < document.all.length; i++){
|
|
|
|
|
if(document.all(i).tagName == "TEXTAREA"){
|
|
|
|
|
txtEdit = document.all(i);
|
|
|
|
|
|
|
|
|
|
var rt = txtEdit.createTextRange();
|
|
|
|
|
rt.collapse();
|
|
|
|
|
rt.select();//光标置最前
|
|
|
|
|
|
|
|
|
|
var r = document.selection.createRange();
|
|
|
|
|
r.collapse(false);
|
|
|
|
|
|
|
|
|
|
r.moveStart("character", pressRecord.length);//从m位开始
|
|
|
|
|
r.moveEnd("character", old_length);//选取n位
|
|
|
|
|
//txtEdit.focus();
|
|
|
|
|
r.select();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},500);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//code8 end
|
|
|
|
|
}
|
|
|
|
|
//向下方向键
|
|
|
|
|
if(code == 40){
|
|
|
|
|
//code40 begin
|
|
|
|
|
if(ind == 1 || ind == 13|| ind == 5|| ind == 6|| ind == 7|| ind == 8|| ind == 10){
|
|
|
|
|
var rowCount = mygrid_pay.getRowsNum();
|
|
|
|
|
mygrid_pay.clearSelection();
|
|
|
|
|
mygrid_pay.editStop();
|
|
|
|
|
if(rowIndex == (rowCount - 1)){
|
|
|
|
|
addPayRow();
|
|
|
|
|
}else{
|
|
|
|
|
mygrid_pay.selectCell(rowIndex+1,1,true,true);
|
|
|
|
|
mygrid_pay.editCell();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
pressCount = 0;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//code40 end
|
|
|
|
|
}
|
|
|
|
|
//向上箭头
|
|
|
|
|
if(code == 38){
|
|
|
|
|
//code38 begin
|
|
|
|
|
|
|
|
|
|
if(ind == 1 || ind == 13|| ind == 5|| ind == 6|| ind == 7|| ind == 8|| ind == 10){
|
|
|
|
|
if(rowIndex > 0){
|
|
|
|
|
mygrid_pay.clearSelection();
|
|
|
|
|
mygrid_pay.editStop();
|
|
|
|
|
mygrid_pay.selectCell(rowIndex-1,1,true,true);
|
|
|
|
|
mygrid_pay.editCell();
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
pressCount = 0;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//code38 end
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//键盘输入数字code >= 48 && code <= 57|| code >= 96 && code <= 105
|
|
|
|
|
if(code == 188|| code == 110|| code == 190){
|
|
|
|
|
if( ind == 2|| ind == 3|| ind == 4||ind == 5|| ind == 6|| ind == 7|| ind == 8|| ind == 10||ind == 11){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(code == 189 || code == 109){
|
|
|
|
|
if(ind == 5){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//onKeyPress end
|
|
|
|
|
});
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
markStatusColor(mygrid_pay);
|
|
|
|
|
},460);
|
|
|
|
|
var pressVal = "";
|
|
|
|
|
var pressColIndex = 0;
|
|
|
|
|
var pressRowIndex = 0;
|
|
|
|
|
var pressGridType = 1;//recv
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function addRecvRow(){
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
// if(newFeePayCount > 0 || changeFeePayCount > 0){
|
|
|
|
|
// alert("应付费用未保存,请先将应付费用保存,再添加应收费用");
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// if(mygrid_recv.getRowsNum() > 0){
|
|
|
|
|
var newId = newGuid();
|
|
|
|
|
//获取插入新纪录位置
|
|
|
|
|
var rowCount = mygrid_recv.getRowsNum();
|
|
|
|
|
mygrid_recv.addRow(newId,[0,"录入状态","","","",0,0,0,0,"RMB",1,"PP","",false],rowCount);
|
|
|
|
|
|
|
|
|
|
//mygrid_recv.addRow(newId,"",mygrid_recv.getRowsNum());
|
|
|
|
|
mygrid_recv.clearSelection();
|
|
|
|
|
//mygrid_recv.selectRow(mygrid_recv.getRowIndex(newId),false,false,true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//mygrid_recv.loadXML("feegridsource.aspx?type=1&read=add&showcount="+page_count);
|
|
|
|
|
//mygrid_recv.enableCellIds(true);
|
|
|
|
|
|
|
|
|
|
var rId = mygrid_recv.getRowId(rowCount-1);
|
|
|
|
|
// var combo_name;
|
|
|
|
|
// var combo_customer;
|
|
|
|
|
// var combo_unit;
|
|
|
|
|
// var combo_currency;
|
|
|
|
|
// var combo_frt;
|
|
|
|
|
//
|
|
|
|
|
// combo_name = mygrid_recv.getCustomCombo(rId,1);
|
|
|
|
|
// combo_customer = mygrid_recv.getCustomCombo(rId,2);
|
|
|
|
|
// combo_unit = mygrid_recv.getCustomCombo(rId,3);
|
|
|
|
|
// combo_currency = mygrid_recv.getCustomCombo(rId,8);
|
|
|
|
|
// combo_frt = mygrid_recv.getCustomCombo(rId,10);
|
|
|
|
|
//
|
|
|
|
|
// //重新加载应收费用名称
|
|
|
|
|
// setComboByArray(mygrid_recv,combo_name,newId,1);
|
|
|
|
|
// //重新加载结算单位
|
|
|
|
|
// setComboByArray(mygrid_recv,combo_customer,newId,2);
|
|
|
|
|
// //重新加载计费标准
|
|
|
|
|
// setComboByArray(mygrid_recv,combo_unit,newId,3);
|
|
|
|
|
// //重新加载币别
|
|
|
|
|
// setComboByArray(mygrid_recv,combo_currency,newId,8);
|
|
|
|
|
// //重新加载FRT
|
|
|
|
|
// setComboByArray(mygrid_recv,combo_frt,newId,10);
|
|
|
|
|
var combo_currency;
|
|
|
|
|
combo_currency = mygrid_recv.getCustomCombo(newId,9);
|
|
|
|
|
setCurrencyCombo(combo_currency);
|
|
|
|
|
|
|
|
|
|
var combo_feename;
|
|
|
|
|
combo_feename = mygrid_recv.getCustomCombo(newId,2);
|
|
|
|
|
setFeeNameCombo(combo_feename);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var combo_cust;
|
|
|
|
|
combo_cust = mygrid_recv.getCustomCombo(newId,3);
|
|
|
|
|
setCustomerCombo(combo_cust);
|
|
|
|
|
|
|
|
|
|
var combo_unit;
|
|
|
|
|
combo_unit = mygrid_recv.getCustomCombo(newId,4);
|
|
|
|
|
setUnitCombo(combo_unit);
|
|
|
|
|
|
|
|
|
|
var combo_frt;
|
|
|
|
|
combo_frt = mygrid_recv.getCustomCombo(newId,11);
|
|
|
|
|
setFrtCombo(combo_frt);
|
|
|
|
|
|
|
|
|
|
newFeeRecvCount++;
|
|
|
|
|
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
mygrid_recv.editStop(true);
|
|
|
|
|
mygrid_recv.selectCell(mygrid_recv.getRowIndex(newId),2,true,true);
|
|
|
|
|
mygrid_recv.editCell();
|
|
|
|
|
},150);
|
|
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
// var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// mygrid_recv.loadXML("feegridsource.aspx?type=1&read=add&showcount=1&bsno="+bsno);
|
|
|
|
|
// newFeeRecvCount++;
|
|
|
|
|
// //mygrid_recv.init();
|
|
|
|
|
// }
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,费用不能添加");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function addPayRow(){
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
// if(newFeeRecvCount > 0 || changeFeeRecvCount > 0){
|
|
|
|
|
// alert("应收费用未保存,请先将应收费用保存,再添加应付费用");
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
//if(mygrid_pay.getRowsNum() > 0){
|
|
|
|
|
|
|
|
|
|
var newId = newGuid();
|
|
|
|
|
//获取插入新纪录位置
|
|
|
|
|
var rowCount = mygrid_pay.getRowsNum();
|
|
|
|
|
mygrid_pay.addRow(newId,[0,"录入状态","","","",0,0,0,0,"RMB",1,"PP","",false],rowCount);
|
|
|
|
|
//mygrid_recv.addRow(newId,"",mygrid_recv.getRowsNum());
|
|
|
|
|
mygrid_pay.selectRow(mygrid_pay.getRowIndex(newId),false,false,true);
|
|
|
|
|
|
|
|
|
|
//mygrid_recv.loadXML("feegridsource.aspx?type=1&read=add&showcount="+page_count);
|
|
|
|
|
//mygrid_recv.enableCellIds(true);
|
|
|
|
|
|
|
|
|
|
var rId = mygrid_pay.getRowId(rowCount-1);
|
|
|
|
|
// var combo_name;
|
|
|
|
|
// var combo_customer;
|
|
|
|
|
// var combo_unit;
|
|
|
|
|
// var combo_currency;
|
|
|
|
|
//
|
|
|
|
|
// combo_name = mygrid_pay.getCustomCombo(rId,1);
|
|
|
|
|
// combo_customer = mygrid_pay.getCustomCombo(rId,2);
|
|
|
|
|
// combo_unit = mygrid_pay.getCustomCombo(rId,3);
|
|
|
|
|
// combo_currency = mygrid_pay.getCustomCombo(rId,8);
|
|
|
|
|
//
|
|
|
|
|
// //重新加载应收费用名称
|
|
|
|
|
// setComboByArray(mygrid_pay,combo_name,newId,1);
|
|
|
|
|
// //重新加载结算单位
|
|
|
|
|
// setComboByArray(mygrid_pay,combo_customer,newId,2);
|
|
|
|
|
// //重新加载计费标准
|
|
|
|
|
// setComboByArray(mygrid_pay,combo_unit,newId,3);
|
|
|
|
|
// //重新加载币别
|
|
|
|
|
// setComboByArray(mygrid_pay,combo_currency,newId,8);
|
|
|
|
|
var combo_currency;
|
|
|
|
|
combo_currency = mygrid_pay.getCustomCombo(newId,9);
|
|
|
|
|
setCurrencyCombo(combo_currency);
|
|
|
|
|
|
|
|
|
|
var combo_feename;
|
|
|
|
|
combo_feename = mygrid_pay.getCustomCombo(newId,2);
|
|
|
|
|
setFeeNameCombo(combo_feename);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var combo_cust;
|
|
|
|
|
combo_cust = mygrid_pay.getCustomCombo(newId,3);
|
|
|
|
|
setCustomerCombo(combo_cust);
|
|
|
|
|
|
|
|
|
|
var combo_unit;
|
|
|
|
|
combo_unit = mygrid_pay.getCustomCombo(newId,4);
|
|
|
|
|
setUnitCombo(combo_unit);
|
|
|
|
|
|
|
|
|
|
var combo_frt;
|
|
|
|
|
combo_frt = mygrid_pay.getCustomCombo(newId,11);
|
|
|
|
|
setFrtCombo(combo_frt);
|
|
|
|
|
|
|
|
|
|
newFeePayCount++;
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
mygrid_pay.editStop(true);
|
|
|
|
|
mygrid_pay.selectCell(mygrid_pay.getRowIndex(newId),2,true,true);
|
|
|
|
|
mygrid_pay.editCell();
|
|
|
|
|
},150);
|
|
|
|
|
// }else{
|
|
|
|
|
// var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// mygrid_pay.loadXML("feegridsource.aspx?type=2&read=add&showcount=1&bsno="+bsno);
|
|
|
|
|
// newFeePayCount++;
|
|
|
|
|
// //mygrid_pay.init();
|
|
|
|
|
// }
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,费用不能添加");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function deleteRecvRow(){
|
|
|
|
|
// var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_recv.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_recv.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_recv.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_recv.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
if(feeState != "录入状态" && feeState != "驳回审核"){
|
|
|
|
|
alert("只能删除状态为录入状态和驳回审核状态的应收费用");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(iCount > 0){
|
|
|
|
|
var delCount = 0;
|
|
|
|
|
if(recvArg.length > 0){
|
|
|
|
|
if(window.confirm("您确定要将所选应收费用删除")){
|
|
|
|
|
while(delCount < recvArg.length){
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(recvArg[delCount]);
|
|
|
|
|
|
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var cusName = mygrid_recv.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
|
|
|
|
|
var urlVal = "FeeService.aspx?crmfee="+recvArg[delCount]+"&handle=deletecrmfee"+"&no="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
|
|
|
|
|
if(loadVal > 0 ){
|
|
|
|
|
mygrid_recv.deleteRow(recvArg[delCount]);
|
|
|
|
|
}
|
|
|
|
|
delCount++;
|
|
|
|
|
}
|
|
|
|
|
getFeeProfit(bsno);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("未选中要操作的费用项");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,费用不能修改");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// //查看是否有被选中的费用项
|
|
|
|
|
// if(selGroup.length > 0){
|
|
|
|
|
// if(selGroup.length > 1){
|
|
|
|
|
// var delCount = 0;
|
|
|
|
|
// if(window.confirm("您确定要将所选应收费用删除")){
|
|
|
|
|
// var dg=new dialog();
|
|
|
|
|
// dg.html="<img src=\"../images/icon/progress.gif\" />";
|
|
|
|
|
// dg.width=200;
|
|
|
|
|
// dg.height=100;
|
|
|
|
|
// dg.title="标题";
|
|
|
|
|
// dg.show();
|
|
|
|
|
// while(delCount < selGroup.length){
|
|
|
|
|
// var rowIndex = mygrid_recv.getRowIndex(selGroup[delCount]);
|
|
|
|
|
//
|
|
|
|
|
// var feeName = mygrid_recv.cellByIndex(rowIndex,1).getValue();
|
|
|
|
|
// var cusName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// var urlVal = "FeeService.aspx?gid="+selGroup[delCount]+"&handle=delete"+"&no="+newGuid();;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
//
|
|
|
|
|
// if(loadVal > 0 ){
|
|
|
|
|
// mygrid_recv.deleteRow(selGroup[delCount]);
|
|
|
|
|
// }else{
|
|
|
|
|
// mygrid_recv.deleteSelectedRows();
|
|
|
|
|
// }
|
|
|
|
|
// delCount++;
|
|
|
|
|
// }
|
|
|
|
|
// dg.close();
|
|
|
|
|
// totalDynamicFeeGain();
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
// var delCount = 0;
|
|
|
|
|
// while(delCount < selGroup.length){
|
|
|
|
|
// var rowIndex = mygrid_recv.getRowIndex(selGroup[delCount]);
|
|
|
|
|
//
|
|
|
|
|
// var feeName = mygrid_recv.cellByIndex(rowIndex,1).getValue();
|
|
|
|
|
// var cusName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
//
|
|
|
|
|
// if(window.confirm("您确定要将 应收费用("+feeName+") 删除")){
|
|
|
|
|
// var dg=new dialog();
|
|
|
|
|
// dg.html="<img src=\"../images/icon/progress.gif\" />";
|
|
|
|
|
// dg.width=200;
|
|
|
|
|
// dg.height=100;
|
|
|
|
|
// dg.title="标题";
|
|
|
|
|
// dg.show();
|
|
|
|
|
//
|
|
|
|
|
// var urlVal = "FeeService.aspx?gid="+selGroup[delCount]+"&handle=delete"+"&no="+newGuid();
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
|
|
|
|
|
// if(loadVal > 0 ){
|
|
|
|
|
// mygrid_recv.deleteRow(selGroup[delCount]);
|
|
|
|
|
// dg.close();
|
|
|
|
|
// alert("删除成功");
|
|
|
|
|
// }else{
|
|
|
|
|
// mygrid_recv.deleteSelectedRows();
|
|
|
|
|
// dg.close();
|
|
|
|
|
// }
|
|
|
|
|
// totalDynamicFeeGain();
|
|
|
|
|
// }
|
|
|
|
|
// delCount++;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
// alert("未选中要操作的费用项");
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function deletePayRow(){
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
// if(opStatus == 1){
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_pay.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_pay.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_pay.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_pay.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
if(feeState != "录入状态" && feeState != "驳回审核"){
|
|
|
|
|
alert("只能删除状态为录入状态和驳回审核状态的应付费用");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(iCount > 0){
|
|
|
|
|
var delCount = 0;
|
|
|
|
|
if(recvArg.length > 0){
|
|
|
|
|
if(window.confirm("您确定要将所选应付费用删除")){
|
|
|
|
|
while(delCount < recvArg.length){
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(recvArg[delCount]);
|
|
|
|
|
|
|
|
|
|
var feeName = mygrid_pay.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var cusName = mygrid_pay.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
|
|
|
|
|
var urlVal = "FeeService.aspx?crmfee="+recvArg[delCount]+"&handle=deletecrmfee"+"&no="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
|
|
|
|
|
if(loadVal > 0 ){
|
|
|
|
|
mygrid_pay.deleteRow(recvArg[delCount]);
|
|
|
|
|
}
|
|
|
|
|
delCount++;
|
|
|
|
|
}
|
|
|
|
|
getFeeProfit(bsno);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("未选中要操作的费用项");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,费用不能修改");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function saveRecvChange(){
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
var jsonFeeObj = null;
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_recv.getRowsNum();i++){
|
|
|
|
|
var rowId = mygrid_recv.getRowId(i);
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(rowId);
|
|
|
|
|
|
|
|
|
|
var status = mygrid_recv.cellByIndex(i,1).getValue();
|
|
|
|
|
var fname = mygrid_recv.cellByIndex(i,2).getValue();
|
|
|
|
|
if(fname.trim() == ""){
|
|
|
|
|
$("recvContainer").value
|
|
|
|
|
alert("费用名称不能为空");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
var cust = mygrid_recv.cellByIndex(i,3).getValue();
|
|
|
|
|
if(cust.trim() == ""){
|
|
|
|
|
$("recvContainer").value
|
|
|
|
|
alert("结算单位不能为空");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
var unit = mygrid_recv.cellByIndex(i,4).getValue();
|
|
|
|
|
if(unit == ""){
|
|
|
|
|
$("recvContainer").value
|
|
|
|
|
}
|
|
|
|
|
var price = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var tempPrice = parseFloat(price);
|
|
|
|
|
if(tempPrice == 0){
|
|
|
|
|
$("recvContainer").value
|
|
|
|
|
alert("单价不能为零");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
var quantity = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
var tempQuantity = parseFloat(quantity);
|
|
|
|
|
if(tempQuantity == 0){
|
|
|
|
|
$("recvContainer").value
|
|
|
|
|
alert("数量不能为零");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
var commission = mygrid_recv.cellByIndex(i,7).getValue();
|
|
|
|
|
var amount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(i,8).getValue())));
|
|
|
|
|
var tempAmount = parseFloat(amount);
|
|
|
|
|
var currency = mygrid_recv.cellByIndex(i,9).getValue();
|
|
|
|
|
var rate = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(i,10).getValue())));
|
|
|
|
|
var tempRate = parseFloat(rate);
|
|
|
|
|
var frt = mygrid_recv.cellByIndex(i,11).getValue();
|
|
|
|
|
var remark = mygrid_recv.cellByIndex(i,12).getValue();
|
|
|
|
|
var isAdvance = mygrid_recv.cellByIndex(i,13).getValue();
|
|
|
|
|
|
|
|
|
|
if(jsonFeeObj == null){
|
|
|
|
|
var cacheBuffer = "";
|
|
|
|
|
cacheBuffer += "{";
|
|
|
|
|
cacheBuffer += "\"id\":\""+rowId+"\",";
|
|
|
|
|
cacheBuffer += "\"type\":\"1\",";
|
|
|
|
|
cacheBuffer += "\"bsno\":\""+bsno+"\",";
|
|
|
|
|
cacheBuffer += "\"status\":\""+status+"\",";
|
|
|
|
|
cacheBuffer += "\"fname\":\""+fname+"\",";
|
|
|
|
|
cacheBuffer += "\"cust\":\""+cust+"\",";
|
|
|
|
|
cacheBuffer += "\"unit\":\""+unit+"\",";
|
|
|
|
|
cacheBuffer += "\"price\":\""+price+"\",";
|
|
|
|
|
cacheBuffer += "\"quant\":\""+quantity+"\",";
|
|
|
|
|
cacheBuffer += "\"com\":\""+commission+"\",";
|
|
|
|
|
cacheBuffer += "\"amount\":\""+amount+"\",";
|
|
|
|
|
cacheBuffer += "\"cur\":\""+currency+"\",";
|
|
|
|
|
cacheBuffer += "\"rate\":\""+rate+"\",";
|
|
|
|
|
cacheBuffer += "\"frt\":\""+frt+"\",";
|
|
|
|
|
cacheBuffer += "\"remark\":\""+remark+"\",";
|
|
|
|
|
cacheBuffer += "\"isadv\":\""+isAdvance+"\"";
|
|
|
|
|
cacheBuffer += "}";
|
|
|
|
|
// var cacheBuffer = "";
|
|
|
|
|
// cacheBuffer += "{";
|
|
|
|
|
// cacheBuffer += "\"id\":\""+rowId+"\",";
|
|
|
|
|
// cacheBuffer += "\"type\":\"1\",";
|
|
|
|
|
// cacheBuffer += "\"bsno\":\""+bsno+"\",";
|
|
|
|
|
// cacheBuffer += "\"status\":\""+mygrid_recv.cellByIndex(rowIndex,1).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"fname\":\""+mygrid_recv.cellByIndex(rowIndex,2).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"cust\":\""+mygrid_recv.cellByIndex(rowIndex,3).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"unit\":\""+mygrid_recv.cellByIndex(rowIndex,4).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"price\":\""+mygrid_recv.cellByIndex(rowIndex,5).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"quant\":\""+mygrid_recv.cellByIndex(rowIndex,6).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"com\":\""+mygrid_recv.cellByIndex(rowIndex,7).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"amount\":\""+mygrid_recv.cellByIndex(rowIndex,8).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"cur\":\""+mygrid_recv.cellByIndex(rowIndex,9).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"rate\":\""+mygrid_recv.cellByIndex(rowIndex,10).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"frt\":\""+mygrid_recv.cellByIndex(rowIndex,11).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"remark\":\""+mygrid_recv.cellByIndex(rowIndex,12).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"isadv\":\""+mygrid_recv.cellByIndex(rowIndex,13).getValue()+"\"";
|
|
|
|
|
// cacheBuffer += "}";
|
|
|
|
|
|
|
|
|
|
var result = "";
|
|
|
|
|
result += "{\"fees\":[";
|
|
|
|
|
result += cacheBuffer;
|
|
|
|
|
result += "]}";
|
|
|
|
|
|
|
|
|
|
jsonFeeObj = eval('(' + result + ')');
|
|
|
|
|
}else{
|
|
|
|
|
var newFeeRow = jsonFeeObj.fees;
|
|
|
|
|
|
|
|
|
|
// var cacheBuffer = "";
|
|
|
|
|
// cacheBuffer += "{";
|
|
|
|
|
// cacheBuffer += "\"id\":\""+rowId+"\",";
|
|
|
|
|
// cacheBuffer += "\"type\":\"1\",";
|
|
|
|
|
// cacheBuffer += "\"bsno\":\""+bsno+"\",";
|
|
|
|
|
// cacheBuffer += "\"status\":\""+mygrid_recv.cellByIndex(rowIndex,1).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"fname\":\""+mygrid_recv.cellByIndex(rowIndex,2).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"cust\":\""+mygrid_recv.cellByIndex(rowIndex,3).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"unit\":\""+mygrid_recv.cellByIndex(rowIndex,4).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"price\":\""+mygrid_recv.cellByIndex(rowIndex,5).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"quant\":\""+mygrid_recv.cellByIndex(rowIndex,6).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"com\":"+mygrid_recv.cellByIndex(rowIndex,7).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"amount\":\""+mygrid_recv.cellByIndex(rowIndex,8).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"cur\":\""+mygrid_recv.cellByIndex(rowIndex,9).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"rate\":\""+mygrid_recv.cellByIndex(rowIndex,10).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"frt\":\""+mygrid_recv.cellByIndex(rowIndex,11).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"remark\":\""+mygrid_recv.cellByIndex(rowIndex,12).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"isadv\":\""+mygrid_recv.cellByIndex(rowIndex,13).getValue()+"\"";
|
|
|
|
|
// cacheBuffer += "}";
|
|
|
|
|
// newFeeRow = {id:rowId,type:"1",bsno:bsno,status:mygrid_recv.cellByIndex(rowIndex,1).getValue(),fname:mygrid_recv.cellByIndex(rowIndex,2).getValue(),cust:mygrid_recv.cellByIndex(rowIndex,3).getValue(),
|
|
|
|
|
// unit:mygrid_recv.cellByIndex(rowIndex,4).getValue(),price:mygrid_recv.cellByIndex(rowIndex,5).getValue(),quant:mygrid_recv.cellByIndex(rowIndex,6).getValue(),
|
|
|
|
|
// com:mygrid_recv.cellByIndex(rowIndex,7).getValue(),amount:mygrid_recv.cellByIndex(rowIndex,8).getValue(),cur:mygrid_recv.cellByIndex(rowIndex,9).getValue(),
|
|
|
|
|
// rate:mygrid_recv.cellByIndex(rowIndex,10).getValue(),frt:mygrid_recv.cellByIndex(rowIndex,11).getValue(),remark:mygrid_recv.cellByIndex(rowIndex,12).getValue(),
|
|
|
|
|
// isadv:mygrid_recv.cellByIndex(rowIndex,13).getValue()};
|
|
|
|
|
newFeeRow = {id:rowId,type:"1",bsno:bsno,status:status,fname:fname,
|
|
|
|
|
cust:cust,unit:unit,price:tempPrice,quant:tempQuantity,com:commission,
|
|
|
|
|
amount:tempAmount,cur:currency,rate:tempRate,frt:frt,remark:remark,isadv:isAdvance};
|
|
|
|
|
|
|
|
|
|
jsonFeeObj.fees.push(newFeeRow);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//alert(JSON.stringify(jsonFeeObj));
|
|
|
|
|
//alert(JSON.stringify(jsonFeeObj));
|
|
|
|
|
$("recvContainer").value = JSON.stringify(jsonFeeObj);
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function saveAction(){
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var recvState = 0;
|
|
|
|
|
var payState = 0;
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
recvState = saveRecvChange();//保存应收费用
|
|
|
|
|
payState = savePayChange();//保存应付费用
|
|
|
|
|
|
|
|
|
|
if(recvState == 1 && payState == 1){
|
|
|
|
|
GetGainArg();
|
|
|
|
|
msgBox();
|
|
|
|
|
setTimeout(postEnterFee,200);
|
|
|
|
|
newFeeRecvCount = 0;
|
|
|
|
|
changeFeeRecvCount = 0;
|
|
|
|
|
$("h_post").value = 1;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,费用不能修改");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function savePayChange(){
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
var jsonFeeObj = null;
|
|
|
|
|
for(var i=0;i<mygrid_pay.getRowsNum();i++){
|
|
|
|
|
var rowId = mygrid_pay.getRowId(i);
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(rowId);
|
|
|
|
|
|
|
|
|
|
var status = mygrid_pay.cellByIndex(i,1).getValue();
|
|
|
|
|
var fname = mygrid_pay.cellByIndex(i,2).getValue();
|
|
|
|
|
if(fname.trim() == ""){
|
|
|
|
|
$("recvContainer").value
|
|
|
|
|
alert("费用名称不能为空");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
var cust = mygrid_pay.cellByIndex(i,3).getValue();
|
|
|
|
|
if(cust.trim() == ""){
|
|
|
|
|
$("recvContainer").value
|
|
|
|
|
alert("结算单位不能为空");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
var unit = mygrid_pay.cellByIndex(i,4).getValue();
|
|
|
|
|
if(unit == ""){
|
|
|
|
|
$("recvContainer").value
|
|
|
|
|
}
|
|
|
|
|
var price = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var tempPrice = parseFloat(price);
|
|
|
|
|
if(tempPrice == 0){
|
|
|
|
|
$("recvContainer").value
|
|
|
|
|
alert("单价不能为零");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
var quantity = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
var tempQuantity = parseFloat(quantity);
|
|
|
|
|
if(tempQuantity == 0){
|
|
|
|
|
$("recvContainer").value
|
|
|
|
|
alert("数量不能为零");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
var commission = mygrid_pay.cellByIndex(i,7).getValue();
|
|
|
|
|
var amount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(i,8).getValue())));
|
|
|
|
|
var tempAmount = parseFloat(amount);
|
|
|
|
|
var currency = mygrid_pay.cellByIndex(i,9).getValue();
|
|
|
|
|
var rate = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(i,10).getValue())));
|
|
|
|
|
var tempRate = parseFloat(rate);
|
|
|
|
|
var frt = mygrid_pay.cellByIndex(i,11).getValue();
|
|
|
|
|
var remark = mygrid_pay.cellByIndex(i,12).getValue();
|
|
|
|
|
var isAdvance = mygrid_pay.cellByIndex(i,13).getValue();
|
|
|
|
|
|
|
|
|
|
if(jsonFeeObj == null){
|
|
|
|
|
var cacheBuffer = "";
|
|
|
|
|
cacheBuffer += "{";
|
|
|
|
|
cacheBuffer += "\"id\":\""+rowId+"\",";
|
|
|
|
|
cacheBuffer += "\"type\":\"2\",";
|
|
|
|
|
cacheBuffer += "\"bsno\":\""+bsno+"\",";
|
|
|
|
|
cacheBuffer += "\"status\":\""+status+"\",";
|
|
|
|
|
cacheBuffer += "\"fname\":\""+fname+"\",";
|
|
|
|
|
cacheBuffer += "\"cust\":\""+cust+"\",";
|
|
|
|
|
cacheBuffer += "\"unit\":\""+unit+"\",";
|
|
|
|
|
cacheBuffer += "\"price\":\""+price+"\",";
|
|
|
|
|
cacheBuffer += "\"quant\":\""+quantity+"\",";
|
|
|
|
|
cacheBuffer += "\"com\":\""+commission+"\",";
|
|
|
|
|
cacheBuffer += "\"amount\":\""+amount+"\",";
|
|
|
|
|
cacheBuffer += "\"cur\":\""+currency+"\",";
|
|
|
|
|
cacheBuffer += "\"rate\":\""+rate+"\",";
|
|
|
|
|
cacheBuffer += "\"frt\":\""+frt+"\",";
|
|
|
|
|
cacheBuffer += "\"remark\":\""+remark+"\",";
|
|
|
|
|
cacheBuffer += "\"isadv\":\""+isAdvance+"\"";
|
|
|
|
|
cacheBuffer += "}";
|
|
|
|
|
// var cacheBuffer = "";
|
|
|
|
|
// cacheBuffer += "{";
|
|
|
|
|
// cacheBuffer += "\"id\":\""+rowId+"\",";
|
|
|
|
|
// cacheBuffer += "\"type\":\"1\",";
|
|
|
|
|
// cacheBuffer += "\"bsno\":\""+bsno+"\",";
|
|
|
|
|
// cacheBuffer += "\"status\":\""+mygrid_recv.cellByIndex(rowIndex,1).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"fname\":\""+mygrid_recv.cellByIndex(rowIndex,2).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"cust\":\""+mygrid_recv.cellByIndex(rowIndex,3).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"unit\":\""+mygrid_recv.cellByIndex(rowIndex,4).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"price\":\""+mygrid_recv.cellByIndex(rowIndex,5).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"quant\":\""+mygrid_recv.cellByIndex(rowIndex,6).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"com\":\""+mygrid_recv.cellByIndex(rowIndex,7).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"amount\":\""+mygrid_recv.cellByIndex(rowIndex,8).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"cur\":\""+mygrid_recv.cellByIndex(rowIndex,9).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"rate\":\""+mygrid_recv.cellByIndex(rowIndex,10).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"frt\":\""+mygrid_recv.cellByIndex(rowIndex,11).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"remark\":\""+mygrid_recv.cellByIndex(rowIndex,12).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"isadv\":\""+mygrid_recv.cellByIndex(rowIndex,13).getValue()+"\"";
|
|
|
|
|
// cacheBuffer += "}";
|
|
|
|
|
|
|
|
|
|
var result = "";
|
|
|
|
|
result += "{\"fees\":[";
|
|
|
|
|
result += cacheBuffer;
|
|
|
|
|
result += "]}";
|
|
|
|
|
|
|
|
|
|
jsonFeeObj = eval('(' + result + ')');
|
|
|
|
|
}else{
|
|
|
|
|
var newFeeRow = jsonFeeObj.fees;
|
|
|
|
|
|
|
|
|
|
// var cacheBuffer = "";
|
|
|
|
|
// cacheBuffer += "{";
|
|
|
|
|
// cacheBuffer += "\"id\":\""+rowId+"\",";
|
|
|
|
|
// cacheBuffer += "\"type\":\"1\",";
|
|
|
|
|
// cacheBuffer += "\"bsno\":\""+bsno+"\",";
|
|
|
|
|
// cacheBuffer += "\"status\":\""+mygrid_recv.cellByIndex(rowIndex,1).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"fname\":\""+mygrid_recv.cellByIndex(rowIndex,2).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"cust\":\""+mygrid_recv.cellByIndex(rowIndex,3).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"unit\":\""+mygrid_recv.cellByIndex(rowIndex,4).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"price\":\""+mygrid_recv.cellByIndex(rowIndex,5).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"quant\":\""+mygrid_recv.cellByIndex(rowIndex,6).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"com\":"+mygrid_recv.cellByIndex(rowIndex,7).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"amount\":\""+mygrid_recv.cellByIndex(rowIndex,8).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"cur\":\""+mygrid_recv.cellByIndex(rowIndex,9).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"rate\":\""+mygrid_recv.cellByIndex(rowIndex,10).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"frt\":\""+mygrid_recv.cellByIndex(rowIndex,11).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"remark\":\""+mygrid_recv.cellByIndex(rowIndex,12).getValue()+"\",";
|
|
|
|
|
// cacheBuffer += "\"isadv\":\""+mygrid_recv.cellByIndex(rowIndex,13).getValue()+"\"";
|
|
|
|
|
// cacheBuffer += "}";
|
|
|
|
|
// newFeeRow = {id:rowId,type:"1",bsno:bsno,status:mygrid_recv.cellByIndex(rowIndex,1).getValue(),fname:mygrid_recv.cellByIndex(rowIndex,2).getValue(),cust:mygrid_recv.cellByIndex(rowIndex,3).getValue(),
|
|
|
|
|
// unit:mygrid_recv.cellByIndex(rowIndex,4).getValue(),price:mygrid_recv.cellByIndex(rowIndex,5).getValue(),quant:mygrid_recv.cellByIndex(rowIndex,6).getValue(),
|
|
|
|
|
// com:mygrid_recv.cellByIndex(rowIndex,7).getValue(),amount:mygrid_recv.cellByIndex(rowIndex,8).getValue(),cur:mygrid_recv.cellByIndex(rowIndex,9).getValue(),
|
|
|
|
|
// rate:mygrid_recv.cellByIndex(rowIndex,10).getValue(),frt:mygrid_recv.cellByIndex(rowIndex,11).getValue(),remark:mygrid_recv.cellByIndex(rowIndex,12).getValue(),
|
|
|
|
|
// isadv:mygrid_recv.cellByIndex(rowIndex,13).getValue()};
|
|
|
|
|
newFeeRow = {id:rowId,type:"2",bsno:bsno,status:status,fname:fname,
|
|
|
|
|
cust:cust,unit:unit,price:tempPrice,quant:tempQuantity,com:commission,
|
|
|
|
|
amount:tempAmount,cur:currency,rate:tempRate,frt:frt,remark:remark,isadv:isAdvance};
|
|
|
|
|
|
|
|
|
|
jsonFeeObj.fees.push(newFeeRow);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//alert(JSON.stringify(jsonFeeObj));
|
|
|
|
|
//alert(JSON.stringify(jsonFeeObj));
|
|
|
|
|
$("payContainer").value = JSON.stringify(jsonFeeObj);
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function doOnRowSelected(rowID,celInd){
|
|
|
|
|
alert("Selected row ID is "+rowID+"\nUser clicked cell with index "+celInd);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getValue(){
|
|
|
|
|
var colLabel=mygrid_recv.getColumnLabel(0);
|
|
|
|
|
//alert(colLabel);
|
|
|
|
|
var colLabel2=mygrid_recv.getColumnLabel(0,1);
|
|
|
|
|
//alert(colLabel2);
|
|
|
|
|
}
|
|
|
|
|
//post数据
|
|
|
|
|
function postEnterFee(){
|
|
|
|
|
/*var myForm = document.createElement("form");
|
|
|
|
|
myForm.method="post" ;
|
|
|
|
|
myForm.action = "gridshow.aspx" ;
|
|
|
|
|
|
|
|
|
|
var myInput = document.createElement("input") ;
|
|
|
|
|
myInput.setAttribute("name", "abc") ;
|
|
|
|
|
myInput.setAttribute("value", "bbs");
|
|
|
|
|
myForm.appendChild(myInput) ;
|
|
|
|
|
|
|
|
|
|
document.body.appendChild(myForm) ;
|
|
|
|
|
myForm.submit() ;
|
|
|
|
|
document.body.removeChild(myForm) ;*/
|
|
|
|
|
|
|
|
|
|
var myForm = document.getElementById("form1");
|
|
|
|
|
myForm.submit() ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function findRow(){
|
|
|
|
|
|
|
|
|
|
var colNum = mygrid.getColumnsNum();
|
|
|
|
|
//alert(colNum);
|
|
|
|
|
|
|
|
|
|
var count = mygrid.getRowsNum();
|
|
|
|
|
//alert(count);
|
|
|
|
|
|
|
|
|
|
//var combo = mygrid.getCombo(1);
|
|
|
|
|
//combo.put("abc","abc");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function initGrid(){
|
|
|
|
|
doInitRecvGrid();
|
|
|
|
|
// setTimeout(doInitPayGrid,200);
|
|
|
|
|
// setTimeout(totalDynamicFeeGain,700);
|
|
|
|
|
//setTimeout(doInitPayGrid,100000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//放弃应收费用修改 重新加载页面
|
|
|
|
|
function recoverRecvChange(){
|
|
|
|
|
var iSuccess = 0;
|
|
|
|
|
var iFailure = 0;
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
//查看是否有被选中的费用项
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_recv.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_recv.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_recv.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_recv.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
if(feeState != "录入状态"){
|
|
|
|
|
alert("只能对状态为录入状态应收费用进行放弃修改操作");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(iCount > 0){
|
|
|
|
|
var delCount = 0;
|
|
|
|
|
if(recvArg.length > 0){
|
|
|
|
|
if(window.confirm("您确定要将所选应收费用放弃修改")){
|
|
|
|
|
while(delCount < recvArg.length){
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(recvArg[delCount]);
|
|
|
|
|
|
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var cusName = mygrid_recv.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
|
|
|
|
|
var urlVal = "FeeService.aspx?crmfee="+recvArg[delCount]+"&handle=recovercrmfee&no="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
if(!IsNum(loadVal)){
|
|
|
|
|
var recoverArg = new Array();
|
|
|
|
|
recoverArg = loadVal.split(",");
|
|
|
|
|
|
|
|
|
|
var selRowIndex = mygrid_recv.getRowIndex(recvArg[delCount]);
|
|
|
|
|
|
|
|
|
|
var colCount = mygrid_recv.getColumnsNum();
|
|
|
|
|
for(var i=2;i<colCount;i++){
|
|
|
|
|
mygrid_recv.cellByIndex(selRowIndex,i).setValue(recoverArg[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
iSuccess++;
|
|
|
|
|
}else{
|
|
|
|
|
mygrid_recv.deleteRow(recvArg[delCount]);
|
|
|
|
|
}
|
|
|
|
|
delCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ReShowLabel(mygrid_recv);
|
|
|
|
|
alert("提交放弃修改应收费用 共 "+delCount+" 条 成功 "+iSuccess+" 条 失败 "+iFailure+" 条");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("未选中要操作的费用项");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,费用修改费用");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//放弃应付费用修改 重新加载页面
|
|
|
|
|
function recoverPayChange(){
|
|
|
|
|
var iSuccess = 0;
|
|
|
|
|
var iFailure = 0;
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
//查看是否有被选中的费用项
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_pay.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_pay.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_pay.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_pay.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
if(feeState != "录入状态"){
|
|
|
|
|
alert("只能对状态为录入状态应付费用进行放弃修改操作");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(iCount > 0){
|
|
|
|
|
var delCount = 0;
|
|
|
|
|
if(recvArg.length > 0){
|
|
|
|
|
if(window.confirm("您确定要将所选应付费用放弃修改")){
|
|
|
|
|
while(delCount < recvArg.length){
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(recvArg[delCount]);
|
|
|
|
|
|
|
|
|
|
var feeName = mygrid_pay.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var cusName = mygrid_pay.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
|
|
|
|
|
var urlVal = "FeeService.aspx?crmfee="+recvArg[delCount]+"&handle=recovercrmfee&no="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
if(!IsNum(loadVal)){
|
|
|
|
|
var recoverArg = new Array();
|
|
|
|
|
recoverArg = loadVal.split(",");
|
|
|
|
|
|
|
|
|
|
var selRowIndex = mygrid_pay.getRowIndex(recvArg[delCount]);
|
|
|
|
|
|
|
|
|
|
var colCount = mygrid_pay.getColumnsNum();
|
|
|
|
|
for(var i=2;i<colCount;i++){
|
|
|
|
|
mygrid_pay.cellByIndex(selRowIndex,i).setValue(recoverArg[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
iSuccess++;
|
|
|
|
|
}else{
|
|
|
|
|
mygrid_pay.deleteRow(recvArg[delCount]);
|
|
|
|
|
}
|
|
|
|
|
delCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ReShowLabel(mygrid_pay);
|
|
|
|
|
alert("提交放弃修改应收费用 共 "+delCount+" 条 成功 "+iSuccess+" 条 失败 "+iFailure+" 条");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("未选中要操作的费用项");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,费用修改费用");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function print_recv(){
|
|
|
|
|
var strBSNO = "";
|
|
|
|
|
strBSNO = $("h_bsno").value;
|
|
|
|
|
// var openSet = "height=680, width=1050, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-710)/2 + ",Left= "+(screen.width-800)/2
|
|
|
|
|
// var openType = "_blank";
|
|
|
|
|
// var openUrl = "../Reports/DebitNoteReport.aspx?bsno="+strBSNO+"&type=1";
|
|
|
|
|
// window.open (openUrl,openType,openSet);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
alert("没有权限操作");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
printMessageBox(event,1);
|
|
|
|
|
// var printUrl = "";
|
|
|
|
|
// var companyID = "";
|
|
|
|
|
// var typeName = "SEAOPFEE";
|
|
|
|
|
// var dbSourceID = "";
|
|
|
|
|
// var userID = "";
|
|
|
|
|
//
|
|
|
|
|
// var url = "../Reports/ReportService.aspx?handle=printseaopfee&bsno="+strBSNO+"&feetype=1&val="+newGuid();
|
|
|
|
|
//
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
// var reportVal = loader.xmlDoc.responseText;
|
|
|
|
|
// var reportObj = null;
|
|
|
|
|
//
|
|
|
|
|
// if(reportVal != ""){
|
|
|
|
|
// reportObj = eval('(' + reportVal + ')');
|
|
|
|
|
// if(reportObj.reports.length > 0){
|
|
|
|
|
// if(reportObj.reports[0].compid != ""){
|
|
|
|
|
// companyID = reportObj.reports[0].compid;
|
|
|
|
|
// }
|
|
|
|
|
// if(reportObj.reports[0].sourceid != ""){
|
|
|
|
|
// dbSourceID = reportObj.reports[0].sourceid;
|
|
|
|
|
// }
|
|
|
|
|
// if(reportObj.reports[0].compid != ""){
|
|
|
|
|
// userID = reportObj.reports[0].userid;
|
|
|
|
|
// }
|
|
|
|
|
// printUrl = "print://?comp="+companyID+"&type="+typeName+"&dbid="+dbSourceID+"&uid="+userID;//alert(printUrl);
|
|
|
|
|
//
|
|
|
|
|
// window.location.href = window.location.href;
|
|
|
|
|
// location.href = printUrl;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }else{
|
|
|
|
|
// alert("没有要打印的报表");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function print_pay(){
|
|
|
|
|
var strBSNO = "";
|
|
|
|
|
strBSNO = $("h_bsno").value;
|
|
|
|
|
// var openSet = "height=680, width=1050, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-710)/2 + ",Left= "+(screen.width-800)/2
|
|
|
|
|
// var openType = "_blank";
|
|
|
|
|
// var openUrl = "../Reports/DebitNoteReport.aspx?bsno="+strBSNO+"&type=2";
|
|
|
|
|
// window.open (openUrl,openType,openSet);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
alert("没有权限操作");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
printMessageBox(event,2);
|
|
|
|
|
// var printUrl = "";
|
|
|
|
|
// var companyID = "";
|
|
|
|
|
// var typeName = "SEAOPFEE";
|
|
|
|
|
// var dbSourceID = "";
|
|
|
|
|
// var userID = "";
|
|
|
|
|
//
|
|
|
|
|
// var url = "../Reports/ReportService.aspx?handle=printseaopfee&bsno="+strBSNO+"&feetype=2&val="+newGuid();
|
|
|
|
|
//
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
// var reportVal = loader.xmlDoc.responseText;
|
|
|
|
|
// var reportObj = null;
|
|
|
|
|
//
|
|
|
|
|
// if(reportVal != ""){
|
|
|
|
|
// reportObj = eval('(' + reportVal + ')');
|
|
|
|
|
// if(reportObj.reports.length > 0){
|
|
|
|
|
// if(reportObj.reports[0].compid != ""){
|
|
|
|
|
// companyID = reportObj.reports[0].compid;
|
|
|
|
|
// }
|
|
|
|
|
// if(reportObj.reports[0].sourceid != ""){
|
|
|
|
|
// dbSourceID = reportObj.reports[0].sourceid;
|
|
|
|
|
// }
|
|
|
|
|
// if(reportObj.reports[0].compid != ""){
|
|
|
|
|
// userID = reportObj.reports[0].userid;
|
|
|
|
|
// }
|
|
|
|
|
// printUrl = "print://?comp="+companyID+"&type="+typeName+"&dbid="+dbSourceID+"&uid="+userID;//alert(printUrl);
|
|
|
|
|
|
|
|
|
|
// window.location.href = window.location.href;
|
|
|
|
|
// location.href = printUrl;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }else{
|
|
|
|
|
// alert("没有要打印的报表");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
//动态计算费用利润信息
|
|
|
|
|
function totalDynamicFeeGain(){
|
|
|
|
|
|
|
|
|
|
//获取应收费用列表行数
|
|
|
|
|
var rowCount_recv = mygrid_recv.getRowsNum();
|
|
|
|
|
|
|
|
|
|
var usdSum_recv = 0.0;//美元合计-应收
|
|
|
|
|
var rmbSum_recv = 0.0;//人民币合计-应收
|
|
|
|
|
var otherSum_recv = 0.0;//其他币别合计-应收
|
|
|
|
|
var totalAmount_recv = 0.0//应收合计-包括除人民币以外其他币别折合成人民币
|
|
|
|
|
|
|
|
|
|
var usdSum_pay = 0.0;//美元合计-应付
|
|
|
|
|
var rmbSum_pay = 0.0;//人民币合计-应付
|
|
|
|
|
var otherSum_pay = 0.0;//其他币别合计-应付
|
|
|
|
|
var totalAmount_pay = 0.0//应付合计-包括除人民币以外其他币别折合成人民币
|
|
|
|
|
|
|
|
|
|
var usdGain = 0.0//美元利润
|
|
|
|
|
var rmbGain = 0.0//人民币利润
|
|
|
|
|
var otherGain = 0.0//其他币别利润
|
|
|
|
|
var totalGain = 0.0//合计利润
|
|
|
|
|
|
|
|
|
|
var gainRate = 0.0//利润比率
|
|
|
|
|
|
|
|
|
|
//计算应收费用
|
|
|
|
|
for(var i = 0;i<rowCount_recv;i++){
|
|
|
|
|
//获取Row GID
|
|
|
|
|
var rId = mygrid_recv.getRowId(i);
|
|
|
|
|
//费用名称
|
|
|
|
|
var sfeename = mygrid_recv.cellById(rId, 2);
|
|
|
|
|
sfeename = sfeename.getValue();
|
|
|
|
|
var uv = "../Shipping/feegridsource.aspx?read=isfeename&feename=" + escape(sfeename) + "&val=" + newGuid();
|
|
|
|
|
var ld = dhtmlxAjax.getSync(uv);
|
|
|
|
|
var lv = ld.xmlDoc.responseText;
|
|
|
|
|
if (lv.trim() != "0") {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//定位币别单元位置
|
|
|
|
|
var cell = mygrid_recv.cellById(rId,9);
|
|
|
|
|
//获取当前行币别类型
|
|
|
|
|
var value = cell.getValue().toLowerCase();
|
|
|
|
|
//获取总金额
|
|
|
|
|
var amount = parseFloat(ConvertToMoney(mygrid_recv.cellById(rId,8).getValue()));
|
|
|
|
|
if(amount.toString().toLowerCase() == "nan"){
|
|
|
|
|
amount = 0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var exchangeRate_recv = 0.0;//当前对应汇率比率
|
|
|
|
|
exchangeRate_recv = parseFloat(mygrid_recv.cellById(rId,10).getValue());
|
|
|
|
|
|
|
|
|
|
switch(value){
|
|
|
|
|
case "usd":
|
|
|
|
|
usdSum_recv = usdSum_recv + parseFloat(amount);
|
|
|
|
|
totalAmount_recv += (parseFloat(amount) * (exchangeRate_recv > 0 ? exchangeRate_recv : 1));
|
|
|
|
|
break;
|
|
|
|
|
case "rmb":
|
|
|
|
|
rmbSum_recv = rmbSum_recv + parseFloat(amount);
|
|
|
|
|
totalAmount_recv += parseFloat(amount);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
otherSum_recv = otherSum_recv + parseFloat(amount);
|
|
|
|
|
totalAmount_recv += (parseFloat(amount) * (exchangeRate_recv > 0 ? exchangeRate_recv : 1));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$("dvUSRecvVal").innerHTML = outputMoney(usdSum_recv.toString());
|
|
|
|
|
$("dvRecvRMBVal").innerHTML = outputMoney(rmbSum_recv.toString());
|
|
|
|
|
$("dvOtherCurrencyRecvVal").innerHTML = outputMoney(otherSum_recv.toString());
|
|
|
|
|
$("dvRecvTotalVal").innerHTML = outputMoney(totalAmount_recv.toString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取应付费用列表行数
|
|
|
|
|
var rowCount_pay = mygrid_pay.getRowsNum();
|
|
|
|
|
//计算应收费用
|
|
|
|
|
for(var j = 0;j<rowCount_pay;j++){
|
|
|
|
|
//获取Row GID
|
|
|
|
|
var rowID = mygrid_pay.getRowId(j);
|
|
|
|
|
//费用名称
|
|
|
|
|
var sfeename = mygrid_pay.cellById(rowID, 2);
|
|
|
|
|
sfeename = sfeename.getValue();
|
|
|
|
|
var uv = "../Shipping/feegridsource.aspx?read=isfeename&feename=" + escape(sfeename) + "&val=" + newGuid();
|
|
|
|
|
var ld = dhtmlxAjax.getSync(uv);
|
|
|
|
|
var lv = ld.xmlDoc.responseText;
|
|
|
|
|
if (lv.trim() != "0") {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//定位币别单元位置
|
|
|
|
|
var cell_pay = mygrid_pay.cellById(rowID,9);
|
|
|
|
|
//获取当前行币别类型
|
|
|
|
|
var pay_value = cell_pay.getValue().toLowerCase();
|
|
|
|
|
//获取总金额
|
|
|
|
|
var amount = parseFloat(ConvertToMoney(mygrid_pay.cellById(rowID,8).getValue()));
|
|
|
|
|
if(amount.toString().toLowerCase() == "nan"){
|
|
|
|
|
amount = 0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var exchangeRate_pay = 0.0;//当前对应汇率比率
|
|
|
|
|
exchangeRate_pay = parseFloat(mygrid_pay.cellById(rowID,10).getValue());
|
|
|
|
|
|
|
|
|
|
switch(pay_value){
|
|
|
|
|
case "usd":
|
|
|
|
|
usdSum_pay += parseFloat(amount);
|
|
|
|
|
totalAmount_pay += (parseFloat(amount) * (exchangeRate_pay > 0 ? exchangeRate_pay : 1));
|
|
|
|
|
break;
|
|
|
|
|
case "rmb":
|
|
|
|
|
rmbSum_pay += parseFloat(amount);
|
|
|
|
|
totalAmount_pay += parseFloat(amount);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
otherSum_pay += parseFloat(amount);
|
|
|
|
|
totalAmount_pay += (parseFloat(amount) * (exchangeRate_pay > 0 ? exchangeRate_pay : 1));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//alert(usdSum_pay);alert(rmbSum_pay);alert(otherSum_pay);alert(totalAmount_pay);
|
|
|
|
|
$("dvUSPayVal").innerHTML = outputMoney(usdSum_pay.toString());
|
|
|
|
|
$("dvPayRMBVal").innerHTML = outputMoney(rmbSum_pay.toString());
|
|
|
|
|
$("dvOtherCurrencyPayVal").innerHTML = outputMoney(otherSum_pay.toString());
|
|
|
|
|
$("dvPaySumVal").innerHTML = outputMoney(totalAmount_pay.toString());
|
|
|
|
|
|
|
|
|
|
//计算利润
|
|
|
|
|
usdGain = usdSum_recv - usdSum_pay;//美元利润
|
|
|
|
|
rmbGain = rmbSum_recv - rmbSum_pay;//人民币利润
|
|
|
|
|
otherGain = otherSum_recv - otherSum_pay;//其他币别利润
|
|
|
|
|
totalGain = totalAmount_recv - totalAmount_pay;//利润合计
|
|
|
|
|
|
|
|
|
|
$("dvUSProfitVal").innerHTML = outputMoney(usdGain.toString());
|
|
|
|
|
if(usdGain < 0 || usdGain == 0){
|
|
|
|
|
$("dvUSProfitVal").style.color = "#007F00";
|
|
|
|
|
}
|
|
|
|
|
$("dvRMBProfitVal").innerHTML = outputMoney(rmbGain.toString());
|
|
|
|
|
if(rmbGain < 0 || rmbGain == 0){
|
|
|
|
|
$("dvRMBProfitVal").style.color = "#007F00";
|
|
|
|
|
}
|
|
|
|
|
$("dvOtherCurrencyProfitVal").innerHTML = outputMoney(otherGain.toString());
|
|
|
|
|
if(otherGain < 0 || otherGain == 0){
|
|
|
|
|
$("dvOtherCurrencyProfitVal").style.color = '#007F00';
|
|
|
|
|
}
|
|
|
|
|
$("dvProfitTotalVal").innerHTML = outputMoney(totalGain.toString());
|
|
|
|
|
if(totalGain < 0 || totalGain == 0){
|
|
|
|
|
$("dvProfitTotalVal").style.color = "#007F00";
|
|
|
|
|
}
|
|
|
|
|
if(totalAmount_recv == 0){
|
|
|
|
|
$("dvProfitRateVal").innerHTML = "0%";
|
|
|
|
|
$("dvProfitRateVal").style.color = "#007F00";
|
|
|
|
|
}else{
|
|
|
|
|
//利润合计除以应付费用
|
|
|
|
|
gainRate = (totalGain / totalAmount_recv) * 100;
|
|
|
|
|
|
|
|
|
|
var percentage = gainRate.toFixed(2);
|
|
|
|
|
$("dvProfitRateVal").innerHTML = percentage.toString() + "%";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function amountSum(gridName){
|
|
|
|
|
if(gridName == "recv"){
|
|
|
|
|
//计算应收
|
|
|
|
|
mygrid_recv
|
|
|
|
|
}else{
|
|
|
|
|
//计算应付
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function outputMoney(number) {
|
|
|
|
|
number= number.replace(/\,/g,"");
|
|
|
|
|
if (isNaN(number)||number=="") return "";
|
|
|
|
|
number = Math.round( number*100) /100;
|
|
|
|
|
if(number<0)
|
|
|
|
|
return '-'+outputDollars(Math.floor(Math.abs(number)-0) + '') + outputCents(Math.abs(number) - 0);
|
|
|
|
|
else
|
|
|
|
|
return outputDollars(Math.floor(number-0) + '') + outputCents(number - 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function outputDollars(number)
|
|
|
|
|
{
|
|
|
|
|
if (number.length<= 3)
|
|
|
|
|
return (number == '' ? '0' : number);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var mod = number.length%3;
|
|
|
|
|
var output = (mod == 0 ? '' : (number.substring(0,mod)));
|
|
|
|
|
for (i=0 ; i< Math.floor(number.length/3) ; i++)
|
|
|
|
|
{
|
|
|
|
|
if ((mod ==0) && (i ==0))
|
|
|
|
|
output+= number.substring(mod+3*i,mod+3*i+3);
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
output+= ',' + number.substring(mod+3*i,mod+3*i+3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (output);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function outputCents(amount)
|
|
|
|
|
{
|
|
|
|
|
amount = Math.round( ( (amount) - Math.floor(amount) ) *100);
|
|
|
|
|
return (amount<10 ? '.0' + amount : '.' + amount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取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 dialog() {
|
|
|
|
|
this.width = 450;
|
|
|
|
|
this.height = 360;
|
|
|
|
|
this.title_height = 20;
|
|
|
|
|
this.html = '';
|
|
|
|
|
this.title = '';
|
|
|
|
|
var self = this;
|
|
|
|
|
var bgObj, msgObj, titleObj;
|
|
|
|
|
this.close = function () {
|
|
|
|
|
document.body.removeChild(document.getElementById("bgDiv"));
|
|
|
|
|
document.getElementById("msgDiv").removeChild(document.getElementById("msgTitle"));
|
|
|
|
|
document.body.removeChild(document.getElementById("msgDiv"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.show = function () {
|
|
|
|
|
var msgw, msgh, bordercolor;
|
|
|
|
|
msgw = self.width;
|
|
|
|
|
msgh = self.height;
|
|
|
|
|
bordercolor = "#336699";
|
|
|
|
|
titlecolor = "#99CCFF";
|
|
|
|
|
|
|
|
|
|
var sWidth, sHeight;
|
|
|
|
|
sWidth = document.body.offsetWidth;
|
|
|
|
|
sHeight = screen.height;
|
|
|
|
|
bgObj = document.createElement("div");
|
|
|
|
|
bgObj.setAttribute('id', 'bgDiv');
|
|
|
|
|
bgObj.style.position = "absolute";
|
|
|
|
|
bgObj.style.top = "0";
|
|
|
|
|
bgObj.style.background = "#777";
|
|
|
|
|
bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
|
|
|
|
|
bgObj.style.opacity = "0.6";
|
|
|
|
|
bgObj.style.left = "0";
|
|
|
|
|
bgObj.style.width = sWidth + "px";
|
|
|
|
|
bgObj.style.height = sHeight + "px";
|
|
|
|
|
bgObj.style.zIndex = "10000";
|
|
|
|
|
document.body.appendChild(bgObj);
|
|
|
|
|
|
|
|
|
|
msgObj = document.createElement("div")
|
|
|
|
|
msgObj.setAttribute("id", "msgDiv");
|
|
|
|
|
msgObj.setAttribute("align", "center");
|
|
|
|
|
msgObj.style.background = "white";
|
|
|
|
|
msgObj.style.border = "1px solid " + bordercolor;
|
|
|
|
|
msgObj.style.position = "absolute";
|
|
|
|
|
msgObj.style.left = "50%";
|
|
|
|
|
msgObj.style.top = "30%";
|
|
|
|
|
msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
|
|
|
|
|
msgObj.style.marginLeft = "-225px";
|
|
|
|
|
msgObj.style.marginTop = -75 + document.documentElement.scrollTop + "px";
|
|
|
|
|
msgObj.style.width = msgw + "px";
|
|
|
|
|
msgObj.style.height = msgh + "px";
|
|
|
|
|
msgObj.style.textAlign = "center";
|
|
|
|
|
msgObj.style.lineHeight = "25px";
|
|
|
|
|
msgObj.style.zIndex = "10001";
|
|
|
|
|
|
|
|
|
|
titleObj = document.createElement("h4");
|
|
|
|
|
titleObj.setAttribute("id", "msgTitle");
|
|
|
|
|
titleObj.setAttribute("align", "center");
|
|
|
|
|
titleObj.style.margin = "0";
|
|
|
|
|
titleObj.style.padding = "3px";
|
|
|
|
|
titleObj.style.background = bordercolor;
|
|
|
|
|
titleObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
|
|
|
|
|
titleObj.style.opacity = "0.75";
|
|
|
|
|
titleObj.style.border = "1px solid " + bordercolor;
|
|
|
|
|
titleObj.style.height = self.title_height + "px";
|
|
|
|
|
titleObj.style.font = "12px Verdana, Geneva, Arial, Helvetica, sans-serif";
|
|
|
|
|
titleObj.style.color = "white";
|
|
|
|
|
titleObj.style.cursor = "pointer";
|
|
|
|
|
titleObj.innerHTML = self.title;
|
|
|
|
|
//titleObj.onclick=function(){self.close();}
|
|
|
|
|
document.body.appendChild(msgObj);
|
|
|
|
|
document.getElementById("msgDiv").appendChild(titleObj);
|
|
|
|
|
var txt = document.createElement("div");
|
|
|
|
|
txt.style.margin = "1em 0"
|
|
|
|
|
txt.setAttribute("id", "msgTxt");
|
|
|
|
|
txt.innerHTML = self.html;
|
|
|
|
|
document.getElementById("msgDiv").appendChild(txt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function msgBox() {
|
|
|
|
|
var dg = new dialog();
|
|
|
|
|
dg.html = "程序正在提交,请稍等!";
|
|
|
|
|
//dg.html+="<input type=button onclick='new dialog().close();' value='确定'>";
|
|
|
|
|
dg.width = 200;
|
|
|
|
|
dg.height = 100;
|
|
|
|
|
dg.title = "标题";
|
|
|
|
|
dg.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//是否为数字
|
|
|
|
|
function IsNum(val){
|
|
|
|
|
var re = /^[-\+]?\d+(\.\d+)?$/;
|
|
|
|
|
if (!re.test(val)){
|
|
|
|
|
return false;
|
|
|
|
|
}else{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ConvertToMoney(strObj){
|
|
|
|
|
var result = strObj.replace(",","");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function GetGainArg(){
|
|
|
|
|
var gainArg = new Array();
|
|
|
|
|
|
|
|
|
|
gainArg.push(ConvertToMoney($("dvRecvRMBVal").innerHTML));
|
|
|
|
|
gainArg.push(ConvertToMoney($("dvUSRecvVal").innerHTML));
|
|
|
|
|
gainArg.push(ConvertToMoney($("dvOtherCurrencyRecvVal").innerHTML));
|
|
|
|
|
|
|
|
|
|
gainArg.push(ConvertToMoney($("dvPayRMBVal").innerHTML));
|
|
|
|
|
gainArg.push(ConvertToMoney($("dvUSPayVal").innerHTML));
|
|
|
|
|
gainArg.push(ConvertToMoney($("dvOtherCurrencyPayVal").innerHTML));
|
|
|
|
|
|
|
|
|
|
gainArg.push(ConvertToMoney($("dvRecvTotalVal").innerHTML));
|
|
|
|
|
gainArg.push(ConvertToMoney($("dvPaySumVal").innerHTML));
|
|
|
|
|
|
|
|
|
|
gainArg.push(ConvertToMoney($("dvRMBProfitVal").innerHTML));
|
|
|
|
|
gainArg.push(ConvertToMoney($("dvUSProfitVal").innerHTML));
|
|
|
|
|
gainArg.push(ConvertToMoney($("dvOtherCurrencyProfitVal").innerHTML));
|
|
|
|
|
|
|
|
|
|
gainArg.push(ConvertToMoney($("dvProfitTotalVal").innerHTML));
|
|
|
|
|
gainArg.push($("dvProfitRateVal").innerHTML);
|
|
|
|
|
|
|
|
|
|
$("gainContainer").value = gainArg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function filterComboCustomerPress(gridObj,rowID,rowIndex,colIndex,filterVal,oldVal){
|
|
|
|
|
var combo = gridObj.getCustomCombo(rowID,colIndex);
|
|
|
|
|
|
|
|
|
|
var comboArg = combo.getKeys();
|
|
|
|
|
|
|
|
|
|
var doCount = 0;
|
|
|
|
|
for(var i = 0;i<comboArg.length;i++){
|
|
|
|
|
|
|
|
|
|
if(combo.get(comboArg[i]).toUpperCase().trim().indexOf(filterVal.toUpperCase()) == 0){
|
|
|
|
|
//alert(combo.get(comboArg[i]).toUpperCase().trim());
|
|
|
|
|
//gridObj.cellByIndex(rowIndex,colIndex).setValue(comboArg[i]);
|
|
|
|
|
gridObj.cellByIndex(rowIndex,colIndex).setValue(combo.get(comboArg[i]));
|
|
|
|
|
|
|
|
|
|
//combo.selectOption(3,true,true);
|
|
|
|
|
|
|
|
|
|
//gridObj.editStop();
|
|
|
|
|
|
|
|
|
|
gridObj.selectCell(rowIndex,colIndex,true,true,true,true);
|
|
|
|
|
doCount = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if(doCount == 0){
|
|
|
|
|
// gridObj.cellByIndex(rowIndex,colIndex).setValue(oldVal);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//两端去空格函数
|
|
|
|
|
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
|
|
|
|
|
|
|
|
|
|
function orderRecvAudit(){
|
|
|
|
|
var iSuccess = 0;
|
|
|
|
|
var iFailure = 0;
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(newFeePayCount > 0 || changeFeePayCount > 0){
|
|
|
|
|
alert("应付费用未保存,请先保存应付费用");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_recv.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_recv.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_recv.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_recv.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
if(feeState != "录入状态"){
|
|
|
|
|
alert("只能提交录入状态的应收费用进行审核");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(iCount > 0){
|
|
|
|
|
if(recvArg.length > 0){
|
|
|
|
|
if(window.confirm("您确定将所选应收费用提交审核")){
|
|
|
|
|
var delCount = 0;
|
|
|
|
|
var loadVal = 0;
|
|
|
|
|
while(delCount < recvArg.length){
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(recvArg[delCount]);
|
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var cusName = mygrid_recv.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
var urlVal = "../AuditProcess/AuditService.aspx?handle=audit&oplb=op_Seae&id=" + recvArg[delCount] + "&val=" + newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
if(loadVal > 0){
|
|
|
|
|
iSuccess++;
|
|
|
|
|
}else{
|
|
|
|
|
iFailure++;
|
|
|
|
|
}
|
|
|
|
|
delCount++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (delCount > 0) {
|
|
|
|
|
if (loadVal != 10 && loadVal > 0) {
|
|
|
|
|
//向审核人发送申请消息
|
|
|
|
|
var postUrlVal = "../message/messageservice.aspx?billno=" + postBillNO + "&type=1&oplb=" + stroplb + "&handle=postmessage" + "&uid=" + newGuid(); ;
|
|
|
|
|
var loader = dhtmlxAjax.getSync(postUrlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
}
|
|
|
|
|
alert("提交应收费用审核 " + delCount + " 条 成功 " + iSuccess + " 条 失败 " + iFailure + " 条");
|
|
|
|
|
}
|
|
|
|
|
doInitRecvGrid();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("未选中要操作的费用项");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,费用不能添加");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function orderPayAudit(){
|
|
|
|
|
var iSuccess = 0;
|
|
|
|
|
var iFailure = 0;
|
|
|
|
|
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(newFeeRecvCount > 0 || changeFeeRecvCount > 0){
|
|
|
|
|
alert("应收费用未保存,请先将应收费用保存,提交应付费用-提交审核");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_pay.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_pay.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_pay.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_pay.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
if(feeState != "录入状态"){
|
|
|
|
|
alert("只能提交录入状态的应付费用进行审核");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(iCount > 0){
|
|
|
|
|
if(recvArg.length > 0){
|
|
|
|
|
if(window.confirm("您确定将所选应付费用提交审核")){
|
|
|
|
|
var delCount = 0;
|
|
|
|
|
var loadVal = 0;
|
|
|
|
|
while(delCount < recvArg.length){
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(recvArg[delCount]);
|
|
|
|
|
var feeName = mygrid_pay.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var cusName = mygrid_pay.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
var urlVal = "../AuditProcess/AuditService.aspx?handle=audit&oplb=op_Seae&id="+recvArg[delCount]+"&val="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
|
|
|
|
|
if(loadVal > 0){
|
|
|
|
|
iSuccess++;
|
|
|
|
|
}else{
|
|
|
|
|
iFailure++;
|
|
|
|
|
}
|
|
|
|
|
delCount++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (delCount > 0) {
|
|
|
|
|
if (loadVal != 10 && loadVal > 0) {
|
|
|
|
|
//向审核人发送申请消息
|
|
|
|
|
var postUrlVal = "../message/messageservice.aspx?billno=" + postBillNO + "&type=1&oplb=" + stroplb + "&handle=postmessage" + "&uid=" + newGuid(); ;
|
|
|
|
|
var loader = dhtmlxAjax.getSync(postUrlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
}
|
|
|
|
|
alert("提交应收费用审核 " + delCount + " 条 成功 " + iSuccess + " 条 失败 " + iFailure + " 条");
|
|
|
|
|
}
|
|
|
|
|
doInitPayGrid();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("未选中要操作的费用项");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,费用不能添加");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function orderRecvModify(){
|
|
|
|
|
var iSuccess = 0;
|
|
|
|
|
var iFailure = 0;
|
|
|
|
|
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
if(newFeePayCount > 0 || changeFeePayCount > 0){
|
|
|
|
|
alert("应付费用未保存,先保存应付费用再进行应收费用--申请修改");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_recv.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_recv.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_recv.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_recv.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
if(feeState == "申请修改"){
|
|
|
|
|
alert("不能重复申请修改,如要查看申请信息请点-历史申请-查看");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(feeState == "申请删除"){
|
|
|
|
|
alert("不能申请删除,如要查看申请信息请点-历史申请-查看");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(feeState == "录入状态"){
|
|
|
|
|
alert("录入状态-不能申请修改");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(iCount == 1){
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(recvArg[0]);
|
|
|
|
|
var statusName = mygrid_recv.cellByIndex(rowIndex,1).getValue();
|
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var cusName = mygrid_recv.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
if(window.confirm("您确定要将 应收费用("+feeName+") 提交申请修改")){
|
|
|
|
|
var openUrl = "FeeModify.aspx?id="+recvArg[0]+"&oplb=op_Seae&type=1&bsno="+bsno+"&handle=1";
|
|
|
|
|
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 if(iCount > 1){
|
|
|
|
|
alert("每次只能申请修改一条费用信息");
|
|
|
|
|
}else{
|
|
|
|
|
alert("未选中要操作的费用项");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,费用不能添加");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function orderPayModify(){
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
if(newFeeRecvCount > 0 || changeFeeRecvCount > 0){
|
|
|
|
|
alert("应收费用未保存,请先将应收费用保存,再提交应付费用-申请修改");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_pay.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_pay.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_pay.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_pay.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
if(feeState == "申请修改"){
|
|
|
|
|
alert("不能重复申请修改,如要查看申请信息请点-历史申请-查看");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(feeState == "申请删除"){
|
|
|
|
|
alert("不能申请删除,如要查看申请信息请点-历史申请-查看");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(feeState == "录入状态"){
|
|
|
|
|
alert("录入状态-不能申请修改");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(iCount == 1){
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(recvArg[0]);
|
|
|
|
|
var statusName = mygrid_pay.cellByIndex(rowIndex,1).getValue();
|
|
|
|
|
var feeName = mygrid_pay.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var cusName = mygrid_pay.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
if(window.confirm("您确定要将 应付费用("+feeName+") 提交申请修改")){
|
|
|
|
|
var openUrl = "FeeModify.aspx?id="+recvArg[0]+"&oplb=op_Seae&type=2&bsno="+bsno+"&handle=1";
|
|
|
|
|
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 if(iCount > 1){
|
|
|
|
|
alert("每次只能申请修改一条费用信息");
|
|
|
|
|
}else{
|
|
|
|
|
alert("未选中要操作的费用项");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,费用不能添加");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function orderRecvDelete(){
|
|
|
|
|
var iSuccess = 0;
|
|
|
|
|
var iFailure = 0;
|
|
|
|
|
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
if(newFeePayCount > 0 || changeFeePayCount > 0){
|
|
|
|
|
alert("应付费用未保存,先保存应付费用再进行应收费用-申请删除操作");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_recv.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_recv.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_recv.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_recv.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
if(feeState == "录入状态"){
|
|
|
|
|
alert("只能提交录入状态的应收费用进行审核");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(feeState == "申请修改"){
|
|
|
|
|
alert("申请修改-不能申请删除");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(iCount == 1){
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(recvArg[0]);
|
|
|
|
|
var statusName = mygrid_recv.cellByIndex(rowIndex,1).getValue();
|
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var cusName = mygrid_recv.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
if(window.confirm("您确定要将 应收费用("+feeName+") 提交申请删除")){
|
|
|
|
|
|
|
|
|
|
var openUrl = "FeeDelete.aspx?id="+recvArg[0]+"&handle=1&type=1";
|
|
|
|
|
window.open (openUrl, "_blank", "height=100, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-100)/2 + ",Left= "+(screen.width-400)/2);
|
|
|
|
|
}
|
|
|
|
|
}else if(iCount > 1){
|
|
|
|
|
alert("每次只能申请删除一条费用信息");
|
|
|
|
|
}else{
|
|
|
|
|
alert("未选中要操作的费用项");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,费用不能添加");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function orderPayDelete(){
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
if(newFeeRecvCount > 0 || changeFeeRecvCount > 0){
|
|
|
|
|
alert("应收费用未保存,请先将应收费用保存,再提交应付费用-申请删除");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_recv.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_recv.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_recv.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_recv.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
if(feeState == "录入状态"){
|
|
|
|
|
alert("只能提交录入状态的应收费用进行审核");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(feeState == "申请修改"){
|
|
|
|
|
alert("申请修改-不能申请删除");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(iCount == 1){
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(recvArg[0]);
|
|
|
|
|
var statusName = mygrid_recv.cellByIndex(rowIndex,1).getValue();
|
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var cusName = mygrid_recv.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
if(window.confirm("您确定要将 应付费用("+feeName+") 提交申请删除")){
|
|
|
|
|
|
|
|
|
|
var openUrl = "FeeDelete.aspx?id="+recvArg[0]+"&handle=1&type=2";
|
|
|
|
|
window.open (openUrl, "_blank", "height=100, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-100)/2 + ",Left= "+(screen.width-400)/2);
|
|
|
|
|
}
|
|
|
|
|
}else if(iCount > 1){
|
|
|
|
|
alert("每次只能申请删除一条费用信息");
|
|
|
|
|
}else{
|
|
|
|
|
alert("未选中要操作的费用项");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,费用不能添加");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function applyRecvHistory(){
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// if(newFeePayCount > 0 || changeFeePayCount > 0){
|
|
|
|
|
// alert("应收费用未保存,请先将应收费用保存,再查看历史申请");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_recv.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_recv.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_recv.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_recv.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(iCount == 1){
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(recvArg[0]);
|
|
|
|
|
|
|
|
|
|
var status = mygrid_recv.cellByIndex(rowIndex,1).getValue();
|
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var cusName = mygrid_recv.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
var bsno = $("h_bsno").value;
|
|
|
|
|
if(status.trim() == "申请修改" || status.trim() == "驳回申请" || status.trim() == "申请通过"){
|
|
|
|
|
var openUrl = "FeeModify.aspx?id="+recvArg[0]+"&oplb=op_Seae&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_Seae&id="+recvArg[0]+"&val="+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_Seae&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(){
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_pay.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_pay.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_pay.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_pay.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(iCount == 1){
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(recvArg[0]);
|
|
|
|
|
|
|
|
|
|
var status = mygrid_pay.cellByIndex(rowIndex,1).getValue();
|
|
|
|
|
var feeName = mygrid_pay.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var cusName = mygrid_pay.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
var bsno = $("h_bsno").value;
|
|
|
|
|
if(status.trim() == "申请修改" || status.trim() == "驳回申请" || status.trim() == "申请通过"){
|
|
|
|
|
var openUrl = "FeeModify.aspx?id="+recvArg[0]+"&oplb=op_Seae&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_Seae&id="+recvArg[0]+"&val="+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_Seae&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 ReShowLabel(gridObj){
|
|
|
|
|
var columnCount = gridObj.getColumnsNum();
|
|
|
|
|
var rowCount = gridObj.getRowsNum();
|
|
|
|
|
|
|
|
|
|
if(rowCount > 0){
|
|
|
|
|
for(var i = 0;i<rowCount;i++){
|
|
|
|
|
for(var j = 0;j<columnCount;j++){
|
|
|
|
|
if(j == 2 || j == 3){
|
|
|
|
|
var cellCurVal = gridObj.cellByIndex(i,j).getValue();
|
|
|
|
|
gridObj.cellByIndex(i,j).setLabel(cellCurVal);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ReShowLabelForEnter(gridObj){
|
|
|
|
|
var columnCount = gridObj.getColumnsNum();
|
|
|
|
|
var rowCount = gridObj.getRowsNum();
|
|
|
|
|
|
|
|
|
|
if(rowCount > 0){
|
|
|
|
|
for(var i = 0;i<rowCount;i++){
|
|
|
|
|
for(var j = 0;j<columnCount;j++){
|
|
|
|
|
if(j == 3){
|
|
|
|
|
var cellCurVal = gridObj.cellByIndex(i,j).getValue();
|
|
|
|
|
gridObj.cellByIndex(i,j).setLabel(cellCurVal);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function clearNoNum(valObj)
|
|
|
|
|
{
|
|
|
|
|
//先把非数字的都替换掉,除了数字和.
|
|
|
|
|
valObj = valObj.replace(/[^\d.|-]/g,"");
|
|
|
|
|
//必须保证第一个为数字而不是.
|
|
|
|
|
valObj = valObj.replace(/^\./g,"");
|
|
|
|
|
//保证只有出现一个.而没有多个.
|
|
|
|
|
valObj = valObj.replace(/\.{2,}/g,".");
|
|
|
|
|
valObj = valObj.replace(/\-{2,}/g,"-");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保证.只出现一次,而不能出现两次以上
|
|
|
|
|
valObj = valObj.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
|
|
|
|
|
|
|
|
|
|
if(valObj.lastIndexOf("-") > 0){
|
|
|
|
|
if(valObj.indexOf("-") == 0){alert(222);
|
|
|
|
|
valObj = "-"+valObj.replace(/-/g,"");
|
|
|
|
|
}else{
|
|
|
|
|
valObj = valObj.replace(/-/g,"");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return valObj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 "审核通过":
|
|
|
|
|
gridObj.setRowColor(rowId,"#7FDF00");
|
|
|
|
|
break;
|
|
|
|
|
case "提交审核":
|
|
|
|
|
case "申请修改":
|
|
|
|
|
gridObj.setRowColor(rowId,"#ebf48a");
|
|
|
|
|
break;
|
|
|
|
|
case "驳回申请":
|
|
|
|
|
gridObj.setRowColor(rowId,"#f53939");
|
|
|
|
|
break;
|
|
|
|
|
case "申请删除":
|
|
|
|
|
gridObj.setRowColor(rowId,"#9f9e9e");
|
|
|
|
|
break;
|
|
|
|
|
case "驳回提交":
|
|
|
|
|
gridObj.setRowColor(rowId,"#f53939");
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//刷新应收
|
|
|
|
|
function refreshRecv(){
|
|
|
|
|
if(newFeeRecvCount > 0 || changeFeeRecvCount > 0){
|
|
|
|
|
if(window.confirm("应收费用未保存,您确定要刷新应收费用列表,刷新后自动放弃未保存内容")){
|
|
|
|
|
doInitRecvGrid();
|
|
|
|
|
newFeeRecvCount = 0;
|
|
|
|
|
changeFeeRecvCount = 0;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
doInitRecvGrid();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//刷新应付
|
|
|
|
|
function refreshPay(){
|
|
|
|
|
if(newFeePayCount > 0 || changeFeePayCount > 0){
|
|
|
|
|
if(window.confirm("应付费用未保存,您确定要刷新应付费用列表,刷新后自动放弃未保存内容")){
|
|
|
|
|
doInitPayGrid();
|
|
|
|
|
newFeePayCount = 0;
|
|
|
|
|
changeFeePayCount = 0;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
doInitPayGrid();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function checkRecvHistory(){
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_recv.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_recv.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_recv.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_recv.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(iCount > 1){
|
|
|
|
|
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 = "FeeHistory.aspx?bsno="+strBSNO+"&type=1";
|
|
|
|
|
window.open (openUrl,openType,openSet);
|
|
|
|
|
}else{
|
|
|
|
|
alert("未选中要操作的费用项");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function checkPayHistory(){
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var recvArg = new Array();
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<mygrid_pay.getRowsNum();i++){
|
|
|
|
|
var checkState = mygrid_pay.cellByIndex(i,0).getValue();
|
|
|
|
|
var feeState = mygrid_pay.cellByIndex(i,1).getValue();
|
|
|
|
|
var rowID = mygrid_pay.getRowId(i);
|
|
|
|
|
if(checkState == 1){
|
|
|
|
|
recvArg.push(rowID);
|
|
|
|
|
iCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(iCount == 1){
|
|
|
|
|
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 = "FeeHistory.aspx?bsno="+strBSNO+"&type=2";
|
|
|
|
|
window.open (openUrl,openType,openSet);
|
|
|
|
|
}else{
|
|
|
|
|
alert("未选中要操作的费用项");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function importRecvTemplate(){
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
if(newFeePayCount > 0 || changeFeePayCount > 0){
|
|
|
|
|
alert("应付费用未保存,先保存应付费用,再操作应收费用-引入费用模板");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var openSet = "height=700, width=1000, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=10,Left= " + (screen.width - 900) / 2;
|
|
|
|
|
var openType = "_blank";
|
|
|
|
|
|
|
|
|
|
var openUrl = "ImportFeeTemplate.aspx?handle=import&type=1";
|
|
|
|
|
window.open (openUrl,openType,openSet);
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,不能引入费用");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function importPayTemplate(){
|
|
|
|
|
if(parseInt($("h_authority").value) <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
// var urlVal = "FeeService.aspx?bsno="+bsno+"&handle=checkopstatus"+"&uid="+newGuid();;
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
// var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var opStatus = 1;//parseInt(loadVal);
|
|
|
|
|
if(opStatus == 1){
|
|
|
|
|
if(newFeeRecvCount > 0 || changeFeeRecvCount > 0){
|
|
|
|
|
alert("应收费用未保存,先保存应收费用,再操作应付费用-引入费用模板");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var openSet = "height=700, width=1000, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=10,Left= " + (screen.width - 900) / 2;
|
|
|
|
|
var openType = "_blank";
|
|
|
|
|
|
|
|
|
|
var openUrl = "ImportFeeTemplate.aspx?handle=import&type=2";
|
|
|
|
|
window.open (openUrl,openType,openSet);
|
|
|
|
|
}else{
|
|
|
|
|
alert("委托已退载,不能引入费用");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var isIe=(document.all)?true:false;
|
|
|
|
|
//设置select的可见状态
|
|
|
|
|
function setSelectState(state){
|
|
|
|
|
var objl=document.getElementsByTagName('select');
|
|
|
|
|
for(var i=0;i<objl.length;i++)
|
|
|
|
|
{
|
|
|
|
|
objl[i].style.visibility=state;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mousePosition(ev){
|
|
|
|
|
if(ev.pageX || ev.pageY)
|
|
|
|
|
{
|
|
|
|
|
return {x:ev.pageX, y:ev.pageY};
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,y:ev.clientY + document.body.scrollTop - document.body.clientTop
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
//弹出方法
|
|
|
|
|
function showMessageBox(wTitle,content,pos,wWidth){
|
|
|
|
|
closeWindow();
|
|
|
|
|
var bWidth=parseInt(document.documentElement.scrollWidth);
|
|
|
|
|
var bHeight=parseInt(document.documentElement.scrollHeight);
|
|
|
|
|
if(isIe){
|
|
|
|
|
setSelectState('hidden');}
|
|
|
|
|
var back=document.createElement("div");
|
|
|
|
|
back.id="back";
|
|
|
|
|
var styleStr="top:0px;left:0px;position:absolute;background:#666;width:"+bWidth+"px;height:"+bHeight+"px;";
|
|
|
|
|
styleStr+=(isIe)?"filter:alpha(opacity=0);":"opacity:0;";
|
|
|
|
|
back.style.cssText=styleStr;
|
|
|
|
|
document.body.appendChild(back);
|
|
|
|
|
showBackground(back,50);
|
|
|
|
|
var mesW=document.createElement("div");
|
|
|
|
|
mesW.id="mesWindow";
|
|
|
|
|
mesW.className="mesWindow";
|
|
|
|
|
mesW.innerHTML = "<div class='mesWindowTop'><table width='100%' height='100%'><tr><td>"+wTitle+"</td><td style='width:1px;'>"
|
|
|
|
|
+ "<input type='button' onclick='closeWindow();' title='关闭窗口' class='close' value='关闭' style='width:60px;'/></td></tr></table></div>"
|
|
|
|
|
+ "<div class='mesWindowContent' id='mesWindowContent'>"+content+"</div><div class='mesWindowBottom'></div>";
|
|
|
|
|
var v_top=(document.body.clientHeight-mesW.clientHeight)/2;
|
|
|
|
|
v_top+=document.documentElement.scrollTop;
|
|
|
|
|
styleStr="top:"+(v_top-180)+"px;left:"+(document.body.clientWidth/2-mesW.clientWidth/2)+"px;position:absolute;width:600px;margin-left:-300px;left:50%;z-index:9999;";
|
|
|
|
|
mesW.style.cssText=styleStr;
|
|
|
|
|
document.body.appendChild(mesW);
|
|
|
|
|
}
|
|
|
|
|
//让背景渐渐变暗
|
|
|
|
|
function showBackground(obj,endInt){
|
|
|
|
|
if(isIe){
|
|
|
|
|
obj.filters.alpha.opacity+=5;
|
|
|
|
|
if(obj.filters.alpha.opacity<endInt){
|
|
|
|
|
setTimeout(function(){showBackground(obj,endInt)},5);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
var al=parseFloat(obj.style.opacity);al+=0.05;
|
|
|
|
|
obj.style.opacity=al;
|
|
|
|
|
if(al<(endInt/100)){
|
|
|
|
|
setTimeout(function(){showBackground(obj,endInt)},5);}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//关闭窗口
|
|
|
|
|
function closeWindow(){
|
|
|
|
|
if(document.getElementById('back')!=null){
|
|
|
|
|
document.getElementById('back').parentNode.removeChild(document.getElementById('back'));
|
|
|
|
|
}
|
|
|
|
|
if(document.getElementById('mesWindow')!=null){
|
|
|
|
|
document.getElementById('mesWindow').parentNode.removeChild(document.getElementById('mesWindow'));
|
|
|
|
|
}
|
|
|
|
|
if(isIe){
|
|
|
|
|
setSelectState('');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//测试弹出
|
|
|
|
|
function printMessageBox(ev,type)
|
|
|
|
|
{
|
|
|
|
|
var selectCustomerOptions = "";
|
|
|
|
|
|
|
|
|
|
if(type == 1){
|
|
|
|
|
if(newFeeRecvCount > 0 || changeFeeRecvCount > 0){
|
|
|
|
|
alert("应收费用未保存,请先保存之后再打印");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var selRowID = mygrid_recv.getSelectedRowId();
|
|
|
|
|
|
|
|
|
|
if(selRowID != null){
|
|
|
|
|
var selGroup = new Array();
|
|
|
|
|
if(selRowID.indexOf(",") > 0){
|
|
|
|
|
selGroup = selRowID.split(",");
|
|
|
|
|
}else{
|
|
|
|
|
if(selRowID != null){
|
|
|
|
|
selGroup.push(selRowID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(selGroup.length > 0){
|
|
|
|
|
for(var i=0;i<selGroup.length;i++){
|
|
|
|
|
for(var j=0;mygrid_recv.getRowsNum();j++){
|
|
|
|
|
var rowID = mygrid_recv.getRowId(j);
|
|
|
|
|
|
|
|
|
|
if(rowID == selGroup[i]){
|
|
|
|
|
var customerName = mygrid_recv.cellByIndex(j,2).getValue();
|
|
|
|
|
selectCustomerOptions += "<option value=\""+customerName+"\">"+customerName+"</options>";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
for(var i=0;i<mygrid_recv.getRowsNum();i++){
|
|
|
|
|
var customerName = mygrid_recv.cellByIndex(i,2).getValue();
|
|
|
|
|
selectCustomerOptions += "<option value=\""+customerName+"\">"+customerName+"</options>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
if(newFeePayCount > 0 || changeFeePayCount > 0){
|
|
|
|
|
alert("应付费用未保存,请先保存之后再打印");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var selRowID = mygrid_pay.getSelectedRowId();
|
|
|
|
|
|
|
|
|
|
if(selRowID != null){
|
|
|
|
|
var selGroup = new Array();
|
|
|
|
|
if(selRowID.indexOf(",") > 0){
|
|
|
|
|
selGroup = selRowID.split(",");
|
|
|
|
|
}else{
|
|
|
|
|
if(selRowID != null){
|
|
|
|
|
selGroup.push(selRowID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(selGroup.length > 0){
|
|
|
|
|
for(var i=0;i<selGroup.length;i++){
|
|
|
|
|
for(var j=0;mygrid_pay.getRowsNum();j++){
|
|
|
|
|
var rowID = mygrid_pay.getRowId(j);
|
|
|
|
|
|
|
|
|
|
if(rowID == selGroup[i]){
|
|
|
|
|
var customerName = mygrid_pay.cellByIndex(j,2).getValue();
|
|
|
|
|
selectCustomerOptions += "<option value=\""+customerName+"\">"+customerName+"</options>";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
for(var i=0;i<mygrid_pay.getRowsNum();i++){
|
|
|
|
|
var customerName = mygrid_pay.cellByIndex(i,2).getValue();
|
|
|
|
|
selectCustomerOptions += "<option value=\""+customerName+"\">"+customerName+"</options>";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var objPos = mousePosition(ev);
|
|
|
|
|
messContent = "<div style=\"padding:20px 0 20px 0;text-align:center\">"
|
|
|
|
|
+"<div style=\"float:left;width:100%\"><select id=\"reportType\" onchange=\"onReportTypeChange('reportType')\"><option value=\"1\">打印应收费用报表</option><option value=\"2\">打印应付费用报表</option> "
|
|
|
|
|
+"<option value=\"3\">打印利润报表</option></select></div> "
|
|
|
|
|
// +"<div style=\"float:left;width:100%;text-align:center;display:none;\" id=\"dvGainCheck\"><div style=\"float:left\"><input type=\"radio\" id=\"ra_recv\" name=\"gain\" title=\"打印应收利润\"/>应收利润</div> "
|
|
|
|
|
// +"<div style=\"float:left\"><input type=\"radio\" id=\"ra_recv\" name=\"gain\" title=\"打印应付利润\"/>应付利润</div><div style=\"float:left\"> "
|
|
|
|
|
// +"<input type=\"radio\" id=\"ra_recv\" name=\"gain\" title=\"打印利润\"/>利润</div></div> "
|
|
|
|
|
+"<div style=\"float:left;width:100%;padding-left:80px;\"> "
|
|
|
|
|
+"<table style=\"width:350px;\"><tr><td><select id=\"sel_customer\" multiple style=\"width:150px; height:60px;\">"+selectCustomerOptions+"</select></td><td> "
|
|
|
|
|
+"<table style=\"height:60px; width:20px;\"><tr><td height=\"20px\"><div id=\"dvRemove\"><img src=\"../images/icons/edit_left.gif\" "
|
|
|
|
|
+"onmouseover=\"mouseMoveImg(this,1)\" onmouseout=\"mouseMoveImg(this,1)\" title=\"移除\" onclick=\"removeCustomer()\"/></div></td> "
|
|
|
|
|
+"</tr><tr><td height=\"20px\"><div id=\"dvAdd\"><img src=\"../images/icons/edit_right.gif\" onmouseover=\"mouseMoveImg(this,2)\" "
|
|
|
|
|
+"onmouseout=\"mouseMoveImg(this,2)\" title=\"添加\" onclick=\"addCustomer()\"/></div></td> "
|
|
|
|
|
+"</tr></table></td><td><select id=\"sel_print\" multiple style=\"width:150px; height:60px;\" class=\"select\"></select></td></tr></table></div>"
|
|
|
|
|
+"<input type=\"button\" id=\"btn_print_report\" value=\"打印\" class=\"btn\" onclick=\"printReport()\"/></div> ";
|
|
|
|
|
|
|
|
|
|
showMessageBox('费用打印',messContent,objPos,350);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function printReport(){
|
|
|
|
|
var strBSNO = "";
|
|
|
|
|
var typeName = "";
|
|
|
|
|
strBSNO = $("h_bsno").value;
|
|
|
|
|
var printUrl = "";
|
|
|
|
|
var companyID = "";
|
|
|
|
|
var typeName = "SEAOPFEE";
|
|
|
|
|
var dbSourceID = "";
|
|
|
|
|
var userID = "";
|
|
|
|
|
|
|
|
|
|
var selectObj = $("reportType");
|
|
|
|
|
var selVal = parseInt(selectObj.options[selectObj.selectedIndex].value);
|
|
|
|
|
|
|
|
|
|
var url = "";
|
|
|
|
|
var searchCustomer = "";
|
|
|
|
|
var selectedObj = $("sel_print");
|
|
|
|
|
|
|
|
|
|
for(var j=0;j<selectedObj.options.length;j++){
|
|
|
|
|
if(j == selectedObj.options.length - 1){
|
|
|
|
|
searchCustomer += "'"+selectedObj.options[j].value+"'";
|
|
|
|
|
}else{
|
|
|
|
|
searchCustomer += "'"+selectedObj.options[j].value+"',";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(selVal == 1){
|
|
|
|
|
url = "../Reports/ReportService.aspx?handle=printseaopfee&bsno="+strBSNO+"&search="+escape(searchCustomer)+"&feetype=1&val="+newGuid();
|
|
|
|
|
typeName = "SEAOPFEEDR";
|
|
|
|
|
}else if(selVal == 2){
|
|
|
|
|
url = "../Reports/ReportService.aspx?handle=printseaopfee&bsno="+strBSNO+"&search="+escape(searchCustomer)+"&feetype=2&val="+newGuid();
|
|
|
|
|
typeName = "SEAOPFEECR";
|
|
|
|
|
}else if(selVal == 3){
|
|
|
|
|
typeName = "SEAOPGAIN";
|
|
|
|
|
url = "../Reports/ReportService.aspx?handle=printseaopgain&bsno="+strBSNO+"&val="+newGuid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
var reportVal = loader.xmlDoc.responseText;
|
|
|
|
|
var reportObj = null;
|
|
|
|
|
|
|
|
|
|
if(reportVal != ""){
|
|
|
|
|
reportObj = eval('(' + reportVal + ')');
|
|
|
|
|
if(reportObj.reports.length > 0){
|
|
|
|
|
if(reportObj.reports[0].compid != ""){
|
|
|
|
|
companyID = reportObj.reports[0].compid;
|
|
|
|
|
}
|
|
|
|
|
if(reportObj.reports[0].sourceid != ""){
|
|
|
|
|
dbSourceID = reportObj.reports[0].sourceid;
|
|
|
|
|
}
|
|
|
|
|
if(reportObj.reports[0].compid != ""){
|
|
|
|
|
userID = reportObj.reports[0].userid;
|
|
|
|
|
}
|
|
|
|
|
printUrl = "print://?comp="+companyID+"&type="+typeName+"&dbid="+dbSourceID+"&uid="+userID;//alert(printUrl);
|
|
|
|
|
window.location.href = window.location.href;
|
|
|
|
|
location.href = printUrl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
alert("没有要打印的报表");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function onReportTypeChange(id){
|
|
|
|
|
var selectObj = $(id);
|
|
|
|
|
|
|
|
|
|
var selVal = parseInt(selectObj.options[selectObj.selectedIndex].value);
|
|
|
|
|
|
|
|
|
|
if(selVal == 3){
|
|
|
|
|
$("sel_customer").disabled = 1;
|
|
|
|
|
$("sel_print").disabled = 1;
|
|
|
|
|
$("dvRemove").disabled = 1;
|
|
|
|
|
$("dvAdd").disabled = 1;
|
|
|
|
|
}
|
|
|
|
|
pageShowCount = selVal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mouseMoveImg(obj,type){
|
|
|
|
|
var imgUrl = obj.src;
|
|
|
|
|
var urlArg = imgUrl.split("/");
|
|
|
|
|
|
|
|
|
|
if(type == 1){
|
|
|
|
|
if(urlArg[urlArg.length-1] == "edit_left.gif"){
|
|
|
|
|
var newUrl = "";
|
|
|
|
|
for(var i=0;i<urlArg.length;i++){
|
|
|
|
|
if(i == urlArg.length - 1){
|
|
|
|
|
newUrl += "edit_lefthover.gif";
|
|
|
|
|
}else{
|
|
|
|
|
newUrl += urlArg[i]+"/";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
obj.src = newUrl;
|
|
|
|
|
}else{
|
|
|
|
|
var newUrl = "";
|
|
|
|
|
for(var i=0;i<urlArg.length;i++){
|
|
|
|
|
if(i == urlArg.length - 1){
|
|
|
|
|
newUrl += "edit_left.gif";
|
|
|
|
|
}else{
|
|
|
|
|
newUrl += urlArg[i]+"/";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
obj.src = newUrl;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if(urlArg[urlArg.length-1] == "edit_right.gif"){
|
|
|
|
|
var newUrl = "";
|
|
|
|
|
for(var i=0;i<urlArg.length;i++){
|
|
|
|
|
if(i == urlArg.length - 1){
|
|
|
|
|
newUrl += "edit_righthover.gif";
|
|
|
|
|
}else{
|
|
|
|
|
newUrl += urlArg[i]+"/";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
obj.src = newUrl;
|
|
|
|
|
}else{
|
|
|
|
|
var newUrl = "";
|
|
|
|
|
for(var i=0;i<urlArg.length;i++){
|
|
|
|
|
if(i == urlArg.length - 1){
|
|
|
|
|
newUrl += "edit_right.gif";
|
|
|
|
|
}else{
|
|
|
|
|
newUrl += urlArg[i]+"/";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
obj.src = newUrl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function removeCustomer(){
|
|
|
|
|
var selectedObj = $("sel_print");
|
|
|
|
|
var selectedCount = selectedObj.options.length;
|
|
|
|
|
for(var j=0;j<selectedCount;j++){
|
|
|
|
|
if(selectedObj[j].selected){
|
|
|
|
|
selectedObj.options.remove(j);
|
|
|
|
|
if(selectedCount == 1){
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
j=-1;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function addCustomer(){
|
|
|
|
|
var customerObj = $("sel_customer");
|
|
|
|
|
var selectedObj = $("sel_print");
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<customerObj.options.length;i++){
|
|
|
|
|
if(customerObj[i].selected){
|
|
|
|
|
var sameCount = 0;
|
|
|
|
|
var selectedCount = selectedObj.options.length;
|
|
|
|
|
for(var j=0;j<selectedCount;j++){
|
|
|
|
|
if(selectedObj.options[j].value.trim() == customerObj.options[i].value.trim()){
|
|
|
|
|
sameCount++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(sameCount == 0){
|
|
|
|
|
var varItem = new Option(customerObj.options[i].value.trim(), customerObj.options[i].value.trim());
|
|
|
|
|
selectedObj.options.add(varItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getUnitType(typeID){
|
|
|
|
|
var strBSNO = "";
|
|
|
|
|
strBSNO = $("h_bsno").value;
|
|
|
|
|
var url = "";
|
|
|
|
|
url = "../FeeCodes/FeeUnitService.aspx?handle=quantity&bsno="+strBSNO+"&unittype="+typeID+"&type=2&val="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
var quantityVal = loader.xmlDoc.responseText;
|
|
|
|
|
var quantityObj = null;
|
|
|
|
|
|
|
|
|
|
quantityObj = eval('(' + quantityVal + ')');
|
|
|
|
|
return quantityObj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getTypeNameQuantity(typeName){
|
|
|
|
|
var unitType = 0;
|
|
|
|
|
switch(typeName){
|
|
|
|
|
case "单票"://1
|
|
|
|
|
unitType = 1;
|
|
|
|
|
break;
|
|
|
|
|
case "重量": //2毛重
|
|
|
|
|
unitType = 2;
|
|
|
|
|
break;
|
|
|
|
|
case "尺码"://3
|
|
|
|
|
unitType = 3;
|
|
|
|
|
break;
|
|
|
|
|
case "计费吨"://4
|
|
|
|
|
unitType = 4;
|
|
|
|
|
break;
|
|
|
|
|
case "TEU"://5
|
|
|
|
|
unitType = 5;
|
|
|
|
|
break;
|
|
|
|
|
// case "净重"://6
|
|
|
|
|
// unitType = 6;
|
|
|
|
|
// break;
|
|
|
|
|
case "总价"://7
|
|
|
|
|
unitType = 7;
|
|
|
|
|
break;
|
|
|
|
|
case "计价重量"://8
|
|
|
|
|
unitType = 8;
|
|
|
|
|
break;
|
|
|
|
|
case "箱型":
|
|
|
|
|
unitType = 9;//
|
|
|
|
|
break;
|
|
|
|
|
case "CBM":
|
|
|
|
|
unitType = 10; //
|
|
|
|
|
break;
|
|
|
|
|
case "BILL": //单票
|
|
|
|
|
unitType = 11; //
|
|
|
|
|
break;
|
|
|
|
|
default://默认是根据CTN型号获取
|
|
|
|
|
unitType = 0;//
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var strBSNO = "";
|
|
|
|
|
strBSNO = $("h_bsno").value;
|
|
|
|
|
var url = "";
|
|
|
|
|
|
|
|
|
|
if(unitType == 0){
|
|
|
|
|
url = "../FeeCodes/FeeUnitService.aspx?handle=quantity&bsno="+strBSNO+"&unittype="+unitType+"&type=2&ctn="+typeName+"&val="+newGuid();
|
|
|
|
|
}else{
|
|
|
|
|
url = "../FeeCodes/FeeUnitService.aspx?handle=quantity&bsno="+strBSNO+"&unittype="+unitType+"&type=2&val="+newGuid();
|
|
|
|
|
}
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
var quantityVal = loader.xmlDoc.responseText;
|
|
|
|
|
var quantityObj = null;
|
|
|
|
|
|
|
|
|
|
quantityObj = eval('(' + quantityVal + ')');
|
|
|
|
|
return quantityObj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getDebitType(typeID){
|
|
|
|
|
var strBSNO = "";
|
|
|
|
|
strBSNO = $("h_bsno").value;
|
|
|
|
|
var url = "";
|
|
|
|
|
url = "../FeeCodes/FeeDebitService.aspx?handle=debit&bsno="+strBSNO+"&debittype="+typeID+"&type=2&val="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
var debitVal = loader.xmlDoc.responseText;
|
|
|
|
|
var debitObj = null;
|
|
|
|
|
|
|
|
|
|
debitObj = eval('(' + debitVal + ')');
|
|
|
|
|
return debitObj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setCurrencyCombo(obj){
|
|
|
|
|
var url = "../FeeCodes/CurrencyAdapter.aspx?handle=drate&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
|
|
|
|
|
var currencyInfo = loader.xmlDoc.responseText;
|
|
|
|
|
var jsonCacheObj = eval('(' + currencyInfo + ')');
|
|
|
|
|
|
|
|
|
|
if(jsonCacheObj.drate.length > 0){
|
|
|
|
|
for(var i = 0;i < jsonCacheObj.drate.length;i++){
|
|
|
|
|
obj.put(jsonCacheObj.drate[i].code,jsonCacheObj.drate[i].code);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function setCustomerCombo(obj){
|
|
|
|
|
var customerInfo = "";
|
|
|
|
|
|
|
|
|
|
if($("h_custcache").value.trim() != ""){
|
|
|
|
|
customerInfo = $("h_custcache").value.trim();
|
|
|
|
|
}else{
|
|
|
|
|
var url = "../FeeCodes/CRMClientInfo.aspx?handle=client&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
customerInfo = loader.xmlDoc.responseText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var jsonCacheObj = eval('(' + customerInfo + ')');
|
|
|
|
|
|
|
|
|
|
if(jsonCacheObj.customer.length > 0){
|
|
|
|
|
for(var i = 0;i < jsonCacheObj.customer.length;i++){
|
|
|
|
|
obj.put(jsonCacheObj.customer[i].name,jsonCacheObj.customer[i].code + ' '+jsonCacheObj.customer[i].name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setFeeNameCombo(obj){
|
|
|
|
|
var feeCodeInfo = "";
|
|
|
|
|
|
|
|
|
|
if($("h_feecache").value.trim() != ""){
|
|
|
|
|
feeCodeInfo = $("h_feecache").value.trim();
|
|
|
|
|
}else{
|
|
|
|
|
var url = "../FeeCodes/FeeCodeService.aspx?handle=feecode&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
feeCodeInfo = loader.xmlDoc.responseText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var jsonCacheObj = eval('(' + feeCodeInfo + ')');
|
|
|
|
|
|
|
|
|
|
if(jsonCacheObj.feecode.length > 0){
|
|
|
|
|
for(var i = 0;i < jsonCacheObj.feecode.length;i++){
|
|
|
|
|
obj.put(jsonCacheObj.feecode[i].name,jsonCacheObj.feecode[i].code);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//function setCustomerCombo(obj){
|
|
|
|
|
// var url = "../FeeCodes/CRMClientInfo.aspx?handle=client&uid="+newGuid();
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
//
|
|
|
|
|
// var customerInfo = loader.xmlDoc.responseText;
|
|
|
|
|
// var jsonCacheObj = eval('(' + customerInfo + ')');
|
|
|
|
|
//
|
|
|
|
|
// if(jsonCacheObj.customer.length > 0){
|
|
|
|
|
// for(var i = 0;i < jsonCacheObj.customer.length;i++){
|
|
|
|
|
// obj.put(jsonCacheObj.customer[i].name,jsonCacheObj.customer[i].code + ' '+jsonCacheObj.customer[i].name);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//function setFeeNameCombo(obj){
|
|
|
|
|
// var url = "../FeeCodes/FeeCodeService.aspx?handle=feecode&uid="+newGuid();
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
//
|
|
|
|
|
// var feeCodeInfo = loader.xmlDoc.responseText;
|
|
|
|
|
// var jsonCacheObj = eval('(' + feeCodeInfo + ')');
|
|
|
|
|
//
|
|
|
|
|
// if(jsonCacheObj.feecode.length > 0){
|
|
|
|
|
// for(var i = 0;i < jsonCacheObj.feecode.length;i++){
|
|
|
|
|
// obj.put(jsonCacheObj.feecode[i].name,jsonCacheObj.feecode[i].code);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
function setUnitCombo(obj) {
|
|
|
|
|
obj.put("单票", "单票");
|
|
|
|
|
obj.put("重量", "重量"); //毛重
|
|
|
|
|
//obj.put("净重", "净重");
|
|
|
|
|
obj.put("尺码", "尺码");
|
|
|
|
|
obj.put("TEU", "TEU");
|
|
|
|
|
obj.put("箱型", "箱型");
|
|
|
|
|
obj.put("CBM", "CBM");
|
|
|
|
|
obj.put("BILL", "BILL");
|
|
|
|
|
var feeCodeCtnObj = null;
|
|
|
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
|
|
|
var url = "../FeeCodes/FeeCodeCtnService.aspx?handle=getcrmctn&bsno="+bsno+"&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
|
|
|
|
|
var ctnInfo = loader.xmlDoc.responseText;
|
|
|
|
|
|
|
|
|
|
if(ctnInfo.trim() != ""){
|
|
|
|
|
feeCodeCtnObj = eval('(' + ctnInfo + ')');
|
|
|
|
|
if(feeCodeCtnObj.ctns.length > 0){
|
|
|
|
|
for(var i=0;i<feeCodeCtnObj.ctns.length;i++){
|
|
|
|
|
|
|
|
|
|
if(feeCodeCtnObj.ctns[i].name.trim() != ""){
|
|
|
|
|
obj.put(feeCodeCtnObj.ctns[i].name,feeCodeCtnObj.ctns[i].name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setFrtCombo(obj){
|
|
|
|
|
obj.put("PP","PP");
|
|
|
|
|
obj.put("CC","CC");
|
|
|
|
|
}
|
|
|
|
|
//应收费用复制添加
|
|
|
|
|
function copyAddRecv(){
|
|
|
|
|
var selRowID = mygrid_recv.getSelectedRowId();
|
|
|
|
|
var selGroup = new Array();
|
|
|
|
|
if(selRowID.indexOf(",") > 0){
|
|
|
|
|
selGroup = selRowID.split(",");
|
|
|
|
|
}else{
|
|
|
|
|
if(selRowID != null){
|
|
|
|
|
selGroup.push(selRowID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查看是否有被选中的费用项
|
|
|
|
|
if(selGroup.length > 0){
|
|
|
|
|
for(var i=0;i<selGroup.length;i++){
|
|
|
|
|
var selectedRowID = selGroup[i];
|
|
|
|
|
var newId = newGuid();
|
|
|
|
|
//获取插入新纪录位置
|
|
|
|
|
var rowCount = mygrid_recv.getRowsNum();
|
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(selectedRowID);
|
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,1).getValue();
|
|
|
|
|
var custName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var unit = mygrid_recv.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
var unitprice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,4).getValue())));
|
|
|
|
|
var quantity = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var comm = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
var amount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,7).getValue())));
|
|
|
|
|
var currency = mygrid_recv.cellByIndex(rowIndex,8).getValue();
|
|
|
|
|
var rate = clearNoNum(isObjNaN(ConvertToMoney(mygrid_recv.cellByIndex(rowIndex,9).getValue())));
|
|
|
|
|
var frt = mygrid_recv.cellByIndex(rowIndex,10).getValue();
|
|
|
|
|
var remark = mygrid_recv.cellByIndex(rowIndex,11).getValue();
|
|
|
|
|
var isadvance = mygrid_recv.cellByIndex(rowIndex,12).getValue();
|
|
|
|
|
|
|
|
|
|
mygrid_recv.addRow(newId,["录入状态",feeName,custName,unit,unitprice,quantity,comm,amount,currency,rate,frt,remark,isadvance],rowCount);
|
|
|
|
|
|
|
|
|
|
mygrid_recv.clearSelection();
|
|
|
|
|
|
|
|
|
|
var rId = mygrid_recv.getRowId(rowCount-1);
|
|
|
|
|
var combo_name;
|
|
|
|
|
var combo_customer;
|
|
|
|
|
var combo_unit;
|
|
|
|
|
var combo_currency;
|
|
|
|
|
var combo_frt;
|
|
|
|
|
|
|
|
|
|
combo_name = mygrid_recv.getCustomCombo(rId,1);
|
|
|
|
|
combo_customer = mygrid_recv.getCustomCombo(rId,2);
|
|
|
|
|
combo_unit = mygrid_recv.getCustomCombo(rId,3);
|
|
|
|
|
combo_currency = mygrid_recv.getCustomCombo(rId,8);
|
|
|
|
|
combo_frt = mygrid_recv.getCustomCombo(rId,10);
|
|
|
|
|
|
|
|
|
|
//重新加载应收费用名称
|
|
|
|
|
setComboByArray(mygrid_recv,combo_name,newId,1);
|
|
|
|
|
//重新加载结算单位
|
|
|
|
|
setComboByArray(mygrid_recv,combo_customer,newId,2);
|
|
|
|
|
//重新加载计费标准
|
|
|
|
|
setComboByArray(mygrid_recv,combo_unit,newId,3);
|
|
|
|
|
//重新加载币别
|
|
|
|
|
setComboByArray(mygrid_recv,combo_currency,newId,8);
|
|
|
|
|
//重新加载FRT
|
|
|
|
|
setComboByArray(mygrid_recv,combo_frt,newId,10);
|
|
|
|
|
|
|
|
|
|
newFeeRecvCount++;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("没有选择要复制的应收费用信息");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//应付费用复制添加
|
|
|
|
|
function copyAddPay(){
|
|
|
|
|
var selRowID = mygrid_pay.getSelectedRowId();
|
|
|
|
|
var selGroup = new Array();
|
|
|
|
|
if(selRowID.indexOf(",") > 0){
|
|
|
|
|
selGroup = selRowID.split(",");
|
|
|
|
|
}else{
|
|
|
|
|
if(selRowID != null){
|
|
|
|
|
selGroup.push(selRowID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//查看是否有被选中的费用项
|
|
|
|
|
if(selGroup.length > 0){
|
|
|
|
|
for(var i=0;i<selGroup.length;i++){
|
|
|
|
|
var selectedRowID = selGroup[i];
|
|
|
|
|
|
|
|
|
|
var newId = newGuid();
|
|
|
|
|
//获取插入新纪录位置
|
|
|
|
|
var rowCount = mygrid_pay.getRowsNum();
|
|
|
|
|
var rowIndex = mygrid_pay.getRowIndex(selectedRowID);
|
|
|
|
|
var feeName = mygrid_pay.cellByIndex(rowIndex,1).getValue();
|
|
|
|
|
var custName = mygrid_pay.cellByIndex(rowIndex,2).getValue();
|
|
|
|
|
var unit = mygrid_pay.cellByIndex(rowIndex,3).getValue();
|
|
|
|
|
var unitprice = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,4).getValue())));
|
|
|
|
|
var quantity = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
|
var comm = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,6).getValue())));
|
|
|
|
|
var amount = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,7).getValue())));
|
|
|
|
|
var currency = mygrid_pay.cellByIndex(rowIndex,8).getValue();
|
|
|
|
|
var rate = clearNoNum(isObjNaN(ConvertToMoney(mygrid_pay.cellByIndex(rowIndex,9).getValue())));
|
|
|
|
|
var frt = mygrid_pay.cellByIndex(rowIndex,10).getValue();
|
|
|
|
|
var remark = mygrid_pay.cellByIndex(rowIndex,11).getValue();
|
|
|
|
|
var isadvance = mygrid_pay.cellByIndex(rowIndex,12).getValue();
|
|
|
|
|
|
|
|
|
|
mygrid_pay.addRow(newId,["录入状态",feeName,custName,unit,unitprice,quantity,comm,amount,currency,rate,frt,remark,isadvance],rowCount);
|
|
|
|
|
|
|
|
|
|
//mygrid_pay.clearSelection();
|
|
|
|
|
|
|
|
|
|
var rId = mygrid_pay.getRowId(rowCount-1);
|
|
|
|
|
var combo_name;
|
|
|
|
|
var combo_customer;
|
|
|
|
|
var combo_unit;
|
|
|
|
|
var combo_currency;
|
|
|
|
|
var combo_frt;
|
|
|
|
|
|
|
|
|
|
combo_name = mygrid_pay.getCustomCombo(rId,1);
|
|
|
|
|
combo_customer = mygrid_pay.getCustomCombo(rId,2);
|
|
|
|
|
combo_unit = mygrid_pay.getCustomCombo(rId,3);
|
|
|
|
|
combo_currency = mygrid_pay.getCustomCombo(rId,8);
|
|
|
|
|
combo_frt = mygrid_pay.getCustomCombo(rId,10);
|
|
|
|
|
|
|
|
|
|
//重新加载应收费用名称
|
|
|
|
|
setComboByArray(mygrid_pay,combo_name,newId,1);
|
|
|
|
|
//重新加载结算单位
|
|
|
|
|
setComboByArray(mygrid_pay,combo_customer,newId,2);
|
|
|
|
|
//重新加载计费标准
|
|
|
|
|
setComboByArray(mygrid_pay,combo_unit,newId,3);
|
|
|
|
|
//重新加载币别
|
|
|
|
|
setComboByArray(mygrid_pay,combo_currency,newId,8);
|
|
|
|
|
//重新加载FRT
|
|
|
|
|
setComboByArray(mygrid_pay,combo_frt,newId,10);
|
|
|
|
|
|
|
|
|
|
newFeePayCount++;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert("没有选择要复制的应付费用信息");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function checkAll(id){
|
|
|
|
|
if(id == "recv"){
|
|
|
|
|
for(var i=0;i<mygrid_recv.getRowsNum();i++){
|
|
|
|
|
if($("ck_all_recv").checked){
|
|
|
|
|
mygrid_recv.cellByIndex(i,0).setValue(1)
|
|
|
|
|
}else{
|
|
|
|
|
mygrid_recv.cellByIndex(i,0).setValue(0)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else if(id == "pay"){
|
|
|
|
|
for(var i=0;i<mygrid_pay.getRowsNum();i++){
|
|
|
|
|
if($("ck_all_pay").checked){
|
|
|
|
|
mygrid_pay.cellByIndex(i,0).setValue(1)
|
|
|
|
|
}else{
|
|
|
|
|
mygrid_pay.cellByIndex(i,0).setValue(0)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取利润信息
|
|
|
|
|
function getFeeProfit(strBSNO){
|
|
|
|
|
|
|
|
|
|
if(strBSNO.trim() != ""){
|
|
|
|
|
var urlVal = "../AuditProcess/FeeAuditGridSource.aspx?type=4&bsno="+strBSNO+"&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{
|
|
|
|
|
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 = "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isDigit(amount){
|
|
|
|
|
var patrn=/^-?\d+\.{0,}\d{0,}$/;
|
|
|
|
|
if (!patrn.exec(amount)) {
|
|
|
|
|
return false;
|
|
|
|
|
}else{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function postCrmOrderAudit(){
|
|
|
|
|
var bsno = $("h_bsno").value.trim();
|
|
|
|
|
if(bsno != ""){
|
|
|
|
|
if(window.confirm("您确定要将销售订舱提交审核,提交完审核后将不能更改任何信息")){
|
|
|
|
|
$("btn_audit").disabled = true;
|
|
|
|
|
var url = "";
|
|
|
|
|
url = "CrmOrderFeeGridSource.aspx?bsno="+bsno+"&handle=postaudit&val="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
var postVal = loader.xmlDoc.responseText;
|
|
|
|
|
|
|
|
|
|
if(parseInt(postVal) == 1){
|
|
|
|
|
$("btn_audit").disabled = true;
|
|
|
|
|
//window.opener.location.href=window.opener.location.href;
|
|
|
|
|
var parentObj = window.parent.location;
|
|
|
|
|
var oldUrl = parentObj.href;
|
|
|
|
|
var idIndex = oldUrl.indexOf("&id");
|
|
|
|
|
var newUrl = "";
|
|
|
|
|
if(idIndex > 0)
|
|
|
|
|
{
|
|
|
|
|
var addfull=oldUrl.indexOf("addfull");
|
|
|
|
|
if(addfull>0)
|
|
|
|
|
{
|
|
|
|
|
var handleIndex = oldUrl.indexOf("handle=");
|
|
|
|
|
newUrl = oldUrl.substring(0,handleIndex);
|
|
|
|
|
window.parent.opener.location.href = window.parent.opener.location.href;
|
|
|
|
|
parentObj.href = newUrl+"handle=edit&isAudit=1&id="+bsno;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//newUrl = oldUrl.substring(0,idIndex+4);
|
|
|
|
|
window.parent.opener.location.href = window.parent.opener.location.href;
|
|
|
|
|
//parentObj.href = newUrl+bsno;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var handleIndex = oldUrl.indexOf("handle=");
|
|
|
|
|
newUrl = oldUrl.substring(0,handleIndex);
|
|
|
|
|
window.parent.opener.location.href = window.parent.opener.location.href;
|
|
|
|
|
parentObj.href = newUrl+"handle=edit&isAudit=1&id="+bsno;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
$("btn_audit").disabled = false;
|
|
|
|
|
if(parseInt(postVal) == -3){
|
|
|
|
|
alert("销售订舱未录费用不能提交审核");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function initDownFeeName(){
|
|
|
|
|
var url = "../FeeCodes/FeeCodeService.aspx?handle=feecode&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
|
|
|
|
|
var feeCodeInfo = loader.xmlDoc.responseText;
|
|
|
|
|
//var jsonCacheObj = eval('(' + feeCodeInfo + ')');
|
|
|
|
|
|
|
|
|
|
if($("h_feecache").value.trim() == ""){
|
|
|
|
|
$("h_feecache").value = feeCodeInfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var url = "../FeeCodes/CRMClientInfo.aspx?handle=client&uid="+newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
var customerInfo = loader.xmlDoc.responseText;
|
|
|
|
|
|
|
|
|
|
if($("h_custcache").value.trim() == ""){
|
|
|
|
|
$("h_custcache").value = customerInfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if(jsonCacheObj.feecode.length > 0){
|
|
|
|
|
// for(var i = 0;i < jsonCacheObj.feecode.length;i++){
|
|
|
|
|
// obj.put(jsonCacheObj.feecode[i].name,jsonCacheObj.feecode[i].code);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|