📄 printcertification.bas
字号:
Attribute VB_Name = "PrintCertification"
'********************************说明************************************
'*2003-05-21 dww am 09:49 *
'*以下代码将实现打证 *
'*打证所需信息:受理号,证件类别,证件存储名,数据源 *
'*{注1}:受理号作用是作为查询条件找到打证所需的数据 *
'* 证件类别单证,正副,大中小,大二中通过证件 *
'* 类别决定调用不同的模板 *
'* 证件存储名决定证件存储的总名称 *
'* 数据源决定证件所调用的数据库 *
'*{注2}:证件模板命名规则如下:单位名_证名_操作名_类型名 *
'* 采用新的命名方法 2003-05-23 dww pm14:54 *
'* M41010519004100101此为申请表组成M+单位代码+项目代码 *
'* 其中命名采用汉语拼音并且长名简写,如单位名采用 *
'* 单位简称例子如下: jiaowenti_yinshuajingying_dz_fb *
'* weisheng_weishengxuke_dz_big *
'* M41010519004100101_dz_big *
'* 模板文件存储名如下:jiaowenti_yinshuajingying_dz_fb.rpx *
'* weisheng_weishengxuke_dz_big.rpx *
'* M41010519004100101_dz_big.rpx *
'* *
'*{注3}:此处代码根据需要进行修改,和博云的设计思想有所不同 *
'************************************************************************
Public Sub PrintViewCertification(in_TransactionNo As String, in_CertificationType As String, in_CertificationStorageName As String)
'========================================================================
'实现证书的打印预览
'因为每个证书打印数据都以模板的形式存在,存放路径是:当前路径+"\ShenPiRPX"
'打证时候首先要找到受理号所对应的数据,然后打开证书模板,把取得的数据源赋给
'模板中的数据源,其中证书模板路径为:reportFileDirectory(启动模块中定义)
'2003-08-04 dww pm11:38
'========================================================================
Dim cN As ADODB.Connection
Dim rs As ADODB.Recordset
Dim SQL As String
Dim reportFileName As String
Dim reportFilePath As String
Dim reportFileOfDepartmentCode As String
reportFileOfDepartmentCode = frmShouJian.inDepartmentCode
'========================================================================
'证书模板文件路径初始化
reportFilePath = reportFileDirectory + "\" + reportFileOfDepartmentCode
'========================================================================
'数据库连接对象和数据源对象的初始化
Set cN = New ADODB.Connection
Set rs = New ADODB.Recordset
'定义数据库连接字符串和SQL查询字符串
cN.ConnectionString = frmShouJian.DBConectString
SQL = "select * from " & in_CertificationStorageName & " where 受理号='" & in_TransactionNo & "'"
'通过数据库连接字符串打开数据库
cN.Open
'通过SQL查询字符串打开记录集
rs.Open SQL, cN, adOpenStatic, adLockReadOnly
'------------------------------------------------------------------------
'先卸载ActiveReportDZ对象然后装入,否则将会产生错误
Unload ActiveReportDZ
Load ActiveReportDZ
ActiveReportDZ.DataControl1.Recordset = rs
If Not rs.EOF Then
'========================================================================
Select Case in_CertificationType
Case "单证"
reportFileName = in_CertificationStorageName + "_dz.rpx"
reportFilePath = reportFilePath + "\" + reportFileName
Case "正本"
reportFileName = in_CertificationStorageName + "_dz_zb.rpx"
reportFilePath = reportFilePath + "\" + reportFileName
Case "副本"
reportFileName = in_CertificationStorageName + "_dz_fb.rpx"
reportFilePath = reportFilePath + "\" + reportFileName
Case "大证"
reportFileName = in_CertificationStorageName + "_dz_big.rpx"
reportFilePath = reportFilePath + "\" + reportFileName
Case "中证"
reportFileName = in_CertificationStorageName + "_dz_mid.rpx"
reportFilePath = reportFilePath + "\" + reportFileName
Case "小证"
reportFileName = in_CertificationStorageName + "_dz_small.rpx"
reportFilePath = reportFilePath + "\" + reportFileName
End Select
If Dir(reportFilePath) <> "" Then
ActiveReportDZ.LoadLayout (reportFilePath)
'此处可进行打印预览操作,直接调用Show方法显示后通过打印按钮来决定
'是否执行打印操作 2003-12-31 dww pm14:09
ActiveReportDZ.Show
Else
MsgBox "证件模板:" + reportFilePath + "不存在", 48, "系统提示"
Exit Sub
End If
Else
MsgBox "受理号为" + in_TransactionNo + "数据不存在,不能打证!", 48, "系统提示"
Set rs = Nothing
Exit Sub
End If
Set rs = Nothing
End Sub
Public Sub PrintDirectCertification(in_TransactionNo As String, in_CertificationType As String, in_CertificationStorageName As String)
'========================================================================
'实现证书的直接打印
'因为每个证书打印数据都以模板的形式存在,存放路径是:当前路径+"\ShenPiRPX"
'打证时候首先要找到受理号所对应的数据,然后打开证书模板,把取得的数据源赋给
'模板中的数据源,其中证书模板路径为:reportFileDirectory(启动模块中定义)
'2003-08-04 dww pm11:38
'========================================================================
Dim cN As ADODB.Connection
Dim rs As ADODB.Recordset
Dim SQL As String
Dim reportFileName As String
Dim reportFilePath As String
Dim reportFileOfDepartmentCode As String
reportFileOfDepartmentCode = frmShouJian.inDepartmentCode
'========================================================================
'证书模板文件路径初始化
reportFilePath = reportFileDirectory + "\" + reportFileOfDepartmentCode
'========================================================================
Set cN = New ADODB.Connection
Set rs = New ADODB.Recordset
'定义数据库连接字符串和SQL查询字符串
SQL = "select * from " & in_CertificationStorageName & " where 受理号='" & in_TransactionNo & "'"
cN.ConnectionString = frmShouJian.DBConectString
'通过数据库连接字符串打开数据库
cN.Open
'通过SQL查询字符串打开记录集
rs.Open SQL, cN, adOpenStatic, adLockReadOnly
'------------------------------------------------------------------------
'先卸载ActiveReportDZ对象然后装入,否则将会产生错误
Unload ActiveReportDZ
Load ActiveReportDZ
ActiveReportDZ.DataControl1.Recordset = rs
If Not rs.EOF Then
'========================================================================
Select Case in_CertificationType
Case "单证"
reportFileName = in_CertificationStorageName + "_dz.rpx"
reportFilePath = reportFilePath + "\" + reportFileName
Case "正本"
reportFileName = in_CertificationStorageName + "_dz_zb.rpx"
reportFilePath = reportFilePath + "\" + reportFileName
Case "副本"
reportFileName = in_CertificationStorageName + "_dz_fb.rpx"
reportFilePath = reportFilePath + "\" + reportFileName
Case "大证"
reportFileName = in_CertificationStorageName + "_dz_big.rpx"
reportFilePath = reportFilePath + "\" + reportFileName
Case "中证"
reportFileName = in_CertificationStorageName + "_dz_mid.rpx"
reportFilePath = reportFilePath + "\" + reportFileName
Case "小证"
reportFileName = in_CertificationStorageName + "_dz_small.rpx"
reportFilePath = reportFilePath + "\" + reportFileName
End Select
If Dir(reportFilePath) <> "" Then
ActiveReportDZ.LoadLayout (reportFilePath)
'-----------------------------------------------------------
'此处可进行直接打印操作,直接调用PrintReport方法打印后参数来决定
'是否是否显示打印的对话框True显示打印对话框,False不显示对话框。
'2003-12-31 dww pm14:09
ActiveReportDZ.PrintReport False
'----------------------------------------------------------
'在此将对象卸载否则打印再打印其他时候会产生错误2004-1-3 dww am15:33
Unload ActiveReportDZ
Else
MsgBox "证件模板:" + reportFilePath + "不存在", 48, "系统提示"
Exit Sub
End If
Else
MsgBox "受理号为" + in_TransactionNo + "数据不存在,不能打证!", 48, "系统提示"
Set rs = Nothing
Exit Sub
End If
Set rs = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -