1 我们在这张报表中有主表也有从表; 我们根据主表的数据,对从表的数据进行汇总: 如下是我们从表数据汇总的函数,请看。我们是用回车换行隔开了:
create function [dbo].[fun_GetChargePayplacecd](@keyid nvarchar(4000),@cd nchar(1),@ioid nchar(1)=1, @fmid nchar(1)='N')
returns nvarchar(4000) as
begin
DECLARE @STR varchar(8000)
SELECT @STR=ISNULL(@STR+CHAR(13)+char(10),'')+isnull(item1,'') -----用回车换行隔开了每个从表的数据
FROM (SELECT top 100 percent CAST(case when @cd='T' then f_costitem.Payplacecd else f_costitem.Payplace end as varchar(8000)) as item1 ,costprntno
FROM f_costitem left join ia_document on f_costitem.dockeyid=ia_document.keyid
left join f_costsetting on f_costsetting.costcd=f_costitem.costcd and ia_document.orgcd=f_costsetting.orgcd
WHERE f_costitem.dockeyid =@keyid and ioid=case when @ioid=0 then ioid else @ioid end
and isnull(f_costitem.fmid,'N')=@fmid order by costprntno )AS T
return @STR
end
2. 数据模板, 你看, 我们另存为pdf是OK的,但是另存为Excel有问题: 数据显示还是有问题; 另存为Word时, 线条会没掉
模板 与导出Excel:
预览:
另存为pdf:
另存为word:
|