资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:16k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{D76D7128-4A96-11D3-BD95-D296DC2DD072}#1.0#0"; "VSOCX7.OCX"
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
- Begin VB.Form Rep_SelectItem_Frm
- BackColor = &H80000004&
- BorderStyle = 3 'Fixed Dialog
- Caption = "报表项目选择"
- ClientHeight = 5910
- ClientLeft = 3150
- ClientTop = 855
- ClientWidth = 6795
- HelpContextID = 2212014
- Icon = "报表_报表项目选择.frx":0000
- KeyPreview = -1 'True
- LinkTopic = "Form5"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- MousePointer = 4 'Icon
- ScaleHeight = 5910
- ScaleWidth = 6795
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 '屏幕中心
- Begin VSFlex8Ctl.VSFlexGrid vsFG_Choose
- Height = 4665
- Left = 3750
- TabIndex = 3
- Top = 780
- Width = 2970
- _ExtentX = 5239
- _ExtentY = 8229
- Appearance = 1
- BorderStyle = 1
- Enabled = -1 'True
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- MousePointer = 0
- BackColor = -2147483643
- ForeColor = -2147483640
- BackColorFixed = -2147483633
- ForeColorFixed = -2147483630
- BackColorSel = -2147483635
- ForeColorSel = -2147483634
- BackColorBkg = -2147483636
- BackColorAlternate= -2147483643
- GridColor = -2147483633
- GridColorFixed = -2147483632
- TreeColor = -2147483632
- FloodColor = 192
- SheetBorder = -2147483642
- FocusRect = 1
- HighLight = 1
- AllowSelection = -1 'True
- AllowBigSelection= -1 'True
- AllowUserResizing= 0
- SelectionMode = 1
- GridLines = 1
- GridLinesFixed = 2
- GridLineWidth = 1
- Rows = 0
- Cols = 10
- FixedRows = 0
- FixedCols = 0
- RowHeightMin = 0
- RowHeightMax = 0
- ColWidthMin = 0
- ColWidthMax = 0
- ExtendLastCol = 0 'False
- FormatString = ""
- ScrollTrack = 0 'False
- ScrollBars = 3
- ScrollTips = 0 'False
- MergeCells = 0
- MergeCompare = 0
- AutoResize = -1 'True
- AutoSizeMode = 0
- AutoSearch = 0
- MultiTotals = -1 'True
- SubtotalPosition= 1
- OutlineBar = 0
- OutlineCol = 0
- Ellipsis = 0
- ExplorerBar = 0
- PicturesOver = 0 'False
- FillStyle = 0
- RightToLeft = 0 'False
- PictureType = 0
- TabBehavior = 0
- OwnerDraw = 0
- Editable = 0 'False
- ShowComboButton = -1 'True
- WordWrap = 0 'False
- TextStyle = 0
- TextStyleFixed = 0
- OleDragMode = 0
- OleDropMode = 0
- DataMode = 0
- VirtualData = -1 'True
- End
- Begin VB.CommandButton Cmd_OK
- Caption = "保存(&S)"
- Height = 300
- Left = 4365
- TabIndex = 4
- Top = 5520
- Width = 1120
- End
- Begin MSComctlLib.TreeView TV_PreField
- Height = 4665
- Left = 75
- TabIndex = 1
- Top = 765
- Width = 2970
- _ExtentX = 5239
- _ExtentY = 8229
- _Version = 393217
- Style = 7
- Appearance = 1
- End
- Begin VB.CommandButton Cmd_Remove
- Caption = "<"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 300
- Left = 3135
- TabIndex = 7
- TabStop = 0 'False
- Top = 1335
- Width = 525
- End
- Begin VB.CommandButton Cmd_Choose
- Caption = ">"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 300
- Left = 3135
- TabIndex = 6
- TabStop = 0 'False
- Top = 930
- Width = 525
- End
- Begin VB.CommandButton Cmd_Cancel
- Cancel = -1 'True
- Caption = "取消(&C)"
- Height = 300
- Left = 5565
- TabIndex = 5
- Top = 5520
- Width = 1120
- End
- Begin MSComctlLib.ImageCombo ImgCmb_Sort
- Height = 315
- Left = 1020
- TabIndex = 10
- Top = 105
- Width = 2040
- _ExtentX = 3598
- _ExtentY = 556
- _Version = 393216
- ForeColor = -2147483640
- BackColor = -2147483643
- Locked = -1 'True
- End
- Begin MSComctlLib.ImageCombo ImgCmb_PmSort
- Height = 315
- Left = 4650
- TabIndex = 11
- Top = 75
- Width = 2055
- _ExtentX = 3625
- _ExtentY = 556
- _Version = 393216
- ForeColor = -2147483640
- BackColor = -2147483643
- Locked = -1 'True
- End
- Begin VB.Label Lab_Mark
- AutoSize = -1 'True
- Caption = "工资类别:"
- Height = 180
- Index = 0
- Left = 3735
- TabIndex = 9
- Top = 165
- Width = 810
- End
- Begin VB.Label Lab_Mark
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "报表名称:"
- Height = 180
- Index = 5
- Left = 105
- TabIndex = 8
- Top = 165
- Width = 810
- End
- Begin VB.Label Lab_Note
- AutoSize = -1 'True
- Caption = "待选项目(&S)"
- Height = 180
- Index = 0
- Left = 105
- TabIndex = 0
- Top = 495
- Width = 990
- End
- Begin VB.Label Lab_Note
- AutoSize = -1 'True
- Caption = "查询项目(&X)"
- Height = 180
- Index = 1
- Left = 3735
- TabIndex = 2
- Top = 525
- Width = 990
- End
- End
- Attribute VB_Name = "Rep_SelectItem_Frm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '******************************************************************
- '* 模 块 名 称 :报表项目选择
- '* 功 能 描 述 :
- '* 程序员姓名 :苗鹏
- '* 最后修改人 :苗鹏
- '* 最后修改时间:2002/01/01
- '* 备 注:
- '******************************************************************
- Dim Str_RightEdit As String '编辑(新增、修改、删除)权限索引
- Private Sub Cmd_Cancel_Click()
- Unload Me
- End Sub
- Private Sub Cmd_Choose_Click()
- Call TV_PreField_DblClick
- End Sub
- Private Sub Cmd_Ok_Click() '保存数据
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
- Exit Sub
- End If
- On Error GoTo ErrCtrl
- Dim sRCode As String
- Dim sPmSort As String
- Dim s As String
- Dim rs As New ADODB.Recordset
- Dim i As Integer
- Dim sTable As String
- Dim sField As String
- Dim bBeginTrans As Boolean
- '判断有效性
- sRCode = GetComboKey(Me.ImgCmb_Sort, 0)
- With Me.ImgCmb_PmSort
- If Not .SelectedItem Is Nothing Then
- sPmSort = .SelectedItem.Tag
- End If
- End With
- If Trim(sRCode) = "" Or Trim(sPmSort) = "" Then
- MsgBox "报表编码和工资类别不能为空!", vbOKOnly + vbCritical
- Exit Sub
- End If
- s = " delete FROM PM_ReportItem where RCode='" & sRCode & "' AND PmSort='" & sPmSort & "'"
- With Me.vsFG_Choose
- For i = .FixedRows To .Rows - 1
- If GetTableField(Trim(.TextMatrix(i, 2)), sTable, sField, ".") <> 1 Then
- MsgBox "出现未知错误,程序返回原始状态!", vbOKOnly + vbCritical
- Exit Sub
- End If
- s = s & " INSERT INTO PM_ReportItem VALUES('" & sRCode & "','" & sPmSort & "','" & sField & "','" & sTable & "'," & i - .FixedRows & ",1000,1) " & Chr(10)
- Next i
- End With
- '保存
- Cw_DataEnvi.DataConnect.BeginTrans
- bBeginTrans = True
- Cw_DataEnvi.DataConnect.Execute (s)
- Cw_DataEnvi.DataConnect.CommitTrans
- MsgBox "保存完毕!", vbOKOnly + vbInformation
- Exit Sub
- ErrCtrl:
- If bBeginTrans = True Then
- Cw_DataEnvi.DataConnect.RollbackTrans
- End If
- MsgBox "出现未知错误,程序返回原始状态!", vbOKOnly + vbCritical
- End Sub
- Private Sub Cmd_Remove_Click()
- Call vsFG_Choose_DblClick
- End Sub
- Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) '快捷方式
- If Shift = 4 Then '按住Alt
- Select Case KeyCode
- Case 190 '>
- Call Cmd_Choose_Click
- Case 188 '<
- Call Cmd_Remove_Click
- End Select
- End If
- End Sub
- Private Sub Form_Load()
- On Error GoTo ErrCtrl
- '添加工资类别
- Dim s As String
- Dim rs As New ADODB.Recordset
- Dim itm As ComboItem
- s = "SELECT b.SortID,b.SortName FROM PM_OpeSort a inner join PM_Sort b on a.SortID=b.SortID where a.Czybm='" & Xtczybm & "'"
- Set rs = Cw_DataEnvi.DataConnect.Execute(s)
- With rs
- Do While Not .EOF()
- Set itm = Me.ImgCmb_PmSort.ComboItems.Add(, "@" & Trim(!SortId), Trim(!SortName))
- itm.Tag = !SortId
- .MoveNext
- Loop
- .Close
- End With
- If Me.ImgCmb_PmSort.ComboItems.Count <> 0 Then
- Me.ImgCmb_PmSort.ComboItems.Item(1).Selected = True
- End If
- Set rs = Nothing
- Set itm = Nothing
- FillImageCombo Me.ImgCmb_Sort, "Pm_ReportSort", 1
- InitView Me.TV_PreField '初始化树并填充数据
- InitGrid Me.vsFG_Choose '初始化网格结构
- FillGrid '填充网格数据
- '编辑(新增、修改、删除)权限索引
- Str_RightEdit = "Pm_ReportItem_edit"
- Exit Sub
- ErrCtrl:
- If rs.State = 1 Then
- rs.Close
- End If
- Set rs = Nothing
- Set itm = Nothing
- End Sub
- Private Function FillGrid() '填充已经选入的字段到网格同时删除树的对应节点
- On Error GoTo ErrCtrl
- Dim rs As New ADODB.Recordset
- Dim s As String
- Dim sRCode As String
- Dim sPmSort As String
- Me.vsFG_Choose.Redraw = False
- Me.vsFG_Choose.Rows = Me.vsFG_Choose.FixedRows
- '取得报表编码和工资类别
- sRCode = GetComboKey(Me.ImgCmb_Sort, 0)
- sPmSort = Me.ImgCmb_PmSort.SelectedItem.Tag
- '调用 ChooseItem 函数
- s = "SELECT FieldName ,TableName FROM PM_ReportItem where RCode='" & sRCode & "' AND PmSort='" & sPmSort & "' Order by FieldOrder"
- Set rs = Cw_DataEnvi.DataConnect.Execute(s)
- With rs
- Do While Not .EOF()
- Me.TV_PreField.SelectedItem = Me.TV_PreField.Nodes(UCase(Trim(!TableName) & "." & Trim(!FieldName)))
- ChooseItem Me.TV_PreField, Me.vsFG_Choose
- .MoveNext
- Loop
- End With
- Me.vsFG_Choose.Redraw = True
- Exit Function
- ErrCtrl:
- If rs.State = 1 Then
- rs.Close
- End If
- Set rs = Nothing
- Me.vsFG_Choose.Redraw = True
- End Function
- Private Sub ImgCmb_PmSort_Click()
- Call ImgCmb_Sort_Click
- End Sub
- Private Sub ImgCmb_Sort_Click()
- On Error Resume Next
- InitView Me.TV_PreField
- FillGrid
- End Sub
- Private Sub TV_PreField_BeforeLabelEdit(Cancel As Integer)
- Cancel = True
- End Sub
- Private Function ChooseItem(tv As TreeView, vs As vsFlexGrid) '选择字段
- On Error GoTo ErrCtrl
- Dim nod As Node
- Dim i As Integer
- Dim Item As ComboItem
- Set nod = tv.SelectedItem
- If Not nod.Parent Is Nothing Then
- '添加网格
- i = nod.Parent.Index
- With vs
- .AddItem ""
- .TextMatrix(.Rows - 1, 0) = nod.Parent.Key
- .TextMatrix(.Rows - 1, 1) = nod.Parent.Text
- .TextMatrix(.Rows - 1, 2) = nod.Key
- .TextMatrix(.Rows - 1, 3) = nod.Text
- .TextMatrix(.Rows - 1, 4) = nod.Tag
- .TextMatrix(.Rows - 1, 5) = nod.Parent.Text & "." & nod.Text
- End With
- '删除节点
- If nod.Parent.Children = 1 Then
- tv.Nodes.Remove nod.Index
- tv.Nodes.Remove i
- Else
- tv.Nodes.Remove nod.Index
- End If
- End If
- Set nod = Nothing
- Exit Function
- ErrCtrl:
- Dim smsg As String
- Dim smsgSys As String
- smsg = GetError(Err.Number)
- smsgSys = Err.Number & Err.Description & "!"
- MsgBox IIf(smsg = "", smsgSys, smsg), vbOKOnly + vbCritical
- End Function
- Private Function RemoveItem(vs As vsFlexGrid, tv As TreeView) '删除字段
- On Error GoTo ErrCtrl
- Dim nod As Node
- '增加树节点
- With Me.TV_PreField
- If Not IsNodeExist(Trim(vs.TextMatrix(vs.Row, 0)), Me.TV_PreField) Then
- Set nod = tv.Nodes.Add("R", tvwChild, Trim(vs.TextMatrix(vs.Row, 0)), Trim(vs.TextMatrix(vs.Row, 1)))
- Set nod = tv.Nodes.Add(Trim(vs.TextMatrix(vs.Row, 0)), tvwChild, Trim(vs.TextMatrix(vs.Row, 2)), Trim(vs.TextMatrix(vs.Row, 3)))
- nod.Tag = Trim(vs.TextMatrix(vs.Row, 4))
- Else
- Set nod = tv.Nodes.Add(Trim(vs.TextMatrix(vs.Row, 0)), tvwChild, Trim(vs.TextMatrix(vs.Row, 2)), Trim(vs.TextMatrix(vs.Row, 3)))
- nod.Tag = Trim(vs.TextMatrix(vs.Row, 4))
- End If
- '删除当前行
- vs.RemoveItem (vs.Row)
- End With
- Exit Function
- ErrCtrl:
- Dim smsg As String
- Dim smsgSys As String
- smsg = GetError(Err.Number)
- smsgSys = Err.Number & Err.Description & "!"
- MsgBox IIf(smsg = "", smsgSys, smsg), vbOKOnly + vbCritical
- End Function
- Private Function InitGrid(vs As vsFlexGrid) '初始化网格
- '第1列:表的物理名
- '第2列:表的用户名
- '第3列:字段的物理名
- '第4列:字段的帮助信息
- '第5列:字段的用户名
- On Error GoTo ErrCtrl
- Dim i As Integer
- With vs
- .Cols = 6
- For i = 0 To .Cols - 2
- .ColHidden(i) = True
- Next i
- .ColWidth(.Cols - 1) = .Width - 100
- End With
- Exit Function
- ErrCtrl:
- Dim smsg As String
- Dim smsgSys As String
- smsg = GetError(Err.Number)
- smsgSys = Err.Number & Err.Description & "!"
- MsgBox IIf(smsg = "", smsgSys, smsg), vbOKOnly + vbCritical
- End Function
- Private Sub TV_PreField_DblClick()
- If Me.TV_PreField.SelectedItem Is Nothing Then
- Exit Sub
- End If
- If Me.TV_PreField.SelectedItem.Children = 0 Then
- ChooseItem Me.TV_PreField, Me.vsFG_Choose
- End If
- End Sub
- Private Sub TV_PreField_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then
- Call TV_PreField_DblClick
- End If
- End Sub
- Private Sub vsFG_Choose_DblClick()
- If Me.vsFG_Choose.Rows > 0 Then
- RemoveItem Me.vsFG_Choose, Me.TV_PreField
- End If
- End Sub
- Private Sub vsFG_Choose_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then
- Call vsFG_Choose_DblClick
- End If
- End Sub