上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:30k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
  3. Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
  4. Begin VB.Form XT_login 
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "百利/ERP5.0-运输系统登录"
  7.    ClientHeight    =   4140
  8.    ClientLeft      =   45
  9.    ClientTop       =   330
  10.    ClientWidth     =   4770
  11.    ControlBox      =   0   'False
  12.    HelpContextID   =   1601007
  13.    Icon            =   "系统_登录窗体.frx":0000
  14.    KeyPreview      =   -1  'True
  15.    LinkTopic       =   "Form2"
  16.    MaxButton       =   0   'False
  17.    MinButton       =   0   'False
  18.    ScaleHeight     =   4140
  19.    ScaleWidth      =   4770
  20.    StartUpPosition =   2  '屏幕中心
  21.    Begin VB.CheckBox QdCheck 
  22.       Caption         =   "是否修改"
  23.       Height          =   825
  24.       Left            =   4980
  25.       TabIndex        =   13
  26.       Top             =   1260
  27.       Value           =   1  'Checked
  28.       Width           =   705
  29.    End
  30.    Begin VB.CheckBox CtdrCheck 
  31.       Caption         =   "非第一次调入窗体"
  32.       Height          =   735
  33.       Left            =   4980
  34.       TabIndex        =   0
  35.       Top             =   390
  36.       Width           =   705
  37.    End
  38.    Begin TabDlg.SSTab StTab 
  39.       Height          =   4065
  40.       Left            =   60
  41.       TabIndex        =   14
  42.       Top             =   30
  43.       Width           =   4665
  44.       _ExtentX        =   8229
  45.       _ExtentY        =   7170
  46.       _Version        =   393216
  47.       Style           =   1
  48.       TabHeight       =   520
  49.       TabCaption(0)   =   "帐套选择及身份验证"
  50.       TabPicture(0)   =   "系统_登录窗体.frx":1042
  51.       Tab(0).ControlEnabled=   -1  'True
  52.       Tab(0).Control(0)=   "Frame1(0)"
  53.       Tab(0).Control(0).Enabled=   0   'False
  54.       Tab(0).ControlCount=   1
  55.       TabCaption(1)   =   "数据服务器连接设置"
  56.       TabPicture(1)   =   "系统_登录窗体.frx":105E
  57.       Tab(1).ControlEnabled=   0   'False
  58.       Tab(1).Control(0)=   "Frame1(1)"
  59.       Tab(1).ControlCount=   1
  60.       TabCaption(2)   =   "更改密码"
  61.       TabPicture(2)   =   "系统_登录窗体.frx":107A
  62.       Tab(2).ControlEnabled=   0   'False
  63.       Tab(2).Control(0)=   "Frame1(2)"
  64.       Tab(2).ControlCount=   1
  65.       Begin VB.Frame Frame1 
  66.          Height          =   3555
  67.          Index           =   0
  68.          Left            =   90
  69.          TabIndex        =   25
  70.          Top             =   390
  71.          Width           =   4455
  72.          Begin VB.CommandButton QxCommand 
  73.             Caption         =   "取消(&C)"
  74.             Height          =   300
  75.             Left            =   3210
  76.             TabIndex        =   29
  77.             Top             =   3150
  78.             Width           =   1120
  79.          End
  80.          Begin VB.CommandButton QdCommand 
  81.             Caption         =   "确定(&O)"
  82.             Height          =   300
  83.             Left            =   2040
  84.             TabIndex        =   6
  85.             Top             =   3150
  86.             Width           =   1120
  87.          End
  88.          Begin VB.ComboBox ZtCombo 
  89.             Height          =   300
  90.             Left            =   1050
  91.             Style           =   2  'Dropdown List
  92.             TabIndex        =   1
  93.             Top             =   330
  94.             Width           =   3225
  95.          End
  96.          Begin VB.ComboBox KjyearCombo 
  97.             Height          =   300
  98.             Left            =   1050
  99.             Style           =   2  'Dropdown List
  100.             TabIndex        =   2
  101.             Top             =   720
  102.             Width           =   3225
  103.          End
  104.          Begin VB.TextBox CzrqText 
  105.             Height          =   300
  106.             Left            =   1050
  107.             MaxLength       =   10
  108.             TabIndex        =   3
  109.             Top             =   1140
  110.             Width           =   2895
  111.          End
  112.          Begin VB.CommandButton Rlcommand 
  113.             CausesValidation=   0   'False
  114.             Height          =   302
  115.             Left            =   3960
  116.             Picture         =   "系统_登录窗体.frx":1096
  117.             Style           =   1  'Graphical
  118.             TabIndex        =   28
  119.             Top             =   1140
  120.             Width           =   315
  121.          End
  122.          Begin VB.ComboBox CzyCombo 
  123.             Height          =   300
  124.             Left            =   1050
  125.             TabIndex        =   4
  126.             Top             =   1560
  127.             Width           =   3255
  128.          End
  129.          Begin VB.TextBox MmText 
  130.             Height          =   300
  131.             IMEMode         =   3  'DISABLE
  132.             Left            =   1050
  133.             MaxLength       =   20
  134.             PasswordChar    =   "*"
  135.             TabIndex        =   5
  136.             Top             =   1980
  137.             Width           =   2610
  138.          End
  139.          Begin VB.Timer Timer1 
  140.             Interval        =   100
  141.             Left            =   120
  142.             Top             =   1980
  143.          End
  144.          Begin VB.CommandButton XgmaCommand 
  145.             Caption         =   "修改密码(&M)"
  146.             Height          =   300
  147.             Left            =   2040
  148.             TabIndex        =   27
  149.             Top             =   2790
  150.             Width           =   1120
  151.          End
  152.          Begin VB.CommandButton GgszCommand 
  153.             Caption         =   "更改设置(&A)"
  154.             Height          =   300
  155.             Left            =   3210
  156.             TabIndex        =   26
  157.             Top             =   2790
  158.             Width           =   1120
  159.          End
  160.          Begin VB.Label TsLabel 
  161.             Alignment       =   1  'Right Justify
  162.             Caption         =   "操作日期"
  163.             Height          =   345
  164.             Index           =   3
  165.             Left            =   150
  166.             TabIndex        =   34
  167.             Top             =   1200
  168.             Width           =   825
  169.          End
  170.          Begin VB.Label TsLabel 
  171.             Alignment       =   1  'Right Justify
  172.             Caption         =   "会计年度"
  173.             Height          =   345
  174.             Index           =   1
  175.             Left            =   180
  176.             TabIndex        =   33
  177.             Top             =   780
  178.             Width           =   795
  179.          End
  180.          Begin VB.Label TsLabel 
  181.             Alignment       =   1  'Right Justify
  182.             Caption         =   "公司帐套"
  183.             Height          =   255
  184.             Index           =   0
  185.             Left            =   120
  186.             TabIndex        =   32
  187.             Top             =   420
  188.             Width           =   855
  189.          End
  190.          Begin VB.Label TsLabel 
  191.             Alignment       =   1  'Right Justify
  192.             Caption         =   "用户名"
  193.             Height          =   345
  194.             Index           =   2
  195.             Left            =   120
  196.             TabIndex        =   31
  197.             Top             =   1620
  198.             Width           =   855
  199.          End
  200.          Begin VB.Label TsLabel 
  201.             Caption         =   "密码"
  202.             Height          =   345
  203.             Index           =   4
  204.             Left            =   600
  205.             TabIndex        =   30
  206.             Top             =   2040
  207.             Width           =   405
  208.          End
  209.          Begin VB.Line Line1 
  210.             Index           =   0
  211.             X1              =   240
  212.             X2              =   4260
  213.             Y1              =   2610
  214.             Y2              =   2610
  215.          End
  216.          Begin VB.Line Line1 
  217.             BorderColor     =   &H00FFFFFF&
  218.             Index           =   1
  219.             X1              =   240
  220.             X2              =   4260
  221.             Y1              =   2640
  222.             Y2              =   2640
  223.          End
  224.          Begin VB.Image Image1 
  225.             Height          =   480
  226.             Left            =   3810
  227.             Picture         =   "系统_登录窗体.frx":1420
  228.             Top             =   1980
  229.             Width           =   480
  230.          End
  231.       End
  232.       Begin VB.Frame Frame1 
  233.          Height          =   3555
  234.          Index           =   1
  235.          Left            =   -74910
  236.          TabIndex        =   20
  237.          Top             =   330
  238.          Width           =   4455
  239.          Begin VB.TextBox ServerText 
  240.             Height          =   300
  241.             Left            =   1800
  242.             TabIndex        =   7
  243.             Top             =   660
  244.             Width           =   1905
  245.          End
  246.          Begin VB.CommandButton LjqdCommand 
  247.             Caption         =   "确 定"
  248.             Height          =   300
  249.             Left            =   1410
  250.             TabIndex        =   8
  251.             Top             =   1440
  252.             Width           =   1120
  253.          End
  254.          Begin VB.CommandButton LjqxCommand 
  255.             Caption         =   "取 消"
  256.             Height          =   300
  257.             Left            =   2580
  258.             TabIndex        =   21
  259.             Top             =   1440
  260.             Width           =   1120
  261.          End
  262.          Begin MSComCtl2.Animation Animation1 
  263.             Height          =   615
  264.             Left            =   150
  265.             TabIndex        =   22
  266.             Top             =   1290
  267.             Visible         =   0   'False
  268.             Width           =   705
  269.             _ExtentX        =   1244
  270.             _ExtentY        =   1085
  271.             _Version        =   393216
  272.             Center          =   -1  'True
  273.             BackStyle       =   1
  274.             FullWidth       =   47
  275.             FullHeight      =   41
  276.          End
  277.          Begin VB.Label TsLabel 
  278.             Alignment       =   1  'Right Justify
  279.             AutoSize        =   -1  'True
  280.             Caption         =   "数据服务器:"
  281.             Height          =   180
  282.             Index           =   7
  283.             Left            =   765
  284.             TabIndex        =   24
  285.             Top             =   720
  286.             Width           =   990
  287.          End
  288.          Begin VB.Label DdtsLabel 
  289.             ForeColor       =   &H00FF0000&
  290.             Height          =   255
  291.             Left            =   1110
  292.             TabIndex        =   23
  293.             Top             =   2490
  294.             Width           =   3045
  295.          End
  296.       End
  297.       Begin VB.Frame Frame1 
  298.          Height          =   3585
  299.          Index           =   2
  300.          Left            =   -74910
  301.          TabIndex        =   15
  302.          Top             =   330
  303.          Width           =   4455
  304.          Begin VB.TextBox LrText 
  305.             Height          =   300
  306.             IMEMode         =   3  'DISABLE
  307.             Index           =   0
  308.             Left            =   1350
  309.             MaxLength       =   20
  310.             PasswordChar    =   "*"
  311.             TabIndex        =   9
  312.             Top             =   360
  313.             Width           =   2250
  314.          End
  315.          Begin VB.CommandButton MmqdCommand 
  316.             Caption         =   "确定(&O)"
  317.             Height          =   300
  318.             Left            =   1200
  319.             TabIndex        =   12
  320.             Top             =   2190
  321.             Width           =   1120
  322.          End
  323.          Begin VB.CommandButton MmqxCommand 
  324.             Caption         =   "取消(&C)"
  325.             Height          =   300
  326.             Left            =   2370
  327.             TabIndex        =   16
  328.             Top             =   2190
  329.             Width           =   1125
  330.          End
  331.          Begin VB.TextBox LrText 
  332.             Height          =   300
  333.             IMEMode         =   3  'DISABLE
  334.             Index           =   1
  335.             Left            =   1350
  336.             MaxLength       =   20
  337.             PasswordChar    =   "*"
  338.             TabIndex        =   10
  339.             Top             =   750
  340.             Width           =   2250
  341.          End
  342.          Begin VB.TextBox LrText 
  343.             Height          =   300
  344.             IMEMode         =   3  'DISABLE
  345.             Index           =   2
  346.             Left            =   1350
  347.             MaxLength       =   20
  348.             PasswordChar    =   "*"
  349.             TabIndex        =   11
  350.             Top             =   1140
  351.             Width           =   2250
  352.          End
  353.          Begin VB.Line Line1 
  354.             Index           =   2
  355.             X1              =   420
  356.             X2              =   4020
  357.             Y1              =   1800
  358.             Y2              =   1800
  359.          End
  360.          Begin VB.Label TsLabel 
  361.             AutoSize        =   -1  'True
  362.             Caption         =   "旧密码:"
  363.             Height          =   180
  364.             Index           =   14
  365.             Left            =   480
  366.             TabIndex        =   19
  367.             Top             =   420
  368.             Width           =   630
  369.          End
  370.          Begin VB.Label TsLabel 
  371.             AutoSize        =   -1  'True
  372.             Caption         =   "新密码:"
  373.             Height          =   180
  374.             Index           =   15
  375.             Left            =   480
  376.             TabIndex        =   18
  377.             Top             =   810
  378.             Width           =   630
  379.          End
  380.          Begin VB.Label TsLabel 
  381.             AutoSize        =   -1  'True
  382.             Caption         =   "确认密码:"
  383.             Height          =   180
  384.             Index           =   16
  385.             Left            =   480
  386.             TabIndex        =   17
  387.             Top             =   1200
  388.             Width           =   810
  389.          End
  390.          Begin VB.Line Line1 
  391.             BorderColor     =   &H00FFFFFF&
  392.             Index           =   3
  393.             X1              =   420
  394.             X2              =   4020
  395.             Y1              =   1830
  396.             Y2              =   1830
  397.          End
  398.       End
  399.    End
  400. End
  401. Attribute VB_Name = "XT_login"
  402. Attribute VB_GlobalNameSpace = False
  403. Attribute VB_Creatable = False
  404. Attribute VB_PredeclaredId = True
  405. Attribute VB_Exposed = False
  406. Dim Xtsjljc As String                       '系统数据服务器连接串
  407. Dim ErpPassWord As String                   '系统连接密码
  408. Dim Cslj As New ADODB.Connection            '测试连接(为屏蔽提示信息)
  409. Dim Tsxx As String                          '系统提示信息
  410. Dim Czyrec As New ADODB.Recordset           '操作员动态集
  411. Dim Xtrlrec As New ADODB.Recordset          '系统日历动态集
  412. Dim Ztdqsjk As String                       '所选帐套当前数据库
  413. Private Function Ljyxxpd() As Boolean       '数据服务器(系统基本信息库)连接有效性测试
  414.     Ljyxxpd = False
  415.     If Len(Trim(ServerText.Text)) = 0 Then
  416.         Tsxx = "数据服务器名不能为空!"
  417.         Call Xtxxts(Tsxx, 0, 1)
  418.         ServerText.SetFocus
  419.         Exit Function
  420.     End If
  421.     Xtsjljc = "Provider=SQLOLEDB.1;"
  422.     
  423.     Xtsjljc = Xtsjljc + "Persist Security Info=False;"
  424.     
  425.     Xtsjljc = Xtsjljc + "Data Source=" + Trim(ServerText.Text) + ";"
  426.     
  427.     Xtsjljc = Xtsjljc + " Initial Catalog=" + "Master" + ";"
  428.     
  429.     If Cslj.State = 1 Then Cslj.Close
  430.     
  431.     DdtsLabel = "系统正在连接数据服务器,请稍等..."
  432.     DdtsLabel.Refresh
  433.     With Me.Animation1
  434.         .Visible = True
  435.         .Open App.Path + "Ljcs.avi"
  436.         .Play
  437.     End With
  438.     On Error GoTo Cwcl
  439.     
  440.     If Cslj.State = 1 Then Cslj.Close
  441.     Cslj.Open Xtsjljc, "Hxxd", ErpPassWord
  442.     
  443.     Animation1.Stop
  444.     Animation1.Visible = False
  445.     
  446.     DdtsLabel = ""
  447.     DdtsLabel.Refresh
  448.       
  449.     Ljyxxpd = True
  450.     
  451.     Exit Function
  452.     
  453. Cwcl:
  454.     Animation1.Visible = False
  455.     Animation1.Stop
  456.     DdtsLabel = ""
  457.     Tsxx = "数据服务器连接测试失败!"
  458.     Call Xtxxts(Tsxx, 0, 1)
  459.     Exit Function
  460.   
  461. End Function
  462. Private Sub CzrqText_KeyPress(KeyAscii As Integer)      '录入日期限制
  463.     Call Lrrqxz(KeyAscii)
  464. End Sub
  465. Private Sub Form_KeyPress(KeyAscii As Integer)          '控 制 焦 点 转 移
  466.     Dim jdzygs As Integer
  467.     jdzygs = 12
  468.     Select Case KeyAscii
  469.         Case vbKeyReturn
  470.             If Kjjdzy(jdzygs) Then
  471.                 KeyAscii = 0
  472.             End If
  473.         Case 39           '屏蔽"'"
  474.             KeyAscii = 0
  475.     End Select
  476. End Sub
  477. Private Sub Form_Load()
  478.     App.HelpFile = App.Path + "运输系统.chm"
  479.     
  480.     XtMenuList = "12%"         '子系统菜单系统代号
  481.     
  482.     ErpPassWord = "123"
  483.     
  484.     Call Qcljnr     '读入连接内容
  485.     
  486.     With StTab
  487.         .TabEnabled(0) = False
  488.         Frame1(0).Enabled = False
  489.         .TabEnabled(1) = True
  490.         Frame1(1).Enabled = True
  491.         .TabEnabled(2) = False
  492.         Frame1(2).Enabled = False
  493.          StTab.Tab = 1
  494.     End With
  495.     
  496. End Sub
  497. Private Sub GgszCommand_Click()
  498.     With Me.StTab
  499.         .TabEnabled(0) = False
  500.         Frame1(0).Enabled = False
  501.         .TabEnabled(1) = True
  502.         Frame1(1).Enabled = True
  503.         .Tab = 1
  504.     End With
  505.     
  506.     ' 让数据服务器设置文本框得到焦点
  507.     ServerText.SetFocus
  508.     ServerText.SelStart = 0
  509.     ServerText.SelLength = Len(ServerText.Text)
  510. End Sub
  511. Private Sub LjqdCommand_Click()                              '保 存 设 置
  512.  
  513.     If Ljyxxpd Then
  514.         If Cw_DataEnvi.BaseInfoConnect.State = 1 Then Cw_DataEnvi.BaseInfoConnect.Close
  515.         Cw_DataEnvi.BaseInfoConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  516.         
  517.         Tsxx = "连接测试成功!"
  518.         Call Xtxxts(Tsxx, 0, 4)
  519.         
  520.         StTab.TabEnabled(1) = False
  521.         Frame1(1).Enabled = False
  522.         StTab.TabEnabled(0) = True
  523.         Frame1(0).Enabled = True
  524.         StTab.Tab = 0
  525.         Call Tcztxx
  526.         
  527.         If ZtCombo.ListCount > 0 Then
  528.             ZtCombo.ListIndex = 0
  529.         End If
  530.     End If
  531. End Sub
  532. Private Sub Qcljnr()                                         '取 出 数 据
  533.     Dim Fsote As New FileSystemObject, Tste As TextStream
  534.     Dim Dqhs As Integer, Dqnr As String
  535.     Dqhs = 5
  536.     On Error GoTo Cwcl:
  537.     Set Tste = Fsote.OpenTextFile(App.Path + "百利erp.txt", 1)
  538.     For jsqte = 1 To Dqhs
  539.         Dqnr = Trim(Tste.ReadLine)
  540.         If InStr(1, UCase(Dqnr), "SQLSERVER=") <> 0 Then
  541.             ServerText.Text = Mid(Dqnr, InStr(1, UCase(Dqnr), "SQLSERVER=") + 10, Len(Dqnr))
  542.         End If
  543.         If InStr(1, UCase(Dqnr), "ACCOUNT=") <> 0 Then
  544.             str_Account = Mid(Dqnr, InStr(1, UCase(Dqnr), "ACCOUNT=") + 8, Len(Dqnr))
  545.             Dim int_Count As Integer
  546.              
  547.             For int_Count = 0 To ZtCombo.ListCount - 1
  548.                 If UCase(Mid(ZtCombo.List(int_Count), 1, InStr(ZtCombo.List(int_Count), "-") - 1)) = UCase(Mid(str_Account, 1, InStr(str_Account, "-") - 1)) Then
  549.                     ZtCombo.ListIndex = int_Count
  550.                 End If
  551.             Next int_Count
  552.         End If
  553.     Next jsqte
  554.     Exit Sub
  555. Cwcl:
  556.     Exit Sub
  557. End Sub
  558. Private Sub QdCommand_Click()          '确定进入系统
  559.     If Trim(CzyCombo.Text) = "" Then Exit Sub
  560.     
  561.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl where czybm='" + Trim(CzyCombo.Text) + "' or czymc='" & Trim(CzyCombo.Text) & "' or rtrim(czybm)+'-'+rtrim(czymc)='" & Trim(CzyCombo.Text) & "'")
  562.     With Czyrec
  563.         If Not .EOF Then
  564.         CzyCombo.Text = Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  565.         Else
  566.             Tsxx = "无此用户名!"
  567.             Call Xtxxts(Tsxx, 0, 1)
  568.             Exit Sub
  569.         End If
  570.     End With
  571.     Czyrec.Close
  572.     Set Czyrec = Nothing
  573.     If Xtyxxpd Then
  574.         If Ljyxxpd1 Then
  575.             If Cw_DataEnvi.DataConnect.State = 1 Then Cw_DataEnvi.DataConnect.Close
  576.             Cw_DataEnvi.DataConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  577.         End If
  578.         QdCheck.Value = 1
  579.         Me.Hide
  580.         
  581.         Dim Fsote As New FileSystemObject, Tste As TextStream
  582.         Set Tste = Fsote.CreateTextFile(App.Path + "百利erp.txt", True)
  583.         Tste.WriteLine "Sqlserver=" + Trim(ServerText.Text)
  584.         Tste.WriteLine "Account=" + Trim(ZtCombo.Text)
  585.         Tste.Close
  586.         
  587.         CtdrCheck.Value = 1
  588.         GgszCommand.Enabled = False
  589.         XT_Main.Show
  590.         
  591.         Xt_Control.tvTreeView.Visible = False
  592.         Xt_Control.tvTreeView.Nodes.Clear
  593.         Xt_Control.Cshgns
  594.         Xt_Control.tvTreeView.Refresh
  595.         Xt_Control.tvTreeView.Visible = True
  596.     End If
  597. End Sub
  598. Private Sub QxCommand_Click()                                     '取消进入系统
  599.     If CtdrCheck.Value <> 1 Then
  600.         Unload Me
  601.     Else
  602.         Me.Hide
  603.     End If
  604. End Sub
  605. Private Sub Rlcommand_Click()                                     '操作日期帮助
  606.     Call Czrqbz
  607. End Sub
  608. Private Sub Timer1_Timer()                                        '激活连接测试
  609.     Timer1.Enabled = False
  610.     
  611.     If Ljyxxpd Then
  612.         If Cw_DataEnvi.BaseInfoConnect.State = 1 Then Cw_DataEnvi.BaseInfoConnect.Close
  613.         Cw_DataEnvi.BaseInfoConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  614.     Else
  615.         Exit Sub
  616.     End If
  617.     
  618.     With StTab
  619.         .TabEnabled(1) = False
  620.         Frame1(1).Enabled = False
  621.         .TabEnabled(0) = True
  622.         Frame1(0).Enabled = True
  623.     End With
  624.     
  625.     StTab.Tab = 0
  626.       
  627.     Call Tcztxx
  628.     Qcljnr
  629.     
  630.     '让用户名录入框得到焦点
  631.     CzyCombo.SetFocus
  632. End Sub
  633. Private Sub LjqxCommand_Click()                                   '连接失败退出
  634.     If CtdrCheck.Value <> 1 Then
  635.         Unload Me
  636.     Else
  637.         Me.Hide
  638.     End If
  639. End Sub
  640. Private Sub Tcztxx()                                              '填充帐套信息选择
  641.     Dim Xtztxxrec As New ADODB.Recordset        '系统帐套信息动态集
  642.     Set Xtztxxrec = Cw_DataEnvi.BaseInfoConnect.Execute("Select * From HDSystem_Databases order by number")
  643.     ZtCombo.Clear
  644.     With Xtztxxrec
  645.         Do While Not .EOF
  646.             If .Fields("YNuse") = "1" Then
  647.                 ZtCombo.AddItem .Fields("number") + "-" + Trim(.Fields("CountingRoomName"))
  648.             End If
  649.             .MoveNext
  650.         Loop
  651.     End With
  652. End Sub
  653. Private Sub ZtCombo_Click()
  654.     Dim Xtztxxrec As New ADODB.Recordset        '系统帐套信息动态集
  655.     Dim RecTemp As New ADODB.Recordset
  656.     Dim Xt_Id As Integer                         '该模块系统的ID号
  657.     
  658.     On Error GoTo ErrHandle
  659.     Set Xtztxxrec = Cw_DataEnvi.BaseInfoConnect.Execute("Select * From HDSystem_DataBases where Number='" + Trim(Mid(ZtCombo.Text, 1, InStr(1, ZtCombo.Text, "-") - 1)) + "'")
  660.     With Xtztxxrec
  661.         If Not .EOF Then
  662.             Ztdqsjk = Trim(.Fields("DataBasesName"))
  663.         End If
  664.     End With
  665.     If Ljyxxpd1 Then
  666.         If Cw_DataEnvi.DataConnect.State = 1 Then Cw_DataEnvi.DataConnect.Close
  667.         Cw_DataEnvi.DataConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  668.     Else
  669.         Exit Sub
  670.     End If
  671.    
  672.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select ID From Xt_Xtgnb  Where gnbm='01'")
  673.     If RecTemp.EOF = False Then
  674.         Xt_Id = RecTemp.Fields("ID")
  675.         Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl Where  right(left(AuthorityId," & Xt_Id & "),1)='1' order by czybm")
  676.         XgmaCommand.Enabled = True
  677.         QdCommand.Enabled = True
  678.         CzyCombo.Enabled = True
  679.     Else
  680.         XgmaCommand.Enabled = False
  681.         QdCommand.Enabled = False
  682.         CzyCombo.Text = ""
  683.         CzyCombo.Enabled = False
  684.         Tsxx = "请将该系统的操作权限赋予操作员!"
  685.         Call Xtxxts(Tsxx, 0, 4)
  686.         Exit Sub
  687.     End If
  688.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl order by czybm")
  689.     CzyCombo.Clear
  690.     With Czyrec
  691.         Do While Not .EOF
  692.             CzyCombo.AddItem Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  693.             .MoveNext
  694.         Loop
  695.         CzyCombo.Text = CzyCombo.List(0)
  696.     End With
  697.     Set Xtrlrec = Cw_DataEnvi.DataConnect.Execute("Select distinct kjyear From gy_kjrlb order by kjyear ")
  698.     KjyearCombo.Clear
  699.     With Xtrlrec
  700.         Do While Not .EOF
  701.            KjyearCombo.AddItem Trim(.Fields("kjyear"))
  702.            .MoveNext
  703.         Loop
  704.     End With
  705.     
  706.     Set Xtrlrec = Cw_DataEnvi.DataConnect.Execute("Select top 1 kjyear From gy_kjrlb where cwzzjzbz=0 order by kjyear DESC,period ")
  707.     If Not Xtrlrec.EOF Then
  708.         KjyearCombo.Text = Xtrlrec.Fields("Kjyear")
  709.     End If
  710.    
  711.     Call Drxtztcs             '读入系统帐套参数
  712.   
  713.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select ServerDate=getdate()")
  714.     CzrqText = Format(RecTemp.Fields("ServerDate"), "yyyy-mm-dd")
  715.    
  716. ErrHandle:
  717.    
  718. End Sub
  719. Private Sub Czrqbz()                                                  '操作日期帮助
  720.     Xtcdcs = Trim(CzrqText.Text)
  721.     Xtfhcs = ""
  722.     XT_calendar.Show 1
  723.     If Xtfhcs <> "" Then
  724.         CzrqText.Text = Trim(Xtfhcs)
  725.     End If
  726.     CzrqText.SetFocus
  727. End Sub
  728. Private Sub CzrqText_KeyDown(KeyCode As Integer, Shift As Integer)    '操作日期帮助
  729.     If KeyCode = vbKeyF2 Then
  730.         Call Czrqbz
  731.     End If
  732. End Sub
  733. Private Function Xtyxxpd() As Boolean                                                   '系统有效性判断
  734.     Xtyxxpd = False
  735.     If Len(Trim(ZtCombo.Text)) = 0 Then
  736.         Tsxx = "公司帐套不能为空,请先建帐套!"
  737.         Call Xtxxts(Tsxx, 0, 1)
  738.         ZtCombo.SetFocus
  739.         Exit Function
  740.     End If
  741.     lsblte = Trim(CzrqText.Text)
  742.     If IsDate(lsblte) Then
  743.         CzrqText.Text = Format(lsblte, "yyyy-mm-dd")
  744.     Else
  745.         Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
  746.         Call Xtxxts(Tsxx, 0, 1)
  747.         Xtyxxpd = False
  748.         CzrqText.SetFocus
  749.         Exit Function
  750.     End If
  751.     If Val(KjyearCombo.Text) <> Val(Mid(CzrqText.Text, 1, 4)) Then
  752.         Tsxx = "所选操作日期与会计年度不一致!"
  753.         Call Xtxxts(Tsxx, 0, 1)
  754.         Xtyxxpd = False
  755.         CzrqText.SetFocus
  756.         Exit Function
  757.     End If
  758.     
  759.     If Trim(CzyCombo.Text) = "" Then
  760.         Tsxx = "用户名不能为空!"
  761.         Call Xtxxts(Tsxx, 0, 1)
  762.         Xtyxxpd = False
  763.         CzyCombo.SetFocus
  764.         Exit Function
  765.     End If
  766.     
  767.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl where czybm='" + Trim(Mid(CzyCombo.Text, 1, InStr(1, CzyCombo.Text, "-") - 1)) + "'")
  768.     With Czyrec
  769.         If Not .EOF Then
  770.             If Trim(.Fields("czmm")) <> Mmjm(MmText.Text) Then
  771.                 Tsxx = "操作员密码录入错误!"
  772.                 Call Xtxxts(Tsxx, 0, 1)
  773.                 Xtyxxpd = False
  774.                 MmText.SetFocus
  775.                 Exit Function
  776.             End If
  777.         Else
  778.             Tsxx = "无此操作员!"
  779.             Call Xtxxts(Tsxx, 0, 1)
  780.             Xtyxxpd = False
  781.             CzyCombo.SetFocus
  782.             Exit Function
  783.         End If
  784.    End With
  785.    Xtyxxpd = True
  786. End Function
  787. Private Function Ljyxxpd1() As Boolean                  '数据服务器(帐套当前数据库)连接有效性测试
  788.     Ljyxxpd1 = False
  789.     Xtsjljc = "Provider=SQLOLEDB.1;"
  790.     
  791.     Xtsjljc = Xtsjljc + "Persist Security Info=False;"
  792.     
  793.     Xtsjljc = Xtsjljc + "Data Source=" + Trim(ServerText.Text) + ";"
  794.     
  795.     Xtsjljc = Xtsjljc + " Initial Catalog=" + Ztdqsjk + ";"
  796.     
  797.     On Error GoTo Cwcl
  798.     If Cslj.State = 1 Then Cslj.Close
  799.     Cslj.Open Xtsjljc, "Hxxd", ErpPassWord
  800.     
  801.     Ljyxxpd1 = True
  802.     Exit Function
  803.     
  804. Cwcl:
  805.     Tsxx = "帐套数据库连接失败!"
  806.     Call Xtxxts(Tsxx, 0, 1)
  807.     Exit Function
  808. End Function
  809. Private Sub XgmaCommand_Click()                '修改密码
  810.     If Trim(CzyCombo.Text) = "" Then Exit Sub
  811.     
  812.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl where czybm='" + Trim(CzyCombo.Text) + "' or czymc='" & Trim(CzyCombo.Text) & "' or rtrim(czybm)+'-'+rtrim(czymc)='" & Trim(CzyCombo.Text) & "'")
  813.     With Czyrec
  814.         If Not .EOF Then
  815.         CzyCombo.Text = Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  816.         Else
  817.             Tsxx = "无此用户名!"
  818.             Call Xtxxts(Tsxx, 0, 1)
  819.             Exit Sub
  820.         End If
  821.     End With
  822.     Czyrec.Close
  823.     Set Czyrec = Nothing
  824.     
  825.     
  826.     With StTab
  827.         .TabEnabled(0) = False
  828.         Frame1(0).Enabled = False
  829.         .TabEnabled(2) = True
  830.         Frame1(2).Enabled = True
  831.         .Tab = 2
  832.     End With
  833.     LrText(0).Text = Trim(MmText.Text)
  834.     LrText(1).Text = ""
  835.     LrText(2).Text = ""
  836.     LrText(0).SetFocus
  837. End Sub
  838. Private Sub MmqdCommand_Click()                '修改密码完毕确定
  839.     With Czyrec
  840.         If .State = 1 Then .Close
  841.         .Open "SELECT * FROM gy_czygl WHERE czybm= '" + Trim(Mid(CzyCombo.Text, 1, InStr(1, CzyCombo.Text, "-") - 1)) + "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  842.         If .EOF Then
  843.             Tsxx = "此操作员已删除!"
  844.             Call Xtxxts(Tsxx, 0, 1)
  845.             Exit Sub
  846.         End If
  847.         If Trim(.Fields("czmm")) <> Mmjm(Trim(LrText(0).Text)) Then
  848.             Tsxx = "输入旧密码错误!"
  849.             Call Xtxxts(Tsxx, 0, 1)
  850.             LrText(0).SetFocus
  851.             Exit Sub
  852.         End If
  853.         If Len(Trim(LrText(1).Text)) = 0 Then
  854.             Tsxx = "操作员密码不能为空!"
  855.             Call Xtxxts(Tsxx, 0, 1)
  856.             LrText(1).SetFocus
  857.             Exit Sub
  858.         End If
  859.         If Trim(LrText(0).Text) = Trim(LrText(1).Text) Then
  860.             Tsxx = "密码没有发生改变!"
  861.             Call Xtxxts(Tsxx, 0, 1)
  862.             LrText(1).SetFocus
  863.             Exit Sub
  864.         End If
  865.         If Trim(LrText(1).Text) <> Trim(LrText(2).Text) Then
  866.             Tsxx = "输入密码与确认密码不一致!"
  867.             Call Xtxxts(Tsxx, 0, 1)
  868.             LrText(1).SetFocus
  869.             Exit Sub
  870.         End If
  871.         .Fields("czmm") = Mmjm(Trim(LrText(1).Text))
  872.         .Fields("xgrq") = Date
  873.         .Update
  874.         MmText.Text = Trim(LrText(1).Text)
  875.         Tsxx = "用户密码修改完毕!"
  876.         Call Xtxxts(Tsxx, 0, 4)
  877.     End With
  878.     With StTab
  879.         .TabEnabled(0) = True
  880.         Frame1(0).Enabled = True
  881.         .TabEnabled(2) = False
  882.         Frame1(2).Enabled = False
  883.         .Tab = 0
  884.     End With
  885. End Sub
  886. Private Sub MmqxCommand_Click()                          '修改密码取消
  887.     With StTab
  888.         .TabEnabled(0) = True
  889.         Frame1(0).Enabled = True
  890.         .TabEnabled(2) = False
  891.         Frame1(2).Enabled = False
  892.         .Tab = 0
  893.     End With
  894. End Sub