资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:94k
源码类别:
企业管理
开发平台:
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 AutoTran_TranList
- BorderStyle = 1 'Fixed Single
- Caption = "自动转帐凭证列表"
- ClientHeight = 6285
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 8475
- Icon = "自动转帐凭证_转帐列表.frx":0000
- KeyPreview = -1 'True
- LinkTopic = "Form4"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 6285
- ScaleWidth = 8475
- StartUpPosition = 3 '窗口缺省
- Begin VB.Timer Timer1
- Interval = 1
- Left = 3570
- Top = 570
- End
- Begin MSComctlLib.Toolbar GsToolbar
- Height = 525
- Left = 6000
- TabIndex = 0
- 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
- Begin MSComctlLib.Toolbar SzToolbar
- Align = 1 'Align Top
- Height = 555
- Left = 0
- TabIndex = 8
- Top = 0
- Width = 8475
- _ExtentX = 14949
- _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 = 13
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "设置"
- Key = "ymsz"
- ImageKey = "sz"
- BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628}
- NumButtonMenus = 1
- BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628}
- EndProperty
- EndProperty
- 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}
- 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}
- Caption = "删除"
- Key = "sc"
- ImageKey = "sc"
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "定义"
- Key = "define"
- ImageKey = "define"
- EndProperty
- BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "执行"
- Key = "run"
- ImageKey = "exec"
- EndProperty
- BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "帮助"
- Key = "bz"
- ImageKey = "bz"
- EndProperty
- BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- ImageKey = "tc"
- EndProperty
- EndProperty
- BorderStyle = 1
- End
- Begin TabDlg.SSTab StTab
- Height = 5655
- Left = 90
- TabIndex = 1
- Top = 600
- Width = 8325
- _ExtentX = 14684
- _ExtentY = 9975
- _Version = 393216
- Style = 1
- Tabs = 2
- TabHeight = 556
- TabCaption(0) = "列表视图"
- TabPicture(0) = "自动转帐凭证_转帐列表.frx":1042
- Tab(0).ControlEnabled= -1 'True
- Tab(0).Control(0)= "TsLabel(9)"
- Tab(0).Control(0).Enabled= 0 'False
- Tab(0).Control(1)= "ImageList1"
- Tab(0).Control(1).Enabled= 0 'False
- Tab(0).Control(2)= "CzxsGrid"
- Tab(0).Control(2).Enabled= 0 'False
- Tab(0).Control(3)= "Combo_Kjqj"
- Tab(0).Control(3).Enabled= 0 'False
- Tab(0).Control(4)= "Chk_Vouch"
- Tab(0).Control(4).Enabled= 0 'False
- Tab(0).ControlCount= 5
- TabCaption(1) = "单张视图"
- TabPicture(1) = "自动转帐凭证_转帐列表.frx":105E
- Tab(1).ControlEnabled= 0 'False
- Tab(1).Control(0)= "Frame1"
- Tab(1).ControlCount= 1
- Begin VB.CheckBox Chk_Vouch
- Caption = "是否包含未记帐凭证"
- ForeColor = &H00000000&
- Height = 255
- Left = 330
- TabIndex = 15
- Top = 5190
- Value = 1 'Checked
- Width = 2025
- End
- Begin VB.ComboBox Combo_Kjqj
- Height = 300
- Left = 4770
- Style = 2 'Dropdown List
- TabIndex = 14
- Top = 5160
- Visible = 0 'False
- Width = 1545
- End
- Begin VB.Frame Frame1
- Height = 5235
- Left = -74880
- TabIndex = 9
- Top = 360
- Width = 8055
- Begin MSComctlLib.ImageCombo ImgCmbClass
- Height = 315
- Left = 1260
- TabIndex = 4
- Top = 1140
- Width = 2085
- _ExtentX = 3678
- _ExtentY = 556
- _Version = 393216
- ForeColor = -2147483640
- BackColor = -2147483643
- Text = "ImgCmbClass"
- End
- Begin VB.TextBox LrText
- Height = 300
- Index = 0
- Left = 1260
- TabIndex = 2
- Text = "0"
- Top = 300
- Width = 2055
- End
- Begin VB.TextBox LrText
- Height = 300
- Index = 1
- Left = 1260
- TabIndex = 3
- Text = "1"
- Top = 720
- Width = 2055
- End
- Begin VB.CommandButton Ydcommand1
- Height = 300
- Index = 0
- Left = 5220
- Picture = "自动转帐凭证_转帐列表.frx":107A
- Style = 1 'Graphical
- TabIndex = 11
- Top = 1290
- Visible = 0 'False
- Width = 300
- End
- Begin VB.CommandButton QxCommand
- Cancel = -1 'True
- Caption = "取消(&C)"
- Height = 300
- Left = 2220
- TabIndex = 6
- Top = 1650
- Width = 1120
- End
- Begin VB.CommandButton BcCommand
- Caption = "保存(&S)"
- Height = 300
- Left = 990
- TabIndex = 5
- Top = 1650
- Width = 1120
- End
- Begin VB.Label TsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "转帐编码:"
- Height = 180
- Index = 0
- Left = 435
- TabIndex = 7
- Top = 360
- Width = 810
- End
- Begin VB.Label TsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "转帐名称:"
- Height = 180
- Index = 1
- Left = 435
- TabIndex = 12
- Top = 780
- Width = 810
- End
- Begin VB.Label TsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "凭证类别:"
- Height = 180
- Index = 2
- Left = 435
- TabIndex = 10
- Top = 1200
- Width = 810
- End
- End
- Begin VSFlex8Ctl.VSFlexGrid CzxsGrid
- Height = 4515
- Left = 120
- TabIndex = 13
- Top = 480
- Width = 8055
- _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 = 16777215
- ForeColor = -2147483640
- BackColorFixed = -2147483624
- ForeColorFixed = -2147483630
- BackColorSel = -2147483635
- ForeColorSel = -2147483634
- BackColorBkg = 8421504
- BackColorAlternate= 16777215
- 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 = 200
- 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
- Begin MSComctlLib.ImageList ImageList1
- Left = 5160
- Top = 0
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 22
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":1404
- Key = "sz"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":179E
- Key = "dy"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":1B38
- Key = "yl"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":1ED2
- Key = "xg"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":226C
- Key = "zh"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":2606
- Key = "sh"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":29A0
- Key = "bc"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":2D3A
- Key = "fq"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":30D4
- Key = "bz"
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":346E
- Key = "tc"
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":3808
- Key = "bcgs"
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":3BA2
- Key = "mrlk"
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":3F3C
- Key = "xsxm"
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":42D6
- Key = "first"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":4670
- Key = "prev"
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":4A0A
- Key = "next"
- EndProperty
- BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":4DA4
- Key = "last"
- EndProperty
- BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":513E
- Key = "xx"
- EndProperty
- BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":54D8
- Key = "define"
- EndProperty
- BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":5872
- Key = "exec"
- EndProperty
- BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":5C0C
- Key = "xz"
- EndProperty
- BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_转帐列表.frx":5FA6
- Key = "sc"
- EndProperty
- EndProperty
- End
- Begin VB.Label TsLabel
- Caption = "会计期间:"
- Height = 195
- Index = 9
- Left = 3900
- TabIndex = 16
- Top = 5220
- Visible = 0 'False
- Width = 825
- End
- End
- End
- Attribute VB_Name = "AutoTran_TranList"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '*******************************************************
- '* 模 块 名 称 :自动转帐列表
- '* 功 能 描 述 :所有通过定义转帐关系能进行自动转帐的目录清单及执行转帐过程
- '* 程序员姓名 : 姜冬梅
- '* 最后修改人 : 魏永生
- '* 最早完成时间:2001/04/30
- '* 最近修改时间:2001/12/29
- '* 备 注:经过自己测试
- '*******************************************************
- '修改]
- Dim Rec_AutoTranMain As New ADODB.Recordset '转帐过程主表中
- Dim Rec_AutoTranItem As New ADODB.Recordset '转帐过程辅表
- Dim RecTemp As New ADODB.Recordset '临时数据表
- Dim Sqlstr As String '查询字符串
- Dim Jsqte As Long '临时计数器
- '
- Dim Je As Double '取金额
- Dim Jhj As Double '借合计金额
- Dim Dhj As Double '贷合计金额
- Dim Sl As Double '取数量
- Dim Jhjsl As Double '借合计数量
- Dim Dhjsl As Double '贷合计数量
- Dim ItemSl As Double '取数量
- Dim JhjItemSl As Double '借合计数量
- Dim DhjItemSl As Double '贷合计数量
- Dim OperationNum As Integer '本次转帐操作批号
- Dim Jsq_Eff As Integer '本批有效转帐过程总数
- Dim TranJsq As Integer '本批选择的转帐过程个数计数器
- Dim TranNum() As String '转帐过程数组
- Dim TranVouchClass() As String '转帐凭证类别数组
- Dim Bln_DeleteFlag As Boolean '转帐后是否删除临时表
- Dim Int_Year As Integer '会计年份
- Dim Int_Period As Integer '会计期间
- Dim jdzygs As Integer '控件焦点转移个数
- Dim Lrzt As Integer '录入状态标志(0-非录入状态 1-增加 2-修改)
- Dim ReportTitle As String '报表主标题
- Public TranClassCode As String '转帐类型编码
- '以下为固定使用变量(网格)
- Dim Cxnrrec As New ADODB.Recordset '显示查询内容动态集
- 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 GridBoolean() As Boolean '网格列信息(布尔型)
- Dim GridStr() As String '网格列信息(字符型)
- Dim GridInt() As Integer '网格列信息(整型)
- Dim Szzls As Integer '数组总列数(网格列数-1)
- '以下为固定使用变量(文本框)
- Dim Textvar() As Variant '存储变体型文本框信息
- Dim Textboolean() As Boolean '存储布尔型文本框信息
- Dim Textint() As Integer '存储整型文本框信息
- Dim Textstr() As String '存储字符型文本框信息
- Dim Max_Text_Index As Integer '最大录入文本框索引值
- Dim TextGroupCode As String '文本框录入分组编码
- Dim TextValiLock As Boolean '文本框失去焦点是否进行有效性控制判断
- Dim TextValiJudgeLock() As Boolean '文本框录入有效性判断控制锁,=True时光标离开不需要马上进行判断
- '=False时,即允许马上进行有效性验证。
- Dim CurTextIndex As Integer '当前文本框索引值
- Dim TextChangeLock As Boolean '文本框内容变换控制锁.=True时屏蔽LrText.Change事件,=False时则执行。
- '=True时,关闭Change事件,当新增记录填充网格、取消操作、按帮助按纽时均需关闭CHANGE事件。
- Dim Bln_Cancel As Boolean '取消按钮信息传递
- Private Sub Form_KeyPress(KeyAscii As Integer) '控 制 焦 点 转 移
- jdzygs = 6
- Select Case KeyAscii
- Case vbKeyReturn
- If Kjjdzy(jdzygs) Then
- KeyAscii = 0
- End If
- Case 39 '屏蔽"'"
- KeyAscii = 0
- End Select
- End Sub
- Private Sub Form_Load()
- '确定转帐过程编码
- Call SeleTranBm
- '窗体的Caption
- Me.Caption = ReportTitle
- Me.Left = (Screen.Width - Me.Width) / 2
- Me.Top = (Screen.Height - Me.Height) / 2
- '报表主标题及报表编码
- ReportTitle = "转帐凭证列表"
- XtReportCode = "cwzz_AutoAccList"
- Load Dyymctbl
- '以下为文本框处理程序
- TextGroupCode = "cwzz_AutoAccL"
- Call Drwbkxx(TextGroupCode, Textvar(), Textboolean(), Textint(), Textstr()) '读入文本框录入信息
- Call Wbkcsh
- '调 入 网 格
- GridCode = "cwzz_AutoAccList" '网格属性编码
- Call BzWgcsh(CzxsGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
- Qslz = GridInf(1)
- Sjhgd = GridInf(2)
- Szzls = CzxsGrid.Cols - 1
- '填 充 网 格
- Call Cxnrtcwg
- '初始化toolbar,tab卡状态
- StTab.Tab = 0
- StTab.TabEnabled(1) = False
- Frame1.Enabled = False
- Lrzt = 0 '初始为非编辑状态
- '[自定义
- Chk_Vouch.Value = vbChecked
- '填充凭证类型下拉框
- Call FillImageCombo(ImgCmbClass, "Cwzz_AccVouchClass", 2)
- '填充会计期间列表框(年度默认为用户选择年度)
- Call Sub_FillPeriod(Combo_Kjqj, Xtyear, Xtmm)
- '自定义]
- End Sub
- Private Sub Cxnrtcwg() '查询内容填充网格
- Sqlstr = "SELECT Cwzz_VouchClass.VouchClassName AS VouchClassName, Cwzz_AutoTranMain.TranClass, " & _
- "Cwzz_AutoTranMain.TranCode, Cwzz_AutoTranMain.TranName," & _
- "Cwzz_AutoTranMain.VouchClassCode, Cwzz_AutoTranMain.EndTranDate," & _
- "Cwzz_AutoTranMain.Bill FROM Cwzz_AutoTranMain LEFT OUTER JOIN " & _
- "Cwzz_VouchClass ON " & _
- "Cwzz_AutoTranMain.VouchClassCode = Cwzz_VouchClass.VouchClassCode " & _
- "Where Cwzz_AutoTranMain.TranClass='" & TranClassCode & "' ORDER BY Cwzz_AutoTranMain.TranCode"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With RecTemp
- 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(RecTemp, 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("TranCode"))
- CzxsGrid.TextMatrix(Rowjsq, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("TranName"))
- CzxsGrid.TextMatrix(Rowjsq, Sydz("003", GridStr(), Szzls)) = Trim(Trim(.Fields("VouchClassCode")) & " " & Trim(.Fields("VouchClassName")))
- CzxsGrid.TextMatrix(Rowjsq, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("Bill") & "")
- CzxsGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), Szzls)) = IIf(Trim(.Fields("EndTranDate") & "") = "", "", Format(Trim(.Fields("EndTranDate") & ""), "yyyy-mm-dd"))
- End With
- End Sub
- Private Sub Wbkcsh() '录入文本框初始化
- Dim Jsqte As Integer
- '最大录入文本框索引值
- Max_Text_Index = Textvar(1)
- ReDim TextValiJudgeLock(Max_Text_Index)
- For Jsqte = 0 To Max_Text_Index
- If Len(Trim(Textstr(Jsqte, 1))) <> 0 Then '如果文本框索引值不为0,即不是“编码”文本框
- If Textboolean(Jsqte, 1) Then '如果该文本框处需要提供帮助
- If Jsqte <> 0 And Not Textboolean(Jsqte, 3) Then '
- Load Ydcommand1(Jsqte)
- End If
- Ydcommand1(Jsqte).Visible = True
- Ydcommand1(Jsqte).Move LrText(Jsqte).Left + LrText(Jsqte).Width, LrText(Jsqte).Top
- End If
- TextChangeLock = True
- LrText(Jsqte).Text = ""
- LrText(Jsqte).Tag = ""
- If Textint(Jsqte, 5) <> 0 Then '如果字段录入长度不等于0
- LrText(Jsqte).MaxLength = Textint(Jsqte, 5) '该文本框的最大录入长度赋值给文本框的MaxLength
- End If
- TextChangeLock = False
- End If
- TextValiJudgeLock(Jsqte) = True
- Next Jsqte
- End Sub
- Private Sub Form_Unload(Cancel As Integer) '窗体卸载
- TranClassCode = ""
- Set Cxnrrec = Nothing
- Unload Dyymctbl
- Set Rec_AutoTranMain = Nothing
- Set Rec_AutoTranItem = Nothing
- Set RecTemp = Nothing
- End Sub
- Private Function Bclrsj() As Boolean '判断录入数据有效性,并保存数据
- Dim Jsqte As Integer
- For Jsqte = 0 To Max_Text_Index
- If Textint(Jsqte, 8) = 1 Then '如果字段不能为空
- If Len(Trim(LrText(Jsqte).Text)) = 0 Then
- Tsxx = Textstr(Jsqte, 7) & "不能为空!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(Jsqte).SetFocus
- Bclrsj = False
- Exit Function
- End If
- Else
- If Textint(Jsqte, 8) = 2 Then '如果字段不能为零
- If Val(Trim(LrText(Jsqte).Text)) = 0 Then
- Tsxx = Textstr(Jsqte, 7) & "不能为零!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(Jsqte).SetFocus
- Bclrsj = False
- Exit Function
- End If
- End If
- End If
- Next Jsqte
- If ImgCmbClass.Text = "" Then
- Tsxx = tsLabel(2).Caption & "不能为空!"
- Call Xtxxts(Tsxx, 0, 1)
- ImgCmbClass.SetFocus
- Bclrsj = False
- Exit Function
- Else
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select * from Cwzz_VouchClass Where VouchClassCode='" & Trim(GetComboKey(ImgCmbClass, 0)) & "'")
- End If
- '对需要进行事后判断的文本框录入内容进行有效性判断 (固定不变)
- For Jsqte = 0 To Max_Text_Index
- If Textint(Jsqte, 9) = 0 Or Textint(Jsqte, 9) = 2 Then '需要进行有效性判断的字段存盘之前再进行判断。
- If Not TextYxxpd(Jsqte) Then
- Exit Function
- End If
- End If
- Next Jsqte
- On Error GoTo Swcwcl
- If Lrzt = 1 Then '增 加一个新编码时
- With Rec_AutoTranMain
- If .State = 1 Then .Close
- .Open "SELECT * FROM Cwzz_AutoTranMain WHERE TranCode= '" + Trim(LrText(0).Text) + "' and TranClass='" & TranClassCode & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not .EOF Then
- Tsxx = "转帐编码重复!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(0).SetFocus
- Bclrsj = False
- Exit Function
- End If
- If .State = 1 Then .Close
- .Open "SELECT * FROM Cwzz_AutoTranMain WHERE TranName= '" + Trim(LrText(1).Text) + "' and TranClass='" & TranClassCode & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not .EOF Then
- Tsxx = "转帐名称重复!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(1).SetFocus
- Bclrsj = False
- Exit Function
- End If
- .AddNew
- .Fields("TranClass") = TranClassCode
- .Fields("TranCode") = Trim(LrText(0).Text)
- .Fields("TranName") = Trim(LrText(1).Text)
- .Fields("VouchClassCode") = Trim(GetComboKey(ImgCmbClass, 0))
- .Update
- End With
- Sqlstr = "SELECT cwzz_VouchClass.VouchClassCode,cwzz_VouchClass.VouchClassName, Cwzz_AutoTranMain.TranName, " & _
- "Cwzz_AutoTranMain.TranCode, Cwzz_AutoTranMain.VouchClassCode," & _
- "Cwzz_AutoTranMain.EndTranDate , Cwzz_AutoTranMain.Bill FROM Cwzz_AutoTranMain LEFT OUTER JOIN " & _
- "Cwzz_VouchClass ON " & _
- "Cwzz_AutoTranMain.VouchClassCode = Cwzz_VouchClass.VouchClassCode WHERE trancode = '" & Trim(LrText(0)) & "' and TranClass='" & TranClassCode & "'" & _
- "ORDER BY Cwzz_AutoTranMain.TranCode"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With CzxsGrid
- .AddItem ""
- .RowHeight(.Rows - 1) = Sjhgd
- .Select .Rows - 1, Qslz
- Call Jltcwg(RecTemp, .Rows - 1)
- End With
- Tsxx = "保存成功!"
- Call Xtxxts(Tsxx, 0, 4)
- Call Cshlrxx(1)
- LrText(0).SetFocus
- Else '修改转帐名称或转帐类型时 修改编辑状态
- With Rec_AutoTranMain
- If .State = 1 Then .Close
- .Open "SELECT * FROM Cwzz_AutoTranMain WHERE TranName= '" + Trim(LrText(1).Text) + "' and TranCode<>'" & Trim(LrText(0).Text) & "' and TranClass='" & TranClassCode & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not .EOF Then
- Tsxx = "转帐名称重复!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(1).SetFocus
- Bclrsj = False
- Exit Function
- End If
- If .State = 1 Then .Close
- .Open "SELECT * FROM Cwzz_AutoTranMain WHERE TranCode= '" + LrText(0).Text + "' and TranClass='" & TranClassCode & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If Not .EOF Then
- .Fields("TranName") = Trim(LrText(1).Text)
- .Fields("VouchClassCode") = Trim(GetComboKey(ImgCmbClass, 0))
- End If
- .Update
- .Close
- End With
- Sqlstr = "SELECT Cwzz_VouchClass.VouchClassName, Cwzz_AutoTranMain.TranName," & _
- "Cwzz_AutoTranMain.TranCode,Cwzz_AutoTranMain.VouchClassCode, Cwzz_AutoTranMain.EndTranDate," & _
- "Cwzz_AutoTranMain.Bill FROM Cwzz_AutoTranMain LEFT OUTER JOIN " & _
- "Cwzz_VouchClass ON Cwzz_AutoTranMain.VouchClassCode = Cwzz_VouchClass.VouchClassCode WHERE trancode = '" & Trim(LrText(0)) & "' and TranClass='" & TranClassCode & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Not RecTemp.EOF Then
- Call Jltcwg(RecTemp, CzxsGrid.Row)
- End If
- End If
- Bclrsj = True
- Exit Function
- Swcwcl:
- Tsxx = "存盘过程中出现错误,请退出后重新进入!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Function
- End Function
- Private Sub Cshlrxx(lrztxx As Integer) '初始化录入字段信息
- TextChangeLock = True '关闭Chang事件
- If lrztxx = 1 Then '新增状态
- For Jsqte = 0 To Max_Text_Index
- If Len(Trim(Textstr(Jsqte, 1))) <> 0 Then '文本框索引值
- TextChangeLock = True
- LrText(Jsqte).Text = ""
- LrText(Jsqte).Tag = ""
- TextChangeLock = False
- End If
- TextValiJudgeLock(Jsqte) = True
- Next Jsqte
- ImgCmbClass.Text = ""
- Else '其他状态,修改、非编辑
- With CzxsGrid
- LrText(0).Text = Trim(.TextMatrix(.Row, Sydz("001", GridStr(), Szzls)))
- LrText(1).Text = Trim(.TextMatrix(.Row, Sydz("002", GridStr(), Szzls)))
- ImgCmbClass.Text = Trim(.TextMatrix(.Row, Sydz("003", GridStr(), Szzls)))
- End With
- End If
- TextChangeLock = False
- End Sub
- Private Sub Scdqjl() '删 除 当 前 记 录
- Dim Yhanswer As Integer
- If CzxsGrid.Row < CzxsGrid.FixedRows Then
- Exit Sub
- End If
- Tsxx = "请确认是否删除当前记录?"
- Yhanswer = Xtxxts(Tsxx, 2, 2)
- If Yhanswer = 2 Then
- Exit Sub
- End If
- On Error GoTo Cwcl
- Cw_DataEnvi.DataConnect.BeginTrans
- Cw_DataEnvi.DataConnect.Execute "delete Cwzz_AutoTranItem where TranCode= '" + Trim(CzxsGrid.TextMatrix(CzxsGrid.Row, Sydz("001", GridStr(), Szzls))) + "' and TranClass='" & TranClassCode & "'"
- Cw_DataEnvi.DataConnect.Execute "delete Cwzz_AutoTranMain where TranCode = '" + Trim(CzxsGrid.TextMatrix(CzxsGrid.Row, Sydz("001", GridStr(), Szzls))) + "' and TranClass='" & TranClassCode & "'"
- Cw_DataEnvi.DataConnect.CommitTrans
- CzxsGrid.RemoveItem CzxsGrid.Row
- Exit Sub
- Cwcl:
- If Err.Number = -2147217900 Then
- Tsxx = "该编码已经被使用,不能删除!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- Else
- Tsxx = "出现未知情况,该编码不能被删除!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End If
- End Sub
- Public Sub Define() '定义转帐关系
- Dim gnsybm As String '功能索引编码
- Dim gnsymc As String '功能索引名称
- If CzxsGrid.Rows = CzxsGrid.FixedRows Then
- Tsxx = "请首先新增转帐过程!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- End If
- If Trim(CzxsGrid.TextMatrix(CzxsGrid.Row, Sydz("001", GridStr(), Szzls))) = "" Then
- Tsxx = "请选择转帐过程!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- Else
- '为转帐定义窗体传递该转帐过程参数
- CzxsGrid.Tag = CzxsGrid.TextMatrix(CzxsGrid.Row, Sydz("001", GridStr(), Szzls))
- Sqlstr = "Select * From Xt_xtgnb where gnmc='" & Xt_Control.tvTreeView.SelectedItem.Text & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- gnsybm = Trim(RecTemp.Fields("gnsy") & "")
- gnsymc = Trim(RecTemp.Fields("gnmc") & "")
- Select Case gnsybm
- Case "Cwzz_UserDefineTran" '"自定义转帐凭证"
- AutoTran_DefiMy.HelpContextID = AutoTran_TranList.HelpContextID
- AutoTran_DefiMy.Show 1
- Case "Cwzz_ProfitTran" '"期间损益结转"
- AutoTran_DefiSy.HelpContextID = AutoTran_TranList.HelpContextID
- AutoTran_DefiSy.Show 1
- Case "Cwzz_ModelTran" '"模式结转凭证"
- AutoTran_DefiCus.HelpContextID = AutoTran_TranList.HelpContextID
- AutoTran_DefiCus.Show 1
- Case "Cwzz_ExchangeTran" '"汇兑损益凭证"
- AutoTran_DefiExchange.HelpContextID = AutoTran_TranList.HelpContextID
- AutoTran_DefiExchange.Show 1
- End Select
- End If
- End Sub
- Private Sub Run1() '执行自定义转帐程序
- Dim Tj_Main As String '总帐取数公式
- Dim Tj_List As String '明细帐取数公式
- Dim Tj_Ass As String '辅助帐取数公式
- Dim jsq As Integer '临时计数器
- Dim I As Integer
- Dim Str_Formula As String '公式串
- Dim DestTranOri As String '对方汇总数的借贷方向
- Dim lng_OperationNum As Long
- Bln_DeleteFlag = True
- If Tran_Pd = False Then
- Exit Sub
- End If
- On Error GoTo Err1
- Cw_DataEnvi.DataConnect.BeginTrans
- TranCount = TranJsq '记录生成凭证的个数
- VoidStr = "" '记录没有数值的空凭证序号
- '对转帐列表网格内选中的TranJsq个转帐过程依次生成凭证,写到临时凭证数据表中
- For jsq = 1 To TranJsq
- '写临时凭证主表
- lng_OperationNum = CreatBillID("0102")
- Call Save_TempPz_Main(TranVouchClass(jsq), TranNum(jsq), OperationNum, lng_OperationNum)
- '对方汇总数的借贷方向
- Sqlstr = "Select ccode,TranOri,FormulaString from Cwzz_AutoTranItem where Trancode='" & TranNum(jsq) & "' and TranClass='" & TranClassCode & "' and FormulaString like '%对方汇总数%' Order by AutoTranId"
- Set Rec_AutoTranItem = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Rec_AutoTranItem.EOF = False Then
- DestTranOri = Rec_AutoTranItem.Fields("tranori")
- End If
- Jhj = 0
- Dhj = 0 '对方汇总金额
- Jhjsl = 0
- Dhjsl = 0
- JhjItemSl = 0
- DhjItemSl = 0
- I = 0
- hjje = 0 '合计金额
- '按转帐定义关系,取每笔转帐数据,写入临时数据辅表中
- Sqlstr = "select * from Cwzz_AutoTranItem where Trancode='" & TranNum(jsq) & "' and TranClass='" & TranClassCode & "' and FormulaString not like '%对方汇总数%' ORDER BY AutoTranId"
- Set Rec_AutoTranItem = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- Do While Rec_AutoTranItem.EOF = False
- Str_Formula = Trim(Rec_AutoTranItem.Fields("FormulaString"))
- Str_Formula = Fn_Replace(Str_Formula, Chk_Vouch.Value)
- Sqlstr = "select " & Str_Formula & " as ReturnValue"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If RecTemp.EOF = False Then
- Je = IIf(IsNull(RecTemp.Fields("ReturnValue")), 0, RecTemp.Fields("ReturnValue"))
- If Rec_AutoTranItem.Fields("tranori") <> DestTranOri Then
- Dhj = Dhj + Je * IIf(Rec_AutoTranItem.Fields("tranori") = DestTranOri, -1, 1)
- End If
- '写临时凭证辅表
- If Je <> 0 Then
- Call Save_TempPz_Ass(lng_OperationNum, I, Trim(Rec_AutoTranItem.Fields("Digest")), Trim(Rec_AutoTranItem.Fields("Ccode")), Trim(Rec_AutoTranItem.Fields("DeptCode") & ""), Trim(Rec_AutoTranItem.Fields("PersonCode") & ""), Trim(Rec_AutoTranItem.Fields("CusCode") & ""), Trim(Rec_AutoTranItem.Fields("Suppliercode") & ""), Trim(Rec_AutoTranItem.Fields("ItemCode") & ""), Trim(Rec_AutoTranItem.Fields("TranOri")))
- End If
- End If
- Rec_AutoTranItem.MoveNext
- I = I + 1
- hjje = hjje + Je
- Loop
- '对方汇总
- Sqlstr = "Select ccode,TranOri,FormulaString from Cwzz_AutoTranItem where Trancode='" & TranNum(jsq) & "' and TranClass='" & TranClassCode & "' and FormulaString like '%对方汇总数%' Order by AutoTranId"
- Set Rec_AutoTranItem = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Rec_AutoTranItem.EOF = False Then
- DestTranOri = Rec_AutoTranItem.Fields("tranori")
- End If
- '找到数据来源为对方汇总数的转帐关系
- Sqlstr = "select * from Cwzz_AutoTranItem where Trancode='" & TranNum(jsq) & "' and TranClass='" & TranClassCode & "' and FormulaString like '%对方汇总数%' ORDER BY AutoTranId"
- Set Rec_AutoTranItem = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- Do While Rec_AutoTranItem.EOF = False
- Str_Formula = Trim(Rec_AutoTranItem.Fields("FormulaString"))
- Str_Formula = Replace(Str_Formula, "对方汇总数", Str(Dhj))
- Sqlstr = "select " & Str_Formula & " as ReturnValue"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If RecTemp.EOF = False Then
- Je = RecTemp.Fields("ReturnValue")
- End If
- Call Save_TempPz_Ass(lng_OperationNum, I, Trim(Rec_AutoTranItem.Fields("Digest")), Trim(Rec_AutoTranItem.Fields("Ccode")), Trim(Rec_AutoTranItem.Fields("DeptCode") & ""), Trim(Rec_AutoTranItem.Fields("PersonCode") & ""), Trim(Rec_AutoTranItem.Fields("CusCode") & ""), Trim(Rec_AutoTranItem.Fields("Suppliercode") & ""), Trim(Rec_AutoTranItem.Fields("ItemCode") & ""), Trim(Rec_AutoTranItem.Fields("TranOri")))
- Rec_AutoTranItem.MoveNext
- I = I + 1
- Loop
- If hjje = 0 Then '合计金额
- '删除空凭证主从表
- Sqlstr = "Delete From Cwzz_AccVouchSubTemp Where VouchId=" & lng_OperationNum
- Cw_DataEnvi.DataConnect.Execute Sqlstr
- Sqlstr = "Delete From Cwzz_AccVouchMainTemp Where VouchId=" & lng_OperationNum
- Cw_DataEnvi.DataConnect.Execute Sqlstr
- VoidStr = VoidStr + Str(jsq) + " "
- TranCount = TranCount - 1
- End If
- Next jsq
- Cw_DataEnvi.DataConnect.CommitTrans
- '没有有效凭证生成,即金额、数量均为0
- If Len(VoidStr) <> 0 Then
- Tsxx = "第" & VoidStr & "张凭证没有发生额,不需要结转!"
- Call Xtxxts(Tsxx, 0, 4)
- End If
- If TranCount > 0 Then '记录生成凭证的个数
- '记录此次转帐的批号,做为凭证窗体调用的参数
- AutoTran_PzFrm.OperationNumPz = OperationNum
- AutoTran_PzFrm.vouchsourcePz = "自动转帐"
- '调入凭证制作窗体
- AutoTran_PzFrm.Show 1
- '为在转帐过程列表的网格中重新显示制单日期和操作员,防止虽转完,但无痕迹
- Call Write_Date
- Call Clean
- End If
- Call Cxnrtcwg
- Exit Sub
- Err1:
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "转帐过程中出现未知错误,程序自动恢复保存前状态!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End Sub
- Private Sub Run3() '执行汇兑损益程序
- Dim Tj_Main As String '总帐取数公式
- Dim Tj_List As String '明细帐取数公式
- Dim Tj_Ass As String '辅助帐取数公式
- Dim jsq As Integer '临时计数器
- Dim I As Integer
- Dim Str_Formula As String '公式串
- Dim DestTranOri As String '对方汇总数的借贷方向
- Dim Str_ForeignCode As String '外币编码
- Dim Dec_AdjustRate As Double '汇率
- Dim lng_OperationNum As Long
- Bln_DeleteFlag = True
- If Tran_Pd = False Then
- Exit Sub
- End If
- On Error GoTo Err1
- Cw_DataEnvi.DataConnect.BeginTrans
- TranCount = TranJsq '记录生成凭证的个数
- VoidStr = "" '记录没有数值的空凭证序号
- '对转帐列表网格内选中的TranJsq个转帐过程依次生成凭证,写到临时凭证数据表中
- For jsq = 1 To TranJsq
- '写临时凭证主表
- lng_OperationNum = CreatBillID("0102")
- Call Save_TempPz_Main(TranVouchClass(jsq), TranNum(jsq), OperationNum, lng_OperationNum)
- '对方汇总数的借贷方向
- Sqlstr = "Select ccode,TranOri from Cwzz_V_AutoItemAccCode where Trancode='" & TranNum(jsq) & "' and TranClass='" & TranClassCode & "' and ForeignFlag=0 Order by AutoTranId"
- Set Rec_AutoTranItem = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Not Rec_AutoTranItem.EOF Then
- DestTranOri = Rec_AutoTranItem.Fields("tranori")
- End If
- Jhj = 0
- Dhj = 0 '对方汇总金额
- Jhjsl = 0
- Dhjsl = 0
- JhjItemSl = 0
- DhjItemSl = 0
- I = 0
- hjje = 0 '合计金额
- '按转帐定义关系,取每笔转帐数据,写入临时数据辅表中
- Sqlstr = "select * from Cwzz_V_AutoItemAccCode where Trancode='" & TranNum(jsq) & "' and TranClass='" & TranClassCode & "' and ForeignFlag=1 ORDER BY AutoTranId"
- Set Rec_AutoTranItem = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- Do While Rec_AutoTranItem.EOF = False
- Str_Formula = Trim(Rec_AutoTranItem.Fields("ccode"))
- Str_ForeignCode = Trim(Rec_AutoTranItem.Fields("ForeigncurrCode"))
- If RecTemp.State = 1 Then RecTemp.Close
- Sqlstr = "select AdjustRate from Gy_ForeignCurrency where ForeignCurrCode='" & Str_ForeignCode & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If RecTemp.EOF = False Then
- Dec_AdjustRate = RecTemp.Fields("AdjustRate")
- End If
- If RecTemp.State = 1 Then RecTemp.Close
- Sqlstr = "select ccode,qmye,qmwb from Cwzz_AccSum where ccode='" & Str_Formula & "' and year=" & Xtyear & " and period=" & Xtmm
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If RecTemp.EOF = False Then
- Je = RecTemp.Fields("qmwb") * Dec_AdjustRate - RecTemp.Fields("qmye")
- Je = Je * IIf(Rec_AutoTranItem.Fields("tranori") = Rec_AutoTranItem.Fields("BalanceOri"), 1, -1)
- Dhj = Dhj + Je * IIf(Rec_AutoTranItem.Fields("tranori") = DestTranOri, -1, 1)
- '写临时凭证辅表
- If Je <> 0 Then
- Call Save_TempPz_Ass(lng_OperationNum, I, Trim(Rec_AutoTranItem.Fields("Digest")), Trim(Rec_AutoTranItem.Fields("Ccode")), Trim(Rec_AutoTranItem.Fields("DeptCode") & ""), Trim(Rec_AutoTranItem.Fields("PersonCode") & ""), Trim(Rec_AutoTranItem.Fields("CusCode") & ""), Trim(Rec_AutoTranItem.Fields("Suppliercode") & ""), Trim(Rec_AutoTranItem.Fields("ItemCode") & ""), Trim(Rec_AutoTranItem.Fields("TranOri")))
- End If
- End If
- Rec_AutoTranItem.MoveNext
- I = I + 1
- hjje = hjje + Je
- Loop
- '对方汇总
- Sqlstr = "Select ccode,TranOri from Cwzz_V_AutoItemAccCode where Trancode='" & TranNum(jsq) & "' and TranClass='" & TranClassCode & "' and ForeignFlag=0 Order by AutoTranId"
- Set Rec_AutoTranItem = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Rec_AutoTranItem.EOF = False Then
- DestTranOri = Rec_AutoTranItem.Fields("tranori")
- End If
- '找到数据来源为对方汇总数的转帐关系
- Sqlstr = "select * from Cwzz_V_AutoItemAccCode where Trancode='" & TranNum(jsq) & "' and TranClass='" & TranClassCode & "' and ForeignFlag=0 ORDER BY AutoTranId"
- Set Rec_AutoTranItem = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- Do While Rec_AutoTranItem.EOF = False
- Je = Dhj
- Call Save_TempPz_Ass(lng_OperationNum, I, Trim(Rec_AutoTranItem.Fields("Digest")), Trim(Rec_AutoTranItem.Fields("Ccode")), Trim(Rec_AutoTranItem.Fields("DeptCode") & ""), Trim(Rec_AutoTranItem.Fields("PersonCode") & ""), Trim(Rec_AutoTranItem.Fields("CusCode") & ""), Trim(Rec_AutoTranItem.Fields("Suppliercode") & ""), Trim(Rec_AutoTranItem.Fields("ItemCode") & ""), Trim(Rec_AutoTranItem.Fields("TranOri")))
- Rec_AutoTranItem.MoveNext
- Loop
- If Dhj = 0 Then
- '删除空凭证主从表
- Cw_DataEnvi.DataConnect.Execute "Delete From Cwzz_AccVouchSubTemp Where VouchId=lng_OperationNum"
- Cw_DataEnvi.DataConnect.Execute "Delete From Cwzz_AccVouchMainTemp Where VouchId=lng_OperationNum"
- End If
- If hjje = 0 Then '合计金额
- '删除空凭证主从表
- Sqlstr = "Delete From Cwzz_AccVouchSubTemp Where VouchId=" & lng_OperationNum
- Cw_DataEnvi.DataConnect.Execute Sqlstr
- Sqlstr = "Delete From Cwzz_AccVouchMainTemp Where VouchId=" & lng_OperationNum
- Cw_DataEnvi.DataConnect.Execute Sqlstr
- VoidStr = VoidStr + Str(jsq) + " "
- TranCount = TranCount - 1
- End If
- Next jsq
- Cw_DataEnvi.DataConnect.CommitTrans
- '没有有效凭证生成,即金额、数量均为0
- If Len(VoidStr) <> 0 Then
- Tsxx = "第" & VoidStr & "张凭证没有发生额,不需要结转!"
- Call Xtxxts(Tsxx, 0, 4)
- End If
- If TranCount > 0 Then '记录生成凭证的个数
- '记录此次转帐的批号,做为凭证窗体调用的参数
- AutoTran_PzFrm.OperationNumPz = OperationNum
- AutoTran_PzFrm.vouchsourcePz = "自动转帐"
- '调入凭证制作窗体
- AutoTran_PzFrm.Show 1
- '为在转帐过程列表的网格中重新显示制单日期和操作员,防止虽转完,但无痕迹
- Call Write_Date
- Call Clean
- End If
- Call Cxnrtcwg
- Exit Sub
- Err1:
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "转帐过程中出现未知错误,程序自动恢复保存前状态!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End Sub
- Public Sub Balance(TjMain As String, TjList As String, TjAss As String) '期末余额子过程
- Je = 0
- Sl = 0
- ItemSl = 0
- '[从科目总帐或辅助帐取年初余额
- If TjAss = "" Then
- Sqlstr = "select * from Cwzz_AccSum where " & TjMain & " and Year='" & Int_Year & "' and period='" & Xtmm & " '" '从科目总帐取月初余额"
- Else
- Sqlstr = "select * from Cwzz_AccSumAssi where " & TjMain & "and " & TjAss & " and Year='" & Int_Year & "' and period='" & Xtmm & " '" '从辅助总帐取年初余额
- End If
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- '余额赋初值
- If RecTemp.EOF = False Then
- Je = Trim(RecTemp.Fields("qcye") & "") '改为本月期初余额(bsj 2001-10-16)
- Sl = Trim(RecTemp.Fields("qcsl") & "") '改为本月期初余额(bsj 2001-10-16)
- If TjAss <> "" Then
- ItemSl = Trim(RecTemp.Fields("YcItemsl") & "")
- End If
- End If
- '[从科目总帐或辅助帐取年初余额
- '[从凭证明细取累计借方贷方发生额计算期末余额
- Sqlstr = "SELECT ccode,Debi_Je=Sum(Jfje),Debi_Sl=Sum(Jfsl),Debi_Itemsl=sum(Itemjfsl),Lender_Je=Sum(Dfje),Lender_Sl=Sum(dfsl)," & _
- "Lender_Itemsl=sum(ItemDfsl) FROM Cwzz_V_AccVouch "
- If TjAss = "" Then '无辅助项目核算
- Sqlstr = Sqlstr + " where " & TjList & ""
- Else
- Sqlstr = Sqlstr + " Where " & TjList & " and " & TjAss & ""
- End If
- '若不包含未记帐凭证,再增加一个限制
- If Chk_Vouch.Value = 0 Then
- Sqlstr = Sqlstr & " and BookFlag='1' "
- End If
- Sqlstr = Sqlstr + " and Year='" & Int_Year & "' and Period='" & Int_Period & "' group by ccode " '(取本月数 bsj 2001-10-16)
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- '计算期末余额
- If RecTemp.EOF = False Then
- Do While RecTemp.EOF = False
- Je = Je + Val(RecTemp.Fields("Debi_je") & "") - Val(RecTemp.Fields("Lender_je") & "")
- Sl = Sl + Val(RecTemp.Fields("Debi_sl") & "") - Val(RecTemp.Fields("Lender_sl") & "")
- If TjAss <> "" Then
- ItemSl = ItemSl + Val(RecTemp.Fields("Debi_Itemsl") & "") - Val(RecTemp.Fields("Lender_Itemsl") & "")
- End If
- RecTemp.MoveNext
- Loop
- End If
- ']从凭证明细取累计借方贷方发生额计算期末余额
- End Sub
- Public Sub Debi(TjList As String, TjAss As String) ''从凭证明细帐求本期借方发生额
- 'TjList为计算明细帐发生额的条件,TjAss 有辅助项目核算的条件
- Je = 0
- Sl = 0
- ItemSl = 0
- Sqlstr = "SELECT Debi_Je=Sum(Jfje),Debi_Sl=Sum(Jfsl),Debi_Itemsl=sum(Itemjfsl) " & _
- "FROM Cwzz_V_AccVouch "
- If TjAss = "" Then
- Sqlstr = Sqlstr + "where " & TjList & " "
- Else
- Sqlstr = Sqlstr + "where " & TjList & " and " & TjAss & " "
- End If
- If Chk_Vouch.Value = 0 Then '不包含未记帐凭证
- Sqlstr = Sqlstr & " and BookFlag='1'"
- End If
- Sqlstr = Sqlstr + " and Year='" & Int_Year & "' and Period='" & Int_Period & "' Group by Ccode"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If RecTemp.EOF = False Then
- Do While RecTemp.EOF = False
- Je = Je + Val(RecTemp.Fields("Debi_Je") & "")
- Sl = Sl + Val(RecTemp.Fields("Debi_Sl") & "")
- ItemSl = ItemSl + Val(RecTemp.Fields("Debi_ItemSl") & "")
- RecTemp.MoveNext
- Loop
- End If
- End Sub
- Public Sub Lender(TjList As String, TjAss As String) ''从凭证明细帐求本期贷方发生额
- 'TjList为计算明细帐发生额的条件,TjAss 有辅助项目核算的条件
- Je = 0
- Sl = 0
- ItemSl = 0
- Sqlstr = "SELECT Lender_Je=Sum(Dfje),Lender_Sl=Sum(Dfsl),Lender_ItemSl=sum(ItemDfsl) " & _
- "FROM Cwzz_V_AccVouch "
- If TjAss = "" Then
- Sqlstr = Sqlstr + "where " & TjList & " "
- Else
- Sqlstr = Sqlstr + "where " & TjList & " and " & TjAss & " "
- End If
- If Chk_Vouch.Value = 0 Then '不包含未记帐凭证
- Sqlstr = Sqlstr & " and BookFlag='1'"
- End If
- Sqlstr = Sqlstr + " and Year='" & Int_Year & "' and Period='" & Int_Period & "' Group by Ccode"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If RecTemp.EOF = False Then
- Do While RecTemp.EOF = False
- Je = Je + Val(RecTemp.Fields("Lender_Je") & "")
- Sl = Sl + Val(RecTemp.Fields("Lender_Sl") & "")
- ItemSl = ItemSl + Val(RecTemp.Fields("Lender_ItemSl") & "")
- RecTemp.MoveNext
- Loop
- End If
- End Sub
- Public Sub Balance_Sy(TjMain As String, TjList As String, TjAss As String) '期间损益结转,以明细帐为循环体求总帐中不符合条件的科目期末余额
- 'TjMain为取年初余额的条件,TjList为计算明细帐发生额的条件,TjAss 有辅助项目核算的条件
- 'Je表示期末余额,Sl表示期末余数量
- Je = 0
- Sl = 0
- ItemSl = 0
- '[从凭证明细取累计借方、贷方发生额等
- Sqlstr = "SELECT ccode,Debi_Je=Sum(Jfje),Debi_Sl=Sum(Jfsl),Lender_Je=Sum(Dfje),Lender_Sl=Sum(dfsl) FROM Cwzz_V_AccVouch "
- If TjAss = "" Then '无辅助项目核算时
- Sqlstr = Sqlstr + "Where " & TjList & " "
- Else
- Sqlstr = Sqlstr + "Where " & TjList & " and " & TjAss & " "
- End If
- '若不包含未记帐凭证,再增加一个限制
- If Chk_Vouch.Value = 0 Then
- Sqlstr = Sqlstr & " and BookFlag='1'"
- End If
- Sqlstr = Sqlstr + " and Year='" & Int_Year & "' and Period<='" & Int_Period & "' group by ccode "
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- '计算期末余额
- If RecTemp.EOF = False Then
- Je = Je + Val(RecTemp.Fields("Debi_je") & "") - Val(RecTemp.Fields("Lender_je") & "")
- Sl = Sl + Val(RecTemp.Fields("Debi_sl") & "") - Val(RecTemp.Fields("Lender_sl") & "")
- End If
- '再搜索总帐中是否存在该辅助条件的记录,若存在则不参与计算,因为在上面的明细帐汇总时已经计算过,需要剔除掉.
- If TjAss = "" Then
- Sqlstr = "SELECT * from Cwzz_AccSum where " & TjMain & " and Year='" & Int_Year & "' and period=1 " '从科目总帐取年初余额"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- Else
- Sqlstr = "select * from Cwzz_AccSumAssi where " & TjMain & "and " & TjAss & " and Year='" & Int_Year & "' and period=1" '从辅助总帐取年初余额
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- End If
- If RecTemp.EOF = False Then
- Je = 0
- Sl = 0
- End If
- End Sub
- Private Sub Save_TempPz_Main(TranVouchClass1 As String, TranNo As String, OperationNum1 As Integer, VouchIdTemp_Id As Long) '将有效数据写入临时凭证主表。(先写辅表再写主表,为了防止在主表中写入没有发生额的空凭证记录)
- Dim Rec_VouchMainTemp As New ADODB.Recordset '临时凭证主表记录集
- '打开临时凭证主表,用于存放有效凭证的凭证号等信息
- If Rec_VouchMainTemp.State = 1 Then Rec_VouchMainTemp.Close
- Rec_VouchMainTemp.Open "select * from Cwzz_AccVouchMainTemp Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With Rec_VouchMainTemp
- .AddNew
- .Fields("VouchId") = VouchIdTemp_Id '转帐过程序号
- .Fields("Year") = Int_Year '取选中的年份
- .Fields("period") = Int_Period '取选中的会计期间
- .Fields("Ddate") = Xtrq '取系统日期
- .Fields("VouchClassCode") = TranVouchClass1 '所转转帐过程的凭证类别
- .Fields("Doc") = 0
- .Fields("Bill") = Xtczy
- .Fields("VouchSource") = "自动转帐" '凭证来源
- .Fields("OperationClass") = "" '业务类型
- .Fields("BillType") = ""
- .Fields("BillNo") = TranNo '存放转帐过程编码
- .Fields("OperationNo") = OperationNum1 '存放批号
- .Fields("DeleteFlag") = IIf(Bln_DeleteFlag, 1, 0)
- .Update
- End With
- End Sub
- Private Function Tran_Pd() As Boolean '转帐之前的判断
- Dim jsq As Long '临时计数器
- '提示已转过的凭证是否再转一次
- With CzxsGrid
- For jsq = .FixedRows To .Rows - 1
- If .TextMatrix(jsq, Sydz("006", GridStr(), Szzls)) = "√" Then
- If .TextMatrix(jsq, Sydz("005", GridStr(), Szzls)) <> "" Then
- Tsxx = "第" & CzxsGrid.TextMatrix(jsq, Sydz("001", GridStr(), Szzls)) & "号已转过凭证,再转一次吗?"
- If Xtxxts(Tsxx, 1, 4) = 7 Then
- .TextMatrix(jsq, Sydz("006", GridStr(), Szzls)) = ""
- End If
- End If
- End If
- Next jsq
- End With
- '判断选择的转帐过程共几个,保存在TranJsq中。将每个转帐过程编号赋值到TranNum()数组中,
- ReDim TranNum(1) '转帐过程数组附初值
- TranJsq = 0
- With CzxsGrid
- For jsq = .FixedRows To .Rows - 1
- If .TextMatrix(jsq, Sydz("006", GridStr(), Szzls)) = "√" Then
- If TranJsq = 0 Then
- TranNum(1) = .TextMatrix(jsq, Sydz("001", GridStr(), Szzls))
- End If
- If TranJsq > 0 Then
- ReDim Preserve TranNum(UBound(TranNum) + 1)
- TranNum(TranJsq + 1) = .TextMatrix(jsq, Sydz("001", GridStr(), Szzls))
- End If
- TranJsq = TranJsq + 1
- End If
- Next jsq
- End With
- If TranJsq = 0 Then
- Tsxx = "没有选择转帐过程!"
- Call Xtxxts(Tsxx, 0, 4)
- Tran_Pd = False
- Exit Function
- End If
- Jsq_Eff = TranJsq '假设选择的转帐过程全部有效
- '将每个转帐过程的凭证类别放到数组TranVouchClass中
- ReDim TranVouchClass(1)
- For jsq = 1 To TranJsq
- Sqlstr = "SELECT * FROM Cwzz_AutoTranMain where TranCode='" & TranNum(jsq) & "'and tranclass='" & TranClassCode & "'"
- Set Rec_AutoTranMain = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If jsq > 1 Then
- ReDim Preserve TranVouchClass(UBound(TranVouchClass) + 1)
- End If
- TranVouchClass(jsq) = Trim(Rec_AutoTranMain.Fields("VouchClassCode") & "")
- Next jsq
- '取操作批号OperationNum,需唯一。
- OperationNum = CreatBillID("0102")
- RecTemp.Close
- Tran_Pd = True
- End Function
- Private Sub SeleTranBm() '报表主标题及报表编码 '定义转帐类型
- Dim gnsybm As String '功能索引编码
- Dim gnsymc As String '功能索引名称
- If TranClassCode <> "" Then Exit Sub
- Sqlstr = "Select * From Xt_xtgnb where gnmc='" & Xt_Control.tvTreeView.SelectedItem.Text & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- gnsybm = Trim(RecTemp.Fields("gnsy") & "")
- gnsymc = Trim(RecTemp.Fields("gnmc") & "")
- Select Case gnsybm
- Case "Cwzz_UserDefineTran" '"自定义转帐凭证"
- ReportTitle = gnsymc & "列表"
- TranClassCode = "01"
- Case "Cwzz_ProfitTran" '"期间损益结转"
- ReportTitle = gnsymc & "列表"
- TranClassCode = "04"
- Case "Cwzz_ModelTran" '"模式结转凭证"
- ReportTitle = gnsymc & "列表"
- TranClassCode = "05"
- Case "Cwzz_ExchangeTran"
- ReportTitle = gnsymc & "列表"
- TranClassCode = "03"
- End Select
- XtReportCode = ReportTitle
- End Sub
- Private Sub Write_Date() '写转帐日期
- Dim RecTran As ADODB.Recordset
- Set RecTran = Cw_DataEnvi.DataConnect.Execute("Select * from Cwzz_AccVouchMainTemp where OperationNo='" & OperationNum & "' and VouchNo is not null and VouchNo<>'' ")
- If RecTran.EOF = False Then
- Do While RecTran.EOF = False
- If RecTemp.State = 1 Then RecTemp.Close
- RecTemp.Open "select * from Cwzz_AutoTranMain where TranCode='" & Trim(RecTran.Fields("BillNo")) & "' and TranClass='" & TranClassCode & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- RecTemp.Fields("EndTranDate") = Xtrq
- RecTemp.Fields("Bill") = Xtczy
- RecTemp.Update
- RecTemp.Close
- RecTran.MoveNext
- Loop
- End If
- End Sub
- Private Sub Clean() '删除临时数据表数据
- If Bln_DeleteFlag = True Then
- If RecTemp.State = 1 Then RecTemp.Close
- '删除临时凭证主从表
- Cw_DataEnvi.DataConnect.Execute "Delete From Cwzz_AccVouchSubTemp Where VouchId in (select VouchId from Cwzz_AccVouchMainTemp where OperationNo='" & OperationNum & "')"
- Cw_DataEnvi.DataConnect.Execute "Delete From Cwzz_AccVouchMainTemp Where OperationNo='" & OperationNum & "'"
- End If
- End Sub
- Private Sub Run5() '执行模式转帐程序
- Dim jsq As Integer '临时计数器
- Dim serialno As Integer
- Dim lng_OperationNum As Long
- Bln_DeleteFlag = True
- If Tran_Pd = False Then
- Exit Sub
- End If
- On Error GoTo Err1
- Cw_DataEnvi.DataConnect.BeginTrans
- TranCount = TranJsq '记录生成凭证的个数
- VoidStr = "" '记录没有数值的空凭证序号
- '对转帐列表网格内选中的TranJsq个转帐过程依次生成凭证,写到临时凭证数据表中
- For jsq = 1 To TranJsq
- '定位转帐定义辅表,找到转帐编码为TranNum(jsq)的转帐关系
- Sqlstr = "select * from Cwzz_AutoTranItem where Trancode='" & TranNum(jsq) & "' and TranClass='" & TranClassCode & "' Order by AutoTranId "
- Set Rec_AutoTranItem = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Rec_AutoTranItem.EOF = True Then
- Jsq_Eff = Jsq_Eff - 1
- Else
- Jhj = 0
- Dhj = 0
- hjje = 0 '合计金额
- '写临时凭证主表
- lng_OperationNum = CreatBillID("0102")
- Call Save_TempPz_Main(TranVouchClass(jsq), TranNum(jsq), OperationNum, lng_OperationNum)
- '按转帐定义关系,取每笔转帐数据,写入临时数据辅表中
- serialno = 1
- Do While Rec_AutoTranItem.EOF = False
- Je = Round(Rec_AutoTranItem.Fields("Constant") * Rec_AutoTranItem.Fields("DistriProp") / 100, Xtjexsws)
- '写临时凭证辅表
- Call Save_TempPz_Ass(lng_OperationNum, serialno, Rec_AutoTranItem.Fields("Digest"), Rec_AutoTranItem.Fields("Ccode"), Trim(Rec_AutoTranItem.Fields("DeptCode") & ""), Trim(Rec_AutoTranItem.Fields("PersonCode") & ""), Trim(Rec_AutoTranItem.Fields("CusCode") & ""), Trim(Rec_AutoTranItem.Fields("Suppliercode") & ""), Trim(Rec_AutoTranItem.Fields("ItemCode") & ""), Trim(Rec_AutoTranItem.Fields("TranOri")))
- Rec_AutoTranItem.MoveNext
- serialno = serialno + 1
- hjje = hjje + Je
- Loop
- End If
- If hjje = 0 Then '合计金额
- '删除空凭证主从表
- Sqlstr = "Delete From Cwzz_AccVouchSubTemp Where VouchId=" & lng_OperationNum
- Cw_DataEnvi.DataConnect.Execute Sqlstr
- Sqlstr = "Delete From Cwzz_AccVouchMainTemp Where VouchId=" & lng_OperationNum
- Cw_DataEnvi.DataConnect.Execute Sqlstr
- VoidStr = VoidStr + Str(jsq) + " "
- TranCount = TranCount - 1
- End If
- Next jsq
- Cw_DataEnvi.DataConnect.CommitTrans
- '没有有效凭证生成,即金额、数量均为0
- If Len(VoidStr) <> 0 Then
- Tsxx = "第" & VoidStr & "张凭证没有发生额,不需要结转!"
- Call Xtxxts(Tsxx, 0, 4)
- End If
- If TranCount > 0 Then '记录生成凭证的个数
- '记录此次转帐的批号,做为凭证窗体调用的参数
- AutoTran_PzFrm.OperationNumPz = OperationNum
- AutoTran_PzFrm.vouchsourcePz = "自动转帐"
- '调入凭证制作窗体
- AutoTran_PzFrm.Show 1
- '为在转帐过程列表的网格中重新显示制单日期和操作员,防止虽转完,但无痕迹
- Call Write_Date
- Call Clean
- End If
- Call Cxnrtcwg
- Exit Sub
- Err1:
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "转帐过程中出现未知错误,程序自动恢复保存前状态!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End Sub
- Private Sub Save_TempPz_Ass(VouchIdTemp_Id As Long, serialnum As Integer, Str_Digest As String, Str_Kmh As String, Str_Dept As String, Str_Per As String, Str_Cus As String, Str_Sup As String, Str_Item As String, str_TranOri As String) '写临时凭证辅表
- 'VouchIdTemp_Id临时凭证主表、辅表对应关系Id号
- Dim Rec_VouchTemp As New ADODB.Recordset '临时凭证辅表记录集
- '打开临时凭证辅表,用于存放转帐凭证内容
- Rec_VouchTemp.Open "select * from Cwzz_AccVouchsubTemp where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select * from Cwzz_AccCode where Ccode='" & Str_Kmh & "'")
- With Rec_VouchTemp
- .AddNew
- '[公共信息
- If str_TranOri = "贷" Then '若记入借方
- .Fields("Dfje") = Je '贷方金额
- .Fields("Jfje") = 0
- .Fields("Jfsl") = 0
- Else
- .Fields("Jfje") = Je '借方金额
- .Fields("Dfje") = 0
- .Fields("Dfsl") = 0
- End If
- .Fields("Digest") = Str_Digest '摘要
- .Fields("Ccode") = Str_Kmh '转帐科目号
- .Fields("VouchId") = VouchIdTemp_Id '与主表的对应ID
- .Fields("serialID") = serialnum '序号ID
- ']公共信息
- If RecTemp.EOF = True Then
- Exit Sub
- End If
- '[数量信息
- If RecTemp.Fields("QuantityFlag") = True Then
- If str_TranOri = "贷" Then
- .Fields("Dfsl") = Sl '贷方数量
- .Fields("Jfsl") = 0
- Else
- .Fields("Dfsl") = 0
- .Fields("Jfsl") = Sl
- End If
- Else
- .Fields("Jfsl") = 0
- .Fields("Dfsl") = 0
- End If
- ']数量信息
- '[项目信息
- If RecTemp.Fields("ItemFlag") = True Then
- If str_TranOri = "贷" Then
- .Fields("ItemDfsl") = ItemSl
- .Fields("ItemJfsl") = 0
- Else
- .Fields("ItemDfsl") = 0
- .Fields("ItemJfsl") = ItemSl
- End If
- .Fields("ItemClassCode") = RecTemp.Fields("ItemClassCode")
- .Fields("ItemCode") = Str_Item
- Else
- .Fields("ItemJfsl") = 0
- .Fields("ItemDfsl") = 0
- End If
- ']项目信息
- '[辅助信息
- If RecTemp.Fields("PersonFlag") = True Then
- .Fields("PersonCode") = Str_Per '个人
- End If
- If RecTemp.Fields("DeptFlag") = True Then
- .Fields("DeptCode") = Str_Dept '部门
- End If
- If RecTemp.Fields("CusFlag") = True Then
- .Fields("CusCode") = Str_Cus '客户
- End If
- If RecTemp.Fields("SupplierFlag") = True Then
- .Fields("Suppliercode") = Str_Sup '供应商
- End If
- ']辅助信息
- '[币别信息
- .Fields("AccRate") = 1
- .Fields("ForeignCurrCode") = XtSCurrCode
- If str_TranOri = "贷" Then '若记入借方
- .Fields("WbDfje") = Je
- .Fields("WbJfje") = 0
- Else
- .Fields("WbJfje") = Je
- .Fields("WbDfje") = 0
- End If
- ']币别信息
- '[银行结算信息
- .Fields("SScode") = ""
- .Fields("BillNo") = ""
- .Fields("TranPerson") = ""
- ']银行结算信息
- .Update
- End With
- End Sub
- Private Sub Run4() '期间损益结转、管理费用差额结转
- Dim Tj_Main As String '总帐取数公式
- Dim Tj_List As String '明细帐取数公式
- Dim Tj_Ass As String '辅助帐取数公式
- Dim jsq As Integer '临时计数器
- Dim I As Integer '凭证序列号
- Dim Rec_AccCcode As New ADODB.Recordset '会计科目记录集
- Dim Rec_AccAss As New ADODB.Recordset '总辅助帐
- Dim Rec_AccList As New ADODB.Recordset '明细帐
- Dim RecAssType As ADODB.Recordset '判断转帐科目有几种辅助核算时用
- Dim lng_OperationNum As Long
- Bln_DeleteFlag = True
- If Tran_Pd = False Then
- Exit Sub
- End If
- On Error GoTo Err1
- Cw_DataEnvi.DataConnect.BeginTrans
- TranCount = TranJsq '记录生成凭证的个数
- VoidStr = "" '记录没有数值的空凭证序号
- '对转帐列表网格内选中的TranJsq个转帐过程依次生成凭证,写到临时凭证数据表中
- For jsq = 1 To TranJsq
- 'VouchIdTemp=jsq + OperationNum 为了确保VouchIdTemp每次生成时唯一
- '借方或贷方有有效数据时,写临时凭证主表,否则有效转帐过程-1
- lng_OperationNum = CreatBillID("0102")
- Call Save_TempPz_Main(TranVouchClass(jsq), TranNum(jsq), OperationNum, lng_OperationNum)
- '定位转帐定义辅表,找到转帐编码为TranNum(jsq)的转帐关系(把对方汇总数除外)
- Sqlstr = "select * from Cwzz_AutoTranItem where Trancode='" & TranNum(jsq) & "' and TranClass='" & TranClassCode & "' and FormulaCode<>'05' order by AutoTranId"
- Set Rec_AutoTranItem = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- I = 1
- If Rec_AutoTranItem.EOF = False Then
- Jhj = 0
- Dhj = 0
- Jhjsl = 0
- Dhjsl = 0
- hjje = 0 '合计金额
- Do While Rec_AutoTranItem.EOF = False '转帐关系定义数据记录集
- Tj_Main = "Ccode='" & Trim(Rec_AutoTranItem.Fields("GetCcode") & "") & "'"
- Tj_List = Tj_Main
- Sqlstr = "Select * from Cwzz_AccCode Where " & Tj_Main & ""
- Set RecAssType = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If RecAssType.EOF = False Then '转帐科目是否存在
- If RecAssType.Fields("stopflag") <> True Then '若该科目没有停用
- '若该科目不参与任何辅助核算
- If Trim(RecAssType.Fields("DeptFlag") & "") <> True And Trim(RecAssType.Fields("PersonFlag") & "") <> True And Trim(RecAssType.Fields("CusFlag") & "") <> True And Trim(RecAssType.Fields("SupplierFlag") & "") <> True And Trim(RecAssType.Fields("ItemFlag") & "") <> True Then
- TjAss = ""
- Call Balance(Tj_Main, Tj_List, Tj_Ass)
- If Rec_AutoTranItem.Fields("TranOri") = "借" Then
- Je = -Je
- Sl = -Sl
- ItemSl = -ItemSl
- End If
- If Je <> 0 Or SJ <> 0 Or ItemSl <> 0 Then
- If Rec_AutoTranItem.Fields("TranOri") = "借" Then
- Jhj = Jhj + Je
- Else
- Dhj = Dhj + Je
- End If
- Call Save_TempPz_Ass(lng_OperationNum, I, Rec_AutoTranItem.Fields("Digest"), Rec_AutoTranItem.Fields("Ccode"), "", "", "", "", "", Rec_AutoTranItem.Fields("TranOri"))
- I = I + 1
- End If
- Else
- If Chk_Vouch.Value = 1 Then '包含未记帐凭证
- Sqlstr = " SELECT DeptCode, PersonCode, CusCode, Suppliercode, ItemClassCode, ItemCode,b.Qmye , b.Qmsl, b.QmItemSl From " & _
- "(SELECT DeptCode, PersonCode, CusCode, Suppliercode, ItemClassCode,ItemCode, Qmye = SUM(YcyeHj + Jfljjehj - Dfljjehj),Qmsl = SUM(Ycslhj + Jfljslhj - Dfljslhj),QmItemSl = Sum(YcItemslHj + JfljItemslhj - DfljItemslhj) From " & _
- "((SELECT DeptCode, PersonCode, CusCode, Suppliercode, ItemClassCode,ItemCode, YcyeHj = SUM(Ycye), Ycslhj = SUM(Ycsl),YcItemSlHj = SUM(YcItemSl), JfljjeHj = 0, Dfljjehj = 0, Jfljslhj = 0,Dfljslhj = 0, JfljItemslhj = 0, DfljItemslhj = 0 From Cwzz_AccSumAssi " & _
- " WHERE " & Tj_Main & " AND Year ='" & Int_Year & "' AND Period = 1 GROUP BY DeptCode, PersonCode, CusCode, Suppliercode,ItemClassCode, ItemCode) Union All " & _
- "(SELECT DeptCode, PersonCode, CusCode, Suppliercode, ItemClassCode,ItemCode, YcyeHJ = 0, Ycslhj = 0, YcItemslHj = 0, JfljjeHj = SUM(Jfje),Dfljjehj = SUM(Dfje), Jfljslhj = SUM(Jfsl), Dfljslhj = SUM(Dfsl),JfljItemslhj = SUM(ItemJfsl), DfljItemslhj = SUM(ItemDfsl) From Cwzz_V_AccVouch " & _
- " WHERE " & Tj_Main & " AND Year ='" & Int_Year & "' AND Period <='" & Int_Period & "' GROUP BY DeptCode, PersonCode, CusCode, Suppliercode, ItemClassCode,ItemCode)) a GROUP BY DeptCode, PersonCode, CusCode, Suppliercode, ItemClassCode, ItemCode) b ORDER BY DeptCode, PersonCode, CusCode, Suppliercode, ItemClassCode, ItemCode "
- Else
- Sqlstr = "Select DeptCode,PersonCode,CusCode,Suppliercode,ItemClassCode,ItemCode,Qmye,Qmsl,QmItemSl From Cwzz_AccSumAssi Where " & Tj_Main & " And Year='" & Int_Year & "' And Period='" & Int_Period & "' order by DeptCode,PersonCode,CusCode,Suppliercode,ItemClassCode,ItemCode"
- End If
- Set Rec_AccAss = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Rec_AccAss.EOF = False Then
- Do While Rec_AccAss.EOF = False
- aa = Trim(Rec_AccAss.Fields("DeptCode") & "")
- '计算该科目下的所有部门个人等的期末余额
- Je = Rec_AccAss.Fields("Qmye")
- Sl = Rec_AccAss.Fields("Qmsl")
- ItemSl = Rec_AccAss.Fields("QmItemSl")
- If Rec_AutoTranItem.Fields("TranOri") = "借" Then
- Je = -Je
- Sl = -Sl
- ItemSl = -ItemSl
- End If
- '[写临时凭证,并计算借、贷方合计
- If Je <> 0 Or Sl <> 0 Or ItemSl <> 0 Then
- If Rec_AutoTranItem.Fields("TranOri") = "借" Then
- Jhj = Jhj + Je
- Jhjsl = Jhjsl + Sl
- Else
- Dhj = Dhj + Je
- Dhjsl = Dhjsl + Sl
- End If
- Call Save_TempPz_Ass(lng_OperationNum, I, Rec_AutoTranItem.Fields("Digest"), Rec_AutoTranItem.Fields("Ccode"), Trim(Rec_AccAss.Fields("DeptCode") & ""), Trim(Rec_AccAss.Fields("PersonCode") & ""), Trim(Rec_AccAss.Fields("CusCode") & ""), Trim(Rec_AccAss.Fields("Suppliercode") & ""), Trim(Rec_AccAss.Fields("ItemCode") & ""), Rec_AutoTranItem.Fields("TranOri"))
- I = I + 1
- End If
- Rec_AccAss.MoveNext
- Loop
- End If '总辅助帐计算后记录集不为空
- End If '有无辅助核算
- End If '科目没有停用
- End If '转帐科目是否存在
- Rec_AutoTranItem.MoveNext
- hjje = hjje + Je
- Loop
- '[“对方汇总数”的转帐关系
- Sqlstr = "select * from Cwzz_AutoTranItem where Trancode='" & TranNum(jsq) & "' and TranClass='" & TranClassCode & "' and FormulaCode='05'"
- Set Rec_AutoTranItem = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Rec_AutoTranItem.EOF = False And Abs(Jhj - Dhj) > 0.001 Then
- Je = Jhj - Dhj
- If Rec_AutoTranItem.Fields("TranOri") = "借" Then
- Je = -Je
- End If
- Sl = 0
- ItemSl = 0
- Call Save_TempPz_Ass(lng_OperationNum, I, Rec_AutoTranItem.Fields("Digest"), Rec_AutoTranItem.Fields("Ccode"), Trim(Rec_AutoTranItem.Fields("DeptCode") & ""), Trim(Rec_AutoTranItem.Fields("PersonCode") & ""), Trim(Rec_AutoTranItem.Fields("CusCode") & ""), Trim(Rec_AutoTranItem.Fields("Suppliercode") & ""), Trim(Rec_AutoTranItem.Fields("ItemCode") & ""), Rec_AutoTranItem.Fields("TranOri"))
- I = I + 1
- End If
- ']“对方汇总数”的转帐关系
- End If
- If hjje = 0 Then '合计金额
- '删除空凭证主从表
- Sqlstr = "Delete From Cwzz_AccVouchSubTemp Where VouchId=" & lng_OperationNum
- Cw_DataEnvi.DataConnect.Execute Sqlstr
- Sqlstr = "Delete From Cwzz_AccVouchMainTemp Where VouchId=" & lng_OperationNum
- Cw_DataEnvi.DataConnect.Execute Sqlstr
- VoidStr = VoidStr + Str(jsq) + " "
- TranCount = TranCount - 1
- End If
- Next jsq
- Cw_DataEnvi.DataConnect.CommitTrans
- '没有有效凭证生成,即金额、数量均为0
- If Len(VoidStr) <> 0 Then
- Tsxx = "第" & VoidStr & "张凭证没有发生额或余额,不需要结转!"
- Call Xtxxts(Tsxx, 0, 4)
- End If
- If TranCount > 0 Then '记录生成凭证的个数
- '记录此次转帐的批号,做为凭证窗体调用的参数
- AutoTran_PzFrm.OperationNumPz = OperationNum
- AutoTran_PzFrm.vouchsourcePz = "自动转帐"
- '调入凭证制作窗体
- AutoTran_PzFrm.Show 1
- '为在转帐过程列表的网格中重新显示制单日期和操作员,防止虽转完,但无痕迹
- Call Write_Date
- Call Clean
- End If
- Call Cxnrtcwg
- Exit Sub
- Err1:
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "转帐过程中出现未知错误,程序自动恢复保存前状态!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End Sub
- '******************以下为基本处理程序(固定不变)************************'
- Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) '支持热键操作
- If Shift = 2 Then
- Select Case UCase(Chr(KeyCode))
- Case "P" 'Ctrl+P 打印
- Call bbyl(False)
- Case "I" 'Ctrl+I 增加
- Call Toolbjzt
- Lrzt = 1
- Call Cshlrxx(Lrzt)
- LrText(0).SetFocus
- LrText(0).Locked = False
- Case "D" 'Ctrl+D 删除
- Call Scdqjl
- End Select
- End If
- 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 "zj" '增 加
- Call Toolbjzt
- Lrzt = 1
- Call Cshlrxx(Lrzt)
- LrText(0).SetFocus
- LrText(0).Locked = False
- Case "xg" '修 改
- Call Xgdqjl
- Case "sc" '删 除
- Call Scdqjl
- Case "fq" '取 消
- Call Toolfbjzt
- Case "sx" '刷 新
- Call Cxnrtcwg
- Case "bz" '帮 助
- Call F1bz
- Case "fh" '退 出
- Unload Me
- '[自定义
- Case "run"
- '[>>计算会计期间
- Int_Year = Val(Mid(Combo_Kjqj.Text, 1, 4))
- Int_Period = Val(Mid(Combo_Kjqj.Text, 6, 2))
- '<<]
- Select Case TranClassCode
- Case "01" '执行自定义转帐凭证
- Call Run1
- Case "04" '执行期间损益
- Call Run4
- Case "05" '模式转帐凭证
- Call Run5
- Case "03" '汇兑损益凭证
- Call Run3
- End Select
- Case "define" '定义转帐凭证
- Call Define
- '自定义]
- End Select
- End Sub
- Private Sub CzxsGrid_DblClick() '修改当前编码记录
- With CzxsGrid
- If .Row < .FixedRows Then
- Exit Sub
- End If
- If GridStr(.Col, 1) <> "006" Then
- Call Xgdqjl
- Else
- If .TextMatrix(.Row, Sydz("006", GridStr(), Szzls)) = "√" Then
- .TextMatrix(.Row, Sydz("006", GridStr(), Szzls)) = ""
- Else
- .TextMatrix(.Row, Sydz("006", GridStr(), Szzls)) = "√"
- End If
- End If
- End With
- End Sub
- Private Sub Xgdqjl() '修改当前编码记录
- If CzxsGrid.Row < CzxsGrid.FixedRows Then
- Exit Sub
- End If
- Call Toolbjzt
- Lrzt = 2
- Call Cshlrxx(Lrzt)
- LrText(1).SetFocus
- LrText(0).Locked = True
- End Sub
- Private Sub Toolbjzt() 'Toolbar状态(编辑状态)
- StTab.TabEnabled(1) = True
- StTab.Tab = 1
- Frame1.Enabled = True
- StTab.TabEnabled(0) = False
- CzxsGrid.Enabled = False
- With SzToolbar
- .Buttons("ymsz").Enabled = False
- .Buttons("dy").Enabled = False
- .Buttons("yl").Enabled = False
- .Buttons("zj").Enabled = False
- .Buttons("xg").Enabled = False
- .Buttons("sc").Enabled = False
- '[自定义
- .Buttons("define").Enabled = False
- .Buttons("run").Enabled = False
- '自定义]
- End With
- '[自定义
- With GsToolbar
- .Buttons("bcgs").Enabled = False
- .Buttons("hfmrgs").Enabled = False
- .Buttons("szxsxm").Enabled = False
- End With
- '自定义]
- End Sub
- Private Sub Toolfbjzt() 'Toolbar状态(非编辑状态)
- StTab.TabEnabled(0) = True
- StTab.Tab = 0
- CzxsGrid.Enabled = True
- Frame1.Enabled = False
- StTab.TabEnabled(1) = False
- Lrzt = 0
- With SzToolbar
- .Buttons("ymsz").Enabled = True
- .Buttons("dy").Enabled = True
- .Buttons("yl").Enabled = True
- .Buttons("zj").Enabled = True
- .Buttons("xg").Enabled = True
- .Buttons("sc").Enabled = True
- '[自定义
- .Buttons("define").Enabled = True
- .Buttons("run").Enabled = True
- '自定义]
- End With
- '[自定义
- With GsToolbar
- .Buttons("bcgs").Enabled = True
- .Buttons("hfmrgs").Enabled = True
- .Buttons("szxsxm").Enabled = True
- End With
- '自定义]
- End Sub
- Private Sub BcCommand_Click() '保 存
- If Not Bclrsj Then
- Exit Sub
- End If
- If Lrzt = 2 Then '修改编辑状态
- Call Toolfbjzt
- End If
- End Sub
- Private Sub QxCommand_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) '取消
- '避免执行Click程序
- Bln_Cancel = True
- Call Cancel
- End Sub
- Private Sub QxCommand_Click() '取消
- If Bln_Cancel Then
- Bln_Cancel = False
- Exit Sub
- End If
- Call Cancel
- End Sub
- Private Sub Cancel() '取消
- '文本框加锁
- For Jsqte = 0 To Max_Text_Index
- TextValiJudgeLock(Jsqte) = True '光标离开不必进行有效性判断
- Next Jsqte
- Call Toolfbjzt
- 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())
- Case "szxsxm" '设置显示项目
- Call Szxsxm(CzxsGrid, GridCode)
- End Select
- 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(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 Wbklrwbcl(Index As Integer) '文本框录入事后处理程序
- '以下为依据实际情况自定义部分[
- '在此填写文本框录入事后处理程序
- SendKeys "vbtab"
- ']以上为依据实际情况自定义部分
- End Sub
- Private Sub LrText_Change(Index As Integer)
- '屏蔽程序改变控制
- If TextChangeLock Then
- Exit Sub
- End If
- TextValiJudgeLock(Index) = False '打开有效性判断锁
- '限制字段录入长度
- TextChangeLock = True '加锁(防止执行Lrtext_Change)
- Select Case Textint(Index, 1) '文本框索引值
- Case 8 '金额型
- Call Sjgskz(LrText(Index), Xtjezws - Xtjexsws - 1, Xtjexsws)
- Case 9 '数量型
- Call Sjgskz(LrText(Index), Xtslzws - Xtslxsws - 1, Xtslxsws)
- Case 10 '单价型
- Call Sjgskz(LrText(Index), Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
- Case Else '其他小数类型控制
- If Textint(Index, 6) <> 0 Or Textint(Index, 7) <> 0 Then '字段小数位个数、整数位个数。
- Call Sjgskz(LrText(Index), Textint(Index, 6), Textint(Index, 7))
- End If
- End Select
- TextChangeLock = False '解锁
- End Sub
- Private Sub LrText_GotFocus(Index As Integer) '文本框得到焦点,显示相应信息
- Call TextShow(Index)
- CurTextIndex = Index
- LrText(Index).SelStart = Len(LrText(Index))
- End Sub
- Private Sub LrText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) '字段按F2键提供帮助
- Select Case KeyCode
- Case vbKeyF2
- Call Text_Help(Index)
- End Select
- End Sub
- Private Sub LrText_KeyPress(Index As Integer, KeyAscii As Integer) '文本框录入事中控制
- Call InputFieldLimit(LrText(Index), Textint(Index, 1), KeyAscii)
- End Sub
- Private Sub LrText_LostFocus(Index As Integer) '文本框失去焦点进行有效性判断及相应处理
- If Textint(Index, 9) = 0 Or Textint(Index, 9) = 1 Then '事中判断
- Call TextYxxpd(Index)
- End If
- End Sub
- Private Sub Ydcommand1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single) '按钮提供帮助
- Call Text_Help(Index)
- End Sub
- Private Sub Text_Help(Index As Integer) '录入字段帮助
- If Not Textboolean(Index, 1) Then
- Exit Sub
- End If
- TextValiJudgeLock(Index) = True '按帮助按纽时,不进行有效性判断
- '先进行有效性判断
- If Not TextYxxpd(CurTextIndex) Then
- Exit Sub
- End If
- Call Drbmhelp(Textint(Index, 2), Textstr(Index, 4), Trim(LrText(Index).Text)) '帮助类型,帮助编码(HelpCode),文本框录入内容
- If Len(Xtfhcs) <> 0 Then
- If Textint(Index, 3) = 1 Then '如果返回显示名称
- LrText(Index).Text = Xtfhcsfz
- LrText(Index).Tag = Xtfhcs
- Else '如果返回显示编码
- LrText(Index).Text = Xtfhcs
- LrText(Index).Tag = Xtfhcsfz
- End If
- End If
- TextValiJudgeLock(Index) = False
- LrText(Index).SetFocus
- End Sub
- Private Sub TextShow(Index As Integer) '文本框得到焦点,显示相应信息
- '填写文本框得到焦点,进行相应信息处理程序
- '可以填写帮助按纽显示并调整位置。
- End Sub
- Private Function TextYxxpd(Index As Integer) As Boolean '文本框有效性判断,数据的正确性
- '可以补充自定义限制
- If TextValiJudgeLock(Index) Then '=True文本框内容不需进行有效性判断时,退出
- TextYxxpd = True
- Exit Function
- End If
- If Trim(LrText(Index)) = "" Then
- LrText(Index).Tag = ""
- Call Wbklrwbcl(Index)
- TextValiJudgeLock(Index) = True '文本框内容不需进行有效性判断时,退出
- TextYxxpd = True
- Exit Function
- End If
- Select Case Textint(Index, 4)
- Case 1 '编码型
- Sqlstr = Trim(Textstr(Index, 5)) '有效性判断依据有内容时
- Sqlstr = Replace(Sqlstr, "@", "'" + Trim(LrText(Index).Text) + "'")
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If RecTemp.EOF Then
- Call Xtxxts(Trim(Textstr(Index, 6)), 0, 1)
- LrText(Index).SetFocus
- Exit Function
- Else
- Select Case Textint(Index, 3) '显示编码还是显示名称
- Case 0 '显示编码
- If Len(Trim(Textstr(Index, 2))) <> 0 Then
- LrText(Index).Text = Trim(RecTemp.Fields(Trim(Textstr(Index, 2))))
- End If
- If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
- LrText(Index).Tag = Trim(RecTemp.Fields(Trim(Textstr(Index, 3))))
- End If
- Case 1 '显示名称
- If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
- LrText(Index).Text = Trim(RecTemp.Fields(Trim(Textstr(Index, 3))))
- End If
- If Len(Trim(Textstr(Index, 2))) <> 0 Then
- LrText(Index).Tag = Trim(RecTemp.Fields(Trim(Textstr(Index, 2))))
- End If
- End Select
- End If
- Case 2 '日期型
- If IsDate(LrText(Index).Text) Then
- LrText(Index).Text = Format(LrText(Index).Text, "yyyy-mm-dd")
- Else
- Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(Index).SetFocus
- Exit Function
- End If
- Case 3 '其他类型
- End Select
- TextValiJudgeLock(Index) = True
- TextYxxpd = True
- End Function