| 
					
				 | 
			
			
				@@ -275,6 +275,56 @@ const stageIm = (function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         im.calc_img_remark = detail.calc_img_remark; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    function checkTzCustomDetail(im) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const cd = _.find(details, function (d) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return im.lid === d.lid && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.code || im.code === d.code) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.name || im.name === d.name) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.unit || im.unit === d.unit) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.pid || im.pid === d.pid) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.pos_name || im.pos_name === d.pos_name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (cd) loadCustomDetail(im, cd); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    function checkZlCustomDetail(im) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const cd = _.find(details, function (d) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return im.lid === d.lid && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.code || im.code === d.code) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.name || im.name === d.name) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.unit || im.unit === d.unit) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                checkZero(ZhCalc.sub(im.unit_price, d.unit_price)) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.pid || im.pid === d.pid) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.pos_name || im.pos_name === d.pos_name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (cd) loadCustomDetail(im, cd); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    function checkBwCustomDetail(im) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const cd = _.find(details, function (d) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return im.lid === d.lid && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.code || im.code === d.code) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.name || im.name === d.name) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.unit || im.unit === d.unit) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                checkZero(ZhCalc.sub(im.unit_price, d.unit_price)) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.pid || im.pid === d.pid) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.pos_name || im.pos_name === d.pos_name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (cd) loadCustomDetail(im, cd); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    function checkBbCustomDetail(im) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const cd = _.find(details, function (d) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return im.lid === d.lid && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.name || im.name === d.name) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.unit || im.unit === d.unit) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.pid || im.pid === d.pid) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                (!im.pos_name || im.pos_name === d.pos_name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (cd) loadCustomDetail(im, cd); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     function checkCustomDetail(im) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const cd = _.find(details, function (d) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return im.lid === d.lid && 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -502,6 +552,7 @@ const stageIm = (function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 lIndex: nodeIndex, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 custom_define: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 source: [{id: node.ledger_id, code: node.code, b_code: node.b_code}], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                im_type: imType.zl.value, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (stage.im_gather && node.check) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 im.bw = getZlGatherBw(node, peg); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -559,6 +610,7 @@ const stageIm = (function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 changes: [], gclBills: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 custom_define: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 source: [{id: node.ledger_id, code: node.code, b_code: node.b_code}], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                im_type: imType.bb.value, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (const p of posterity) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (p.children && p.children.length > 0) continue; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -582,6 +634,7 @@ const stageIm = (function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 changes: [], gclBills: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 custom_define: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 source: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                im_type: imType.bb.value, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             nodeImData.push(im); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -724,6 +777,7 @@ const stageIm = (function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     lIndex: nodeIndex, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     custom_define: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     source: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    im_type: imType.zl.value, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (stage.im_gather && node.check) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     im.bw = getZlGatherBw(node, peg); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -773,6 +827,7 @@ const stageIm = (function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         lIndex: nodeIndex, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         custom_define: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         source: [{id: p.ledger_id, code: p.code, b_code: p.b_code}], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        im_type: imType.bw.value, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     im.calc_memo = '本期计量:' + (checkZero(im.jl) ? 0 : im.jl) + ' ' + im.unit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     ImData.push(im); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -800,6 +855,7 @@ const stageIm = (function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     lIndex: gsTree.getNodeIndex(node), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     custom_define: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     source: [{id: p.ledger_id, code: p.code, b_code: p.b_code}], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    im_type: imType.bw.value, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 im.calc_memo = '本期计量:' + (checkZero(im.jl) ? 0 : im.jl) + ' ' + im.unit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 ImData.push(im); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -859,7 +915,12 @@ const stageIm = (function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             getCalcMemo(im); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             getChangeInfo(im); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            checkCustomDetail(im); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            switch (stage.im_type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                case imType.tz.value: checkTzCustomDetail(im); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                case imType.zl.value: checkZlCustomDetail(im); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                case imType.bw.value: checkBwCustomDetail(im); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                case imType.bb.value: checkBbCustomDetail(im); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |