You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2359 lines
83 KiB
JavaScript
2359 lines
83 KiB
JavaScript
var commonGridObj_old;
|
|
var commonGridObj_new;
|
|
var stroplb;//业务类别
|
|
function $(id){
|
|
return document.getElementById(id);
|
|
}
|
|
|
|
function doInitOldFeeGrid(){
|
|
|
|
commonGridObj_old = new dhtmlXGridObject('mygrid_container_old');
|
|
commonGridObj_old.setImagePath("../images/");
|
|
commonGridObj_old.setSkin("xp");
|
|
commonGridObj_old.setHeader("费用状态,应收费用名称,结算单位,计费标准,单价,数量,佣金比例,金额,币别,汇率,FRT,费用备注,是否垫付");
|
|
commonGridObj_old.setInitWidths("70,110,150,70,80,80,90,90,50,70,70,70,70");
|
|
commonGridObj_old.setColAlign("center,right,right,right,right,right,right,right,right,right,right,right,center");
|
|
|
|
commonGridObj_old.setColSorting("str,txt,txt,int,int,int,int,int,int,int,int,int,str");
|
|
commonGridObj_old.setColTypes("ro,co,co,co,ed,ed,ed,ed,co,ed,co,txt,ch");
|
|
|
|
var id = $("h_fee").value.trim();
|
|
var type = $("h_type").value.trim();
|
|
var loadType = $("h_loadtype").value.trim();
|
|
|
|
var urlVal = "FeeModifySource.aspx?handle=exist&id="+id+"&val="+newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
loader = null;
|
|
|
|
if(parseInt(loadVal) == 1){
|
|
|
|
var handleType = parseInt($("h_handle").value);
|
|
var applyState = parseInt($("h_applystate").value);
|
|
var checkState = parseInt($("sel_check").value);
|
|
switch(handleType){
|
|
case 1:
|
|
commonGridObj_old.loadXML("FeeModifySource.aspx?handle=apply&id="+id+"&applystate="+applyState+"&checkstate="+checkState+"&applytype=1&val="+newGuid()+"&oplb="+stroplb);
|
|
break;
|
|
case 2:
|
|
commonGridObj_old.loadXML("FeeModifySource.aspx?handle=apply&id="+id+"&applystate="+applyState+"&checkstate="+checkState+"&applytype=1&val="+newGuid()+"&oplb="+stroplb);
|
|
break;
|
|
case 3:
|
|
commonGridObj_old.loadXML("FeeModifySource.aspx?handle=apply&id="+id+"&applystate="+applyState+"&checkstate="+checkState+"&applytype=1&val="+newGuid()+"&oplb="+stroplb);
|
|
break;
|
|
}
|
|
setTimeout(function(){
|
|
ReShowLabel(commonGridObj_old);
|
|
},200);
|
|
|
|
}
|
|
commonGridObj_old.init();
|
|
|
|
commonGridObj_old.enableMultiselect(true);
|
|
commonGridObj_old.attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
|
|
|
|
//初始化状态
|
|
if(stage == 0){
|
|
return false;
|
|
}
|
|
});
|
|
}
|
|
|
|
//讲下拉列表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 doInitNewFeeGrid(){
|
|
|
|
commonGridObj_new = new dhtmlXGridObject('mygrid_container_new');
|
|
commonGridObj_new.setImagePath("../images/");
|
|
commonGridObj_new.setSkin("xp");
|
|
commonGridObj_new.setHeader("费用状态,应收费用名称,结算单位,计费标准,单价,数量,佣金比例,金额,币别,汇率,FRT,费用备注,是否垫付,REASON");
|
|
commonGridObj_new.setInitWidths("70,110,150,70,80,80,90,90,50,70,70,70,70,0");
|
|
commonGridObj_new.setColAlign("center,right,right,right,right,right,right,right,right,right,right,right,center,right");
|
|
// commonGridObj_new.setSkin("light");
|
|
commonGridObj_new.setColSorting("str,txt,txt,int,int,int,int,int,int,int,int,int,str,int");
|
|
commonGridObj_new.setColTypes("ro,co,co,co,ed,ed,ed,ed,co,ed,co,txt,ch,txt");
|
|
|
|
var id = $("h_fee").value.trim();
|
|
var type = $("h_type").value.trim();
|
|
var readOnly = $("h_readonly").value.trim();
|
|
var loadType = $("h_loadtype").value.trim();
|
|
|
|
var urlVal = "FeeModifySource.aspx?handle=exist&id="+id+"&val="+newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
loader = null;
|
|
|
|
if(parseInt(loadVal) == 1){
|
|
var handleType = parseInt($("h_handle").value);
|
|
var applyState = parseInt($("h_applystate").value);
|
|
var checkState = parseInt($("sel_check").value);
|
|
switch(handleType){
|
|
case 1:
|
|
commonGridObj_new.loadXML("FeeModifySource.aspx?handle=apply&id="+id+"&applystate="+applyState+"&checkstate="+checkState+"&applytype=2&val="+newGuid()+"&oplb="+stroplb);
|
|
break;
|
|
case 2:
|
|
commonGridObj_new.loadXML("FeeModifySource.aspx?handle=apply&id="+id+"&applystate="+applyState+"&checkstate="+checkState+"&applytype=2&val="+newGuid()+"&oplb="+stroplb);
|
|
break;
|
|
case 3:
|
|
commonGridObj_new.loadXML("FeeModifySource.aspx?handle=apply&id="+id+"&applystate="+applyState+"&checkstate="+checkState+"&applytype=2&val="+newGuid()+"&oplb="+stroplb);
|
|
break;
|
|
}
|
|
setTimeout(function(){
|
|
ReShowLabel(commonGridObj_new);
|
|
},200);
|
|
|
|
}
|
|
commonGridObj_new.init();
|
|
commonGridObj_new.enableEditEvents(true,false,true);
|
|
commonGridObj_new.enableMultiselect(true);
|
|
//commonGridObj_new.setTabOrder("1,2,3,4,5,6,7,8,9,10,11,12");
|
|
//commonGridObj_new.enableLightMouseNavigation(true);
|
|
commonGridObj_new.enableKeyboardSupport(true);
|
|
|
|
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;
|
|
//手动编写Grid控件编辑事件,由于免费控件没有提供完整的编辑判断功能,现特此做更改
|
|
commonGridObj_new.attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
|
|
var newCheckValue = false;
|
|
//初始化状态
|
|
if(stage == 0){
|
|
var checkState = parseInt($("sel_check").value);
|
|
if(checkState == 2 || checkState == 3){
|
|
return false;
|
|
}
|
|
//alert();
|
|
//return true;
|
|
//var cell = commonGridObj_new.cellById(rId,cInd);
|
|
//alert(cell.getValue());
|
|
var selectedId = commonGridObj_new.getSelectedRowId();
|
|
var rowIndex = commonGridObj_new.getRowIndex(selectedId);
|
|
|
|
var oldVal = commonGridObj_new.cellByIndex(rowIndex,0).getValue().trim();
|
|
|
|
if(readOnly == 1){
|
|
return false;
|
|
}else{
|
|
if(oldVal == "录入状态"){
|
|
return true;
|
|
|
|
}else if(oldVal == "提交申请"){
|
|
return false;
|
|
}else{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(stage == 1){
|
|
var selectedId = commonGridObj_new.getSelectedRowId();
|
|
var rowIndex = commonGridObj_new.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 == 1 || cInd == 2){
|
|
if(flagFilter == 0){
|
|
//alert(txtEdit.value);
|
|
}
|
|
}
|
|
}
|
|
//如果编辑结束
|
|
if(stage == 2){
|
|
if(cInd == 4){
|
|
|
|
var rowIndex = commonGridObj_new.getRowIndex(rId);
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_new.cellByIndex(rowIndex,4).getValue())));
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_new.cellByIndex(rowIndex,5).getValue())));
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
commonGridObj_new.cellByIndex(rowIndex,4).setValue(outputMoney(unitPrice.toString()));
|
|
//commonGridObj_new.cellByIndex(rowIndex,5).setValue(outputMoney(quantityCount.toString()));
|
|
commonGridObj_new.cellByIndex(rowIndex,7).setValue(outputMoney(amount.toString()));
|
|
|
|
totalDynamicFeeGain();
|
|
return true;
|
|
|
|
}else if(cInd == 5){
|
|
var rowIndex = commonGridObj_new.getRowIndex(rId);
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_new.cellByIndex(rowIndex,4).getValue())));
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_new.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
//commonGridObj_new.cellByIndex(rowIndex,4).setValue(outputMoney(unitPrice.toString()));
|
|
commonGridObj_new.cellByIndex(rowIndex,5).setValue(outputMoney(quantityCount.toString()));
|
|
commonGridObj_new.cellByIndex(rowIndex,7).setValue(outputMoney(amount.toString()));
|
|
|
|
totalDynamicFeeGain();
|
|
return true;
|
|
}else if(cInd == 8){
|
|
var rowIndex = commonGridObj_new.getRowIndex(rId);
|
|
|
|
//filterComboCustomerPress(commonGridObj_new,rId,rowIndex,8,nValue,oValue);
|
|
|
|
var curValue = commonGridObj_new.cellByIndex(rowIndex,8).getValue();
|
|
//alert(curValue);
|
|
//alert(rId);alert(curValue);
|
|
var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+curValue;
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
commonGridObj_new.cellByIndex(rowIndex,9).setValue(loadVal);
|
|
|
|
loader == null;
|
|
return true;
|
|
}else if(cInd == 7){
|
|
return;
|
|
// }else if(cInd == 9){
|
|
// return;
|
|
}else if(cInd == 1 || cInd == 2){
|
|
var rowIndex = commonGridObj_new.getRowIndex(rId);
|
|
if(pressCount == 1){
|
|
if(flagFilter == 1){
|
|
//mygrid_recv.editStop();
|
|
commonGridObj_new.cellByIndex(rowIndex,cInd).setLabel(oValue);
|
|
return true;
|
|
}else{
|
|
// if(pressRowIndex == rowIndex && pressCellIndex == cInd){
|
|
var cellVal = commonGridObj_new.cellByIndex(rowIndex,cInd).getValue();
|
|
|
|
var combo = commonGridObj_new.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){
|
|
commonGridObj_new.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
commonGridObj_new.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){
|
|
commonGridObj_new.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
commonGridObj_new.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]);
|
|
tempCount++;
|
|
break;
|
|
}
|
|
}
|
|
}alert(tempCount)
|
|
if(tempCount == 0){
|
|
commonGridObj_new.cellByIndex(rowIndex,cInd).setValue("");
|
|
commonGridObj_new.cellByIndex(rowIndex,cInd).setLabel("");
|
|
}
|
|
|
|
isExchange = false;
|
|
pressRecord = "";
|
|
pressRowIndex = -1;
|
|
pressCellIndex = -1;
|
|
pressCount = 0;
|
|
flagFilter = 0;
|
|
return true;
|
|
// }else{
|
|
|
|
// return true;
|
|
// }
|
|
}
|
|
}else if(pressCount == 2){
|
|
if(flagFilter == 1){
|
|
commonGridObj_new.editStop();
|
|
commonGridObj_new.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 = commonGridObj_new.cellByIndex(rowIndex,cInd).getValue();//alert(cellVal)
|
|
var combo = commonGridObj_new.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){
|
|
commonGridObj_new.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
commonGridObj_new.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){
|
|
commonGridObj_new.cellByIndex(rowIndex,cInd).setValue("");
|
|
commonGridObj_new.cellByIndex(rowIndex,cInd).setLabel("");
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}else{
|
|
var cellVal = commonGridObj_new.cellByIndex(rowIndex,cInd).getValue();
|
|
var combo = commonGridObj_new.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){
|
|
commonGridObj_new.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
commonGridObj_new.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){
|
|
commonGridObj_new.cellByIndex(rowIndex,cInd).setValue(comboArg[i]);
|
|
commonGridObj_new.cellByIndex(rowIndex,cInd).setLabel(comboArg[i]);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
}else{
|
|
return true;
|
|
}
|
|
}
|
|
});
|
|
|
|
// commonGridObj_new.attachEvent("onEnter",function(rowId,celInd){
|
|
// var rowIndex = commonGridObj_new.getRowIndex(rowId);
|
|
// var ColumnsNum=commonGridObj_new.getColumnsNum();
|
|
// if (ColumnsNum==14){
|
|
// $("txt_reason").value=commonGridObj_new.cellByIndex(rowIndex,13).getValue();
|
|
// }
|
|
// return true;
|
|
// });
|
|
|
|
//键盘操作事件
|
|
commonGridObj_new.attachEvent("onKeyPress", function(code,cFlag,sFlag){
|
|
//onKeyPress begin
|
|
//获取当前RowID
|
|
var selectedId = commonGridObj_new.getSelectedRowId();
|
|
//获取当前RowIndex
|
|
var rowIndex = commonGridObj_new.getRowIndex(selectedId);
|
|
//获取当前CellIndex(ind)
|
|
var ind = commonGridObj_new.getSelectedCellIndex();
|
|
|
|
//触发操作事件前获取单元值
|
|
var oldVal = commonGridObj_new.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;
|
|
}
|
|
}
|
|
// alert(" rowIndex "+rowIndex);
|
|
if(code == 13){
|
|
if(ind == 1 || ind == 2 ||ind == 3||ind == 10){
|
|
//如果是检索失败,
|
|
if(pressCount == 2){
|
|
commonGridObj_new.editStop();
|
|
//将value写入cell(触发 stage2)
|
|
commonGridObj_new.cellByIndex(rowIndex,ind).setValue(oldVal);
|
|
//重新打开cell(触发stage0 stage1)
|
|
commonGridObj_new.selectCell(rowIndex,ind,true,true);
|
|
commonGridObj_new.cellByIndex(rowIndex,ind).setLabel(oldVal);
|
|
commonGridObj_new.editCell();
|
|
return true;
|
|
}else{
|
|
|
|
}
|
|
|
|
return true;
|
|
}else{
|
|
return true;
|
|
}
|
|
// if (commonGridObj_new.getColumnsNum()==14 && rowIndex>0){
|
|
// $("txt_reason").value=commonGridObj_new.cellByIndex(rowIndex,13).getValue();
|
|
// }
|
|
}
|
|
//Tab键
|
|
if(code == 9){
|
|
|
|
//code9 begin
|
|
var colCount = commonGridObj_new.getColumnsNum();
|
|
var rowCount = commonGridObj_new.getRowsNum();
|
|
|
|
if(ind < colCount){
|
|
isExchange = false;
|
|
pressRecord = "";
|
|
pressRowIndex = -1;
|
|
pressCellIndex = -1;
|
|
commonGridObj_new.editStop(true);
|
|
|
|
|
|
commonGridObj_new.cellByIndex(rowIndex,ind).setLabel(oldVal);
|
|
|
|
var cInd = ind;
|
|
var rId = selectedId;
|
|
if(cInd == 4){
|
|
|
|
var rowIndex = commonGridObj_new.getRowIndex(rId);
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_new.cellByIndex(rowIndex,4).getValue())));
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_new.cellByIndex(rowIndex,5).getValue())));
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
commonGridObj_new.cellByIndex(rowIndex,4).setValue(outputMoney(unitPrice.toString()));
|
|
|
|
commonGridObj_new.cellByIndex(rowIndex,7).setValue(outputMoney(amount.toString()));
|
|
|
|
totalDynamicFeeGain();
|
|
|
|
}else if(cInd == 5){
|
|
var rowIndex = commonGridObj_new.getRowIndex(rId);
|
|
var unitPrice = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_new.cellByIndex(rowIndex,4).getValue())));
|
|
var quantityCount = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_new.cellByIndex(rowIndex,5).getValue())));
|
|
|
|
var amount = unitPrice * quantityCount;
|
|
|
|
//mygrid_recv.cellByIndex(rowIndex,4).setValue(outputMoney(unitPrice.toString()));
|
|
commonGridObj_new.cellByIndex(rowIndex,5).setValue(outputMoney(quantityCount.toString()));
|
|
commonGridObj_new.cellByIndex(rowIndex,7).setValue(outputMoney(amount.toString()));
|
|
|
|
totalDynamicFeeGain();
|
|
}else if(cInd == 8){
|
|
var rowIndex = commonGridObj_new.getRowIndex(rId);
|
|
|
|
//filterComboCustomerPress(mygrid_recv,rId,rowIndex,8,nValue,oValue);
|
|
|
|
var curValue = commonGridObj_new.cellByIndex(rowIndex,8).getValue();
|
|
//alert(curValue);
|
|
//alert(rId);alert(curValue);
|
|
var urlVal = "../FeeCodes/CurrencyCodeService.aspx?gid="+rId+"¤cy="+curValue+"&val="+newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
commonGridObj_new.cellByIndex(rowIndex,9).setValue(loadVal);
|
|
totalDynamicFeeGain();
|
|
loader == null;
|
|
}
|
|
|
|
|
|
commonGridObj_new.selectCell(rowIndex,ind+1,true,true);
|
|
commonGridObj_new.editCell();
|
|
if(ind == colCount - 2){
|
|
if(rowIndex < rowCount){
|
|
commonGridObj_new.editStop(true);
|
|
commonGridObj_new.clearSelection();
|
|
commonGridObj_new.selectCell(rowIndex+1,1,true,true);
|
|
commonGridObj_new.editCell();
|
|
|
|
}else{
|
|
return;
|
|
}
|
|
}
|
|
|
|
}
|
|
//cdoe9 end
|
|
}
|
|
|
|
if(code>=65&&code<=90){//如果是输入英文字符
|
|
|
|
if(ind == 1 || ind == 2 ||ind == 3||ind == 10){
|
|
//获取键盘输入字符
|
|
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 = commonGridObj_new.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;
|
|
//关闭编辑
|
|
commonGridObj_new.editStop();
|
|
//将value写入cell(触发 stage2)
|
|
commonGridObj_new.cellByIndex(rowIndex,ind).setValue(oldVal);
|
|
flagFilter = 0;
|
|
//重新打开cell(触发stage0 stage1)
|
|
commonGridObj_new.selectCell(rowIndex,ind,true,true);
|
|
commonGridObj_new.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;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
//delete
|
|
if(code == 8){
|
|
//code8 begin
|
|
if(ind == 1 || ind == 2 ||ind == 3||ind == 10){
|
|
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 = commonGridObj_new.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;
|
|
commonGridObj_new.editStop();
|
|
commonGridObj_new.cellByIndex(rowIndex,ind).setValue(oldVal);
|
|
|
|
commonGridObj_new.selectCell(rowIndex,ind,true,true);
|
|
commonGridObj_new.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 == 0 || ind == 12|| ind == 4|| ind == 5|| ind == 6|| ind == 7|| ind == 9){
|
|
var rowCount = commonGridObj_new.getRowsNum();
|
|
commonGridObj_new.clearSelection();
|
|
commonGridObj_new.editStop();
|
|
if(rowIndex == (rowCount - 1)){
|
|
addPayRow();
|
|
}else{
|
|
commonGridObj_new.selectCell(rowIndex+1,1,true,true);
|
|
commonGridObj_new.editCell();
|
|
}
|
|
|
|
}else{
|
|
pressCount = 0;
|
|
return true;
|
|
}
|
|
//code40 end
|
|
}
|
|
//向上箭头
|
|
if(code == 38){
|
|
//code38 begin
|
|
|
|
if(ind == 0 || ind == 12|| ind == 4|| ind == 5|| ind == 6|| ind == 7|| ind == 9){
|
|
if(rowIndex > 0){
|
|
commonGridObj_new.clearSelection();
|
|
commonGridObj_new.editStop();
|
|
commonGridObj_new.selectCell(rowIndex-1,1,true,true);
|
|
commonGridObj_new.editCell();
|
|
}
|
|
}else{
|
|
pressCount = 0;
|
|
return true;
|
|
}
|
|
//code38 end
|
|
}
|
|
//键盘输入数字
|
|
if(code >= 48 && code <= 57|| code >= 96 && code <= 105 || code == 188|| code == 110|| code == 190){
|
|
if( ind == 1|| ind == 2|| ind == 3||ind == 4|| ind == 5|| ind == 6|| ind == 7|| ind == 9||ind == 11){
|
|
return true;
|
|
}
|
|
}
|
|
//onKeyPress end
|
|
});
|
|
|
|
var pressVal = "";
|
|
var pressColIndex = 0;
|
|
var pressRowIndex = 0;
|
|
var pressGridType = 1;//recv
|
|
}
|
|
|
|
function addRecvRow(){
|
|
if(mygrid_recv.getRowsNum() > 0){
|
|
var newId = newGuid();
|
|
//获取插入新纪录位置
|
|
var rowCount = mygrid_recv.getRowsNum();
|
|
mygrid_recv.addRow(newId,["录入状态","","","",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);
|
|
|
|
mygrid_recv.editStop(true);
|
|
mygrid_recv.selectCell(mygrid_recv.getRowIndex(newId),1,true,true);
|
|
mygrid_recv.editCell();
|
|
}else{
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
mygrid_recv.loadXML("feegridsource.aspx?type=1&read=add&showcount=1&bsno="+bsno+"&oplb="+stroplb);
|
|
//mygrid_recv.init();
|
|
}
|
|
}
|
|
|
|
|
|
function addPayRow(){
|
|
if(commonGridObj_new.getRowsNum() > 0){
|
|
var newId = newGuid();
|
|
//获取插入新纪录位置
|
|
var rowCount = commonGridObj_new.getRowsNum();
|
|
commonGridObj_new.addRow(newId,["录入状态","","","",0,0,0,0,"RMB",1,"PP","",false],rowCount);
|
|
//mygrid_recv.addRow(newId,"",mygrid_recv.getRowsNum());
|
|
commonGridObj_new.selectRow(commonGridObj_new.getRowIndex(newId),false,false,true);
|
|
|
|
//mygrid_recv.loadXML("feegridsource.aspx?type=1&read=add&showcount="+page_count);
|
|
//mygrid_recv.enableCellIds(true);
|
|
|
|
var rId = commonGridObj_new.getRowId(rowCount-1);
|
|
var combo_name;
|
|
var combo_customer;
|
|
var combo_unit;
|
|
var combo_currency;
|
|
|
|
combo_name = commonGridObj_new.getCustomCombo(rId,1);
|
|
combo_customer = commonGridObj_new.getCustomCombo(rId,2);
|
|
combo_unit = commonGridObj_new.getCustomCombo(rId,3);
|
|
combo_currency = commonGridObj_new.getCustomCombo(rId,8);
|
|
|
|
//重新加载应收费用名称
|
|
setComboByArray(commonGridObj_new,combo_name,newId,1);
|
|
//重新加载结算单位
|
|
setComboByArray(commonGridObj_new,combo_customer,newId,2);
|
|
//重新加载计费标准
|
|
setComboByArray(commonGridObj_new,combo_unit,newId,3);
|
|
//重新加载币别
|
|
setComboByArray(commonGridObj_new,combo_currency,newId,8);
|
|
|
|
}else{
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
commonGridObj_new.loadXML("feegridsource.aspx?type=2&read=add&showcount=1&bsno="+bsno+"&oplb="+stroplb);
|
|
//commonGridObj_new.init();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
function deleteRecvRow(){
|
|
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){
|
|
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();
|
|
}
|
|
}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();
|
|
}
|
|
}
|
|
delCount++;
|
|
}
|
|
}
|
|
|
|
|
|
}else{
|
|
alert("未选中要操作的费用项");
|
|
|
|
}
|
|
}
|
|
|
|
function deletePayRow(){
|
|
|
|
var selRowID = commonGridObj_new.getSelectedRowId();
|
|
var selGroup = new Array();
|
|
if(selRowID.indexOf(",") > 0){
|
|
selGroup = selRowID.split(",");
|
|
}else{
|
|
if(selRowID != null){
|
|
selGroup.push(selRowID);
|
|
}
|
|
}
|
|
//查看是否有被选中的费用项
|
|
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 = commonGridObj_new.getRowIndex(selGroup[delCount]);
|
|
|
|
var feeName = commonGridObj_new.cellByIndex(rowIndex,1).getValue();
|
|
var cusName = commonGridObj_new.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 ){
|
|
commonGridObj_new.deleteRow(selGroup[delCount]);
|
|
}else{
|
|
commonGridObj_new.deleteSelectedRows();
|
|
}
|
|
delCount++;
|
|
}
|
|
dg.close();
|
|
}
|
|
}else{
|
|
var delCount = 0;
|
|
while(delCount < selGroup.length){
|
|
var rowIndex = commonGridObj_new.getRowIndex(selGroup[delCount]);
|
|
|
|
var feeName = commonGridObj_new.cellByIndex(rowIndex,1).getValue();
|
|
var cusName = commonGridObj_new.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;
|
|
alert();
|
|
if(loadVal > 0 ){
|
|
commonGridObj_new.deleteRow(selGroup[delCount]);
|
|
dg.close();
|
|
alert("删除成功");
|
|
}else{
|
|
commonGridObj_new.deleteSelectedRows();
|
|
dg.close();
|
|
}
|
|
}
|
|
delCount++;
|
|
}
|
|
}
|
|
|
|
}else{
|
|
alert("未选中要操作的费用项");
|
|
|
|
}
|
|
}
|
|
|
|
function saveRecvChange(){
|
|
//jsonFeeObj = "{\"postFee\": [";
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
jsonFeeObj = "{\"$type\":\"DSWeb.Models.JsonFeeGroupEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",\"JsonFeeEntities\":[";
|
|
column_count = mygrid_recv.getColumnsNum();
|
|
|
|
var tempJson = "";
|
|
var rowCount = mygrid_recv.getRowsNum();
|
|
for(var i = 0;i < rowCount;i++){
|
|
//获取RowID
|
|
|
|
tempJson = "";
|
|
var rId = mygrid_recv.getRowId(i);
|
|
|
|
tempJson += "\"$type\":\"DSWeb.Models.JsonFeeEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",";
|
|
tempJson += "\"fee1\":\""+rId+"\",";//gid
|
|
//tempJson += "\"fee1\":\""+2222+"\",";
|
|
|
|
for(var j=0;j < column_count;j++){
|
|
var cell = mygrid_recv.cellById(rId,j);
|
|
var value = "";
|
|
value = cell.getValue();
|
|
|
|
if(value == ""){
|
|
value = "null";
|
|
}
|
|
switch(j){
|
|
case 0:
|
|
case 1:
|
|
case 2:
|
|
case 3:
|
|
case 8:
|
|
case 10:
|
|
case 11:
|
|
tempJson += "\"fee"+(j+2)+"\":\""+value+"\",";
|
|
break;
|
|
case 12:
|
|
if(value == 1){
|
|
value = true;
|
|
}else{
|
|
value = false;
|
|
}
|
|
tempJson += "\"fee"+(j+2)+"\":"+value+",";
|
|
//tempJson += "\"fee"+(j+3)+"\":\""+bsno+"\"";
|
|
break;
|
|
default:
|
|
tempJson += "\"fee"+(j+2)+"\":"+ConvertToMoney(value)+",";
|
|
}
|
|
//tempJson += "\"fun"+(j+2)+"\":\"false\"";
|
|
|
|
}
|
|
tempJson += "\"fee15\":\""+bsno+"\"";
|
|
//tempJson += "\"fee"+14+"\":true";
|
|
tempJson = "{"+tempJson+"}";
|
|
|
|
|
|
if(i == rowCount - 1){
|
|
jsonFeeObj = jsonFeeObj+tempJson;
|
|
}else{
|
|
jsonFeeObj = jsonFeeObj+tempJson+",";
|
|
}
|
|
}
|
|
|
|
//jsonFeeObj = jsonFeeObj +"{"+ tempJson +"}";
|
|
jsonFeeObj += "]}";
|
|
var txt_name = $("recvContainer");
|
|
txt_name.value = jsonFeeObj;
|
|
|
|
|
|
GetGainArg();
|
|
//post form
|
|
msgBox();
|
|
setTimeout(postEnterFee,200);
|
|
// var bsno = $("dvOrderNumVal").innerHTML.trim();
|
|
// setTimeout(function(){
|
|
// mygrid_recv.loadXML("feegridsource.aspx?type=1&read=init&showcount=1&bsno="+bsno);
|
|
// },200);
|
|
//
|
|
//postEnterFee();
|
|
|
|
}
|
|
|
|
function savePayChange(){
|
|
var bsno = $("dvOrderNumVal").value.trim();
|
|
jsonPayObj = "{\"$type\":\"DSWeb.Models.JsonFeeGroupEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",\"JsonFeeEntities\":[";
|
|
column_count = commonGridObj_new.getColumnsNum();
|
|
|
|
var tempJson = "";
|
|
var rowCount = commonGridObj_new.getRowsNum();
|
|
for(var i = 0;i < rowCount;i++){
|
|
//获取RowID
|
|
|
|
tempJson = "";
|
|
var rId = commonGridObj_new.getRowId(i);
|
|
|
|
tempJson += "\"$type\":\"DSWeb.Models.JsonFeeEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",";
|
|
tempJson += "\"fee1\":\""+rId+"\",";//gid
|
|
//tempJson += "\"fee1\":\""+2222+"\",";
|
|
|
|
for(var j=0;j < column_count;j++){
|
|
var cell = commonGridObj_new.cellById(rId,j);
|
|
var value = "";
|
|
value = cell.getValue();
|
|
|
|
if(value == ""){
|
|
value = "null";
|
|
}
|
|
switch(j){
|
|
case 0:
|
|
case 1:
|
|
case 2:
|
|
case 3:
|
|
case 8:
|
|
case 10:
|
|
case 11:
|
|
tempJson += "\"fee"+(j+2)+"\":\""+value+"\",";
|
|
break;
|
|
case 12:
|
|
if(value == 1){
|
|
value = true;
|
|
}else{
|
|
value = false;
|
|
}
|
|
tempJson += "\"fee"+(j+2)+"\":"+value+",";
|
|
|
|
break;
|
|
default:
|
|
tempJson += "\"fee"+(j+2)+"\":"+ConvertToMoney(value)+",";
|
|
}
|
|
//tempJson += "\"fun"+(j+2)+"\":\"false\"";
|
|
|
|
}
|
|
tempJson += "\"fee15\":\""+bsno+"\"";
|
|
//tempJson += "\"fee"+14+"\":true";
|
|
tempJson = "{"+tempJson+"}";
|
|
|
|
|
|
if(i == rowCount - 1){
|
|
jsonPayObj = jsonPayObj+tempJson;
|
|
}else{
|
|
jsonPayObj = jsonPayObj+tempJson+",";
|
|
}
|
|
}
|
|
|
|
//jsonFeeObj = jsonFeeObj +"{"+ tempJson +"}";
|
|
jsonPayObj += "]}";
|
|
|
|
var txt_name = $("payContainer");
|
|
txt_name.value = jsonPayObj;
|
|
|
|
GetGainArg();
|
|
//post form
|
|
// alert(jsonPayObj);
|
|
msgBox();
|
|
setTimeout(postEnterFee,200);
|
|
// var bsno = $("dvOrderNumVal").innerHTML.trim();
|
|
// setTimeout(function(){
|
|
// commonGridObj_new.loadXML("feegridsource.aspx?type=2&read=init&showcount=1&bsno="+bsno);
|
|
// },200);
|
|
|
|
}
|
|
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(){
|
|
stroplb= $("h_oplb").value;
|
|
doInitOldFeeGrid();
|
|
setTimeout(doInitNewFeeGrid,200);
|
|
|
|
//setTimeout(doInitPayGrid,100000);
|
|
}
|
|
|
|
//放弃应收费用修改 重新加载页面
|
|
function recoverRecvChange(){
|
|
var selRowID = mygrid_recv.getSelectedRowId();
|
|
//查看是否有被选中的费用项
|
|
if(selRowID != null){
|
|
|
|
var rowIndex = mygrid_recv.getRowIndex(selRowID);
|
|
|
|
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="+selRowID+"&handle=recover";
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
if(!IsNum(loadVal)){
|
|
var recvArg = new Array();
|
|
recvArg = loadVal.split(",");
|
|
|
|
var selRowIndex = mygrid_recv.getRowIndex(recvArg[0]);
|
|
|
|
var colCount = mygrid_recv.getColumnsNum();
|
|
for(var i=1;i<colCount;i++){
|
|
mygrid_recv.cellByIndex(selRowIndex,i).setValue(recvArg[i]);
|
|
}
|
|
dg.close();
|
|
alert("恢复成功");
|
|
|
|
}else{
|
|
|
|
if(parseInt(loadVal) == -3){
|
|
mygrid_recv.cellByIndex(rowIndex,1).setValue("");
|
|
|
|
mygrid_recv.cellByIndex(rowIndex,2).setValue("");
|
|
mygrid_recv.cellByIndex(rowIndex,3).setValue("");
|
|
mygrid_recv.cellByIndex(rowIndex,4).setValue(0);
|
|
mygrid_recv.cellByIndex(rowIndex,5).setValue(0);
|
|
mygrid_recv.cellByIndex(rowIndex,6).setValue(0);
|
|
mygrid_recv.cellByIndex(rowIndex,7).setValue(0);
|
|
mygrid_recv.cellByIndex(rowIndex,8).setValue("RMB");
|
|
mygrid_recv.cellByIndex(rowIndex,9).setValue(1);
|
|
mygrid_recv.cellByIndex(rowIndex,10).setValue("");
|
|
mygrid_recv.cellByIndex(rowIndex,11).setValue("");
|
|
mygrid_recv.cellByIndex(rowIndex,12).setValue(false);
|
|
|
|
}
|
|
//mygrid_recv.deleteSelectedRows();
|
|
dg.close();
|
|
//alert("恢复失败");
|
|
}
|
|
|
|
// if(loadVal > 0 ){
|
|
//
|
|
// }else{
|
|
// dg.close();
|
|
// alert("恢复失败");
|
|
// }
|
|
//doInitRecvGrid();
|
|
}else{
|
|
return;
|
|
}
|
|
}else{
|
|
alert("未选中要操作的费用项");
|
|
|
|
}
|
|
}
|
|
//放弃应付费用修改 重新加载页面
|
|
function recoverPayChange(){
|
|
var selRowID = commonGridObj_new.getSelectedRowId();
|
|
//查看是否有被选中的费用项
|
|
if(selRowID != null){
|
|
var rowIndex = commonGridObj_new.getRowIndex(selRowID);
|
|
|
|
var feeName = commonGridObj_new.cellByIndex(rowIndex,1).getValue();
|
|
var cusName = commonGridObj_new.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="+selRowID+"&handle=recover";
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
if(!IsNum(loadVal)){
|
|
var recvArg = new Array();
|
|
recvArg = loadVal.split(",");
|
|
|
|
var selRowIndex = commonGridObj_new.getRowIndex(recvArg[0]);
|
|
|
|
var colCount = commonGridObj_new.getColumnsNum();
|
|
for(var i=1;i<colCount;i++){
|
|
commonGridObj_new.cellByIndex(selRowIndex,i).setValue(recvArg[i]);
|
|
}
|
|
dg.close();
|
|
alert("恢复成功");
|
|
|
|
}else{
|
|
if(parseInt(loadVal) == -3){
|
|
commonGridObj_new.cellByIndex(rowIndex,1).setValue("");
|
|
|
|
commonGridObj_new.cellByIndex(rowIndex,2).setValue("");
|
|
commonGridObj_new.cellByIndex(rowIndex,3).setValue("");
|
|
commonGridObj_new.cellByIndex(rowIndex,4).setValue(0);
|
|
commonGridObj_new.cellByIndex(rowIndex,5).setValue(0);
|
|
commonGridObj_new.cellByIndex(rowIndex,6).setValue(0);
|
|
commonGridObj_new.cellByIndex(rowIndex,7).setValue(0);
|
|
commonGridObj_new.cellByIndex(rowIndex,8).setValue("RMB");
|
|
commonGridObj_new.cellByIndex(rowIndex,9).setValue(1);
|
|
commonGridObj_new.cellByIndex(rowIndex,10).setValue("");
|
|
commonGridObj_new.cellByIndex(rowIndex,11).setValue("");
|
|
commonGridObj_new.cellByIndex(rowIndex,12).setValue(false);
|
|
|
|
}
|
|
//mygrid_recv.deleteSelectedRows();
|
|
dg.close();
|
|
}
|
|
//alert(loadVal);
|
|
//doInitRecvGrid();
|
|
}else{
|
|
return;
|
|
}
|
|
}else{
|
|
alert("未选中要操作的费用项");
|
|
|
|
}
|
|
}
|
|
|
|
function print_recv(){
|
|
alert("正在打印");
|
|
}
|
|
|
|
function print_pay(){
|
|
alert("正在打印");
|
|
}
|
|
//动态计算费用利润信息
|
|
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, 1);
|
|
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,8);
|
|
//获取当前行币别类型
|
|
var value = cell.getValue().toLowerCase();
|
|
//获取总金额
|
|
var amount = parseFloat(ConvertToMoney(mygrid_recv.cellById(rId,7).getValue()));
|
|
if(amount.toString().toLowerCase() == "nan"){
|
|
amount = 0.0;
|
|
}
|
|
|
|
var exchangeRate_recv = 0.0;//当前对应汇率比率
|
|
exchangeRate_recv = parseFloat(mygrid_recv.cellById(rId,9).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 = commonGridObj_new.getRowsNum();
|
|
//计算应收费用
|
|
for(var j = 0;j<rowCount_pay;j++){
|
|
//获取Row GID
|
|
var rowID = commonGridObj_new.getRowId(j);
|
|
//费用名称
|
|
var sfeename = rowCount_pay.cellById(rowID, 1);
|
|
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 = commonGridObj_new.cellById(rowID,8);
|
|
//获取当前行币别类型
|
|
var pay_value = cell_pay.getValue().toLowerCase();
|
|
//获取总金额
|
|
var amount = parseFloat(ConvertToMoney(commonGridObj_new.cellById(rowID,7).getValue()));
|
|
if(amount.toString().toLowerCase() == "nan"){
|
|
amount = 0.0;
|
|
}
|
|
|
|
var exchangeRate_pay = 0.0;//当前对应汇率比率
|
|
exchangeRate_pay = parseFloat(commonGridObj_new.cellById(rowID,9).getValue());
|
|
|
|
switch(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="<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 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){
|
|
if(selGroup.length > 1){
|
|
var delCount = 0;
|
|
var loadVal = 0;
|
|
if(window.confirm("您确定批准通过所选应收费用")){
|
|
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 = "../AuditProcess/AuditService.aspx?handle=audit&oplb=" + stroplb + "&id=" + selGroup[delCount] + "&val=" + newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
loadVal = loader.xmlDoc.responseText;
|
|
if(loadVal > 0 ){
|
|
}else{
|
|
}
|
|
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{
|
|
var delCount = 0;
|
|
var loadVal = 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 urlVal = "../AuditProcess/AuditService.aspx?handle=audit&oplb="+stroplb+"&id="+selGroup[delCount]+"&val="+newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
loadVal = loader.xmlDoc.responseText;
|
|
if(loadVal > 0 ){
|
|
doInitRecvGrid();
|
|
}else{
|
|
}
|
|
}
|
|
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("未选中要操作的费用项");
|
|
|
|
}
|
|
}
|
|
|
|
function orderPayAudit(){
|
|
var selRowID = commonGridObj_new.getSelectedRowId();
|
|
var selGroup = new Array();
|
|
if(selRowID.indexOf(",") > 0){
|
|
selGroup = selRowID.split(",");
|
|
}else{
|
|
if(selRowID != null){
|
|
selGroup.push(selRowID);
|
|
}
|
|
}
|
|
//查看是否有被选中的费用项
|
|
if(selGroup.length > 0){
|
|
if(selGroup.length > 1){
|
|
var delCount = 0;
|
|
var loadVal = 0;
|
|
if(window.confirm("您确定批准通过所选应收费用")){
|
|
while(delCount < selGroup.length){
|
|
var rowIndex = commonGridObj_new.getRowIndex(selGroup[delCount]);
|
|
var feeName = commonGridObj_new.cellByIndex(rowIndex,1).getValue();
|
|
var cusName = commonGridObj_new.cellByIndex(rowIndex,2).getValue();
|
|
var urlVal = "../AuditProcess/AuditService.aspx?handle=audit&oplb=" + stroplb + "&id=" + selGroup[delCount] + "&val=" + newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
loadVal = loader.xmlDoc.responseText;
|
|
if(loadVal > 0 ){
|
|
}else{
|
|
}
|
|
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{
|
|
var delCount = 0;
|
|
var loadVal = 0;
|
|
while(delCount < selGroup.length){
|
|
var rowIndex = commonGridObj_new.getRowIndex(selGroup[delCount]);
|
|
var feeName = commonGridObj_new.cellByIndex(rowIndex,1).getValue();
|
|
var cusName = commonGridObj_new.cellByIndex(rowIndex,2).getValue();
|
|
if(window.confirm("您确定要将 应收费用("+feeName+") 批准通过")){
|
|
var urlVal = "../AuditProcess/AuditService.aspx?handle=audit&oplb="+stroplb+"&id="+selGroup[delCount]+"&val="+newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
loadVal = loader.xmlDoc.responseText;
|
|
|
|
if(loadVal > 0 ){
|
|
doInitRecvGrid();
|
|
}else{
|
|
}
|
|
}
|
|
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("未选中要操作的费用项");
|
|
}
|
|
}
|
|
|
|
function orderRecvModify(){
|
|
var selRowID = mygrid_recv.getSelectedRowId();
|
|
//查看是否有被选中的费用项
|
|
if(selRowID != null){
|
|
var rowIndex = mygrid_recv.getRowIndex(selRowID);
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,1).getValue();
|
|
var cusName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
if(window.confirm("您确定要将 应收费用("+feeName+") 提交申请修改")){
|
|
}
|
|
}else{
|
|
alert("未选中要操作的费用项");
|
|
}
|
|
}
|
|
|
|
function orderPayModify(){
|
|
var selRowID = commonGridObj_new.getSelectedRowId();
|
|
//查看是否有被选中的费用项
|
|
if(selRowID != null){
|
|
var rowIndex = mygrid_recv.getRowIndex(selRowID);
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,1).getValue();
|
|
var cusName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
if(window.confirm("您确定要将 应付费用("+feeName+") 提交申请修改")){
|
|
}
|
|
}else{
|
|
alert("未选中要操作的费用项");
|
|
}
|
|
}
|
|
|
|
function orderRecvDelete(){
|
|
var selRowID = mygrid_recv.getSelectedRowId();
|
|
//查看是否有被选中的费用项
|
|
if(selRowID != null){
|
|
var rowIndex = mygrid_recv.getRowIndex(selRowID);
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,1).getValue();
|
|
var cusName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
if(window.confirm("您确定要将 应收费用("+feeName+") 提交申请删除")){
|
|
}
|
|
}else{
|
|
alert("未选中要操作的费用项");
|
|
}
|
|
}
|
|
|
|
function orderPayDelete(){
|
|
var selRowID = commonGridObj_new.getSelectedRowId();
|
|
//查看是否有被选中的费用项
|
|
if(selRowID != null){
|
|
var rowIndex = mygrid_recv.getRowIndex(selRowID);
|
|
|
|
var feeName = mygrid_recv.cellByIndex(rowIndex,1).getValue();
|
|
var cusName = mygrid_recv.cellByIndex(rowIndex,2).getValue();
|
|
if(window.confirm("您确定要将 应付费用("+feeName+") 提交申请删除")){
|
|
}
|
|
}else{
|
|
alert("未选中要操作的费用项");
|
|
}
|
|
}
|
|
|
|
function ReShowLabel(gridObj){
|
|
var columnCount = gridObj.getColumnsNum();
|
|
var rowCount = gridObj.getRowsNum();
|
|
if (columnCount==14){
|
|
$("txt_reason").value=gridObj.cellByIndex(0,13).getValue();
|
|
}
|
|
if(rowCount > 0){
|
|
for(var i = 0;i<rowCount;i++){
|
|
for(var j = 0;j<columnCount;j++){
|
|
if(j == 1 || j == 2){
|
|
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(".","$#$").replace(/\./g,"").replace("$#$",".");
|
|
|
|
return valObj;
|
|
}
|
|
|
|
function saveOld(){
|
|
var bsno = $("h_bsno").value.trim();
|
|
jsonPayObj = "{\"$type\":\"DSWeb.Models.JsonFeeGroupEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",\"JsonFeeEntities\":[";
|
|
column_count = commonGridObj_old.getColumnsNum();
|
|
|
|
var tempJson = "";
|
|
var rowCount = commonGridObj_old.getRowsNum();
|
|
for(var i = 0;i < rowCount;i++){
|
|
//获取RowID
|
|
|
|
tempJson = "";
|
|
var rId = commonGridObj_old.getRowId(i);
|
|
|
|
tempJson += "\"$type\":\"DSWeb.Models.JsonFeeEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",";
|
|
tempJson += "\"fee1\":\""+rId+"\",";//gid
|
|
//tempJson += "\"fee1\":\""+2222+"\",";
|
|
|
|
for(var j=0;j < column_count;j++){
|
|
var cell = commonGridObj_old.cellById(rId,j);
|
|
var value = "";
|
|
value = cell.getValue();
|
|
|
|
if(value == ""){
|
|
value = "null";
|
|
}
|
|
switch(j){
|
|
case 0:
|
|
case 1:
|
|
case 2:
|
|
case 3:
|
|
case 8:
|
|
case 10:
|
|
case 11:
|
|
tempJson += "\"fee"+(j+2)+"\":\""+value+"\",";
|
|
break;
|
|
case 12:
|
|
if(value == 1){
|
|
value = true;
|
|
}else{
|
|
value = false;
|
|
}
|
|
tempJson += "\"fee"+(j+2)+"\":"+value+",";
|
|
|
|
break;
|
|
default:
|
|
tempJson += "\"fee"+(j+2)+"\":"+ConvertToMoney(value)+",";
|
|
}
|
|
//tempJson += "\"fun"+(j+2)+"\":\"false\"";
|
|
|
|
}
|
|
tempJson += "\"fee15\":\""+bsno+"\"";
|
|
//tempJson += "\"fee"+14+"\":true";
|
|
tempJson = "{"+tempJson+"}";
|
|
|
|
|
|
if(i == rowCount - 1){
|
|
jsonPayObj = jsonPayObj+tempJson;
|
|
}else{
|
|
jsonPayObj = jsonPayObj+tempJson+",";
|
|
}
|
|
}
|
|
jsonPayObj += "]}";
|
|
|
|
|
|
var txt_old = $("h_old");
|
|
txt_old.value = jsonPayObj;
|
|
|
|
return true;
|
|
}
|
|
|
|
function saveNew(){
|
|
var bsno = $("h_bsno").value.trim();
|
|
jsonPayObj = "{\"$type\":\"DSWeb.Models.JsonFeeGroupEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",\"JsonFeeEntities\":[";
|
|
column_count = commonGridObj_new.getColumnsNum();
|
|
|
|
var tempJson = "";
|
|
var rowCount = commonGridObj_new.getRowsNum();
|
|
for(var i = 0;i < rowCount;i++){
|
|
//获取RowID
|
|
|
|
tempJson = "";
|
|
var rId = commonGridObj_new.getRowId(i);
|
|
|
|
tempJson += "\"$type\":\"DSWeb.Models.JsonFeeEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",";
|
|
tempJson += "\"fee1\":\""+rId+"\",";//gid
|
|
//tempJson += "\"fee1\":\""+2222+"\",";
|
|
|
|
for(var j=0;j < column_count;j++){
|
|
var cell = commonGridObj_new.cellById(rId,j);
|
|
var value = "";
|
|
value = cell.getValue();
|
|
|
|
if(value == ""){
|
|
value = "null";
|
|
}
|
|
switch(j){
|
|
case 0:
|
|
case 1:
|
|
case 2:
|
|
case 3:
|
|
case 8:
|
|
case 10:
|
|
case 11:
|
|
tempJson += "\"fee"+(j+2)+"\":\""+value+"\",";
|
|
break;
|
|
case 12:
|
|
if(value == 1){
|
|
value = true;
|
|
}else{
|
|
value = false;
|
|
}
|
|
tempJson += "\"fee"+(j+2)+"\":"+value+",";
|
|
|
|
break;
|
|
default:
|
|
tempJson += "\"fee"+(j+2)+"\":"+ConvertToMoney(value)+",";
|
|
}
|
|
//tempJson += "\"fun"+(j+2)+"\":\"false\"";
|
|
|
|
}
|
|
tempJson += "\"fee15\":\""+bsno+"\"";
|
|
//tempJson += "\"fee"+14+"\":true";
|
|
tempJson = "{"+tempJson+"}";
|
|
|
|
|
|
if(i == rowCount - 1){
|
|
jsonPayObj = jsonPayObj+tempJson;
|
|
}else{
|
|
jsonPayObj = jsonPayObj+tempJson+",";
|
|
}
|
|
}
|
|
|
|
//jsonFeeObj = jsonFeeObj +"{"+ tempJson +"}";
|
|
jsonPayObj += "]}";
|
|
|
|
var txt_new = $("h_new");
|
|
txt_new.value = jsonPayObj;
|
|
|
|
$("h_reason").value = $("txt_reason").value;
|
|
$("h_do").value = "1";
|
|
|
|
return true;
|
|
}
|
|
|
|
function postChange(){
|
|
//saveOld();
|
|
//saveNew();
|
|
|
|
if(saveOld() && saveNew()){
|
|
postEnterFee();
|
|
|
|
//setTimeout(function(){
|
|
window.parent.opener.location.href = window.parent.opener.location.href;
|
|
//},300);
|
|
}
|
|
//setTimeout(,200);
|
|
|
|
|
|
|
|
// exit();
|
|
}
|
|
|
|
function exit(){
|
|
window.opener='null';
|
|
window.close();
|
|
}
|
|
//查看当前更改申请是否提交成功
|
|
function validApplyStatus(){
|
|
|
|
}
|
|
|
|
function audtPass(){
|
|
$("h_do").value = "2";
|
|
postEnterFee();
|
|
}
|
|
|
|
function auditReject(){
|
|
$("h_do").value = "3";
|
|
postEnterFee();
|
|
}
|
|
|
|
function selectChangeEvent(){
|
|
initGrid();
|
|
}
|
|
|
|
function printModify(){
|
|
var postState = 0;
|
|
var typeName = "";
|
|
postState = parseInt($("h_applystate").value);
|
|
|
|
if(postState == 1){
|
|
var printUrl = "";
|
|
var companyID = "";
|
|
var typeName = "FEEMODIFIED";
|
|
var dbSourceID = "";
|
|
var userID = "";
|
|
var url = "";
|
|
var oldGid = "";
|
|
var newGid = "";
|
|
if(commonGridObj_old != null){
|
|
oldGid = commonGridObj_old.getRowId(0);
|
|
}
|
|
|
|
if(commonGridObj_new != null){
|
|
newGid = commonGridObj_new.getRowId(0);
|
|
}
|
|
|
|
url = "../Reports/ReportService.aspx?handle=printmodify&oldfeeid="+oldGid+"&newfeeid="+newGid+"&val="+newGuid();
|
|
typeName = "FEEMODIFIED";
|
|
|
|
|
|
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;
|
|
}
|
|
}else{
|
|
alert("费用未保存不能打印");
|
|
return;
|
|
}
|
|
} |