Commit 57d1dd64 by 孙亚楠

增加算法编码

parent 766b3054
...@@ -186,7 +186,7 @@ class ApplyService extends ServiceBase { ...@@ -186,7 +186,7 @@ class ApplyService extends ServiceBase {
params.status = "1000"; params.status = "1000";
params.customerStatus = "1000"; params.customerStatus = "1000";
params.ruleCode = this.trim(params.ruleCode); params.ruleCode = this.trim(params.ruleCode);
params.ruleParams = JSON.stringify(params.ruleParams); params.ruleParams = JSON.stringify(params);
await this.db.transaction(async (t) => { await this.db.transaction(async (t) => {
//插入发票申请单 //插入发票申请单
......
...@@ -124,34 +124,6 @@ let calTaxPersonal=(x2, taxPer, quiCalDed, cumulativeProfit)=>{ ...@@ -124,34 +124,6 @@ let calTaxPersonal=(x2, taxPer, quiCalDed, cumulativeProfit)=>{
return (new Decimal(x2).mul(taxPer).div(100).sub(quiCalDed).sub(cumulativeProfit)).toFixed(2); return (new Decimal(x2).mul(taxPer).div(100).sub(quiCalDed).sub(cumulativeProfit)).toFixed(2);
} }
/**
* 计算税率值
* @param {*} amount 金额
* @param {*} taxRange 税率范围
* @param {*} type 类型 1:个税 2 增值税
*/
// let calRateRange=(amount, taxRange, type)=>{
// let res = {};
// if (type === PER_TAX) {
// for (let item of taxRange) {
// if (item.minValue <= amount && amount <= item.maxValue) {
// res.taxPer = item.rate;
// res.quiCalDed = item.quiCalDed;
// break;
// }
// }
// } else {
// for (let item of taxRange) {
// if (item.minValue <= amount && amount <= item.maxValue) {
// res.valAddTaxRat = item.zengzhiRate;
// res.addTaxRat = item.fujiaRate;
// break;
// }
// }
// }
// return res;
// }
/** /**
* 计算增值税 * 计算增值税
......
...@@ -11,10 +11,12 @@ module.exports={ ...@@ -11,10 +11,12 @@ module.exports={
*/ */
"10":{ "10":{
MAX_AMOUNT:500000000, MAX_AMOUNT:500000000,
WARNING_AMOUNT:400000000 WARNING_AMOUNT:400000000,
algorithmCode:"10"
}, },
"20":{ "20":{
MAX_AMOUNT:400000000, MAX_AMOUNT:400000000,
WARNING_AMOUNT:300000000 WARNING_AMOUNT:300000000,
algorithmCode:"10"
} }
} }
\ No newline at end of file
...@@ -14,8 +14,8 @@ module.exports.dispatcher=async (params)=>{ ...@@ -14,8 +14,8 @@ module.exports.dispatcher=async (params)=>{
return system.getResult(-1,`参数错误 销售方类型不能为空`); return system.getResult(-1,`参数错误 销售方类型不能为空`);
} }
//加载算法类 //加载算法类
let businessmenType = common.trim(params.businessmenType); let ruleCode = common.trim(params.ruleCode);
let filePath =`./algorithm/calInvoice${businessmenType}`; let filePath =`./algorithm/calInvoice${ruleCode}`;
console.log(filePath); console.log(filePath);
let calInvApi = require(filePath); let calInvApi = require(filePath);
if(!calInvApi){ if(!calInvApi){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment