select
u1.FBillNo 单据编号,
u1.FDate 日期,
t3.FNumber as 供应商代码,
t3.FName as 供应商,
t4.FNumber 物料代码,
t4.FName 物料名称,
t4.FModel 物料规格,
t5.fvoucherid as 凭证号,
t5.FExplanation as 摘要,
t1.FQty 入库数量,
isnull(t2.FHookQty,0) 勾稽数量,
isnull(t2.FHookAmount,0) 勾稽金额
from ICStockBill u1
inner join ICStockBillEntry t1 on u1.FInterID=t1.FInterID
left join ICHookRelations t2 on t2.FIBInterID=t1.FInterID and t2.FEntryID=t1.FEntryID and u1.FTranType=t2.FTranType
left join t_Supplier t3 on t3.FItemID=u1.FSupplyID
left join t_ICItem t4 on t4.FItemID=t1.FItemID
inner join t_Voucher T5 ON u1.FVCHINTERID=t5.fvoucherid
where u1.FTranType=1 and u1.FCancellation=0
and u1.FHookStatus<>2 and t1.FQty<>ISNULL(t2.FHookQty,0)
order by t3.FNumber
select * from ICStockBillEntry