瀏覽代碼

成本分配表 辅料金额

liuchaohui 1 年之前
父節點
當前提交
933b8cce2e

+ 7 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationIngredientMapper.xml

@@ -30,15 +30,15 @@
 		from 
 		(
 				select oti.cInvName as goodsName,max(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity 
-				 ,max(pb.rmbAmount) as rmbAmount,max(pb.usdAmount) as usdAmount,max(pb.priceExcludingtax) as priceExcludingtax,max(pb.iCost) as cost
+				 ,sum(pb.rmbAmount) as rmbAmount,sum(pb.usdAmount) as usdAmount,sum(pb.priceExcludingtax) as priceExcludingtax,max(pb.iCost) as cost
 				from UFDATA_103_2021.dbo.om_momain om
 				join UFDATA_103_2021.dbo.OM_MODetails od on om.moid=od.moid
 				join UFDATA_103_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
 				join UFDATA_103_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
 				join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
 				left join (
-						SELECT p.cInvCode,p.iorderdid,max(bi.iMoney) as rmbAmount,max(bi.iOriMoney) as usdAmount
-									,max(bi.iMoney-bi.iTaxPrice) as priceExcludingtax,max(bi.iCost) as iCost
+						SELECT p.cInvCode,p.iorderdid,sum(bi.iMoney) as rmbAmount,sum(bi.iOriMoney) as usdAmount
+									,sum(bi.iMoney-bi.iTaxPrice) as priceExcludingtax,max(bi.iCost) as iCost
 						from UFDATA_103_2021.dbo.PO_Podetails p      
 						join UFDATA_103_2021.dbo.PurBillVouchs bi  on bi.iPOsID=p.ID 
 						GROUP BY p.cInvCode,p.iorderdid 
@@ -93,15 +93,15 @@
 		from
 		(
 				select oti.cInvName as goodsName,max(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity 
-				 ,max(pb.rmbAmount) as rmbAmount,max(pb.usdAmount) as usdAmount,max(pb.priceExcludingtax) as priceExcludingtax,max(pb.iCost) as cost
+				 ,sum(pb.rmbAmount) as rmbAmount,sum(pb.usdAmount) as usdAmount,sum(pb.priceExcludingtax) as priceExcludingtax,max(pb.iCost) as cost
 				from UFDATA_101_2021.dbo.om_momain om
 				join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
 				join UFDATA_101_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
 				join UFDATA_101_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
 				join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
 				left join (
-						SELECT p.cInvCode,p.iorderdid,max(bi.iMoney) as rmbAmount,max(bi.iOriMoney) as usdAmount
-									,max(bi.iMoney-bi.iTaxPrice) as priceExcludingtax,max(bi.iCost) as iCost
+						SELECT p.cInvCode,p.iorderdid,sum(bi.iMoney) as rmbAmount,sum(bi.iOriMoney) as usdAmount
+									,sum(bi.iMoney-bi.iTaxPrice) as priceExcludingtax,max(bi.iCost) as iCost
 						from UFDATA_101_2021.dbo.PO_Podetails p
 						join UFDATA_101_2021.dbo.PO_Pomain pm on p.POID  = pm.POID
 						join UFDATA_101_2021.dbo.PurBillVouchs bi  on bi.iPOsID=p.ID
@@ -112,7 +112,7 @@
 
 						 select
 						pod.cInvCode,pod.iorderdid,sum(bi.iMoney) as rmbAmount,sum(bi.iOriMoney) as usdAmount
-						,sum(bi.iMoney-bi.iTaxPrice) as priceExcludingtax,sum(bi.iCost) as iCost
+						,sum(bi.iMoney-bi.iTaxPrice) as priceExcludingtax,max(bi.iCost) as iCost
 						 from UFDATA_101_2021.dbo.PO_Pomain pom
 						 join UFDATA_101_2021.dbo.PO_Podetails pod on pod.POID  = pom.POID
 						 join UFDATA_102_2021.dbo.SO_SODetails sd on sd.cSOCode=pom.cpoid and sd.irowno=pod.ivouchrowno