📄 单据打印设置.frm
字号:
TF = False
label_XY.Visible = False
If WglrGrid.Height > (Move_Y - Y) Then
Pmbcsjhs = Int((WglrGrid.Height - WglrGrid.FixedRows * WglrGrid.RowHeight(0)) / Sjhgd) - Fzxwghs - 1
WglrGrid.Rows = WglrGrid.FixedRows
Sub_AdjustGrid
'程序自动调整网格高度(自动设置为网格剩余高度+辅助项网格行数(默认为1)*数据行高度)、并设置其位置信息
With HjGrid
.Height = Fzxwghs * Sjhgd + ((WglrGrid.Height - WglrGrid.FixedRows * WglrGrid.RowHeight(0)) Mod Sjhgd)
.RowHeight(0) = .Height
.Move 0, WglrGrid.Height - .Height, WglrGrid.Width, .Height
End With
End If
End Sub
Private Sub SD_Text() '竖对
Dim i As Integer: Dim Y As Integer
For Y = 0 To LrText.Count - 1
If LrText(Y).BackColor = &HF2FAEB Then
For i = 1 To LrText.Count - 1
If LrText(i).BackColor = &HF2FAEB Then
If LrText(Y).Top > LrText(i).Top Then
Y = i
End If
End If
Next i
Exit For
End If
Next Y
For i = 0 To LrText.Count - 1
If LrText(i).BackColor = &HF2FAEB Then
LrText(i).Left = LrText(Y).Left
TsLabel(i).Left = LrText(i).Left - TsLabel(i).Width - 20
LrText(i).BackColor = &HFFFFFF
End If
Next i
End Sub
Private Sub HD_Text() '横对
Dim i As Integer: Dim Y As Integer
For Y = 0 To LrText.Count - 1
If LrText(Y).BackColor = &HF2FAEB Then
For i = 1 To LrText.Count - 1
If LrText(i).BackColor = &HF2FAEB Then
If LrText(Y).Top > LrText(i).Top Then
Y = i
End If
End If
Next i
Exit For
End If
Next Y
For i = 0 To LrText.Count - 1
If LrText(i).BackColor = &HF2FAEB Then
LrText(i).Top = LrText(Y).Top
TsLabel(i).Top = LrText(i).Top + 30
LrText(i).BackColor = &HFFFFFF
End If
Next i
End Sub
Sub Bill_Save() '保存单据信息
Dim i As Integer, Sql_Str As String
Dim aDo_Name As New Recordset
Set aDo_Name = Cw_DataEnvi.DataConnect.Execute("select * from xt_BillDesign where billname='" & ComboName.Text & "'")
For i = 0 To Max_Text_Index
Sql_Str = "update Xt_BillTextPrint set printTop=" & LrText(i).Top & ",printLeft=" & LrText(i).Left & ",printWidth=" & LrText(i).Width & ",PrintLabelLeft=" & TsLabel(i).Left _
& " where text_group_code='" & Trim(aDo_Name!text_group_code) & "' and text_index=" & i & " and PrintTextCode='" & PrintType.Text & "'"
Cw_DataEnvi.DataConnect.Execute Sql_Str
Next i
Sql_Str = "update Xt_billgridprint set PrintGridHeight=" & WglrGrid.Height & ",PrintGridWidth=" & WglrGrid.Width _
& ",PrintGridTop=" & WglrGrid.Top & ",PrintGridLeft=" & WglrGrid.Left & ",PrintDataRows=" & WglrGrid.Rows - WglrGrid.FixedRows _
& ",BillTitleLeft=" & Lab_Title.Left & ",BillTitleTop=" & Lab_Title.Top _
& " where Grid_Code='" & Trim(aDo_Name!Grid_code) & "' and ColIndex='000' and PrintGridCode='" & Trim(PrintType.Text) & "'"
Cw_DataEnvi.DataConnect.Execute Sql_Str
aDo_Name.Close
Sql_Str = "update xt_BillDesign set PrintFormHeight=" & Pict.Height & ",PrintFormWidth=" & Pict.Width _
& " where billname='" & ComboName.Text & "'"
Cw_DataEnvi.DataConnect.Execute Sql_Str
End Sub
'==========================
'=================
'=================
'=================
'==========================
Public Sub Sub_PrintReadBillInfo(BillCode As String, Frm_Bill As Form, Var_Bill() As Variant) '读入单据整体设计信息 '读入单据整体信息
'参数说明:BillCode 单据编码(索引号) Frm_Bill 单据窗体 VarBill 用来返回单据设计信息
Dim RecTemp As New ADODB.Recordset
ReDim Var_Bill(1 To 4)
Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select * From xt_BillDesign Where BillCode='" & Trim(BillCode) & "'")
With RecTemp
If Not .EOF Then
Frm_Bill.Pict.Height = .Fields("PrintFormHeight") '设置窗体高度
Frm_Bill.Pict.Width = .Fields("PrintFormWidth") '设置窗体宽度
Frm_Bill.Lab_Title = Trim(.Fields("BillTitle"))
Var_Bill(1) = Trim(.Fields("BillName")) '单据描述
Frm_Bill.Caption = Frm_Bill.Tag & "/" & Var_Bill(1) '单据描述赋予窗体Caption
Var_Bill(2) = Trim(.Fields("Text_Group_Code")) '单据所使用文本框组索引号
Var_Bill(3) = Trim(.Fields("Grid_Code")) '单据所使用网格组索引号
Var_Bill(4) = Trim(.Fields("Print_Code")) '单据所使用网格组索引号
End If
End With
End Sub
Public Sub PrintDrwbkxx(Wbklrbmte As String, Textvar() As Variant, Textboolean() As Boolean, Textint() As Integer, Textstr() As String) '读入文本框录入信息
Dim Wbklrbrec As ADODB.Recordset
Dim Zdszxb As Integer '最大数组下标
Dim text_indexte As Integer '文本框索引值
ReDim Textvar(1 To 1)
Set Wbklrbrec = Cw_DataEnvi.DataConnect.Execute("SELECT * FROM Xt_V_BillTextPrint WHERE text_group_code ='" + Wbklrbmte + "'and PrintTextCode='" & Trim(PrintType.Text) & "' ORDER BY text_index")
With Wbklrbrec
If Not (.BOF And .EOF) Then
.MoveLast
Zdszxb = .Fields("text_index")
Textvar(1) = Zdszxb
ReDim Textboolean(0 To Zdszxb, 1 To 4)
ReDim Textint(0 To Zdszxb, 1 To 13)
ReDim Textstr(0 To Zdszxb, 1 To 7)
.MoveFirst
Else
Exit Sub
End If
Do While Not .EOF
text_indexte = .Fields("text_index")
If .Fields("help_flag") Then '是否提供帮助
Textboolean(text_indexte, 1) = True
End If
If .Fields("Help_ManuFlag") Then '手工设置帮助按钮
Textboolean(text_indexte, 3) = True
End If
If .Fields("YNPrint") Then '文本框是否显示
Textboolean(text_indexte, 4) = True
End If
If Not IsNull(.Fields("text_data_type")) Then '字段数据类型
Textint(text_indexte, 1) = .Fields("text_data_type")
End If
If Not IsNull(.Fields("help_type")) Then '帮助类型
Textint(text_indexte, 2) = .Fields("help_type")
End If
If Not IsNull(.Fields("show_code_name")) Then '帮助返回值显示类型
Textint(text_indexte, 3) = .Fields("show_code_name")
End If
If Not IsNull(.Fields("judge_type")) Then '有效性判断类型
Textint(text_indexte, 4) = .Fields("judge_type")
End If
If Not IsNull(.Fields("text_length")) Then '字段录入长度
Textint(text_indexte, 5) = .Fields("text_length")
End If
If Not IsNull(.Fields("text_int_length")) Then '数值字段整数位长度
Textint(text_indexte, 6) = .Fields("text_int_length")
End If
If Not IsNull(.Fields("text_deci_length")) Then '数值字段小数位长度
Textint(text_indexte, 7) = .Fields("text_deci_length")
End If
If Not IsNull(.Fields("NotAllowEmpty_Type")) Then '字段不允许为空或为零
Textint(text_indexte, 8) = .Fields("NotAllowEmpty_Type")
End If
If Not IsNull(.Fields("Judge_Time")) Then '文本框有效性判断时刻
Textint(text_indexte, 9) = .Fields("Judge_Time")
End If
If Not IsNull(.Fields("TextHeight")) Then '文本框高度
Textint(text_indexte, 10) = .Fields("TextHeight")
End If
If Not IsNull(.Fields("PrintWidth")) Then '文本框宽度
Textint(text_indexte, 11) = .Fields("PrintWidth")
End If
If Not IsNull(.Fields("PrintTop")) Then '文本框距离顶端高度
Textint(text_indexte, 12) = .Fields("PrintTop")
End If
If Not IsNull(.Fields("PrintLeft")) Then '文本框左端距离
Textint(text_indexte, 13) = .Fields("PrintLeft")
End If
Textstr(text_indexte, 1) = Trim(.Fields("text_index") & "") '文本框对应索引值
Textstr(text_indexte, 2) = Trim(.Fields("text_field_code") & "") '文本框对应编码字段
Textstr(text_indexte, 3) = Trim(.Fields("text_field_name") & "") '文本框对应名称字段
Textstr(text_indexte, 4) = Trim(.Fields("help_code") & "") '通用帮助编码
Textstr(text_indexte, 5) = Trim(.Fields("judge_base") & "") '字段有效性判断依据
Textstr(text_indexte, 6) = Trim(.Fields("error_message") & "") '字段录入错误提示信息
Textstr(text_indexte, 7) = Trim(.Fields("text_name") & "") '文本框名称
.MoveNext
Loop
End With
End Sub
Public Sub PrintBzWgcsh(Xsgrid As Object, Wgdmte As String, GridInf() As Variant, GridBoolean() As Boolean, GridInt() As Integer, GridStr() As String) '标准网格初始化模块
'过程参数为:Xsgrid 生成网格对象名称,Wgdmte 网格参数编码,GridInf()返回网格设置信息(返回整体信息)
'GridBoolean() 网格列属性(返回布尔型信息),GridInt() 网格列属性(返回整型信息),GridStr() 网格列属性(返回字符型信息)
Dim Rowjsq As Integer
Dim Coljsq As Integer
Dim Qslzte As Integer
Dim wglbt() As String '网格显示列标题
Dim Wgxsls As Long '网格显示(主操作)列数
Dim gdls As Long '网格固定列数
Dim Gdhs As Long '网格固定行数(标题行数)
Dim Gdhgd As Double '网格固定行高度
Dim wglkd() As Double '每列默认字符个数
Dim wglzz() As Integer '网格列组织形式
Dim zdxsgs() As String '数值字段显示格式
Dim Sfhide() As Boolean '网格列是否隐藏
Dim Sfhxz As Boolean '网格列是否行选中
Dim Qslz As Long '网格隐藏(非操作显示)列数
Dim Sjhgd As Double '网格数据行高度
Dim Wglsfkydpx As Integer '网格列是否可移动及排序
Dim wgxsrec As New ADODB.Recordset '网格显示动态集
ReDim GridInf(1 To 7) '整个网格设置信息
Set wgxsrec = Cw_DataEnvi.DataConnect.Execute("SELECT * FROM Xt_V_BillGridPrint WHERE Grid_Code ='" + Wgdmte + "' and PrintGridCode='" & Trim(PrintType.Text) & "' ORDER BY ColId")
With wgxsrec
If .EOF And .BOF Then
Exit Sub
Else
.MoveFirst
End If
'如果网格为单据则设置网格大小、位置
' If .Fields("BillFlag") Then
Xsgrid.Height = .Fields("PrintGridHeight") '网格高度
Xsgrid.Width = .Fields("PrintGridwidth") '网格宽度
Xsgrid.Top = .Fields("PrintGridTop") '网格上边距
Xsgrid.Left = .Fields("PrintGridLeft") '网格左边距
Lab_Title.Top = .Fields("BillTitleTop")
Lab_Title.Left = .Fields("BillTitleLeft")
'End If
Qslz = .Fields("BeginCol") '网格隐藏(非操作显示)列数
Sjhgd = .Fields("DataRowHeight") '网格数据行高度
GridInf(1) = Qslz '起始列值
GridInf(2) = Sjhgd '数据行高度
GridInf(3) = .Fields("KeepDataRows") '屏幕保持数据行数
GridInf(4) = .Fields("AssistantRows") '辅助项网格行数(例如:合计行)
If .Fields("SaveHelpWidth_Flag") Then '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
GridInf(5) = True
Else
GridInf(5) = False
End If
If .Fields("DeleteRowAsk_Flag") Then '删除有效记录行是否提示
GridInf(6) = True
Else
GridInf(6) = False
End If
If .Fields("ShowSumGrid_Flag") Then '是否显示合计网格
GridInf(7) = True
Else
GridInf(7) = False
End If
Wgxsls = .RecordCount - 1 '网格显示(主操作)列数(原.Fields("wgxsls"))
gdls = .Fields("FixCols") '网格固定列数
Gdhs = .Fields("FixRows") '网格固定行数(标题行数)
Gdhgd = .Fields("FixRowHeight") '网格固定行高度
Wglsfkydpx = .Fields("explorerbar") '网格列是否可移动及排序
If .Fields("SelectRow_Flag") Then '是否行选中
Sfhxz = True
End If
ReDim wglbt(Gdhs - 1, Wgxsls + Qslz - 1) '网格显示列标题
ReDim wglkd(Qslz + Wgxsls - 1) '每列默认字符个数
ReDim zdxsgs(Qslz + Wgxsls - 1) '数值字段标志
ReDim wglzz(Qslz + Wgxsls - 1) '网格列组织形式
ReDim Sfhide(Qslz + Wgxsls - 1) '网格列是否显示
ReDim GridBoolean(Qslz + Wgxsls - 1, 1 To 6) '网格列属性(布尔型)
ReDim GridStr(Qslz + Wgxsls - 1, 1 To 20) '网格列信息(字符型)
ReDim GridInt(Qslz + Wgxsls - 1, 1 To 7) '网格列信息(整型)
.MoveNext
jsqte = 0
Do While Not .EOF
wglkd(Qslz + jsqte) = .Fields("printColWidth") '网格列宽度限制
If Not IsNull(.Fields("ColTitle1")) Then
wglbt(0, Qslz + jsqte) = Trim(.Fields("ColTitle1")) '网格列标题1
End If
If Not IsNull(.Fields("ColTitle2")) And Gdhs >= 2 Then '网格列标题2
wglbt(1, Qslz + jsqte) = Trim(.Fields("ColTitle2"))
End If
If Not IsNull(.Fields("ColTitle3")) And Gdhs >= 3 Then '网格列标题3
wglbt(2, Qslz + jsqte) = Trim(.Fields("ColTitle3"))
End If
If .Fields("ColFormat") Then '字段显示格式(千分符)
If .Fields("Text_Int_Length") <> 0 Then
zdxsgs(Qslz + jsqte) = "#,##0." + String(.Fields("Text_deci_Length"), "0")
Else
zdxsgs(Qslz + jsqte) = "#,##0.00"
End If
Select Case .Fields("Text_Data_Type")
Case 8 '金额
zdxsgs(Qslz + jsqte) = "#,##0." + String(Xtjexsws, "0")
Case 9 '数量
zdxsgs(Qslz + jsqte) = "#,##0." + String(Xtslxsws, "0")
Case 10 '单价
zdxsgs(Qslz + jsqte) = "#,##0." + String(Xtdjxsws, "0")
End Select
Else
If .Fields("Text_Int_Length") <> 0 Th
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -