Skip to content

Commit

Permalink
Add convert currency
Browse files Browse the repository at this point in the history
  • Loading branch information
coding-and-trading committed Nov 4, 2017
1 parent 42d059d commit 1051414
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions CompanyCommonTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,35 @@ var ligerHelper = (function () {
return {
getSingleFilter: getSingleFilter
};
})();

// 与财务相关的辅助方法
var financialHelper = (function () {
var chnNumChar = ["零","一","二","三","四","五","六","七","八","九"],
chnUnitSection = ["","万","亿","万亿","亿亿"],
chnUnitChar = ["","十","百","千"],
SectionToChinese;

SectionToChinese = function (section){
var strIns = '', chnStr = '';
var unitPos = 0;
var zero = true;
while(section > 0){
var v = section % 10;
if(v === 0){
if(!zero){
zero = true;
chnStr = chnNumChar[v] + chnStr;
}
}else{
zero = false;
strIns = chnNumChar[v];
strIns += chnUnitChar[unitPos];
chnStr = strIns + chnStr;
}
unitPos++;
section = Math.floor(section / 10);
}
return chnStr;
}
})();

0 comments on commit 1051414

Please sign in to comment.