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