setExpenseAndAmountSum: function() {
var detailList = vehicleVueObj.vehicleData;
var expenseAmountSum = "";//報銷金額
var expenseAmountMap = new Map();//存放key爲幣種符號,value爲報銷某一幣種的合計
var invoiceCountSum = 0;
// var expenseAmountTotalMap = new Map();
if (detailList != undefined && detailList.length > 0){
for (var i = 0;i < detailList.length;i++) {
if(detailList[i]!=null){
//報銷金額總和
var currencyNo = detailList[i]["currencySymbol"];//幣別符號
var expenseAmount = detailList[i]["expenseAmount"];//報銷金額
if(!detailList[i]["ifSettlement"]){ //去掉 統一結算的狀況
var travelExpenseAmountTotal = Supp.Util.add(Number(expenseAmountMap.get(currencyNo) || 0) , Number(expenseAmount));
if(currencyNo!=null){
expenseAmountMap.set(currencyNo,travelExpenseAmountTotal);
}
}
//票據的總數量
var invoiceCount = detailList[i]["invoiceCount"];
if(!isNaN(invoiceCount) && invoiceCount != "") {
invoiceCountSum = Supp.Util.add(invoiceCountSum,invoiceCount);
}
vehicleVueObj.titleSumData["invoiceCountSum"] = invoiceCountSum;
}
}
}
//報銷金額總和
if (expenseAmountMap != undefined && expenseAmountMap.size > 0) {
var varEntries = expenseAmountMap.entries();
var keyPairList = [];
for (var k = 0;k < 50;k++) {
keyPairList.push(varEntries.next().value);
}
for (var indexPair = 0;indexPair < keyPairList.length; indexPair++) {
if(keyPairList[indexPair] != undefined){
var keyPair = keyPairList[indexPair];
var bibie = keyPair[0];
var money = keyPair[1];
expenseAmountSum += bibie + money + " ";
}
}
vehicleVueObj.titleSumData["expenseAmountSum"] = expenseAmountSum;
}
}