+
资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:34k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{BEEECC20-4D5F-4F8B-BFDC-5D9B6FBDE09D}#1.0#0"; "vsflex8.ocx"
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
- Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
- Begin VB.Form JC_FrmBalSetup
- BackColor = &H00C0C0C0&
- BorderStyle = 1 'Fixed Single
- Caption = "资产负债表设置"
- ClientHeight = 7125
- ClientLeft = 675
- ClientTop = 720
- ClientWidth = 9405
- Icon = "基础设置_资产负债表设置.frx":0000
- KeyPreview = -1 'True
- LinkTopic = "Form4"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 7125
- ScaleWidth = 9405
- StartUpPosition = 1 '所有者中心
- Begin MSComctlLib.Toolbar SzToolbar
- Align = 1 'Align Top
- Height = 555
- Left = 0
- TabIndex = 2
- Top = 0
- Width = 9405
- _ExtentX = 16589
- _ExtentY = 979
- ButtonWidth = 820
- ButtonHeight = 926
- AllowCustomize = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 12
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "设置"
- Key = "ymsz"
- ImageKey = "sz"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "打印"
- Key = "dy"
- ImageKey = "dy"
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "预览"
- Key = "yl"
- ImageKey = "yl"
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.Visible = 0 'False
- Caption = "增加"
- Key = "zj"
- ImageKey = "xz"
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "修改"
- Key = "xg"
- ImageKey = "xg"
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.Visible = 0 'False
- Caption = "删除"
- Key = "sc"
- ImageKey = "sc"
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.Visible = 0 'False
- Caption = "刷新"
- Key = "sx"
- ImageKey = "sx"
- EndProperty
- BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.Visible = 0 'False
- Style = 3
- EndProperty
- BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "帮助"
- Key = "bz"
- ImageKey = "bz"
- EndProperty
- BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- ImageKey = "tc"
- EndProperty
- EndProperty
- BorderStyle = 1
- Begin MSComctlLib.ImageList ImageList1
- Left = 5130
- Top = -15
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 29
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":1042
- Key = "sz"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":13DC
- Key = "dy"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":1776
- Key = "yl"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":1B10
- Key = "xg"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":1EAA
- Key = "zh"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":2244
- Key = "sh"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":25DE
- Key = "bc"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":2978
- Key = "fq"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":2D12
- Key = "bz"
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":30AC
- Key = "tc"
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":3446
- Key = "bcgs"
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":37E0
- Key = "mrlk"
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":3B7A
- Key = "xsxm"
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":3F14
- Key = "first"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":42AE
- Key = "prev"
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":4648
- Key = "next"
- EndProperty
- BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":49E2
- Key = "last"
- EndProperty
- BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":4D7C
- Key = "xx"
- EndProperty
- BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":5116
- Key = "define"
- EndProperty
- BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":54B0
- Key = "exec"
- EndProperty
- BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":584A
- Key = "xz"
- EndProperty
- BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":5BE4
- Key = "sc"
- EndProperty
- BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":5F7E
- Key = "sx"
- EndProperty
- BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":6318
- Key = "cx"
- EndProperty
- BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":66B2
- Key = "zd"
- EndProperty
- BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":6A4C
- Key = "dz"
- EndProperty
- BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":6DE6
- Key = "ph"
- EndProperty
- BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":7180
- Key = "fz"
- EndProperty
- BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "基础设置_资产负债表设置.frx":751A
- Key = "dw"
- EndProperty
- EndProperty
- End
- Begin MSComctlLib.Toolbar GsToolbar
- Height = 525
- Left = 7695
- TabIndex = 3
- Top = 0
- Width = 2475
- _ExtentX = 4366
- _ExtentY = 926
- ButtonWidth = 1455
- ButtonHeight = 926
- AllowCustomize = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 3
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "保存格式"
- Key = "bcgs"
- ImageKey = "bcgs"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "默认列宽"
- Key = "hfmrgs"
- ImageKey = "mrlk"
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "显示项目"
- Key = "szxsxm"
- ImageKey = "xsxm"
- EndProperty
- EndProperty
- End
- End
- Begin TabDlg.SSTab StTab
- Height = 6495
- Left = 15
- TabIndex = 4
- Top = 615
- Width = 9360
- _ExtentX = 16510
- _ExtentY = 11456
- _Version = 393216
- Style = 1
- Tabs = 2
- Tab = 1
- TabHeight = 520
- TabCaption(0) = "列表视图"
- TabPicture(0) = "基础设置_资产负债表设置.frx":78B4
- Tab(0).ControlEnabled= 0 'False
- Tab(0).Control(0)= "CzxsGrid"
- Tab(0).ControlCount= 1
- TabCaption(1) = "单张视图"
- TabPicture(1) = "基础设置_资产负债表设置.frx":78D0
- Tab(1).ControlEnabled= -1 'True
- Tab(1).Control(0)= "Frame1"
- Tab(1).Control(0).Enabled= 0 'False
- Tab(1).ControlCount= 1
- Begin VB.Frame Frame1
- Height = 6075
- Left = 75
- TabIndex = 5
- Top = 330
- Width = 9180
- Begin VB.Frame Frame2
- Height = 525
- Left = 540
- TabIndex = 12
- Top = 4110
- Width = 4935
- Begin VB.OptionButton OptUnAdd
- Caption = "减项"
- Height = 375
- Left = 3120
- TabIndex = 15
- Top = 120
- Width = 840
- End
- Begin VB.OptionButton OptAdd
- Caption = "加项"
- Height = 270
- Left = 2040
- TabIndex = 14
- Top = 180
- Value = -1 'True
- Width = 810
- End
- Begin VB.CommandButton cmdSel
- Caption = "选定(&S)"
- Height = 300
- Left = 210
- TabIndex = 13
- Top = 150
- Width = 1485
- End
- End
- Begin VB.ListBox LstCodeList
- Height = 2760
- ItemData = "基础设置_资产负债表设置.frx":78EC
- Left = 555
- List = "基础设置_资产负债表设置.frx":78F3
- TabIndex = 9
- Top = 690
- Width = 4890
- End
- Begin VB.CommandButton cmdOK
- Caption = "保存(&O)"
- Height = 300
- Left = 810
- TabIndex = 8
- Top = 4980
- Width = 1120
- End
- Begin VB.CommandButton cmdCancel
- Caption = "取消(&C)"
- Height = 300
- Left = 2010
- TabIndex = 7
- Top = 4980
- Width = 1120
- End
- Begin VB.TextBox txtExp
- Height = 315
- Left = 540
- MaxLength = 100
- TabIndex = 6
- Top = 3750
- Width = 4905
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "科目:"
- Height = 180
- Left = 555
- TabIndex = 11
- Top = 330
- Width = 450
- End
- Begin VB.Label labList
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "---------------"
- Height = 180
- Left = 1110
- TabIndex = 10
- Top = 345
- Width = 1350
- End
- End
- Begin VSFlex8Ctl.VSFlexGrid CzxsGrid
- Height = 6060
- Left = -74925
- TabIndex = 0
- Top = 360
- Width = 9210
- _cx = 5080
- _cy = 5080
- 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 = 8421504
- 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 = 0
- GridLines = 1
- GridLinesFixed = 2
- GridLineWidth = 1
- Rows = 5000
- Cols = 10
- FixedRows = 1
- 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
- AutoSearchDelay = 2
- 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
- ShowComboButton = 1
- WordWrap = 0 'False
- TextStyle = 0
- TextStyleFixed = 0
- OleDragMode = 0
- OleDropMode = 0
- DataMode = 0
- VirtualData = -1 'True
- DataMember = ""
- ComboSearch = 3
- AutoSizeMouse = -1 'True
- FrozenRows = 0
- FrozenCols = 0
- AllowUserFreezing= 0
- BackColorFrozen = 0
- ForeColorFrozen = 0
- WallPaperAlignment= 9
- AccessibleName = ""
- AccessibleDescription= ""
- AccessibleValue = ""
- AccessibleRole = 24
- End
- End
- Begin VB.Label Lab_OperStatus
- BackColor = &H000080FF&
- Caption = "1"
- Height = 345
- Left = 9540
- TabIndex = 1
- Top = 270
- Visible = 0 'False
- Width = 345
- End
- End
- Attribute VB_Name = "JC_FrmBalSetup"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '*************************************************************
- '* 模 块 名 称 :资产负债表设置
- '* 功 能 描 述 :对资产负债表的一些项目和科目名称进行设置
- '* 程序员姓名 : 魏永生
- '* 最后修改人 :
- '* 最后修改时间:2002/01/21
- '* 备 注:
- '* 需要预置所有表项目名称,录入项目栏。
- '* 数据来源栏提供生成公式:公式设定方法:
- '* 系统提示总帐系统的会计科目和编码,用户选择相应的编码确定计算公式。
- '*************************************************************
- Option Explicit
- '--------------------单张视图变量声明--------------------------
- Public bExpChange As Boolean '如果确认公式所做的修改 则此值为True
- '否则为False
- Private CodeListRs As New ADODB.Recordset
- '----------------------------------------------------------------------
- '=================列表视图程序开始==========================
- Dim ReportTitle As String
- Dim iRow As Integer '网格行
- Dim iCol As Integer '网格列
- Dim Str_RightEdit As String '编辑(新增、修改、删除)权限索引
- '以下为固定使用变量
- Dim Dyymctbl As New DY_Dyymsz '打印页面窗体变量
- Dim GridCode As String '显示网格网格代码
- Dim GridInf() As Variant '整个网格设置信息
- Dim Tsxx As String '系统提示信息
- Dim Qslz As Long '网格隐藏(非操作显示)列数
- Dim Sjhgd As Double '网格数据行高度
- Dim Sfxshjwg As Boolean '是否显示合计网格
- Dim GridBoolean() As Boolean '网格列信息(布尔型)
- Dim GridStr() As String '网格列信息(字符型)
- Dim GridInt() As Integer '网格列信息(整型)
- Dim Szzls As Integer '数组总列数(网格列数-1)
- Dim Bln_Stop As Boolean '停止输出查询结果
- Dim Cxnrrec As New ADODB.Recordset
- Private frmExp As New JC_Expressions '公式设置窗体
- Private Sub Form_Load()
- '调入打印页面设置窗体
- XtReportCode = "cwfx_BalSetup"
- Load Dyymctbl
- ReportTitle = "资产负债表设置"
- '调 入 网 格
- GridCode = "cwfx_BalSetup"
- Call BzWgcsh(CzxsGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
- Qslz = GridInf(1)
- Sjhgd = GridInf(2)
- Sfxshjwg = GridInf(7)
- Szzls = CzxsGrid.Cols - 1
- Call Cxnrtcwg
- Call OldForm_Load
- StTab.Tab = 0
- StTab.TabEnabled(1) = False
- '编辑(新增、修改、删除)权限索引
- Str_RightEdit = "cwfx_Balacen_Edit"
- End Sub
- Private Sub Cxnrtcwg() '查 询 内 容 填 充 网 格
- Dim SqlStr As String
- Dim Jsqte As Long
- '查询连接串
- SqlStr = "SELECT * FROM cwfx_BalanceInitial ORDER BY ID"
- Set Cxnrrec = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- With Cxnrrec
- CzxsGrid.Clear 1
- CzxsGrid.Rows = .RecordCount + CzxsGrid.FixedRows
- If .EOF And .BOF Then
- Exit Sub
- End If
- Jsqte = CzxsGrid.FixedRows
- Do While Not .EOF
- If Jsqte >= CzxsGrid.Rows Then
- CzxsGrid.AddItem ""
- End If
- Call Jltcwg(Cxnrrec, Jsqte)
- CzxsGrid.RowHeight(Jsqte) = Sjhgd
- .MoveNext
- Jsqte = Jsqte + 1
- Loop
- End With
- End Sub
- Private Sub Jltcwg(Jlbrec As ADODB.Recordset, Rowjsq As Long) '记录内容填充网格
- '[以下为自定义部分
- With Jlbrec
- CzxsGrid.TextMatrix(Rowjsq, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("ID"))
- CzxsGrid.TextMatrix(Rowjsq, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("Item"))
- CzxsGrid.TextMatrix(Rowjsq, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("Account")) & ""
- CzxsGrid.TextMatrix(Rowjsq, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("Editable"))
- CzxsGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), Szzls)) = RTrim(.Fields("comment"))
- CzxsGrid.TextMatrix(Rowjsq, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("AccntOrItem"))
- End With
- '以上为自定义部分]
- End Sub
- Private Sub SaveData()
- Dim strSql As String '查询字符串
- Dim I As Integer
- With Cxnrrec
- !account = Me.Tag
- .Update
- End With
- End Sub
- Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button) '表格格式设置(通用)
- Select Case Button.Key
- Case "bcgs" '保存表格格式
- Call Bcwggs(CzxsGrid, GridCode, GridStr())
- Case "hfmrgs" '恢复默认格式
- Call Hfmrgs(CzxsGrid, GridCode, GridStr())
- End Select
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- If Cxnrrec.State <> adStateClosed Then Cxnrrec.Close
- Set Cxnrrec = Nothing
- Set frmExp = Nothing
- '---------原公式窗体Form_Unload--------------
- Call OldForm_Unload(Cancel)
- '-----------------------
- End Sub
- Private Sub CzxsGrid_DblClick()
- Call Xgdqjl
- End Sub
- Private Sub bbyl(bbylte As Boolean) '报表打印预览
- Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
- Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
- Bbxbtgs = 1 '报 表 小 标 题 行 数
- Bbbwhgs = 0 '报 表 表 尾 行 数
- ReDim Bbxbt(1 To Bbxbtgs)
- ReDim bbxbtzzxs(1 To Bbxbtgs)
- If Bbbwhgs <> 0 Then
- ReDim Bbbwh(1 To Bbbwhgs)
- ReDim Bbbwhzzxs(1 To Bbbwhgs)
- End If
- Bbzbt = ReportTitle
- Bbxbt(1) = " "
- bbxbtzzxs(1) = 0 '报表行组织形式(0-居左 1-居中 2-居右)
- Call Scyxsjb(Me.CzxsGrid) '生成报表数据
- Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
- If Not bbylte Then
- Unload DY_Tybbyldy
- End If
- End Sub
- Private Sub cmdCancel_Click()
- Me.bExpChange = False
- StTab.Tab = 0
- StTab.TabEnabled(0) = True
- StTab.TabEnabled(1) = False
- End Sub
- Private Sub cmdOK_Click()
- If CheckExp = False Then
- Xtxxts "公式不合法!", 0, 1
- Exit Sub
- End If
- '返回解析后的公式(正向解析)
- Me.Tag = ExpTranslate(True, txtExp.Text)
- CzxsGrid.TextMatrix(CzxsGrid.Row, Sydz("003", GridStr(), Szzls)) = Me.Tag
- Me.bExpChange = True
- Call SaveData
- StTab.Tab = 0
- StTab.TabEnabled(0) = True
- StTab.TabEnabled(1) = False
- End Sub
- Private Sub cmdSel_Click()
- Call lstCodeList_DblClick '默认为相加
- End Sub
- Private Sub OldForm_Activate()
- With Me
- '公式文本框内容为解析后的公式 (反向解析)
- txtExp.Text = ExpTranslate(False, Me.Tag)
- .Tag = ""
- .labList.Caption = ""
- bExpChange = False
- txtExp.SetFocus
- txtExp.SelStart = 0
- txtExp.SelLength = Len(txtExp.Text)
- End With
- End Sub
- Private Sub OldForm_Load()
- Call FullCodeList ' 填充科目列表
- End Sub
- Private Sub OldForm_Unload(Cancel As Integer)
- On Error Resume Next
- CodeListRs.Close
- Set CodeListRs = Nothing
- End Sub
- Private Sub lstCodeList_Click()
- Dim strTem As String
- strTem = Right(LstCodeList.List(LstCodeList.ListIndex), Len(LstCodeList.List(LstCodeList.ListIndex)) - 20)
- labList.Caption = strTem
- End Sub
- Private Sub lstCodeList_DblClick()
- Dim strTem As String
- Dim iWhere As Integer '用于截取字符
- Dim strSign As String '符号,+ 或 - 或 ""
- If LstCodeList.ListIndex = -1 Then Exit Sub
- iWhere = InStr(1, LstCodeList.List(LstCodeList.ListIndex), " ") - 1
- strTem = Left(LstCodeList.List(LstCodeList.ListIndex), iWhere)
- If Trim(txtExp.Text) = "" Then
- strSign = ""
- ElseIf OptAdd.Value = True Then
- strSign = "+"
- ElseIf OptAdd.Value = False Then
- strSign = "-"
- End If
- txtExp.Text = txtExp.Text & strSign & strTem
- txtExp.SelStart = Len(txtExp.Text)
- End Sub
- Private Sub lstCodeList_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then
- Call lstCodeList_DblClick
- End If
- End Sub
- Private Sub txtExp_KeyPress(KeyAscii As Integer)
- Select Case KeyAscii
- Case 13
- Call cmdOK_Click
- End Select
- End Sub
- Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
- Select Case Button.Key
- Case "ymsz" '页面设置
- Dyymctbl.Show 1
- Case "yl" '预 览
- Call bbyl(True)
- Case "dy" '打 印
- Call bbyl(False)
- Case "xg" '修 改
- Call Xgdqjl
- Case "sx" '刷 新
- Call Cxnrtcwg
- Case "bz" '帮 助
- Call F1bz
- Case "fh" '退 出
- Unload Me
- End Select
- End Sub
- Private Sub Xgdqjl()
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightEdit, Xtczybm, 1, True, False) Then
- cmdOK.Enabled = False
- End If
- With CzxsGrid
- iRow = .Row
- iCol = .Col
- If CzxsGrid.TextMatrix(iRow, Sydz("004", GridStr(), Szzls)) = "True" Then
- '如果此行可编辑 并且 双击行为写公式的行
- If Cxnrrec.State = adStateOpen Then Cxnrrec.Close
- Cxnrrec.Open "SELECT * FROM cwfx_BalanceInitial where ID='" & CzxsGrid.TextMatrix(CzxsGrid.Row, Sydz("001", GridStr(), Szzls)) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- Me.Tag = Cxnrrec!account & ""
- Call OldForm_Activate
- StTab.Tab = 1
- StTab.TabEnabled(1) = True
- StTab.TabEnabled(0) = False
- End If
- End With
- End Sub
- '=================自定义程序开始====================================
- Private Function CheckExp() As Boolean
- '公式检察,如果公式合法返加TRUE,否则返回FALSE
- Dim strTem As String
- Dim strTem2 As String
- Dim strTemLast As String
- Dim bOK As Boolean '公式合法,则为True
- Dim I As Integer
- Dim j As Integer
- Dim codeColl As New Collection '用于存放科目编码的集合
- Dim iLen As Integer
- Dim iWordBegin As Integer '用于确定一个科目在字符串中的
- Dim iWordEnd As Integer '开始位置和结束位置
- strTem = Trim(txtExp.Text)
- '去除字符串中的不合法字符
- Dim strLastWord As String
- For I = 1 To Len(strTem)
- strTem2 = Mid(strTem, I, 1)
- If strTem2 = "+" And strLastWord = "+" Then
- '不合法,去除此字符
- ElseIf strTem2 = "-" And strLastWord = "-" Then
- '不合法,去除此字符
- ElseIf strTem2 = " " Then
- '不合法,去除此字符
- ElseIf (Asc(strTem2) < Asc("0") Or Asc(strTem2) > Asc("9")) And (strTem2 <> "+" And strTem2 <> "-") Then
- '不合法,去除此字符
- Else
- strTemLast = strTemLast & strTem2
- End If
- strLastWord = strTem2
- Next
- '去除字符串右边多余的符号
- If Right(strTemLast, 1) = "+" Or Right(strTemLast, 1) = "-" Then
- strTemLast = Left(strTemLast, Len(strTemLast) - 1)
- End If
- '去除字符串左边多余的符号
- If Left(strTemLast, 1) = "+" Or Left(strTemLast, 1) = "-" Then
- strTemLast = Right(strTemLast, Len(strTemLast) - 1)
- End If
- txtExp.Text = strTemLast
- If strTemLast = "" Then '如果公式为空
- CheckExp = True
- Exit Function
- End If
- '得到科目列表集合
- iLen = Len(strTemLast)
- iWordBegin = 1
- iWordEnd = 1
- For I = 1 To iLen
- strTem = Mid(strTemLast, I, 1)
- If strTem = "+" Or strTem = "-" Or I = iLen Then
- strTem = Mid(strTemLast, iWordBegin, I - iWordBegin + 1)
- strTem = IIf(Right(strTem, 1) = "+" Or Right(strTem, 1) = "-", Left(strTem, Len(strTem) - 1), strTem)
- codeColl.Add strTem
- iWordBegin = I + 1
- End If
- Next
- '验公式是否合法
- For I = 1 To codeColl.count
- bOK = False
- For j = 0 To LstCodeList.ListCount
- strTem2 = Trim(Left(LstCodeList.List(j), 20))
- Debug.Print codeColl.Item(I)
- If codeColl.Item(I) = strTem2 Then
- bOK = True
- Exit For
- End If
- Next
- If bOK = False Then
- CheckExp = bOK
- txtExp.SetFocus
- '----------------------------------------------------------
- '此处代码有待改进,
- 'i的值为不合法的科目位置,如i=2则第二个科目不合法。
- '找出第(i-1)个符号与第i个符号之间的字符串,就为不合法字符串
- '“符号”指“+”或“-”
- txtExp.SelStart = InStr(1, strTemLast, codeColl.Item(I)) - 1
- txtExp.SelLength = Len(codeColl.Item(I))
- '---------------------------------------------------
- Exit Function
- End If
- Next
- CheckExp = bOK
- End Function
- Private Sub FullCodeList()
- Dim strSql As String
- Dim strCodeList As String
- strSql = "SELECT cCode,cClass,cName,EndFlag,codelevel FROM Cwzz_AccCode ORDER BY cCode"
- Set CodeListRs = Cw_DataEnvi.DataConnect.Execute(strSql)
- LstCodeList.Clear
- '格式化字符串
- With CodeListRs
- Do Until .EOF
- strCodeList = Trim(CodeListRs!cCode)
- strCodeList = strCodeList & Space(20 - Len(strCodeList))
- strCodeList = strCodeList & Trim(CodeListRs!cName)
- LstCodeList.AddItem strCodeList
- .MoveNext
- Loop
- End With
- End Sub
- Private Function ExpTranslate(ByVal bWay As Boolean, ByVal strExp As String) As String
- '公式解析过程序,参数bWay为TRUE则为正向解析,由科目代码->文字
- ' FALSE 为反向解析,由文字->科目代码
- 'strExp 为传递的公式字符串
- ExpTranslate = strExp
- End Function