解决方案: |
新建自定义报表,写入以下语句:
select CAST(iperiod as char) as 月份, cPPID as 产品编码, Inventory.cInvStd as 规格型号,
ComputationUnit.cComUnitName as 单位, ifinqua as 产量, Inventory.iInvSCost as 出厂价,
Inventory.iInvSCost*ifinqua as 金额,
round((Sum([iTotalAmo])- Sum([iOnpTotalAmo]))/(Inventory.iInvSCost*ifinqua),2)as 分配率,
round(Sum([iTotalAmo])- Sum([iOnpTotalAmo]),2) as 总成本,
round((Sum([iTotalAmo])- Sum([iOnpTotalAmo]))/ifinqua,2) as 单位成本
from CA_AmoCt
join Inventory on CA_AmoCt.cPPID=Inventory.cInvCode
join ComputationUnit on ComputationUnit.cComunitCode=Inventory.cComUnitCode
where iperiod<>0 and ifinqua<>0
and Inventory.iInvSCost<>0
group by iperiod,cPPID,Inventory.cInvStd,ifinqua,ComputationUnit.cComUnitName,Inventory.iInvSCost
order by cppid |