我们可以通过存储过程自定义报表
1、在菜单中新增报表菜单,这里的代码约束为报表对应存储过程名称,配置完成成后重启客户端生效
2、在自定义模板中适配存储过程入参,这里的功能键值为存储过程名称,字段键值与存储过程入参对应
3、在数据库中适配存储过程
if (exists (select * from sys.objects where name = 'sp_udefreport_voucher_udef'))
drop proc sp_udefreport_voucher_udef
go
create proc sp_udefreport_voucher_udef
(
@yearBegin int,
@periodBegin int,
@yearEnd int,
@periodEnd int
)
as
select 'ID' as _id, '凭证字号' as _voucher_no, '黄金单价' as _price_gold, '黄金数量' as _qty_gold, '石头单价' as _price_stone, '石头数量' as _qty_stone, '备注' as _remark;
select h._word + '-' + convert(nvarchar(10), h._no) as _voucher_no,e._id,
convert(decimal(18,2), e._price_gold) as _price_gold,convert(decimal(18,2),e._qty_gold) as _qty_gold,
convert(decimal(18,2), e._price_stone) as _price_stone,convert(decimal(18,2),e._qty_stone) as _qty_stone,
e._remark
from _VoucherEntryUdef as e
inner join _VoucherHeader h on e._id = h._id
where h._year >= @yearBegin and h._period >= @periodBegin and h._year <= @yearEnd and h._period <= @periodEnd
go
以上配置完成就可以去试试。enjoy!