|  | @@ -21,7 +21,9 @@
 | 
	
		
			
				|  |  |  		case when tab2.jian-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0
 | 
	
		
			
				|  |  |  		else tab2.jian-isnull(tab1.purchaseQuantity,0) end
 | 
	
		
			
				|  |  |  		as ingredientsTransferQuantity,
 | 
	
		
			
				|  |  | -				tab.usageQuantity-isnull(tab1.purchaseQuantity,0) as ingredientsRemainingQuantity,
 | 
	
		
			
				|  |  | +		case when tab2.jian-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then isnull(tab1.purchaseQuantity,0)-tab.usageQuantity
 | 
	
		
			
				|  |  | +		else (tab2.jian-isnull(tab1.purchaseQuantity,0))+isnull(tab1.purchaseQuantity,0)-tab.usageQuantity end
 | 
	
		
			
				|  |  | +		as ingredientsRemainingQuantity,
 | 
	
		
			
				|  |  |  				(tab1.purchaseQuantity-tab.usageQuantity)/tab1.purchaseQuantity as loss,
 | 
	
		
			
				|  |  |  				case when tab2.jian-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0
 | 
	
		
			
				|  |  |  				else (tab2.jian-isnull(tab1.purchaseQuantity,0))*tab.cost end as transferCost
 | 
	
	
		
			
				|  | @@ -83,7 +85,9 @@
 | 
	
		
			
				|  |  |  				case when tab2.jian-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0
 | 
	
		
			
				|  |  |  				else tab2.jian-isnull(tab1.purchaseQuantity,0) end
 | 
	
		
			
				|  |  |  				as ingredientsTransferQuantity,
 | 
	
		
			
				|  |  | -				tab.usageQuantity-isnull(tab1.purchaseQuantity,0) as ingredientsRemainingQuantity,
 | 
	
		
			
				|  |  | +				case when tab2.jian-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then isnull(tab1.purchaseQuantity,0)-tab.usageQuantity
 | 
	
		
			
				|  |  | +		else (tab2.jian-isnull(tab1.purchaseQuantity,0))+isnull(tab1.purchaseQuantity,0)-tab.usageQuantity end
 | 
	
		
			
				|  |  | +		as ingredientsRemainingQuantity,
 | 
	
		
			
				|  |  |  				(tab1.purchaseQuantity-tab.usageQuantity)/tab1.purchaseQuantity as loss,case when tab2.jian-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0
 | 
	
		
			
				|  |  |  				else (tab2.jian-isnull(tab1.purchaseQuantity,0))*tab.cost end as transferCost
 | 
	
		
			
				|  |  |  		from
 |