| 
					
				 | 
			
			
				@@ -165,7 +165,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			a.comcode as cCode,case when a.iSQuantity is null or a.iSQuantity=0 then a.iquantity else a.iSQuantity end as iQuantity, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,a.cInvCode,isnull(a.cFree1,'') as cColor, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			case when a.cBatch is not null and a.cBatch='期初' then '期初' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				isnull(stuff(( 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -205,7 +205,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		) union all ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			a.comcode as cCode,case when a.iSQuantity is null or a.iSQuantity=0 then a.iquantity else a.iSQuantity end as iQuantity, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,a.cInvCode,isnull(a.cFree1,'') as cColor, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			case when a.cBatch is not null and a.cBatch='期初' then '期初' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				isnull(stuff(( 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -359,13 +359,14 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	<!--获取本次采购入库单,含发票和结算数据--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	<select id="getPurchaseInList" resultType="org.jeecg.modules.report.entity.FabricPoOrderIn"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		select a.cCode,a.cBusType,b.cInvCode,b.cFree1 as cColor,b.cBatch,b.iQuantity, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		select a.cCode,a.cBusType,b.cInvCode,b.cFree1 as cColor,b.cBatch,b.iQuantity,e.cInvName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		isnull((select sum(iPBVQuantity ) from PurBillVouchs x where x.RdsId =b.autoid),0) as iQuantityInvoice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		isnull((select sum(iSum)/sum(iPBVQuantity ) from PurBillVouchs  x where x.RdsId =b.autoid),0) as iPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		isnull(isnull((select sum(iSum)/sum(iPBVQuantity ) from PurBillVouchs  x where x.RdsId =b.autoid),b.iSum/b.iQuantity),0) as iPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		isnull((select sum(iSVQuantity) from PurSettleVouchs  x where x.iRdsID=b.autoid),0) as iQuantitySettle 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		from RdRecord01 a inner join RdRecords01 b on a.id=b.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		inner join PO_Podetails c on  b.iposid=c.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		inner join PO_Pomain d on d.poid=c.poid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		inner join Inventory e on b.cinvcode=e.cinvcode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		where d.cPOID like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	<!--获取费用支出--> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -630,7 +631,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			select f.cBusType,f.cCode,g.cVenName,g.cVenAbbName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			e.cInvCode,isnull(e.cFree1,'') as cColor,isnull(e.cBatch,'') as cBatch, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			e.iQuantity, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			isnull((select sum(iSum) from PurBillVouchs  x where x.RdsId =e.autoid and f.cbustype='普通采购'),0) as iPurchuseMoney, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			isnull(isnull((select sum(iSum) from PurBillVouchs  x where x.RdsId =e.autoid and f.cbustype='普通采购'),iSum ),0) as iPurchuseMoney, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			e.iOMoDID as MODetailsID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			from rdrecords01 e 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				inner join rdrecord01 f on e.id=f.id 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -682,7 +683,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	select e.autoid,f.cBusType,f.cCode,g.cVenName,g.cVenAbbName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		e.cInvCode,isnull(e.cFree1,'') as cColor,isnull(e.cBatch,'') as cBatch, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		e.iQuantity, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		isnull((select sum(iSum) from PurBillVouchs  x where x.RdsId =e.autoid and f.cbustype='普通采购'),0) as iPurchuseMoney, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		isnull(isnull((select sum(iSum) from PurBillVouchs  x where x.RdsId =e.autoid and f.cbustype='普通采购'),iSum ),0) as iPurchuseMoney, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		e.iOMoDID as MODetailsID, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		(select top 1  x.cInvCode2+isnull(x.cColor2,'')+isnull(x.cAVBatch2,'') from 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				VIEW_FabricLoss_AssemVouchs x where 
			 |