资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:35k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{65A39231-6133-11D1-BAA2-444553540000}#1.0#0"; "VSLIGHT6.OCX"
- Object = "{C5DE3F80-3376-11D2-BAA4-04F205C10000}#1.0#0"; "VSFLEX6D.OCX"
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Begin VB.Form XJ_XJLLB
- Caption = "现金流量表"
- ClientHeight = 5940
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 9645
- LinkTopic = "Form1"
- ScaleHeight = 5940
- ScaleWidth = 9645
- StartUpPosition = 2 '屏幕中心
- WindowState = 2 'Maximized
- Begin VB.Timer Timer1
- Enabled = 0 'False
- Interval = 1
- Left = 7080
- Top = 90
- End
- Begin VB.PictureBox Pic_Title
- Height = 1125
- Left = 0
- Picture = "现金流量表.frx":0000
- ScaleHeight = 1065
- ScaleWidth = 11535
- TabIndex = 1
- Top = 570
- Width = 11595
- Begin VB.ComboBox Combo1
- Height = 300
- Left = 6180
- TabIndex = 10
- Text = "Combo1"
- Top = 720
- Width = 2445
- End
- Begin VB.Label Label2
- BackStyle = 0 'Transparent
- Caption = "编制单位:沧化集团"
- Height = 255
- Left = 750
- TabIndex = 9
- Top = 780
- Width = 3525
- End
- Begin VB.Label tsLabel
- BackColor = &H80000018&
- BackStyle = 0 'Transparent
- Caption = "现金流量表"
- BeginProperty Font
- Name = "隶书"
- Size = 15.75
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 360
- Index = 4
- Left = 390
- TabIndex = 6
- Top = 90
- Width = 2355
- End
- Begin VB.Label Lab_TitleMess
- BackStyle = 0 'Transparent
- Caption = "会计期间:"
- Height = 225
- Index = 0
- Left = 5160
- TabIndex = 5
- Top = 780
- Width = 915
- End
- Begin VB.Label Lab_TitleText
- BackStyle = 0 'Transparent
- ForeColor = &H00FF0000&
- Height = 225
- Index = 0
- Left = 2040
- TabIndex = 4
- Top = 480
- Width = 735
- End
- Begin VB.Label Lab_TitleText
- BackStyle = 0 'Transparent
- ForeColor = &H00FF0000&
- Height = 225
- Index = 1
- Left = 3840
- TabIndex = 3
- Top = 480
- Width = 1755
- End
- Begin VB.Label Lab_TitleText
- BackStyle = 0 'Transparent
- ForeColor = &H00FF0000&
- Height = 225
- Index = 2
- Left = 7290
- TabIndex = 2
- Top = 240
- Width = 1875
- End
- End
- Begin MSComctlLib.Toolbar GsToolbar
- Height = 525
- Left = 6990
- TabIndex = 0
- Top = -30
- Width = 2595
- _ExtentX = 4577
- _ExtentY = 926
- ButtonWidth = 1455
- ButtonHeight = 926
- 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 VSFlex6DAOCtl.vsFlexGrid CxbbGrid
- Height = 6885
- Left = 30
- TabIndex = 7
- Top = 1710
- Width = 11715
- _ExtentX = 20664
- _ExtentY = 12144
- _ConvInfo = 1
- 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 = -2147483636
- BackColorAlternate= 16777215
- GridColor = -2147483633
- GridColorFixed = -2147483632
- TreeColor = -2147483632
- FloodColor = 192
- SheetBorder = -2147483642
- FocusRect = 1
- HighLight = 1
- AllowSelection = -1 'True
- AllowBigSelection= -1 'True
- AllowUserResizing= 3
- SelectionMode = 0
- GridLines = 1
- GridLinesFixed = 2
- GridLineWidth = 1
- Rows = 50
- Cols = 10
- FixedRows = 1
- FixedCols = 0
- RowHeightMin = 250
- 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 MSComctlLib.Toolbar SzToolbar
- Align = 1 'Align Top
- Height = 555
- Left = 0
- TabIndex = 8
- Top = 0
- Width = 9645
- _ExtentX = 17013
- _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 = 6
- 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}
- Caption = "帮助"
- Key = "bz"
- ImageKey = "bz"
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- ImageKey = "tc"
- EndProperty
- EndProperty
- BorderStyle = 1
- Begin MSComctlLib.ImageList ImageList1
- Left = 5820
- Top = 0
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 32
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":340C4
- Key = "sz"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":3445E
- Key = "dy"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":347F8
- Key = "yl"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":34B92
- Key = "xg"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":34F2C
- Key = "zh"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":352C6
- Key = "sh"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":35660
- Key = "bc"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":359FA
- Key = "fq"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":35D94
- Key = "bz"
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":3612E
- Key = "tc"
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":364C8
- Key = "bcgs"
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":36862
- Key = "mrlk"
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":36BFC
- Key = "xsxm"
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":36F96
- Key = "first"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":37330
- Key = "prev"
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":376CA
- Key = "next"
- EndProperty
- BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":37A64
- Key = "last"
- EndProperty
- BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":37DFE
- Key = "xx"
- EndProperty
- BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":38198
- Key = "define"
- EndProperty
- BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":38532
- Key = "exec"
- EndProperty
- BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":388CC
- Key = "xz"
- EndProperty
- BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":38C66
- Key = "sc"
- EndProperty
- BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":39000
- Key = "sx"
- EndProperty
- BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":3939A
- Key = "cx"
- EndProperty
- BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":39734
- Key = "zd"
- EndProperty
- BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":39ACE
- Key = "dz"
- EndProperty
- BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":39E68
- Key = "ph"
- EndProperty
- BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":3A202
- Key = "fz"
- EndProperty
- BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":3A59C
- Key = "dw"
- EndProperty
- BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":3A936
- Key = "hf"
- EndProperty
- BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":3ACD0
- Key = "pz"
- EndProperty
- BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "现金流量表.frx":3B06A
- Key = "check"
- EndProperty
- EndProperty
- End
- End
- End
- Attribute VB_Name = "XJ_XJLLB"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Dim Dyymctbl As New DY_Dyymsz '打印页面窗体变量
- Private Sub Combo1_Click()
- Call Sub_xjllsc
- End Sub
- Private Sub Form_Load() '计算现金流量表
- Dim RecAdoYear As New ADODB.Recordset '定义数据库
- If RecAdoYear.State = 1 Then RecAdoYear.Close
- RecAdoYear.Open "select period,year from cwzz_cashflowdata group by period ,year", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- Do While Not RecAdoYear.EOF()
- Combo1.AddItem Trim(RecAdoYear.Fields!Year) + "-" + Trim(RecAdoYear.Fields!Period)
- RecAdoYear.MoveNext
- Loop
- Combo1.Text = Format(XT_login.CzrqText.Text, "yyyy-mm")
- '调入打印页面设置窗体
- XtReportCode = "c_xjllb"
- Load Dyymctbl
- ReportTitle = "现金流量表"
- '调整标题栏及网格、格式工具条位置
- Pic_Title.Left = 40
- Pic_Title.Top = SzToolbar.Top + SzToolbar.Height - 10
- CxbbGrid.Left = Pic_Title.Left
- CxbbGrid.Top = Pic_Title.Top + Pic_Title.Height + 20
- CxbbGrid.ColHidden(0) = True
- Call Sub_xjllsc
- 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 "fh" '退 出
- Unload Me
- 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) = "编制单位:沧化集团" + Space(23) + "会计期间:" + Combo1.Text
- bbxbtzzxs(1) = 0 '报表行组织形式(0-居左 1-居中 2-居右)
- Call Scyxsjb(CxbbGrid) '生成报表数据
- Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
- If Not bbylte Then
- Unload DY_Tybbyldy
- End If
- End Sub
- Private Sub Form_Unload(Cancel As Integer) '窗体卸载
- '卸载打印页面设置窗体
- Unload Dyymctbl
- End Sub
- Sub Sub_xjllsc() '现金流量表生成
- Dim First As Double, Second As Double, SumValue As Double, SumValueYear As Double, OperateFirst As String, OperateSecond As String
- Dim Jsqte As Integer, FirstFlag As Boolean, OperateFlag As Boolean '定义变量
- Dim RecTemp As New ADODB.Recordset, RecAdo As New ADODB.Recordset, recData As New ADODB.Recordset, RecAdoYear As New ADODB.Recordset '定义数据库
- Dim i As Integer '定义网各行
- On Error Resume Next
- CxbbGrid.Clear
- SumValue = 0
- FirstFlag = False
- OperateFlag = False
- If RecTemp.State = 1 Then RecTemp.Close
- RecTemp.Open "select * from cwzz_cashflowitem order by logicid", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic '取出现金流量项目
- CxbbGrid.Rows = 1
- CxbbGrid.Cols = 5
- CxbbGrid.FormatString = "编 码|项 目|行 次|本月数|本年累计"
- CxbbGrid.FixedAlignment(1) = flexAlignCenterCenter
- CxbbGrid.FixedAlignment(2) = flexAlignCenterCenter
- CxbbGrid.FixedAlignment(3) = flexAlignCenterCenter
- CxbbGrid.FixedAlignment(4) = flexAlignCenterCenter
- i = 1
- Do While Not RecTemp.EOF() '循环查找数据
- If i >= CxbbGrid.Rows - 1 Then
- CxbbGrid.AddItem ""
- CxbbGrid.ColWidth(1) = 5000
- CxbbGrid.ColWidth(2) = 600
- CxbbGrid.ColWidth(3) = 2500
- CxbbGrid.ColWidth(4) = 2500
- CxbbGrid.ColAlignment(2) = flexAlignCenterCenter
- End If
- CxbbGrid.TextMatrix(i, 0) = RecTemp.Fields!CASHFLOWCODE
- CxbbGrid.TextMatrix(i, 1) = RecTemp.Fields!CASHFLOWNAME
- If RecTemp.Fields!RowNo = 0 Then
- CxbbGrid.TextMatrix(i, 2) = ""
- Else
- CxbbGrid.TextMatrix(i, 2) = RecTemp.Fields!RowNo
- End If
- If Trim(RecTemp.Fields!DataSource) = "" Then '如果为空
- If RecAdo.State = 1 Then RecAdo.Close
- RecAdo.Open "select sum(fpje) as fpje from cwzz_cashflowdata where cashflowid='" & Trim(RecTemp.Fields!CASHFLOWCODE) & "'and year='" & Format(Combo1.Text, "yyyy") & "' and period='" & Format(Combo1.Text, "mm") & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If RecAdo.EOF = False Then
- If IsNull(RecAdo.Fields!fpje) = False Then
- CxbbGrid.TextMatrix(i, 3) = Format(RecAdo.Fields!fpje, "#,###.00")
- Else
- CxbbGrid.TextMatrix(i, 3) = ""
- End If
- End If
- If RecAdoYear.State = 1 Then RecAdoYear.Close
- RecAdoYear.Open "select sum(fpje) as fpje from cwzz_cashflowdata where cashflowid='" & Trim(RecTemp.Fields!CASHFLOWCODE) & "'and year='" & Format(Combo1.Text, "yyyy") & "' and period<='" & Format(Combo1.Text, "mm") & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If RecAdoYear.EOF = False Then
- If IsNull(RecAdoYear.Fields!fpje) = False Then
- CxbbGrid.TextMatrix(i, 4) = Format(RecAdoYear.Fields!fpje, "#,###.00")
- Else
- CxbbGrid.TextMatrix(i, 4) = ""
- End If
- End If
- Else '从网格中直接取数
- SumValue = 0
- FirstFlag = False
- OperateFlag = False
- For Jsqte = 1 To Len(Trim(RecTemp.Fields!DataSource))
- If Mid(Trim(RecTemp.Fields!DataSource), Jsqte, 1) >= "0" And Mid(Trim(RecTemp.Fields!DataSource), Jsqte, 1) <= "9" Then
- If Not FirstFlag Then
- First = First & Mid(Trim(RecTemp.Fields!DataSource), Jsqte, 1)
- Else
- Second = Second & Mid(Trim(RecTemp.Fields!DataSource), Jsqte, 1)
- End If
- Else
- If Not OperateFlag Then
- OperateFirst = Mid(Trim(RecTemp.Fields!DataSource), Jsqte, 1)
- Else
- OperateSecond = Mid(RecTemp.Fields!DataSource, Jsqte, 1)
- End If
- If FirstFlag = False Then FirstFlag = True
- If OperateFlag Then
- Dim FirstFpje, SecondFpje, FirstFpjeYear, SecondFpjeYear
- Select Case OperateFirst
- Case "+"
- If FirstFlag Then
- If RecAdo.State = 1 Then RecAdo.Close
- RecAdo.Open "select * from cwzz_cashflowitem where rowno='" & First & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If RecAdo.EOF = False Then
- If Trim(RecAdo.Fields!CASHFLOWCODE) <> "" Then
- First = RecAdo.Fields!CASHFLOWCODE
- End If
- End If
- If recData.State = 1 Then recData.Close
- recData.Open "select sum(fpje) as fpje from cwzz_cashflowdata where cashflowid='" & First & "'and year='" & Format(Combo1.Text, "yyyy") & "' and period='" & Format(Combo1.Text, "mm") & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If recData.EOF = False Then
- If IsNull(recData.Fields!fpje) = False Then
- FirstFpje = recData.Fields!fpje
- End If
- End If
- If RecAdoYear.State = 1 Then RecAdoYear.Close
- RecAdoYear.Open "select sum(fpje) as fpje from cwzz_cashflowdata where cashflowid='" & First & "'and year='" & Format(Combo1.Text, "yyyy") & "' and period<='" & Format(Combo1.Text, "mm") & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If RecAdoYear.EOF = False Then
- If IsNull(RecAdoYear.Fields!fpje) = False Then
- FirstFpjeYear = RecAdoYear.Fields!fpje
- End If
- End If
- If RecAdo.State = 1 Then RecAdo.Close
- RecAdo.Open "select * from cwzz_cashflowitem where rowno='" & Second & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- Second = RecAdo.Fields!CASHFLOWCODE
- If recData.State = 1 Then recData.Close
- recData.Open "select sum(fpje) as fpje from cwzz_cashflowdata where cashflowid='" & Second & "'and year='" & Format(Combo1.Text, "yyyy") & "' and period='" & Format(Combo1.Text, "mm") & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If recData.EOF = False Then
- If IsNull(recData.Fields!fpje) = False Then
- SecondFpje = recData.Fields!fpje
- Else
- SecondFpje = 0
- End If
- End If
- If RecAdoYear.State = 1 Then RecAdoYear.Close
- RecAdoYear.Open "select sum(fpje) as fpje from cwzz_cashflowdata where cashflowid='" & Second & "'and year='" & Format(Combo1.Text, "yyyy") & "' and period<='" & Format(Combo1.Text, "mm") & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If RecAdoYear.EOF = False Then
- If IsNull(RecAdoYear.Fields!fpje) = False Then
- SecondFpjeYear = RecAdoYear.Fields!fpje
- Else
- SecondFpjeYear = 0
- End If
- End If
- SumValue = SumValue + Val(FirstFpje) + Val(SecondFpje)
- SumValueYear = SumValueYear + Val(FirstFpjeYear) + Val(SecondFpjeYear)
- First = 0
- Second = 0
- FirstFpje = 0
- SecondFpje = 0
- FirstFpjeYear = 0
- SecondFpjeYear = 0
- End If
- If FirstFlag = False Then FirstFlag = True
- Case "-"
- If FirstFlag Then
- If RecAdo.State = 1 Then RecAdo.Close
- RecAdo.Open "select * from cwzz_cashflowitem where rowno='" & First & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If RecAdo.EOF = False Then
- If Trim(RecAdo.Fields!CASHFLOWCODE) <> "" Then
- First = RecAdo.Fields!CASHFLOWCODE
- End If
- End If
- If recData.State = 1 Then recData.Close
- recData.Open "select sum(fpje) as fpje from cwzz_cashflowdata where cashflowid='" & First & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If recData.EOF = False Then
- If IsNull(recData.Fields!fpje) = False Then
- FirstFpje = recData.Fields!fpje
- End If
- End If
- If RecAdoYear.State = 1 Then RecAdoYear.Close
- RecAdoYear.Open "select sum(fpje) as fpje from cwzz_cashflowdata where cashflowid='" & First & "'and year='" & Format(Combo1.Text, "yyyy") & "' and period<='" & Format(Combo1.Text, "mm") & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If RecAdoYear.EOF = False Then
- If IsNull(RecAdoYear.Fields!fpje) = False Then
- FirstFpjeYear = RecAdoYear.Fields!fpje
- End If
- End If
- If RecAdo.State = 1 Then RecAdo.Close
- RecAdo.Open "select * from cwzz_cashflowitem where rowno='" & Second & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- Second = RecAdo.Fields!CASHFLOWCODE
- If recData.State = 1 Then recData.Close
- recData.Open "select sum(fpje) as fpje from cwzz_cashflowdata where cashflowid='" & Second & "'and year='" & Format(Combo1.Text, "yyyy") & "' and period='" & Format(Combo1.Text, "mm") & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If recData.EOF = False Then
- If IsNull(recData.Fields!fpje) = False Then
- SecondFpje = recData.Fields!fpje
- Else
- SecondFpje = 0
- End If
- End If
- If RecAdoYear.State = 1 Then RecAdoYear.Close
- RecAdoYear.Open "select sum(fpje) as fpje from cwzz_cashflowdata where cashflowid='" & Second & "'and year='" & Format(Combo1.Text, "yyyy") & "' and period<='" & Format(Combo1.Text, "mm") & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If RecAdoYear.EOF = False Then
- If IsNull(RecAdoYear.Fields!fpje) = False Then
- SecondFpjeYear = RecAdoYear.Fields!fpje
- Else
- SecondFpjeYear = 0
- End If
- End If
- SumValue = SumValue + Val(FirstFpje) - Val(SecondFpje)
- SumValueYear = SumValueYear + Val(FirstFpjeYear) - Val(SecondFpjeYear)
- First = 0
- Second = 0
- FirstFpje = 0
- SecondFpje = 0
- FirstFpjeYear = 0
- SecondFpjeYear = 0
- End If
- If FirstFlag = False Then FirstFlag = True
- End Select
- End If
- If OperateFlag Then OperateFirst = OperateSecond
- If OperateFlag = False Then OperateFlag = True
- End If
- Next Jsqte
- If RecAdo.State = 1 Then RecAdo.Close '最后一行数据处理
- If Second <> 0 Then
- RecAdo.Open "select * from cwzz_cashflowitem where rowno='" & Second & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- Else
- If First <> "" Then
- RecAdo.Open "select * from cwzz_cashflowitem where rowno='" & First & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- End If
- End If
- If RecAdo.EOF = False Then
- Second = RecAdo.Fields!CASHFLOWCODE
- End If
- If recData.State = 1 Then recData.Close
- recData.Open "select sum(fpje) as fpje from cwzz_cashflowdata where cashflowid='" & Second & "'and year='" & Format(Combo1.Text, "yyyy") & "' and period='" & Format(Combo1.Text, "mm") & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If recData.EOF = False Then
- If IsNull(recData.Fields!fpje) = False Then
- SecondFpje = recData.Fields!fpje
- Else
- SecondFpje = 0
- End If
- End If
- If RecAdoYear.State = 1 Then RecAdoYear.Close
- RecAdoYear.Open "select sum(fpje) as fpje from cwzz_cashflowdata where cashflowid='" & Second & "'and year='" & Format(Combo1.Text, "yyyy") & "' and period<='" & Format(Combo1.Text, "mm") & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- If RecAdoYear.EOF = False Then
- If IsNull(RecAdoYear.Fields!fpje) = False Then
- SecondFpjeYear = RecAdoYear.Fields!fpje
- Else
- SecondFpjeYear = 0
- End If
- End If
- '完整数据
- If OperateFirst = "+" Then SumValue = SumValue + Val(FirstFpje) + Val(SecondFpje): SumValueYear = SumValueYear + Val(FirstFpjeYear) + Val(SecondFpjeYear)
- If OperateFirst = "-" Then SumValue = SumValue + Val(FirstFpje) - Val(SecondFpje): SumValueYear = SumValueYear + Val(FirstFpjeYear) - Val(SecondFpjeYear)
- If SumValue = 0 Then
- CxbbGrid.TextMatrix(i, 3) = ""
- Else
- CxbbGrid.TextMatrix(i, 3) = Format(SumValue, "#,###.00")
- End If
- If SumValueYear = 0 Then
- CxbbGrid.TextMatrix(i, 4) = ""
- Else
- CxbbGrid.TextMatrix(i, 4) = Format(SumValueYear, "#,###.00")
- End If
- End If
- SumValue = 0
- SumValueYear = 0
- First = 0
- Second = 0
- i = i + 1
- RecTemp.MoveNext
- Loop
- End Sub