Browse Source

限额相关

MaiXinRong 1 năm trước cách đây
mục cha
commit
3f3f8f69d2
2 tập tin đã thay đổi với 6 bổ sung6 xóa
  1. 4 4
      app/service/stage_change.js
  2. 2 2
      app/service/stage_change_final.js

+ 4 - 4
app/service/stage_change.js

@@ -809,8 +809,8 @@ module.exports = app => {
             const stageChange = await this.ctx.service.stageChange.getAllDataByCondition({ where: { sid: stage.id, lid }});
 
             const useModal = new autoUseChange(this.ctx.helper, tender.info);
-            const projectFunInfo = await this.ctx.service.project.getFunRela(ctx.session.sessionProject.id);
-            const minusNoValue = projectFunInfo.minusNoValue && ctx.tender.info.fun_rela.stage_change.minusNoValue;
+            const projectFunInfo = await this.ctx.service.project.getFunRela(this.ctx.session.sessionProject.id);
+            const minusNoValue = projectFunInfo.minusNoValue && tender.info.fun_rela.stage_change.minusNoValue;
             useModal.use({ledgerData, posData, stageBills, stagePos, stageChange, default: { tid: stage.tid, sid: stage.id, said: this.ctx.session.sessionUser.accountId } }, validChangeBills, minusNoValue);
 
             const conn = await this.db.beginTransaction();
@@ -858,8 +858,8 @@ module.exports = app => {
             const stageBills = await this.ctx.service.stageBills.getAllDataByCondition({ where: { sid: stage.id } });
             const stagePos = await this.ctx.service.stagePos.getAllDataByCondition({ where: { sid: stage.id } });
             const useModal = new autoUseChange(this.ctx.helper, tender.info, this.ctx.service.settle.settleStatus);
-            const projectFunInfo = await this.ctx.service.project.getFunRela(ctx.session.sessionProject.id);
-            const minusNoValue = projectFunInfo.minusNoValue && ctx.tender.info.fun_rela.stage_change.minusNoValue;
+            const projectFunInfo = await this.ctx.service.project.getFunRela(this.ctx.session.sessionProject.id);
+            const minusNoValue = projectFunInfo.minusNoValue && tender.info.fun_rela.stage_change.minusNoValue;
             useModal.use({ledgerData, posData, stageBills, stagePos, default: { tid: stage.tid, sid: stage.id, said: this.ctx.session.sessionUser.accountId } }, validChangeBills, minusNoValue);
 
             // if (useModal.insertChange.length === 0) return '无可调用的清单或计量单元';

+ 2 - 2
app/service/stage_change_final.js

@@ -105,7 +105,7 @@ module.exports = app => {
             return changeBills.filter(cb => {
                 cb.qty = parseFloat(cb.samount);
                 const qtyDecimal = self.ctx.helper.findDecimal(changeBills.unit);
-                cb.limitQty = self.ctx.helper.mul(qty, self.ctx.helper.div(changeBills.delimit, 100, 2), qtyDecimal);
+                cb.limitQty = self.ctx.helper.mul(cb.qty, self.ctx.helper.div(changeBills.delimit, 100, 2), qtyDecimal);
                 cb.valid_qty = self.ctx.helper.sub(cb.limitQty, cb.used_qty);
                 return cb.valid_qty;
             });
@@ -125,7 +125,7 @@ module.exports = app => {
             return changeBills.filter(cb => {
                 cb.qty = parseFloat(cb.samount);
                 const qtyDecimal = self.ctx.helper.findDecimal(changeBills.unit);
-                cb.limitQty = self.ctx.helper.mul(qty, self.ctx.helper.div(changeBills.delimit, 100, 2), qtyDecimal);
+                cb.limitQty = self.ctx.helper.mul(cb.qty, self.ctx.helper.div(changeBills.delimit, 100, 2), qtyDecimal);
                 cb.valid_qty = self.ctx.helper.sub(cb.limitQty, cb.used_qty);
                 return cb.valid_qty;
             });