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