Переглянути джерело

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

Tony Kang 1 рік тому
батько
коміт
229eaa9bae

+ 1 - 0
app/const/account_permission.js

@@ -41,6 +41,7 @@ const permission = {
         type: 'checkbox',
         children: [
             { title: '变更意向', value: 1, hint: '开启该选项,变更立项可新建变更意向书', hintIcon: 'fa-question-circle' },
+            { title: '删除附件', value: 2, hint: '开启该选项,可删除审批通过前自己上传的附件', hintIcon: 'fa-question-circle' },
         ],
     },
     material: {

+ 10 - 1
app/controller/change_controller.js

@@ -424,6 +424,10 @@ module.exports = app => {
                         }
                     }
                 }
+                const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
+                const userPermission = accountInfo !== undefined && accountInfo.permission !== ''
+                    ? JSON.parse(accountInfo.permission) : null;
+                const deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
 
                 // 工程变更类别读取
                 const projectData = await ctx.service.project.getDataById(ctx.session.sessionProject.id);
@@ -467,6 +471,7 @@ module.exports = app => {
                     settleBills,
                     settlePos,
                     removeSettleNum,
+                    deleteFilePermission,
                 };
                 // 获取是否已存在调用变更令
                 let changeUsedData = await ctx.service.stageChange.getAllFinalUsedData(ctx.tender.id, change.cid);
@@ -1224,7 +1229,11 @@ module.exports = app => {
                 if (!fileInfo || !Object.keys(fileInfo).length) {
                     throw '该文件不存在';
                 }
-                if (!fileInfo.extra_upload && change.status === audit.change.status.checked) {
+                const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
+                const userPermission = accountInfo !== undefined && accountInfo.permission !== ''
+                    ? JSON.parse(accountInfo.permission) : null;
+                const deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
+                if (!fileInfo.extra_upload && change.status === audit.change.status.checked && !deleteFilePermission) {
                     throw '无权限删除';
                 }
                 if (fileInfo !== undefined && fileInfo !== '') {

+ 1 - 1
app/public/js/change_information.js

@@ -724,7 +724,7 @@ function getAllList(currPageNum = 1) {
         <td>${moment(att.in_time * 1000).format('YYYY-MM-DD')}<br>${bytesToSize(att.filesize)}</td>
         <td>
             <a href="/change/download/file/${att.id}" class="mr-2" title="下载"><span class="fa fa-download text-primary"></span></a>`
-        html += (att.uid === accountId && (changeStatus === auditConst.status.checked ? Boolean(att.extra_upload) : true)) ?
+        html += (att.uid === accountId && ((changeStatus === auditConst.status.checked ? Boolean(att.extra_upload) : true) || deleteFilePermission)) ?
             `<a href="javascript:void(0)" class="mr-2 delete-file" data-attid="${att.id}" title="删除附件"><span class="fa fa-trash text-danger"></span></a>` : '';
         html += `</td>`;
     }

+ 36 - 2
app/public/report/js/rpt_archive.js

@@ -27,10 +27,42 @@ let rptArchiveObj = {
         for (let aItem of ARCHIVE_LIST) {
             archivedRptIds.push(parseInt(aItem.rpt_id));
         }
+        const _chkIfShouldFilter = function(rptItem, currentRptType = 'normal') {
+            let rst = (!(rptItem.released) && rptItem.nodeType === 2 || rptItem.hidden); //未发布判断 或 故意隐藏
+            if (!rst) {
+                // 根据当前业务类型判断及检测其他非同类报表,如动态决算类型、支付审批类型
+                switch(currentRptType) {
+                    case 'normal':
+                        // 检测:预付款
+                        if (CURRENT_SELECTED_BIZ_TYPE && CURRENT_SELECTED_BIZ_TYPE === 'change_prepay' && rptItem.nodeType === 2) {
+                            rst = true;
+                            if (rptItem.flags && rptItem.flags.rptTplType) {
+                                if (current_advance_id > 0) {
+                                    rst = !((rptItem.flags.rptTplType || '') === getAdvanceType2());
+                                }
+                            }
+                        }
+                        break;
+                    case 'juesuan':
+                        break;
+                    case 'zhifushenpi':
+                        break;
+                    default:
+                        break;
+                }
+            }
+            return rst;
+        };
         let private_remove_hide_item = function (items, nlv) {
             if (items && items.length > 0) {
                 for (let i = items.length - 1; i >= 0; i--) {
-                    if (!(items[i].released) && items[i].nodeType === 2) {
+                    // if (!(items[i].released) && items[i].nodeType === 2) {
+                    //     if (archivedRptIds.indexOf(items[i].refId) < 0) {
+                    //         // 备注:这里还要再判断是否存在已经归档的报表,如果有,需要保留。否则才真正剔除
+                    //         items.splice(i, 1);
+                    //     }
+                    // } else {
+                    if (_chkIfShouldFilter(items[i])) {
                         if (archivedRptIds.indexOf(items[i].refId) < 0) {
                             // 备注:这里还要再判断是否存在已经归档的报表,如果有,需要保留。否则才真正剔除
                             items.splice(i, 1);
@@ -1015,7 +1047,9 @@ let rptArchiveObj = {
         }
     }
 };
-
+function getAdvanceType2() {
+    return current_advance_type !== -1 ? ('tplType_prePay' + (current_advance_type + 1)) : '';
+}
 /**
  * 获取 blob
  * @param  {String} url 目标文件地址

+ 8 - 1
app/service/advance.js

@@ -1,6 +1,7 @@
 'use strict';
 
 const auditConst = require('../const/audit').advance;
+const advanceConst = require('../const/advance');
 const path = require('path');
 const fs = require('fs');
 
@@ -274,7 +275,13 @@ module.exports = app => {
                 ' c.tid = ? AND c.id in (' + this.ctx.helper.getInArrStrSqlFilter(ids) + ') AND c.status = ? ORDER BY ca.end_time DESC';
             const params = [this.tableName, this.ctx.service.advanceAudit.tableName, tid, tid, auditConst.status.checked];
             const list = await this.db.query(sql, params);
-            return list;
+            // 再按预付款顺序再进行一次排列
+            const advances = [];
+            for (const tc of advanceConst.typeCol) {
+                const typeList = list.filter(item => item.type === tc.type);
+                advances.push(...typeList);
+            }
+            return advances;
         }
     }
     return Advance;

+ 1 - 1
app/service/change.js

@@ -2155,7 +2155,7 @@ module.exports = app => {
         }
 
         async getCheckingList(tid, uid) {
-            const sql = 'select c.* from ?? as c LEFT JOIN ?? as ca ON c.cid = ca.cid where c.tid = ? and ca.status = ? and ca.uid = ?';
+            const sql = 'select c.* from ?? as c LEFT JOIN ?? as ca ON c.cid = ca.cid where c.tid = ? and ca.status = ? and ca.uid = ? and ca.usite != 0';
             const sqlParams = [this.tableName, this.ctx.service.changeAudit.tableName, tid, audit.change.status.checking, uid];
             const list = await this.db.query(sql, sqlParams);
             const returnList = [];

+ 13 - 8
app/service/rpt_gather_memory.js

@@ -1383,7 +1383,7 @@ module.exports = app => {
             const helper = this.ctx.helper;
 
             if (preStage) {
-                const preStageChange = await this.ctx.service.stageChangeFinal.getEndStageData(stage.tid, preStage.order);
+                const preStageChange = await this.ctx.service.stageChangeFinal.getEndStageData(preStage.tid, preStage.order);
                 if (gatherType === 'flow') {
                     result.push(...preStageChange);
                 } else {
@@ -1415,9 +1415,11 @@ module.exports = app => {
             result.forEach(r => { r.end_qty = helper.add(r.pre_qty, r.qty); });
             return result;
         }
-        async _gatherCustomZoneStageChange(sTender, completeData, timeType, gatherType) {
+        async _gatherCustomZoneStageChange(sTender, completeData, zone, timeType, gatherType) {
+            const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
             const [stages, preStage, endStage] = await this._getCustomZoneStages(tender, zone, timeType);
-            await this._gatherStagesChange(completeData, tender, stages, preStage, gatherType);
+            const result = await this._gatherStagesChange(completeData, tender, stages, preStage, gatherType);
+            this.resultStageChange.push(...result);
         }
         async _gatherStageChange(completeData, tender, stage, hasPre, gatherType = 'flow'){
             if (!stage) return [];
@@ -1452,29 +1454,32 @@ module.exports = app => {
             const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
             const stages = await this._getValidStages(tender.id);
             const stage = this.ctx.helper._.find(stages, {s_time: month});
-            await this._gatherStageChange(completeData, tender, stage, hasPre, gatherType);
+            const result = await this._gatherStageChange(completeData, tender, stage, hasPre, gatherType);
+            this.resultStageChange.push(...result);
         }
         async _gatherOrderStageChange(sTender, completeData, order, hasPre, gatherType) {
             const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
             const stages = await this._getValidStages(tender.id);
             const stage = this.ctx.helper._.find(stages, {order: order});
-            await this._gatherStageChange(completeData, tender, stage, hasPre, gatherType);
+            const result = await this._gatherStageChange(completeData, tender, stage, hasPre, gatherType);
+            this.resultStageChange.push(...result);
         }
         async _gatherFinalStageChange(sTender, completeData, hasPre, gatherType) {
             const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
             const stages = await this._getValidStages(tender.id);
-            await this._gatherStageChange(completeData, tender, stages[0], hasPre, gatherType);
+            const result = await this._gatherStageChange(completeData, tender, stages[0], hasPre, gatherType);
+            this.resultStageChange.push(...result);
         }
         async _gatherCheckedFinalStageChange(sTender, completeData, hasPre, gatherType) {
             const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
             const stages = await this._getCheckedStages(tender.id);
-            await this._gatherStageChange(completeData, tender, stages[0], hasPre, gatherType);
+            const result = await this._gatherStageChange(completeData, tender, stages[0], hasPre, gatherType);
+            this.resultStageChange.push(...result);
         }
         async getGatherStageChange(memFieldKeys, gsDefine, gsCustom) {
             if (!gsDefine || !gsDefine.enable) return [];
             if (!gsCustom || !gsCustom.tenders || gsCustom.tenders.length === 0) return [];
             const gsSetting = JSON.parse(gsDefine.setting);
-            if (gsSetting.type !== 'stage') return [];
 
             this.resultStageChange = [];
             let commonIndex = 0;

+ 1 - 1
app/view/change/addlist.ejs

@@ -18,7 +18,7 @@
             </div>
             <% if (ctx.session.sessionProject.page_show.openChangeRevise) { %>
             <div class="ml-auto">
-                <a class="btn btn-sm btn-primary mr-1" id="add-all-revise" href="javascript: void(0);">添加当前新增部位/清单</a>
+                <a class="btn btn-sm btn-primary mr-1" id="add-all-revise" href="javascript: void(0);">勾选当前新增部位/清单</a>
             </div>
             <% } %>
         </div>

+ 5 - 4
app/view/change/information.ejs

@@ -87,11 +87,11 @@
                         </li>
                         <li class="nav-item ml-auto pt-1" id="fujian_btn" style="display:none;">
                             <!--所有附件 翻页-->
-                            <button  data-toggle="modal" class="btn btn-sm btn-primary" id="bach-download"><i class="fa fa-download "></i> 批量下载</button>
+                            <button data-toggle="modal" class="btn btn-sm btn-primary" id="bach-download">批量下载</button>
                             <!-- <a href="javascript: void(0);" data-toggle="modal" class="btn btn-sm btn-primary" id="bach-download"><i class="fa fa-download "></i> 批量下载</a> -->
-                            <a href="javascript:void(0);" class="page-select ml-3" content="pre"><i class="fa fa-chevron-left"></i></a> <span id="currentPage">1</span>/<span id="totalPage">10</span> <a href="javascript:void(0);" class="page-select mr-3" content="next"><i class="fa fa-chevron-right"></i></a>
+                            <a href="javascript:void(0);" class="page-select ml-2" content="pre"><i class="fa fa-chevron-left"></i></a> <span id="currentPage">1</span>/<span id="totalPage">10</span> <a href="javascript:void(0);" class="page-select mr-2" content="next"><i class="fa fa-chevron-right"></i></a>
                             <% if (change.filePermission) { %>
-                            <a href="#addfujian" data-toggle="modal" class="btn btn-sm btn-light text-primary" data-placement="bottom" title="" data-original-title="上传附件"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 上传附件</a>
+                            <a href="#addfujian" data-toggle="modal" class="btn btn-sm btn-light text-primary" data-placement="bottom" title="" data-original-title="上传附件">上传附件</a>
                             <% } %>
                             <a href="javascript: void(0);" id="zipDown" download style="display: none;"></a>
                         </li>
@@ -369,7 +369,7 @@
                                                 <td><%- moment(att.in_time * 1000).format('YYYY-MM-DD') %><br><%- ctx.helper.bytesToSize(att.filesize) %></td>
                                                 <td>
                                                     <a href="/change/download/file/<%- att.id %>" class="mr-2" title="下载"><span class="fa fa-download text-primary"></span></a>
-                                                    <% if (att.uid === ctx.session.sessionUser.accountId && (change.status === auditConst.status.checked ? Boolean(att.extra_upload) : true )) { %>
+                                                    <% if (att.uid === ctx.session.sessionUser.accountId && ((change.status === auditConst.status.checked ? Boolean(att.extra_upload) : true ) || deleteFilePermission)) { %>
                                                         <a href="javascript:void(0)" class="mr-2 delete-file" data-attid="<%- att.id %>" title="删除附件"><span class="fa fa-trash text-danger"></span></a>
                                                     <% } %>
                                                 </td>
@@ -477,6 +477,7 @@
 <script>
     const tenderName = JSON.parse(unescape('<%- escape(JSON.stringify(tender.data.name)) %>'));
     const tenderId = '<%- tender.id %>';
+    const deleteFilePermission = <%- deleteFilePermission %>;
     const totalPriceUnit = '<%- tpUnit %>';
     const unitPriceUnit = '<%- upUnit %>';
     const accountId = parseInt('<%- ctx.session.sessionUser.accountId %>');

+ 1 - 1
app/view/change/revise.ejs

@@ -50,7 +50,7 @@
             </div>
             <% if (ctx.session.sessionProject.page_show.openChangeRevise) { %>
             <div class="ml-auto">
-                <a class="btn btn-sm btn-primary mr-1" id="add-all-revise" href="javascript: void(0);">添加当前新增部位/清单</a>
+                <a class="btn btn-sm btn-primary mr-1" id="add-all-revise" href="javascript: void(0);">勾选当前新增部位/清单</a>
                 <a class="btn btn-sm btn-primary mr-1" id="ledger-check2" href="javascript: void(0);">数据检查</a>
             </div>
             <% } %>

+ 86 - 46
app/view/report/index_archive.ejs

@@ -83,12 +83,8 @@
                 </div>
                 <div class="d-inline-block">
                     <div class="dropdown" style="display: none" id="divSelectableAdvances">
-                        <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="btnCurrentAdvance" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><%- advanceConst.typeCol[0].name %></button>
-                        <div class="dropdown-menu" aria-labelledby="allPrepayButton" id="optionSelectableAdvances">
-                            <% for (const type of advanceConst.typeCol) { %>
-                            <a class="dropdown-item" href="javascript:void(0);" data-type="<%- type.key %>" <% if (type.value === 0) { %>style="display: none"<% } %>><%- type.name %></a>
-                            <% } %>
-                        </div>
+                        <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="btnCurrentAdvance" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
+                        <div class="dropdown-menu" aria-labelledby="allPrepayButton" id="optionSelectableAdvances"></div>
                     </div>
                 </div>
                 <div class="d-inline-block">
@@ -271,10 +267,13 @@
     let CHANGE_LIST = [], current_change_id = -1, current_change_code = '';
     let CHANGE_ID = -1, BUSINESS_ID = -1;
     let current_advance_id = -1;  // 预付款期id
+    let current_advance_type = -1;// 预付款报表类型
     let current_material_id = -1; // 材差期id
     let current_material_order = -1; // 材差期order
     let ADVANCE_LIST = [];
     let MATERIAL_LIST = [];
+    let CURRENT_SELECTED_BIZ_TYPE = '';
+    const ADVANCE_TYPECOL = JSON.parse(unescape('<%- escape(JSON.stringify(advanceConst.typeCol)) %>'));
 
     const FOLDER_SEPERATER = '->';
 
@@ -426,27 +425,85 @@
         // }
     }
 
-    function buildAdvancePaySelection(adList) {
+    function buildAdvanceSelection() {
+        $('#optionSelectableAdvances').html('');
+        $("#btnCurrentAdvance")[0].innerText = '';
+        const advanceCols = [];
+        for (const advance of ADVANCE_LIST) {
+            if (advanceCols.indexOf(advance.type) === -1) {
+                advanceCols.push(advance.type);
+            }
+        }
+        for (const advanceAdj of ADVANCE_TYPECOL) {
+            const ad = _.includes(advanceCols, advanceAdj.type);
+            if (ad) {
+                let dispStr = '';
+                if (current_advance_type === -1 || current_advance_type === advanceAdj.type) {
+                    current_advance_type = advanceAdj.type;
+                    current_advance_id = -1;
+                    $("#btnCurrentAdvance")[0].innerText = advanceAdj.name;
+                    dispStr = ';display:none';
+                }
+                const str = `<a class="dropdown-item" style="cursor:pointer${dispStr}" onclick="changeCurrentAdvance(this)" data-type = "${advanceAdj.type}">${advanceAdj.name}</a>`;
+                $("#optionSelectableAdvances").append(str);
+            }
+        }
+        buildAdvancePaySelection(current_advance_type, true);
+    }
+
+    function changeCurrentAdvance(ele) {
+        $('#optionSelectableAdvances a').show();
+        $(ele).hide();
+        current_advance_type = +ele.attributes[3].value;
+        $('#optionSelectableAdvances').siblings('button').text($(ele).text());
+        // BUSINESS_ID = material_id;
+        buildAdvanceSelection();
+    }
+
+    function buildAdvancePaySelection(current_advance_type, needClick = false) {
         $("#optionSelectableAdvancePays").empty();
         $("#btnCurrentAdvancePay")[0].innerText = '';
-        let hasMatch = false;
-        if (current_advance_id !== -1) {}
+        const adList = _.orderBy(_.filter(ADVANCE_LIST, { type: current_advance_type }), ['order'], ['desc']);
         for (const advance of adList) {
-            if (current_advance_id === advance.id) {
-                hasMatch = true; // 预付款有好几种类型,需要考虑不同类型的转换检测
-                break;
-            }
-        }
-        adList.forEach((advance, adIndex) => {
             let dispStr = '';
-            if (!hasMatch && adIndex === 0 || current_advance_id === advance.id) {
+            if (current_advance_id === -1 || current_advance_id === advance.id) {
                 current_advance_id = advance.id;
-                $("#btnCurrentAdvancePay")[0].innerText = `第${adIndex + 1}期`;
+                $("#btnCurrentAdvancePay")[0].innerText = `第${advance.order}期`;
                 dispStr = ';display:none';
             }
-            const str = `<a class="dropdown-item" style="cursor:pointer${dispStr}" onclick="changeCurrentAdvance(this)" advance_id = "${advance.id}">第${adIndex + 1}期</a>`;
+            const str = `<a class="dropdown-item" style="cursor:pointer${dispStr}" onclick="changeCurrentAdvancePays(this)" advance_id = "${advance.id}">第${advance.order}期</a>`;
             $("#optionSelectableAdvancePays").append(str);
-        });
+        }
+        if (needClick) {
+            changeCurrentAdvancePays($("#optionSelectableAdvancePays a")[0], !needClick);
+        }
+    }
+
+    function changeCurrentAdvancePays(ele, refresh = true) {
+        $('#optionSelectableAdvancePays a').show();
+        $(ele).hide();
+        current_advance_id = ele ? +ele.attributes[3].value : -1;
+        $('#optionSelectableAdvancePays').siblings('button').text($(ele).text());
+        // BUSINESS_ID = material_id;
+        if (refresh) buildAdvancePaySelection(current_advance_type);
+        //还有必要触发归档报表刷新!
+        //rptArchiveObj.onClick(null, null, rptArchiveObj.currentNode);
+        const params = {tenderId: TENDER_ID, business_type, bzId: current_advance_id};
+        $.bootstrapLoading.start();
+        CommonAjax.postXsrfEx("/tender/report_api/getReportArchive4bz", params, 10000, true, getCookie('csrfToken_j'),
+            function(result){
+                $.bootstrapLoading.end();
+                ARCHIVE_LIST = result.data;
+                ARCHIVE_ENCRYPTION_LIST = result.encryptionData;
+                TOP_TREE_NODES = JSON.parse(JSON.stringify(result.rpt_tpl_data));
+                buildTplTree();
+                rptArchiveObj.iniPage();
+            }, function(err){
+                $.bootstrapLoading.end();
+            }, function(ex){
+                $.bootstrapLoading.end();
+            }
+        );
     }
 
     function buildMaterialSelection() {
@@ -632,27 +689,6 @@
             }
         });
 
-        function advancePayClick(ele = null) {
-            $('#optionSelectableAdvances a').show();
-            const thisEle = ele === null ? this : ele;
-            $(thisEle).hide();
-            $('#optionSelectableAdvances').siblings('button').text($(thisEle).text());
-            const type = $(thisEle).data('type');
-            const typeStr = ['start', 'material', 'safe', 'dust'];
-            const tIdx = typeStr.indexOf(type)
-            const adList = [];
-            ADVANCE_LIST.forEach(advance => {
-                if (advance.type === tIdx) {
-                    adList.push(advance);
-                }
-            });
-            buildAdvancePaySelection(adList);
-        }
-
-        $('#optionSelectableAdvances a').on('click', function (){
-            advancePayClick(this);
-        });
-
         $('#select-item a').on('click', function () {
            $('#select-item a').show();
            $(this).hide();
@@ -661,6 +697,8 @@
            business_type = type;
            CHANGE_ID = -1;
            BUSINESS_ID = -1;
+           current_advance_type = -1;
+           CURRENT_SELECTED_BIZ_TYPE = '';
            if (type === 'stage') {
                $('#divSelectableStages').show();
                $('#divSelectableChanges').hide();
@@ -682,6 +720,7 @@
                //rptArchiveObj.onClick(null, null, rptArchiveObj.currentNode);
                const params = {prjId: PROJECT_ID, stgId: current_stage_id};
                $.bootstrapLoading.start();
+               ARCHIVE_LIST = [];
                CommonAjax.postXsrfEx("/tender/report_api/getReportArchive", params, 10000, true, getCookie('csrfToken_j'),
                    function(result){
                        $.bootstrapLoading.end();
@@ -698,7 +737,7 @@
                        $.bootstrapLoading.end();
                    }
                );
-           } else if (_.indexOf(type, 'change') !== -1) {
+           } else if (_.includes(type, 'change')) {
                $('#divSelectableStages').hide();
                $('#divSelectableAdvances').hide();
                $('#divSelectableAdvancePays').hide();
@@ -708,7 +747,7 @@
                //rptArchiveObj.onClick(null, null, rptArchiveObj.currentNode);
                const params = {tenderId: TENDER_ID, business_type: type};
                $.bootstrapLoading.start();
-               // ARCHIVE_LIST = [];
+               ARCHIVE_LIST = [];
                // ARCHIVE_ENCRYPTION_LIST = [];
                // TOP_TREE_NODES = JSON.parse(JSON.stringify(ORG_TOP_TREE_NODES));
                // rptArchiveObj.iniPage();
@@ -735,6 +774,7 @@
                    }
                );
            } else if (type === 'advance') {
+               CURRENT_SELECTED_BIZ_TYPE = 'change_prepay'
                $('#divSelectableStages').hide();
                $('#divSelectableChanges').hide();
                $('#divSelectableAdvances').show();
@@ -744,7 +784,7 @@
                //rptArchiveObj.onClick(null, null, rptArchiveObj.currentNode);
                const params = {tenderId: TENDER_ID, business_type: type};
                $.bootstrapLoading.start();
-               // ARCHIVE_LIST = [];
+               ARCHIVE_LIST = [];
                // ARCHIVE_ENCRYPTION_LIST = [];
                // TOP_TREE_NODES = JSON.parse(JSON.stringify(ORG_TOP_TREE_NODES));
                // rptArchiveObj.iniPage();
@@ -755,10 +795,10 @@
                        ARCHIVE_LIST = result.data;
                        ARCHIVE_ENCRYPTION_LIST = result.encryptionData;
                        ADVANCE_LIST = result.changes;
-                       current_advance_id = ADVANCE_LIST.length > 0 ? ADVANCE_LIST[0].id : -1;
+                       // current_advance_id = ADVANCE_LIST.length > 0 ? ADVANCE_LIST[0].id : -1;
                        TOP_TREE_NODES = JSON.parse(JSON.stringify(result.rpt_tpl_data));
                        BUSINESS_ID = ADVANCE_LIST.length > 0 ? ADVANCE_LIST[0].id : -1;
-                       advancePayClick( $('#optionSelectableAdvances a')[0]);
+                       buildAdvanceSelection();
                        buildTplTree();
                        rptArchiveObj.iniPage();
                        current_stage_id = result.stgId;
@@ -778,7 +818,7 @@
                //rptArchiveObj.onClick(null, null, rptArchiveObj.currentNode);
                const params = {tenderId: TENDER_ID, business_type: type};
                $.bootstrapLoading.start();
-               // ARCHIVE_LIST = [];
+               ARCHIVE_LIST = [];
                // ARCHIVE_ENCRYPTION_LIST = [];
                // TOP_TREE_NODES = JSON.parse(JSON.stringify(ORG_TOP_TREE_NODES));
                // rptArchiveObj.iniPage();