CREATE proc [dbo].[GetHTPrice]
(
	@Fnumber nvarchar(50)  ,
	@Fprice decimal(28,10) out,
	@Fnote  nvarchar(50)  out
)
as
begin
	declare @Fprice1  decimal(28,10)
	set @Fprice1=0
	select top 1 @Fprice1=b.F_QNV_DECIMAL3,@Fnote=a.F_QNV_TEXT2   
	from QNV_t_Cust_Entry100003 a 
		inner join QNV_t_Cust_Entry100004 b on a.FID=b.fid 
		inner join T_BD_MATERIAL  c on  c.FMATERIALID=b.F_QNV_BASE1 
		inner join T_BD_MATERIAL_L d on d.FMATERIALID=c.FMATERIALID 
	where c.FNUMBER=@Fnumber 
		and a.FDOCUMENTSTATUS='C'
	order by b.F_QNV_DATE2 desc 
    if(@Fprice1<>0)
		begin
		 set @Fprice=@Fprice1
		 return
		end
	else
	   begin
		  set @Fprice=0
		 return
	   end
end