套打.二开案例.打印一个单据体的两个子单据体
【场景】打印一个单据体的两个子单据体
【案例】以检验单为例,在一个数据表格中打印两个子单据体
<0>数据库视图,将两个子单据体合并为一个表
具体合并成什么样根据业务需求,数据库视图的逻辑不在这个帖子说明,参考:[数据库视图](https://wenku.my7c.com/article/302821751594042112?productLineId=1)
```sql
create view V_QM_NotePrintSubEntity as
select t.FENTRYID * 100 + t.FSEQ as FDetailID, t.* from
(select detail.FENTRYID, 1 as FSEQ,
'检验项目' as 'F_M_Text1','抽样数' as 'F_M_Text2' ,'不合格数' as 'F_M_Text3',
'检验结果' as 'F_M_Text4','检验方法' as 'F_M_Text5','检验仪器' as 'F_M_Text6',
'抽样方案' as 'F_M_Text7'
from T_QM_IBITEMDETAIL detail where FSeq = 1
union all
select detail.FENTRYID, detail.FSEQ + 1 as FSEQ,
itemL.FNAME as 'F_M_Text1', convert(varchar(20),detail.FSampleQty) as 'F_M_Text2', convert(varchar(20),detail.FSampleQty) as 'F_M_Text3',
detail.FInspectResult as 'F_M_Text4', methodL.FNAME as 'F_M_Text5', instL.FNAME as 'F_M_Text6',
schemeL.FNAME as 'F_M_Text7'
from T_QM_IBITEMDETAIL detail
left join T_QM_INSPECTITEM item on detail.FInspectItemId = item.FID
left join T_QM_INSPECTITEM_L itemL on item.FID = itemL.FID and itemL.FLOCALEID = 2052
left join T_QM_INSPECTMETHOD method on detail.FInspectMethodId = method.FID
left join T_QM_INSPECTMETHOD_L methodL on method.FID = methodL.FID and methodL.FLOCALEID = 2052
left join T_QM_INSPECTINSTRUMENT inst on detail.FInspectInstrumentId = inst.FID
left join T_QM_INSPECTINSTRUMENT_L instL on inst.FID = instL.FID and instL.FLOCALEID = 2052
left join T_QM_SAMPLESCHEME scheme on scheme.FID = detail.FSAMPLESCHEMEID
left join T_QM_SAMPLESCHEME_L schemeL on scheme.FID = schemeL.FID and schemeL.FLOCALEID = 2052
union all
select detail.FENTRYID, 1+ isnull((select 1+ MAX(fseq) from T_QM_IBITEMDETAIL seq where detail.FENTRYID = seq.FENTRYID),0) as FSEQ,
'缺陷名称' as 'F_M_Text1','缺陷数' as 'F_M_Text2' ,'缺陷等级' as 'F_M_Text3',
'缺陷原因' as 'F_M_Text4','' as 'F_M_Text5','' as 'F_M_Text6',
'' as 'F_M_Text7'
from T_QM_IBDEFECTDETAIL detail where FSeq = 1
union all
select detail.FENTRYID,detail.FSEQ+1+ isnull((select 1+ MAX(fseq) from T_QM_IBITEMDETAIL seq where detail.FENTRYID = seq.FENTRYID),0) as FSEQ,
defTypeL.FNAME as 'F_M_Text1', convert(varchar(20),FDefectQty) as 'F_M_Text2',convert(varchar(20), FDefectLevel) as 'F_M_Text3',
reasonL.FNAME as 'F_M_Text4', ''as 'F_M_Text5' ,'' as 'F_M_Text6',
'' as 'F_M_Text7'
from T_QM_IBDEFECTDETAIL detail
left join T_QM_DEFECTTYPE defType on detail.FDefectTypeId = defType.FID
left join T_QM_DEFECTTYPE_L defTypeL on defType.FID = defTypeL.FID and defTypeL.FLOCALEID = 2052
left join T_QM_DEFECTREASON reason on reason.FID = detail.FDEFECTREASONID
left join T_QM_DEFECTREASON_L reasonL on reason.FID = reasonL.FID and reasonL.FLOCALEID = 2052
) t
```
数据库视图的效果
![image.webp](/download/0100aab57b883cb346ffb22b60f7c836e16b.webp)
<1>增加子单据体绑定视图
![image.webp](/download/0100d43fee3390e5486fb8f1418750e5a078.webp)
![image.webp](/download/01000328fc9fe3a1440a8c3edf5ed2771f41.webp)
<2>套打模板绑定,调整为绑定自定义子单据体
![image.webp](/download/0100629a4743b48a40a19df04e34f6b492e5.webp)
效果:多个子单据体正常换页输出
![image.webp](/download/01005ac46344f77e4f3296c56faea643f718.webp)
![image.webp](/download/0100f410788b69df4360a30ab42e4e503528.webp)
套打.二开案例.打印一个单据体的两个子单据体
【场景】打印一个单据体的两个子单据体【案例】以检验单为例,在一个数据表格中打印两个子单据体<0>数据库视图,将两个子单据体合并为一个...
点击下载文档
上一篇:想了解如何深入某个模块的应用下一篇:前端请求超时报错的解决办法
本文2024-09-16 18:21:16发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-21591.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章