Browse Source

成本报表 辅料转入成本

liuchaohui 2 years ago
parent
commit
d600ee09cb

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

@@ -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