Explorar o código

1. 清单汇总,完成率计算调整
2. 计量期,矫正完成率相关

MaiXinRong %!s(int64=4) %!d(string=hai) anos
pai
achega
a8e4737899
Modificáronse 4 ficheiros con 44 adicións e 9 borrados
  1. 4 1
      app/public/js/gcl_gather.js
  2. 20 1
      app/public/js/stage.js
  3. 2 7
      app/view/stage/index.ejs
  4. 18 0
      app/view/stage/modal.ejs

+ 4 - 1
app/public/js/gcl_gather.js

@@ -336,8 +336,11 @@ const gclGatherModel = (function () {
             gcl.end_qc_tp = ZhCalc.add(gcl.pre_qc_tp, gcl.qc_tp);
             gcl.end_gather_tp = ZhCalc.add(gcl.pre_gather_tp, gcl.gather_tp);
             gcl.dgn_price = ZhCalc.round(ZhCalc.div(gcl.total_price, gcl.dgn_qty1), 2);
+            gcl.end_final_qty = ZhCalc.add(gcl.end_qc_qty, gcl.quantity);
             gcl.end_final_tp = ZhCalc.add(gcl.end_qc_tp, gcl.total_price);
-            gcl.end_gather_percent = ZhCalc.mul(ZhCalc.div(gcl.end_gather_tp, gcl.end_final_tp), 100, 2);
+            gcl.end_gather_percent = gcl.end_final_qty && gcl.end_gather_qty
+                ? ZhCalc.mul(ZhCalc.div(gcl.end_gather_qty, gcl.end_final_qty), 100, 2)
+                : ZhCalc.mul(ZhCalc.div(gcl.end_gather_tp, gcl.end_final_tp), 100, 2);
             for (const xmj of gcl.leafXmjs) {
                 xmj.pre_gather_qty = ZhCalc.add(xmj.pre_contract_qty, xmj.pre_qc_qty);
                 xmj.gather_qty = ZhCalc.add(xmj.contract_qty, xmj.qc_qty);

+ 20 - 1
app/public/js/stage.js

@@ -193,7 +193,6 @@ $(document).ready(() => {
             node.end_contract_qty = ZhCalc.add(node.pre_contract_qty, node.contract_qty);
             node.end_qc_qty = ZhCalc.add(node.pre_qc_qty, node.qc_qty);
             node.end_gather_qty = ZhCalc.add(node.pre_gather_qty, node.gather_qty);
-            node.end_correct_tp = ZhCalc.add(node.end_qc_tp, ZhCalc.mul(node.end_contract_qty, node.unit_price, tenderInfo.decimal.tp));
         }
         node.pre_gather_tp = ZhCalc.add(node.pre_contract_tp, node.pre_qc_tp);
         node.gather_tp = ZhCalc.add(node.contract_tp, node.qc_tp);
@@ -201,9 +200,11 @@ $(document).ready(() => {
         node.end_qc_tp = ZhCalc.add(node.pre_qc_tp, node.qc_tp);
         node.end_gather_tp = ZhCalc.add(node.pre_gather_tp, node.gather_tp);
         node.end_final_tp = ZhCalc.add(node.end_qc_tp, node.total_price);
+        node.end_correct_tp = ZhCalc.add(node.end_qc_tp, ZhCalc.mul(node.end_contract_qty, node.unit_price, tenderInfo.decimal.tp));
         node.end_gather_percent = ZhCalc.mul(ZhCalc.div(node.end_gather_tp, node.end_final_tp), 100, 2);
         node.end_correct_percent = ZhCalc.mul(ZhCalc.div(node.end_correct_tp, node.end_final_tp), 100, 2);
         node.final_dgn_price = ZhCalc.round(ZhCalc.div(node.end_gather_tp, ZhCalc.add(node.deal_dgn_qty1, node.c_dgn_qty1)), tenderInfo.decimal.up);
+        if (node.b_code === '209-2-3') console.log(node);
     };
     const stageTree = createNewPathTree('stage', stageTreeSetting);
     // 初始化 计量单元 数据结构
@@ -1191,9 +1192,11 @@ $(document).ready(() => {
         });
     }
     stageTreeSpreadObj.loadExprToInput(slSpread.getActiveSheet());
+    //let check_correct = false;
     $.contextMenu({
         selector: '#stage-ledger',
         build: function ($trigger, e) {
+            e.data.items.correct_percent.selected = check_correct;
             const target = SpreadJsObj.safeRightClickSelection($trigger, e, slSpread);
             return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
         },
@@ -1230,6 +1233,22 @@ $(document).ready(() => {
                     }
                 },
             },
+            // 'correct_percent': {
+            //     name: '使用数量矫正完成率',
+            //     type: 'checkbox',
+            //     events: {
+            //         change: function (e) {
+            //             check_correct = e.data.commands.correct_percent.$input[0].checked;
+            //             const sheet = slSpread.getActiveSheet();
+            //             const col = sheet.zh_setting.cols.find(x => {
+            //                 return x.field === 'end_gather_percent' || x.field === 'end_correct_percent'
+            //             });
+            //             col.field = check_correct ? 'end_correct_percent' : 'end_gather_percent';
+            //             SpreadJsObj.reLoadColsData(sheet, [col]);
+            //             e.data.$menu.hide();
+            //         }
+            //     },
+            // }
         }
     });
 

+ 2 - 7
app/view/stage/index.ejs

@@ -36,13 +36,8 @@
                     <a id="exportExcel" class="btn btn-primary btn-sm" href="javascript: void(0)">导出计量台账Excel</a>
                     <a class="btn btn-sm btn-primary" href="#ledger-check-modal" data-toggle="modal" data-target="#ledger-check-modal">数据检查</a>
                 </div>
-                <div class="d-inline-block ml-1">
-                    <a class="btn btn-sm btn-light">
-                        <div class="custom-control custom-checkbox">
-                            <input type="checkbox" class="custom-control-input" id="correct_percent">
-                            <label class="custom-control-label text-primary" for="correct_percent">使用数量矫正完成率</label>
-                        </div>
-                    </a>
+                <div class="d-inline-block">
+                    <a class="btn btn-sm btn-primary" href="#correct" data-toggle="modal" data-target="#correct"><i class="fa fa-cog"></i></a>
                 </div>
             </div>
             <div class="ml-auto">

+ 18 - 0
app/view/stage/modal.ejs

@@ -450,6 +450,24 @@
         </div>
     </div>
 </div>
+<div class="modal fade" id="correct" data-backdrop="static">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title">操作确认</h5>
+            </div>
+            <div class="modal-body">
+                <div class="custom-control custom-checkbox">
+                    <input type="checkbox" class="custom-control-input" id="correct_percent">
+                    <label class="custom-control-label " for="correct_percent">使用数量纠正完成率</label>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-sm btn-primary" data-dismiss="modal">确认</button>
+            </div>
+        </div>
+    </div>
+</div>
 <% include ./audit_modal.ejs %>
 <% include ../shares/merge_peg_modal.ejs %>
 <% include ../shares/ledger_check_modal.ejs %>