📄 frmaccount.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmAccount
Caption = "选择账套"
ClientHeight = 3870
ClientLeft = 60
ClientTop = 345
ClientWidth = 4500
Icon = "frmAccount.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 3870
ScaleWidth = 4500
StartUpPosition = 2 '屏幕中心
Begin MSComCtl2.DTPicker dtpTime
Height = 255
Left = 195
TabIndex = 5
Top = 435
Width = 1935
_ExtentX = 3413
_ExtentY = 450
_Version = 393216
CustomFormat = "yyyy-MM-dd"
Format = 26935299
CurrentDate = 37368
End
Begin VB.CommandButton cmdCancel
Caption = "取消(&C)"
Height = 345
Left = 2625
TabIndex = 3
Top = 3315
Width = 1065
End
Begin VB.CommandButton cmdOK
Caption = "确定(&O)"
Height = 345
Left = 795
TabIndex = 2
Top = 3315
Width = 1065
End
Begin VB.ListBox lstAccount
Height = 1680
Left = 195
TabIndex = 1
Top = 1155
Width = 4095
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "操作日期:"
Height = 180
Left = 195
TabIndex = 4
Top = 195
Width = 810
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "请选择数据处理账套:"
Height = 180
Left = 195
TabIndex = 0
Top = 915
Width = 1710
End
End
Attribute VB_Name = "frmAccount"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public OK As Boolean '是否成功
Dim m_sStatus As String '操作状态,备份或恢复
Option Explicit
Public Property Let uiStatus(ByVal vNewValue As String)
m_sStatus = vNewValue
End Property
Private Sub cmdCancel_Click()
OK = False
Unload Me
End Sub
Private Sub cmdOk_Click()
Dim cnnVirtual As New ADODB.Connection
Dim sAccountID As String
Dim sUserName As String
Dim sYear As String
On Error GoTo HandleErr
'账套选择判断
If lstAccount.ListCount > 0 Then
If lstAccount.ListIndex <> -1 Then
If lstAccount.List(lstAccount.ListIndex) = "财务系统表" Then
sAccountID = "YKCWSYSDB"
Else
sAccountID = Mid(lstAccount.List(lstAccount.ListIndex), 1, InStr(1, lstAccount.List(lstAccount.ListIndex), "=") - 1)
End If
Else
MsgBox "请选择相应的账套!", vbInformation, "提示"
OK = False
lstAccount.SetFocus
Exit Sub
End If
Else
MsgBox "没有账套!请在“系统管理”子系统中创建!", vbExclamation, "警告"
OK = False
cmdCancel.SetFocus
Exit Sub
End If
sYear = Year(dtpTime.Value)
sUserName = frmLogin.usUserName
OK = True
If sUserName = "" Then
sUserName = Mid(frmLogin.cboUser.text, InStr(1, frmLogin.cboUser.text, "]") + 1)
End If
'生成备份账套连接
If lstAccount.List(lstAccount.ListIndex) = "财务系统表" Then
If g_FLAT = "SQL" Then
cnnVirtual.Open GetConnectString(g_FLAT, gloSys.sServer, _
gloSys.sUser, s.decrypt(gloSys.sPassword), sAccountID)
Else
cnnVirtual.Open GetConnectString(g_FLAT, gloSys.sServer, _
sAccountID, "horse")
End If
frmSelectedZXT.lvwReports.Enabled = False
frmSelectedZXT.cmdSelectReport.Enabled = False
frmSelectedZXT.cmdClearReport.Enabled = False
Else
If g_FLAT = "SQL" Then
cnnVirtual.Open GetConnectString(g_FLAT, gloSys.sServer, _
"sa", "", "cwDB" & sAccountID)
Else
cnnVirtual.Open GetConnectString(g_FLAT, gloSys.sServer, _
"cwDB" & sAccountID, "YKcwdb" & sAccountID)
End If
End If
'数据导入、导出状态处理
Select Case m_sStatus
Case "Import"
frmRestoreData.GetCnn = cnnVirtual
frmRestoreData.Show 1
Case "Export"
frmSelectedZXT.GetCnn = cnnVirtual
frmSelectedZXT.GetTime = Me.dtpTime.Value
frmSelectedZXT.GetAccountID = sAccountID
frmSelectedZXT.Show 1
End Select
Unload Me
Exit Sub
HandleErr:
MsgBox Err.Number & vbTab & Err.Description & vbTab & Err.Source, vbInformation, "提示"
Exit Sub
End Sub
Private Sub Form_Load()
Dim rSt As New ADODB.Recordset
lstAccount.Clear
lstAccount.AddItem "财务系统表"
lstAccount.Refresh
With rSt
.CursorLocation = adUseClient
.Open "SELECT * FROM tSYS_Account A,tSYS_Trade B " & _
"WHERE A.TradeID=B.ID ORDER BY A.AccountID", _
gloSys.cnnSys, adOpenStatic, adLockReadOnly
If .RecordCount <> 0 Then
Do Until .EOF
lstAccount.AddItem .Fields("AccountID").Value & "=" & _
.Fields("AccountName").Value
.MoveNext
Loop
End If
.Close
End With
lstAccount.Refresh
dtpTime.Value = Date
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -