📄 m2.bas
字号:
Attribute VB_Name = "任务书"
Public Sub renwushu1(biaoming As String)
Dim da As Date
rs.CursorLocation = adUseClient
rs.Open "select * from " & biaoming & "", conn, adOpenKeyset, adLockPessimistic
If Form7.Text1(0).Text <> "" Then
a = Form7.Text1(0).Text
f = Len(a)
SearchString = a ' 被搜索的字符串。
SearchChar = "-" ' 要查找字符串 "P"。
MyPos = InStr(1, SearchString, SearchChar, 1)
If MyPos = 0 Then
ln = MsgBox("输入格式不对,请重新输入!", vbInformation, "提示")
Form7.Text1(0).Text = ""
rs.Close
Exit Sub
End If
If MyPos <> "0" Then
b = left(a, MyPos - 1)
c = right(a, f - MyPos)
Form7.Text1(0).Text = b & "设字" & c & "号"
End If
Else
ln = MsgBox("工程编号不能为空,请重新输入!", vbInformation, "提示")
Form7.Text1(0).Text = ""
rs.Close
Exit Sub
End If
If Form7.Text1(15).Text <> "" Then
a1 = Form7.Text1(15).Text
f1 = Len(a1)
SearchString1 = a1 ' 被搜索的字符串。
SearchChar1 = "-" ' 要查找字符串 "P"。
MyPos1 = InStr(1, SearchString1, SearchChar1, 1)
If MyPos1 = 0 Then
ln = MsgBox("输入格式不对,请重新输入!", vbInformation, "提示")
Form7.Text1(15).Text = ""
Form7.Text1(0).Text = a
rs.Close
Exit Sub
End If
If MyPos1 <> "0" Then
b1 = left(a1, MyPos1 - 1)
c1 = right(a1, f1 - MyPos1)
Form7.Text1(15).Text = "哈规卷" & "[" & b1 & "]" & c1 & "号"
End If
Else
ln = MsgBox("规划报件审批编号不能为空,请重新输入!", vbInformation, "提示")
Form7.Text1(15).Text = ""
Form7.Text1(0).Text = a
rs.Close
Exit Sub
End If
For r = 1 To rs.RecordCount
g = rs.Fields(0).Value
g1 = rs.Fields(17).Value
If Form7.Text1(0).Text = g Then
ln = MsgBox("工程编号已存在,请重新输入!", vbInformation, "提示")
Form7.Text1(15).Text = a1
Form7.Text1(0).Text = a
rs.Close
Exit Sub
End If
If Form7.Text1(15).Text = g1 Then
ln = MsgBox("规划报件审批编号已存在,请重新输入!", vbInformation, "提示")
Form7.Text1(15).Text = a1
Form7.Text1(0).Text = a
rs.Close
Exit Sub
End If
rs.MoveNext
Next
For j = 5 To 10
If Form7.Text1(j).Text <> "" Then
If Not IsDate(Form7.Text1(j).Text) Then
MsgBox "建成时间格式(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告!"
Form7.Text1(j).Text = ""
Form7.Text1(15).Text = a1
Form7.Text1(0).Text = a
rs.Close
Exit Sub
End If
End If
Next
For m = 0 To 17
If m >= 5 And m <= 10 Then
If Form7.Text1(m).Text = "" Then
aa(m) = "0:00:00"
Else
aa(m) = Form7.Text1(m).Text
End If
Else
If Form7.Text1(m).Text = "" Then
aa(m) = "0"
Else
aa(m) = Form7.Text1(m).Text
End If
End If
Next
With rs
.AddNew
For m = 0 To 14
.Fields(m) = aa(m)
Next
.Fields(15) = "0"
.Fields(16) = "0"
.Fields(17) = aa(15)
.Fields(18) = aa(16)
.Fields(19) = aa(17)
End With
rs.Update
rs.Close
grs.CursorLocation = adUseClient
grs.Open "select * from " & biaoming & "", gconn, adOpenKeyset, adLockPessimistic
With grs
.AddNew
.Fields(0) = "0"
.Fields(1) = "0"
.Fields(2) = "0:00:00"
For m = 3 To 130
.Fields(m) = "0"
Next
.Fields(0) = Form7.Text1(1).Text '建设单位
.Fields(1) = Form7.Text1(0).Text '工程编号
.Fields(65) = "1" '系数1
.Fields(66) = "1" '系数2
.Fields(123) = "1" '打折
.Fields(128) = aa(11) '预收款
End With
grs.Update
grs.Close
grs.CursorLocation = adUseClient '增加流程记录的数据
grs.Open "select * from 流程记录", gconn, adOpenKeyset, adLockPessimistic
grs.AddNew
grs("sp_rws_num").Value = Form7.Text1(0).Text
grs("sp_fromman_dept").Value = department
grs("sp_fromman").Value = username
grs("sp_opinion").Value = "0"
grs("sp_xz").Value = "登记"
grs.Update
grs.Close
MsgBox "数据存储完毕!", vbInformation, "存储数据"
Form7.ListView1.ListItems.Clear
rs.CursorLocation = adUseClient
rs.Open "select * from " & biaoming & " order by 工程编号", conn, adOpenKeyset, adLockPessimistic
For o = 1 To rs.RecordCount
Form7.ListView1.ListItems.Add , , rs.Fields(0).Value
For p = 1 To 19
Form7.ListView1.ListItems.Item(o).SubItems(p) = rs.Fields(p).Value
Next
rs.MoveNext
Next
rs.Close
Form7.ListView1.ListItems(Form7.ListView1.ListItems.Count).Selected = True
Form7.ListView1.SelectedItem.EnsureVisible
Form7.ListView1.Refresh
For q = 0 To 17
Form7.Text1(q).Text = ""
Next
da = Date
Form7.Text1(5).Text = da
Form7.Text1(6).Text = da
Form7.Text1(17).Text = username
End Sub
Public Sub renwushu2(biaoming As String)
Dim da As Date
rs.CursorLocation = adUseClient
rs.Open "select * from " & biaoming & "", conn, adOpenKeyset, adLockPessimistic
If Form7.Text1(0).Text <> "" Then
a = Form7.Text1(0).Text
f = Len(a)
SearchString = a ' 被搜索的字符串。
SearchChar = "-" ' 要查找字符串 "P"。
MyPos = InStr(1, SearchString, SearchChar, 1)
If MyPos = 0 Then
ln = MsgBox("输入格式不对,请重新输入!", vbInformation, "提示")
Form7.Text1(0).Text = ""
rs.Close
Exit Sub
End If
If MyPos <> "0" Then
If biaoming = "松北" Then
b = left(a, MyPos - 1)
c = right(a, f - MyPos)
Form7.Text1(0).Text = b & "松北" & c & "号"
End If
If biaoming = "地籍" Then
b = left(a, MyPos - 1)
c = right(a, f - MyPos)
Form7.Text1(0).Text = b & "籍字" & c & "号"
End If
End If
Else
ln = MsgBox("序号不能为空,请重新输入!", vbInformation, "提示")
Form7.Text1(0).Text = ""
rs.Close
Exit Sub
End If
For r = 1 To rs.RecordCount
g = rs.Fields(0).Value
If Form7.Text1(0).Text = g Then
ln = MsgBox("工程编号已存在,请重新输入!", vbInformation, "提示")
Form7.Text1(0).Text = a
rs.Close
Exit Sub
End If
rs.MoveNext
Next
For j = 5 To 10
If Form7.Text1(j).Text <> "" Then
If Not IsDate(Form7.Text1(j).Text) Then
MsgBox "建成时间格式(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告!"
Form7.Text1(j).Text = ""
Form7.Text1(0).Text = a
rs.Close
Exit Sub
End If
End If
Next
For m = 0 To 17
If m >= 5 And m <= 10 Then
If Form7.Text1(m).Text = "" Then
aa(m) = "0:00:00"
Else
aa(m) = Form7.Text1(m).Text
End If
Else
If Form7.Text1(m).Text = "" Then
aa(m) = "0"
Else
aa(m) = Form7.Text1(m).Text
End If
End If
Next
With rs
.AddNew
For m = 0 To 14
.Fields(m) = aa(m)
Next
.Fields(15) = "0"
.Fields(16) = "0"
.Fields(17) = aa(16)
.Fields(18) = aa(17)
End With
rs.Update
rs.Close
grs.CursorLocation = adUseClient
grs.Open "select * from " & biaoming & "", gconn, adOpenKeyset, adLockPessimistic
With grs
.AddNew
.Fields(0) = "0"
.Fields(1) = "0"
.Fields(2) = "0:00:00"
For m = 3 To 130
.Fields(m) = "0"
Next
.Fields(0) = Form7.Text1(1).Text '建设单位
.Fields(1) = Form7.Text1(0).Text '工程编号
.Fields(65) = "1" '系数1
.Fields(66) = "1" '系数2
.Fields(123) = "1" '打折
.Fields(128) = aa(11) '预收款
End With
grs.Update
grs.Close
grs.CursorLocation = adUseClient '增加流程记录的数据
grs.Open "select * from 流程记录", gconn, adOpenKeyset, adLockPessimistic
grs.AddNew
grs("sp_rws_num").Value = Form7.Text1(0).Text
grs("sp_fromman_dept").Value = department
grs("sp_fromman").Value = username
grs("sp_opinion").Value = "0"
grs("sp_xz").Value = "登记"
grs.Update
grs.Close
MsgBox "数据存储完毕!", vbInformation, "存储数据"
Form7.ListView1.ListItems.Clear
rs.CursorLocation = adUseClient
rs.Open "select * from " & biaoming & " order by 工程编号", conn, adOpenKeyset, adLockPessimistic
For o = 1 To rs.RecordCount
Form7.ListView1.ListItems.Add , , rs.Fields(0).Value
For p = 1 To 16
Form7.ListView1.ListItems.Item(o).SubItems(p) = rs.Fields(p).Value
Next
Form7.ListView1.ListItems.Item(o).SubItems(18) = rs.Fields(17).Value
Form7.ListView1.ListItems.Item(o).SubItems(19) = rs.Fields(18).Value
rs.MoveNext
Next
rs.Close
Form7.ListView1.ListItems(Form7.ListView1.ListItems.Count).Selected = True
Form7.ListView1.SelectedItem.EnsureVisible
Form7.ListView1.Refresh
For q = 0 To 17
Form7.Text1(q).Text = ""
Next
da = Date
Form7.Text1(5).Text = da
Form7.Text1(6).Text = da
Form7.Text1(17).Text = username
End Sub
Public Sub renwushu3(biaoming As String)
Dim da As Date
rs.CursorLocation = adUseClient
rs.Open "select * from " & biaoming & "", conn, adOpenKeyset, adLockPessimistic
If Form7.Text1(0).Text = "" Then
ln = MsgBox("工程编号不能为空,请重新输入!", vbInformation, "提示")
Form7.Text1(0).Text = ""
rs.Close
Exit Sub
End If
For r = 1 To rs.RecordCount
g = rs.Fields(0).Value
If Form7.Text1(0).Text = g Then
ln = MsgBox("工程编号已存在,请重新输入!", vbInformation, "提示")
rs.Close
Exit Sub
End If
rs.MoveNext
Next
For j = 5 To 10
If Form7.Text1(j).Text <> "" Then
If Not IsDate(Form7.Text1(j).Text) Then
MsgBox "建成时间格式(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告!"
Form7.Text1(j).Text = ""
rs.Close
Exit Sub
End If
End If
Next
For m = 0 To 17
If m >= 5 And m <= 10 Then
If Form7.Text1(m).Text = "" Then
aa(m) = "0:00:00"
Else
aa(m) = Form7.Text1(m).Text
End If
Else
If Form7.Text1(m).Text = "" Then
aa(m) = "0"
Else
aa(m) = Form7.Text1(m).Text
End If
End If
Next
With rs
.AddNew
For m = 0 To 14
.Fields(m) = aa(m)
Next
.Fields(15) = "0"
.Fields(16) = "0"
.Fields(17) = aa(16)
.Fields(18) = aa(17)
End With
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -