浏览代码

变更清单,取值调整

MaiXinRong 5 年之前
父节点
当前提交
0b916ee4b4
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      app/service/change_audit_list.js

+ 5 - 4
app/service/change_audit_list.js

@@ -24,11 +24,12 @@ module.exports = app => {
         }
 
         async gatherBgBills (tid) {
-            const sql = 'SELECT code, name, unit, unit_price, Sum(camount) as quantity' +
-                '  FROM ' + this.tableName +
-                '  WHERE tid = ?' +
+            const sql = 'SELECT cb.code, cb.name, cb.unit, cb.unit_price, Sum(cb.samount + 0) as quantity' +
+                '  FROM ' + this.tableName + ' cb' +
+                '  LEFT JOIN ' + this.ctx.service.change.tableName + ' c ON cb.cid = c.cid' +
+                '  WHERE cb.tid = ? and c.status = ?' +
                 '  GROUP BY code, name, unit, unit_price';
-            const param = [tid];
+            const param = [tid, audit.flow.status.checked];
             const result = await this.db.query(sql, param);
             for (const b of result) {
                 b.total_price = this.ctx.helper.mul(b.unit_price, b.quantity, this.ctx.tender.info.decimal.tp);