|  | @@ -454,16 +454,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |              let contract_tp = 0;
 | 
	
		
			
				|  |  |              let qc_tp = 0;
 | 
	
		
			
				|  |  |              for (const stage of stage_list) {
 | 
	
		
			
				|  |  | -                const sql = 'SELECT Sum(`contract_tp`) As `contract_tp`, Sum(`qc_tp`) As `qc_tp` FROM ' + this.tableName + ' As Bills ' +
 | 
	
		
			
				|  |  | -                    '  INNER JOIN ( ' +
 | 
	
		
			
				|  |  | -                    '    SELECT MAX(`times` * ' + timesLen + ' + `order`) As `flow`, `lid` From ' + this.tableName +
 | 
	
		
			
				|  |  | -                    '      WHERE `times` <= ? AND `order` <= ?' +
 | 
	
		
			
				|  |  | -                    '      GROUP BY `lid`' +
 | 
	
		
			
				|  |  | -                    '  ) As MaxFilter ' +
 | 
	
		
			
				|  |  | -                    '  ON (Bills.times * ' + timesLen + ' + `order`) = MaxFilter.flow And Bills.lid = MaxFilter.lid' +
 | 
	
		
			
				|  |  | -                    '  WHERE Bills.sid = ?';
 | 
	
		
			
				|  |  | -                const sqlParam = [stage.curTimes, stage.curOrder, stage.id];
 | 
	
		
			
				|  |  | -                const result = await this.db.queryOne(sql, sqlParam);
 | 
	
		
			
				|  |  | +                const result = await this.getSumTotalPrice(stage);
 | 
	
		
			
				|  |  |                  if (result) {
 | 
	
		
			
				|  |  |                      contract_tp = this.ctx.helper.add(contract_tp, result.contract_tp);
 | 
	
		
			
				|  |  |                      qc_tp = this.ctx.helper.add(qc_tp, result.qc_tp);
 | 
	
	
		
			
				|  | @@ -476,12 +467,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |              let contract_tp = 0;
 | 
	
		
			
				|  |  |              let qc_tp = 0;
 | 
	
		
			
				|  |  |              for (const stage of stage_list) {
 | 
	
		
			
				|  |  | -                let result = null;
 | 
	
		
			
				|  |  | -                if (regText) {
 | 
	
		
			
				|  |  | -                    result = await this.getSumTotalPriceFilter(stage, 'REGEXP', regText);
 | 
	
		
			
				|  |  | -                } else {
 | 
	
		
			
				|  |  | -                    result = await this.getSumTotalPriceFilter(stage, '<>', this.db.escape(''));
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | +                const result = await this.getSumTotalPriceGcl(stage, regText);
 | 
	
		
			
				|  |  |                  if (result) {
 | 
	
		
			
				|  |  |                      contract_tp = this.ctx.helper.add(contract_tp, result.contract_tp);
 | 
	
		
			
				|  |  |                      qc_tp = this.ctx.helper.add(qc_tp, result.qc_tp);
 |