?? 單據打印設置.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 + -