| 
					
				 | 
			
			
				@@ -237,9 +237,8 @@ let baseCalcField = [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class BillsCalcHelper { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     constructor (project, calcFlag) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.project = project; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.InitFields(this.project.calcFields); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.InitFields(project.calcFields); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     getBillsGLjs (node) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let rations = this.project.Ration.getBillsSortRation(node.source.getID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let gljs = this.project.ration_glj.getGatherGljArrByRations(rations); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -248,7 +247,7 @@ class BillsCalcHelper { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return gljs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    calcRationLeaf (node, fields) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    calcRationLeaf (node, fields, isIncre) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         nodeCalcObj.node = node; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         nodeCalcObj.digit = this.project.Decimal.unitFee; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         calcFees.checkFields(node.data, fields); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -277,47 +276,50 @@ class BillsCalcHelper { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     node.data.feesIndex[field.type].unitFee = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let value = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             switch (field.totalFeeFlag) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case sumTotalFeeFlag: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    node.data.feesIndex[field.type].totalFee = nodeCalcObj.sumTotalFee().toDecimal(this.project.Decimal.common.totalFee); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    value = nodeCalcObj.sumTotalFee().toDecimal(this.project.Decimal.common.totalFee); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case totalFeeFlag: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    node.data.feesIndex[field.type].totalFee = nodeCalcObj.totalFee().toDecimal(this.project.Decimal.common.totalFee); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    value = nodeCalcObj.totalFee().toDecimal(this.project.Decimal.common.totalFee); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    node.data.feesIndex[field.type].totalFee = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    value = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.setTotalFee(node, field, value, isIncre); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    calcVolumePriceLeaf (node, fields) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    calcVolumePriceLeaf (node, fields, isIncre) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let total = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (let child of this.node.children) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             total += this.getFee(child.data, 'feesIndex.common.totalFee'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    calcParent (node, fields) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    calcParent (node, fields, isIncre) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         nodeCalcObj.node = node; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         calcFees.checkFields(node.data, fields); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (let field of fields) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             nodeCalcObj.field = field; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            node.data.feesIndex[field.type].totalFee = nodeCalcObj.sumTotalFee().toDecimal(this.project.Decimal.common.totalFee); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let value = nodeCalcObj.sumTotalFee().toDecimal(this.project.Decimal.common.totalFee); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.setTotalFee(node, field, value, isIncre); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    calcNode(node) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    calcNode(node, isIncre) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (node.source.children.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            this.calcParent(node, this.project.calcFields); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.calcParent(node, this.project.calcFields, isIncre); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (node.children.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (node.firstChild().sourceType === this.project.Ration.getSourceType()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    this.calcRationLeaf(node, this.project.calcFields); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.calcRationLeaf(node, this.project.calcFields, isIncre); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    this.calcVolumePriceLeaf(node, this.project.calcFields); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.calcVolumePriceLeaf(node, this.project.calcFields, isIncre); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     calcNodes (nodes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (let node of nodes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (node.sourceType !== this.project.Bills.getSourceType()) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -329,6 +331,22 @@ class BillsCalcHelper { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.calcNode(node); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    updateParent (parent, field, Incre) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (parent && parent.sourceType === this.project.Bills.getSourceType()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            calcFees.checkFields(parent.data, [field]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            parent.data.feesIndex[field.type].totalFee = (parent.data.feesIndex[field.type].totalFee + Incre).toDecimal(this.project.Decimal.common.totalFee); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.updateParent(parent.parent, field, Incre); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    setTotalFee (node, field, value, isIncre) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (isIncre) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let incre = value - node.data.feesIndex[field.type].totalFee; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            node.data.feesIndex[field.type].totalFee = value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.updateParent(node.parent, field, incre); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            node.data.feesIndex[field.type].totalFee = value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     converseCalc (node) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (node && node.sourceType === this.project.Bills.getSourceType()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.calcNode(node); 
			 |