RDL/RDLC批量单据打印

使用RDL或RDLC进行单据打印时,单张单据打印比较直观简单,无需说明。下面我们来谈一下批量单据打印的实现方法。以下以RDL的ReportBuilder设计环境为例进行讲解,RDLC、VS设计环境同理。实现效果如下。

RDL/RDLC批量单据打印 [转]-LMLPHP

一、 基本思路

数据集:将单据表头、表体合并为一个数据集。例如将以下两个表合并为一个DataSet查询:单据号码、客户代码、部门、货品代码、货品名称、仓库、数量、单价、金额等。

  • 表头字段:单据号码、客户代码、部门等;
  • 表体字段:项次、货品代码、货品名称、仓库、数量、单价、金额等字段;

控件:列表、矩形、文本框、表。使用“列表”控件作为单据的边界,并在列表中设置一个“单号”分组,实现分页,在“列表”中设计单据表头及明细表体。

RDL/RDLC批量单据打印 [转]-LMLPHP

二、 详细步骤

1. 建立列表

在主体中插入一个列表,并指定其数据源。

RDL/RDLC批量单据打印 [转]-LMLPHP

选择列表,在行组中用鼠标右键选择详细信息,选择 组属性 ,设置“单据号码”分组,为了明了,修改组名称为 “单据号码”。排序选项根据需要设定。

在分页符选项卡上设置分页,这样可以实现一张单据分页的效果。

此时得到了一个单据容器,用以容纳我们即将要设计的单据。

RDL/RDLC批量单据打印 [转]-LMLPHP

2. 单据明细信息:列表与矩形

细心一点你会发现,在我们刚才插入的“列表”控件中,还有嵌套了一个“矩形”(Rectangle)控件,这是布局所需要的。如果没有矩形的话,我们拖进列表中的字段,将会成为列表本身的值。所以不管是列表、表或矩阵,如果想在Tablix表格之中再进行布局,则先铺一个矩形是非常必要的。

因为有矩形的存在,所以我们可以像普通报表一样,在列表中布置表头文本框,和表体详细数据。需要注意的是一些设计细节,比如表头居中,表体数量型字段需要居右,其他字段居左,小数位数的取舍等等。

表头的设计推荐两种方式:

1)表头信息可以使用下图中的“文本框”控件,设计空间比较自由。

RDL/RDLC批量单据打印 [转]-LMLPHP

2)也可以在详细数据表第一行之上再添加一个数据行,合并整行后插入个矩形控件,再插入一个无边框的数据表用来作为表头,这样比较整齐

aaarticlea/png;base64,iVBORw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6Y7RO0o4rhWXZHZ/gedC131HUAOBXKlIvksHS1NDEXKoWrQPOaNpfBHfWH6P5Ct6yramxWXOJkCVT5XzhRnahyjkaeEkNLojK5X67gWkWwWC1nasnbjPoCFjik7oOdgealXajYIOaezU2Z8dHaZ50rLEZtO+f1BDsHezfODL+pYycgunj3OU3Eo2PH3ycL6kCaDbqCL5EyLJVOVF9slE5r2UXqhxCCCGEtGGjcmL6ZFU5/+QLr2UXqhxCCCGEtGFVOXF9QpVDCCGEEENQ5RBCCCFkTqhyCCGEEDInWSrn869lF6ocQgghhLThscqJ6pNV5fzjz7+WXahyCCGEENKGVeXE9clG5byaXahyCCGEENKGjcqJ6ROqHEIIIYQYgiqHEEIIIXOSpXI+92p2OSOEEEIIaUtcnxRROZQ7hBBCCGlMgsr5R597dX/p7S8hhBBCjkJclpRVOSwsLCwsLCwsg5StyvkJCwsLCwsLC8s05f8DPOnwQn97TfIAAAAASUVORK5CYII=" alt="" width="604" height="194" />

3. 页眉页脚

将每页都有重复显示的东西放在页眉和页脚。当然还有表格的表头也要设置为在每页中重复。方法是先选中“表”,进入高级模式,在行组中选择作为表头的“静态”行,在属性中将RepeatOnNewPage设置为True。

如果有些信息需要在每页中都要显示,但因为针式打印中存在换页切纸问题,所以把一些重要信息设置在表中,也可以通过设置RepeatOnNewPage属性,在每页中显示。

RDL/RDLC批量单据打印 [转]-LMLPHP

4. 单据分页

在第一步中已经设置了单据分页,需要注意的是,这个列表空间与“页脚”之间不能存在空隙,否则单据最后一页就总会有一个空白页。

其实实现单据分页有很多种方法,不拘泥于这一种。大家自行摸索。

三、 其他细节

1. 大写金额

在报表空白处右击鼠标,选择报表属性,将下面的通过网络搜集的代码粘贴进去,在表中表达式中引用此函数即可。

=code.CNMoney(Sum(Fields!金额.Value))

RDL/RDLC批量单据打印 [转]-LMLPHP

RDL/RDLC批量单据打印 [转]-LMLPHP

  1 '#############################################################################
2
3 '货币转换为中文汉字表述
4
5 '函数名称:CNMoney
6
7 '参数:ls
8
9 '返回值:转换后的字符串
10
11 '整理人:阿泰
12
13 '版本历史
14
15 '本文函数来源于 feng442624978,原帖地址:
16
17 'http://topic.csdn.net/u/20100303/15/0f0ceca7-d29d-4269-b0f5-17ea09d0f139.html
18
19 '#############################################################################
20
21 Shared Function CNMoney(ls As Double) As String
22
23 Dim dx_sz As String
24
25 Dim dx_dw As String
26
27 Dim str_int As String
28
29 Dim str_dec As String
30
31 Dim dx_str As String
32
33 Dim fu As String
34
35 Dim a As String
36
37 Dim b As String
38
39 Dim c As String
40
41 Dim d As String
42
43 Dim b2 As String
44
45 Dim num_int As Long
46
47 Dim num_dec As Long
48
49 Dim len_int As Long
50
51 Dim i As Long
52
53 Dim a_int As Long
54
55 Dim pp As Long
56
57 dx_sz = "零壹贰叁肆伍陆柒捌玖"
58
59 dx_dw = "万仟佰拾亿仟佰拾万仟佰拾圆"
60
61 If ls = 0 Then
62
63 CNMoney = "零圆整"
64
65 Exit Function
66
67 End If
68
69 If ls < 0 Then
70
71 ls = Abs(ls)
72
73 fu = "负"
74
75 Else
76
77 fu = ""
78
79 End If
80
81 dx_str = CStr(ls)
82
83 dx_str = Replace(dx_str, "¥", "")
84
85 dx_str = Replace(dx_str, ",", "")
86
87 If (ls >= 0) And (ls < 1) Then dx_str = "0" + dx_str
88
89 pp = InStr(dx_str, ".")
90
91 If pp > 0 Then
92
93 str_int = Mid(dx_str, 1, InStr(dx_str, ".") - 1)
94
95 Else
96
97 str_int = dx_str
98
99 End If
100
101 num_int = CLng(str_int)
102
103 If (ls > 0) And (ls < 1) Then
104
105 num_dec = ls * 100
106
107 Else
108
109 num_dec = (ls - num_int) * 100
110
111 End If
112
113 str_dec = CStr(num_dec)
114
115 str_dec = Replace(str_dec, "¥", "")
116
117 len_int = Len(str_int)
118
119 dx_str = ""
120
121 For i = 1 To len_int
122
123 a = Mid(str_int, i, 1)
124
125 a_int = CLng(a)
126
127 b = Mid(dx_sz, (a_int + 1), 1)
128
129 c = Mid(dx_dw, (13 - len_int + i), 1)
130
131 If dx_str <> "" Then
132
133 d = Mid(dx_str, Len(dx_str) - 1, 1)
134
135 Else
136
137 d = ""
138
139 End If
140
141 If (b = "零") And ((d = "零") Or (b = b2) Or (c = "圆") Or (c = "万") Or (c = "亿")) Then b = ""
142
143 If (a = "0") And (c <> "圆") And (c <> "万") And (c <> "亿") Then c = ""
144
145 If ((c = "圆") Or (c = "万") Or (c = "亿")) And (d = "零") And (a = "0") Then
146
147 dx_str = Mid(dx_str, 1, Len(dx_str) - 2)
148
149 d = Mid(dx_str, Len(dx_str) - 1, 2)
150
151 If ((c = "圆") And (d = "万")) Or ((c = "万") And (d = "亿")) Then c = ""
152
153 End If
154
155 dx_str = dx_str + b + c
156
157 b2 = b
158
159 Next i
160
161 '处理金额小于1的情况
162
163 If Len(dx_str) < 2 Then dx_str = ""
164
165 If (num_dec < 10) And (ls > 0) Then
166
167 a_int = CLng(str_dec)
168
169 b = Mid(dx_sz, (a_int + 1), 1)
170
171 If num_dec = 0 Then dx_str = dx_str + "整"
172
173 If num_dec > 0 Then dx_str = dx_str + "零" + b + "分"
174
175 End If
176
177 If num_dec >= 10 Then
178
179 a_int = CLng(Mid(str_dec, 1, 1))
180
181 a = Mid(dx_sz, (a_int + 1), 1)
182
183 a_int = CLng(Mid(str_dec, 2, 1))
184
185 b = Mid(dx_sz, (a_int + 1), 1)
186
187 If a <> "零" Then a = a + "角"
188
189 If b <> "零" Then b = b + "分" Else b = ""
190
191 dx_str = dx_str + a + b
192
193 End If
194
195 dx_str = fu + dx_str
196
197 dx_str = Replace(dx_str, "零亿", "亿")
198
199 dx_str = Replace(dx_str, "零万", "万")
200
201 dx_str = Replace(dx_str, "零千", "千")
202
203 dx_str = Replace(dx_str, "零圆", "圆")
204
205 CNMoney = dx_str
206
207 End Function

2. 页码

所有的单据中都需要显示第几页共几页,所以我们只需要打开两个报表文件复制粘贴即可,这样做不仅省时省力,还可以保持统一风格。

页码在新版RDL/RDLC中分为组内页码与全部页码两种,作为全局变量都只能放置于页眉或页脚。全部页码指示报表所有的页码情况,而组内页码通常用于单据打印时显示每张单据的第几页共几页。

组内页码:第Globals!PageNumber 页 共 Globals!TotalPages 页

全部页码:第 Globals!OverallPageNumber 页 共 Globals!OverallTotalPages 页

要使用组内分页效果还需设置分页符所在对象中的ResetPageNumber属性,其位于PageBreak属性组中。如本例中,分页符设置在了“总列表”中的组属性中,则就在这个组的属性中设置。

RDL/RDLC批量单据打印 [转]-LMLPHP

05-11 21:55