| 
					
				 | 
			
			
				@@ -508,6 +508,20 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     SpreadJsObj.initSheet(spSpread.getActiveSheet(), posSpreadSetting); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const errorList = $.cs_errorList({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tabSelector: '#error-list-tab', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        selector: '#error-list', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        relaSpread: slSpread, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        storeKey: 'stage-error-' + stage.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        afterLocated:  function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            stagePosSpreadObj.loadCurPosData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        afterShow: function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            slSpread.refresh(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (spSpread) spSpread.refresh(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const stageTreeSpreadObj = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         loadExprToInput(sheet) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const sel = sheet.getSelections()[0]; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2543,7 +2557,7 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $('.tab-content .tab-select-show').removeClass('active'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             tab.addClass('active'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             tabPanel.addClass('active'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            showTools(tab.hasClass('active')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            showSideTools(tab.hasClass('active')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (tab.attr('content') === '#search' && !searchLedger) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 searchLedger = $.billsSearch({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     selector: '#search', 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2622,6 +2636,9 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     checkedChanges.refresh(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (tab.attr('content') === '#error-list') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                errorList.spread.refresh(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             tab.removeClass('active'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             tabPanel.removeClass('active'); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2871,4 +2888,62 @@ $(document).ready(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     })('a[name=showLevel]', slSpread.getActiveSheet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const dataChecker = DataChecker({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        loadUrl: window.location.pathname + '/load', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        loadData: { filter: 'ledger;pos' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        checkFun: function (data, progress) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const checkFields = ['contract_qty', 'qc_qty'], result = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const differBills = [], differPos = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const iLen = data.ledgerData.length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (const [i, b] of data.ledgerData.entries()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const pr = _.filter(data.posData, {lid: b.id}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (pr && pr.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const checkData = {}, calcData = {}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (const field of checkFields) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        checkData[field] = b[field] ? b[field] : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (const p of pr) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        for (const field of checkFields) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            calcData[field] = ZhCalc.add(calcData[field], p[field]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (const field of checkFields) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        calcData[field] = calcData[field] ? calcData[field] : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!_.isMatch(checkData, calcData)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        result.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ledger_id: b.ledger_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            b_code: b.b_code, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            name: b.name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            serialNo: stageTree.getNodeIndex(stageTree.getItems(b.ledger_id)) + 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            error: {checkData: checkData, calcData: calcData} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        differBills.push(b); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        for (const p of pr) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            differPos.push(p); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    progress(parseInt((i+1)/iLen*90)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            stagePos.updateDatas({update: differPos}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const refreshData = stageTree.loadPostStageData({bills: differBills}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            progress(95); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), refreshData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            stagePosSpreadObj.loadCurPosData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        errorList: errorList, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('[name=stage-start]').submit(function (e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (checkAuditorFrom()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $(this).parent().parent().parent().modal('hide'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const formData = new FormData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dataChecker.checkAndPost(this.action, formData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#hide-all').hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }); 
			 |