?? frmexportquery.frm
字號(hào):
ShowDateRef txtStartDate
End Sub
Private Sub cmdRef1_LostFocus()
cmdRef1.Visible = False
End Sub
Private Sub cmdRef2_Click()
ShowDateRef txtEndDate
End Sub
Private Sub cmdRef2_LostFocus()
cmdRef2.Visible = False
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF1 Then
SendKeys "{F1}"
ElseIf KeyCode = vbKeySeparator Or KeyCode = vbKeyReturn Then
SendKeys "{tab}"
ElseIf KeyCode = vbKeyF2 Then
If Me.ActiveControl.Name = "txtStartDate" Then
cmdRef1_Click
ElseIf Me.ActiveControl.Name = "txtEndDate" Then
cmdRef2_Click
End If
End If
End Sub
Private Sub Form_Load()
cmdRef1.Picture = LoadResPicture(1108, vbResBitmap)
cmdRef2.Picture = LoadResPicture(1108, vbResBitmap)
Me.Icon = LoadResPicture(109, vbResIcon)
FillUser
FillVchStyle
FillUnitName
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set unitID = Nothing
End Sub
Private Sub txtEndDate_GotFocus()
cmdRef2.Visible = True
End Sub
Private Sub txtStartDate_GotFocus()
cmdRef1.Visible = True
End Sub
Private Sub txtStartDate_LostFocus()
Dim tmp As String
If Me.ActiveControl.Name <> "cmdRef1" And Trim(txtStartDate.Text) = "" Then
cmdRef1.Visible = False
Exit Sub
End If
If Me.ActiveControl.Name = "cmdRef1" Then
Exit Sub
End If
tmp = txtStartDate.Text
If tmp = "" Then
ElseIf tmp <> "" And m_objAid.bCheckDate(tmp) Then
txtStartDate.Text = tmp
Else
txtStartDate.SelStart = 0
txtStartDate.SelLength = Len(txtStartDate.Text)
iShowMsg "日期格式錯(cuò)誤!"
txtStartDate.SetFocus
End If
txtStartDate.Text = tmp
cmdRef1.Visible = False
End Sub
Private Sub txtEndDate_LostFocus()
Dim tmp As String
If Me.ActiveControl.Name <> "cmdRef2" And Trim(txtEndDate.Text) = "" Then
cmdRef2.Visible = False
Exit Sub
End If
If Me.ActiveControl.Name = "cmdRef2" Then
Exit Sub
End If
tmp = txtEndDate.Text
If tmp = "" Then
ElseIf tmp <> "" And m_objAid.bCheckDate(tmp) Then
txtEndDate.Text = tmp
Else
txtEndDate.SelStart = 0
txtEndDate.SelLength = Len(txtEndDate.Text)
iShowMsg "日期格式錯(cuò)誤!"
txtEndDate.SetFocus
End If
txtEndDate.Text = tmp
cmdRef2.Visible = False
End Sub
'載入操作員列表
Public Sub FillUser()
Dim rs As ADODB.Recordset
If zjLogInfo.GetAccInfo(120, rs) Then
While Not rs.EOF
cboCheck.AddItem rs!cUser_Name
cboBill.AddItem rs!cUser_Name
rs.MoveNext
Wend
rs.Close
End If
End Sub
'載入單據(jù)類型
Private Sub FillVchStyle()
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
Dim cnt As Integer
con.CursorLocation = adUseClient
con.ConnectionString = g_sDataSourceName
con.Open
cnt = 0
sql = "select scaption,iid from fd_entities where ibitype=27 or ibitype=28 or iBIType=25"
Set rs = con.Execute(sql)
While Not rs.EOF
cboVchStyle.AddItem rs!sCaption
cboVchStyle.ItemData(cnt) = rs!iid
cnt = cnt + 1
rs.MoveNext
Wend
If cnt <> 0 Then
cboVchStyle.ListIndex = 0
End If
rs.Close
con.Close
End Sub
'載入
Private Sub FillUnitName()
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
Dim cnt As Integer
con.CursorLocation = adUseClient
con.ConnectionString = g_sDataSourceName
con.Open
cnt = 0
sql = "SELECT accunit_id, cUnitName FROM FD_AccUnit"
Set rs = con.Execute(sql)
While Not rs.EOF
cboUnitName.AddItem rs!cunitName
unitID.Add "" & rs!accunit_id, "" & cnt
cnt = cnt + 1
rs.MoveNext
Wend
rs.Close
con.Close
End Sub
'檢查完整性
Private Function GetQuery() As String
Dim tmp As String
'單據(jù)類型
GetQuery = ""
If Trim(cboVchStyle.Text) <> "" Then
GetQuery = " (t5.iBIType=" & cboVchStyle.ItemData(cboVchStyle.ListIndex) & " or t5.iDeriveBIType=" & cboVchStyle.ItemData(cboVchStyle.ListIndex) & ")"
End If
'單據(jù)編號(hào)
tmp = Trim(txtStartID.Text)
If tmp <> "" Then
If GetQuery <> "" Then
GetQuery = GetQuery & " and fd_transactions.transactions_code>='" & tmp & "' "
Else
GetQuery = " fd_transactions.transactions_code>='" & tmp & "' "
End If
End If
tmp = Trim(txtEndID.Text)
If tmp <> "" Then
If GetQuery <> "" Then
GetQuery = GetQuery & " and fd_transactions.transactions_code<='" & tmp & "' "
Else
GetQuery = " fd_transactions.transactions_code<='" & tmp & "' "
End If
End If
'單位名稱
If Trim(cboUnitName.Text) <> "" Then
If GetQuery <> "" Then
GetQuery = GetQuery & " and (t3.accunit_id='" & unitID(cboUnitName.ListIndex + 1) & "' or t4.accunit_id='" & unitID(cboUnitName.ListIndex + 1) & "')"
Else
GetQuery = " t3.accunit_id='" & unitID(cboUnitName.ListIndex + 1) & "' or t4.accunit_id='" & unitID(cboUnitName.ListIndex + 1) & "'"
End If
End If
'日期
tmp = Trim(txtStartDate.Text)
If tmp <> "" Then
If GetQuery <> "" Then
GetQuery = GetQuery & " and fd_transactions.bill_date>='" & tmp & "' "
Else
GetQuery = " fd_transactions.bill_date>='" & tmp & "' "
End If
End If
tmp = Trim(txtEndDate.Text)
If tmp <> "" Then
If GetQuery <> "" Then
GetQuery = GetQuery & " and fd_transactions.bill_date<='" & tmp & "' "
Else
GetQuery = " fd_transactions.bill_date<='" & tmp & "' "
End If
End If
'制單人
tmp = Trim(cboBill.Text)
If tmp <> "" Then
If GetQuery <> "" Then
GetQuery = GetQuery & " and fd_transactions.bill_name='" & tmp & "' "
Else
GetQuery = " fd_transactions.bill_name='" & tmp & "' "
End If
End If
'審核人
tmp = Trim(cboCheck.Text)
If tmp <> "" Then
If GetQuery <> "" Then
GetQuery = GetQuery & " and fd_transactions.check_name='" & tmp & "' "
Else
GetQuery = " fd_transactions.check_name='" & tmp & "' "
End If
End If
'
If GetQuery <> "" Then
GetQuery = "where fd_transactions.check_name is not null and fd_transactions.pz_code is null and fd_transactions.book_name is null and " & GetQuery
Else
GetQuery = "where fd_transactions.check_name is not null and fd_transactions.pz_code is null and fd_transactions.book_name is null "
End If
End Function
'檢查日期
Private Function bCheckField() As Boolean
If txtEndDate <> "" And txtStartDate <> "" And txtEndDate <> txtStartDate Then
If DateDiff("d", CDate(txtEndDate.Text), CDate(txtStartDate)) >= 0 Then
iShowMsg "結(jié)束日期不應(yīng)小于起始日期!!"
txtEndDate.SelStart = 0
txtEndDate.SelLength = Len(txtEndDate.Text)
txtEndDate.SetFocus
Exit Function
End If
End If
bCheckField = True
End Function
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -