📄 mdlzhangjf.bas
字号:
xmlNode.appendChild currNode
Set currNode = objDom.createNode(NODE_ELEMENT, "表体", "")
Set tempNode = objDom.createNode(NODE_ELEMENT, "表体头", "")
currNode.appendChild tempNode
con.Open g_sDataSourceName
rec.Open sql, con
PrintTypeList = "": PrintSizeList = ""
For i = 0 To rec.Fields.count - 1
Set unitNode = objDom.createNode(NODE_ELEMENT, "单元", "")
tempNode.appendChild unitNode
unitNode.Text = rec.Fields(i).Name
If rec.Fields(i).Type = adBigInt Then
PrintTypeList = PrintTypeList & "4" & ","
PrintSizeList = PrintSizeList & "8" & ","
ElseIf rec.Fields(i).Type = adInteger Then
PrintTypeList = PrintTypeList & "3" & ","
PrintSizeList = PrintSizeList & "4" & ","
ElseIf rec.Fields(i).Type = adSmallInt Then
PrintTypeList = PrintTypeList & "3" & ","
PrintSizeList = PrintSizeList & "2" & ","
ElseIf rec.Fields(i).Type = adTinyInt Then
PrintTypeList = PrintTypeList & "2" & ","
PrintSizeList = PrintSizeList & "1" & ","
ElseIf rec.Fields(i).Type = adDate Or rec.Fields(i).Type = adDBDate Or rec.Fields(i).Type = adDBTime Or rec.Fields(i).Type = adDBTimeStamp Then
PrintTypeList = PrintTypeList & "8" & ","
PrintSizeList = PrintSizeList & "8" & ","
ElseIf rec.Fields(i).Type = adCurrency Then
PrintTypeList = PrintTypeList & "7" & ","
PrintSizeList = PrintSizeList & "8" & ","
ElseIf rec.Fields(i).Type = adSingle Then
PrintTypeList = PrintTypeList & "7" & ","
PrintSizeList = PrintSizeList & "4" & ","
ElseIf rec.Fields(i).Type = adDouble Then
PrintTypeList = PrintTypeList & "7" & ","
PrintSizeList = PrintSizeList & "8" & ","
Else
PrintTypeList = PrintTypeList & "10" & ","
PrintSizeList = PrintSizeList & rec.Fields(i).DefinedSize & ","
End If
Next
PrintTypeList = mID(PrintTypeList, 1, Len(PrintTypeList) - 1)
PrintSizeList = mID(PrintSizeList, 1, Len(PrintSizeList) - 1)
Do Until rec.EOF
Set tempNode = objDom.createNode(NODE_ELEMENT, "表体行", "")
currNode.appendChild tempNode
For i = 0 To rec.Fields.count - 1
Set unitNode = objDom.createNode(NODE_ELEMENT, "单元", "")
tempNode.appendChild unitNode
unitNode.Text = IIf(IsNull(rec.Fields(i).Value), "", rec.Fields(i).Value)
Next
rec.MoveNext
Loop
'Set tempNode = objDom.createNode(NODE_ELEMENT, "表体尾", "")
'currNode.appendChild tempNode
xmlNode.appendChild currNode
Set currNode = objDom.createNode(NODE_ELEMENT, "表尾", "")
Set tempNode = objDom.createNode(NODE_ELEMENT, "字段", "")
currNode.appendChild tempNode
tempNode.Text = "操作员:" & zjLogInfo.cUserId
Set tempNode = objDom.createNode(NODE_ELEMENT, "字段", "")
currNode.appendChild tempNode
tempNode.Text = "打印日期:" & zjLogInfo.curDate
xmlNode.appendChild currNode
Set currNode = objDom.createNode(NODE_ELEMENT, "页脚", "")
currNode.Text = "用友软件\n第 %p 页, 共 %P 页"
xmlNode.appendChild currNode
rec.Close
con.Close
Set rec = Nothing
Set con = Nothing
xmlNode.appendChild currNode
objDom.documentElement.appendChild xmlNode
SetPrintDataXML = objDom.xml
Set objDom = Nothing
Exit Function
lblHandle:
SetPrintDataXML = ""
End Function
Public Function SetPrintStyleXML(PrintSetup As String) As String
Dim con As New adodb.Connection
Dim rec As New adodb.Recordset
Dim sql As String
Dim xml As String
On Error GoTo errHandle
xml = "<?xml version='1.0' standalone='yes' ?><格式><打印设置 打印范围='全部' 页码范围='1-1' 打印份数='1' 压缩='是' 多任务强制分页='否' /><纸张设置 纸张类型='9' 纸张大小='2100,2970' 打印方向='横向' 页边距='300,200,200,200' /><页眉 对齐方式='左' 左顶点='0,0' 宽='0' 高='100' 字体名='楷体_GB2312' 字体大小='12' 颜色='#000000' 粗体='否' 斜体='否' 打印='是' /><标题 对齐方式='中' 左顶点='0,200' 宽='0' 高='300' 字体名='黑体' 字体大小='24' 颜色='#000000' 粗体='是' 斜体='否' 打印='是' /> <表头 对齐方式='左' 左顶点='0,500' 宽='1600' 高='300' 字体名='宋体' 字体大小='12' 颜色='#000000' 粗体='否' 斜体='否' 打印='是'><字段 打印='是' 名字='日期' 对齐方式='左' 左顶点='1100,500' 宽='800' 高='200' 字体名='黑体' 字体大小='16' 颜色='#000000' 粗体='否' 斜体='否' 标题宽度='0' 下标线='否' /></表头><表体 左顶点='0,800' 宽='0' 高='1400' 固定行数='0' 列宽='250,220,350,350,300,400'><表体头 对齐方式='中' 边框风格='735' 边框宽度='2' 行高='140' 字体名='黑体' 字体大小='14' 颜色='#000000' 粗体='是' 斜体='否' 打印='是' />" & _
"<表体行 对齐方式='左,左,左,左 , 左, 左, 左, 左, 左, 左 ' 边框风格='783' 边框宽度='2' 行高='0' 字体名='Times New Roman' 字体大小='12' 颜色='#000000' 粗体='否' 斜体='否' 打印='是' /><表体尾 对齐方式='中' 边框风格='735' 边框宽度='2' 行高='140' 字体名='黑体' 字体大小='14' 颜色='#000000' 粗体='否' 斜体='否' 打印='是' /></表体><页脚 对齐方式='右' 左顶点='0,2400' 宽='0' 高='170' 字体名='楷体_GB2312' 字体大小='10' 颜色='#000000' 粗体='否' 斜体='否' 打印='是' /></格式>"
con.Open g_sDataSourceName
rec.Open "Select ModuleID,FormatXML from PRN_Format where ModuleID='FD'", con, adOpenDynamic, adLockOptimistic
If Not rec.EOF Then
If PrintSetup <> "" Then
xml = PrintSetup
rec("FormatXML") = xml
rec.Update
End If
Else
If PrintSetup <> "" Then
xml = PrintSetup
rec.AddNew
rec("ModuleID") = "FD"
rec("FormatXML") = xml
rec.Update
Else
rec.AddNew
rec("ModuleID") = "FD"
rec("FormatXML") = xml
rec.Update
End If
End If
rec.Close
con.Close
Set rec = Nothing
Set con = Nothing
SetPrintStyleXML = xml
Exit Function
errHandle:
rec.Close
con.Close
Set rec = Nothing
Set con = Nothing
SetPrintStyleXML = ""
End Function
Public Sub SetTlbStyle(Form As Object, Optional Resize As Boolean = True)
On Error Resume Next
If gToolbarStyle = 1 Then '文本按钮
Form.ocxCtbTool.Visible = False
Form.ocxCtbTool.RefreshVisible
Form.ocxCtbTool.SetToolbar Form.tlbAction
Form.ocxCtbTool.SpecialEffect = True
Form.ocxCtbTool.SetDisplayStyle TextOnly
Form.ocxCtbTool.Visible = True
Form.ocxCtbTool.top = 0
Else '图形按钮
Form.ocxCtbTool.SetToolbar Form.tlbAction
Form.ocxCtbTool.SetDisplayStyle PictureText
Form.ocxCtbTool.Visible = False
End If
If Resize Then ResizeCtbTool Form
End Sub
Public Sub ResizeCtbTool(Form As Object, Optional picContainer As Object, Optional treStyle As Object, Optional jkrTree As Object)
On Error Resume Next
If Form.Name = "frmAccSet" Then
If Form.ocxCtbTool.Visible Then
Form.tlbAction.Visible = False
Form.ocxCtbTool.top = 0
Form.ocxCtbTool.width = Form.width
Form.lblAccSubject(0).top = Form.ocxCtbTool.Height
Form.lgdAccSubject.top = Form.ocxCtbTool.Height
Form.lblAccSubject(1).top = Form.ocxCtbTool.Height + 330
Form.cboDebCred.top = Form.ocxCtbTool.Height + 330
Form.sgdSubject.top = Form.ocxCtbTool.Height + 330 + 330
Else
Form.tlbAction.Visible = True
Form.lblAccSubject(0).top = Form.tlbAction.Height
Form.lgdAccSubject.top = Form.tlbAction.Height
Form.lblAccSubject(1).top = Form.tlbAction.Height + 330
Form.cboDebCred.top = Form.tlbAction.Height + 330
Form.sgdSubject.top = Form.tlbAction.Height + 330 + 330
End If
ResizeForm Form, Form.sgdSubject, Form.sgdSubject, Form.sgdSubject, FRM_ACCSET_WIDTH, FRM_ACCSET_HEIGHT
Exit Sub
End If
If Form.ocxCtbTool.Visible Then
Form.tlbAction.Visible = False
Form.ocxCtbTool.top = 0
Form.ocxCtbTool.width = Form.width
If IsEmpty(picContainer) Or picContainer Is Nothing Then
Form.picContainer.top = Form.ocxCtbTool.Height
Form.picView.top = Form.ocxCtbTool.Height
Form.msg.top = Form.ocxCtbTool.Height
Form.treStyle.top = Form.ocxCtbTool.Height
Form.jkrTree.top = Form.ocxCtbTool.Height
Else
picContainer.top = Form.ocxCtbTool.Height
treStyle.top = Form.ocxCtbTool.Height
jkrTree.top = Form.ocxCtbTool.Height
End If
Form.jkrTree.maxLeft = Form.ScaleWidth - g_conMoveLimit
Form.jkrTree.minLeft = g_conMoveLimit
Form.treStyle.Move 0, Form.ocxCtbTool.Height, Form.jkrTree.left, Form.ScaleHeight - Form.ocxCtbTool.Height
Form.jkrTree.Move Form.jkrTree.left, Form.ocxCtbTool.Height, 50, Form.ScaleHeight
If Form.Name = "frmVchQueryResult" Then Form.msg.Move 0, Form.ocxCtbTool.Height, Form.ScaleWidth, Form.ScaleHeight - Form.ocxCtbTool.Height
If Form.Name = "frmAccMgr" Then Form.msg.Move Form.jkrTree.left + 50, Form.ocxCtbTool.Height, Form.ScaleWidth - Form.jkrTree.left - 50, Form.ScaleHeight - Form.ocxCtbTool.Height
Form.picView.Move Form.jkrTree.left + 50, Form.ocxCtbTool.Height, Form.ScaleWidth - Form.jkrTree.left - 50, Form.ScaleHeight - Form.ocxCtbTool.Height
Form.picContainer.Move Form.jkrTree.left + 50, Form.ocxCtbTool.Height, Form.ScaleWidth - Form.jkrTree.left - 50, Form.ScaleHeight - Form.ocxCtbTool.Height
Form.objF1Book.width = Form.picContainer.width - 60
Form.objF1Book.Height = Form.picContainer.Height - 60
Else
Form.tlbAction.Visible = True
If IsEmpty(picContainer) Or picContainer Is Nothing Then
Form.picContainer.top = Form.tlbAction.Height
Form.picView.top = Form.tlbAction.Height
Form.msg.top = Form.tlbAction.Height
Form.treStyle.top = Form.tlbAction.Height
Form.jkrTree.top = Form.tlbAction.Height
Else
picContainer.top = Form.tlbAction.Height
treStyle.top = Form.tlbAction.Height
jkrTree.top = Form.tlbAction.Height
End If
Form.jkrTree.maxLeft = Form.ScaleWidth - g_conMoveLimit
Form.jkrTree.minLeft = g_conMoveLimit
Form.treStyle.Move 0, Form.tlbAction.Height, Form.jkrTree.left, Form.ScaleHeight - Form.tlbAction.Height
Form.jkrTree.Move Form.jkrTree.left, Form.tlbAction.Height, 50, Form.ScaleHeight
If Form.Name = "frmVchQueryResult" Then Form.msg.Move 0, Form.tlbAction.Height, Form.ScaleWidth, Form.ScaleHeight - Form.tlbAction.Height
If Form.Name = "frmAccMgr" Then Form.msg.Move Form.jkrTree.left + 50, Form.tlbAction.Height, Form.ScaleWidth - Form.jkrTree.left - 50, Form.ScaleHeight - Form.tlbAction.Height
Form.picView.Move Form.jkrTree.left + 50, Form.tlbAction.Height, Form.ScaleWidth - Form.jkrTree.left - 50, Form.ScaleHeight - Form.tlbAction.Height
Form.picContainer.Move Form.jkrTree.left + 50, Form.tlbAction.Height, Form.ScaleWidth - Form.jkrTree.left - 50, Form.ScaleHeight - Form.tlbAction.Height
Form.objF1Book.width = Form.picContainer.width - 60
Form.objF1Book.Height = Form.picContainer.Height - 60
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -