Przeglądaj źródła

修复调差建筑税统计bug

ellisran 7 miesięcy temu
rodzic
commit
bc83204e9c
1 zmienionych plików z 12 dodań i 0 usunięć
  1. 12 0
      app/service/material_list.js

+ 12 - 0
app/service/material_list.js

@@ -285,6 +285,18 @@ module.exports = app => {
                 m_tp: tp.total_price,
                 m_tax_tp: tp.tax_total_price,
             };
+            // 计算建筑税价
+            if (this.ctx.material.is_stage_self) {
+                const materialStages = await transaction.select(this.ctx.service.materialStage.tableName, { where: { mid: this.ctx.material.id } });
+                let rate_tp = 0;
+                for (const ms of materialStages) {
+                    const ms_rate_tp = this.ctx.helper.round(this.ctx.helper.mul(ms.m_tp, 1 + this.ctx.material.rate / 100), this.ctx.material.decimal.tp);
+                    rate_tp = this.ctx.helper.add(rate_tp, ms_rate_tp);
+                }
+                updateData2.rate_tp = rate_tp;
+            } else {
+                updateData2.rate_tp = this.ctx.helper.round(this.ctx.helper.mul(tp.total_price, 1 + this.ctx.material.rate / 100), this.ctx.material.decimal.tp);
+            }
             const result = await transaction.update(this.ctx.service.material.tableName, updateData2);
             // 找出当前人并更新tp_data
             const tp_data = await this.ctx.service.materialAudit.getTpData(transaction, this.ctx.material.id);