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

企业管理

开发平台:

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 Kpgl_CardList 
  5.    Caption         =   "卡片基本操作"
  6.    ClientHeight    =   8595
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   11880
  10.    HelpContextID   =   503001
  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 VSFlex8Ctl.VSFlexGrid CxbbGrid 
  19.       Height          =   7215
  20.       Left            =   0
  21.       TabIndex        =   0
  22.       Top             =   1440
  23.       Width           =   11895
  24.       _cx             =   5080
  25.       _cy             =   5080
  26.       Appearance      =   1
  27.       BorderStyle     =   1
  28.       Enabled         =   -1  'True
  29.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  30.          Name            =   "宋体"
  31.          Size            =   9
  32.          Charset         =   134
  33.          Weight          =   400
  34.          Underline       =   0   'False
  35.          Italic          =   0   'False
  36.          Strikethrough   =   0   'False
  37.       EndProperty
  38.       MousePointer    =   0
  39.       BackColor       =   -2147483643
  40.       ForeColor       =   -2147483640
  41.       BackColorFixed  =   -2147483633
  42.       ForeColorFixed  =   -2147483630
  43.       BackColorSel    =   -2147483635
  44.       ForeColorSel    =   -2147483634
  45.       BackColorBkg    =   -2147483636
  46.       BackColorAlternate=   -2147483643
  47.       GridColor       =   -2147483633
  48.       GridColorFixed  =   -2147483632
  49.       TreeColor       =   -2147483632
  50.       FloodColor      =   192
  51.       SheetBorder     =   -2147483642
  52.       FocusRect       =   1
  53.       HighLight       =   1
  54.       AllowSelection  =   -1  'True
  55.       AllowBigSelection=   -1  'True
  56.       AllowUserResizing=   0
  57.       SelectionMode   =   0
  58.       GridLines       =   1
  59.       GridLinesFixed  =   2
  60.       GridLineWidth   =   1
  61.       Rows            =   50
  62.       Cols            =   10
  63.       FixedRows       =   1
  64.       FixedCols       =   1
  65.       RowHeightMin    =   0
  66.       RowHeightMax    =   0
  67.       ColWidthMin     =   0
  68.       ColWidthMax     =   0
  69.       ExtendLastCol   =   0   'False
  70.       FormatString    =   ""
  71.       ScrollTrack     =   0   'False
  72.       ScrollBars      =   3
  73.       ScrollTips      =   0   'False
  74.       MergeCells      =   0
  75.       MergeCompare    =   0
  76.       AutoResize      =   -1  'True
  77.       AutoSizeMode    =   0
  78.       AutoSearch      =   0
  79.       AutoSearchDelay =   2
  80.       MultiTotals     =   -1  'True
  81.       SubtotalPosition=   1
  82.       OutlineBar      =   0
  83.       OutlineCol      =   0
  84.       Ellipsis        =   0
  85.       ExplorerBar     =   0
  86.       PicturesOver    =   0   'False
  87.       FillStyle       =   0
  88.       RightToLeft     =   0   'False
  89.       PictureType     =   0
  90.       TabBehavior     =   0
  91.       OwnerDraw       =   0
  92.       Editable        =   0
  93.       ShowComboButton =   1
  94.       WordWrap        =   0   'False
  95.       TextStyle       =   0
  96.       TextStyleFixed  =   0
  97.       OleDragMode     =   0
  98.       OleDropMode     =   0
  99.       DataMode        =   0
  100.       VirtualData     =   -1  'True
  101.       DataMember      =   ""
  102.       ComboSearch     =   3
  103.       AutoSizeMouse   =   -1  'True
  104.       FrozenRows      =   0
  105.       FrozenCols      =   0
  106.       AllowUserFreezing=   0
  107.       BackColorFrozen =   0
  108.       ForeColorFrozen =   0
  109.       WallPaperAlignment=   9
  110.       AccessibleName  =   ""
  111.       AccessibleDescription=   ""
  112.       AccessibleValue =   ""
  113.       AccessibleRole  =   24
  114.    End
  115.    Begin VB.Timer Timer1 
  116.       Enabled         =   0   'False
  117.       Interval        =   1
  118.       Left            =   7110
  119.       Top             =   90
  120.    End
  121.    Begin VB.PictureBox Pic_Title 
  122.       BackColor       =   &H00FFFFFF&
  123.       Height          =   825
  124.       Left            =   0
  125.       Picture         =   "卡片列表.frx":1042
  126.       ScaleHeight     =   765
  127.       ScaleWidth      =   11835
  128.       TabIndex        =   2
  129.       Top             =   570
  130.       Width           =   11895
  131.       Begin MSComctlLib.ImageList ImageList1 
  132.          Left            =   3900
  133.          Top             =   120
  134.          _ExtentX        =   1005
  135.          _ExtentY        =   1005
  136.          BackColor       =   -2147483643
  137.          ImageWidth      =   16
  138.          ImageHeight     =   16
  139.          MaskColor       =   12632256
  140.          _Version        =   393216
  141.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  142.             NumListImages   =   16
  143.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  144.                Picture         =   "卡片列表.frx":35106
  145.                Key             =   "sz"
  146.             EndProperty
  147.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  148.                Picture         =   "卡片列表.frx":354A0
  149.                Key             =   "js"
  150.             EndProperty
  151.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  152.                Picture         =   "卡片列表.frx":3583A
  153.                Key             =   "bd"
  154.             EndProperty
  155.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  156.                Picture         =   "卡片列表.frx":35BD4
  157.                Key             =   "dy"
  158.             EndProperty
  159.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  160.                Picture         =   "卡片列表.frx":35F6E
  161.                Key             =   "yl"
  162.             EndProperty
  163.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  164.                Picture         =   "卡片列表.frx":36308
  165.                Key             =   "xg"
  166.             EndProperty
  167.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  168.                Picture         =   "卡片列表.frx":366A2
  169.                Key             =   "bz"
  170.             EndProperty
  171.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  172.                Picture         =   "卡片列表.frx":36A3C
  173.                Key             =   "tc"
  174.             EndProperty
  175.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  176.                Picture         =   "卡片列表.frx":36DD6
  177.                Key             =   "bcgs"
  178.             EndProperty
  179.             BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  180.                Picture         =   "卡片列表.frx":37170
  181.                Key             =   "mrlk"
  182.             EndProperty
  183.             BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  184.                Picture         =   "卡片列表.frx":3750A
  185.                Key             =   "xsxm"
  186.             EndProperty
  187.             BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  188.                Picture         =   "卡片列表.frx":378A4
  189.                Key             =   "sc"
  190.             EndProperty
  191.             BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  192.                Picture         =   "卡片列表.frx":37C3E
  193.                Key             =   "sx"
  194.             EndProperty
  195.             BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  196.                Picture         =   "卡片列表.frx":37FD8
  197.                Key             =   "cx"
  198.             EndProperty
  199.             BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  200.                Picture         =   "卡片列表.frx":38372
  201.                Key             =   "kp"
  202.             EndProperty
  203.             BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  204.                Picture         =   "卡片列表.frx":3870C
  205.                Key             =   "xz"
  206.             EndProperty
  207.          EndProperty
  208.       End
  209.       Begin VB.Label tsLabel 
  210.          AutoSize        =   -1  'True
  211.          BackColor       =   &H80000018&
  212.          BackStyle       =   0  'Transparent
  213.          Caption         =   "资产卡片列表"
  214.          BeginProperty Font 
  215.             Name            =   "宋体"
  216.             Size            =   12
  217.             Charset         =   134
  218.             Weight          =   700
  219.             Underline       =   0   'False
  220.             Italic          =   0   'False
  221.             Strikethrough   =   0   'False
  222.          EndProperty
  223.          ForeColor       =   &H00000000&
  224.          Height          =   240
  225.          Index           =   4
  226.          Left            =   600
  227.          TabIndex        =   3
  228.          Top             =   240
  229.          Width           =   1530
  230.       End
  231.    End
  232.    Begin MSComctlLib.Toolbar GsToolbar 
  233.       Height          =   525
  234.       Left            =   9390
  235.       TabIndex        =   1
  236.       Top             =   30
  237.       Width           =   2475
  238.       _ExtentX        =   4366
  239.       _ExtentY        =   926
  240.       ButtonWidth     =   1455
  241.       ButtonHeight    =   926
  242.       Appearance      =   1
  243.       Style           =   1
  244.       ImageList       =   "ImageList1"
  245.       _Version        =   393216
  246.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  247.          NumButtons      =   3
  248.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  249.             Caption         =   "保存格式"
  250.             Key             =   "bcgs"
  251.             ImageKey        =   "bcgs"
  252.          EndProperty
  253.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  254.             Caption         =   "默认列宽"
  255.             Key             =   "hfmrgs"
  256.             ImageKey        =   "mrlk"
  257.          EndProperty
  258.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  259.             Caption         =   "显示项目"
  260.             Key             =   "szxsxm"
  261.             ImageKey        =   "xsxm"
  262.          EndProperty
  263.       EndProperty
  264.    End
  265.    Begin MSComctlLib.Toolbar SzToolbar 
  266.       Align           =   1  'Align Top
  267.       Height          =   555
  268.       Left            =   0
  269.       TabIndex        =   4
  270.       Top             =   0
  271.       Width           =   11880
  272.       _ExtentX        =   20955
  273.       _ExtentY        =   979
  274.       ButtonWidth     =   820
  275.       ButtonHeight    =   926
  276.       AllowCustomize  =   0   'False
  277.       Appearance      =   1
  278.       Style           =   1
  279.       ImageList       =   "ImageList1"
  280.       _Version        =   393216
  281.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  282.          NumButtons      =   19
  283.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  284.             Caption         =   "设置"
  285.             Key             =   "ymsz"
  286.             ImageKey        =   "sz"
  287.          EndProperty
  288.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  289.             Caption         =   "打印"
  290.             Key             =   "dy"
  291.             ImageKey        =   "dy"
  292.          EndProperty
  293.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  294.             Caption         =   "预览"
  295.             Key             =   "yl"
  296.             ImageKey        =   "yl"
  297.          EndProperty
  298.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  299.             Style           =   4
  300.          EndProperty
  301.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  302.             Caption         =   "新增"
  303.             Key             =   "xz"
  304.             ImageKey        =   "xz"
  305.          EndProperty
  306.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  307.             Caption         =   "修改"
  308.             Key             =   "xg"
  309.             ImageKey        =   "xg"
  310.          EndProperty
  311.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  312.             Caption         =   "删除"
  313.             Key             =   "sc"
  314.             ImageKey        =   "sc"
  315.          EndProperty
  316.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  317.             Style           =   4
  318.          EndProperty
  319.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  320.             Caption         =   "变动"
  321.             Key             =   "bd"
  322.             ImageKey        =   "bd"
  323.          EndProperty
  324.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  325.             Caption         =   "减少"
  326.             Key             =   "js"
  327.             ImageKey        =   "js"
  328.          EndProperty
  329.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  330.             Style           =   4
  331.          EndProperty
  332.          BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  333.             Caption         =   "卡片"
  334.             Key             =   "kp"
  335.             ImageKey        =   "kp"
  336.          EndProperty
  337.          BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  338.             Style           =   4
  339.          EndProperty
  340.          BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  341.             Caption         =   "查询"
  342.             Key             =   "cx"
  343.             ImageKey        =   "cx"
  344.          EndProperty
  345.          BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  346.             Style           =   4
  347.          EndProperty
  348.          BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  349.             Caption         =   "刷新"
  350.             Key             =   "sx"
  351.             ImageKey        =   "sx"
  352.          EndProperty
  353.          BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  354.             Style           =   4
  355.          EndProperty
  356.          BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  357.             Caption         =   "帮助"
  358.             Key             =   "bz"
  359.             ImageKey        =   "bz"
  360.          EndProperty
  361.          BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  362.             Caption         =   "退出"
  363.             Key             =   "fh"
  364.             ImageKey        =   "tc"
  365.          EndProperty
  366.       EndProperty
  367.       BorderStyle     =   1
  368.       Begin VB.TextBox Txt_Bit 
  369.          Height          =   270
  370.          Left            =   5070
  371.          TabIndex        =   5
  372.          Text            =   "Text1"
  373.          Top             =   1230
  374.          Visible         =   0   'False
  375.          Width           =   1035
  376.       End
  377.    End
  378. End
  379. Attribute VB_Name = "Kpgl_CardList"
  380. Attribute VB_GlobalNameSpace = False
  381. Attribute VB_Creatable = False
  382. Attribute VB_PredeclaredId = True
  383. Attribute VB_Exposed = False
  384. '**************************************************************************
  385. '*    模 块 名 称 :卡片列表
  386. '*    功 能 描 述 :
  387. '*    程序员姓名  :徐衍民
  388. '*    最后修改人  :徐衍民
  389. '*    最后修改时间:2001/11/21
  390. '*    备        注:
  391. '**************************************************************************
  392. Dim ReportTitle As String                '报表主标题
  393. Dim Card_Str As String                   '用户录入查询条件
  394. Dim rstemp As ADODB.Recordset            '临时打开数据集变量
  395. Dim Str_RightEdit As String              '编辑(新增、修改、删除)权限索引
  396. Public Tj_YesNo As Boolean               '是否点击条件窗体“确定”按钮
  397. '以下为固定使用变量
  398. Dim Dyymctbl As New DY_Dyymsz            '打印页面窗体变量
  399. Dim GridCode As String                   '显示网格网格代码
  400. Dim GridInf() As Variant                 '整个网格设置信息
  401. Dim Tsxx As String                       '系统提示信息
  402. Dim Qslz As Long                         '网格隐藏(非操作显示)列数
  403. Dim Sjhgd As Double                      '网格数据行高度
  404. Dim Sfxshjwg As Boolean                  '是否显示合计网格
  405. Dim GridBoolean() As Boolean             '网格列信息(布尔型)
  406. Dim GridStr()  As String                 '网格列信息(字符型)
  407. Dim GridInt() As Integer                 '网格列信息(整型)
  408. Dim Szzls As Integer                     '数组总列数(网格列数-1)
  409. Private Sub CxbbGrid_Click()             '单击数据行决定按钮状态
  410.     
  411.     If CxbbGrid.Row > CxbbGrid.FixedRows - 1 Then
  412.         
  413.         Set rstemp = New ADODB.Recordset
  414.         rstemp.Open "select * from Gdzc_Card where CardCode='" & Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 0)) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  415.         If Not rstemp.EOF Then
  416.             If rstemp!Year = Xtyear And rstemp!Period = Xtmm Then
  417.                 SzToolbar.Buttons("xg").Enabled = True
  418.                 SzToolbar.Buttons("sc").Enabled = True
  419.                 SzToolbar.Buttons("bd").Enabled = False
  420.                 SzToolbar.Buttons("js").Enabled = False
  421.             Else
  422.                 SzToolbar.Buttons("xg").Enabled = False
  423.                 SzToolbar.Buttons("sc").Enabled = False
  424.                 SzToolbar.Buttons("bd").Enabled = True
  425.                 SzToolbar.Buttons("js").Enabled = True
  426.             End If
  427.         End If
  428.         rstemp.Close
  429.         Set rstemp = Nothing
  430.     End If
  431.     
  432. End Sub
  433. '双击数据行,进入卡片修改状态
  434. Private Sub CxbbGrid_DblClick()
  435.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  436.     If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  437.         Exit Sub
  438.     End If
  439.     If CxbbGrid.Rows > CxbbGrid.FixedRows Then
  440.         Kpgl_jbcz.str_State = "3"
  441.         Kpgl_jbcz.str_CardNumber = CxbbGrid.TextMatrix(CxbbGrid.Row, 0)
  442.         Kpgl_jbcz.Show 1
  443.         Me.Txt_Bit = "1"
  444.     Else
  445.         Tsxx = "无可选记录!"
  446.         Call Xtxxts(Tsxx, 0, 4)
  447.         Exit Sub
  448.     End If
  449.     
  450. End Sub
  451. Private Sub Form_Resize()                '根据窗体大小来调整网格,标题栏大小
  452.     
  453.     On Error Resume Next
  454.     With CxbbGrid
  455.         .Width = Me.Width - 160
  456.         .Height = Me.Height - .Top - 400
  457.     End With
  458.     With Pic_Title
  459.         .Width = Me.Width - 160
  460.     End With
  461.     
  462.     GsToolbar.Left = Me.Width - GsToolbar.Width - 160
  463. End Sub
  464. Private Sub Form_Load()                                                   '窗体装入
  465.      
  466.     '调入打印页面设置窗体
  467.     ReportTitle = "固定资产卡片列表"
  468.     XtReportCode = "Gdzc_V_CardList"
  469.     Load Dyymctbl
  470.      
  471.     '调整标题栏及网格、格式工具条位置
  472.     Pic_Title.Left = 40
  473.     Pic_Title.Top = SzToolbar.Top + SzToolbar.Height - 10
  474.     CxbbGrid.Left = Pic_Title.Left
  475.     CxbbGrid.Top = Pic_Title.Top + Pic_Title.Height + 20
  476.     
  477.     '调 入 网 格
  478.     GridCode = "Gdzc_V_CardList"
  479.     Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  480.      
  481.     Qslz = GridInf(1)
  482.     Sjhgd = GridInf(2)
  483.     Sfxshjwg = GridInf(7)
  484.     Szzls = CxbbGrid.Cols - 1
  485.     '由会计期间决定按钮状态
  486.     Set rstemp = New ADODB.Recordset
  487.     rstemp.Open "select top 1 * from gy_kjrlb where gdzcjzbz='0'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  488.     If Not rstemp.EOF Then
  489.         If Val(rstemp!KjYear) <> Val(Xtyear) Or Val(rstemp!Period) <> Val(Xtmm) Then
  490.             SzToolbar.Buttons("xz").Enabled = False
  491.             SzToolbar.Buttons("xg").Enabled = False
  492.             SzToolbar.Buttons("sc").Enabled = False
  493.             SzToolbar.Buttons("bd").Enabled = True
  494.             SzToolbar.Buttons("js").Enabled = True
  495.         Else
  496.             SzToolbar.Buttons("xz").Enabled = True
  497.             SzToolbar.Buttons("xg").Enabled = True
  498.             SzToolbar.Buttons("sc").Enabled = True
  499.             SzToolbar.Buttons("bd").Enabled = False
  500.             SzToolbar.Buttons("js").Enabled = False
  501.         End If
  502.     End If
  503.     rstemp.Close
  504.     Set rstemp = Nothing
  505.     
  506.     '编辑(新增、修改、删除)权限索引
  507.     Str_RightEdit = "Gdzc_Jbcz_Edit"
  508.     
  509. End Sub
  510. Private Sub Form_Unload(Cancel As Integer)                                  '窗体卸载
  511.     
  512.     '卸载条件窗体
  513.     Kpgl_Search.UnloadCheck.Value = 1
  514.     Unload Kpgl_Search
  515.     '卸载打印页面设置窗体
  516.     Unload Dyymctbl
  517. End Sub
  518. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)       '网格格式调整
  519.     
  520.     Select Case Button.Key
  521.         Case "bcgs"                                          '保存表格格式
  522.           Call Bcwggs(CxbbGrid, GridCode, GridStr)
  523.         Case "hfmrgs"                                        '恢复默认格式
  524.           Call Hfmrgs(CxbbGrid, GridCode, GridStr)
  525.         Case "szxsxm"                                        '设置显示项目
  526.           Call Szxsxm(CxbbGrid, GridCode)
  527.     End Select
  528. End Sub
  529. Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
  530.     
  531.     Select Case Button.Key
  532.         Case "ymsz"                                          '页面设置
  533.             Dyymctbl.Show 1
  534.         Case "yl"                                            '预 览
  535.             Call bbyl(True)
  536.         Case "dy"                                            '打 印
  537.             Call bbyl(False)
  538.         Case "cx"                                            '查 询
  539.             Kpgl_Search.Show 1
  540.         Case "kp"
  541.             If CxbbGrid.Rows > CxbbGrid.FixedRows - 1 Then CxbbGrid_DblClick
  542.         Case "xz"                                            '新增
  543.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  544.             If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  545.                 Exit Sub
  546.             End If
  547.             
  548.             If If_Add = True Then
  549.                 Kpgl_jbcz.str_State = "1"
  550.                 Kpgl_jbcz.Show 1
  551.             End If
  552.         Case "xg"                                            '修改
  553.             If If_Add = True Then
  554.                 If CxbbGrid.Rows > 1 Then CxbbGrid_DblClick
  555.             End If
  556.         Case "sc"                                            '删除
  557.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  558.             If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  559.                 Exit Sub
  560.             End If
  561.             If CxbbGrid.Rows > 1 Then Call Rs_Del
  562.         Case "bd"                                            '变动
  563.             If CxbbGrid.Rows > 1 And Edit_Bit = True Then
  564.                 FAVari_Variation.Lbl_Num = Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 0))
  565.                 FAVari_Variation.Show 1
  566.             End If
  567.         Case "js"                                            '减少
  568.             If CxbbGrid.Rows > 1 And Edit_Bit = True Then
  569.                 FAVari_Lessen.Lbl_Num = Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 0))
  570.                 FAVari_Lessen.Show 1
  571.             End If
  572.         Case "sx"                                            '刷新
  573.             If Tj_YesNo = False Then Exit Sub
  574.             Timer1.Enabled = True
  575.         Case "fh"                                            '退 出
  576.             Unload Me
  577.         Case "bz"
  578.             SendKeys "{F1}"
  579.      End Select
  580.      
  581. End Sub
  582. Private Sub Timer1_Timer()                                 '在窗体激活后调入查询程序
  583.     
  584.     Timer1.Enabled = False
  585.     Xt_Wait.Show
  586.     Xt_Wait.Refresh
  587.     
  588.     '加快显示速度
  589.     CxbbGrid.Redraw = False
  590.     
  591.     '生成查询结果
  592.     Call Sub_Query
  593.     
  594.     CxbbGrid_Click
  595.     
  596.     CxbbGrid.Redraw = True
  597.      
  598.     Xt_Wait.Hide
  599.     
  600. End Sub
  601. Private Sub Sub_Query()                                    '生成查询结果
  602.     
  603.     Dim Rec_Query As New ADODB.Recordset        '查询结果动态集
  604.     Dim Sqlstr As String                        '查询字符串
  605.     Dim Coljsq As Long                          '网格列计数器
  606.     Dim Jsqte As Integer                        '临时动态计数器
  607.     Dim lng_CurrentRow As Long                  '当前行
  608.     
  609.     '以下为自定义部分[
  610.     With Kpgl_Search
  611.         '生成查询条件
  612.         Card_Str = " where 1=1 "
  613.         For Jsqte = 1 To 9
  614.             Select Case Jsqte
  615.                 Case 1      '卡片开始录入日期
  616.                     If Trim(.LrText(0).Text) <> "" Then
  617.                         Card_Str = Card_Str & " And writedate>=' " & Trim(.LrText(0).Text) & "'"
  618.                     End If
  619.                 Case 2      '卡片录入终止日期
  620.                     If Trim(.LrText(1).Text) <> "" Then
  621.                         Card_Str = Card_Str & " and writedate <= '" & Trim(.LrText(1).Text) & "'"
  622.                     End If
  623.                 Case 3      '卡片编号(开始)
  624.                     If Trim(.LrText(2).Text) <> "" Then
  625.                         Card_Str = Card_Str & " and Cardcode>='" & Trim(.LrText(2).Text) & "'"
  626.                     End If
  627.                 Case 4      '卡片编号(终止)
  628.                     If Trim(.LrText(3).Text) <> "" Then
  629.                         Card_Str = Card_Str & " and cardcode<='" & Trim(.LrText(3).Text) & "'"
  630.                     End If
  631.                 Case 5      '资产编号
  632.                     If Trim(.LrText(4).Text) <> "" Then
  633.                         Card_Str = Card_Str & " and FACode>='" & (Trim(.LrText(4).Text)) & "'"
  634.                     End If
  635.                 Case 6      '资产编号
  636.                     If Trim(.LrText(5).Text) <> "" Then
  637.                         Card_Str = Card_Str & " and FACode<='" & (Trim(.LrText(5).Text)) & "'"
  638.                     End If
  639.                 Case 7      '资产类别编号
  640.                     If Trim(.LrText(6).Text) <> "" Then
  641.                         Card_Str = Card_Str & " and FASortCode='" & Trim(.LrText(6).Tag) & "'"
  642.                     End If
  643.                 Case 8      '部门编号
  644.                     If Trim(.LrText(7).Text) <> "" Then
  645.                         Card_Str = Card_Str & " and DeptCode='" & Trim(.LrText(7).Tag) & "'"
  646.                     End If
  647.                 Case 9      '设备位号
  648.                     If Trim(.LrText(8).Text) <> "" Then
  649.                         Card_Str = Card_Str & " and setlocaNum='" & Trim(.LrText(8).Text) & "'"
  650.                     End If
  651.             End Select
  652.         Next Jsqte
  653.     End With
  654.  
  655.     lng_CurrentRow = CxbbGrid.Row
  656.     
  657.     Sqlstr = "SELECT * From Gdzc_V_CardList " & Card_Str & " ORDER BY CardCode"
  658.     Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  659.     With Rec_Query
  660.         CxbbGrid.Rows = CxbbGrid.FixedRows
  661.         CxbbGrid.Rows = CxbbGrid.FixedRows + .RecordCount
  662.         Jsqte = CxbbGrid.FixedRows
  663.         
  664.         Do While Not .EOF
  665.             If Jsqte >= CxbbGrid.Rows Then
  666.                 CxbbGrid.AddItem ""
  667.             End If
  668.             
  669.             CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("CardCode") & "")                                          '卡片编号
  670.             CxbbGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("FASortName") & "")                                        '资产类别
  671.             CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("FACode") & "")                                            '资产编号
  672.             CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("FAName") & "")                                            '资产名称
  673.             CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("SpecificationMode") & "")                                 '规格型号
  674.             CxbbGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("MeasureUnit"))                                            '计量单位
  675.             If Val(.Fields("FAQuantity")) <> 0 Then CxbbGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("FAQuantity"))     '资产数量
  676.             CxbbGrid.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)) = Trim(.Fields("FAVariName"))                                             '变动方式
  677.             If Val(.Fields("FAValue")) <> 0 Then CxbbGrid.TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls)) = Trim(.Fields("FAValue") & "")      '资产原值
  678.             If Val(.Fields("UseYears")) <> 0 Then CxbbGrid.TextMatrix(Jsqte, Sydz("010", GridStr(), Szzls)) = Trim(.Fields("UseYears") & "")    '使用年限
  679.             If Val(.Fields("DeprSum")) <> 0 Then CxbbGrid.TextMatrix(Jsqte, Sydz("011", GridStr(), Szzls)) = Trim(.Fields("DeprSum"))           '累计折旧
  680.             If Val(.Fields("FactValue")) <> 0 Then CxbbGrid.TextMatrix(Jsqte, Sydz("012", GridStr(), Szzls)) = Trim(.Fields("FactValue"))       '净资产
  681.             Select Case .Fields("DeprMethod")                                                                                                   '折旧方法
  682.                 Case "01"
  683.                     CxbbGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)) = "不计提折旧"
  684.                 Case "02"
  685.                     CxbbGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)) = "平均年限法(依净资产计提折旧)"
  686.                 Case "03"
  687.                     CxbbGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)) = "平均年限法(依帐面原值计提折旧)"
  688.                 Case "04"
  689.                     CxbbGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)) = "工作量法"
  690.                 Case "05"
  691.                     CxbbGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)) = "固定折旧额折旧法"
  692.                 Case "06"
  693.                     CxbbGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)) = "年数总和法"
  694.                 Case "07"
  695.                     CxbbGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)) = "双倍余额法"
  696.             End Select
  697.             CxbbGrid.TextMatrix(Jsqte, Sydz("014", GridStr(), Szzls)) = Format(.Fields("BeginUseDate"), "yyyy-mm-dd")                           '开始使用日期
  698.             CxbbGrid.TextMatrix(Jsqte, Sydz("015", GridStr(), Szzls)) = Trim(.Fields("SetLocaNum") & "")                                        '设备位号
  699.             CxbbGrid.TextMatrix(Jsqte, Sydz("016", GridStr(), Szzls)) = Format(.Fields("WriteDate"), "yyyy-mm-dd")                              '录入日期
  700.             CxbbGrid.RowHeight(Jsqte) = Sjhgd
  701.             .MoveNext
  702.             Jsqte = Jsqte + 1
  703.         Loop
  704.     End With
  705.     If lng_CurrentRow > CxbbGrid.Rows - 1 Then
  706.         lng_CurrentRow = lng_CurrentRow - 1
  707.     End If
  708.    
  709.     If Kpgl_jbcz.str_State = "1" Then
  710.         lng_CurrentRow = CxbbGrid.Rows - 1
  711.     End If
  712.    
  713.     If lng_CurrentRow = 0 Then Exit Sub
  714.     CxbbGrid.TopRow = lng_CurrentRow
  715.     If lng_CurrentRow < CxbbGrid.Rows Then
  716.         CxbbGrid.Select lng_CurrentRow, 1, lng_CurrentRow, CxbbGrid.Cols - 1
  717.     End If
  718.    
  719.     ']以上为用户自定义部分
  720. End Sub
  721. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  722.     
  723.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  724.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  725.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  726.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  727.     ReDim Bbxbt(1 To Bbxbtgs)
  728.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  729.     
  730.     If Bbbwhgs <> 0 Then
  731.         ReDim Bbbwh(1 To Bbbwhgs)
  732.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  733.     End If
  734.     
  735.     Bbzbt = ReportTitle
  736.     Bbxbt(1) = " "
  737.     bbxbtzzxs(1) = 0                                     '报表行组织形式(0-居左 1-居中 2-居右)
  738.     
  739.     Call Scyxsjb(CxbbGrid)                               '生成报表数据
  740.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  741.   
  742.     If Not bbylte Then
  743.         Unload DY_Tybbyldy
  744.     End If
  745. End Sub
  746. '***********************************************************************************
  747. '[>>自定义
  748. '本月是否已经进行计提折旧
  749. Function If_Add() As Boolean
  750.     
  751.     If_Add = False
  752.     Set rstemp = New ADODB.Recordset
  753.     rstemp.Open "select * from Gdzc_card where DeprFlag='1'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  754.     If rstemp.EOF Then
  755.         If_Add = True
  756.     Else
  757.         Tsxx = "固定资产已计提折旧,未执行月末结帐!"
  758.         Call Xtxxts(Tsxx, 0, 4)
  759.         Exit Function
  760.     End If
  761.     rstemp.Close
  762.     Set rstemp = Nothing
  763. End Function
  764. '删除操作
  765. Function Rs_Del()
  766.     
  767.     Dim FAValue_Temp As Double              '修改原资产原值变量
  768.     Dim DeprSum_temp As Double              '修改原累计折旧变量
  769.     Dim DeptCode_temp As String             '部门编号
  770.     Dim FASortCode_temp As String           '资产类别编号
  771.     Dim str As String
  772.     
  773.     '已计提折旧资产不能发生变动
  774.     Set rstemp = New ADODB.Recordset
  775.     rstemp.Open "select * from Gdzc_Variation where FAVariCode='00501' and Cardcode='" & Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 0)) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  776.     If Not rstemp.EOF Then
  777.         Tsxx = "该资产卡片已经计提折旧,不能删除!"
  778.         Call Xtxxts(Tsxx, 0, 4)
  779.         Exit Function
  780.     End If
  781.     rstemp.Close
  782.     Set rstemp = Nothing
  783.     
  784.     '非本会计期间不能进行数据添加、修改、删除操作
  785.     Set rstemp = New ADODB.Recordset
  786.     rstemp.Open "select * from gdzc_card where CardCode='" & Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 0)) & "' and year=" & CInt(Xtyear) & " and period=" & CInt(Xtmm), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  787.     If rstemp.EOF Then
  788.        Tsxx = "请操作本会计期间数据!"
  789.        Call Xtxxts(Tsxx, 0, 4)
  790.        Exit Function
  791.     End If
  792.     rstemp.Close
  793.     Set rstemp = Nothing
  794.     
  795.     If MsgBox("真的要删除该记录吗?", vbOKCancel + vbDefaultButton2 + vbQuestion, "百利/ERP5.0-固定资产") = vbOK Then
  796.         
  797.         On Error GoTo Cwcl
  798.         Cw_DataEnvi.DataConnect.BeginTrans
  799.         '删除资产卡片
  800.         Set rstemp = New ADODB.Recordset
  801.         rstemp.Open "select * from Gdzc_Card where CardCode='" & Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 0)) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  802.         If Not rstemp.EOF Then
  803.             FAValue_Temp = rstemp.Fields("FAValue")                                 '借助变量存储修改资产原值
  804.             DeprSum_temp = rstemp.Fields("DeprSum")
  805.             DeptCode_temp = rstemp.Fields("DeptCode")
  806.             FASortCode_temp = rstemp.Fields("FASortCode")
  807.             rstemp.Delete
  808.             rstemp.Update
  809.         Else
  810.             Tsxx = "请操作本会计期间的记录!"
  811.             Call Xtxxts(Tsxx, 0, 4)
  812.             Exit Function
  813.         End If
  814.         rstemp.Close
  815.         Set rstemp = Nothing
  816.         
  817.         '删除工作量表
  818.         Set rstemp = New ADODB.Recordset
  819.         With rstemp
  820.             .Open "select * from Gdzc_jobquantity where CardCode='" & Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 0)) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  821.             If Not .EOF Then
  822.                 .Delete
  823.                 .Update
  824.             End If
  825.         End With
  826.         rstemp.Close
  827.         Set rstemp = Nothing
  828.         
  829.         '删除会计明细表记录
  830.         Set rstemp = New ADODB.Recordset
  831.         With rstemp
  832.             .Open "select * from Gdzc_DetailedForm where CardCode='" & Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 0)) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  833.             .Delete
  834.             .Update
  835.         End With
  836.         rstemp.Close
  837.         Set rstemp = Nothing
  838.         
  839.         '修改资产汇总表记录
  840.         Set rstemp = New ADODB.Recordset
  841.         str = "select * from Gdzc_Total where DeptCode='" & DeptCode_temp & "' and FASortCode='" & FASortCode_temp & "'"
  842.         rstemp.Open str, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  843.         With rstemp
  844.             If Not .EOF Then
  845.                 If Val(.Fields("FAValueEndM")) = Val(FAValue_Temp) Then
  846.                     .Delete
  847.                     .Update
  848.                 Else
  849.                     .Fields("FAValueEndM") = CCur(Format(Val(.Fields("FAValueEndM")) - FAValue_Temp, "##0.00"))       '月末原值
  850.                     .Fields("DeprSumEndM") = CCur(Val(.Fields("DeprSumEndM")) - DeprSum_temp)  '月末累计折旧
  851.                     .Fields("FAValueInM") = CCur(Val(.Fields("FAValueInM")) - FAValue_Temp)     '本期增加原值
  852.                     .Fields("DeprSumInM") = CCur(Val(.Fields("DeprSumInM")) - DeprSum_temp)      '本期累计折旧增加
  853.                     .Update
  854.                 End If
  855.             End If
  856.         End With
  857.         rstemp.Close
  858.         Set rstemp = Nothing
  859.         
  860.         '删除资产变动单据表
  861.         Set rstemp = New ADODB.Recordset
  862.         With rstemp
  863.             .Open "Select * from Gdzc_Variation where CardCode='" & Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 0)) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  864.             While Not .EOF
  865.                 .Delete
  866.                 .Update
  867.                 .MoveNext
  868.             Wend
  869.         End With
  870.         rstemp.Close
  871.         Set rstemp = Nothing
  872.         
  873.         '判断并修改自定义属性表
  874.         Set rstemp = New ADODB.Recordset
  875.         rstemp.Open "select * from gdzc_Custom where FieldState='1'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  876.         While Not rstemp.EOF
  877.             Set rs = New ADODB.Recordset
  878.             rs.Open "select * from gdzc_card where convert(char(20)," & Trim(rstemp!FieldCode) & ")<>''", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  879.             If rs.EOF Then
  880.                 rstemp!WhetherNull = False
  881.                 rstemp.Update
  882.             End If
  883.             rs.Close
  884.             Set rs = Nothing
  885.             
  886.             rstemp.MoveNext
  887.         Wend
  888.         rstemp.Close
  889.         Set rstemp = Nothing
  890.         
  891.         Cw_DataEnvi.DataConnect.CommitTrans
  892.         Call Sub_Query
  893.                 
  894.         Exit Function
  895.     Else
  896.         Exit Function
  897.     End If
  898. Cwcl:
  899.     Cw_DataEnvi.DataConnect.RollbackTrans
  900.     Tsxx = "删除出错,系统自动返回删除前状态!"
  901.     Call Xtxxts(Tsxx, 0, 1)
  902.     Exit Function
  903.     
  904. End Function
  905. '判断选中记录是否可以操作
  906. Function Edit_Bit() As Boolean
  907.     
  908.     Edit_Bit = False
  909.     
  910.     Set rstemp = New ADODB.Recordset
  911.     rstemp.Open "select * from gdZc_card where cardCode='" & Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 0)) & "' and year=" & Xtyear & " and period=" & Xtmm, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  912.     If Not rstemp.EOF Then
  913.         Tsxx = "本会计期间录入卡片只能进行修改或删除!     "
  914.         Call Xtxxts(Tsxx, 0, 4)
  915.         Exit Function
  916.     End If
  917.     rstemp.Close
  918.     Set rstemp = Nothing
  919.     
  920.     Set rstemp = Cw_DataEnvi.DataConnect.Execute("select top 1 * from gy_kjrlb where gdzcjzbz='0'")
  921.     If Not rstemp.EOF Then
  922.         If Val(rstemp!KjYear) <> Val(Xtyear) Or Val(rstemp!Period) <> Val(Xtmm) Then
  923.             Tsxx = "非当前会计期间不能进行此操作!"
  924.             Call Xtxxts(Tsxx, 0, 4)
  925.             Exit Function
  926.         End If
  927.     End If
  928.     rstemp.Close
  929.     Set rstemp = Nothing
  930.     
  931.     Edit_Bit = True
  932.     
  933. End Function
  934. '<<]
  935. '***********************************************************************************