فهرست منبع

清单汇总,超计比例

MaiXinRong 6 سال پیش
والد
کامیت
442b3076e2
3فایلهای تغییر یافته به همراه14 افزوده شده و 4 حذف شده
  1. 6 2
      app/public/js/stage_gather.js
  2. 8 0
      app/view/stage/gather.ejs
  3. 0 2
      config/web.js

+ 6 - 2
app/public/js/stage_gather.js

@@ -44,12 +44,13 @@ $(document).ready(function () {
     function checkOverRange() {
         const sheet = gclSpread.getActiveSheet();
         const bQty = $('#customRadio1')[0].checked, bDealQty = $('#customRadio2')[0].checked;
+        const nPercent = Math.min(Math.max(ZhCalc.div(parseFloat($('#over-percent').val()), 100), 0.5), 1);
         SpreadJsObj.beginMassOperation(sheet);
         for (let iRow = 0, iLength = sheet.getRowCount(); iRow < iLength; iRow++) {
             const node = sheet.zh_data[iRow];
             if (node) {
-                const bOverRangeQty = node.quantity ? node.end_gather_qty > node.quantity : node.end_gather_qty;
-                const bOverRangeDealQty = node.deal_qty ? node.end_gather_qty > node.deal_qty : node.end_gather_qty;
+                const bOverRangeQty = node.quantity ? node.end_gather_qty > ZhCalc.mul(node.quantity, nPercent) : node.end_gather_qty;
+                const bOverRangeDealQty = node.deal_bills_qty ? node.end_gather_qty > ZhCalc.mul(node.deal_bills_qty, nPercent) : node.end_gather_qty;
                 const bOverRange = bQty ? bOverRangeQty : (bDealQty ? bOverRangeDealQty : bOverRangeQty || bOverRangeDealQty);
                 const color = bOverRange ? '#f8d7da' : '';
                 sheet.getRange(iRow, -1, 1, -1).backColor(color);
@@ -73,4 +74,7 @@ $(document).ready(function () {
         // 收起菜单
         $('.dropdown-menu').click();
     });
+    $('#over-percent').change(function () {
+        checkOverRange();
+    });
 });

+ 8 - 0
app/view/stage/gather.ejs

@@ -29,6 +29,14 @@
                                 </div>
                             </div>
                         </form>
+                        <span class="dropdown-item-text text-danger">
+                            <div class="input-group input-group-sm">
+                                <input type="number" step="5" class="form-control m-0" placeholder="100" max="100" min="50" id="over-percent" value="100">
+                                <div class="input-group-append">
+                                    <span class="input-group-text" id="basic-addon2">%</span>
+                                </div>
+                            </div>
+                        </span>
                     </div>
                 </div>
             </div>

+ 0 - 2
config/web.js

@@ -186,7 +186,6 @@ const JsFiles = {
             },
             gather: {
                 files: [
-                    "/public/js/decimal.min.js",
                     "/public/js/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js",
                     "/public/js/decimal.min.js",
                 ],
@@ -195,7 +194,6 @@ const JsFiles = {
                     "/public/js/spreadjs_rela/spreadjs_zh.js",
                     "/public/js/zh_calc.js",
                     "/public/js/path_tree.js",
-                    "/public/js/zh_calc.js",
                     "/public/js/gcl_gather.js",
                     "/public/js/stage_gather.js",
                 ],