获取指定期间存货核算后的库存金额及数量【emoji】
说明一下表信息:
0.T_HS_OUTACCTG 出库核算
1.T_HS_INIVBALANCE_H 即时库存期初余额表
2.T_HS_CALDIMENSIONS 存货核算计算维度表
3.T_HS_INIVSTOCKDIMENSION 库存属性维度表
4.T_ORG_ACCOUNTSYSTEM 会计制度
5.T_FA_ACCTPOLICY 会计政策
字典查询:https://open.kingdee.com/K3Cloud/PDM/FIN.htm
select DIM.FMATERIALID , SUM(bal.FAmount ) FAmount ,SUM(bal.FQty) FQty
from T_HS_OUTACCTG AG
inner join T_HS_INIVBALANCE_H BAL on AG.FID = BAL.FID
inner join T_HS_CALDIMENSIONS CAL on AG.FDIMENSIONID = CAL.FDIMENSIONID
inner join T_HS_INIVSTOCKDIMENSION DIM on BAL.FDIMEENTRYID = DIM.FENTRYID
inner join T_ORG_ACCOUNTSYSTEM sy on CAL.Facctsystemid =sy. FACCTSYSTEMID
inner join T_FA_ACCTPOLICY fa on fa.FACCTPOLICYID=cal.FACCTPOLICYID
where sy.fisdefault='1' and fa.fisdefault='1'and bal.FEndInitKey='1'
AND FYEAR=YEAR('{0}') AND FPERIOD=MONTH('{0}'
推荐阅读