上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:26k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{BEEECC20-4D5F-4F8B-BFDC-5D9B6FBDE09D}#1.0#0"; "vsflex8.ocx"
  3. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  4. Begin VB.Form Book_Value 
  5.    Caption         =   "资产价值结构分析报表"
  6.    ClientHeight    =   8595
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   11730
  10.    HelpContextID   =   505008
  11.    Icon            =   "资产价值结构分析.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    LockControls    =   -1  'True
  14.    MDIChild        =   -1  'True
  15.    ScaleHeight     =   8595
  16.    ScaleWidth      =   11730
  17.    WindowState     =   2  'Maximized
  18.    Begin VB.PictureBox Pic_Title 
  19.       BackColor       =   &H00FFFFFF&
  20.       Height          =   825
  21.       Left            =   0
  22.       Picture         =   "资产价值结构分析.frx":1042
  23.       ScaleHeight     =   765
  24.       ScaleWidth      =   11655
  25.       TabIndex        =   1
  26.       Top             =   570
  27.       Width           =   11715
  28.       Begin VB.Label tsLabel 
  29.          AutoSize        =   -1  'True
  30.          BackColor       =   &H80000018&
  31.          BackStyle       =   0  'Transparent
  32.          Caption         =   "固定资产价值结构分析表"
  33.          BeginProperty Font 
  34.             Name            =   "宋体"
  35.             Size            =   12
  36.             Charset         =   134
  37.             Weight          =   700
  38.             Underline       =   0   'False
  39.             Italic          =   0   'False
  40.             Strikethrough   =   0   'False
  41.          EndProperty
  42.          ForeColor       =   &H00000000&
  43.          Height          =   240
  44.          Index           =   4
  45.          Left            =   525
  46.          TabIndex        =   2
  47.          Top             =   240
  48.          Width           =   2805
  49.       End
  50.    End
  51.    Begin VB.Timer Timer1 
  52.       Enabled         =   0   'False
  53.       Interval        =   1
  54.       Left            =   7620
  55.       Top             =   90
  56.    End
  57.    Begin MSComctlLib.Toolbar GsToolbar 
  58.       Height          =   525
  59.       Left            =   9240
  60.       TabIndex        =   3
  61.       Top             =   30
  62.       Width           =   2475
  63.       _ExtentX        =   4366
  64.       _ExtentY        =   926
  65.       ButtonWidth     =   1455
  66.       ButtonHeight    =   926
  67.       AllowCustomize  =   0   'False
  68.       Appearance      =   1
  69.       Style           =   1
  70.       ImageList       =   "ImageList1"
  71.       _Version        =   393216
  72.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  73.          NumButtons      =   3
  74.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  75.             Caption         =   "保存格式"
  76.             Key             =   "bcgs"
  77.             ImageKey        =   "bcgs"
  78.          EndProperty
  79.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  80.             Caption         =   "默认列宽"
  81.             Key             =   "hfmrgs"
  82.             ImageKey        =   "mrlk"
  83.          EndProperty
  84.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  85.             Caption         =   "显示项目"
  86.             Key             =   "szxsxm"
  87.             ImageKey        =   "xmsz"
  88.          EndProperty
  89.       EndProperty
  90.    End
  91.    Begin VSFlex8Ctl.VSFlexGrid CxbbGrid 
  92.       Height          =   7125
  93.       Left            =   0
  94.       TabIndex        =   0
  95.       Top             =   1440
  96.       Width           =   11715
  97.       _cx             =   5080
  98.       _cy             =   5080
  99.       Appearance      =   1
  100.       BorderStyle     =   1
  101.       Enabled         =   -1  'True
  102.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  103.          Name            =   "宋体"
  104.          Size            =   9
  105.          Charset         =   134
  106.          Weight          =   400
  107.          Underline       =   0   'False
  108.          Italic          =   0   'False
  109.          Strikethrough   =   0   'False
  110.       EndProperty
  111.       MousePointer    =   0
  112.       BackColor       =   16777215
  113.       ForeColor       =   -2147483640
  114.       BackColorFixed  =   -2147483648
  115.       ForeColorFixed  =   -2147483630
  116.       BackColorSel    =   -2147483635
  117.       ForeColorSel    =   -2147483634
  118.       BackColorBkg    =   -2147483636
  119.       BackColorAlternate=   16777215
  120.       GridColor       =   -2147483633
  121.       GridColorFixed  =   -2147483648
  122.       TreeColor       =   -2147483632
  123.       FloodColor      =   192
  124.       SheetBorder     =   -2147483642
  125.       FocusRect       =   1
  126.       HighLight       =   1
  127.       AllowSelection  =   -1  'True
  128.       AllowBigSelection=   -1  'True
  129.       AllowUserResizing=   0
  130.       SelectionMode   =   0
  131.       GridLines       =   1
  132.       GridLinesFixed  =   2
  133.       GridLineWidth   =   1
  134.       Rows            =   50
  135.       Cols            =   10
  136.       FixedRows       =   1
  137.       FixedCols       =   1
  138.       RowHeightMin    =   0
  139.       RowHeightMax    =   0
  140.       ColWidthMin     =   0
  141.       ColWidthMax     =   0
  142.       ExtendLastCol   =   0   'False
  143.       FormatString    =   ""
  144.       ScrollTrack     =   0   'False
  145.       ScrollBars      =   3
  146.       ScrollTips      =   0   'False
  147.       MergeCells      =   2
  148.       MergeCompare    =   0
  149.       AutoResize      =   -1  'True
  150.       AutoSizeMode    =   0
  151.       AutoSearch      =   0
  152.       AutoSearchDelay =   2
  153.       MultiTotals     =   -1  'True
  154.       SubtotalPosition=   1
  155.       OutlineBar      =   0
  156.       OutlineCol      =   0
  157.       Ellipsis        =   0
  158.       ExplorerBar     =   0
  159.       PicturesOver    =   0   'False
  160.       FillStyle       =   0
  161.       RightToLeft     =   0   'False
  162.       PictureType     =   0
  163.       TabBehavior     =   0
  164.       OwnerDraw       =   0
  165.       Editable        =   0
  166.       ShowComboButton =   1
  167.       WordWrap        =   0   'False
  168.       TextStyle       =   0
  169.       TextStyleFixed  =   0
  170.       OleDragMode     =   0
  171.       OleDropMode     =   0
  172.       DataMode        =   0
  173.       VirtualData     =   -1  'True
  174.       DataMember      =   ""
  175.       ComboSearch     =   3
  176.       AutoSizeMouse   =   -1  'True
  177.       FrozenRows      =   0
  178.       FrozenCols      =   0
  179.       AllowUserFreezing=   0
  180.       BackColorFrozen =   0
  181.       ForeColorFrozen =   0
  182.       WallPaperAlignment=   9
  183.       AccessibleName  =   ""
  184.       AccessibleDescription=   ""
  185.       AccessibleValue =   ""
  186.       AccessibleRole  =   24
  187.    End
  188.    Begin MSComctlLib.Toolbar SzToolbar 
  189.       Align           =   1  'Align Top
  190.       Height          =   555
  191.       Left            =   0
  192.       TabIndex        =   4
  193.       Top             =   0
  194.       Width           =   11730
  195.       _ExtentX        =   20690
  196.       _ExtentY        =   979
  197.       ButtonWidth     =   820
  198.       ButtonHeight    =   926
  199.       AllowCustomize  =   0   'False
  200.       Appearance      =   1
  201.       Style           =   1
  202.       ImageList       =   "ImageList1"
  203.       _Version        =   393216
  204.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  205.          NumButtons      =   8
  206.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  207.             Caption         =   "设置"
  208.             Key             =   "ymsz"
  209.             ImageKey        =   "sz"
  210.          EndProperty
  211.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  212.             Caption         =   "打印"
  213.             Key             =   "dy"
  214.             ImageKey        =   "dy"
  215.          EndProperty
  216.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  217.             Caption         =   "预览"
  218.             Key             =   "yl"
  219.             ImageKey        =   "yl"
  220.          EndProperty
  221.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  222.             Style           =   4
  223.          EndProperty
  224.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  225.             Caption         =   "查询"
  226.             Key             =   "cx"
  227.             ImageKey        =   "cx"
  228.          EndProperty
  229.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  230.             Style           =   4
  231.          EndProperty
  232.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  233.             Caption         =   "帮助"
  234.             Key             =   "bz"
  235.             ImageKey        =   "bz"
  236.          EndProperty
  237.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  238.             Caption         =   "退出"
  239.             Key             =   "fh"
  240.             ImageKey        =   "tc"
  241.          EndProperty
  242.       EndProperty
  243.       BorderStyle     =   1
  244.       Begin MSComctlLib.ImageList ImageList1 
  245.          Left            =   5040
  246.          Top             =   0
  247.          _ExtentX        =   1005
  248.          _ExtentY        =   1005
  249.          BackColor       =   -2147483643
  250.          ImageWidth      =   16
  251.          ImageHeight     =   16
  252.          MaskColor       =   12632256
  253.          _Version        =   393216
  254.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  255.             NumListImages   =   9
  256.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  257.                Picture         =   "资产价值结构分析.frx":35106
  258.                Key             =   "sz"
  259.             EndProperty
  260.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  261.                Picture         =   "资产价值结构分析.frx":354A0
  262.                Key             =   "dy"
  263.             EndProperty
  264.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  265.                Picture         =   "资产价值结构分析.frx":3583A
  266.                Key             =   "yl"
  267.             EndProperty
  268.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  269.                Picture         =   "资产价值结构分析.frx":35BD4
  270.                Key             =   "cx"
  271.             EndProperty
  272.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  273.                Picture         =   "资产价值结构分析.frx":35F6E
  274.                Key             =   "bz"
  275.             EndProperty
  276.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  277.                Picture         =   "资产价值结构分析.frx":36308
  278.                Key             =   "tc"
  279.             EndProperty
  280.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  281.                Picture         =   "资产价值结构分析.frx":366A2
  282.                Key             =   "bcgs"
  283.             EndProperty
  284.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  285.                Picture         =   "资产价值结构分析.frx":36A3C
  286.                Key             =   "mrlk"
  287.             EndProperty
  288.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  289.                Picture         =   "资产价值结构分析.frx":36DD6
  290.                Key             =   "xmsz"
  291.             EndProperty
  292.          EndProperty
  293.       End
  294.    End
  295. End
  296. Attribute VB_Name = "Book_Value"
  297. Attribute VB_GlobalNameSpace = False
  298. Attribute VB_Creatable = False
  299. Attribute VB_PredeclaredId = True
  300. Attribute VB_Exposed = False
  301. '******************************************************************
  302. '*    模 块 名 称 :资产价值结构分析
  303. '*    功 能 描 述 :
  304. '*    程序员姓名  :徐衍民
  305. '*    最后修改人  :徐衍民
  306. '*    最后修改时间:2001/12/19
  307. '*    备        注:
  308. '******************************************************************
  309. Dim ReportTitle As String                '报表主标题
  310. Dim Card_Str As String                   '用户录入查询条件
  311. Dim rstemp As ADODB.Recordset
  312. '以下为固定使用变量
  313. Dim Dyymctbl As New DY_Dyymsz            '打印页面窗体变量
  314. Dim GridCode As String                   '显示网格网格代码
  315. Dim GridInf() As Variant                 '整个网格设置信息
  316. Dim Tsxx As String                       '系统提示信息
  317. Dim Qslz As Long                         '网格隐藏(非操作显示)列数
  318. Dim Sjhgd As Double                      '网格数据行高度
  319. Dim Sfxshjwg As Boolean                  '是否显示合计网格
  320. Dim GridBoolean() As Boolean             '网格列信息(布尔型)
  321. Dim GridStr()  As String                 '网格列信息(字符型)
  322. Dim GridInt() As Integer                 '网格列信息(整型)
  323. Dim Szzls As Integer                     '数组总列数(网格列数-1)
  324. Private Sub Form_Resize()                '根据窗体大小来调整网格,标题栏大小
  325.     
  326.     On Error Resume Next
  327.     
  328.     With CxbbGrid
  329.         .Width = Me.Width - 160
  330.         .Height = Me.Height - .Top - 400
  331.     End With
  332.     
  333.     With Pic_Title
  334.         .Width = Me.Width - 160
  335.     End With
  336.     
  337.     GsToolbar.Left = Me.Width - GsToolbar.Width - 160
  338. End Sub
  339. Private Sub Form_Load()                                                   '窗体装入
  340.      
  341.     '调入打印页面设置窗体
  342.     ReportTitle = "固定资产价值结构分析表"
  343.     XtReportCode = "Gdzc_Value"
  344.     Load Dyymctbl
  345.      
  346.     '调整标题栏及网格、格式工具条位置
  347.     Pic_Title.Left = 40
  348.     Pic_Title.Top = SzToolbar.Top + SzToolbar.Height - 10
  349.     CxbbGrid.Left = Pic_Title.Left
  350.     CxbbGrid.Top = Pic_Title.Top + Pic_Title.Height + 20
  351.     
  352.     '调 入 网 格
  353.     GridCode = "Gdzc_Value"
  354.     Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  355.      
  356.     Qslz = GridInf(1)
  357.     Sjhgd = GridInf(2)
  358.     Sfxshjwg = GridInf(7)
  359.     Szzls = CxbbGrid.Cols - 1
  360. End Sub
  361. Private Sub Form_Unload(Cancel As Integer)                                  '窗体卸载
  362.     
  363.     '卸载条件窗体
  364.     Book_Value_Search.UnloadCheck.Value = 1
  365.     Unload Book_Value_Search
  366.     '卸载打印页面设置窗体
  367.     Unload Dyymctbl
  368. End Sub
  369. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)       '网格格式调整
  370.     
  371.     Select Case Button.Key
  372.         Case "bcgs"                                          '保存表格格式
  373.           Call Bcwggs(CxbbGrid, GridCode, GridStr)
  374.         Case "hfmrgs"                                        '恢复默认格式
  375.           Call Hfmrgs(CxbbGrid, GridCode, GridStr)
  376.         Case "szxsxm"                                        '设置显示项目
  377.           Call Szxsxm(CxbbGrid, GridCode)
  378.     End Select
  379. End Sub
  380. Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
  381.     
  382.     Select Case Button.Key
  383.         Case "ymsz"                                          '页面设置
  384.             Dyymctbl.Show 1
  385.         Case "yl"                                            '预 览
  386.             Call bbyl(True)
  387.         Case "dy"                                            '打 印
  388.             Call bbyl(False)
  389.         Case "cx"                                            '查 询
  390.             Book_Value_Search.Show 1
  391.         Case "fh"                                            '退 出
  392.             Unload Me
  393.         Case "bz"
  394.             SendKeys "{F1}"
  395.      End Select
  396.      
  397. End Sub
  398. Private Sub Timer1_Timer()                                 '在窗体激活后调入查询程序
  399.     
  400.     Timer1.Enabled = False
  401.     Xt_Wait.Show
  402.     Xt_Wait.Refresh
  403.     
  404.     '加快显示速度
  405.     CxbbGrid.Redraw = False
  406.     
  407.     '生成查询结果
  408.     Call Sub_Query
  409.     
  410.     CxbbGrid.Redraw = True
  411.      
  412.     Xt_Wait.Hide
  413.     
  414. End Sub
  415. Private Sub Sub_Query()                                    '生成查询结果
  416.     
  417.     Dim Rec_Query As New ADODB.Recordset        '查询结果动态集
  418.     Dim Sqlstr, SqlStr1 As String               '查询字符串
  419.     Dim Coljsq As Long                          '网格列计数器
  420.     Dim Jsqte As Integer                        '临时动态计数器
  421.     Dim Row_Num As Integer                      '网格列个数变量
  422.     Dim Year, Period
  423.     '以下为自定义部分[
  424.     With Book_Value_Search
  425.         '生成查询条件
  426.         Card_Str = " where 1=1 "
  427.         For Jsqte = 1 To 3
  428.             Select Case Jsqte
  429.                 Case 1
  430.                     If Trim(.Com_Year(1).Text) = "" Then
  431.                         Sqlstr = "select max(year) as Year,max(Period) as Period from Gdzc_total"
  432.                         Set rstemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  433.                         If Not rstemp.EOF Then
  434.                             Year = rstemp!Year
  435.                             Period = rstemp!Period
  436.                         End If
  437.                         rstemp.Close
  438.                         Set rstemp = Nothing
  439.                     Else
  440.                         Year = LeftChar(Trim(.Com_Year(1).Text))
  441.                         Period = RightChar(Trim(.Com_Year(1).Text))
  442.                     End If
  443.                 Case 2      '起始会计期间
  444.                     If Trim(.Com_Year(0).Text) <> "" Then
  445.                         Card_Str = Card_Str & " And Gdzc_Total.Year>= " & Val(LeftChar(Trim(.Com_Year(0).Text))) & " and Gdzc_Total.Period>=" & Val(RightChar(Trim(.Com_Year(0).Text)))
  446.                     End If
  447.                 Case 3      '终止会计期间
  448.                     If Trim(.Com_Year(1).Text) <> "" Then
  449.                         Card_Str = Card_Str & " and Gdzc_Total.Year <= " & Val(LeftChar(Trim(.Com_Year(1).Text))) & " and Gdzc_total.Period<=" & Val(RightChar(Trim(.Com_Year(1).Text)))
  450.                     End If
  451.             End Select
  452.         Next Jsqte
  453.     End With
  454.     
  455.     '取出资产类别数,并把记录数值赋给网格行数
  456.     Sqlstr = "select FASortCode from Gdzc_Total " & Card_Str & " group by FASortCode"
  457.     Set rstemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  458.     CxbbGrid.Rows = CxbbGrid.FixedRows
  459.     CxbbGrid.Rows = CxbbGrid.FixedRows + rstemp.RecordCount
  460.     rstemp.Close
  461.     Set rstemp = Nothing
  462.     
  463.     Sqlstr = "SELECT Gdzc_Sort.FASortName AS FASortName, Gdzc_Total.[Year] AS Year, " _
  464.         & "Gdzc_Total.Period AS Period, SUM(Gdzc_Total.FAValueEndM) AS FAValue, " _
  465.         & "SUM(Gdzc_Total.DeprSumEndM) As DeprSum FROM Gdzc_Total INNER JOIN " _
  466.         & "Gdzc_Sort ON Gdzc_Total.FASortCode = Gdzc_Sort.FASortCode "
  467.     Sqlstr = Sqlstr & Card_Str & "GROUP BY Gdzc_Sort.FASortName, Gdzc_Total.[Year], Gdzc_Total.Period "
  468.     
  469.     Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  470.     With Rec_Query
  471.         CxbbGrid.Rows = CxbbGrid.Rows + .RecordCount
  472.         Jsqte = CxbbGrid.FixedRows
  473.         CxbbGrid.MergeCells = flexMergeRestrictAll
  474.         CxbbGrid.MergeCol(0) = True
  475.         
  476.         Do While Not .EOF
  477.             If Jsqte >= CxbbGrid.Rows Then
  478.                 CxbbGrid.AddItem ""
  479.             End If
  480.                                  
  481.             CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Trim(!FASortName & "")                                                                          '资产类别
  482.             CxbbGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = Trim(!Year & "." & Format(!Period, "00") & "")                                                               '会计期间
  483.             CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Trim(!FAValue & "")                                                                             '期末原值
  484.             CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Trim(!DeprSum & "")                                                                             '期末累计折旧
  485.             CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Trim(Val(Val(!FAValue) - Val(!DeprSum)) & "")                                                   '期末净值
  486.             CxbbGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = Trim(Format(Val(Val(!DeprSum) / Val(!FAValue) * 100), "##0.00") & "")                           '累计折旧/原值(%)
  487.             CxbbGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = Trim(Format(Val(Val(Val(!FAValue) - Val(!DeprSum)) / Val(!FAValue) * 100), "##0.00") & "")      '净值率(%)
  488.             .MoveNext
  489.             Jsqte = Jsqte + 1
  490.             
  491.             '合计行处理
  492.             If Not .EOF Then
  493.                 If Trim(!FASortName) <> Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("001", GridStr(), Szzls))) Then
  494.                     SqlStr1 = "SELECT Gdzc_Sort.FASortName AS FASortName, SUM(Gdzc_Total.FAValueEndM) AS FAValue, " _
  495.                         & "SUM(Gdzc_Total.DeprSumEndM) As DeprSum FROM Gdzc_Total INNER JOIN " _
  496.                         & "Gdzc_Sort ON Gdzc_Total.FASortCode = Gdzc_Sort.FASortCode "
  497.                     SqlStr1 = SqlStr1 & " where Gdzc_Total.Year=" & Val(Year) & " and Gdzc_Total.Period=" & Val(Period) & " and Gdzc_Sort.FASortName='" & Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("001", GridStr(), Szzls))) & "' group by FASortName"
  498.                     Set rstemp = Cw_DataEnvi.DataConnect.Execute(SqlStr1)
  499.                     If Not rstemp.EOF Then
  500.                         CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = "合  计"                                                                            '资产类别
  501.                         CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Trim(rstemp!FAValue & "")                                                           '期末原值
  502.                         CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Trim(rstemp!DeprSum & "")                                                           '期末累计折旧
  503.                         CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Trim(Val(Val(rstemp!FAValue) - Val(rstemp!DeprSum)) & "")                           '期末净值
  504.                         CxbbGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = Trim(Format(Val(Val(rstemp!DeprSum) / Val(rstemp!FAValue) * 100), "##0.00") & "")   '累计折旧/原值(%)
  505.                         CxbbGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = Trim(Format(Val(Val(Val(rstemp!FAValue) - Val(rstemp!DeprSum)) / Val(rstemp!FAValue) * 100), "##0.00") & "")    '净值率(%)
  506.                     End If
  507.                     rstemp.Close
  508.                     Set rstemp = Nothing
  509.                     
  510.                     For Row_Num = 0 To CxbbGrid.Cols - 1
  511.                         CxbbGrid.Cell(flexcpBackColor, Jsqte, Row_Num) = &HFFFF00
  512.                     Next Row_Num
  513.                             
  514.                     Jsqte = Jsqte + 1
  515.                 End If
  516.             Else
  517.                 SqlStr1 = "SELECT Gdzc_Sort.FASortName AS FASortName, SUM(Gdzc_Total.FAValueEndM) AS FAValue, " _
  518.                     & "SUM(Gdzc_Total.DeprSumEndM) As DeprSum FROM Gdzc_Total INNER JOIN " _
  519.                     & "Gdzc_Sort ON Gdzc_Total.FASortCode = Gdzc_Sort.FASortCode "
  520.                 SqlStr1 = SqlStr1 & " where Gdzc_Total.Year=" & Val(Year) & " and Gdzc_Total.Period=" & Val(Period) & " and Gdzc_Sort.FASortName='" & Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("001", GridStr(), Szzls))) & "' group by FASortName"
  521.                 Set rstemp = Cw_DataEnvi.DataConnect.Execute(SqlStr1)
  522.                 If Not rstemp.EOF Then
  523.                     CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = "合  计"                                                                                '资产类别
  524.                     CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Trim(rstemp!FAValue & "")                                                               '期末原值
  525.                     CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Trim(rstemp!DeprSum & "")                                                               '期末累计折旧
  526.                     CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Trim(Val(Val(rstemp!FAValue) - Val(rstemp!DeprSum)) & "")                               '期末净值
  527.                     CxbbGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = Trim(Format(Val(Val(rstemp!DeprSum) / Val(rstemp!FAValue) * 100), "##0.00") & "")       '累计折旧/原值(%)
  528.                     CxbbGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = Trim(Format(Val(Val(Val(rstemp!FAValue) - Val(rstemp!DeprSum)) / Val(rstemp!FAValue) * 100), "##0.00") & "")    '净值率(%)
  529.                 End If
  530.                 rstemp.Close
  531.                 Set rstemp = Nothing
  532.                 
  533.                 For Row_Num = 0 To CxbbGrid.Cols - 1
  534.                     CxbbGrid.Cell(flexcpBackColor, Jsqte, Row_Num) = &HFFFF00
  535.                 Next Row_Num
  536.                         
  537.                 Jsqte = Jsqte + 1
  538.             End If
  539.         Loop
  540.    
  541.     End With
  542.     
  543.     '为零时清空单元格
  544.     Call Txt_Clear
  545.     
  546. End Sub
  547. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  548.     
  549.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  550.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  551.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  552.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  553.     ReDim Bbxbt(1 To Bbxbtgs)
  554.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  555.     
  556.     If Bbbwhgs <> 0 Then
  557.         ReDim Bbbwh(1 To Bbbwhgs)
  558.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  559.     End If
  560.     
  561.     Bbzbt = ReportTitle
  562.     Bbxbt(1) = " "
  563.     bbxbtzzxs(1) = 0                                     '报表行组织形式(0-居左 1-居中 2-居右)
  564.     
  565.     Call Scyxsjb(CxbbGrid)                               '生成报表数据
  566.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  567.   
  568.     If Not bbylte Then
  569.         Unload DY_Tybbyldy
  570.     End If
  571. End Sub
  572. '*****************************************************
  573. '[>>自定义函数
  574. '取右字符串
  575. Function RightChar(str As String) As String
  576.     
  577.     
  578.     If str = "" Then Exit Function
  579.     Dim i As Integer
  580.     
  581.     i = InStrRev(str, ".")
  582.     RightChar = Mid(str, i + 1)
  583.     
  584. End Function
  585. '取左字符串
  586. Function LeftChar(str As String) As String
  587.     
  588.     If str = "" Then Exit Function
  589.     
  590.     Dim i As Integer
  591.     
  592.     i = InStr(str, ".")
  593.     LeftChar = Mid(str, 1, i - 1)
  594.     
  595. End Function
  596. '为零时清空单元格
  597. Function Txt_Clear()
  598.     
  599.     Dim Row_Integer, Col_Integer As Integer         '行数和列数变量
  600.     
  601.     For Row_Integer = CxbbGrid.FixedRows To CxbbGrid.Rows - 1
  602.         For Col_Integer = 2 To CxbbGrid.Cols - 1
  603.             If Val(CxbbGrid.TextMatrix(Row_Integer, Col_Integer)) = 0 Then
  604.                 CxbbGrid.TextMatrix(Row_Integer, Col_Integer) = ""
  605.             End If
  606.         Next Col_Integer
  607.     Next Row_Integer
  608.     
  609. End Function
  610. '<<]
  611. '****************************************************