📄 frmphywin1.frm
字号:
End
End
Attribute VB_Name = "frmPHywin1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim env As rdoEnvironment
Dim cn As rdoConnection
Dim result As rdoResultset
Dim result1 As rdoResultset
Dim d_conn, sql As String
Dim hrowcount, hrowcount1 As Integer
Private Sub Combo1_Change()
Dim iStart As Integer
Dim sString As String
Static iLeftOff As Integer
iStart = 1
iStart = Combo1.SelStart
If iLeftOff <> 0 Then
Combo1.SelStart = iLeftOff
iStart = iLeftOff
End If
sString = CStr(Left(Combo1.Text, iStart))
Combo1.ListIndex = SendMessage(Combo1.hwnd, CB_FINDSTRING, -1, ByVal CStr(Left(Combo1.Text, iStart)))
If Combo1.ListIndex = -1 Then
iLeftOff = Len(sString)
Combo1.Text = sString
End If
Combo1.SelStart = iStart
iLeftOff = 0
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Combo2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Combo3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Combo4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Command1_Click()
If Text6.Text <> "" Or Text2.Text <> "" Then
Dim hdate As String
hdate = Mid(Mask1.Text, 1, 4) & "年" & Trim(Mid(Mask1.Text, 5, 2)) & "月" & Trim(Mid(Mask1.Text, 7, 2)) & "日"
If YWFlagh = 1 Then
frmPHYWin.MSFlex1.TextArray((frmPHYWin.MSFlex1.Rows - 1) * frmPHYWin.MSFlex1.Cols) = Trim(Text6.Text)
frmPHYWin.MSFlex1.TextArray((frmPHYWin.MSFlex1.Rows - 1) * frmPHYWin.MSFlex1.Cols + 1) = Trim(Text2.Text)
frmPHYWin.MSFlex1.TextArray((frmPHYWin.MSFlex1.Rows - 1) * frmPHYWin.MSFlex1.Cols + 2) = Trim(Text3.Text)
frmPHYWin.MSFlex1.TextArray((frmPHYWin.MSFlex1.Rows - 1) * frmPHYWin.MSFlex1.Cols + 3) = Trim(Text4.Text)
frmPHYWin.MSFlex1.TextArray((frmPHYWin.MSFlex1.Rows - 1) * frmPHYWin.MSFlex1.Cols + 4) = Trim(Text5.Text)
frmPHYWin.MSFlex1.TextArray((frmPHYWin.MSFlex1.Rows - 1) * frmPHYWin.MSFlex1.Cols + 5) = Trim(Combo1.Text)
frmPHYWin.MSFlex1.TextArray((frmPHYWin.MSFlex1.Rows - 1) * frmPHYWin.MSFlex1.Cols + 6) = Trim(Text8.Text)
frmPHYWin.MSFlex1.TextArray((frmPHYWin.MSFlex1.Rows - 1) * frmPHYWin.MSFlex1.Cols + 7) = Trim(Text9.Text)
frmPHYWin.MSFlex1.TextArray((frmPHYWin.MSFlex1.Rows - 1) * frmPHYWin.MSFlex1.Cols + 8) = Trim(Text10.Text)
frmPHYWin.MSFlex1.TextArray((frmPHYWin.MSFlex1.Rows - 1) * frmPHYWin.MSFlex1.Cols + 9) = Trim(Combo2.Text)
frmPHYWin.MSFlex1.TextArray((frmPHYWin.MSFlex1.Rows - 1) * frmPHYWin.MSFlex1.Cols + 10) = Trim(Combo3.Text)
frmPHYWin.MSFlex1.TextArray((frmPHYWin.MSFlex1.Rows - 1) * frmPHYWin.MSFlex1.Cols + 11) = Trim(Combo4.Text)
frmPHYWin.date1.Value = Trim(hdate)
frmPHYWin.MSFlex1.Rows = frmPHYWin.MSFlex1.Rows + 1
''''''''''
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
ElseIf YWFlagh = 2 Then
sql = "update ywtable set 合同号='"
End If
Else
MsgBox "合同号不能为空..."
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub date1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Form_Load()
Set env = rdoEnvironments(0)
env.CursorDriver = rdUseOdbc
d_conn = "uid=sa;pwd=;driver={SQL SERVER};SERVER=ntserver;database=phdatabase;"
Set cn = env.OpenConnection(dsname:="odbc_api_demo", Prompt:="rdodriverprompt", ReadOnly:=False, Connect:=d_conn)
Move Screen.width / 2 - frmPHywin1.width / 2, Screen.height / 2 - frmPHywin1.height / 2
'date1.Value = Format(Now, "long date")
sql = "select * from customtable" ' order by 客户编号"
Set result = cn.OpenResultset(sql, rdOpenDynamic, rdConcurRowVer)
If result.RowCount <> 0 Then
Do While Not result.EOF()
Combo1.AddItem Trim(result("客户名称"))
result.MoveNext
Loop
End If
sql = "select * from worktable where 类别='业务员' order by 类别"
Set result = cn.OpenResultset(sql, rdOpenDynamic, rdConcurRowVer)
If result.RowCount <> 0 Then
Do While Not result.EOF()
Combo2.AddItem Trim(result("姓名"))
result.MoveNext
Loop
End If
'''''''''
sql = "select * from worktable where 类别='签单人' order by 类别"
Set result = cn.OpenResultset(sql, rdOpenDynamic, rdConcurRowVer)
If result.RowCount <> 0 Then
Do While Not result.EOF()
Combo3.AddItem Trim(result("姓名"))
result.MoveNext
Loop
End If
'''''''
'''''''''
sql = "select * from worktable where 类别='欠款审核' order by 类别"
Set result = cn.OpenResultset(sql, rdOpenDynamic, rdConcurRowVer)
If result.RowCount <> 0 Then
Do While Not result.EOF()
Combo4.AddItem Trim(result("姓名"))
result.MoveNext
Loop
End If
''''''''''
Mask1.Text = Format(Now, "yyyymmdd")
End Sub
Private Sub Mask1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text10_GotFocus()
Text10.Text = Format(Val(Text8.Text) - Val(Text9.Text), "fixed")
End Sub
Private Sub Text10_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text2_GotFocus()
Text2.Text = Mid(Text6.Text, 1, 5)
Text2.SelStart = Len(Text2.Text) + 1
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text4_GotFocus()
Dim point As Integer
Dim width
Dim height
Dim hstring As String
Dim hpoint As Integer
If Text3.Text <> "" Then
point = InStr(Text3.Text, "*")
width = Format(Mid(Trim(Text3.Text), 1, point - 1), "fixed")
hstring = Trim(Text3.Text)
hpoint = Len(Trim(Text3.Text)) - point
height = Format((Mid(hstring, point + 1, hpoint)), "fixed")
Text3.Text = width & "*" & height
''''''''
Text4.Text = Format((width * height), "fixed")
Else
MsgBox "画面规格不能为空!!"
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text5_LostFocus()
Text5.Text = Format(Text5.Text, "fixed")
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text8_GotFocus()
Text8.Text = Format((Val(Text5.Text) * Val(Text4.Text)), "fixed")
End Sub
Private Sub Text8_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text9_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text9_LostFocus()
Text9.Text = Format(Text9.Text, "fixed")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -