📄 frmsal.frm
字号:
Case Else
End Select
Call SetToolBar(mkey)
End Sub
Private Sub spreaddetail()
txtentc.Text = gsEntCode
cmbcode.ListIndex = 0
cmbyear.ListIndex = 0
txtp1.Text = ""
txtp2.Text = ""
txtp3.Text = ""
txtp4.Text = ""
txtp5.Text = ""
txtp6.Text = ""
txtp7.Text = ""
txtp8.Text = ""
txtp9.Text = ""
txtp10.Text = ""
txtp11.Text = ""
txtp12.Text = ""
End Sub
Private Sub DelRecord()
On Error GoTo err
Dim lrow, lcol As Integer
Dim salcode As String
Dim sSQL As String
Dim syear As String
lrow = vasent.ActiveRow
lcol = 2
salcode = GetValue(vasent, lrow, lcol)
syear = GetValue(vasent, lrow, 3)
sSQL = "delete from syssal where salcode = '" & salcode & "' and salyear = " & syear
Acs_cnt.BeginTrans
Acs_cnt.Execute (sSQL)
Acs_cnt.CommitTrans
Exit Sub
err:
MsgBox err.Description, vbOKOnly, "Error"
End Sub
Private Function saveinfo() As Boolean
Dim sSQL As String
Dim rstsal As Recordset
Dim Entcode, salcode As String
Dim salyear As Long
Dim perio01, perio02, perio03, perio04, perio05, perio06 As Double
Dim perio08, perio09, perio10, perio11, perio12, perio07 As Double
Dim lrow As Integer
Dim year As Integer
Dim syear As String
On Error GoTo err
saveinfo = False
saveinfo = False
syear = str(Now)
syear = LTrim(syear)
syear = Left(syear, 4)
year = CInt(syear)
If cmbyear.Text = "" Then
ElseIf IsNumeric(cmbyear.Text) = False Then
MsgBox "The year must be numeric!"
Exit Function
ElseIf CInt(cmbyear.Text) = year Or CInt(cmbyear.Text) = year + 1 Then
Else
MsgBox "Only the current year and next year are available!"
Exit Function
End If
If txtp1.Text = "" Or txtp1.Text = "0" Then
txtp1.Text = "0"
ElseIf IsNumeric(txtp1.Text) = False Then
MsgBox "The Jan input must be numeric!"
End If
If txtp2.Text = "" Or txtp2.Text = "0" Then
txtp2.Text = "0"
ElseIf IsNumeric(txtp2.Text) = False Then
MsgBox "The Feb input must be numeric!"
End If
If txtp3.Text = "" Or txtp3.Text = "0" Then
txtp3.Text = "0"
ElseIf IsNumeric(txtp3.Text) = False Then
MsgBox "The Mar input must be numeric!"
End If
If txtp4.Text = "" Or txtp4.Text = "0" Then
txtp4.Text = "0"
ElseIf IsNumeric(txtp4.Text) = False Then
MsgBox "The Apr input must be numeric!"
End If
If txtp5.Text = "" Or txtp5.Text = "0" Then
txtp5.Text = "0"
ElseIf IsNumeric(txtp5.Text) = False Then
MsgBox "The May input must be numeric!"
End If
If txtp6.Text = "" Or txtp6.Text = "0" Then
txtp6.Text = "0"
ElseIf IsNumeric(txtp6.Text) = False Then
MsgBox "The Jun input must be numeric!"
End If
If txtp7.Text = "" Or txtp7.Text = "0" Then
txtp7.Text = "0"
ElseIf IsNumeric(txtp7.Text) = False Then
MsgBox "The Jul input must be numeric!"
End If
If txtp8.Text = "" Or txtp8.Text = "0" Then
txtp8.Text = "0"
ElseIf IsNumeric(txtp8.Text) = False Then
MsgBox "The Aug input must be numeric!"
End If
If txtp9.Text = "" Or txtp9.Text = "0" Then
txtp9.Text = "0"
ElseIf IsNumeric(txtp9.Text) = False Then
MsgBox "The Sep input must be numeric!"
End If
If txtp10.Text = "" Or txtp10.Text = "0" Then
txtp10.Text = "0"
ElseIf IsNumeric(txtp10.Text) = False Then
MsgBox "The Oct input must be numeric!"
End If
If txtp11.Text = "" Or txtp11.Text = "0" Then
txtp11.Text = "0"
ElseIf IsNumeric(txtp11.Text) = False Then
MsgBox "The Nov input must be numeric!"
End If
If txtp12.Text = "" Or txtp12.Text = "0" Then
txtp12.Text = "0"
ElseIf IsNumeric(txtp12.Text) = False Then
MsgBox "The Dec input must be numeric!"
End If
Entcode = gsEntCode
salcode = cmbcode.Text
salyear = CLng(cmbyear.Text)
perio01 = CDbl(txtp1.Text)
perio02 = CDbl(txtp2.Text)
perio03 = CDbl(txtp3.Text)
perio04 = CDbl(txtp4.Text)
perio05 = CDbl(txtp5.Text)
perio06 = CDbl(txtp6.Text)
perio07 = CDbl(txtp7.Text)
perio08 = CDbl(txtp8.Text)
perio09 = CDbl(txtp9.Text)
perio10 = CDbl(txtp10.Text)
perio11 = CDbl(txtp11.Text)
perio12 = CDbl(txtp12.Text)
sSQL = "select * from syssal where salcode = '" & salcode & "'and salyear = " & salyear
Set rstsal = Acs_cnt.Execute(sSQL)
If Not rstsal.EOF Then
MsgBox "The record is exist", vbOKOnly, "Information"
Exit Function
End If
rstsal.Close
Set rstsal = Nothing
sSQL = "insert into syssal (entcode,salcode,salyear,perio01,perio02,perio03,perio04,perio05,perio06,perio07,perio08,perio09,perio10,perio11,perio12) values " & _
"('" & Entcode & "','" & salcode & "'," & salyear & "," & perio01 & "," & perio02 & "," & perio03 & "," & perio04 & "," & perio05 & "," & perio06 & "," & perio07 & "," & perio08 & "," & perio09 & "," & perio10 & "," & perio11 & "," & perio12 & ")"
Acs_cnt.BeginTrans
Acs_cnt.Execute (sSQL)
Acs_cnt.CommitTrans
saveinfo = True
Exit Function
err:
MsgBox err.Description, vbOKOnly, "Error"
End Function
Private Function ModifyInfo() As Boolean
Dim sSQL As String
Dim Entcode, salcode As String
Dim salyear As Long
Dim perio01, perio02, perio03, perio04, perio05, perio06 As Double
Dim perio08, perio09, perio10, perio11, perio12, perio07 As Double
Dim year As Integer
Dim syear As String
On Error GoTo err
ModifyInfo = False
syear = str(Now)
syear = LTrim(syear)
syear = Left(syear, 4)
year = CInt(syear)
If cmbyear.Text = "" Then
ElseIf IsNumeric(cmbyear.Text) = False Then
MsgBox "The year must be numeric!"
Exit Function
ElseIf CInt(cmbyear.Text) = year Or CInt(cmbyear.Text) = year + 1 Then
Else
MsgBox "Only the current year and next year are available!"
Exit Function
End If
If txtp1.Text = "" Or txtp1.Text = "0" Then
txtp1.Text = "0"
ElseIf IsNumeric(txtp1.Text) = False Then
MsgBox "The Jan input must be numeric!"
End If
If txtp2.Text = "" Or txtp2.Text = "0" Then
txtp2.Text = "0"
ElseIf IsNumeric(txtp2.Text) = False Then
MsgBox "The Feb input must be numeric!"
End If
If txtp3.Text = "" Or txtp3.Text = "0" Then
txtp3.Text = "0"
ElseIf IsNumeric(txtp3.Text) = False Then
MsgBox "The Mar input must be numeric!"
End If
If txtp4.Text = "" Or txtp4.Text = "0" Then
txtp4.Text = "0"
ElseIf IsNumeric(txtp4.Text) = False Then
MsgBox "The Apr input must be numeric!"
End If
If txtp5.Text = "" Or txtp5.Text = "0" Then
txtp5.Text = "0"
ElseIf IsNumeric(txtp5.Text) = False Then
MsgBox "The May input must be numeric!"
End If
If txtp6.Text = "" Or txtp6.Text = "0" Then
txtp6.Text = "0"
ElseIf IsNumeric(txtp6.Text) = False Then
MsgBox "The Jun input must be numeric!"
End If
If txtp7.Text = "" Or txtp7.Text = "0" Then
txtp7.Text = "0"
ElseIf IsNumeric(txtp7.Text) = False Then
MsgBox "The Jul input must be numeric!"
End If
If txtp8.Text = "" Or txtp8.Text = "0" Then
txtp8.Text = "0"
ElseIf IsNumeric(txtp8.Text) = False Then
MsgBox "The Aug input must be numeric!"
End If
If txtp9.Text = "" Or txtp9.Text = "0" Then
txtp9.Text = "0"
ElseIf IsNumeric(txtp9.Text) = False Then
MsgBox "The Sep input must be numeric!"
End If
If txtp10.Text = "" Or txtp10.Text = "0" Then
txtp10.Text = "0"
ElseIf IsNumeric(txtp10.Text) = False Then
MsgBox "The Oct input must be numeric!"
End If
If txtp11.Text = "" Or txtp11.Text = "0" Then
txtp11.Text = "0"
ElseIf IsNumeric(txtp11.Text) = False Then
MsgBox "The Nov input must be numeric!"
End If
If txtp12.Text = "" Or txtp12.Text = "0" Then
txtp12.Text = "0"
ElseIf IsNumeric(txtp12.Text) = False Then
MsgBox "The Dec input must be numeric!"
End If
Entcode = gsEntCode
salcode = cmbcode.Text
salyear = CLng(cmbyear.Text)
perio01 = CDbl(txtp1.Text)
perio02 = CDbl(txtp2.Text)
perio03 = CDbl(txtp3.Text)
perio04 = CDbl(txtp4.Text)
perio05 = CDbl(txtp5.Text)
perio06 = CDbl(txtp6.Text)
perio07 = CDbl(txtp7.Text)
perio08 = CDbl(txtp8.Text)
perio09 = CDbl(txtp9.Text)
perio10 = CDbl(txtp10.Text)
perio11 = CDbl(txtp11.Text)
perio12 = CDbl(txtp12.Text)
sSQL = "update syssal set perio01 = " & perio01 & "," & "perio02 = " & perio02 & "," & _
"perio03 = " & perio03 & "," & "perio04 = " & perio04 & "," & "perio05 = " & perio05 & "," & "perio06 = " & perio06 & "," & _
"perio07 =" & perio07 & "," & "perio08 = " & perio08 & "," & "perio09 = " & perio09 & "," & "perio10 = " & perio10 & "," & _
"perio11 = " & perio11 & "," & "perio12 = " & perio12 & " where entcode ='" & Entcode & "' and salcode ='" & salcode & "' and salyear = " & salyear
Acs_cnt.BeginTrans
Acs_cnt.Execute (sSQL)
Acs_cnt.CommitTrans
ModifyInfo = True
lCurRow = vasent.ActiveRow
Call vasent_Click(1, lCurRow)
Exit Function
err:
MsgBox err.Description, vbOKOnly, "Error"
End Function
Private Sub vasent_Click(ByVal Col As Long, ByVal Row As Long)
Dim code As String
Dim year As Long
Dim i As Long
lCurRow = Row
If Row > 0 Then
txtentc.Text = gsEntCode
code = GetValue(vasent, lCurRow, 2)
year = GetValue(vasent, lCurRow, 3)
For i = 0 To cmbcode.ListCount - 1
cmbcode.ListIndex = i
If cmbcode.Text = code Then
Exit For
Else
End If
Next
For i = 0 To cmbyear.ListCount - 1
cmbyear.ListIndex = i
If cmbyear.Text = year Then
Exit For
End If
Next
txtp1.Text = GetValue(vasent, lCurRow, 4)
txtp2.Text = GetValue(vasent, lCurRow, 5)
txtp3.Text = GetValue(vasent, lCurRow, 6)
txtp4.Text = GetValue(vasent, lCurRow, 7)
txtp5.Text = GetValue(vasent, lCurRow, 8)
txtp6.Text = GetValue(vasent, lCurRow, 9)
txtp7.Text = GetValue(vasent, lCurRow, 10)
txtp8.Text = GetValue(vasent, lCurRow, 11)
txtp9.Text = GetValue(vasent, lCurRow, 12)
txtp10.Text = GetValue(vasent, lCurRow, 13)
txtp11.Text = GetValue(vasent, lCurRow, 14)
txtp12.Text = GetValue(vasent, lCurRow, 15)
Else
End If
End Sub
Private Sub vasent_KeyUp(KeyCode As Integer, Shift As Integer)
Dim lrow, lcol As Long
lrow = vasent.ActiveRow
lcol = vasent.ActiveCol
If KeyCode = vbKeyUp Or KeyCode = vbKeyDown Then
Call vasent_Click(lcol, lrow)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -