日期:2014-05-17 浏览次数:20605 次
create function uf_jt_bankdailyAll
(@companyid varchar(10),@begindate datetime,@endbegindate datetime,
@periodid varchar(7),@status varchar(10),@supplierName varchar(200)
)
returns @table table
(
companyid varchar(10),begindate datetime,endbegindate datetime,
periodid varchar(7),[status] varchar(10),supplierName varchar(200)
)
as
begin
insert into @table
select * from
(select *,status=case hzflag when 0 then '待处理' when 1 then '已处理' else '全部' end
from jt_bankdailyAll where companyid=@companyid and( docdate between @begindate and @endbegindate or @begindate is null)
and ( convert(varchar(7),docdate,120)=@periodid or isnull(@periodid,'')='') and
(isnull(@supplierName,'')='' or charindex(@supplierName,supplierName)>0) )T
where status=@status or @status='全部'
return
end
go