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

企业管理

开发平台:

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_Parti 
  5.    Caption         =   "固定资产明细帐"
  6.    ClientHeight    =   8595
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   11880
  10.    HelpContextID   =   505005
  11.    Icon            =   "固定资产明细帐.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    LockControls    =   -1  'True
  14.    MDIChild        =   -1  'True
  15.    ScaleHeight     =   8595
  16.    ScaleWidth      =   11880
  17.    WindowState     =   2  'Maximized
  18.    Begin VB.PictureBox Pic_Title 
  19.       BackColor       =   &H00FFFFFF&
  20.       Height          =   1065
  21.       Left            =   -7
  22.       Picture         =   "固定资产明细帐.frx":1042
  23.       ScaleHeight     =   1005
  24.       ScaleWidth      =   11835
  25.       TabIndex        =   1
  26.       Top             =   570
  27.       Width           =   11895
  28.       Begin MSComctlLib.ImageList ImageList1 
  29.          Left            =   4320
  30.          Top             =   150
  31.          _ExtentX        =   1005
  32.          _ExtentY        =   1005
  33.          BackColor       =   -2147483643
  34.          ImageWidth      =   16
  35.          ImageHeight     =   16
  36.          MaskColor       =   12632256
  37.          _Version        =   393216
  38.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  39.             NumListImages   =   9
  40.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  41.                Picture         =   "固定资产明细帐.frx":35106
  42.                Key             =   "sz"
  43.             EndProperty
  44.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  45.                Picture         =   "固定资产明细帐.frx":354A0
  46.                Key             =   "dy"
  47.             EndProperty
  48.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  49.                Picture         =   "固定资产明细帐.frx":3583A
  50.                Key             =   "yl"
  51.             EndProperty
  52.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  53.                Picture         =   "固定资产明细帐.frx":35BD4
  54.                Key             =   "bz"
  55.             EndProperty
  56.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  57.                Picture         =   "固定资产明细帐.frx":35F6E
  58.                Key             =   "tc"
  59.             EndProperty
  60.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  61.                Picture         =   "固定资产明细帐.frx":36308
  62.                Key             =   "bcgs"
  63.             EndProperty
  64.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  65.                Picture         =   "固定资产明细帐.frx":366A2
  66.                Key             =   "mrlk"
  67.             EndProperty
  68.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  69.                Picture         =   "固定资产明细帐.frx":36A3C
  70.                Key             =   "xsxm"
  71.             EndProperty
  72.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  73.                Picture         =   "固定资产明细帐.frx":36DD6
  74.                Key             =   "cx"
  75.             EndProperty
  76.          EndProperty
  77.       End
  78.       Begin VB.Label Lbl_Dept 
  79.          AutoSize        =   -1  'True
  80.          BackStyle       =   0  'Transparent
  81.          ForeColor       =   &H00000000&
  82.          Height          =   180
  83.          Left            =   7530
  84.          TabIndex        =   9
  85.          Top             =   810
  86.          Width           =   90
  87.       End
  88.       Begin VB.Label Label3 
  89.          AutoSize        =   -1  'True
  90.          BackStyle       =   0  'Transparent
  91.          Caption         =   "所属部门:"
  92.          Height          =   180
  93.          Left            =   6690
  94.          TabIndex        =   8
  95.          Top             =   810
  96.          Width           =   810
  97.       End
  98.       Begin VB.Label Lbl_Sort 
  99.          AutoSize        =   -1  'True
  100.          BackStyle       =   0  'Transparent
  101.          ForeColor       =   &H00000000&
  102.          Height          =   180
  103.          Left            =   4230
  104.          TabIndex        =   7
  105.          Top             =   810
  106.          Width           =   90
  107.       End
  108.       Begin VB.Label Label1 
  109.          AutoSize        =   -1  'True
  110.          BackStyle       =   0  'Transparent
  111.          Caption         =   "资产类别:"
  112.          Height          =   180
  113.          Left            =   3390
  114.          TabIndex        =   6
  115.          Top             =   810
  116.          Width           =   810
  117.       End
  118.       Begin VB.Label tsLabel 
  119.          AutoSize        =   -1  'True
  120.          BackColor       =   &H80000018&
  121.          BackStyle       =   0  'Transparent
  122.          Caption         =   "固定资产明细帐"
  123.          BeginProperty Font 
  124.             Name            =   "宋体"
  125.             Size            =   12
  126.             Charset         =   134
  127.             Weight          =   700
  128.             Underline       =   0   'False
  129.             Italic          =   0   'False
  130.             Strikethrough   =   0   'False
  131.          EndProperty
  132.          ForeColor       =   &H00000000&
  133.          Height          =   240
  134.          Index           =   4
  135.          Left            =   585
  136.          TabIndex        =   2
  137.          Top             =   270
  138.          Width           =   1785
  139.       End
  140.    End
  141.    Begin VB.Timer Timer1 
  142.       Enabled         =   0   'False
  143.       Interval        =   1
  144.       Left            =   6533
  145.       Top             =   60
  146.    End
  147.    Begin VSFlex8Ctl.VSFlexGrid CxbbGrid 
  148.       Height          =   6915
  149.       Left            =   0
  150.       TabIndex        =   0
  151.       Top             =   1710
  152.       Width           =   11895
  153.       _cx             =   5080
  154.       _cy             =   5080
  155.       Appearance      =   1
  156.       BorderStyle     =   1
  157.       Enabled         =   -1  'True
  158.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  159.          Name            =   "宋体"
  160.          Size            =   9
  161.          Charset         =   134
  162.          Weight          =   400
  163.          Underline       =   0   'False
  164.          Italic          =   0   'False
  165.          Strikethrough   =   0   'False
  166.       EndProperty
  167.       MousePointer    =   0
  168.       BackColor       =   -2147483643
  169.       ForeColor       =   -2147483640
  170.       BackColorFixed  =   -2147483633
  171.       ForeColorFixed  =   -2147483630
  172.       BackColorSel    =   -2147483635
  173.       ForeColorSel    =   -2147483634
  174.       BackColorBkg    =   -2147483636
  175.       BackColorAlternate=   -2147483643
  176.       GridColor       =   -2147483633
  177.       GridColorFixed  =   -2147483632
  178.       TreeColor       =   -2147483632
  179.       FloodColor      =   192
  180.       SheetBorder     =   -2147483642
  181.       FocusRect       =   1
  182.       HighLight       =   1
  183.       AllowSelection  =   -1  'True
  184.       AllowBigSelection=   -1  'True
  185.       AllowUserResizing=   0
  186.       SelectionMode   =   0
  187.       GridLines       =   1
  188.       GridLinesFixed  =   2
  189.       GridLineWidth   =   1
  190.       Rows            =   50
  191.       Cols            =   10
  192.       FixedRows       =   1
  193.       FixedCols       =   1
  194.       RowHeightMin    =   0
  195.       RowHeightMax    =   0
  196.       ColWidthMin     =   0
  197.       ColWidthMax     =   0
  198.       ExtendLastCol   =   0   'False
  199.       FormatString    =   ""
  200.       ScrollTrack     =   0   'False
  201.       ScrollBars      =   3
  202.       ScrollTips      =   0   'False
  203.       MergeCells      =   4
  204.       MergeCompare    =   0
  205.       AutoResize      =   -1  'True
  206.       AutoSizeMode    =   0
  207.       AutoSearch      =   0
  208.       AutoSearchDelay =   2
  209.       MultiTotals     =   -1  'True
  210.       SubtotalPosition=   1
  211.       OutlineBar      =   0
  212.       OutlineCol      =   0
  213.       Ellipsis        =   0
  214.       ExplorerBar     =   0
  215.       PicturesOver    =   0   'False
  216.       FillStyle       =   0
  217.       RightToLeft     =   0   'False
  218.       PictureType     =   0
  219.       TabBehavior     =   0
  220.       OwnerDraw       =   0
  221.       Editable        =   0
  222.       ShowComboButton =   1
  223.       WordWrap        =   0   'False
  224.       TextStyle       =   0
  225.       TextStyleFixed  =   0
  226.       OleDragMode     =   0
  227.       OleDropMode     =   0
  228.       DataMode        =   0
  229.       VirtualData     =   -1  'True
  230.       DataMember      =   ""
  231.       ComboSearch     =   3
  232.       AutoSizeMouse   =   -1  'True
  233.       FrozenRows      =   0
  234.       FrozenCols      =   0
  235.       AllowUserFreezing=   0
  236.       BackColorFrozen =   0
  237.       ForeColorFrozen =   0
  238.       WallPaperAlignment=   9
  239.       AccessibleName  =   ""
  240.       AccessibleDescription=   ""
  241.       AccessibleValue =   ""
  242.       AccessibleRole  =   24
  243.    End
  244.    Begin MSComctlLib.Toolbar GsToolbar 
  245.       Height          =   525
  246.       Left            =   9390
  247.       TabIndex        =   3
  248.       Top             =   30
  249.       Width           =   2475
  250.       _ExtentX        =   4366
  251.       _ExtentY        =   926
  252.       ButtonWidth     =   1455
  253.       ButtonHeight    =   926
  254.       Appearance      =   1
  255.       Style           =   1
  256.       ImageList       =   "ImageList1"
  257.       _Version        =   393216
  258.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  259.          NumButtons      =   3
  260.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  261.             Caption         =   "保存格式"
  262.             Key             =   "bcgs"
  263.             ImageKey        =   "bcgs"
  264.          EndProperty
  265.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  266.             Caption         =   "默认列宽"
  267.             Key             =   "hfmrgs"
  268.             ImageKey        =   "mrlk"
  269.          EndProperty
  270.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  271.             Caption         =   "显示项目"
  272.             Key             =   "szxsxm"
  273.             ImageKey        =   "xsxm"
  274.          EndProperty
  275.       EndProperty
  276.    End
  277.    Begin MSComctlLib.Toolbar SzToolbar 
  278.       Align           =   1  'Align Top
  279.       Height          =   555
  280.       Left            =   0
  281.       TabIndex        =   4
  282.       Top             =   0
  283.       Width           =   11880
  284.       _ExtentX        =   20955
  285.       _ExtentY        =   979
  286.       ButtonWidth     =   820
  287.       ButtonHeight    =   926
  288.       AllowCustomize  =   0   'False
  289.       Appearance      =   1
  290.       Style           =   1
  291.       ImageList       =   "ImageList1"
  292.       _Version        =   393216
  293.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  294.          NumButtons      =   8
  295.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  296.             Caption         =   "设置"
  297.             Key             =   "ymsz"
  298.             ImageKey        =   "sz"
  299.          EndProperty
  300.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  301.             Caption         =   "打印"
  302.             Key             =   "dy"
  303.             ImageKey        =   "dy"
  304.          EndProperty
  305.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  306.             Caption         =   "预览"
  307.             Key             =   "yl"
  308.             ImageKey        =   "yl"
  309.          EndProperty
  310.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  311.             Style           =   3
  312.          EndProperty
  313.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  314.             Enabled         =   0   'False
  315.             Caption         =   "查询"
  316.             Key             =   "cx"
  317.             ImageKey        =   "cx"
  318.          EndProperty
  319.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  320.             Style           =   4
  321.          EndProperty
  322.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  323.             Caption         =   "帮助"
  324.             Key             =   "bz"
  325.             ImageKey        =   "bz"
  326.          EndProperty
  327.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  328.             Caption         =   "退出"
  329.             Key             =   "fh"
  330.             ImageKey        =   "tc"
  331.          EndProperty
  332.       EndProperty
  333.       BorderStyle     =   1
  334.       Begin VB.TextBox Txt_Bit 
  335.          Height          =   270
  336.          Left            =   5070
  337.          TabIndex        =   5
  338.          Text            =   "Text1"
  339.          Top             =   1230
  340.          Visible         =   0   'False
  341.          Width           =   1035
  342.       End
  343.    End
  344. End
  345. Attribute VB_Name = "Book_Parti"
  346. Attribute VB_GlobalNameSpace = False
  347. Attribute VB_Creatable = False
  348. Attribute VB_PredeclaredId = True
  349. Attribute VB_Exposed = False
  350. '******************************************************************
  351. '*    模 块 名 称 :资产明细帐列表
  352. '*    功 能 描 述 :
  353. '*    程序员姓名  :徐衍民
  354. '*    最后修改人  :徐衍民
  355. '*    最后修改时间:2001/12/17
  356. '*    备        注:
  357. '******************************************************************
  358. Dim ReportTitle As String                '报表主标题
  359. Dim Card_Str As String                   '用户录入查询条件
  360. Dim rstemp As ADODB.Recordset            '临时打开数据集变量
  361. '以下为固定使用变量
  362. Dim Dyymctbl As New DY_Dyymsz            '打印页面窗体变量
  363. Dim GridCode As String                   '显示网格网格代码
  364. Dim GridInf() As Variant                 '整个网格设置信息
  365. Dim Tsxx As String                       '系统提示信息
  366. Dim Qslz As Long                         '网格隐藏(非操作显示)列数
  367. Dim Sjhgd As Double                      '网格数据行高度
  368. Dim Sfxshjwg As Boolean                  '是否显示合计网格
  369. Dim GridBoolean() As Boolean             '网格列信息(布尔型)
  370. Dim GridStr()  As String                 '网格列信息(字符型)
  371. Dim GridInt() As Integer                 '网格列信息(整型)
  372. Dim Szzls As Integer                     '数组总列数(网格列数-1)
  373. Private Sub Form_Resize()                '根据窗体大小来调整网格,标题栏大小
  374.     
  375.     On Error Resume Next
  376.     
  377.     With CxbbGrid
  378.         .Width = Me.Width - 160
  379.         .Height = Me.Height - .Top - 400
  380.     End With
  381.     
  382.     With Pic_Title
  383.         .Width = Me.Width - 160
  384.     End With
  385.     
  386.     GsToolbar.Left = Me.Width - GsToolbar.Width - 160
  387. End Sub
  388. Private Sub Form_Load()                                                   '窗体装入
  389.     
  390.     '调入打印页面设置窗体
  391.     ReportTitle = "固定资产明细帐"
  392.     XtReportCode = "Gdzc_Book_Parti"
  393.     Load Dyymctbl
  394.      
  395.     '调整标题栏及网格、格式工具条位置
  396.     Pic_Title.Left = 40
  397.     Pic_Title.Top = SzToolbar.Top + SzToolbar.Height - 10
  398.     CxbbGrid.Left = Pic_Title.Left
  399.     CxbbGrid.Top = Pic_Title.Top + Pic_Title.Height + 20
  400.     
  401.     '调 入 网 格
  402.     GridCode = "Gdzc_Book_Parti"
  403.     Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  404.      
  405.     Qslz = GridInf(1)
  406.     Sjhgd = GridInf(2)
  407.     Sfxshjwg = GridInf(7)
  408.     Szzls = CxbbGrid.Cols - 1
  409.     
  410.     Me.AutoRedraw = False
  411.     
  412. End Sub
  413. Private Sub Form_Unload(Cancel As Integer)                                  '窗体卸载
  414.     
  415.     '卸载条件窗体
  416.     Book_Parti_Search.UnloadCheck.Value = 1
  417.     Unload Book_Parti_Search
  418.     
  419.     '卸载打印页面设置窗体
  420.     Unload Dyymctbl
  421. End Sub
  422. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)       '网格格式调整
  423.     
  424.     Select Case Button.Key
  425.         Case "bcgs"                                          '保存表格格式
  426.           Call Bcwggs(CxbbGrid, GridCode, GridStr)
  427.         Case "hfmrgs"                                        '恢复默认格式
  428.           Call Hfmrgs(CxbbGrid, GridCode, GridStr)
  429.         Case "szxsxm"                                        '设置显示项目
  430.           Call Szxsxm(CxbbGrid, GridCode)
  431.     End Select
  432. End Sub
  433. Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
  434.     
  435.     Select Case Button.Key
  436.         Case "ymsz"                                          '页面设置
  437.             Dyymctbl.Show 1
  438.         Case "yl"                                            '预 览
  439.             Call bbyl(True)
  440.         Case "dy"                                            '打 印
  441.             Call bbyl(False)
  442.         Case "cx"
  443.             Book_Parti_Search.Show 1
  444.         Case "fh"                                            '退 出
  445.             Unload Me
  446.         Case "bz"
  447.             SendKeys "{F1}"
  448.      End Select
  449.      
  450. End Sub
  451. Private Sub Timer1_Timer()                                 '在窗体激活后调入查询程序
  452.     
  453.     Timer1.Enabled = False
  454.     
  455.     Xt_Wait.Show
  456.     Xt_Wait.Refresh
  457.     
  458.     '加快显示速度
  459.     CxbbGrid.Redraw = False
  460.     
  461.     '生成查询结果
  462.     Call Sub_Query
  463.     CxbbGrid.Redraw = True
  464.     Xt_Wait.Hide
  465.     SzToolbar.Buttons("cx").Enabled = True
  466. End Sub
  467. Private Sub Sub_Query()                                    '生成查询结果
  468.     
  469.     Dim Rec_Query As New ADODB.Recordset        '查询结果动态集
  470.     Dim Sqlstr As String                        '查询字符串
  471.     Dim Coljsq As Long                          '网格列计数器
  472.     Dim Jsqte As Integer                        '临时动态计数器
  473.     Dim Str_Temp As String                      '字符串变量
  474.     Dim SqlStr1, Str_temp1 As String            '字符串变量
  475.     Dim Sql_Str As String                       '字符串变量
  476.     Dim Row_Num As Integer                      '合计背景色处理变量
  477.     Dim Year As Integer                         '当前会计年度
  478.     Dim Period As Integer                       '当前会计期间
  479.     
  480.     '根据查询条件,为查询条件字符串赋值
  481.     With Book_Parti_Search
  482.         Str_Temp = "where 1=1"
  483.         Str_temp1 = "where 1=1"
  484.         For Jsqte = 1 To 5
  485.             Select Case Jsqte
  486.                 Case 1
  487.                     If Trim(.LrText(0).Text) <> "" Then             '资产类别
  488.                         Str_Temp = Str_Temp & " and gdzc_card.FASortCode like '" & Trim(.LrText(0).Tag) & "%'"
  489.                         Str_temp1 = Str_temp1 & " and gdzc_card.FASortCode like '" & Trim(.LrText(0).Tag) & "%'"
  490.                         Sql_Str = Sql_Str & " and Gdzc_Variation.FASortNew like '" & Trim(.LrText(0).Tag) & "%'"
  491.                         Lbl_Sort.Caption = Trim(.LrText(0).Text)
  492.                     Else
  493.                         Lbl_Sort.Caption = "所有类别"
  494.                     End If
  495.                 Case 2
  496.                     If Trim(.LrText(1).Text) <> "" Then             '所属部门
  497.                         Str_Temp = Str_Temp & " and gdzc_card.DeptCode like '" & Trim(.LrText(1).Tag) & "%'"
  498.                         Str_temp1 = Str_temp1 & " and gdzc_card.DeptCode like '" & Trim(.LrText(1).Tag) & "%'"
  499.                         Sql_Str = Sql_Str & " and Gdzc_Variation.deptNew like '" & Trim(.LrText(1).Tag) & "%'"
  500.                         Lbl_Dept.Caption = Trim(.LrText(1).Text)
  501.                     Else
  502.                         Lbl_Dept.Caption = "所有部门"
  503.                     End If
  504.                 Case 3
  505.                     If Trim(.LrText(2).Text) <> "" Then             '卡片编号
  506.                         Str_Temp = Str_Temp & " and gdzc_Variation.CardCode='" & Trim(.LrText(2).Text) & "'"
  507.                         Str_temp1 = Str_temp1 & " and Gdzc_Card.CardCode='" & Trim(.LrText(2).Text) & "'"
  508.                         Sql_Str = Sql_Str & " and Gdzc_Variation.cardcode='" & Trim(.LrText(2).Text) & "'"
  509.                     End If
  510.                 Case 4
  511.                     If Trim(.Com_Year(0).Text) <> "" Then           '起始会计期间
  512.                         Str_Temp = Str_Temp & " and Gdzc_Variation.year>=" & LeftChar(Trim(.Com_Year(0).Text)) & " and Gdzc_Variation.period>=" & RightChar(Trim(.Com_Year(0).Text))
  513.                         Str_temp1 = Str_temp1 & " and Gdzc_DetailedForm.year>=" & LeftChar(Trim(.Com_Year(0).Text)) & " and Gdzc_DetailedForm.period>=" & RightChar(Trim(.Com_Year(0).Text))
  514.                     End If
  515.                 Case 5
  516.                     If Trim(.Com_Year(1).Text) <> "" Then           '终止会计期间
  517.                         Str_Temp = Str_Temp & " and Gdzc_Variation.year<=" & LeftChar(Trim(.Com_Year(1).Text)) & " and Gdzc_Variation.period<=" & RightChar(Trim(.Com_Year(1).Text))
  518.                         Str_temp1 = Str_temp1 & " and Gdzc_DetailedForm.year<=" & LeftChar(Trim(.Com_Year(1).Text)) & " and Gdzc_DetailedForm.period<=" & RightChar(Trim(.Com_Year(1).Text))
  519.                     End If
  520.             End Select
  521.         Next Jsqte
  522.     End With
  523.     
  524.     '当用户要求显示“期间合计”时,为合计查询字符串赋值
  525.     If Book_Parti_Search.Opt_Yes = True Then        '输出期间合计
  526.         SqlStr1 = "SELECT DISTINCT Gdzc_DetailedForm.Period FROM Gdzc_DetailedForm LEFT OUTER JOIN " _
  527.             & "Gdzc_Card ON Gdzc_DetailedForm.CardCode = Gdzc_Card.CardCode LEFT OUTER JOIN " _
  528.             & "Gdzc_Sort ON Gdzc_DetailedForm.FASortCode = Gdzc_Sort.FASortCode LEFT OUTER JOIN " _
  529.             & "Gy_Department ON Gdzc_Card.DeptCode = Gy_Department.DeptCode " _
  530.             & Str_temp1 & " and (Gdzc_DetailedForm.FAValueEnd > 0) "
  531.         Set rstemp = Cw_DataEnvi.DataConnect.Execute(SqlStr1)
  532.         CxbbGrid.Rows = CxbbGrid.FixedRows
  533.         CxbbGrid.Rows = CxbbGrid.FixedRows + rstemp.RecordCount
  534.         rstemp.Close
  535.         Set rstemp = Nothing
  536.     
  537.         SqlStr1 = "SELECT Gy_Department.DeptName AS DeptName, Gdzc_Sort.FASortName AS FASortName, " _
  538.             & "Gdzc_DetailedForm.FAValueStart, Gdzc_DetailedForm.DeprSumStart, " _
  539.             & "Gdzc_DetailedForm.FAValueEnd, Gdzc_DetailedForm.DeprSUmEnd, " _
  540.             & "Gdzc_DetailedForm.DeprValue FROM Gdzc_DetailedForm LEFT OUTER JOIN " _
  541.             & "Gdzc_Card ON Gdzc_DetailedForm.CardCode = Gdzc_Card.CardCode LEFT OUTER JOIN " _
  542.             & "Gdzc_Sort ON Gdzc_DetailedForm.FASortCode = Gdzc_Sort.FASortCode LEFT OUTER JOIN " _
  543.             & "Gy_Department ON Gdzc_Card.DeptCode = Gy_Department.DeptCode "
  544.         SqlStr1 = SqlStr1 & Trim(Str_temp1)
  545.     End If
  546.     
  547.     Sqlstr = "SELECT Gdzc_Variation.CardCode AS CardCode, Gdzc_Variation.[Year] AS Year, " _
  548.         & "Gdzc_Variation.Period AS Period, Gdzc_Variation.VariDate AS VariDate, " _
  549.         & "Gy_Department.DeptName AS DeptName, Gdzc_Sort.FASortName AS FASortName, " _
  550.         & "Gdzc_Variation.FAValueOld AS FAValueOld,Gdzc_Variation.FAValueNew AS FAValueNew, " _
  551.         & "Gdzc_Variation.SumDeprOld AS SumDeprOld,Gdzc_Variation.SumDeprNew AS SumDeprNew, Gdzc_Card.FACode,Gdzc_Card.FAName, " _
  552.         & "Gdzc_Variation.VariationReason AS VariationReaSon FROM Gy_Department RIGHT OUTER JOIN " _
  553.         & "Gdzc_Card ON Gy_Department.DeptCode = Gdzc_Card.DeptCode LEFT OUTER JOIN " _
  554.         & "Gdzc_Sort ON Gdzc_Card.FASortCode = Gdzc_Sort.FASortCode RIGHT OUTER JOIN " _
  555.         & "Gdzc_Variation ON Gdzc_Card.CardCode = Gdzc_Variation.CardCode "
  556.     Sqlstr = Sqlstr & Trim(Str_Temp) & " order by Gdzc_Variation.year,Gdzc_Variation.period,gdzc_Variation.cardcode"
  557.     Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  558.     With Rec_Query
  559.         If Book_Parti_Search.Opt_No = True Then CxbbGrid.Rows = CxbbGrid.FixedRows
  560.         CxbbGrid.Rows = CxbbGrid.Rows + .RecordCount
  561.         Jsqte = CxbbGrid.FixedRows
  562.     
  563.         Do While Not .EOF
  564.             If Jsqte >= CxbbGrid.Rows Then
  565.                 CxbbGrid.AddItem ""
  566.             End If
  567.             
  568.             '填充列表
  569.             CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Trim(!Year & "")                                            '会计年度
  570.             CxbbGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = Trim(Format(!Period, "00") & "")                                         '会计期间
  571.             CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Trim(!varidate & "")                                        '业务日期
  572.             CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Trim(!CardCode & "")                                        '卡片编号
  573.             CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Trim(!FACode & "")                                          '资产编号
  574.             CxbbGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = Trim(!FAName & "")                                          '资产名称
  575.             CxbbGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = Trim(!VariationReason & "")                                 '摘要
  576.             If Val(!FAValueNew) > Val(!FAValueOld) Then
  577.                 CxbbGrid.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)) = Trim(Abs(Val(!FAValueNew) - Val(!FAValueOld)) & "")     '资产原值借方
  578.             Else
  579.                 CxbbGrid.TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls)) = Trim(Abs(Val(!FAValueNew) - Val(!FAValueOld)) & "")     '资产原值贷方
  580.             End If
  581.             CxbbGrid.TextMatrix(Jsqte, Sydz("010", GridStr(), Szzls)) = Trim(!FAValueNew & "")                                      '资产原值余额
  582.             If Val(!SumDeprNew) > Val(!SumDeprOld) Then
  583.                 CxbbGrid.TextMatrix(Jsqte, Sydz("012", GridStr(), Szzls)) = Trim(Abs(Val(!SumDeprNew) - Val(!SumDeprOld)) & "")     '累计折旧贷方
  584.             Else
  585.                 CxbbGrid.TextMatrix(Jsqte, Sydz("011", GridStr(), Szzls)) = Trim(Abs(Val(!SumDeprNew) - Val(!SumDeprOld)) & "")     '累计折旧借方
  586.             End If
  587.             If Val(!SumDeprNew) <> 0 Then CxbbGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)) = Trim(!SumDeprNew & "")        '累计折旧余额
  588.             If Val(Val(!FAValueNew) - Val(!SumDeprNew)) <> 0 Then CxbbGrid.TextMatrix(Jsqte, Sydz("014", GridStr(), Szzls)) = Trim(Val(Val(!FAValueNew) - Val(!SumDeprNew)) & "")   '净资产
  589.             CxbbGrid.RowHeight(Jsqte) = Sjhgd
  590.             .MoveNext
  591.             Jsqte = Jsqte + 1
  592.              
  593.             '本期合计处理
  594.             If Book_Parti_Search.Opt_Yes = True Then
  595.                 If Not .EOF Then
  596.                     If Trim(!Period) <> Val(Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("002", GridStr(), Szzls)))) Then
  597.                         Set rstemp = New ADODB.Recordset
  598.                         rstemp.Open SqlStr1 & " and gdzc_detailedform.Year=" & Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("001", GridStr(), Szzls))) & " and gdzc_detailedform.Period=" & Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("002", GridStr(), Szzls))), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  599.                         While Not rstemp.EOF
  600.                             CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = "本期合计"
  601.                             If Val(rstemp!FAValueEnd) - Val(rstemp!FAValuestart) > 0 Then
  602.                                 CxbbGrid.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)) = Val(CxbbGrid.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls))) + Val(Abs(Val(rstemp!FAValueEnd) - Val(rstemp!FAValuestart)))
  603.                             Else
  604.                                 If Val(Abs(Val(rstemp!FAValueEnd) - Val(rstemp!FAValuestart))) <> 0 Then CxbbGrid.TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls)) = Abs(Val(rstemp!FAValueEnd) - Val(rstemp!FAValuestart))
  605.                             End If
  606.                             CxbbGrid.TextMatrix(Jsqte, Sydz("010", GridStr(), Szzls)) = Val(CxbbGrid.TextMatrix(Jsqte, Sydz("010", GridStr(), Szzls))) + Val(rstemp!FAValueEnd)
  607.                             If Val(Val(rstemp!DeprSumEnd) - Val(rstemp!DeprValue)) < Val(rstemp!DeprSumStart) Then
  608.                                 CxbbGrid.TextMatrix(Jsqte, Sydz("011", GridStr(), Szzls)) = Val(CxbbGrid.TextMatrix(Jsqte, Sydz("011", GridStr(), Szzls))) + Val(rstemp!DeprValue) + Val(rstemp!DeprSumStart) - Val(rstemp!DeprSumEnd)
  609.                             End If
  610.                             If Val(rstemp!DeprValue) > 0 Then CxbbGrid.TextMatrix(Jsqte, Sydz("012", GridStr(), Szzls)) = Val(CxbbGrid.TextMatrix(Jsqte, Sydz("012", GridStr(), Szzls))) + Val(rstemp!DeprValue)
  611.                             CxbbGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)) = Val(CxbbGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls))) + Val(rstemp!DeprSumEnd)
  612.                             CxbbGrid.TextMatrix(Jsqte, Sydz("014", GridStr(), Szzls)) = Val(CxbbGrid.TextMatrix(Jsqte, Sydz("010", GridStr(), Szzls))) - Val(CxbbGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)))
  613.                             rstemp.MoveNext
  614.                         Wend
  615.                         rstemp.Close
  616.                         Set rstemp = Nothing
  617.                         
  618.                         For Row_Num = 0 To CxbbGrid.Cols - 1
  619.                             CxbbGrid.Cell(flexcpBackColor, Jsqte, Row_Num) = &HFFFF00
  620.                         Next Row_Num
  621.                         
  622.                         Jsqte = Jsqte + 1
  623.                     End If
  624.                 Else
  625.                                         
  626.                     Set rstemp = New ADODB.Recordset
  627.                     rstemp.Open "SELECT SUM(FAValueOld) AS FAValueOld, SUM(FAValueNew) AS FAValueNew,SUM(SumDeprOld) AS SumDeprOld, SUM(SumDeprNew) AS SumDeprNew FROM Gdzc_Variation where Year=" & Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("001", GridStr(), Szzls))) & " and Period=" & Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("002", GridStr(), Szzls))) & Sql_Str, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  628.                     If Not rstemp.EOF Then
  629.                         CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = "本期合计"
  630.                         If Val(rstemp!FAValueNew & "") > Val(rstemp!FAValueOld & "") Then
  631.                             CxbbGrid.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)) = Val(rstemp!FAValueNew & "") - Val(rstemp!FAValueOld & "")
  632.                         Else
  633.                             CxbbGrid.TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls)) = Val(rstemp!FAValueNew & "") - Val(rstemp!FAValueOld & "")
  634.                         End If
  635.                         If Val(rstemp!SumDeprNew & "") > Val(rstemp!SumDeprOld & "") Then
  636.                             CxbbGrid.TextMatrix(Jsqte, Sydz("012", GridStr(), Szzls)) = Val(rstemp!SumDeprNew & "") - Val(rstemp!SumDeprOld & "")
  637.                         Else
  638.                             CxbbGrid.TextMatrix(Jsqte, Sydz("011", GridStr(), Szzls)) = Val(rstemp!SumDeprNew & "") - Val(rstemp!SumDeprOld & "")
  639.                         End If
  640.                     End If
  641.                     rstemp.Close
  642.                     Set rstemp = Nothing
  643.                     
  644.                     Set rstemp = New ADODB.Recordset
  645.                     rstemp.Open "SELECT SUM(Gdzc_DetailedForm.FAValueStart) AS FAValue, " _
  646.                             & "Sum (Gdzc_DetailedForm.DeprSumStart) + Sum(Gdzc_DetailedForm.DeprValue) AS DeprSum " _
  647.                             & "FROM Gdzc_Card RIGHT OUTER JOIN Gdzc_DetailedForm ON " _
  648.                             & "Gdzc_Card.CardCode = Gdzc_DetailedForm.CardCode " _
  649.                             & Str_temp1 _
  650.                             & " and Gdzc_DetailedForm.Year=" & Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("001", GridStr(), Szzls))) & " and Gdzc_DetailedForm.Period=" & Trim(CxbbGrid.TextMatrix(Jsqte - 1, Sydz("002", GridStr(), Szzls))), _
  651.                             Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  652.                     If Not rstemp.EOF Then
  653.                         CxbbGrid.TextMatrix(Jsqte, Sydz("010", GridStr(), Szzls)) = Val(CxbbGrid.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls))) - Val(CxbbGrid.TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls))) + Val(rstemp!FAValue)
  654.                         CxbbGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)) = Val(CxbbGrid.TextMatrix(Jsqte, Sydz("012", GridStr(), Szzls))) + Val(Trim(rstemp!DeprSum & "")) - Val(CxbbGrid.TextMatrix(Jsqte, Sydz("011", GridStr(), Szzls)))
  655.                         CxbbGrid.TextMatrix(Jsqte, Sydz("014", GridStr(), Szzls)) = Val(CxbbGrid.TextMatrix(Jsqte, Sydz("010", GridStr(), Szzls))) - Val(CxbbGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)))
  656.                     End If
  657.                     rstemp.Close
  658.                     Set rstemp = Nothing
  659.                     
  660.                     For Row_Num = 0 To CxbbGrid.Cols - 1
  661.                         CxbbGrid.Cell(flexcpBackColor, Jsqte, Row_Num) = &HFFFF00
  662.                     Next Row_Num
  663.                     
  664.                     Jsqte = Jsqte + 1
  665.                 End If
  666.             End If
  667.         Loop
  668.     End With
  669.     
  670.     '为零时清空单元格
  671.     Call Txt_Clear
  672.     
  673. End Sub
  674. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  675.     
  676.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  677.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  678.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  679.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  680.     ReDim Bbxbt(1 To Bbxbtgs)
  681.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  682.     
  683.     If Bbbwhgs <> 0 Then
  684.         ReDim Bbbwh(1 To Bbbwhgs)
  685.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  686.     End If
  687.     
  688.     Bbzbt = ReportTitle
  689.     Bbxbt(1) = " "
  690.     bbxbtzzxs(1) = 0                                     '报表行组织形式(0-居左 1-居中 2-居右)
  691.     
  692.     Bbxbt(1) = Space(2) + Fun_FormatOutPut(Trim(Label1.Caption) & Trim(Lbl_Sort.Caption), 35)
  693.     Bbxbt(1) = Bbxbt(1) + Trim(Trim(Label3.Caption) & Trim(Lbl_Dept.Caption))
  694.     Call Scyxsjb(CxbbGrid)                               '生成报表数据
  695.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  696.   
  697.     If Not bbylte Then
  698.         Unload DY_Tybbyldy
  699.     End If
  700. End Sub
  701. '*****************************************************
  702. '[>>自定义函数
  703. '取右字符串
  704. Function RightChar(str As String) As String
  705.     If str = "" Then Exit Function
  706.     
  707.     Dim i As Integer
  708.     
  709.     i = InStrRev(str, ".")
  710.     RightChar = Mid(str, i + 1)
  711.     
  712. End Function
  713. '取左字符串
  714. Function LeftChar(str As String) As String
  715.     If str = "" Then Exit Function
  716.     
  717.     Dim i As Integer
  718.     
  719.     i = InStr(str, ".")
  720.     LeftChar = Mid(str, 1, i - 1)
  721.     
  722. End Function
  723. '为零时清空单元格
  724. Function Txt_Clear()
  725.     Dim Row_Integer, Col_Integer As Integer         '行数和列数变量
  726.     
  727.     For Row_Integer = CxbbGrid.FixedRows To CxbbGrid.Rows - 1
  728.         For Col_Integer = 7 To CxbbGrid.Cols - 1
  729.             If Format(Val(CxbbGrid.TextMatrix(Row_Integer, Col_Integer)), "0.00") = 0# Then
  730.                 CxbbGrid.TextMatrix(Row_Integer, Col_Integer) = ""
  731.             End If
  732.         Next Col_Integer
  733.     Next Row_Integer
  734.     
  735. End Function
  736. '<<]
  737. '****************************************************