Преглед изворни кода

责任成本,审批流程配置

MaiXinRong пре 8 часа
родитељ
комит
1d2566a920

+ 2 - 0
app/const/shenpi.js

@@ -34,6 +34,7 @@ const cost_sp_type = {
     cost_stage_ledger: 13,
     cost_stage_book: 14,
     cost_stage_analysis: 15,
+    cost_duty: 17,
 };
 // const sp_name = [];
 // sp_name[sp_type.advance] = '预付款审批';
@@ -62,6 +63,7 @@ const cost_sp_lc = [
     { code: 'cost_stage_ledger', type: cost_sp_type.cost_stage_ledger, name: '成本报审' },
     { code: 'cost_stage_book', type: cost_sp_type.cost_stage_book, name: '财务账面' },
     { code: 'cost_stage_analysis', type: cost_sp_type.cost_stage_analysis, name: '成本分析' },
+    { code: 'cost_duty', type: cost_sp_type.cost_duty, name: '责任成本' },
 ];
 
 const sp_status = {

+ 1 - 0
app/const/tender_info.js

@@ -200,6 +200,7 @@ const defaultInfo = {
         cost_stage_ledger: 1,
         cost_stage_book: 1,
         cost_stage_analysis: 1,
+        cost_duty: 1,
         contract: 1,
     },
     ledger_check: {

+ 7 - 2
app/service/cost_stage_book_detail.js

@@ -120,9 +120,13 @@ module.exports = app => {
                     calc = true;
                     nd.in_tp = d.in_tp !== undefined ? this.ctx.helper.round(d.in_tp || 0, this.ctx.costStage.decimal.tp) : (od.in_tp ? od.in_tp : 0);
                     const divNum = this.ctx.helper.add(1, this.ctx.helper.div(cd.tax, 100));
-                    nd.in_excl_tax_tp = this.ctx.helper.div(nd.in_tp, divNum, this.ctx.costStage.decimal.tp);
+                    nd.in_excl_tax_tp = this.ctx.helper.div(nd.in_tp, divNum, this.ctx.costStage.decimal.excl_tax_tp);
+                }
+                if (d.in_excl_tax_tp !== undefined) {
+                    if (d.in_tp === undefined) nd.in_tp = od ? od.in_tp || 0 : 0;
+                    calc = true;
+                    nd.in_excl_tax_tp = this.ctx.helper.round(d.in_excl_tax_tp, this.ctx.costStage.decimal.excl_tax_tp);
                 }
-                if (d.in_excl_tax_tp !== undefined) nd.in_excl_tax_tp = this.ctx.helper.round(d.in_excl_tax_tp, this.ctx.costStage.decimal.tp);
                 if (od) {
                     updateDetail.push(nd);
                 } else {
@@ -130,6 +134,7 @@ module.exports = app => {
                 }
             }
             const bookUpdate = calc ? await this._getBookUpdateData([...insertDetail, ...updateDetail], orgDetail[0].ledger_id) : null;
+            console.log(bookUpdate);
             const orgBook = await this.ctx.service.costStageBook.getDataByCondition({ stage_id: this.ctx.costStage.id, ledger_id: orgDetail[0].ledger_id });
             const orgLedger = await this.ctx.service.costStageLedger.getDataById(orgDetail[0].ledger_id);
             if (bookUpdate) {

+ 7 - 7
app/service/cost_stage_detail.js

@@ -160,8 +160,8 @@ module.exports = app => {
                 if (d.tax !== undefined || nd.sf_tp !== undefined || nd.yf_tp !== undefined) {
                     nd.tax = d.tax !== undefined ? this.ctx.helper.round(d.tax || 0, this.ctx.costStage.decimal.tax) : 0;
                     const divNum = nd.tax ? this.ctx.helper.add(1, this.ctx.helper.div(nd.tax, 100)) : 1;
-                    nd.yf_excl_tax_tp = this.ctx.helper.div(nd.yf_tp !== undefined ? nd.yf_tp : 0, divNum, this.ctx.costStage.decimal.tp);
-                    nd.sf_excl_tax_tp = this.ctx.helper.div(nd.sf_tp !== undefined ? nd.sf_tp : 0, divNum, this.ctx.costStage.decimal.tp);
+                    nd.yf_excl_tax_tp = this.ctx.helper.div(nd.yf_tp !== undefined ? nd.yf_tp : 0, divNum, this.ctx.costStage.decimal.excl_tax_tp);
+                    nd.sf_excl_tax_tp = this.ctx.helper.div(nd.sf_tp !== undefined ? nd.sf_tp : 0, divNum, this.ctx.costStage.decimal.excl_tax_tp);
                 }
                 insertData.push(nd);
             }
@@ -250,8 +250,8 @@ module.exports = app => {
                 if (d.tax !== undefined || nd.sf_tp !== undefined || nd.yf_tp !== undefined) {
                     nd.tax = d.tax !== undefined ? this.ctx.helper.round(d.tax || 0, this.ctx.costStage.decimal.tax) : od.tax;
                     const divNum = nd.tax ? this.ctx.helper.add(1, this.ctx.helper.div(nd.tax, 100)) : 1;
-                    nd.yf_excl_tax_tp = this.ctx.helper.div(nd.yf_tp !== undefined ? nd.yf_tp : od.yf_tp, divNum, this.ctx.costStage.decimal.tp);
-                    nd.sf_excl_tax_tp = this.ctx.helper.div(nd.sf_tp !== undefined ? nd.sf_tp : od.sf_tp, divNum, this.ctx.costStage.decimal.tp);
+                    nd.yf_excl_tax_tp = this.ctx.helper.div(nd.yf_tp !== undefined ? nd.yf_tp : od.yf_tp, divNum, this.ctx.costStage.decimal.excl_tax_tp);
+                    nd.sf_excl_tax_tp = this.ctx.helper.div(nd.sf_tp !== undefined ? nd.sf_tp : od.sf_tp, divNum, this.ctx.costStage.decimal.excl_tax_tp);
                 }
                 uDatas.push(nd);
             }
@@ -327,8 +327,8 @@ module.exports = app => {
                 idetail.yf_tp = this.ctx.helper.add(idetail.yf_tp, pay.yf_price);
                 idetail.sf_tp = this.ctx.helper.add(idetail.sf_tp, pay.sf_price);
                 const divNum = idetail.tax ? this.ctx.helper.add(1, this.ctx.helper.div(idetail.tax, 100)) : 1;
-                idetail.yf_excl_tax_tp = this.ctx.helper.add(idetail.yf_excl_tax_tp, this.ctx.helper.div(pay.yf_price, divNum, this.ctx.costStage.decimal.tp));
-                idetail.sf_excl_tax_tp = this.ctx.helper.add(idetail.sf_excl_tax_tp, this.ctx.helper.div(pay.sf_price, divNum, this.ctx.costStage.decimal.tp));
+                idetail.yf_excl_tax_tp = this.ctx.helper.add(idetail.yf_excl_tax_tp, this.ctx.helper.div(pay.yf_price, divNum, this.ctx.costStage.decimal.excl_tax_tp));
+                idetail.sf_excl_tax_tp = this.ctx.helper.add(idetail.sf_excl_tax_tp, this.ctx.helper.div(pay.sf_price, divNum, this.ctx.costStage.decimal.excl_tax_tp));
             }
             const detailDatas = await this.getAllDataByCondition({ columns: ['id'], where: { ledger_id: ledgerId, stage_id: this.ctx.costStage.id } });
             const billsUpdate = await this._getLedgerUpdateData(insertDetails, ledgerId, []);
@@ -338,7 +338,7 @@ module.exports = app => {
             try {
                 await conn.delete(this.tableName, { stage_id: this.ctx.costStage.id, ledger_id: ledgerId });
                 if (detailDatas.length > 0) {
-                    await this.transaction.update(this.ctx.service.costStageFile.tableName, { is_deleted: 1 }, { where: { rela_sub_id: detailDatas.map(x => { return x.id; }) } });
+                    await conn.update(this.ctx.service.costStageFile.tableName, { is_deleted: 1 }, { where: { rela_sub_id: detailDatas.map(x => { return x.id; }) } });
                     await conn.delete(this.ctx.service.costStageTag.tableName, { rela_sub_id: detailDatas.map(x => { return x.id; }) });
                 }
                 if (insertDetails.length > 0) await conn.insert(this.tableName, insertDetails);

+ 5 - 1
app/service/cost_stage_ledger.js

@@ -349,7 +349,11 @@ module.exports = app => {
                         c[setting.pid] = newBills[setting.id];
                     }
                     for (const prop of costFields.curFields) {
-                        newBills[prop] = this.ctx.helper.round(d[prop] || 0, tpDecimal.tp);
+                        if (prop.indexOf('_excl_tax_') > 0) {
+                            newBills[prop] = this.ctx.helper.round(d[prop] || 0, tpDecimal.excl_tax_tp);
+                        } else {
+                            newBills[prop] = this.ctx.helper.round(d[prop] || 0, tpDecimal.tp);
+                        }
                         newBills['end_' + prop] = newBills[prop];
                     }
                     pbd.push(newBills);

+ 1 - 0
app/view/tender/shenpi.ejs

@@ -32,6 +32,7 @@
                                             <% } %>
                                         </div>
                                     </div>
+                                    <% console.log(sp.status, shenpi.sp_status_list[sp.status], shenpi.sp_status_list[sp.status].name); %>
                                     <div class="alert alert-warning"><%- shenpi.sp_status_list[sp.status].name %>:<%- shenpi.sp_status_list[sp.status].msg %></div>
                                     <div class="lc-show">
                                     <% if (sp.status === shenpi.sp_status.gdspl) { %>