MaiXinRong пре 1 година
родитељ
комит
923f4e8ddf
1 измењених фајлова са 6 додато и 7 уклоњено
  1. 6 7
      app/lib/rm/change.js

+ 6 - 7
app/lib/rm/change.js

@@ -18,7 +18,7 @@ class rptMemChange extends RptMemBase {
     }
 
     async _anaylisChange(change) {
-        const types = ctx.helper._.map(change.type.split(','), function(t) {
+        const types = ctx.helper._.map(change.type.split(','), function (t) {
             return self._getChangeConstName(changeConst.type, ctx.helper._.toInteger(t));
         });
         change.type = types.join(';');
@@ -29,7 +29,7 @@ class rptMemChange extends RptMemBase {
 
     async doCheckChange(changeId) {
         if (this.ctx.change) return;
-        this.ctx.change = await this.ctx.service.change.getDataByCondition({ where: { cid: changeId } });
+        this.ctx.change = await this.ctx.service.change.getDataByCondition({ cid: changeId });
         this._anaylisChange(this.ctx.change);
     }
 
@@ -46,7 +46,7 @@ class rptMemChange extends RptMemBase {
     }
 
     async _getChangeBills() {
-        const changeBills = await this.ctx.service.changeAuditList.getAllDataByCondition({ where: { cid: this.ctx.change.cid } });
+        const changeBills = await this.ctx.service.changeAuditList.getAllDataByCondition({ where: { cid: this.ctx.change.cid} });
         for (const d of changeBills) {
             d.o_qty = d.oamount;
             d.o_tp = this.ctx.helper.mul(d.o_qty, d.unit_price, decimal.tp);
@@ -58,10 +58,9 @@ class rptMemChange extends RptMemBase {
             d.sp_tp = this.ctx.helper.mul(d.sp_qty, d.unit_price, decimal.tp);
 
             const auditAmount = d.audit_amount ? d.audit_amount.split(',') : [];
-            const relaChange = ctx.helper._.find(change, { cid: d.cid });
+            const relaChange = ctx.helper._.find(change, {cid: d.cid});
             for (const [i, aa] of auditAmount.entries()) {
-                const amountField = 'qty_' + (i + 1),
-                    tpField = 'tp_' + (i + 1);
+                const amountField = 'qty_' + (i+1), tpField = 'tp_' + (i+1);
                 d[amountField] = aa ? parseFloat(aa) : 0;
                 d[tpField] = ctx.helper.mul(d[amountField], d.unit_price, decimal.tp);
                 if (relaChange) {
@@ -94,4 +93,4 @@ class rptMemChange extends RptMemBase {
     }
 }
 
-module.exports = rptMemChange;
+module.exports = rptMemChange;