📄 modulemain.bas
字号:
Attribute VB_Name = "ModuleMain"
Global con As New ADODB.Connection
Global Rst As New ADODB.Recordset
Global gExit As Boolean
Global gLogin As Boolean
Global LoginName As String
Global LoginTime As String
Sub Main()
' IsSystem = 1
If App.PrevInstance = True Then End
Dim tmpStrcon As String
tmpStrcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
tmpStrcon = tmpStrcon & App.Path & "\data.mdb;Persist Security Info=False"
con.Open tmpStrcon, "", "", adConnectUnspecified
frmLogin.Show
gExit = False
While Not gExit
DoEvents
Wend
End
End Sub
Sub FirstSub()
Unload frmLogin
frmMain.Show
End Sub
Public Sub ColumnCenter(ByRef Grid As GridEX20.GridEX)
Dim i As Integer
For i = 1 To Grid.Columns.Count
Grid.Columns(i).HeaderAlignment = jgexAlignCenter
Next
End Sub
Public Function FindWindow(Name As String) As Boolean
Dim i As Integer
For i = 1 To Forms.Count
If Forms(i - 1).Name = Name Then
FindWindow = True
Exit Function
End If
Next
End Function
Public Function ImAudi(ImSTID As Long, l As Long) As Boolean
Audi = False
Dim tmpRst As New ADODB.Recordset
tmpRst.CursorLocation = adUseClient
tmpRst.Open "select * from ImST_D where ImSTID=" & ImSTID, con, adOpenStatic, adLockBatchOptimistic
If tmpRst.RecordCount < 1 Then Exit Function
tmpRst.MoveFirst
While Not tmpRst.EOF
If l = 1 Then
con.Execute "update StockInfo set Quantity=Quantity+ " & CStr(tmpRst.Fields("Quantity")) & " where GoodsCode='" & tmpRst.Fields("GoodsCode") & "'"
ElseIf l = 2 Then
con.Execute "update StockInfo set Quantity=Quantity- " & CStr(tmpRst.Fields("Quantity")) & " where GoodsCode='" & tmpRst.Fields("GoodsCode") & "'"
End If
tmpRst.MoveNext
Wend
If l = 1 Then
con.Execute "update ImST set state =true,Audier='" & LoginName & "',AudiDate='" & CStr(Date) & "' where ImSTID= " & ImSTID
ElseIf l = 2 Then
con.Execute "update ImST set state =false,Audier=NULL,AudiDate=NULL where ImSTID= " & ImSTID
End If
tmpRst.Close
Set tmpRst = Nothing
End Function
Public Function ExAudi(ExSTID As Long, l As Long) As Boolean
Audi = False
Dim tmpRst As New ADODB.Recordset
tmpRst.CursorLocation = adUseClient
tmpRst.Open "select * from ExST_D where ExSTID=" & ExSTID, con, adOpenStatic, adLockBatchOptimistic
If tmpRst.RecordCount < 1 Then Exit Function
tmpRst.MoveFirst
While Not tmpRst.EOF
If l = 1 Then
con.Execute "update StockInfo set Quantity=Quantity- " & CStr(tmpRst.Fields("Quantity")) & " where GoodsCode='" & tmpRst.Fields("GoodsCode") & "'"
ElseIf l = 2 Then
con.Execute "update StockInfo set Quantity=Quantity+ " & CStr(tmpRst.Fields("Quantity")) & " where GoodsCode='" & tmpRst.Fields("GoodsCode") & "'"
End If
tmpRst.MoveNext
Wend
If l = 1 Then
con.Execute "update ExST set state =true,Audier='" & LoginName & "',AudiDate='" & CStr(Date) & "' where ExSTID= " & ExSTID
ElseIf l = 2 Then
con.Execute "update ExST set state =false,Audier=NULL,AudiDate=NULL where ExSTID= " & ExSTID
End If
tmpRst.Close
Set tmpRst = Nothing
End Function
Public Function ChangeDly(Msg As String) As Long
ChangeDly = MsgBox(Msg, vbQuestion + vbYesNoCancel, "询问")
End Function
Public Sub Message(Msg As String)
MsgBox Msg, vbInformation, "提示"
End Sub
Public Function QueryDly(Msg As String) As Boolean
If MsgBox(Msg, vbQuestion + vbYesNo, "询问") = vbYes Then QueryDly = True
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -