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

企业管理

开发平台:

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 YS_FrmProfitBudget 
  5.    BackColor       =   &H00C0C0C0&
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "利润预算表"
  8.    ClientHeight    =   7965
  9.    ClientLeft      =   675
  10.    ClientTop       =   720
  11.    ClientWidth     =   11400
  12.    BeginProperty Font 
  13.       Name            =   "宋体"
  14.       Size            =   14.25
  15.       Charset         =   0
  16.       Weight          =   700
  17.       Underline       =   0   'False
  18.       Italic          =   0   'False
  19.       Strikethrough   =   0   'False
  20.    EndProperty
  21.    HelpContextID   =   411004004
  22.    Icon            =   "预算设置_利润预算.frx":0000
  23.    KeyPreview      =   -1  'True
  24.    LinkTopic       =   "Form4"
  25.    MaxButton       =   0   'False
  26.    MinButton       =   0   'False
  27.    ScaleHeight     =   7965
  28.    ScaleWidth      =   11400
  29.    StartUpPosition =   1  '所有者中心
  30.    Begin VB.CommandButton Ydcommand 
  31.       BeginProperty Font 
  32.          Name            =   "MS Sans Serif"
  33.          Size            =   8.25
  34.          Charset         =   0
  35.          Weight          =   400
  36.          Underline       =   0   'False
  37.          Italic          =   0   'False
  38.          Strikethrough   =   0   'False
  39.       EndProperty
  40.       Height          =   300
  41.       Left            =   9030
  42.       Picture         =   "预算设置_利润预算.frx":1042
  43.       Style           =   1  'Graphical
  44.       TabIndex        =   1
  45.       Top             =   3660
  46.       Visible         =   0   'False
  47.       Width           =   300
  48.    End
  49.    Begin VB.PictureBox Pic_Title 
  50.       BeginProperty Font 
  51.          Name            =   "MS Sans Serif"
  52.          Size            =   8.25
  53.          Charset         =   0
  54.          Weight          =   400
  55.          Underline       =   0   'False
  56.          Italic          =   0   'False
  57.          Strikethrough   =   0   'False
  58.       EndProperty
  59.       Height          =   1125
  60.       Left            =   0
  61.       Picture         =   "预算设置_利润预算.frx":13CC
  62.       ScaleHeight     =   1065
  63.       ScaleWidth      =   11715
  64.       TabIndex        =   7
  65.       Top             =   570
  66.       Width           =   11775
  67.       Begin MSComctlLib.ImageList ImageList1 
  68.          Left            =   4260
  69.          Top             =   60
  70.          _ExtentX        =   1005
  71.          _ExtentY        =   1005
  72.          BackColor       =   -2147483643
  73.          ImageWidth      =   16
  74.          ImageHeight     =   16
  75.          MaskColor       =   12632256
  76.          _Version        =   393216
  77.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  78.             NumListImages   =   25
  79.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  80.                Picture         =   "预算设置_利润预算.frx":35490
  81.                Key             =   "sz"
  82.             EndProperty
  83.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  84.                Picture         =   "预算设置_利润预算.frx":3582A
  85.                Key             =   "dy"
  86.             EndProperty
  87.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  88.                Picture         =   "预算设置_利润预算.frx":35BC4
  89.                Key             =   "yl"
  90.             EndProperty
  91.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  92.                Picture         =   "预算设置_利润预算.frx":35F5E
  93.                Key             =   "xg"
  94.             EndProperty
  95.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  96.                Picture         =   "预算设置_利润预算.frx":362F8
  97.                Key             =   "zh"
  98.             EndProperty
  99.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  100.                Picture         =   "预算设置_利润预算.frx":36692
  101.                Key             =   "sh"
  102.             EndProperty
  103.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  104.                Picture         =   "预算设置_利润预算.frx":36A2C
  105.                Key             =   "bc"
  106.             EndProperty
  107.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  108.                Picture         =   "预算设置_利润预算.frx":36DC6
  109.                Key             =   "fq"
  110.             EndProperty
  111.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  112.                Picture         =   "预算设置_利润预算.frx":37160
  113.                Key             =   "bz"
  114.             EndProperty
  115.             BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  116.                Picture         =   "预算设置_利润预算.frx":374FA
  117.                Key             =   "tc"
  118.             EndProperty
  119.             BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  120.                Picture         =   "预算设置_利润预算.frx":37894
  121.                Key             =   "bcgs"
  122.             EndProperty
  123.             BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  124.                Picture         =   "预算设置_利润预算.frx":37C2E
  125.                Key             =   "mrlk"
  126.             EndProperty
  127.             BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  128.                Picture         =   "预算设置_利润预算.frx":37FC8
  129.                Key             =   "xsxm"
  130.             EndProperty
  131.             BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  132.                Picture         =   "预算设置_利润预算.frx":38362
  133.                Key             =   "first"
  134.             EndProperty
  135.             BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  136.                Picture         =   "预算设置_利润预算.frx":386FC
  137.                Key             =   "prev"
  138.             EndProperty
  139.             BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  140.                Picture         =   "预算设置_利润预算.frx":38A96
  141.                Key             =   "next"
  142.             EndProperty
  143.             BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  144.                Picture         =   "预算设置_利润预算.frx":38E30
  145.                Key             =   "last"
  146.             EndProperty
  147.             BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  148.                Picture         =   "预算设置_利润预算.frx":391CA
  149.                Key             =   "xx"
  150.             EndProperty
  151.             BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  152.                Picture         =   "预算设置_利润预算.frx":39564
  153.                Key             =   "define"
  154.             EndProperty
  155.             BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  156.                Picture         =   "预算设置_利润预算.frx":398FE
  157.                Key             =   "exec"
  158.             EndProperty
  159.             BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  160.                Picture         =   "预算设置_利润预算.frx":39C98
  161.                Key             =   "xz"
  162.             EndProperty
  163.             BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  164.                Picture         =   "预算设置_利润预算.frx":3A032
  165.                Key             =   "sc"
  166.             EndProperty
  167.             BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  168.                Picture         =   "预算设置_利润预算.frx":3A3CC
  169.                Key             =   "sx"
  170.             EndProperty
  171.             BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  172.                Picture         =   "预算设置_利润预算.frx":3A766
  173.                Key             =   "cx"
  174.             EndProperty
  175.             BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  176.                Picture         =   "预算设置_利润预算.frx":3AB00
  177.                Key             =   "zd"
  178.             EndProperty
  179.          EndProperty
  180.       End
  181.       Begin VB.Label lbl_AccountYear 
  182.          BackStyle       =   0  'Transparent
  183.          BeginProperty Font 
  184.             Name            =   "MS Sans Serif"
  185.             Size            =   8.25
  186.             Charset         =   0
  187.             Weight          =   400
  188.             Underline       =   0   'False
  189.             Italic          =   0   'False
  190.             Strikethrough   =   0   'False
  191.          EndProperty
  192.          ForeColor       =   &H00FF0000&
  193.          Height          =   285
  194.          Left            =   2220
  195.          TabIndex        =   11
  196.          Top             =   780
  197.          Width           =   2265
  198.       End
  199.       Begin VB.Label Label1 
  200.          Appearance      =   0  'Flat
  201.          BackColor       =   &H80000005&
  202.          BackStyle       =   0  'Transparent
  203.          Caption         =   "会计年度:"
  204.          BeginProperty Font 
  205.             Name            =   "MS Sans Serif"
  206.             Size            =   8.25
  207.             Charset         =   0
  208.             Weight          =   400
  209.             Underline       =   0   'False
  210.             Italic          =   0   'False
  211.             Strikethrough   =   0   'False
  212.          EndProperty
  213.          ForeColor       =   &H80000008&
  214.          Height          =   195
  215.          Index           =   2
  216.          Left            =   1140
  217.          TabIndex        =   10
  218.          Top             =   780
  219.          Width           =   795
  220.       End
  221.       Begin VB.Label Lab_TitleText 
  222.          BackStyle       =   0  'Transparent
  223.          BeginProperty Font 
  224.             Name            =   "MS Sans Serif"
  225.             Size            =   8.25
  226.             Charset         =   0
  227.             Weight          =   400
  228.             Underline       =   0   'False
  229.             Italic          =   0   'False
  230.             Strikethrough   =   0   'False
  231.          EndProperty
  232.          ForeColor       =   &H00FF0000&
  233.          Height          =   225
  234.          Left            =   750
  235.          TabIndex        =   9
  236.          Top             =   690
  237.          Width           =   1455
  238.       End
  239.       Begin VB.Label tsLabel 
  240.          BackColor       =   &H80000018&
  241.          BackStyle       =   0  'Transparent
  242.          Caption         =   "利润预算表"
  243.          BeginProperty Font 
  244.             Name            =   "宋体"
  245.             Size            =   12
  246.             Charset         =   134
  247.             Weight          =   700
  248.             Underline       =   0   'False
  249.             Italic          =   0   'False
  250.             Strikethrough   =   0   'False
  251.          EndProperty
  252.          ForeColor       =   &H00000000&
  253.          Height          =   285
  254.          Index           =   4
  255.          Left            =   630
  256.          TabIndex        =   8
  257.          Top             =   210
  258.          Width           =   2655
  259.       End
  260.    End
  261.    Begin VB.TextBox Ydtext 
  262.       BackColor       =   &H00C0FFFF&
  263.       BorderStyle     =   0  'None
  264.       BeginProperty Font 
  265.          Name            =   "MS Sans Serif"
  266.          Size            =   8.25
  267.          Charset         =   0
  268.          Weight          =   400
  269.          Underline       =   0   'False
  270.          Italic          =   0   'False
  271.          Strikethrough   =   0   'False
  272.       EndProperty
  273.       Height          =   270
  274.       Left            =   7320
  275.       MultiLine       =   -1  'True
  276.       TabIndex        =   0
  277.       Top             =   3600
  278.       Visible         =   0   'False
  279.       Width           =   915
  280.    End
  281.    Begin VB.ComboBox YdCombo 
  282.       BeginProperty Font 
  283.          Name            =   "MS Sans Serif"
  284.          Size            =   8.25
  285.          Charset         =   0
  286.          Weight          =   400
  287.          Underline       =   0   'False
  288.          Italic          =   0   'False
  289.          Strikethrough   =   0   'False
  290.       EndProperty
  291.       Height          =   300
  292.       Left            =   8310
  293.       Style           =   2  'Dropdown List
  294.       TabIndex        =   3
  295.       Top             =   4110
  296.       Visible         =   0   'False
  297.       Width           =   1155
  298.    End
  299.    Begin VB.Timer Timer1 
  300.       Interval        =   1
  301.       Left            =   8310
  302.       Top             =   2970
  303.    End
  304.    Begin VSFlex8Ctl.VSFlexGrid WglrGrid 
  305.       Height          =   6225
  306.       Left            =   0
  307.       TabIndex        =   4
  308.       Top             =   1710
  309.       Width           =   11775
  310.       _cx             =   5080
  311.       _cy             =   5080
  312.       Appearance      =   1
  313.       BorderStyle     =   1
  314.       Enabled         =   -1  'True
  315.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  316.          Name            =   "宋体"
  317.          Size            =   9
  318.          Charset         =   134
  319.          Weight          =   400
  320.          Underline       =   0   'False
  321.          Italic          =   0   'False
  322.          Strikethrough   =   0   'False
  323.       EndProperty
  324.       MousePointer    =   0
  325.       BackColor       =   16777215
  326.       ForeColor       =   -2147483640
  327.       BackColorFixed  =   12632256
  328.       ForeColorFixed  =   -2147483630
  329.       BackColorSel    =   -2147483635
  330.       ForeColorSel    =   -2147483634
  331.       BackColorBkg    =   -2147483636
  332.       BackColorAlternate=   16777215
  333.       GridColor       =   -2147483633
  334.       GridColorFixed  =   -2147483632
  335.       TreeColor       =   -2147483632
  336.       FloodColor      =   192
  337.       SheetBorder     =   -2147483642
  338.       FocusRect       =   1
  339.       HighLight       =   1
  340.       AllowSelection  =   -1  'True
  341.       AllowBigSelection=   -1  'True
  342.       AllowUserResizing=   0
  343.       SelectionMode   =   0
  344.       GridLines       =   1
  345.       GridLinesFixed  =   2
  346.       GridLineWidth   =   1
  347.       Rows            =   50
  348.       Cols            =   10
  349.       FixedRows       =   1
  350.       FixedCols       =   1
  351.       RowHeightMin    =   0
  352.       RowHeightMax    =   0
  353.       ColWidthMin     =   0
  354.       ColWidthMax     =   0
  355.       ExtendLastCol   =   0   'False
  356.       FormatString    =   ""
  357.       ScrollTrack     =   0   'False
  358.       ScrollBars      =   3
  359.       ScrollTips      =   0   'False
  360.       MergeCells      =   0
  361.       MergeCompare    =   0
  362.       AutoResize      =   -1  'True
  363.       AutoSizeMode    =   0
  364.       AutoSearch      =   0
  365.       AutoSearchDelay =   2
  366.       MultiTotals     =   -1  'True
  367.       SubtotalPosition=   1
  368.       OutlineBar      =   0
  369.       OutlineCol      =   0
  370.       Ellipsis        =   0
  371.       ExplorerBar     =   0
  372.       PicturesOver    =   0   'False
  373.       FillStyle       =   0
  374.       RightToLeft     =   0   'False
  375.       PictureType     =   0
  376.       TabBehavior     =   0
  377.       OwnerDraw       =   0
  378.       Editable        =   0
  379.       ShowComboButton =   1
  380.       WordWrap        =   0   'False
  381.       TextStyle       =   0
  382.       TextStyleFixed  =   0
  383.       OleDragMode     =   0
  384.       OleDropMode     =   0
  385.       DataMode        =   0
  386.       VirtualData     =   -1  'True
  387.       DataMember      =   ""
  388.       ComboSearch     =   3
  389.       AutoSizeMouse   =   -1  'True
  390.       FrozenRows      =   0
  391.       FrozenCols      =   0
  392.       AllowUserFreezing=   0
  393.       BackColorFrozen =   0
  394.       ForeColorFrozen =   0
  395.       WallPaperAlignment=   9
  396.       AccessibleName  =   ""
  397.       AccessibleDescription=   ""
  398.       AccessibleValue =   ""
  399.       AccessibleRole  =   24
  400.    End
  401.    Begin MSComctlLib.Toolbar Tlb_Action 
  402.       Align           =   1  'Align Top
  403.       Height          =   555
  404.       Left            =   0
  405.       TabIndex        =   2
  406.       Top             =   0
  407.       Width           =   11400
  408.       _ExtentX        =   20108
  409.       _ExtentY        =   979
  410.       ButtonWidth     =   820
  411.       ButtonHeight    =   926
  412.       AllowCustomize  =   0   'False
  413.       Wrappable       =   0   'False
  414.       Appearance      =   1
  415.       Style           =   1
  416.       ImageList       =   "ImageList1"
  417.       _Version        =   393216
  418.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  419.          NumButtons      =   10
  420.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  421.             Caption         =   "设置"
  422.             Key             =   "ymsz"
  423.             Object.ToolTipText     =   "打印页面设置"
  424.             ImageKey        =   "sz"
  425.          EndProperty
  426.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  427.             Caption         =   "打印"
  428.             Key             =   "dy"
  429.             Object.ToolTipText     =   "打印当前单据或Ctrl+P"
  430.             ImageKey        =   "dy"
  431.          EndProperty
  432.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  433.             Caption         =   "预览"
  434.             Key             =   "yl"
  435.             ImageKey        =   "yl"
  436.          EndProperty
  437.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  438.             Style           =   3
  439.          EndProperty
  440.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  441.             Caption         =   "删行"
  442.             Key             =   "sh"
  443.             Object.ToolTipText     =   "删除当前记录行或Delete"
  444.             ImageKey        =   "sh"
  445.          EndProperty
  446.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  447.             Style           =   3
  448.          EndProperty
  449.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  450.             Caption         =   "导入"
  451.             Key             =   "dr"
  452.             Description     =   "导入上年数据"
  453.             Object.ToolTipText     =   "导入上年数据"
  454.             ImageKey        =   "zd"
  455.          EndProperty
  456.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  457.             Style           =   3
  458.          EndProperty
  459.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  460.             Caption         =   "帮助"
  461.             Key             =   "bz"
  462.             ImageKey        =   "bz"
  463.          EndProperty
  464.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  465.             Caption         =   "退出"
  466.             Key             =   "fh"
  467.             ImageKey        =   "tc"
  468.          EndProperty
  469.       EndProperty
  470.       BorderStyle     =   1
  471.       Begin MSComctlLib.Toolbar GsToolbar 
  472.          Height          =   525
  473.          Left            =   9720
  474.          TabIndex        =   6
  475.          Top             =   0
  476.          Width           =   1695
  477.          _ExtentX        =   2990
  478.          _ExtentY        =   926
  479.          ButtonWidth     =   1455
  480.          ButtonHeight    =   926
  481.          AllowCustomize  =   0   'False
  482.          Appearance      =   1
  483.          Style           =   1
  484.          ImageList       =   "ImageList1"
  485.          _Version        =   393216
  486.          BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  487.             NumButtons      =   2
  488.             BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  489.                Caption         =   "保存格式"
  490.                Key             =   "bcgs"
  491.                ImageKey        =   "bcgs"
  492.             EndProperty
  493.             BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  494.                Caption         =   "默认列宽"
  495.                Key             =   "hfmrgs"
  496.                ImageKey        =   "mrlk"
  497.             EndProperty
  498.          EndProperty
  499.       End
  500.    End
  501.    Begin VB.Label Lab_OperStatus 
  502.       BackColor       =   &H000080FF&
  503.       Caption         =   "1"
  504.       BeginProperty Font 
  505.          Name            =   "MS Sans Serif"
  506.          Size            =   8.25
  507.          Charset         =   0
  508.          Weight          =   400
  509.          Underline       =   0   'False
  510.          Italic          =   0   'False
  511.          Strikethrough   =   0   'False
  512.       EndProperty
  513.       Height          =   345
  514.       Left            =   10980
  515.       TabIndex        =   5
  516.       Top             =   1230
  517.       Visible         =   0   'False
  518.       Width           =   345
  519.    End
  520. End
  521. Attribute VB_Name = "YS_FrmProfitBudget"
  522. Attribute VB_GlobalNameSpace = False
  523. Attribute VB_Creatable = False
  524. Attribute VB_PredeclaredId = True
  525. Attribute VB_Exposed = False
  526. '**************************************************************************************************
  527. '*    模 块 名 称 :利润预算表
  528. '*    功 能 描 述 :对所进行预算的会计科目的预算金额录入
  529. '*    程序员姓名  :魏永生
  530. '*    最后修改人  :
  531. '*    最后修改时间:2002/01/21
  532. '*    备        注:程序中所有依实际情况自定义部分均用[>> <<]括起
  533. '*
  534. '*    1.每次调入外部功能窗体,均要加锁ChangeLock=True,窗体关闭后解锁ChangeLock=false
  535. '*    2.网格列存储内容注解
  536. '*      0-行有效标识 1-记录编辑唯一标识 2-科目编码
  537. '*    3.Lab_OperStatus 用此标签来标识单据录入状态(默认值为1) 1-浏览 2-修改
  538. '**************************************************************************************************
  539.     
  540.  '以下为固定使用变量(网格)
  541.     Dim Cxnrrec As New ADODB.Recordset              '显示查询内容动态集
  542.     Dim Dyymctbl As New DY_Dyymsz                   '打印页面窗体变量
  543.     Dim GridCode As String                          '显示网格网格代码
  544.     Dim GridInf() As Variant                        '整个网格设置信息
  545.     Dim ReportTitle As String                       '报表主标题
  546.     Dim Tsxx As String                              '系统提示信息
  547.     Dim Pmbcsjhs As Long                            '屏幕网格保持数据行数(大于等于1)
  548.     Dim Fzxwghs As Integer                          '辅助项网格行数(包括合计行)
  549.     Dim Sfxshjwg As Boolean                         '是否显示合计网格
  550.     Dim Qslz As Long                                '网格隐藏(非操作显示)列数
  551.     Dim Sjhgd As Double                             '网格数据行高度
  552.     Dim GridBoolean() As Boolean                    '网格列信息(布尔型)
  553.     Dim GridStr()  As String                        '网格列信息(字符型)
  554.     Dim GridInt() As Integer                        '网格列信息(整型)
  555.     Dim Sfblbzkd As Boolean                         '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
  556.     Dim Dqlrwgh As Long                             '当前录入数据网格行
  557.     Dim Dqlrwgl As Long                             '当前录入数据网格列
  558.     Dim Dqlkwgh As Long                             '刚刚离开网格行(不一定为录入行)
  559.     Dim Dqlkwgl As Long                             '刚刚离开网格列
  560.     Dim Dqtoprow As Long                            '当前录入状态时最上端可视行
  561.     Dim Dqleftcol As Long                           '当前录入状态时最左端可视列
  562.     Dim Zdlrqnr As String                           '字段录入修改前内容(用来判断内容是否修改)
  563.     Dim Wbkbhlock As Boolean                        '文本框改变值锁
  564.     Dim changelock As Boolean                       '网格行列改变控制锁(用来区别用户改变.程序改变)
  565.     Dim Gdtlock As Boolean                          '滚动条滚动控制(用来区别用户改变.程序改变)
  566.     Dim Yxxpdlock As Boolean                        '字段有效性判断锁(内容不修改不需进行字段有效性判断)
  567.     Dim Hyxxpdlock As Boolean                       '行有效性判断锁(字段内容不修改不需进行行有效性判断)
  568.     Dim Valilock As Boolean                         '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
  569.     Dim Shsfts As Boolean                           '删除记录行是否提示
  570.     Dim Szzls As Integer                            '网格信息数组最大下标值(网格列数-1)
  571. Private Sub Form_KeyPress(KeyAscii As Integer)      '控制焦点转移和限制录入字符"'"
  572.     Select Case KeyAscii
  573.     Case 39                                         '屏蔽字符"'"
  574.         KeyAscii = 0
  575.     End Select
  576. End Sub
  577. Private Sub Form_Load()                              '窗 体 装 入
  578.     Dim RecTemp As New ADODB.Recordset              '临时使用动态集
  579.     '隐藏选择对话框
  580.     '提示标签
  581.     lbl_AccountYear.Caption = Str(Int_OriYear)
  582.     
  583.     YS_FrmProfitBudgetC.Hide
  584.     
  585.     
  586.     '初始化各种锁值
  587.     changelock = False             '网格行列改变控制锁
  588.     Gdtlock = False                '滚动条滚动控制
  589.     Yxxpdlock = True               '字段有效性判断锁
  590.     Hyxxpdlock = True              '行有效性判断锁
  591.     Wbkbhlock = False              '文本框内容改变锁
  592.     
  593.     '报表主标题及报表编码
  594.     ReportTitle = "利润预算表"
  595.     XtReportCode = "cwfx_ProfitBudget"
  596.     Load Dyymctbl
  597.     
  598.     '调 入 网 格
  599.     GridCode = "cwfx_ProfitBudget"      '网格属性编码
  600.     Call BzWgcsh(WglrGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  601.     
  602.     Qslz = GridInf(1)
  603.     Sjhgd = GridInf(2)
  604.     Pmbcsjhs = GridInf(3)
  605.     Fzxwghs = GridInf(4)
  606.     Sfblbzkd = GridInf(5)
  607.     Shsfts = GridInf(6)
  608.     Sfxshjwg = GridInf(7)
  609.     Szzls = WglrGrid.Cols - 1
  610.     
  611.     '生成查询结果
  612.     Call Sub_Query
  613.     
  614.     '设置状态为修改状态
  615.     Lab_OperStatus = "2"
  616.     
  617. End Sub
  618. Private Sub Form_Unload(Cancel As Integer)           '窗体卸载
  619.     
  620.     '卸载打印页面窗体
  621.     Unload Dyymctbl
  622.     Unload YS_FrmProfitBudgetC
  623.     
  624. End Sub
  625. Private Sub Sub_Query()                              '生成查询结果
  626.     Dim SqlStr As String                   '查询字符串
  627.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  628.     Dim Jsqte  As Long                     '临时计数器
  629.     
  630.     SqlStr = "SELECT cwfx_ProfitBudgetMaster.*,Item FROM cwfx_ProfitBudgetMaster,Cwfx_InComeCostInitial "
  631.     SqlStr = SqlStr + " where cwfx_ProfitBudgetMaster.ID=Cwfx_InComeCostInitial.ID And Year=" & Str(Int_OriYear)
  632.     SqlStr = SqlStr + " order by cwfx_ProfitBudgetMaster.ID "
  633.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  634.     
  635.     With RecTemp
  636.         
  637.         WglrGrid.Clear 1
  638.         
  639.         WglrGrid.Rows = .RecordCount + WglrGrid.FixedRows
  640.         
  641.         Jsqte = WglrGrid.FixedRows
  642.         Do While Not .EOF
  643.             If Jsqte >= WglrGrid.Rows Then
  644.                 WglrGrid.AddItem ""
  645.             End If
  646.             
  647.             WglrGrid.TextMatrix(Jsqte, 0) = "*"                                                              '有效记录标识
  648.             WglrGrid.TextMatrix(Jsqte, 1) = Trim(.Fields("I_id"))            '记录唯一标识
  649.             WglrGrid.TextMatrix(Jsqte, 2) = Trim(.Fields("ID"))
  650.             
  651.             WglrGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("Item"))
  652.             WglrGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = IIf(.Fields("Budget_1") = 0, "", .Fields("budget_1"))
  653.             WglrGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = IIf(.Fields("Add_1") = 0, "", .Fields("Add_1"))
  654.             WglrGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = IIf(.Fields("Budget_2") = 0, "", .Fields("budget_2"))
  655.             WglrGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = IIf(.Fields("Add_2") = 0, "", .Fields("Add_2"))
  656.             WglrGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = IIf(.Fields("Budget_3") = 0, "", .Fields("budget_3"))
  657.             WglrGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = IIf(.Fields("Add_3") = 0, "", .Fields("Add_3"))
  658.             WglrGrid.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)) = IIf(.Fields("Budget_4") = 0, "", .Fields("budget_4"))
  659.             WglrGrid.TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls)) = IIf(.Fields("Add_4") = 0, "", .Fields("Add_4"))
  660.             WglrGrid.TextMatrix(Jsqte, Sydz("010", GridStr(), Szzls)) = IIf(.Fields("Budget_5") = 0, "", .Fields("budget_5"))
  661.             WglrGrid.TextMatrix(Jsqte, Sydz("011", GridStr(), Szzls)) = IIf(.Fields("Add_5") = 0, "", .Fields("Add_5"))
  662.             WglrGrid.TextMatrix(Jsqte, Sydz("012", GridStr(), Szzls)) = IIf(.Fields("Budget_6") = 0, "", .Fields("budget_6"))
  663.             WglrGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)) = IIf(.Fields("Add_6") = 0, "", .Fields("Add_6"))
  664.             WglrGrid.TextMatrix(Jsqte, Sydz("014", GridStr(), Szzls)) = IIf(.Fields("Budget_7") = 0, "", .Fields("budget_7"))
  665.             WglrGrid.TextMatrix(Jsqte, Sydz("015", GridStr(), Szzls)) = IIf(.Fields("Add_7") = 0, "", .Fields("Add_7"))
  666.             WglrGrid.TextMatrix(Jsqte, Sydz("016", GridStr(), Szzls)) = IIf(.Fields("Budget_8") = 0, "", .Fields("budget_8"))
  667.             WglrGrid.TextMatrix(Jsqte, Sydz("017", GridStr(), Szzls)) = IIf(.Fields("Add_8") = 0, "", .Fields("Add_8"))
  668.             WglrGrid.TextMatrix(Jsqte, Sydz("018", GridStr(), Szzls)) = IIf(.Fields("Budget_9") = 0, "", .Fields("budget_9"))
  669.             WglrGrid.TextMatrix(Jsqte, Sydz("019", GridStr(), Szzls)) = IIf(.Fields("Add_9") = 0, "", .Fields("Add_9"))
  670.             WglrGrid.TextMatrix(Jsqte, Sydz("020", GridStr(), Szzls)) = IIf(.Fields("Budget_10") = 0, "", .Fields("budget_10"))
  671.             WglrGrid.TextMatrix(Jsqte, Sydz("021", GridStr(), Szzls)) = IIf(.Fields("Add_10") = 0, "", .Fields("Add_10"))
  672.             WglrGrid.TextMatrix(Jsqte, Sydz("022", GridStr(), Szzls)) = IIf(.Fields("Budget_11") = 0, "", .Fields("budget_11"))
  673.             WglrGrid.TextMatrix(Jsqte, Sydz("023", GridStr(), Szzls)) = IIf(.Fields("Add_11") = 0, "", .Fields("Add_11"))
  674.             WglrGrid.TextMatrix(Jsqte, Sydz("024", GridStr(), Szzls)) = IIf(.Fields("Budget_12") = 0, "", .Fields("budget_12"))
  675.             WglrGrid.TextMatrix(Jsqte, Sydz("025", GridStr(), Szzls)) = IIf(.Fields("Add_12") = 0, "", .Fields("Add_12"))
  676.             
  677.             Cur_SumBudget = .Fields("Budget_1") + .Fields("Budget_2") + .Fields("Budget_3") + .Fields("Budget_4") + _
  678.             .Fields("Budget_5") + .Fields("Budget_6") + .Fields("Budget_7") + .Fields("Budget_8") + _
  679.             .Fields("Budget_9") + .Fields("Budget_10") + .Fields("Budget_11") + .Fields("Budget_12") + _
  680.             .Fields("Add_1") + .Fields("Add_2") + .Fields("Add_3") + .Fields("Add_4") + .Fields("Add_5") + _
  681.             .Fields("Add_6") + .Fields("Add_7") + .Fields("Add_8") + .Fields("Add_9") + .Fields("Add_10") + _
  682.             .Fields("Add_11") + .Fields("Add_12")
  683.             WglrGrid.TextMatrix(Jsqte, Sydz("026", GridStr(), Szzls)) = IIf(Cur_SumBudget = 0, "", Cur_SumBudget)
  684.             
  685.             
  686.             WglrGrid.TextMatrix(Jsqte, Sydz("027", GridStr(), Szzls)) = IIf(.Fields("YearBudget") = 0, "", .Fields("YearBudget"))
  687.             
  688.             '<<]
  689.             WglrGrid.RowHeight(Jsqte) = Sjhgd
  690.             .MoveNext
  691.             Jsqte = Jsqte + 1
  692.         Loop
  693.     End With
  694.     
  695.     '调整网格
  696.     Call Sub_AdjustGrid
  697.     
  698. End Sub
  699. Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
  700.     
  701.     '屏蔽文本框,下拉组合框有效性判断
  702.     Dim Msg, Style, Title, Response
  703.     Valilock = True
  704.     
  705.     '屏蔽网格失去焦点产生的有效性判断
  706.     
  707.     changelock = True
  708.     
  709.     Select Case Button.Key
  710.     Case "ymsz"                                          '页面设置
  711.         Dyymctbl.Show 1
  712.     Case "yl"                                            '预 览
  713.         If Fun_Drfrmyxxpd Then
  714.             Call bbyl(True)
  715.         End If
  716.     Case "dy"                                            '打 印
  717.         If Fun_Drfrmyxxpd Then
  718.             Call bbyl(False)
  719.         End If
  720.     Case "sh"                                            '删 行
  721.         Call Scdqfl
  722.     Case "dr"                                            '导入
  723.         Msg = "导入将替换本年已录入的相同项目的预算数据?"   ' 定义信息。
  724.         Style = vbYesNo + vbDefaultButton2 + vbExclamation ' 定义按钮。
  725.         Title = "百利/ERP财务分析系统5.0"   ' 定义标题。
  726.         Response = MsgBox(Msg, Style, Title)
  727.         If Response = vbYes Then   ' 用户按下“是”。
  728.             Call ImportFromLastYear
  729.            
  730.         End If
  731.         
  732.     Case "bz"                                            '帮 助
  733.         Call F1bz
  734.     Case "fh"                                            '退 出
  735.         Unload Me
  736.     End Select
  737.     
  738.     '解 锁
  739.     Valilock = False
  740.     changelock = False
  741.     
  742. End Sub
  743. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)        '支持热键操作
  744.     If Shift = 2 Then
  745.         Select Case UCase(Chr(KeyCode))
  746.         Case "P"                   'Ctrl+P 打印
  747.             If Tlb_Action.Buttons("dy").Enabled Then
  748.                 Call bbyl(False)
  749.             End If
  750.         End Select
  751.     End If
  752. End Sub
  753. Private Sub Wbkcl()                                                 '文本框录入之前处理(根据实际情况)
  754.     Dim xswbrr As String
  755.     With WglrGrid
  756.         Zdlrqnr = Trim(.Text)
  757.         xswbrr = Trim(.Text)
  758.         
  759.         If GridBoolean(.Col, 3) Then   '列表框录入
  760.             
  761.             '填充列表框程序
  762.             Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
  763.         Else
  764.             Wbkbhlock = True
  765.             
  766.             '====以下为用户自定义
  767.             Ydtext.Text = xswbrr
  768.             '====以上为用户自定义
  769.             
  770.             Wbkbhlock = False
  771.             Ydtext.SelStart = Len(Ydtext.Text)
  772.         End If
  773.     End With
  774. End Sub
  775. Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long)        '录入数据字段有效性判断,同时进行字段录入事后处理
  776.     Dim Str_JudgeText As String  '临时有效性判断字段内容
  777.     Dim Coljsq As Long           '临时列计数器
  778.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  779.     Dim Dbl_Qcye As Double                 '临时期初余额
  780.     
  781.     With WglrGrid
  782.         
  783.         '非录入状态有效性为合法
  784.         If Yxxpdlock Or .Row < .FixedRows Then
  785.             sjzdyxxpd = True
  786.             Exit Function
  787.         End If
  788.         
  789.         Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
  790.         Select Case GridStr(Dqpdwgl, 1)
  791.             
  792.             '以下为自定义部分[
  793.             '1.放置字段有效性判断程序
  794.         Case "001"          '科目(如有效则调入科目编码)
  795.             If Len(Str_JudgeText) <> 0 Then
  796.                 SqlStr = "Select * FROM Cwfx_InComeCostInitial Where ID='" & Val(Str_JudgeText) & "' OR Item='" & Str_JudgeText & "'"
  797.                 Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  798.                 With RecTemp
  799.                     If .EOF Then
  800.                         Tsxx = "此项目不存在!"
  801.                         GoTo Lrcwcl
  802.                     End If
  803.                     
  804.                     '1.如果科目存在则存储相应预算科目编码
  805.                     WglrGrid.TextMatrix(Dqpdwgh, 2) = Trim(RecTemp.Fields("ID"))
  806.                     WglrGrid.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)) = Trim(RecTemp.Fields("Item"))
  807.                 End With
  808.                 
  809.                 '判断记录是否重复
  810.                 SqlStr = "SELECT cwfx_ProfitBudgetMaster.I_id From cwfx_ProfitBudgetMaster WHERE ID='" & WglrGrid.TextMatrix(Dqpdwgh, 2) & "'And Year=" & Str(Int_OriYear)
  811.                 Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  812.                 If Not RecTemp.EOF Then
  813.                     If RecTemp.Fields("I_ID") <> Val(WglrGrid.TextMatrix(Dqpdwgh, 1)) Then
  814.                         Tsxx = "录入记录重复!"
  815.                         Dqpdwgl = Sydz("001", GridStr(), Szzls)
  816.                         GoTo Lrcwcl
  817.                     End If
  818.                 End If
  819.                 
  820.                 
  821.             Else
  822.                 WglrGrid.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)) = ""
  823.             End If
  824.             
  825.             '2.放置字段事后处理程序
  826.             '科目所要进行核算项不能为空
  827.             If (Not .ColHidden(Sydz("001", GridStr(), Szzls))) And Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) = "" Then
  828.                 Tsxx = "预算项目不能为空!"
  829.                 Lrywlz = Sydz("001", GridStr(), Szzls)
  830.                 GoTo Lrcwcl
  831.             End If
  832.             
  833.             
  834.             '以上为自定义部分]
  835.             
  836.         End Select
  837.         '2.放置字段事后处理程序
  838.         Cur_SumBudget = 0
  839.         For I = 2 To 25
  840.             Cur_SumBudget = Cur_SumBudget + Val(WglrGrid.TextMatrix(Dqpdwgh, Sydz(IIf(I > 9, "0", "00") + Trim(Str(I)), GridStr(), Szzls)))
  841.         Next
  842.         WglrGrid.TextMatrix(Dqpdwgh, Sydz("026", GridStr(), Szzls)) = IIf(Cur_SumBudget = 0, "", Cur_SumBudget)
  843.         
  844.         '字段录入正确后为零字段清空
  845.         Call Qkwlzd(Dqpdwgh, Dqpdwgl)
  846.         
  847.         sjzdyxxpd = True
  848.         Yxxpdlock = True
  849.         Exit Function
  850.     End With
  851.     
  852. Lrcwcl:    '录入错误处理
  853.     With WglrGrid
  854.         Call Xtxxts(Tsxx, 0, 1)
  855.         changelock = True
  856.         .Select Dqpdwgh, Dqpdwgl
  857.         changelock = False
  858.         Call xswbk
  859.         sjzdyxxpd = False
  860.         Exit Function
  861.     End With
  862. End Function
  863. Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean                  '录入数据行有效性判断,同时进行行处理
  864.     Dim Lrywlz As Long
  865.     Dim RecTemp As New ADODB.Recordset             '临时使用动态集
  866.     Dim SqlStr As String                           '临时连接字符串
  867.     Dim Rec_AccSumAssi As New ADODB.Recordset      '辅助总帐动态集
  868.     Dim Dbl_Now(1 To 16) As Double                 '科目记录现数据
  869.     Dim Str_OriItemCode As String                  '辅助核算项目编码(原)
  870.     Dim Str_NowItemCode As String                  '辅助核算项目编码(现)
  871.     
  872.     With WglrGrid
  873.         
  874.         '判断行为空和无效数据行则清除当前行
  875.         If Yxxpdh > (.Rows - .FixedRows) Then Exit Function
  876.         If .TextMatrix(Yxxpdh, 0) <> "*" Then
  877.             Sjhzyxxpd = True
  878.             Exit Function
  879.         Else
  880.             If pdhwk(Yxxpdh) And Yxxpdh + 1 <= .Rows - 1 Then
  881.                 If .TextMatrix(Yxxpdh + 1, 0) <> "*" Then
  882.                     changelock = True
  883.                     .RemoveItem Yxxpdh
  884.                     If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  885.                         .AddItem ""
  886.                         .RowHeight(.Rows - 1) = Sjhgd
  887.                     End If
  888.                     changelock = False
  889.                     Sjhzyxxpd = True
  890.                     Exit Function
  891.                 End If
  892.             End If
  893.         End If
  894.         
  895.         '行没有发生变化则不进行有效性判断
  896.         If Hyxxpdlock Then
  897.             Sjhzyxxpd = True
  898.             Exit Function
  899.         End If
  900.         
  901.         '以下为自定义部分[
  902.         
  903.         '1.放置行有效性判断程序
  904.         
  905.         '首先进行为空判断(固定不变)
  906.         For Jsqte = Qslz To .Cols - 1
  907.             If (GridInt(Jsqte, 5) = 1 And Len(Trim(.TextMatrix(Yxxpdh, Jsqte))) = 0) Or (GridInt(Jsqte, 5) = 2 And Val(Trim(.TextMatrix(Yxxpdh, Jsqte))) = 0) Then
  908.                 Tsxx = GridStr(Jsqte, 2)
  909.                 Lrywlz = Jsqte
  910.                 GoTo Lrcwcl
  911.                 Exit For
  912.             End If
  913.         Next Jsqte
  914.         
  915.         '科目所要进行核算项不能为空
  916.         If (Not .ColHidden(Sydz("001", GridStr(), Szzls))) And Trim(.TextMatrix(Yxxpdh, Sydz("001", GridStr(), Szzls))) = "" Then
  917.             Tsxx = "预算项目不能为空!"
  918.             Lrywlz = Sydz("001", GridStr(), Szzls)
  919.             GoTo Lrcwcl
  920.         End If
  921.         
  922.         '判断记录是否重复
  923.         SqlStr = "SELECT cwfx_ProfitBudgetMaster.I_id From cwfx_ProfitBudgetMaster WHERE ID='" & WglrGrid.TextMatrix(Yxxpdh, 2) & "'And Year=" & Str(Int_OriYear)
  924.         Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  925.         If Not RecTemp.EOF Then
  926.             If RecTemp.Fields("I_ID") <> Val(WglrGrid.TextMatrix(Yxxpdh, 1)) Then
  927.                 Tsxx = "录入记录重复!"
  928.                 For Jsqte = Qslz To WglrGrid.Cols - 1
  929.                     If Not WglrGrid.ColHidden(Jsqte) Then
  930.                         Lrywlz = Jsqte
  931.                     End If
  932.                 Next Jsqte
  933.                 Lrywlz = Sydz("001", GridStr(), Szzls)
  934.                 GoTo Lrcwcl
  935.             End If
  936.         End If
  937.         
  938.         '2.进行行数据回写
  939.         
  940.     End With
  941.     
  942.     On Error GoTo Swcwcl
  943.     
  944.     Cw_DataEnvi.DataConnect.BeginTrans
  945.     
  946.     With Rec_AccSumAssi
  947.         
  948.         If Val(Trim(WglrGrid.TextMatrix(Yxxpdh, 1))) <> 0 Then
  949.             If .State = 1 Then .Close
  950.             .Open "SELECT cwfx_ProfitBudgetMaster.* From cwfx_ProfitBudgetMaster WHERE I_id = " & Val(WglrGrid.TextMatrix(Yxxpdh, 1)), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  951.             
  952.             If Not .EOF Then
  953.                 .Fields("ID") = WglrGrid.TextMatrix(Yxxpdh, 2)                                            '预算科目
  954.                 .Fields("Year") = Int_OriYear                                           '会计年度
  955.                 .Fields("Budget_1") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls)))
  956.                 .Fields("Add_1") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("003", GridStr(), Szzls)))
  957.                 .Fields("Budget_2") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("004", GridStr(), Szzls)))
  958.                 .Fields("Add_2") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("005", GridStr(), Szzls)))
  959.                 .Fields("Budget_3") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("006", GridStr(), Szzls)))
  960.                 .Fields("Add_3") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("007", GridStr(), Szzls)))
  961.                 .Fields("Budget_4") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("008", GridStr(), Szzls)))
  962.                 .Fields("Add_4") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("009", GridStr(), Szzls)))
  963.                 .Fields("Budget_5") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("010", GridStr(), Szzls)))
  964.                 .Fields("Add_5") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("011", GridStr(), Szzls)))
  965.                 .Fields("Budget_6") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("012", GridStr(), Szzls)))
  966.                 .Fields("Add_6") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("013", GridStr(), Szzls)))
  967.                 .Fields("Budget_7") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("014", GridStr(), Szzls)))
  968.                 .Fields("Add_7") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("015", GridStr(), Szzls)))
  969.                 .Fields("Budget_8") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("016", GridStr(), Szzls)))
  970.                 .Fields("Add_8") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("017", GridStr(), Szzls)))
  971.                 .Fields("Budget_9") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("018", GridStr(), Szzls)))
  972.                 .Fields("Add_9") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("019", GridStr(), Szzls)))
  973.                 .Fields("Budget_10") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("020", GridStr(), Szzls)))
  974.                 .Fields("Add_10") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("021", GridStr(), Szzls)))
  975.                 .Fields("Budget_11") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("022", GridStr(), Szzls)))
  976.                 .Fields("Add_11") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("023", GridStr(), Szzls)))
  977.                 .Fields("Budget_12") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("024", GridStr(), Szzls)))
  978.                 .Fields("Add_12") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("025", GridStr(), Szzls)))
  979.                 
  980.                 .Fields("YearBudget") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("027", GridStr(), Szzls)))
  981.                 
  982.                 
  983.                 .Update
  984.                 
  985.                 '更新其他各会计期间数据
  986.                 
  987.             End If
  988.             
  989.         Else
  990.             If .State = 1 Then .Close
  991.             .Open "SELECT cwfx_ProfitBudgetMaster.* From cwfx_ProfitBudgetMaster WHERE I_id = " & Val(WglrGrid.TextMatrix(Yxxpdh, 1)), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  992.             
  993.             .AddNew
  994.             .Fields("ID") = Trim(WglrGrid.TextMatrix(Yxxpdh, 2))                                     '预算科目
  995.             .Fields("Year") = Int_OriYear                                          '会计年度
  996.             
  997.             .Fields("Budget_1") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls)))
  998.             .Fields("Add_1") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("003", GridStr(), Szzls)))
  999.             .Fields("Budget_2") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("004", GridStr(), Szzls)))
  1000.             .Fields("Add_2") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("005", GridStr(), Szzls)))
  1001.             .Fields("Budget_3") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("006", GridStr(), Szzls)))
  1002.             .Fields("Add_3") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("007", GridStr(), Szzls)))
  1003.             .Fields("Budget_4") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("008", GridStr(), Szzls)))
  1004.             .Fields("Add_4") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("009", GridStr(), Szzls)))
  1005.             .Fields("Budget_5") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("010", GridStr(), Szzls)))
  1006.             .Fields("Add_5") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("011", GridStr(), Szzls)))
  1007.             .Fields("Budget_6") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("012", GridStr(), Szzls)))
  1008.             .Fields("Add_6") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("013", GridStr(), Szzls)))
  1009.             .Fields("Budget_7") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("014", GridStr(), Szzls)))
  1010.             .Fields("Add_7") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("015", GridStr(), Szzls)))
  1011.             .Fields("Budget_8") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("016", GridStr(), Szzls)))
  1012.             .Fields("Add_8") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("017", GridStr(), Szzls)))
  1013.             .Fields("Budget_9") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("018", GridStr(), Szzls)))
  1014.             .Fields("Add_9") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("019", GridStr(), Szzls)))
  1015.             .Fields("Budget_10") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("020", GridStr(), Szzls)))
  1016.             .Fields("Add_10") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("021", GridStr(), Szzls)))
  1017.             .Fields("Budget_11") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("022", GridStr(), Szzls)))
  1018.             .Fields("Add_11") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("023", GridStr(), Szzls)))
  1019.             .Fields("Budget_12") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("024", GridStr(), Szzls)))
  1020.             .Fields("Add_12") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("025", GridStr(), Szzls)))
  1021.             
  1022.             .Fields("YearBudget") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("027", GridStr(), Szzls)))
  1023.             
  1024.             
  1025.             .Update
  1026.             
  1027.             WglrGrid.TextMatrix(Yxxpdh, 1) = .Fields("I_id")
  1028.             
  1029.             
  1030.         End If
  1031.         
  1032.     End With
  1033.     
  1034.     Cw_DataEnvi.DataConnect.CommitTrans
  1035.     
  1036.     ' <<]
  1037.     
  1038.     '以上为自定义部分]
  1039.     
  1040.     Sjhzyxxpd = True
  1041.     Hyxxpdlock = True
  1042.     Exit Function
  1043.     
  1044. Swcwcl:
  1045.     Cw_DataEnvi.DataConnect.RollbackTrans
  1046.     Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
  1047.     Call Xtxxts(Tsxx, 0, 1)
  1048.     Exit Function
  1049.     
  1050. Lrcwcl:      '录入错误处理
  1051.     With WglrGrid
  1052.         Call Xtxxts(Tsxx, 0, 1)
  1053.         changelock = True
  1054.         .Select Yxxpdh, Lrywlz
  1055.         changelock = False
  1056.         Call xswbk
  1057.         
  1058.         Sjhzyxxpd = False
  1059.         Exit Function
  1060.     End With
  1061. End Function
  1062. '===================以 下 程 序 为 通 用 部 分 ,一 般 不 需 更 改======================='
  1063. Private Sub Sub_AdjustGrid()
  1064.     '调 整 网 格
  1065.     With WglrGrid
  1066.         '加 1 保持一行录入行
  1067.         If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  1068.             .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1069.             For Jsqte = .FixedRows To .Rows - 1
  1070.                 .RowHeight(Jsqte) = Sjhgd
  1071.             Next Jsqte
  1072.         Else
  1073.             '判断是否有辅助行和录入行,如没有则加行
  1074.             Do While .TextMatrix(.Rows - 1 - Fzxwghs, 0) = "*"
  1075.                 .AddItem ""
  1076.                 .RowHeight(.Rows - 1) = Sjhgd
  1077.             Loop
  1078.         End If
  1079.     End With
  1080. End Sub
  1081. Private Sub Lrzdbz()                                                      '录入字段帮助
  1082.     If Not YdCommand.Visible Then
  1083.         Exit Sub
  1084.     End If
  1085.     Valilock = True
  1086.     With WglrGrid
  1087.         
  1088.         changelock = True        '调入另外窗体必须加锁
  1089.         If .Col = Sydz("001", GridStr(), Szzls) Then
  1090.             Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
  1091.         End If
  1092.         changelock = False
  1093.         If Len(Xtfhcs) <> 0 Then
  1094.             If GridInt(.Col, 7) = 0 Then
  1095.                 Ydtext.Text = Xtfhcs
  1096.             Else
  1097.                 Ydtext.Text = Xtfhcsfz
  1098.             End If
  1099.         End If
  1100.         
  1101.         Valilock = False
  1102.         If Ydtext.Visible Then
  1103.             Ydtext.SetFocus
  1104.         End If
  1105.     End With
  1106. End Sub
  1107. Private Sub Form_Resize()                                                '窗体大小发生变化时,重新显示文本框
  1108.     Call Cxxswbk
  1109. End Sub
  1110. Private Function Fun_Drfrmyxxpd() As Boolean                             '调入其它窗体或功能产生的有效性判断(包括数据回写)
  1111.     Fun_Drfrmyxxpd = True
  1112.     With WglrGrid
  1113.         
  1114.         '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
  1115.         
  1116.         If Ydtext.Visible Or YdCombo.Visible Then
  1117.             Call Lrsjhx
  1118.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1119.                 Fun_Drfrmyxxpd = False
  1120.                 Exit Function
  1121.             End If
  1122.         End If
  1123.         
  1124.         '进行行有效性判断
  1125.         If Not Sjhzyxxpd(.Row) Then
  1126.             Fun_Drfrmyxxpd = False
  1127.             Exit Function
  1128.         End If
  1129.         
  1130.     End With
  1131. End Function
  1132. Private Sub WglrGrid_GotFocus()                                     '网格得到焦点
  1133.     
  1134.     '网格得到焦点,如果当前选择行为非数据行
  1135.     '则调整当前焦点至有效数据行
  1136.     
  1137.     With WglrGrid
  1138.         If .Row < .FixedRows And .Rows > .FixedRows Then
  1139.             changelock = True
  1140.             .Select .FixedRows, .Col
  1141.             changelock = False
  1142.         End If
  1143.         If .Col < Qslz Then
  1144.             changelock = True
  1145.             .Select .Row, Qslz
  1146.             changelock = False
  1147.         End If
  1148.     End With
  1149.     
  1150. End Sub
  1151. Private Sub WglrGrid_LostFocus()                                    '录入网格失去焦点
  1152.     
  1153.     '用以屏蔽调用其它窗体时发生网格失去焦点事件
  1154.     If changelock Then
  1155.         Exit Sub
  1156.     End If
  1157.     
  1158.     '引发网格RowcolChange事件
  1159.     With WglrGrid
  1160.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1161.             .Select 0, 0
  1162.         End If
  1163.     End With
  1164.     
  1165. End Sub
  1166. Private Sub WglrGrid_AfterScroll(ByVal OldTopRow As Long, ByVal OldLeftCol As Long, ByVal NewTopRow As Long, ByVal NewLeftCol As Long)                                       '限制用户在录入过程中滚动鼠标
  1167.     
  1168.     If Gdtlock Then
  1169.         Exit Sub
  1170.     End If
  1171.     
  1172.     With WglrGrid
  1173.         If Ydtext.Visible Or YdCombo.Visible Then
  1174.             Gdtlock = True
  1175.             .TopRow = Dqtoprow
  1176.             .LeftCol = Dqleftcol
  1177.             Gdtlock = False
  1178.             Exit Sub
  1179.         End If
  1180.         
  1181.     End With
  1182. End Sub
  1183. Private Sub WglrGrid_LeaveCell()                                    '离开单元格
  1184.     If changelock Then
  1185.         Exit Sub
  1186.     End If
  1187.     
  1188.     '记录刚刚离开网格单元的行列值
  1189.     Dqlkwgh = WglrGrid.Row
  1190.     Dqlkwgl = WglrGrid.Col
  1191.     
  1192.     '判断是否需要录入数据回写
  1193.     If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1194.         Exit Sub
  1195.     End If
  1196.     Call Lrsjhx
  1197. End Sub
  1198. Private Sub WglrGrid_RowColChange()                                '网格录入行列发生变化时,进行有效性判断
  1199.     Valilock = True       '屏蔽文本框失去焦点进行有效性判断
  1200.     With WglrGrid
  1201.         If changelock Then
  1202.             Exit Sub
  1203.         End If
  1204.         If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1205.             Exit Sub
  1206.         End If
  1207.         If .Row <> Dqlkwgh Then
  1208.             If Not Sjhzyxxpd(Dqlkwgh) Then
  1209.                 Exit Sub
  1210.             End If
  1211.         End If
  1212.     End With
  1213.     Call fhyxh
  1214.     Call Xldql
  1215.     
  1216. End Sub
  1217. Private Sub WglrGrid_DblClick()          '鼠标双击网格显示文本框
  1218.     Dim I As Integer
  1219.     Dim Bln_Add As Boolean
  1220.     Dim CurrentRow As Integer
  1221.     Dim CurrentCol As Integer
  1222.     Let Bln_Add = False
  1223.     
  1224.     With WglrGrid
  1225.         '非数据行退出
  1226.         If .Row < .FixedRows Then
  1227.             Exit Sub
  1228.         End If
  1229.         
  1230.         For I = 3 To 25 Step 2                 '如果是追加列则取月份
  1231.             If .Col = Sydz(IIf(I > 9, "0", "00") + Trim(Str(I)), GridStr(), Szzls) Then
  1232.                 Bln_Add = True
  1233.                 Int_Month = Int(I / 2)
  1234.                 Exit For
  1235.             End If
  1236.         Next
  1237.         
  1238.         On Error GoTo Swcwcl1
  1239.         If Bln_Add Then                       '是追加列调用追加金额form
  1240.             Str_Show = "项目名称:" & Trim(.TextMatrix(.Row, Sydz("001", GridStr(), Szzls))) & "  会计年度:" & Trim(Str(Int_OriYear)) & "  月份:" & Trim(Str(Int_Month))
  1241.             Str_TableAdd = "cwfx_ProfitBudgetSlaver"
  1242.             Int_I_Id = .TextMatrix(.Row, 1)
  1243.             Str_Title = "利润预算追加金额表"
  1244.             Str_ReportSubTitle = Space(10) + Fun_FormatOutPut("会计年度:" + Str(Int_OriYear), 30)
  1245.             CurrentRow = .Row
  1246.             CurrentCol = .Col
  1247.             YS_FrmBudgetAdd.HelpContextID = "0411004004"
  1248.             YS_FrmBudgetAdd.Show 1
  1249.             .Row = CurrentRow
  1250.             .Col = CurrentCol
  1251.             
  1252.             .TextMatrix(.Row, .Col) = IIf(Cur_TableAdd = 0, "", Cur_TableAdd)   '金额回写单位格
  1253.             
  1254.             Cur_SumBudget = 0
  1255.             For I = 2 To 25
  1256.                 Cur_SumBudget = Cur_SumBudget + Val(.TextMatrix(.Row, Sydz(IIf(I > 9, "0", "00") + Trim(Str(I)), GridStr(), Szzls)))
  1257.             Next
  1258.             .TextMatrix(.Row, Sydz("026", GridStr(), Szzls)) = IIf(Cur_SumBudget = 0, "", Cur_SumBudget)
  1259.             
  1260.             Hyxxpdlock = False
  1261.             
  1262.         Else
  1263.             Call xswbk
  1264.         End If
  1265.         
  1266.     End With
  1267.     Exit Sub
  1268.     
  1269. Swcwcl1:
  1270.     Tsxx = "先确认本次预算金额的录入才能录入追加金额!"
  1271.     Call Xtxxts(Tsxx, 0, 1)
  1272. End Sub
  1273. Private Sub Ycwbk()                      '隐藏文本框,帮助按钮,列表组合框
  1274.     Valilock = True
  1275.     Ydtext.Visible = False
  1276.     YdCombo.Visible = False
  1277.     YdCommand.Visible = False
  1278. End Sub
  1279. Private Sub YdCombo_KeyDown(KeyCode As Integer, Shift As Integer)        '列表框移动
  1280.     With WglrGrid
  1281.         Select Case KeyCode
  1282.         Case vbKeyEscape                'ESC 键放弃录入
  1283.             Valilock = True
  1284.             .SetFocus
  1285.             Call Ycwbk
  1286.             Valilock = False
  1287.         Case vbKeyReturn                '回 车 键 =13
  1288.             KeyCode = 0
  1289.             .SetFocus
  1290.             Call Lrsjhx
  1291.             Rowjsq = .Row
  1292.             Coljsq = .Col + 1
  1293.             If Coljsq > .Cols - 1 Then
  1294.                 If Rowjsq < .Rows - 1 Then
  1295.                     Rowjsq = Rowjsq + 1
  1296.                 End If
  1297.                 Coljsq = Qslz
  1298.             End If
  1299.             Do While Rowjsq <= .Rows - 1
  1300.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1301.                     Coljsq = Coljsq + 1
  1302.                     If Coljsq > .Cols - 1 Then
  1303.                         Rowjsq = Rowjsq + 1
  1304.                         Coljsq = Qslz
  1305.                     End If
  1306.                 Else
  1307.                     Exit Do
  1308.                 End If
  1309.             Loop
  1310.             .Select Rowjsq, Coljsq
  1311.         Case vbKeyLeft                  '左 箭 头 =37
  1312.             If .Col - 1 = Qslz Then
  1313.                 If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1314.                     GoTo jzzx
  1315.                 End If
  1316.             End If
  1317.             If .Col > Qslz Then
  1318.                 KeyCode = 0
  1319.                 .SetFocus
  1320.                 Call Lrsjhx
  1321.                 Coljsq = .Col - 1
  1322.                 Do While Coljsq > Qslz
  1323.                     If Coljsq - 1 = Qslz Then
  1324.                         If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1325.                             GoTo jzzx
  1326.                         End If
  1327.                     End If
  1328.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1329.                         Coljsq = Coljsq - 1
  1330.                     Else
  1331.                         Exit Do
  1332.                     End If
  1333.                 Loop
  1334.                 .Select .Row, Coljsq
  1335.             End If
  1336.             
  1337.         Case vbKeyRight                 '右 箭 头 =39
  1338.             KeyCode = 0
  1339.             .SetFocus
  1340.             Call Lrsjhx
  1341.             Rowjsq = .Row
  1342.             Coljsq = .Col + 1
  1343.             If Coljsq > .Cols - 1 Then
  1344.                 If Rowjsq < .Rows - 1 Then
  1345.                     Rowjsq = Rowjsq + 1
  1346.                 End If
  1347.                 Coljsq = Qslz
  1348.             End If
  1349.             Do While Rowjsq <= .Rows - 1
  1350.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1351.                     Coljsq = Coljsq + 1
  1352.                     If Coljsq > .Cols - 1 Then
  1353.                         Rowjsq = Rowjsq + 1
  1354.                         Coljsq = Qslz
  1355.                     End If
  1356.                 Else
  1357.                     Exit Do
  1358.                 End If
  1359.             Loop
  1360.             .Select Rowjsq, Coljsq
  1361.         Case Else
  1362.         End Select
  1363.         
  1364. jzzx:
  1365.         
  1366.     End With
  1367. End Sub
  1368. Private Sub YdCombo_LostFocus()
  1369.     With WglrGrid                                    '因为选中网格会先发生Rowcolchange事件置Valiock
  1370.         If Not Valilock Then                           '为TRUE
  1371.             Call Lrsjhx
  1372.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1373.                 Exit Sub
  1374.             End If
  1375.         End If
  1376.     End With
  1377. End Sub
  1378. Private Sub Ydcommand_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  1379.     Call Lrzdbz
  1380. End Sub
  1381. Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer)
  1382.     Dim Rowjsq As Long, Coljsq As Long
  1383.     With WglrGrid
  1384.         Select Case KeyCode
  1385.         Case vbKeyF2
  1386.             Call Lrzdbz
  1387.         Case vbKeyEscape                'ESC 键放弃录入
  1388.             Valilock = True
  1389.             Call Ycwbk
  1390.             .SetFocus
  1391.         Case vbKeyReturn                '回 车 键 =13
  1392.             KeyCode = 0
  1393.             .SetFocus
  1394.             Call Lrsjhx
  1395.             Rowjsq = .Row
  1396.             Coljsq = .Col + 1
  1397.             If Coljsq > .Cols - 1 Then
  1398.                 If Rowjsq < .Rows - 1 Then
  1399.                     Rowjsq = Rowjsq + 1
  1400.                 End If
  1401.                 Coljsq = Qslz
  1402.             End If
  1403.             Do While Rowjsq <= .Rows - 1
  1404.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1405.                     Coljsq = Coljsq + 1
  1406.                     If Coljsq > .Cols - 1 Then
  1407.                         Rowjsq = Rowjsq + 1
  1408.                         Coljsq = Qslz
  1409.                     End If
  1410.                 Else
  1411.                     Exit Do
  1412.                 End If
  1413.             Loop
  1414.             If Rowjsq <= .Rows - 1 Then
  1415.                 .Select Rowjsq, Coljsq
  1416.             End If
  1417.         Case vbKeyUp                    '上 箭 头 =38
  1418.             KeyCode = 0
  1419.             .SetFocus
  1420.             Call Lrsjhx
  1421.             If .Row > .FixedRows Then
  1422.                 .Row = .Row - 1
  1423.             End If
  1424.         Case vbKeyDown                  '下 箭 头 =40
  1425.             KeyCode = 0
  1426.             .SetFocus
  1427.             Call Lrsjhx
  1428.             If .Row < .Rows - 1 Then
  1429.                 .Row = .Row + 1
  1430.             End If
  1431.         Case vbKeyLeft                  '左 箭 头 =37
  1432.             If .Col - 1 = Qslz Then
  1433.                 If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1434.                     GoTo jzzx
  1435.                 End If
  1436.             End If
  1437.             If Ydtext.SelStart = 0 And .Col > Qslz Then
  1438.                 KeyCode = 0
  1439.                 .SetFocus
  1440.                 Call Lrsjhx
  1441.                 Coljsq = .Col - 1
  1442.                 Do While Coljsq > Qslz
  1443.                     If Coljsq - 1 = Qslz Then
  1444.                         If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1445.                             GoTo jzzx
  1446.                         End If
  1447.                     End If
  1448.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1449.                         Coljsq = Coljsq - 1
  1450.                     Else
  1451.                         Exit Do
  1452.                     End If
  1453.                 Loop
  1454.                 .Select .Row, Coljsq
  1455.             End If
  1456. jzzx:
  1457.             
  1458.             
  1459.         Case vbKeyRight                 '右 箭 头 =39
  1460.             wblong = Len(Ydtext.Text)
  1461.             If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
  1462.                 KeyCode = 0
  1463.                 .SetFocus
  1464.                 Call Lrsjhx
  1465.                 Rowjsq = .Row
  1466.                 Coljsq = .Col + 1
  1467.                 If Coljsq > .Cols - 1 Then
  1468.                     If Rowjsq < .Rows - 1 Then
  1469.                         Rowjsq = Rowjsq + 1
  1470.                     End If
  1471.                     Coljsq = Qslz
  1472.                 End If
  1473.                 Do While Rowjsq <= .Rows - 1
  1474.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1475.                         Coljsq = Coljsq + 1
  1476.                         If Coljsq > .Cols - 1 Then
  1477.                             Rowjsq = Rowjsq + 1
  1478.                             Coljsq = Qslz
  1479.                         End If
  1480.                     Else
  1481.                         Exit Do
  1482.                     End If
  1483.                 Loop
  1484.                 .Select Rowjsq, Coljsq
  1485.             End If
  1486.         Case Else
  1487.         End Select
  1488.     End With
  1489. End Sub
  1490. Private Sub ydtext_KeyPress(KeyAscii As Integer)         '录入字符事中控制
  1491.     Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  1492.     If KeyAscii <> 0 Then
  1493.         Call Xyxhbz(Dqlrwgh)
  1494.     End If
  1495. End Sub
  1496. Private Sub ydtext_Change()                              '录入事中变化处理
  1497.     
  1498.     '防止程序改变但不进行处理
  1499.     
  1500.     If Wbkbhlock Then
  1501.         Exit Sub
  1502.     End If
  1503.     
  1504.     With WglrGrid
  1505.         
  1506.         '限制字段录入长度
  1507.         Wbkbhlock = True
  1508.         Select Case GridInt(.Col, 1)
  1509.         Case 8
  1510.             Call Sjgskz(Ydtext, Xtjezws - Xtjexsws - 1, Xtjexsws)
  1511.         Case 9
  1512.             Call Sjgskz(Ydtext, Xtslzws - Xtslxsws - 1, Xtslxsws)
  1513.         Case 10
  1514.             Call Sjgskz(Ydtext, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  1515.         Case Else
  1516.             If GridInt(.Col, 3) <> 0 Or GridInt(.Col, 4) <> 0 Then
  1517.                 Call Sjgskz(Ydtext, GridInt(.Col, 3), GridInt(.Col, 4))
  1518.             End If
  1519.         End Select
  1520.         Wbkbhlock = False
  1521.     End With
  1522. End Sub
  1523. Private Sub ydtext_LostFocus()            '如果由于选中网格之外的控件而发生有效性判断(选中网格会先发生Rowcolchange事件置Valiock为TRUE)
  1524.     With WglrGrid
  1525.         If Not Valilock Then
  1526.             Call Lrsjhx
  1527.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1528.                 Exit Sub
  1529.             End If
  1530.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1531.                 Exit Sub
  1532.             End If
  1533.         End If
  1534.     End With
  1535. End Sub
  1536. Private Sub xswbk()                       '在当前选中单元显示文本框,列表框,帮助按钮(通用)
  1537.     Dim Wbkpy As Integer, Wbkpy1 As Integer '文本框偏移量
  1538.     
  1539.     '如果单据操作状态为浏览状态则不能显示录入载体
  1540.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1541.         Exit Sub
  1542.     End If
  1543.     
  1544.     '显示文本框前返回有效行列(解决滚动条问题)
  1545.     Call Xldqh
  1546.     Call Xldql
  1547.     
  1548.     '隐藏文本框,帮助按钮,列表组合框
  1549.     Call Ycwbk
  1550.     
  1551.     With WglrGrid
  1552.         Dqlrwgh = .Row
  1553.         Dqlrwgl = .Col
  1554.         If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  1555.             Exit Sub
  1556.         End If
  1557.         
  1558.         Wbkpy = 30
  1559.         Wbkpy1 = 15
  1560.         
  1561.         If GridBoolean(.Col, 3) Then
  1562.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  1563.             YdCombo.Top = .CellTop + .Top + Wbkpy
  1564.             YdCombo.Width = .CellWidth - Wbkpy1
  1565.             Call Wbkcl
  1566.             YdCombo.Visible = True
  1567.             YdCombo.SetFocus
  1568.             YdCommand.Visible = False
  1569.             Ydtext.Visible = False
  1570.         Else
  1571.             If GridBoolean(.Col, 2) Then
  1572.                 YdCommand.Left = .Left + .CellLeft + .CellWidth - YdCommand.Width + Wbkpy
  1573.                 YdCommand.Top = .Top + .CellTop + .CellHeight - YdCommand.Height + Wbkpy
  1574.                 YdCommand.Visible = True
  1575.             Else
  1576.                 YdCommand.Visible = False
  1577.             End If
  1578.             
  1579.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1580.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1581.             If YdCommand.Visible Then
  1582.                 If Sfblbzkd Then
  1583.                     Ydtext.Width = .CellWidth - YdCommand.Width
  1584.                 Else
  1585.                     Ydtext.Width = .CellWidth - Wbkpy1
  1586.                 End If
  1587.             Else
  1588.                 Ydtext.Width = .CellWidth - Wbkpy1
  1589.             End If
  1590.             Ydtext.Height = .CellHeight - Wbkpy1
  1591.             
  1592.             If GridInt(.Col, 2) <> 0 Then
  1593.                 Ydtext.MaxLength = GridInt(.Col, 2)
  1594.             Else
  1595.                 Ydtext.MaxLength = 3000
  1596.             End If
  1597.             
  1598.             Call Wbkcl
  1599.             
  1600.             Ydtext.Visible = True
  1601.             Ydtext.SetFocus
  1602.         End If
  1603.         Dqtoprow = .TopRow
  1604.         Dqleftcol = .LeftCol
  1605.         
  1606.         '重置锁值
  1607.         Valilock = False
  1608.         Wbkbhlock = False
  1609.     End With
  1610. End Sub
  1611. Private Sub Cxxswbk()                                                  'Formresize中重新显示文本框,列表框,帮助按钮(通用)
  1612.     
  1613.     Dim Wbkpy As Integer, Wbkpy1 As Integer
  1614.     Wbkpy = 30
  1615.     Wbkpy1 = 15
  1616.     With WglrGrid
  1617.         If YdCombo.Visible Then
  1618.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  1619.             YdCombo.Top = .CellTop + .Top + Wbkpy
  1620.             YdCombo.Width = .CellWidth - Wbkpy1
  1621.         End If
  1622.         If YdCommand.Visible Then
  1623.             YdCommand.Left = .Left + .CellLeft + .CellWidth - YdCommand.Width + Wbkpy
  1624.             YdCommand.Top = .Top + .CellTop + .CellHeight - YdCommand.Height + Wbkpy
  1625.         End If
  1626.         If Ydtext.Visible Then
  1627.             If YdCommand.Visible Then
  1628.                 If Sfblbzkd Then
  1629.                     Ydtext.Width = .CellWidth - YdCommand.Width
  1630.                 Else
  1631.                     Ydtext.Width = .CellWidth - Wbkpy1
  1632.                 End If
  1633.             Else
  1634.                 Ydtext.Width = .CellWidth - Wbkpy1
  1635.             End If
  1636.             
  1637.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1638.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1639.             Ydtext.Height = .CellHeight - Wbkpy1
  1640.         End If
  1641.     End With
  1642.     
  1643. End Sub
  1644. Private Sub Lrsjhx()                                                   '文本框录入数据回写
  1645.     With WglrGrid
  1646.         If YdCombo.Visible Then
  1647.             .Text = Trim(YdCombo.Text)
  1648.         End If
  1649.         If Ydtext.Visible Then
  1650.             .Text = Trim(Ydtext.Text)
  1651.         End If
  1652.         
  1653.         '(如果字段录入内容发生变化,则打开有效性判断锁)
  1654.         If Zdlrqnr <> Trim(.Text) Then
  1655.             Yxxpdlock = False
  1656.             Hyxxpdlock = False
  1657.         End If
  1658.         
  1659.         '如果字段录入内容不为空则写数据行有效性标志
  1660.         
  1661.         If Len(Trim(.Text)) <> 0 Then
  1662.             Call Xyxhbz(.Row)
  1663.         End If
  1664.         
  1665.         '隐藏文本框,帮助按钮,列表组合框
  1666.         Call Ycwbk
  1667.         
  1668.     End With
  1669. End Sub
  1670. Private Sub WglrGrid_KeyDown(KeyCode As Integer, Shift As Integer)    '网格录入增行,删行快捷键
  1671.     
  1672.     '如果单据操作状态为浏览状态则不能显示录入载体
  1673.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1674.         Exit Sub
  1675.     End If
  1676.     
  1677.     Select Case KeyCode
  1678.     Case vbKeyDelete               '删行
  1679.         Call Scdqfl
  1680.     Case vbKeyInsert               '增行
  1681.         Call zjlrfl
  1682.     End Select
  1683. End Sub
  1684. Private Sub WglrGrid_KeyPress(KeyAscii As Integer)                     '网格接受键盘录入
  1685.     Dim Str_ChangeTe As String    '临时交换内容
  1686.     Dim Coljsq As Long            '临时列计数器
  1687.     Dim Int_SaveKey As Integer    '保存KeyAscii值
  1688.     
  1689.     '如果单据操作状态为浏览状态则不能显示录入载体
  1690.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1691.         Exit Sub
  1692.     End If
  1693.     
  1694.     Int_SaveKey = KeyAscii
  1695.     
  1696.     With WglrGrid
  1697.         '屏 蔽 回 车 键
  1698.         If KeyAscii = vbKeyReturn Then
  1699.             KeyAscii = 0
  1700.             Rowjsq = .Row
  1701.             Coljsq = .Col + 1
  1702.             If Coljsq > .Cols - 1 Then
  1703.                 If Rowjsq < .Rows - 1 Then
  1704.                     Rowjsq = Rowjsq + 1
  1705.                 End If
  1706.                 Coljsq = Qslz
  1707.             End If
  1708.             Do While Rowjsq <= .Rows - 1
  1709.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1710.                     Coljsq = Coljsq + 1
  1711.                     If Coljsq > .Cols - 1 Then
  1712.                         Rowjsq = Rowjsq + 1
  1713.                         Coljsq = Qslz
  1714.                     End If
  1715.                 Else
  1716.                     Exit Do
  1717.                 End If
  1718.             Loop
  1719.             If Rowjsq <= .Rows - 1 Then
  1720.                 .Select Rowjsq, Coljsq
  1721.             End If
  1722.             Exit Sub
  1723.         End If
  1724.         '接受用户录入
  1725.         Select Case KeyAscii
  1726.         Case 0 To 32
  1727.             
  1728.             '显示录入载体
  1729.             Call xswbk
  1730.             
  1731.         Case Else
  1732.             
  1733.             '防止非编辑字段SendKeys()出现死循环
  1734.             If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  1735.                 Exit Sub
  1736.             End If
  1737.             
  1738.             If GridBoolean(.Col, 3) Then
  1739.                 
  1740.                 '列表框录入
  1741.                 Call xswbk
  1742.                 
  1743.             Else
  1744.                 
  1745.                 Ydtext.Text = ""
  1746.                 Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  1747.                 If KeyAscii = 0 Then
  1748.                     Exit Sub
  1749.                 End If
  1750.                 
  1751.                 '写有效行数据标志
  1752.                 Call Xyxhbz(.Row)
  1753.                 Call xswbk
  1754.                 Ydtext.Text = ""
  1755.                 Valilock = True
  1756.                 SendKeys Chr(KeyAscii), wait
  1757.                 DoEvents
  1758.                 Valilock = False
  1759.                 
  1760.             End If
  1761.         End Select
  1762.     End With
  1763. End Sub
  1764. Private Sub zjlrfl()                                                    '增加录入分录
  1765.     With WglrGrid
  1766.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1767.             If Not Fun_Drfrmyxxpd Then
  1768.                 Exit Sub
  1769.             End If
  1770.         Else
  1771.             Exit Sub
  1772.         End If
  1773.         If .Row < .FixedRows Then
  1774.             Exit Sub
  1775.         End If
  1776.         .AddItem "", .Row
  1777.         .RowHeight(.Row) = Sjhgd
  1778.         
  1779.         
  1780.         If .Row <> .Rows - 1 Then
  1781.             If .TextMatrix(.Row + 1, 0) = "*" Then
  1782.                 .TextMatrix(.Row, 0) = "*"
  1783.             Else
  1784.                 .RemoveItem .Rows - 1
  1785.             End If
  1786.         End If
  1787.         Call Xldqh
  1788.         Call Xldql
  1789.         Hyxxpdlock = False
  1790.     End With
  1791. End Sub
  1792. Private Sub Scdqfl()                                                    '删除当前分录
  1793.     Dim Answer As Integer, Scqwghz As Long, Scqwglz As Long, Hjlzte As Long, Sflrzt As Boolean
  1794.     Dim RecTemp As New ADODB.Recordset             '临时使用动态集
  1795.     Dim SqlStr As String                           '临时连接字符串
  1796.     Dim Str_NowItemCode As String                  '辅助核算项目编码(现)
  1797.     
  1798.     With WglrGrid
  1799.         Scqwghz = .Row
  1800.         Scqwglz = .Col
  1801.         If .TextMatrix(.Row, 0) = "*" Then
  1802.             
  1803.             '判断是否为录入状态
  1804.             If Ydtext.Visible Or YdCombo.Visible Then
  1805.                 Sflrzt = True
  1806.                 Validate = True
  1807.                 Call Lrsjhx
  1808.                 Validate = False
  1809.             End If
  1810.             
  1811.             Call Xldqh
  1812.             changelock = True
  1813.             .Select .Row, 0
  1814.             changelock = False
  1815.             If Shsfts Then
  1816.                 .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = QBColor(12)
  1817.                 Tsxx = "请确认是否删除当前记录?"
  1818.                 yhAnswer = Xtxxts(Tsxx, 2, 2)
  1819.                 If yhAnswer = 2 Then
  1820.                     .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = &H80000005
  1821.                     changelock = True
  1822.                     .Select Scqwghz, Scqwglz
  1823.                     changelock = False
  1824.                     
  1825.                     '如为录入状态,则恢复录入
  1826.                     If Sflrzt Then
  1827.                         Call xswbk
  1828.                     End If
  1829.                     
  1830.                     Exit Sub
  1831.                 End If
  1832.             End If
  1833.             
  1834.             On Error GoTo Swcwcl
  1835.             
  1836.             Cw_DataEnvi.DataConnect.BeginTrans
  1837.             
  1838.             If Val(WglrGrid.TextMatrix(.Row, 1)) <> 0 Then
  1839.                 SqlStr = "SELECT i_id From cwfx_ProfitBudgetMaster WHERE  I_id=" & Val(WglrGrid.TextMatrix(.Row, 1))
  1840.                 Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  1841.                 If Not RecTemp.EOF Then
  1842.                     SqlStr = "Delete cwfx_ProfitBudgetMaster Where I_id=" & Val(WglrGrid.TextMatrix(.Row, 1))
  1843.                     Cw_DataEnvi.DataConnect.Execute (SqlStr)
  1844.                 End If
  1845.             End If
  1846.             
  1847.             Cw_DataEnvi.DataConnect.CommitTrans
  1848.             
  1849.             .RemoveItem .Row
  1850.             
  1851.             If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  1852.                 .AddItem ""
  1853.                 .RowHeight(.Rows - 1) = Sjhgd
  1854.             End If
  1855.             changelock = True
  1856.             .Select .Row, Scqwglz
  1857.             changelock = False
  1858.             
  1859.         End If
  1860.     End With
  1861.     
  1862.     Exit Sub
  1863.     
  1864.     '[>>事务错误处理
  1865. Swcwcl:
  1866.     Cw_DataEnvi.DataConnect.RollbackTrans
  1867.     txss = "删除过程中出现错误!"
  1868.     Call Xtxxts(Tsxx, 0, 1)
  1869.     Exit Sub
  1870.     '<<]
  1871. End Sub
  1872. Private Sub Qkwlzd(sjh As Long, Sjl As Long)                            '清空为零字段
  1873.     If Not GridBoolean(Sjl, 5) Then
  1874.         Exit Sub
  1875.     End If
  1876.     With WglrGrid
  1877.         If Val(Trim(.TextMatrix(sjh, Sjl))) = 0 Then
  1878.             .TextMatrix(sjh, Sjl) = ""
  1879.         End If
  1880.     End With
  1881. End Sub
  1882. Private Sub fhyxh()                                                     '返回录入数据有效行,同时让得到焦点网格可见
  1883.     With WglrGrid
  1884.         If .Row >= .FixedRows Then
  1885.             If .TextMatrix(.Row, 0) <> "*" Then
  1886.                 For Rowjsq = .FixedRows To .Rows - 1
  1887.                     If .TextMatrix(Rowjsq, 0) <> "*" Then
  1888.                         Exit For
  1889.                     End If
  1890.                 Next Rowjsq
  1891.                 If Rowjsq <= .Rows - 1 Then
  1892.                     changelock = True
  1893.                     .Select Rowjsq, .Col
  1894.                     changelock = False
  1895.                 Else
  1896.                     changelock = True
  1897.                     .Select .Rows - 1, .Col
  1898.                     changelock = False
  1899.                 End If
  1900.             End If
  1901.             Call Xldqh
  1902.         End If
  1903.     End With
  1904. End Sub
  1905. Private Sub Xldqh()                                                      '显露当前行
  1906.     Dim Toprowte As Long
  1907.     With WglrGrid
  1908.         Toprowte = 0
  1909.         Do While .CellTop + .RowHeight(.Row) + Fzxwghs * Sjhgd > .Height And .TopRow <> Toprowte
  1910.             Toprowte = .TopRow
  1911.             .TopRow = .TopRow + 1
  1912.         Loop
  1913.         Toprowte = 0
  1914.         Do While .CellTop < .FixedRows * .RowHeight(0) And .TopRow <> Toprowte
  1915.             Toprowte = .TopRow
  1916.             .TopRow = .TopRow - 1
  1917.         Loop
  1918.     End With
  1919. End Sub
  1920. Private Sub Xldql()                                                     '显露当前列
  1921.     Dim Leftcolte As Long
  1922.     With WglrGrid
  1923.         If .Col >= Qslz Then
  1924.             If .LeftCol > .Col Then
  1925.                 .LeftCol = .Col
  1926.             End If
  1927.             Leftcolte = 0
  1928.             Do While .CellLeft + .CellWidth > .Width And .LeftCol <> Leftcolte
  1929.                 Leftcolte = .LeftCol
  1930.                 .LeftCol = .LeftCol + 1
  1931.             Loop
  1932.         End If
  1933.     End With
  1934. End Sub
  1935. Private Function pdhwk(sjh As Long)                                     '判断网格行是否为空行(所有录入字段均为空*非录入字段除外)
  1936.     With WglrGrid
  1937.         For Coljsq = Qslz To .Cols - 1
  1938.             If Len(Trim(.TextMatrix(sjh, Coljsq))) <> 0 And GridBoolean(Coljsq, 1) Then
  1939.                 pdhwk = False
  1940.                 Exit Function
  1941.             End If
  1942.         Next Coljsq
  1943.         pdhwk = True
  1944.     End With
  1945. End Function
  1946. Private Sub Xyxhbz(sjh As Long)                                         '写行有效性标志,并判断是否增行
  1947.     With WglrGrid
  1948.         If .TextMatrix(sjh, 0) = "*" Then
  1949.             Exit Sub
  1950.         End If
  1951.         .TextMatrix(sjh, 0) = "*"
  1952.         If sjh >= .Rows - Fzxwghs - 1 Then
  1953.             .AddItem ""
  1954.             .RowHeight(.Rows - 1) = Sjhgd
  1955.         End If
  1956.     End With
  1957. End Sub
  1958. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)   '表格格式设置(通用)
  1959.     Select Case Button.Key
  1960.     Case "bcgs"                              '保存表格格式
  1961.         Call Bcwggs(WglrGrid, GridCode, GridStr())
  1962.     Case "hfmrgs"                            '恢复默认格式
  1963.         Call Hfmrgs(WglrGrid, GridCode, GridStr())
  1964.     End Select
  1965. End Sub
  1966. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  1967.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  1968.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  1969.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  1970.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  1971.     ReDim Bbxbt(1 To Bbxbtgs)
  1972.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  1973.     If Bbbwhgs <> 0 Then
  1974.         ReDim Bbbwh(1 To Bbbwhgs)
  1975.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  1976.     End If
  1977.     Bbzbt = ReportTitle
  1978.     Bbxbt(1) = Space(10) + Fun_FormatOutPut("会计年度:" + Str(Int_OriYear), 28)
  1979.     
  1980.     Call Scyxsjb(WglrGrid)                               '生成报表数据
  1981.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  1982.     If Not bbylte Then
  1983.         Unload DY_Tybbyldy
  1984.     End If
  1985. End Sub
  1986. Private Sub ImportFromLastYear()
  1987.     SqlStr = "update cwfx_profitbudgetmaster set "
  1988.     SqlStr = SqlStr + "cwfx_profitbudgetmaster.budget_1=n.budget_1+n.add_1,"
  1989.     SqlStr = SqlStr + "cwfx_profitbudgetmaster.budget_2=n.budget_2+n.add_2,"
  1990.     SqlStr = SqlStr + "cwfx_profitbudgetmaster.budget_3=n.budget_3+n.add_3,"
  1991.     SqlStr = SqlStr + "cwfx_profitbudgetmaster.budget_4=n.budget_4+n.add_4,"
  1992.     SqlStr = SqlStr + "cwfx_profitbudgetmaster.budget_5=n.budget_5+n.add_5,"
  1993.     SqlStr = SqlStr + "cwfx_profitbudgetmaster.budget_6=n.budget_6+n.add_6,"
  1994.     SqlStr = SqlStr + "cwfx_profitbudgetmaster.budget_7=n.budget_7+n.add_7,"
  1995.     SqlStr = SqlStr + "cwfx_profitbudgetmaster.budget_8=n.budget_8+n.add_8,"
  1996.     SqlStr = SqlStr + "cwfx_profitbudgetmaster.budget_9=n.budget_9+n.add_9,"
  1997.     SqlStr = SqlStr + "cwfx_profitbudgetmaster.budget_10=n.budget_10+n.add_10,"
  1998.     SqlStr = SqlStr + "cwfx_profitbudgetmaster.budget_11=n.budget_11+n.add_11,"
  1999.     SqlStr = SqlStr + "cwfx_profitbudgetmaster.budget_12 = n.budget_12 + n.add_12"
  2000.     
  2001.     SqlStr = SqlStr + " from cwfx_profitbudgetmaster,cwfx_profitbudgetmaster as n "
  2002.     SqlStr = SqlStr + " Where cwfx_profitbudgetmaster.id = n.id And "
  2003.     SqlStr = SqlStr + " cwfx_profitbudgetmaster.Year =" & Int_OriYear & " And n.Year =" & Int_OriYear - 1
  2004.     Cw_DataEnvi.DataConnect.Execute (SqlStr)
  2005.     Tsxx = "导入完毕"
  2006.     Call Xtxxts(Tsxx, 0, 4)
  2007. End Sub