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

企业管理

开发平台:

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      =   795
  9.    ClientTop       =   2925
  10.    ClientWidth     =   4770
  11.    ControlBox      =   0   'False
  12.    HelpContextID   =   3311001
  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.    Begin VB.CheckBox QdCheck 
  21.       Caption         =   "是否修改"
  22.       Height          =   825
  23.       Left            =   4980
  24.       TabIndex        =   7
  25.       Top             =   1260
  26.       Value           =   1  'Checked
  27.       Width           =   705
  28.    End
  29.    Begin VB.CheckBox CtdrCheck 
  30.       Caption         =   "非第一次调入窗体"
  31.       Height          =   735
  32.       Left            =   4980
  33.       TabIndex        =   0
  34.       Top             =   390
  35.       Width           =   705
  36.    End
  37.    Begin TabDlg.SSTab StTab 
  38.       Height          =   4065
  39.       Left            =   60
  40.       TabIndex        =   8
  41.       Top             =   30
  42.       Width           =   4665
  43.       _ExtentX        =   8229
  44.       _ExtentY        =   7170
  45.       _Version        =   393216
  46.       Style           =   1
  47.       TabHeight       =   520
  48.       TabCaption(0)   =   "帐套选择及身份验证"
  49.       TabPicture(0)   =   "系统_登录窗体.frx":08CA
  50.       Tab(0).ControlEnabled=   -1  'True
  51.       Tab(0).Control(0)=   "Frame1(0)"
  52.       Tab(0).Control(0).Enabled=   0   'False
  53.       Tab(0).ControlCount=   1
  54.       TabCaption(1)   =   "数据服务器连接设置"
  55.       TabPicture(1)   =   "系统_登录窗体.frx":08E6
  56.       Tab(1).ControlEnabled=   0   'False
  57.       Tab(1).Control(0)=   "Frame1(1)"
  58.       Tab(1).ControlCount=   1
  59.       TabCaption(2)   =   "更改密码"
  60.       TabPicture(2)   =   "系统_登录窗体.frx":0902
  61.       Tab(2).ControlEnabled=   0   'False
  62.       Tab(2).Control(0)=   "Frame1(2)"
  63.       Tab(2).ControlCount=   1
  64.       Begin VB.Frame Frame1 
  65.          Height          =   3555
  66.          Index           =   0
  67.          Left            =   90
  68.          TabIndex        =   25
  69.          Top             =   390
  70.          Width           =   4455
  71.          Begin VB.CommandButton QxCommand 
  72.             Caption         =   "取消(&C)"
  73.             Height          =   300
  74.             Left            =   3060
  75.             TabIndex        =   29
  76.             Top             =   3150
  77.             Width           =   1275
  78.          End
  79.          Begin VB.CommandButton QdCommand 
  80.             Caption         =   "确定(&O)"
  81.             Height          =   300
  82.             Left            =   1725
  83.             TabIndex        =   6
  84.             Top             =   3150
  85.             Width           =   1275
  86.          End
  87.          Begin VB.ComboBox ZtCombo 
  88.             Height          =   300
  89.             Left            =   1050
  90.             Style           =   2  'Dropdown List
  91.             TabIndex        =   1
  92.             Top             =   330
  93.             Width           =   3225
  94.          End
  95.          Begin VB.ComboBox KjyearCombo 
  96.             Height          =   300
  97.             Left            =   1050
  98.             Style           =   2  'Dropdown List
  99.             TabIndex        =   2
  100.             Top             =   720
  101.             Width           =   3225
  102.          End
  103.          Begin VB.TextBox CzrqText 
  104.             Height          =   300
  105.             Left            =   1050
  106.             MaxLength       =   10
  107.             TabIndex        =   3
  108.             Top             =   1170
  109.             Width           =   2895
  110.          End
  111.          Begin VB.CommandButton Rlcommand 
  112.             CausesValidation=   0   'False
  113.             Height          =   302
  114.             Left            =   3960
  115.             Picture         =   "系统_登录窗体.frx":091E
  116.             Style           =   1  'Graphical
  117.             TabIndex        =   28
  118.             Top             =   1140
  119.             Width           =   315
  120.          End
  121.          Begin VB.ComboBox CzyCombo 
  122.             Height          =   300
  123.             Left            =   1050
  124.             TabIndex        =   4
  125.             Text            =   "CzyCombo"
  126.             Top             =   1560
  127.             Width           =   3225
  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            =   1725
  148.             TabIndex        =   27
  149.             Top             =   2790
  150.             Width           =   1275
  151.          End
  152.          Begin VB.CommandButton GgszCommand 
  153.             Caption         =   "更改设置(&A)"
  154.             Height          =   300
  155.             Left            =   3060
  156.             TabIndex        =   26
  157.             Top             =   2790
  158.             Width           =   1275
  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":0CA8
  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        =   18
  237.          Top             =   330
  238.          Width           =   4455
  239.          Begin VB.TextBox ServerText 
  240.             Height          =   300
  241.             Left            =   1800
  242.             TabIndex        =   21
  243.             Top             =   660
  244.             Width           =   1905
  245.          End
  246.          Begin VB.CommandButton LjqdCommand 
  247.             Caption         =   "确 定"
  248.             Height          =   300
  249.             Left            =   1410
  250.             TabIndex        =   20
  251.             Top             =   1440
  252.             Width           =   1120
  253.          End
  254.          Begin VB.CommandButton LjqxCommand 
  255.             Caption         =   "取 消"
  256.             Height          =   300
  257.             Left            =   2580
  258.             TabIndex        =   19
  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        =   9
  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        =   14
  312.             Top             =   360
  313.             Width           =   2250
  314.          End
  315.          Begin VB.CommandButton MmqdCommand 
  316.             Caption         =   "确定(&O)"
  317.             Height          =   300
  318.             Left            =   1200
  319.             TabIndex        =   13
  320.             Top             =   2190
  321.             Width           =   1120
  322.          End
  323.          Begin VB.CommandButton MmqxCommand 
  324.             Caption         =   "取消(&C)"
  325.             Height          =   300
  326.             Left            =   2370
  327.             TabIndex        =   12
  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        =   11
  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        =   10
  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        =   17
  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        =   16
  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        =   15
  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.     
  479.     Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
  480.     
  481.     App.HelpFile = App.Path + "基础数据系统.chm"
  482.     
  483.     XtMenuList = "12%"         '子系统菜单系统代号
  484.     
  485.     ErpPassWord = "123"
  486.     
  487.     Call Qcljnr     '读入连接内容
  488.     
  489.     With StTab
  490.         .TabEnabled(0) = False
  491.         Frame1(0).Enabled = False
  492.         .TabEnabled(1) = True
  493.         Frame1(1).Enabled = True
  494.         .TabEnabled(2) = False
  495.         Frame1(2).Enabled = False
  496.          StTab.Tab = 1
  497.     End With
  498.     
  499. End Sub
  500. Private Sub GgszCommand_Click()
  501.     With Me.StTab
  502.         .TabEnabled(0) = False
  503.         Frame1(0).Enabled = False
  504.         .TabEnabled(1) = True
  505.         Frame1(1).Enabled = True
  506.         .Tab = 1
  507.     End With
  508.     
  509.     ' 让数据服务器设置文本框得到焦点
  510.     ServerText.SetFocus
  511.     ServerText.SelStart = 0
  512.     ServerText.SelLength = Len(ServerText.Text)
  513. End Sub
  514. Private Sub LjqdCommand_Click()                              '保 存 设 置
  515.  
  516.     If Ljyxxpd Then
  517.         If Cw_DataEnvi.BaseInfoConnect.State = 1 Then Cw_DataEnvi.BaseInfoConnect.Close
  518.         Cw_DataEnvi.BaseInfoConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  519.         
  520.         Tsxx = "连接测试成功!"
  521.         Call Xtxxts(Tsxx, 0, 4)
  522.         
  523.         StTab.TabEnabled(1) = False
  524.         Frame1(1).Enabled = False
  525.         StTab.TabEnabled(0) = True
  526.         Frame1(0).Enabled = True
  527.         StTab.Tab = 0
  528.         Call Tcztxx
  529.         
  530.         If ZtCombo.ListCount > 0 Then
  531.             ZtCombo.ListIndex = 0
  532.         End If
  533.     End If
  534. End Sub
  535. Private Sub Qcljnr()                                         '取 出 数 据
  536.     On Error Resume Next
  537.     
  538.     ServerText.Text = ReadOneString("Option", "SqlServer", "localhost")
  539.     str_Account = ReadOneString("Option", "Account", "")
  540.             
  541.     Dim int_Count As Integer
  542.      
  543.     For int_Count = 0 To ZtCombo.ListCount - 1
  544.         If UCase(Mid(ZtCombo.List(int_Count), 1, InStr(ZtCombo.List(int_Count), "-") - 1)) = UCase(Mid(str_Account, 1, InStr(str_Account, "-") - 1)) Then
  545.             ZtCombo.ListIndex = int_Count
  546.         End If
  547.     Next int_Count
  548.     
  549. End Sub
  550. Private Sub QdCommand_Click()          '确定进入系统
  551.     If Trim(CzyCombo.Text) = "" Then Exit Sub
  552.     
  553.     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) & "'")
  554.     With Czyrec
  555.         If Not .EOF Then
  556.         CzyCombo.Text = Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  557.         Else
  558.             Tsxx = "无此用户名!"
  559.             Call Xtxxts(Tsxx, 0, 1)
  560.             Exit Sub
  561.         End If
  562.     End With
  563.     Czyrec.Close
  564.     Set Czyrec = Nothing
  565.     If Xtyxxpd Then
  566.         If Ljyxxpd1 Then
  567.             If Cw_DataEnvi.DataConnect.State = 1 Then Cw_DataEnvi.DataConnect.Close
  568.             Cw_DataEnvi.DataConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  569.         End If
  570.         QdCheck.Value = 1
  571.         Me.Hide
  572.         
  573.         Call WriteOneString("Option", "Sqlserver", Trim(ServerText.Text))
  574.         Call WriteOneString("Option", "Account", Trim(ZtCombo.Text))
  575.         
  576.         CtdrCheck.Value = 1
  577.         GgszCommand.Enabled = False
  578.         XT_Main.Show
  579.         
  580.         Xt_Control.tvTreeView.Visible = False
  581.         Xt_Control.tvTreeView.Nodes.Clear
  582.         Xt_Control.Cshgns
  583.         Xt_Control.tvTreeView.Refresh
  584.         Xt_Control.tvTreeView.Visible = True
  585.     End If
  586. End Sub
  587. Private Sub QxCommand_Click()                                     '取消进入系统
  588.     If CtdrCheck.Value <> 1 Then
  589.         Unload Me
  590.     Else
  591.         Me.Hide
  592.     End If
  593. End Sub
  594. Private Sub Rlcommand_Click()                                     '操作日期帮助
  595.     Call Czrqbz
  596. End Sub
  597. Private Sub Timer1_Timer()                                        '激活连接测试
  598.     Timer1.Enabled = False
  599.     
  600.     If Ljyxxpd Then
  601.         If Cw_DataEnvi.BaseInfoConnect.State = 1 Then Cw_DataEnvi.BaseInfoConnect.Close
  602.         Cw_DataEnvi.BaseInfoConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  603.     Else
  604.         Exit Sub
  605.     End If
  606.     
  607.     With StTab
  608.         .TabEnabled(1) = False
  609.         Frame1(1).Enabled = False
  610.         .TabEnabled(0) = True
  611.         Frame1(0).Enabled = True
  612.     End With
  613.     
  614.     StTab.Tab = 0
  615.       
  616.     Call Tcztxx
  617.     Qcljnr
  618.     
  619.     '让用户名录入框得到焦点
  620.     CzyCombo.SetFocus
  621. End Sub
  622. Private Sub LjqxCommand_Click()                                   '连接失败退出
  623.     If CtdrCheck.Value <> 1 Then
  624.         Unload Me
  625.     Else
  626.         Me.Hide
  627.     End If
  628. End Sub
  629. Private Sub Tcztxx()                                              '填充帐套信息选择
  630.     Dim Xtztxxrec As New ADODB.Recordset        '系统帐套信息动态集
  631.     Set Xtztxxrec = Cw_DataEnvi.BaseInfoConnect.Execute("Select * From HDSystem_Databases order by number")
  632.     ZtCombo.Clear
  633.     With Xtztxxrec
  634.         Do While Not .EOF
  635.             If .Fields("YNuse") = "1" Then
  636.                 ZtCombo.AddItem .Fields("number") + "-" + Trim(.Fields("CountingRoomName"))
  637.             End If
  638.             .MoveNext
  639.         Loop
  640.     End With
  641. End Sub
  642. Private Sub ZtCombo_Click()
  643.     Dim Xtztxxrec As New ADODB.Recordset        '系统帐套信息动态集
  644.     Dim RecTemp As New ADODB.Recordset
  645.     Dim Xt_Id As Integer                         '该模块系统的ID号
  646.     
  647.     On Error GoTo ErrHandle
  648.     Set Xtztxxrec = Cw_DataEnvi.BaseInfoConnect.Execute("Select * From HDSystem_DataBases where Number='" + Trim(Mid(ZtCombo.Text, 1, InStr(1, ZtCombo.Text, "-") - 1)) + "'")
  649.     With Xtztxxrec
  650.         If Not .EOF Then
  651.             Ztdqsjk = Trim(.Fields("DataBasesName"))
  652.         End If
  653.     End With
  654.     If Ljyxxpd1 Then
  655.         If Cw_DataEnvi.DataConnect.State = 1 Then Cw_DataEnvi.DataConnect.Close
  656.         Cw_DataEnvi.DataConnect.Open Xtsjljc, "Hxxd", ErpPassWord
  657.     Else
  658.         Exit Sub
  659.     End If
  660.    
  661.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select ID From Xt_Xtgnb  Where gnbm='01'")
  662.     If RecTemp.EOF = False Then
  663.         Xt_Id = RecTemp.Fields("ID")
  664.         Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl Where  right(left(AuthorityId," & Xt_Id & "),1)='1' order by czybm")
  665.         XgmaCommand.Enabled = True
  666.         QdCommand.Enabled = True
  667.         CzyCombo.Enabled = True
  668.     Else
  669.         XgmaCommand.Enabled = False
  670.         QdCommand.Enabled = False
  671.         CzyCombo.Text = ""
  672.         CzyCombo.Enabled = False
  673.         Tsxx = "请将该系统的操作权限赋予操作员!"
  674.         Call Xtxxts(Tsxx, 0, 4)
  675.         Exit Sub
  676.     End If
  677.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl order by czybm")
  678.     CzyCombo.Clear
  679.     With Czyrec
  680.         Do While Not .EOF
  681.             CzyCombo.AddItem Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  682.             .MoveNext
  683.         Loop
  684.         CzyCombo.Text = CzyCombo.List(0)
  685.     End With
  686.     Set Xtrlrec = Cw_DataEnvi.DataConnect.Execute("Select distinct kjyear From gy_kjrlb order by kjyear ")
  687.     KjyearCombo.Clear
  688.     With Xtrlrec
  689.         Do While Not .EOF
  690.            KjyearCombo.AddItem Trim(.Fields("kjyear"))
  691.            .MoveNext
  692.         Loop
  693.     End With
  694.     
  695.     Set Xtrlrec = Cw_DataEnvi.DataConnect.Execute("Select top 1 kjyear From gy_kjrlb where cwzzjzbz=0 order by kjyear DESC,period DESC")
  696.     If Not Xtrlrec.EOF Then
  697.         KjyearCombo.Text = Xtrlrec.Fields("Kjyear")
  698.     End If
  699.    
  700.     Call Drxtztcs             '读入系统帐套参数
  701.   
  702.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select ServerDate=getdate()")
  703.     CzrqText = Format(RecTemp.Fields("ServerDate"), "yyyy-mm-dd")
  704.    
  705. ErrHandle:
  706.    
  707. End Sub
  708. Private Sub Czrqbz()                                                  '操作日期帮助
  709.     Xtcdcs = Trim(CzrqText.Text)
  710.     Xtfhcs = ""
  711.     XT_calendar.Show 1
  712.     If Xtfhcs <> "" Then
  713.         CzrqText.Text = Trim(Xtfhcs)
  714.     End If
  715.     CzrqText.SetFocus
  716. End Sub
  717. Private Sub CzrqText_KeyDown(KeyCode As Integer, Shift As Integer)    '操作日期帮助
  718.     If KeyCode = vbKeyF2 Then
  719.         Call Czrqbz
  720.     End If
  721. End Sub
  722. Private Function Xtyxxpd() As Boolean                                                   '系统有效性判断
  723.     Xtyxxpd = False
  724.     If Len(Trim(ZtCombo.Text)) = 0 Then
  725.         Tsxx = "公司帐套不能为空,请先建帐套!"
  726.         Call Xtxxts(Tsxx, 0, 1)
  727.         ZtCombo.SetFocus
  728.         Exit Function
  729.     End If
  730.     lsblte = Trim(CzrqText.Text)
  731.     If IsDate(lsblte) Then
  732.         CzrqText.Text = Format(lsblte, "yyyy-mm-dd")
  733.     Else
  734.         Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
  735.         Call Xtxxts(Tsxx, 0, 1)
  736.         Xtyxxpd = False
  737.         CzrqText.SetFocus
  738.         Exit Function
  739.     End If
  740.     If Val(KjyearCombo.Text) <> Val(Mid(CzrqText.Text, 1, 4)) Then
  741.         Tsxx = "所选操作日期与会计年度不一致!"
  742.         Call Xtxxts(Tsxx, 0, 1)
  743.         Xtyxxpd = False
  744.         CzrqText.SetFocus
  745.         Exit Function
  746.     End If
  747.     
  748.     If Trim(CzyCombo.Text) = "" Then
  749.         Tsxx = "用户名不能为空!"
  750.         Call Xtxxts(Tsxx, 0, 1)
  751.         Xtyxxpd = False
  752.         CzyCombo.SetFocus
  753.         Exit Function
  754.     End If
  755.     
  756.     Set Czyrec = Cw_DataEnvi.DataConnect.Execute("Select * From gy_czygl where czybm='" + Trim(Mid(CzyCombo.Text, 1, InStr(1, CzyCombo.Text, "-") - 1)) + "'")
  757.     With Czyrec
  758.         If Not .EOF Then
  759.             If Trim(.Fields("czmm")) <> Mmjm(MmText.Text) Then
  760.                 Tsxx = "操作员密码录入错误!"
  761.                 Call Xtxxts(Tsxx, 0, 1)
  762.                 Xtyxxpd = False
  763.                 MmText.SetFocus
  764.                 Exit Function
  765.             End If
  766.         Else
  767.             Tsxx = "无此操作员!"
  768.             Call Xtxxts(Tsxx, 0, 1)
  769.             Xtyxxpd = False
  770.             CzyCombo.SetFocus
  771.             Exit Function
  772.         End If
  773.    End With
  774.    Xtyxxpd = True
  775. End Function
  776. Private Function Ljyxxpd1() As Boolean                  '数据服务器(帐套当前数据库)连接有效性测试
  777.     Ljyxxpd1 = False
  778.     Xtsjljc = "Provider=SQLOLEDB.1;"
  779.     
  780.     Xtsjljc = Xtsjljc + "Persist Security Info=False;"
  781.     
  782.     Xtsjljc = Xtsjljc + "Data Source=" + Trim(ServerText.Text) + ";"
  783.     
  784.     Xtsjljc = Xtsjljc + " Initial Catalog=" + Ztdqsjk + ";"
  785.     
  786.     On Error GoTo Cwcl
  787.     If Cslj.State = 1 Then Cslj.Close
  788.     Cslj.Open Xtsjljc, "Hxxd", ErpPassWord
  789.     
  790.     Ljyxxpd1 = True
  791.     Exit Function
  792.     
  793. Cwcl:
  794.     Tsxx = "帐套数据库连接失败!"
  795.     Call Xtxxts(Tsxx, 0, 1)
  796.     Exit Function
  797. End Function
  798. Private Sub XgmaCommand_Click()                '修改密码
  799.     If Trim(CzyCombo.Text) = "" Then Exit Sub
  800.     
  801.     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) & "'")
  802.     With Czyrec
  803.         If Not .EOF Then
  804.         CzyCombo.Text = Trim(.Fields("czybm")) + "-" + Trim(.Fields("czymc"))
  805.         Else
  806.             Tsxx = "无此用户名!"
  807.             Call Xtxxts(Tsxx, 0, 1)
  808.             Exit Sub
  809.         End If
  810.     End With
  811.     Czyrec.Close
  812.     Set Czyrec = Nothing
  813.     
  814.     
  815.     With StTab
  816.         .TabEnabled(0) = False
  817.         Frame1(0).Enabled = False
  818.         .TabEnabled(2) = True
  819.         Frame1(2).Enabled = True
  820.         .Tab = 2
  821.     End With
  822.     LrText(0).Text = Trim(MmText.Text)
  823.     LrText(1).Text = ""
  824.     LrText(2).Text = ""
  825.     LrText(0).SetFocus
  826. End Sub
  827. Private Sub MmqdCommand_Click()                '修改密码完毕确定
  828.     With Czyrec
  829.         If .State = 1 Then .Close
  830.         .Open "SELECT * FROM gy_czygl WHERE czybm= '" + Trim(Mid(CzyCombo.Text, 1, InStr(1, CzyCombo.Text, "-") - 1)) + "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  831.         If .EOF Then
  832.             Tsxx = "此操作员已删除!"
  833.             Call Xtxxts(Tsxx, 0, 1)
  834.             Exit Sub
  835.         End If
  836.         If Trim(.Fields("czmm")) <> Mmjm(Trim(LrText(0).Text)) Then
  837.             Tsxx = "输入旧密码错误!"
  838.             Call Xtxxts(Tsxx, 0, 1)
  839.             LrText(0).SetFocus
  840.             Exit Sub
  841.         End If
  842.         If Len(Trim(LrText(1).Text)) = 0 Then
  843.             Tsxx = "操作员密码不能为空!"
  844.             Call Xtxxts(Tsxx, 0, 1)
  845.             LrText(1).SetFocus
  846.             Exit Sub
  847.         End If
  848.         If Trim(LrText(0).Text) = Trim(LrText(1).Text) Then
  849.             Tsxx = "密码没有发生改变!"
  850.             Call Xtxxts(Tsxx, 0, 1)
  851.             LrText(1).SetFocus
  852.             Exit Sub
  853.         End If
  854.         If Trim(LrText(1).Text) <> Trim(LrText(2).Text) Then
  855.             Tsxx = "输入密码与确认密码不一致!"
  856.             Call Xtxxts(Tsxx, 0, 1)
  857.             LrText(1).SetFocus
  858.             Exit Sub
  859.         End If
  860.         .Fields("czmm") = Mmjm(Trim(LrText(1).Text))
  861.         .Fields("xgrq") = Date
  862.         .Update
  863.         MmText.Text = Trim(LrText(1).Text)
  864.         Tsxx = "用户密码修改完毕!"
  865.         Call Xtxxts(Tsxx, 0, 4)
  866.     End With
  867.     With StTab
  868.         .TabEnabled(0) = True
  869.         Frame1(0).Enabled = True
  870.         .TabEnabled(2) = False
  871.         Frame1(2).Enabled = False
  872.         .Tab = 0
  873.     End With
  874. End Sub
  875. Private Sub MmqxCommand_Click()                          '修改密码取消
  876.     With StTab
  877.         .TabEnabled(0) = True
  878.         Frame1(0).Enabled = True
  879.         .TabEnabled(2) = False
  880.         Frame1(2).Enabled = False
  881.         .Tab = 0
  882.     End With
  883. End Sub