|  | @@ -130,7 +130,7 @@ module.exports = app => {
 | 
												
													
														
															|  |                      newMaterial.rate = preMaterial.rate;
 |  |                      newMaterial.rate = preMaterial.rate;
 | 
												
													
														
															|  |                      newMaterial.pre_tp = this.ctx.helper.add(preMaterial.m_tp, preMaterial.pre_tp);
 |  |                      newMaterial.pre_tp = this.ctx.helper.add(preMaterial.m_tp, preMaterial.pre_tp);
 | 
												
													
														
															|  |                      newMaterial.ex_pre_tp = this.ctx.helper.add(preMaterial.ex_tp, preMaterial.ex_pre_tp);
 |  |                      newMaterial.ex_pre_tp = this.ctx.helper.add(preMaterial.ex_tp, preMaterial.ex_pre_tp);
 | 
												
													
														
															|  | -                    newMaterial.tax_pre_tp = this.ctx.helper.add(preMaterial.m_tax_tp, preMaterial.tax_pre_tp);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                    newMaterial.m_tax_pre_tp = this.ctx.helper.add(preMaterial.m_tax_tp, preMaterial.m_tax_pre_tp);
 | 
												
													
														
															|  |                  }
 |  |                  }
 | 
												
													
														
															|  |                  // 新增期记录
 |  |                  // 新增期记录
 | 
												
													
														
															|  |                  const result = await transaction.insert(this.tableName, newMaterial);
 |  |                  const result = await transaction.insert(this.tableName, newMaterial);
 | 
												
											
												
													
														
															|  | @@ -335,6 +335,12 @@ module.exports = app => {
 | 
												
													
														
															|  |              const info = await this.getDataById(id);
 |  |              const info = await this.getDataById(id);
 | 
												
													
														
															|  |              return info.m_tax_tp;
 |  |              return info.m_tax_tp;
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        async getSumMaterial(tid) {
 | 
												
													
														
															|  | 
 |  | +            const sql = 'Select sum(m_tp + ex_tp) as tp From ' + this.tableName + ' where tid = ?';
 | 
												
													
														
															|  | 
 |  | +            const result = await this.db.queryOne(sql, [tid]);
 | 
												
													
														
															|  | 
 |  | +            return result ? result.tp : 0;
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  |      }
 |  |      }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |      return Material;
 |  |      return Material;
 |