¿
资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:33k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Begin VB.Form frm_formula
- AutoRedraw = -1 'True
- BackColor = &H8000000B&
- BorderStyle = 3 'Fixed Dialog
- Caption = "函数公式向导"
- ClientHeight = 4485
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 5730
- Icon = "定义函数公式向导.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4485
- ScaleWidth = 5730
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 '屏幕中心
- Begin VB.Frame Frame2
- Height = 660
- Left = 120
- TabIndex = 11
- Top = 3300
- Width = 5505
- Begin VB.OptionButton Option1
- Caption = "除"
- Height = 300
- Index = 3
- Left = 4275
- TabIndex = 35
- Top = 255
- Width = 555
- End
- Begin VB.OptionButton Option1
- Caption = "乘"
- Height = 300
- Index = 2
- Left = 3465
- TabIndex = 33
- Top = 255
- Width = 555
- End
- Begin VB.OptionButton Option1
- Caption = "减"
- Height = 300
- Index = 1
- Left = 2625
- TabIndex = 31
- Top = 255
- Width = 555
- End
- Begin VB.OptionButton Option1
- Caption = "加"
- Height = 300
- Index = 0
- Left = 1800
- TabIndex = 14
- Top = 255
- Value = -1 'True
- Width = 555
- End
- Begin VB.CheckBox Check1
- Caption = "继续定义?"
- Height = 285
- Left = 225
- TabIndex = 10
- Top = 240
- Width = 1305
- End
- End
- Begin VB.Frame Frame1
- Caption = "辅助项参数内容"
- Height = 1485
- Left = 120
- TabIndex = 15
- Top = 1710
- Width = 5520
- Begin VB.CommandButton YDCommand1
- Height = 300
- Index = 8
- Left = 5100
- Picture = "定义函数公式向导.frx":1042
- Style = 1 'Graphical
- TabIndex = 36
- Top = 1080
- Width = 300
- End
- Begin VB.CommandButton YDCommand1
- Height = 300
- Index = 6
- Left = 5100
- Picture = "定义函数公式向导.frx":13CC
- Style = 1 'Graphical
- TabIndex = 32
- Top = 690
- Width = 300
- End
- Begin VB.CommandButton YDCommand1
- Height = 300
- Index = 4
- Left = 5100
- Picture = "定义函数公式向导.frx":1756
- Style = 1 'Graphical
- TabIndex = 29
- Top = 315
- Width = 300
- End
- Begin VB.CommandButton YDCommand1
- Height = 300
- Index = 3
- Left = 2460
- Picture = "定义函数公式向导.frx":1AE0
- Style = 1 'Graphical
- TabIndex = 27
- Top = 285
- Width = 300
- End
- Begin VB.CommandButton YDCommand1
- Height = 300
- Index = 5
- Left = 2460
- Picture = "定义函数公式向导.frx":1E6A
- Style = 1 'Graphical
- TabIndex = 30
- Top = 660
- Width = 300
- End
- Begin VB.CommandButton YDCommand1
- Height = 300
- Index = 7
- Left = 2460
- Picture = "定义函数公式向导.frx":21F4
- Style = 1 'Graphical
- TabIndex = 34
- Top = 1050
- Width = 300
- End
- Begin VB.TextBox lrText
- Height = 285
- Index = 8
- Left = 3825
- TabIndex = 9
- Top = 1080
- Width = 1290
- End
- Begin VB.TextBox lrText
- Height = 285
- Index = 7
- Left = 1080
- TabIndex = 8
- Top = 1065
- Width = 1380
- End
- Begin VB.TextBox lrText
- Height = 285
- Index = 6
- Left = 3825
- TabIndex = 7
- Top = 705
- Width = 1290
- End
- Begin VB.TextBox lrText
- Height = 285
- Index = 5
- Left = 1080
- TabIndex = 6
- Top = 675
- Width = 1380
- End
- Begin VB.TextBox lrText
- Height = 285
- Index = 4
- Left = 3825
- TabIndex = 5
- Top = 315
- Width = 1290
- End
- Begin VB.TextBox lrText
- Height = 285
- Index = 3
- Left = 1080
- TabIndex = 4
- Top = 285
- Width = 1380
- End
- Begin VB.Label Label1
- Caption = "供应商编码:"
- Height = 255
- Left = 2820
- TabIndex = 37
- Top = 1125
- Width = 1020
- End
- Begin VB.Label Label6
- Caption = "部门编码:"
- Height = 330
- Left = 180
- TabIndex = 28
- Top = 330
- Width = 915
- End
- Begin VB.Label Label4
- Caption = "职员编码:"
- Height = 330
- Left = 2970
- TabIndex = 26
- Top = 360
- Width = 885
- End
- Begin VB.Label Label11
- Caption = "项目编码:"
- Height = 330
- Left = 2970
- TabIndex = 24
- Top = 735
- Width = 1005
- End
- Begin VB.Label Label8
- Caption = "项目分类:"
- Height = 270
- Left = 180
- TabIndex = 23
- Top = 720
- Width = 1215
- End
- Begin VB.Label Label7
- Caption = "客户编码:"
- Height = 255
- Left = 180
- TabIndex = 22
- Top = 1125
- Width = 1245
- End
- End
- Begin VB.CommandButton QXCommand
- Caption = "取消(&C)"
- Height = 300
- Left = 4515
- Style = 1 'Graphical
- TabIndex = 13
- Top = 4065
- Width = 1120
- End
- Begin VB.CommandButton QDCommand
- Caption = "确定(&O)"
- Height = 300
- Left = 3300
- Style = 1 'Graphical
- TabIndex = 12
- Top = 4065
- Width = 1120
- End
- Begin VB.Frame Frame5
- Caption = "函数参数内容"
- Height = 1515
- Left = 90
- TabIndex = 16
- Top = 60
- Width = 5520
- Begin VB.ComboBox Combo3
- Height = 300
- Left = 2415
- Style = 2 'Dropdown List
- TabIndex = 1
- Top = 255
- Width = 1005
- End
- Begin VB.ComboBox Combo1
- Height = 300
- Left = 1125
- Style = 2 'Dropdown List
- TabIndex = 0
- Top = 255
- Width = 1005
- End
- Begin VB.CommandButton YDCommand1
- Height = 300
- Index = 2
- Left = 5100
- Picture = "定义函数公式向导.frx":257E
- Style = 1 'Graphical
- TabIndex = 25
- Top = 1050
- Width = 300
- End
- Begin VB.TextBox lrText
- Height = 300
- Index = 2
- Left = 1095
- TabIndex = 3
- Top = 1065
- Width = 4005
- End
- Begin VB.ComboBox Combo2
- Height = 300
- Left = 1110
- Style = 2 'Dropdown List
- TabIndex = 2
- Top = 660
- Width = 4290
- End
- Begin VB.TextBox lrText
- Height = 300
- Index = 1
- Left = 4920
- TabIndex = 39
- Top = 195
- Visible = 0 'False
- Width = 570
- End
- Begin VB.TextBox lrText
- Height = 300
- Index = 0
- Left = 4305
- TabIndex = 38
- Top = 195
- Visible = 0 'False
- Width = 570
- End
- Begin VB.Label Label5
- BackColor = &H8000000B&
- Caption = "月"
- Height = 225
- Left = 3495
- TabIndex = 21
- Top = 315
- Width = 405
- End
- Begin VB.Label Label2
- BackColor = &H8000000B&
- Caption = "年"
- Height = 270
- Left = 2190
- TabIndex = 20
- Top = 330
- Width = 255
- End
- Begin VB.Label Label10
- BackColor = &H8000000B&
- Caption = "科目编码:"
- Height = 285
- Left = 195
- TabIndex = 19
- Top = 1110
- Width = 930
- End
- Begin VB.Label Label9
- AutoSize = -1 'True
- BackColor = &H8000000B&
- Caption = "函数类型:"
- Height = 195
- Left = 195
- TabIndex = 18
- Top = 735
- Width = 765
- End
- Begin VB.Label Label3
- BackColor = &H8000000B&
- Caption = "取数日期:"
- Height = 240
- Left = 195
- TabIndex = 17
- Top = 360
- Width = 930
- End
- End
- End
- Attribute VB_Name = "frm_formula"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '**************************************************
- '* 模 块 名 称 :单据列表查询条件
- '* 功 能 描 述 :
- '* 程序员姓名 : 奚俊峰
- '* 最后修改人 : 奚俊峰
- '* 最后修改时间:2002/01/03
- '* 备 注:程序中所有依实际情况自定义部分均用[>> <<]括起
- '**************************************************
- Dim Tsxx As String '系统信息提示
- '以下为固定使用变量(文本框)
- Dim Textvar() As Variant '存储变体型文本框信息
- Dim Textboolean() As Boolean '存储布尔型文本框信息
- Dim Textint() As Integer '存储整型文本框信息
- Dim Textstr() As String '存储字符型文本框信息
- Dim Max_Text_Index As Integer '最大录入文本框索引值
- Dim TextGroupCode As String '文本框录入分组编码
- Dim TextValiLock As Boolean '文本框失去焦点是否进行有效性控制判断
- Dim TextValiJudgeLock() As Boolean '文本框录入有效性判断控制锁
- Dim CurTextIndex As Integer '当前文本框索引值
- Dim TextChangeLock As Boolean '文本框内容变换控制锁
- Dim Bln_Cancel As Boolean '取消按钮信息传递
- Private Sub Combo1_Click()
- LrText(0).Text = Combo1.Text
- End Sub
- Private Sub Combo3_Click()
- LrText(1).Text = Combo3.Text
- End Sub
- Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
- Select Case KeyCode
- Case 13
- SendKeys "{TAB}"
- End Select
- End Sub
- Private Sub Form_KeyPress(KeyAscii As Integer) '控 制 焦 点 转 移
- Dim jdzygs As Integer '控件焦点转移个数
- jdzygs = 30
- Select Case KeyAscii
- Case vbKeyReturn
- If Kjjdzy(jdzygs) Then
- KeyAscii = 0
- End If
- Case 39 '屏蔽"'"
- KeyAscii = 0
- End Select
- End Sub
- Private Sub Form_Load()
- '以下为文本框处理程序
- song_temp = ""
- TextGroupCode = "dzbb_hsxd"
- Call Drwbkxx(TextGroupCode, Textvar(), Textboolean(), Textint(), Textstr()) '读入文本框录入信息
- Call Wbkcsh
- Set_Mode
- Load_FuncType
- End Sub
- Private Sub QdCommand_Click() '确 定
- '录入条件有效性判断
- If Not Lrtjyxxpd Then
- Exit Sub
- End If
- Dim FzText1, FzText2 As String
- FzText1 = ""
- FzText2 = ""
- If Trim(LrText(3).Text) <> "" Then
- If FzText1 = "" Then
- FzText1 = "D" & Trim(LrText(3).Text)
- Else
- If Trim(LrText(3).Text) = "*" Then
- FzText2 = Trim(LrText(3).Text)
- Else
- FzText2 = "D" & Trim(LrText(3).Text)
- End If
- End If
- End If
- If Trim(LrText(4).Text) <> "" Then
- If FzText1 = "" Then
- FzText1 = "P" & Trim(LrText(4).Text)
- Else
- If Trim(LrText(4).Text) = "*" Then
- FzText2 = Trim(LrText(4).Text)
- Else
- FzText2 = "P" & Trim(LrText(4).Text)
- End If
- End If
- End If
- If Trim(LrText(5).Text) <> "" Then
- If FzText1 = "" Then
- FzText1 = "I" & Trim(LrText(5).Text)
- Else
- If Trim(LrText(5).Text) = "*" Then
- FzText2 = Trim(LrText(5).Text)
- Else
- FzText2 = "I" & Trim(LrText(5).Text)
- End If
- End If
- End If
- If Trim(LrText(6).Text) <> "" Then
- If FzText1 = "" Then
- FzText1 = "J" & Trim(LrText(6).Text)
- Else
- If Trim(LrText(6).Text) = "*" Then
- FzText2 = Trim(LrText(6).Text)
- Else
- FzText2 = "J" & Trim(LrText(6).Text)
- End If
- End If
- End If
- If Trim(LrText(7).Text) <> "" Then
- If FzText1 = "" Then
- FzText1 = "C" & Trim(LrText(7).Text)
- Else
- If Trim(LrText(7).Text) = "*" Then
- FzText2 = Trim(LrText(7).Text)
- Else
- FzText2 = "C" & Trim(LrText(7).Text)
- End If
- End If
- End If
- If Trim(LrText(8).Text) <> "" Then
- If FzText1 = "" Then
- FzText1 = "S" & Trim(LrText(8).Text)
- Else
- If Trim(LrText(8).Text) = "*" Then
- FzText2 = Trim(LrText(8).Text)
- Else
- FzText2 = "S" & Trim(LrText(8).Text)
- End If
- End If
- End If
- song_temp = song_temp + Left(Combo2.Text, InStr(1, Combo2.Text, "-") - 1)
- song_temp = UCase(song_temp) & "(" + Chr(34) + Trim(LrText(2).Tag) + Chr(34) + "," + Chr(34) + Trim(LrText(0).Text) + Chr(34) + "," + Chr(34) + Trim(LrText(1).Text) + Chr(34) + "," + Chr(34) + FzText1 + Chr(34) + "," + Chr(34) + FzText2 + Chr(34) + ")"
- If QdCommand.Caption = "下一步" Then
- Set_Mode
- If Option1(0).Value = True Then
- song_temp = song_temp & "+"
- ElseIf Option1(1).Value = True Then
- song_temp = song_temp & "-"
- ElseIf Option1(2).Value = True Then
- song_temp = song_temp & "*"
- ElseIf Option1(3).Value = True Then
- song_temp = song_temp & "/"
- End If
- Else
- Unload Me
- End If
- End Sub
- Private Sub QxCommand_Click() '取消
- song_temp = ""
- Unload Me
- End Sub
- Private Function Lrtjyxxpd() As Boolean '用户录入条件有效性判断
- Dim jsqte As Integer
- Lrtjyxxpd = False
- '对需要进行事后判断的文本框录入内容进行有效性判断 (固定不变)
- For jsqte = 0 To Max_Text_Index
- If Textint(Index, 9) = 0 Or Textint(Index, 9) = 2 Then
- If Not TextYxxpd(jsqte) Then
- Exit Function
- End If
- End If
- Next jsqte
- '[>>以下为依据实际情况自定义部分
- '查询凭证号范围应由小到大
- If Combo1.Text = "" Then
- Tsxx = "年不能为空!"
- Call Xtxxts(Tsxx, 0, 4)
- Combo1.SetFocus
- Exit Function
- ElseIf Combo3.Text = "" Then
- Tsxx = "月不能为空!"
- Call Xtxxts(Tsxx, 0, 4)
- Combo3.SetFocus
- Exit Function
- ElseIf LrText(2) = "" Then
- Tsxx = "科目编码不能为空!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(2).SetFocus
- Exit Function
- ElseIf Combo2.Text = "" Then
- Tsxx = "函数类型不能为空!"
- Call Xtxxts(Tsxx, 0, 4)
- Combo2.SetFocus
- Exit Function
- End If
- '<<]以上为依据实际情况自定义部分
- Lrtjyxxpd = True
- End Function
- Private Sub Cmd_Clear_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) '将用户输入条件全部清除
- '清除文本框
- For jsqte = 0 To Max_Text_Index
- LrText(jsqte).Tag = ""
- LrText(jsqte).Text = ""
- Next jsqte
- End Sub
- Private Sub Check1_Click()
- If Check1.Value = 1 Then
- Option1(0).Visible = True
- Option1(1).Visible = True
- Option1(2).Visible = True
- Option1(3).Visible = True
- QdCommand.Caption = "下一步"
- Else
- Option1(0).Visible = False
- Option1(1).Visible = False
- Option1(2).Visible = False
- Option1(3).Visible = False
- QdCommand.Caption = "确定"
- End If
- End Sub
- Public Sub Set_Mode()
- Dim RecTemp As New ADODB.Recordset '临时使用动态集
- Dim TempStr As String
- TempStr = "SELECT * from gy_kjrlb"
- Set RecTemp = Cw_DataEnvi.dataconnect.Execute(TempStr)
- If Not RecTemp.EOF Then
- Combo1.AddItem "本年"
- Combo1.AddItem "去年"
- Combo1.AddItem RecTemp.Fields("kjyear")
- Combo3.AddItem "本月"
- Combo3.AddItem "上月"
- Do While Not RecTemp.EOF
- Combo3.AddItem RecTemp.Fields("period")
- RecTemp.MoveNext
- Loop
- End If
- Dim i As Integer
- For i = 0 To 3
- Option1(i).Visible = False
- Next i
- For i = 3 To 8
- LrText(i).Enabled = False
- YDCommand1(i).Enabled = False
- Next i
- For i = 2 To 8
- LrText(i).Text = ""
- Next i
- Check1.Value = 0
- Frame1.Enabled = False
- Label4.Enabled = False
- Label6.Enabled = False
- Label7.Enabled = False
- Label8.Enabled = False
- Label11.Enabled = False
- Label1.Enabled = False
- End Sub
- Public Sub Load_FuncType()
- Set lrst_xtbm = New ADODB.Recordset
- ls_select = "select funccode,funcname from dzbb_funcname order by id"
- lrst_xtbm.Open ls_select, Cw_DataEnvi.dataconnect, adOpenStatic, adLockReadOnly, adCmdText
- If lrst_xtbm.RecordCount > 0 Then
- lrst_xtbm.MoveFirst
- Do While Not lrst_xtbm.EOF
- Combo2.AddItem Trim(lrst_xtbm.Fields("funccode")) & "-" & Trim(lrst_xtbm.Fields("funcname"))
- lrst_xtbm.MoveNext
- Loop
- lrst_xtbm.Close
- End If
- Set lrst_xtbm = Nothing
- End Sub
- '************以下为文本框录入处理程序(固定不变部分)*************'
- Private Sub Wbklrwbcl(Index As Integer) '文本框录入事后处理程序
- '以下为依据实际情况自定义部分[
- '在此填写文本框录入事后处理程序
- ']以上为依据实际情况自定义部分
- End Sub
- Private Sub LrText_Change(Index As Integer)
- '屏蔽程序改变控制
- If TextChangeLock Then
- Exit Sub
- End If
- TextValiJudgeLock(Index) = False '打开有效性判断锁
- '限制字段录入长度
- TextChangeLock = True '加锁(防止执行Lrtext_Change)
- Select Case Textint(Index, 1)
- Case 8 '金额型
- Call Sjgskz(LrText(Index), Xtjezws - Xtjexsws - 1, Xtjexsws)
- Case 9 '数量型
- Call Sjgskz(LrText(Index), Xtslzws - Xtslxsws - 1, Xtslxsws)
- Case 10 '单价型
- Call Sjgskz(LrText(Index), Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
- Case Else '其他小数类型控制
- If Textint(Index, 6) <> 0 Or Textint(Index, 7) <> 0 Then
- Call Sjgskz(LrText(Index), Textint(Index, 6), Textint(Index, 7))
- End If
- End Select
- TextChangeLock = False '解锁
- End Sub
- Private Sub LrText_GotFocus(Index As Integer) '文本框得到焦点,显示相应信息
- Call TextShow(Index)
- CurTextIndex = Index
- LrText(Index).SelStart = Len(LrText(Index))
- End Sub
- Private Sub LrText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) '字段按F2键提供帮助
- Select Case KeyCode
- Case 13
- SendKeys "{TAB}"
- Case vbKeyF2
- Call Text_Help(Index)
- End Select
- End Sub
- Private Sub LrText_KeyPress(Index As Integer, KeyAscii As Integer) '文本框录入事中控制
- Call InputFieldLimit(LrText(Index), Textint(Index, 1), KeyAscii)
- End Sub
- Private Sub LrText_LostFocus(Index As Integer) '文本框失去焦点进行有效性判断及相应处理
- If Textint(Index, 9) = 0 Or Textint(Index, 9) = 1 Then '事中判断
- Call TextYxxpd(Index)
- End If
- End Sub
- Private Sub YDCommand1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
- Select Case KeyCode
- Case 13
- SendKeys "{TAB}"
- End Select
- End Sub
- Private Sub YDCommand1_KeyPress(Index As Integer, KeyAscii As Integer)
- Select Case KeyCode
- Case 13
- SendKeys "{TAB}"
- End Select
- End Sub
- Private Sub Ydcommand1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) '按钮提供帮助
- Call Text_Help(Index)
- End Sub
- Private Sub Text_Help(Index As Integer) '录入字段帮助
- If Not Textboolean(Index, 1) Then
- Exit Sub
- End If
- TextValiJudgeLock(Index) = True
- '先进行有效性判断
- If Not TextYxxpd(CurTextIndex) Then
- Exit Sub
- End If
- Call Drbmhelp(Textint(Index, 2), Textstr(Index, 4), Trim(LrText(Index).Text))
- If Len(Xtfhcs) <> 0 Then
- If Textint(Index, 3) = 1 Then
- LrText(Index).Text = Xtfhcsfz
- LrText(Index).Tag = Xtfhcs
- Else
- LrText(Index).Text = Xtfhcs
- LrText(Index).Tag = Xtfhcsfz
- End If
- End If
- If Index = 2 Then
- Dim RecTemp As New ADODB.Recordset '临时使用动态集
- Dim TempStr As String
- Dim tDept, tPerson, tCus, tSupplier, tItem As Boolean
- Dim tItemclass As String
- TempStr = "SELECT * FROM cwzz_acccode Where ccode='" & Xtfhcs & "' or ccode='" & Xtfhcs & "'"
- Set RecTemp = Cw_DataEnvi.dataconnect.Execute(TempStr)
- If Not RecTemp.EOF Then
- tDept = Trim(RecTemp.Fields("deptflag"))
- tPerson = Trim(RecTemp.Fields("personflag"))
- tCus = Trim(RecTemp.Fields("cusflag"))
- tItem = Trim(RecTemp.Fields("itemflag"))
- tSupplier = Trim(RecTemp.Fields("supplierflag"))
- tItemclass = Trim(RecTemp.Fields("itemclasscode") & "")
- End If
- Frame1.Enabled = False
- For i = 3 To 8
- LrText(i).Enabled = False
- YDCommand1(i).Enabled = False
- Next i
- For i = 3 To 8
- LrText(i).Text = ""
- Next i
- Label4.Enabled = False
- Label6.Enabled = False
- Label7.Enabled = False
- Label8.Enabled = False
- Label11.Enabled = False
- Label1.Enabled = False
- If tDept = True Then
- Frame1.Enabled = True
- Label6.Enabled = True
- LrText(3).Enabled = True
- YDCommand1(3).Enabled = True
- End If
- If tPerson = True Then
- Frame1.Enabled = True
- Label4.Enabled = True
- LrText(4).Enabled = True
- YDCommand1(4).Enabled = True
- End If
- If tItemclass <> "" Then
- Frame1.Enabled = True
- Label8.Enabled = True
- LrText(5).Enabled = True
- YDCommand1(5).Enabled = True
- End If
- If tItem = True Then
- Frame1.Enabled = True
- Label11.Enabled = True
- LrText(6).Enabled = True
- YDCommand1(6).Enabled = True
- End If
- If tCus = True Then
- Frame1.Enabled = True
- Label7.Enabled = True
- LrText(7).Enabled = True
- YDCommand1(7).Enabled = True
- End If
- If tSupplier = True Then
- Frame1.Enabled = True
- Label1.Enabled = True
- LrText(8).Enabled = True
- YDCommand1(8).Enabled = True
- End If
- End If
- TextValiJudgeLock(Index) = False
- If Index <> 2 Then
- LrText(Index).SetFocus
- End If
- End Sub
- Private Sub TextShow(Index As Integer) '文本框得到焦点,显示相应信息
- '填写文本框得到焦点,进行相应信息处理程序
- End Sub
- Private Sub Wbkcsh() '录入文本框初始化
- Dim jsqte As Integer
- '最大录入文本框索引值
- Max_Text_Index = Textvar(1)
- ReDim TextValiJudgeLock(Max_Text_Index)
- For jsqte = 0 To Max_Text_Index
- If Len(Trim(Textstr(jsqte, 1))) <> 0 Then
- If Textboolean(jsqte, 1) Then
- If jsqte <> 0 And Not Textboolean(jsqte, 1) Then
- Load YDCommand1(jsqte)
- End If
- YDCommand1(jsqte).Visible = True
- YDCommand1(jsqte).Move LrText(jsqte).Left + LrText(jsqte).Width, LrText(jsqte).Top
- End If
- TextChangeLock = True
- LrText(jsqte).Text = ""
- LrText(jsqte).Tag = ""
- If Textint(jsqte, 5) <> 0 Then
- LrText(jsqte).MaxLength = Textint(jsqte, 5)
- End If
- TextChangeLock = False
- End If
- TextValiJudgeLock(jsqte) = True
- Next jsqte
- End Sub
- Private Function TextYxxpd(Index As Integer) As Boolean '文本框有效性判断
- Dim Sqlstr As String
- Dim Findrec As ADODB.Recordset
- If TextValiJudgeLock(Index) Then '文本框内容未曾改变不进行有效性判断
- TextYxxpd = True
- Exit Function
- End If
- If Trim(LrText(Index)) = "" Then
- LrText(Index).Tag = ""
- Call Wbklrwbcl(Index)
- TextValiJudgeLock(Index) = True
- TextYxxpd = True
- Exit Function
- End If
- Select Case Textint(Index, 4)
- Case 1 '编码型
- Sqlstr = Trim(Textstr(Index, 5))
- Sqlstr = Replace(Sqlstr, "@", "'" + Trim(LrText(Index).Text) + "'")
- Set Findrec = Cw_DataEnvi.dataconnect.Execute(Sqlstr)
- If (Index = 3 Or Index = 6) And Trim(LrText(Index).Text) = "*" Then
- TextValiJudgeLock(Index) = True
- TextYxxpd = True
- Exit Function
- End If
- If Findrec.EOF Then
- Call Xtxxts(Trim(Textstr(Index, 6)), 0, 1)
- LrText(Index).SetFocus
- Exit Function
- Else
- Select Case Textint(Index, 3)
- Case 0
- If Len(Trim(Textstr(Index, 2))) <> 0 Then
- LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
- End If
- If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
- LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
- End If
- Case 1
- If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
- LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
- End If
- If Len(Trim(Textstr(Index, 2))) <> 0 Then
- If Index = 2 Then
- Frame1.Enabled = False
- For i = 3 To 8
- LrText(i).Enabled = False
- YDCommand1(i).Enabled = False
- Next i
- Label4.Enabled = False
- Label6.Enabled = False
- Label7.Enabled = False
- Label8.Enabled = False
- Label11.Enabled = False
- Label1.Enabled = False
- If Trim(Findrec.Fields("deptflag")) = True Then
- Frame1.Enabled = True
- Label6.Enabled = True
- LrText(3).Enabled = True
- YDCommand1(3).Enabled = True
- End If
- If Trim(Findrec.Fields("personflag")) = True Then
- Frame1.Enabled = True
- Label4.Enabled = True
- LrText(4).Enabled = True
- YDCommand1(4).Enabled = True
- End If
- If Trim(Findrec.Fields("itemclasscode")) <> "" Then
- Frame1.Enabled = True
- Label8.Enabled = True
- LrText(5).Enabled = True
- YDCommand1(5).Enabled = True
- End If
- If Trim(Findrec.Fields("itemflag")) = True Then
- Frame1.Enabled = True
- Label11.Enabled = True
- LrText(6).Enabled = True
- YDCommand1(6).Enabled = True
- End If
- If Trim(Findrec.Fields("cusflag")) = True Then
- Frame1.Enabled = True
- Label7.Enabled = True
- LrText(7).Enabled = True
- YDCommand1(7).Enabled = True
- End If
- If Trim(Findrec.Fields("supplierflag")) = True Then
- Frame1.Enabled = True
- Label1.Enabled = True
- LrText(8).Enabled = True
- YDCommand1(8).Enabled = True
- End If
- End If
- LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
- End If
- End Select
- End If
- Case 2 '日期型
- If IsDate(LrText(Index).Text) Then
- LrText(Index).Text = Format(LrText(Index).Text, "yyyy-mm-dd")
- Else
- Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(Index).SetFocus
- Exit Function
- End If
- Case 3 '其他类型
- '[>>开始
- Select Case Index
- Case 0
- If Not IsNumeric(LrText(0).Text) Then
- If Trim(LrText(0).Text) <> "本年" And Trim(LrText(0).Text) <> "去年" Then
- Tsxx = "年份必须输入本年、去年或数字!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Function
- End If
- End If
- Case 1
- If IsNumeric(LrText(1).Text) Then
- If Val(LrText(1).Text) > 12 Or Val(LrText(1).Text) < 1 Then
- Tsxx = "月份范围错误!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(1).SetFocus
- Exit Function
- End If
- Else
- If Trim(LrText(1).Text) <> "本月" And Trim(LrText(1).Text) <> "上月" Then
- Tsxx = "月份必须输入本月、上月或1-12数字!"
- Call Xtxxts(Tsxx, 0, 4)
- LrText(1).SetFocus
- Exit Function
- End If
- End If
- End Select
- '完毕<<]
- End Select
- TextValiJudgeLock(Index) = True
- TextYxxpd = True
- End Function