|  | @@ -10,7 +10,7 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const RptMemBase = require('./base');
 | 
	
		
			
				|  |  |  const bindData = {};
 | 
	
		
			
				|  |  | -const changeConst = require('../const/change');
 | 
	
		
			
				|  |  | +const changeConst = require('../../const/change');
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  class rptMemChange extends RptMemBase {
 | 
	
		
			
				|  |  |      constructor(ctx) {
 | 
	
	
		
			
				|  | @@ -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({ where: { 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,9 +58,10 @@ 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) {
 | 
	
	
		
			
				|  | @@ -93,4 +94,4 @@ class rptMemChange extends RptMemBase {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -module.exports = rptMemChange;
 | 
	
		
			
				|  |  | +module.exports = rptMemChange;
 |