获取出货单行的预设科目=主营业务成本的会计科目
查询SQL语句
select sp.DocNo,spl.DocLineNo,Act.Segment1
from SM_ShipLine as spl
inner join SM_Ship as sp on sp.ID=spl.Ship
inner join InvTrans_Period as peri on peri.TransDocLine_EntityType='UFIDA.U9.SM.Ship.ShipLine' and peri.TransDocLine_EntityID=spl.ID
inner join InvTrans_PeriodCost as cost on cost.Period=peri.ID
inner join AAI_TransactionEntry as aai on aai.OriginalEntityType='UFIDA.U9.InvTrans.Trans.PeriodCost' and aai.OriginalEntity=cost.ID
inner join AAI_TransEntryTemplet as aaitemp on aaitemp.ID=aai.EntryTemplet -- 交易分录模板
inner join AAI_PredeterminedAccount_Trl as aaipreaccl on aaipreaccl.ID=aaitemp.PredAcct and aaipreaccl.Name=N'主营业务成本' -- 预设科目
inner join CBO_Account AS Act ON aai.Account = Act.ID -- 会计科目
where sp.DocNo='101FHD25012000001'
结果


评论 (0)