MaiXinRong пре 3 дана
родитељ
комит
91a541acad
2 измењених фајлова са 35 додато и 35 уклоњено
  1. 34 34
      app/lib/ledger.js
  2. 1 1
      app/lib/rm/spss.js

+ 34 - 34
app/lib/ledger.js

@@ -1448,49 +1448,49 @@ const treeUtils = {
                 if (helper._.isMatch(cb, b)) return node;
             }
             return null;
-            for (const change of changes) {
-                for (const changeBills of change.bills) {
-                    const node = changeBills.gcl_id
-                        ? tree.nodes.find(x => {return x.id === changeBills.gcl_id})
-                        : findEmptyBills(tree, change, changeBills);
+        };
+        for (const change of changes) {
+            for (const changeBills of change.bills) {
+                const node = changeBills.gcl_id
+                    ? tree.nodes.find(x => {return x.id === changeBills.gcl_id})
+                    : findEmptyBills(tree, change, changeBills);
 
-                    if (!node) continue;
-                    if (!node.changeBills) node.changeBills = [];
-                    node.tz_qc_qty = helper.add(node.tz_qc_qty, changeBills.checked_amount);
-                    if (tenderInfo.calc_type === 'up') {
-                        node.tz_qc_tp = helper.add(node.tz_qc_tp, changeBills.checked_price);
-                    } else {
-                        node.tz_qc_tp = helper.add(node.tz_qc_tp, changeBills.tp);
-                    }
+                if (!node) continue;
+                if (!node.changeBills) node.changeBills = [];
+                node.tz_qc_qty = helper.add(node.tz_qc_qty, changeBills.checked_amount);
+                if (tenderInfo.calc_type === 'up') {
+                    node.tz_qc_tp = helper.add(node.tz_qc_tp, changeBills.checked_price);
+                } else {
+                    node.tz_qc_tp = helper.add(node.tz_qc_tp, changeBills.tp);
+                }
 
-                    const posData = pos ? pos.getLedgerPos(node.id) : undefined;
-                    if (posData && posData.length > 0) {
-                        for (const p of changeBills.pos) {
-                            const changePos = p.bwmx ? posData.find(x => { return x.name === p.bwmx; }) : posData[0];
-                            if (changePos) {
-                                changePos.tz_qc_qty = helper.add(changePos.tz_qc_qty, p.checked_amount);
-                                if (!changePos.changeBills) changePos.changeBills = [];
-                                changePos.changeBills.push({
-                                    code: change.code || '', name: change.name || '', is_valuation:  p.is_valuation,
-                                    qty: p.checked_amount || 0, tp: p.checked_price || 0, pos: changePos.name,
-                                });
-                                node.changeBills.push({
-                                    code: change.code || '', name: change.name || '', is_valuation: p.is_valuation,
-                                    qty: p.checked_amount || 0, tp: p.checked_price || 0, pos: changePos.name,
-                                });
-                            }
-                        }
-                    } else {
-                        for (const p of changeBills.pos) {
+                const posData = pos ? pos.getLedgerPos(node.id) : undefined;
+                if (posData && posData.length > 0) {
+                    for (const p of changeBills.pos) {
+                        const changePos = p.bwmx ? posData.find(x => { return x.name === p.bwmx; }) : posData[0];
+                        if (changePos) {
+                            changePos.tz_qc_qty = helper.add(changePos.tz_qc_qty, p.checked_amount);
+                            if (!changePos.changeBills) changePos.changeBills = [];
+                            changePos.changeBills.push({
+                                code: change.code || '', name: change.name || '', is_valuation:  p.is_valuation,
+                                qty: p.checked_amount || 0, tp: p.checked_price || 0, pos: changePos.name,
+                            });
                             node.changeBills.push({
                                 code: change.code || '', name: change.name || '', is_valuation: p.is_valuation,
-                                qty: p.checked_amount || 0, tp: p.checked_price || 0, pos: '',
+                                qty: p.checked_amount || 0, tp: p.checked_price || 0, pos: changePos.name,
                             });
                         }
                     }
+                } else {
+                    for (const p of changeBills.pos) {
+                        node.changeBills.push({
+                            code: change.code || '', name: change.name || '', is_valuation: p.is_valuation,
+                            qty: p.checked_amount || 0, tp: p.checked_price || 0, pos: '',
+                        });
+                    }
                 }
             }
-        };
+        }
     }
 };
 

+ 1 - 1
app/lib/rm/spss.js

@@ -32,7 +32,7 @@ class reportMemorySpss {
         const pos = [];
         for (const b of bills) {
             if (!b.pos || b.pos.length === 0) continue;
-            b.pos.forEach(x => { x.lid === b.ledger_id; });
+            b.pos.forEach(x => { x.lid = b.ledger_id; });
             pos.push(...b.pos);
         }
         return pos;