|  | @@ -22,7 +22,9 @@
 | 
	
		
			
				|  |  |  		else tab2.jian-isnull(tab1.purchaseQuantity,0) end
 | 
	
		
			
				|  |  |  		as ingredientsTransferQuantity,
 | 
	
		
			
				|  |  |  				tab.usageQuantity-isnull(tab1.purchaseQuantity,0) as ingredientsRemainingQuantity,
 | 
	
		
			
				|  |  | -				(tab1.purchaseQuantity-tab.usageQuantity)/tab1.purchaseQuantity as loss,(isnull(tab1.purchaseQuantity,0)-tab2.jian)*tab.cost as transferCost
 | 
	
		
			
				|  |  | +				(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 
 | 
	
		
			
				|  |  |  		(
 | 
	
		
			
				|  |  |  				select oti.cInvName as goodsName,max(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity 
 | 
	
	
		
			
				|  | @@ -82,7 +84,8 @@
 | 
	
		
			
				|  |  |  				else tab2.jian-isnull(tab1.purchaseQuantity,0) end
 | 
	
		
			
				|  |  |  				as ingredientsTransferQuantity,
 | 
	
		
			
				|  |  |  				tab.usageQuantity-isnull(tab1.purchaseQuantity,0) as ingredientsRemainingQuantity,
 | 
	
		
			
				|  |  | -				(tab1.purchaseQuantity-tab.usageQuantity)/tab1.purchaseQuantity as loss,(isnull(tab1.purchaseQuantity,0)-tab2.jian)*tab.cost as transferCost
 | 
	
		
			
				|  |  | +				(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
 | 
	
		
			
				|  |  |  		(
 | 
	
		
			
				|  |  |  				select oti.cInvName as goodsName,max(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity 
 |