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

企业管理

开发平台:

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 JS_FrmInventory 
  5.    Caption         =   "月末盘存录入"
  6.    ClientHeight    =   6555
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   8880
  10.    Icon            =   "成本计算_数据盘存.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   6555
  14.    ScaleWidth      =   8880
  15.    Begin VB.ComboBox ydcombo 
  16.       Height          =   300
  17.       Left            =   7470
  18.       TabIndex        =   16
  19.       Top             =   150
  20.       Visible         =   0   'False
  21.       Width           =   1275
  22.    End
  23.    Begin VB.CommandButton Yd_Help 
  24.       Height          =   299
  25.       Left            =   6810
  26.       Picture         =   "成本计算_数据盘存.frx":1042
  27.       Style           =   1  'Graphical
  28.       TabIndex        =   15
  29.       Top             =   150
  30.       Visible         =   0   'False
  31.       Width           =   300
  32.    End
  33.    Begin VB.CommandButton Ydcommand 
  34.       Height          =   299
  35.       Left            =   7200
  36.       Picture         =   "成本计算_数据盘存.frx":13CC
  37.       Style           =   1  'Graphical
  38.       TabIndex        =   14
  39.       Top             =   150
  40.       Visible         =   0   'False
  41.       Width           =   300
  42.    End
  43.    Begin VB.TextBox Ydtext 
  44.       BackColor       =   &H00C0FFFF&
  45.       BorderStyle     =   0  'None
  46.       Height          =   338
  47.       Left            =   6510
  48.       MultiLine       =   -1  'True
  49.       TabIndex        =   13
  50.       Top             =   210
  51.       Visible         =   0   'False
  52.       Width           =   1179
  53.    End
  54.    Begin VB.PictureBox Pic_Title 
  55.       AutoRedraw      =   -1  'True
  56.       BackColor       =   &H00FFFFFF&
  57.       Height          =   1065
  58.       Left            =   20
  59.       Picture         =   "成本计算_数据盘存.frx":1756
  60.       ScaleHeight     =   1005
  61.       ScaleWidth      =   11850
  62.       TabIndex        =   4
  63.       Top             =   600
  64.       Width           =   11915
  65.       Begin VB.ComboBox Combo_KJQJ 
  66.          Height          =   300
  67.          Left            =   1830
  68.          Style           =   2  'Dropdown List
  69.          TabIndex        =   5
  70.          Top             =   690
  71.          Width           =   2025
  72.       End
  73.       Begin VB.Label tsLabel 
  74.          AutoSize        =   -1  'True
  75.          BackColor       =   &H80000018&
  76.          BackStyle       =   0  'Transparent
  77.          Caption         =   "月末盘存录入"
  78.          BeginProperty Font 
  79.             Name            =   "宋体"
  80.             Size            =   12
  81.             Charset         =   134
  82.             Weight          =   700
  83.             Underline       =   0   'False
  84.             Italic          =   0   'False
  85.             Strikethrough   =   0   'False
  86.          EndProperty
  87.          ForeColor       =   &H00000000&
  88.          Height          =   240
  89.          Index           =   7
  90.          Left            =   360
  91.          TabIndex        =   12
  92.          Top             =   240
  93.          Width           =   1530
  94.       End
  95.       Begin VB.Label tsLabel 
  96.          AutoSize        =   -1  'True
  97.          BackStyle       =   0  'Transparent
  98.          Caption         =   "当前记录"
  99.          Height          =   180
  100.          Index           =   5
  101.          Left            =   9795
  102.          TabIndex        =   11
  103.          Top             =   210
  104.          Width           =   720
  105.       End
  106.       Begin VB.Label tsLabel 
  107.          AutoSize        =   -1  'True
  108.          BackStyle       =   0  'Transparent
  109.          Caption         =   "行)"
  110.          Height          =   180
  111.          Index           =   4
  112.          Left            =   11220
  113.          TabIndex        =   10
  114.          Top             =   210
  115.          Width           =   270
  116.       End
  117.       Begin VB.Label tsLabel 
  118.          AutoSize        =   -1  'True
  119.          BackStyle       =   0  'Transparent
  120.          Caption         =   "(第"
  121.          Height          =   180
  122.          Index           =   3
  123.          Left            =   10605
  124.          TabIndex        =   9
  125.          Top             =   210
  126.          Width           =   270
  127.       End
  128.       Begin VB.Label Lab_Row 
  129.          Alignment       =   2  'Center
  130.          Appearance      =   0  'Flat
  131.          AutoSize        =   -1  'True
  132.          BackColor       =   &H80000005&
  133.          BackStyle       =   0  'Transparent
  134.          ForeColor       =   &H00FF0000&
  135.          Height          =   180
  136.          Left            =   11070
  137.          TabIndex        =   8
  138.          Top             =   210
  139.          Width           =   90
  140.       End
  141.       Begin VB.Label Label2 
  142.          AutoSize        =   -1  'True
  143.          BackStyle       =   0  'Transparent
  144.          Caption         =   "会计期间:"
  145.          Height          =   180
  146.          Left            =   960
  147.          TabIndex        =   7
  148.          Top             =   750
  149.          Width           =   810
  150.       End
  151.       Begin VB.Label Lab_OperStatus 
  152.          BackColor       =   &H000080FF&
  153.          Caption         =   "1"
  154.          Height          =   195
  155.          Left            =   4830
  156.          TabIndex        =   6
  157.          Top             =   1320
  158.          Visible         =   0   'False
  159.          Width           =   345
  160.       End
  161.    End
  162.    Begin MSComctlLib.ImageList ImageList2 
  163.       Left            =   1260
  164.       Top             =   690
  165.       _ExtentX        =   1005
  166.       _ExtentY        =   1005
  167.       BackColor       =   -2147483643
  168.       ImageWidth      =   16
  169.       ImageHeight     =   16
  170.       MaskColor       =   12632256
  171.       _Version        =   393216
  172.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  173.          NumListImages   =   8
  174.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  175.             Picture         =   "成本计算_数据盘存.frx":1E696
  176.             Key             =   "stb"
  177.          EndProperty
  178.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  179.             Picture         =   "成本计算_数据盘存.frx":1EAEA
  180.             Key             =   "xttb"
  181.          EndProperty
  182.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  183.             Picture         =   "成本计算_数据盘存.frx":1EF42
  184.             Key             =   "qx"
  185.          EndProperty
  186.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  187.             Picture         =   "成本计算_数据盘存.frx":1F3A2
  188.             Key             =   "kplr"
  189.          EndProperty
  190.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  191.             Picture         =   "成本计算_数据盘存.frx":1F7F6
  192.             Key             =   "kpgl"
  193.          EndProperty
  194.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  195.             Picture         =   "成本计算_数据盘存.frx":1FC56
  196.             Key             =   "tcxt"
  197.          EndProperty
  198.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  199.             Picture         =   "成本计算_数据盘存.frx":1FF72
  200.             Key             =   "szk"
  201.          EndProperty
  202.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  203.             Picture         =   "成本计算_数据盘存.frx":203CA
  204.             Key             =   "gnqx"
  205.          EndProperty
  206.       EndProperty
  207.    End
  208.    Begin MSComctlLib.TreeView Tree_List 
  209.       Height          =   6285
  210.       Left            =   15
  211.       TabIndex        =   0
  212.       Top             =   1710
  213.       Width           =   3345
  214.       _ExtentX        =   5900
  215.       _ExtentY        =   11086
  216.       _Version        =   393217
  217.       Indentation     =   661
  218.       LabelEdit       =   1
  219.       LineStyle       =   1
  220.       Style           =   7
  221.       ImageList       =   "ImageList2"
  222.       Appearance      =   1
  223.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  224.          Name            =   "宋体"
  225.          Size            =   9
  226.          Charset         =   134
  227.          Weight          =   400
  228.          Underline       =   0   'False
  229.          Italic          =   0   'False
  230.          Strikethrough   =   0   'False
  231.       EndProperty
  232.    End
  233.    Begin MSComctlLib.Toolbar SzToolbar 
  234.       Align           =   1  'Align Top
  235.       Height          =   555
  236.       Left            =   0
  237.       TabIndex        =   1
  238.       Top             =   0
  239.       Width           =   8880
  240.       _ExtentX        =   15663
  241.       _ExtentY        =   979
  242.       ButtonWidth     =   820
  243.       ButtonHeight    =   926
  244.       AllowCustomize  =   0   'False
  245.       Appearance      =   1
  246.       Style           =   1
  247.       ImageList       =   "Imagelist1"
  248.       _Version        =   393216
  249.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  250.          NumButtons      =   10
  251.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  252.             Caption         =   "设置"
  253.             Key             =   "ymsz"
  254.             ImageKey        =   "sz"
  255.          EndProperty
  256.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  257.             Caption         =   "打印"
  258.             Key             =   "dy"
  259.             ImageKey        =   "dy"
  260.          EndProperty
  261.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  262.             Caption         =   "预览"
  263.             Key             =   "yl"
  264.             ImageKey        =   "yl"
  265.          EndProperty
  266.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  267.             Style           =   3
  268.          EndProperty
  269.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  270.             Caption         =   "编辑"
  271.             Key             =   "xg"
  272.             ImageKey        =   "xg"
  273.          EndProperty
  274.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  275.             Caption         =   "保存"
  276.             Key             =   "bc"
  277.             ImageKey        =   "bc"
  278.          EndProperty
  279.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  280.             Caption         =   "放弃"
  281.             Key             =   "fq"
  282.             ImageKey        =   "fq"
  283.          EndProperty
  284.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  285.             Style           =   3
  286.          EndProperty
  287.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  288.             Caption         =   "帮助"
  289.             Key             =   "bz"
  290.             ImageKey        =   "bz"
  291.          EndProperty
  292.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  293.             Caption         =   "退出"
  294.             Key             =   "fh"
  295.             ImageKey        =   "tc"
  296.          EndProperty
  297.       EndProperty
  298.       BorderStyle     =   1
  299.       Begin MSComctlLib.Toolbar GsToolbar 
  300.          Height          =   540
  301.          Left            =   10200
  302.          TabIndex        =   2
  303.          Top             =   0
  304.          Width           =   1665
  305.          _ExtentX        =   2937
  306.          _ExtentY        =   953
  307.          ButtonWidth     =   1455
  308.          ButtonHeight    =   953
  309.          AllowCustomize  =   0   'False
  310.          Appearance      =   1
  311.          Style           =   1
  312.          ImageList       =   "Imagelist1"
  313.          _Version        =   393216
  314.          BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  315.             NumButtons      =   2
  316.             BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  317.                Caption         =   "保存格式"
  318.                Key             =   "bcgs"
  319.                ImageKey        =   "bcgs"
  320.             EndProperty
  321.             BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  322.                Caption         =   "默认列宽"
  323.                Key             =   "hfmrgs"
  324.                ImageKey        =   "mrlk"
  325.             EndProperty
  326.          EndProperty
  327.       End
  328.       Begin MSComctlLib.ImageList Imagelist1 
  329.          Left            =   5400
  330.          Top             =   0
  331.          _ExtentX        =   1005
  332.          _ExtentY        =   1005
  333.          BackColor       =   -2147483643
  334.          ImageWidth      =   16
  335.          ImageHeight     =   16
  336.          MaskColor       =   12632256
  337.          _Version        =   393216
  338.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  339.             NumListImages   =   30
  340.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  341.                Picture         =   "成本计算_数据盘存.frx":20822
  342.                Key             =   "sz"
  343.             EndProperty
  344.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  345.                Picture         =   "成本计算_数据盘存.frx":20BBC
  346.                Key             =   "dy"
  347.             EndProperty
  348.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  349.                Picture         =   "成本计算_数据盘存.frx":20F56
  350.                Key             =   "yl"
  351.             EndProperty
  352.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  353.                Picture         =   "成本计算_数据盘存.frx":212F0
  354.                Key             =   "xz"
  355.             EndProperty
  356.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  357.                Picture         =   "成本计算_数据盘存.frx":2168A
  358.                Key             =   "xg"
  359.             EndProperty
  360.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  361.                Picture         =   "成本计算_数据盘存.frx":21A24
  362.                Key             =   "sc"
  363.             EndProperty
  364.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  365.                Picture         =   "成本计算_数据盘存.frx":21DBE
  366.                Key             =   "zh"
  367.             EndProperty
  368.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  369.                Picture         =   "成本计算_数据盘存.frx":22158
  370.                Key             =   "sh"
  371.             EndProperty
  372.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  373.                Picture         =   "成本计算_数据盘存.frx":224F2
  374.                Key             =   "bc"
  375.             EndProperty
  376.             BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  377.                Picture         =   "成本计算_数据盘存.frx":2288C
  378.                Key             =   "fq"
  379.             EndProperty
  380.             BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  381.                Picture         =   "成本计算_数据盘存.frx":22C26
  382.                Key             =   "check"
  383.             EndProperty
  384.             BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  385.                Picture         =   "成本计算_数据盘存.frx":22FC0
  386.                Key             =   "qs"
  387.             EndProperty
  388.             BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  389.                Picture         =   "成本计算_数据盘存.frx":2335A
  390.                Key             =   "fullcheck"
  391.             EndProperty
  392.             BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  393.                Picture         =   "成本计算_数据盘存.frx":236F4
  394.                Key             =   "qq"
  395.             EndProperty
  396.             BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  397.                Picture         =   "成本计算_数据盘存.frx":23A8E
  398.                Key             =   "first"
  399.             EndProperty
  400.             BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  401.                Picture         =   "成本计算_数据盘存.frx":23E28
  402.                Key             =   "prev"
  403.             EndProperty
  404.             BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  405.                Picture         =   "成本计算_数据盘存.frx":241C2
  406.                Key             =   "next"
  407.             EndProperty
  408.             BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  409.                Picture         =   "成本计算_数据盘存.frx":2455C
  410.                Key             =   "last"
  411.             EndProperty
  412.             BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  413.                Picture         =   "成本计算_数据盘存.frx":248F6
  414.                Key             =   "bz"
  415.             EndProperty
  416.             BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  417.                Picture         =   "成本计算_数据盘存.frx":24C90
  418.                Key             =   "tc"
  419.             EndProperty
  420.             BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  421.                Picture         =   "成本计算_数据盘存.frx":2502A
  422.                Key             =   "bcgs"
  423.             EndProperty
  424.             BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  425.                Picture         =   "成本计算_数据盘存.frx":253C4
  426.                Key             =   "mrlk"
  427.             EndProperty
  428.             BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  429.                Picture         =   "成本计算_数据盘存.frx":2575E
  430.                Key             =   "xsxm"
  431.             EndProperty
  432.             BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  433.                Picture         =   "成本计算_数据盘存.frx":25AF8
  434.                Key             =   "hz"
  435.             EndProperty
  436.             BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  437.                Picture         =   "成本计算_数据盘存.frx":25E92
  438.                Key             =   "dw"
  439.             EndProperty
  440.             BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  441.                Picture         =   "成本计算_数据盘存.frx":2622C
  442.                Key             =   "zx"
  443.             EndProperty
  444.             BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  445.                Picture         =   "成本计算_数据盘存.frx":265C6
  446.                Key             =   "mx"
  447.             EndProperty
  448.             BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  449.                Picture         =   "成本计算_数据盘存.frx":26960
  450.                Key             =   "hf"
  451.             EndProperty
  452.             BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  453.                Picture         =   "成本计算_数据盘存.frx":26CFA
  454.                Key             =   "cx"
  455.             EndProperty
  456.             BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  457.                Picture         =   "成本计算_数据盘存.frx":27094
  458.                Key             =   "sx"
  459.             EndProperty
  460.          EndProperty
  461.       End
  462.    End
  463.    Begin VSFlex8Ctl.VSFlexGrid CzxsGrid 
  464.       Height          =   6270
  465.       Left            =   3390
  466.       TabIndex        =   3
  467.       Top             =   1710
  468.       Width           =   8555
  469.       _cx             =   5080
  470.       _cy             =   5080
  471.       Appearance      =   1
  472.       BorderStyle     =   1
  473.       Enabled         =   -1  'True
  474.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  475.          Name            =   "宋体"
  476.          Size            =   9
  477.          Charset         =   134
  478.          Weight          =   400
  479.          Underline       =   0   'False
  480.          Italic          =   0   'False
  481.          Strikethrough   =   0   'False
  482.       EndProperty
  483.       MousePointer    =   0
  484.       BackColor       =   -2147483643
  485.       ForeColor       =   -2147483640
  486.       BackColorFixed  =   -2147483633
  487.       ForeColorFixed  =   -2147483630
  488.       BackColorSel    =   -2147483635
  489.       ForeColorSel    =   -2147483634
  490.       BackColorBkg    =   8421504
  491.       BackColorAlternate=   -2147483643
  492.       GridColor       =   -2147483633
  493.       GridColorFixed  =   -2147483632
  494.       TreeColor       =   -2147483632
  495.       FloodColor      =   192
  496.       SheetBorder     =   -2147483642
  497.       FocusRect       =   1
  498.       HighLight       =   1
  499.       AllowSelection  =   -1  'True
  500.       AllowBigSelection=   -1  'True
  501.       AllowUserResizing=   0
  502.       SelectionMode   =   0
  503.       GridLines       =   1
  504.       GridLinesFixed  =   2
  505.       GridLineWidth   =   1
  506.       Rows            =   5000
  507.       Cols            =   10
  508.       FixedRows       =   1
  509.       FixedCols       =   0
  510.       RowHeightMin    =   0
  511.       RowHeightMax    =   0
  512.       ColWidthMin     =   0
  513.       ColWidthMax     =   0
  514.       ExtendLastCol   =   0   'False
  515.       FormatString    =   ""
  516.       ScrollTrack     =   0   'False
  517.       ScrollBars      =   3
  518.       ScrollTips      =   0   'False
  519.       MergeCells      =   0
  520.       MergeCompare    =   0
  521.       AutoResize      =   -1  'True
  522.       AutoSizeMode    =   0
  523.       AutoSearch      =   0
  524.       AutoSearchDelay =   2
  525.       MultiTotals     =   -1  'True
  526.       SubtotalPosition=   1
  527.       OutlineBar      =   0
  528.       OutlineCol      =   0
  529.       Ellipsis        =   0
  530.       ExplorerBar     =   0
  531.       PicturesOver    =   0   'False
  532.       FillStyle       =   0
  533.       RightToLeft     =   0   'False
  534.       PictureType     =   0
  535.       TabBehavior     =   0
  536.       OwnerDraw       =   0
  537.       Editable        =   0
  538.       ShowComboButton =   1
  539.       WordWrap        =   0   'False
  540.       TextStyle       =   0
  541.       TextStyleFixed  =   0
  542.       OleDragMode     =   0
  543.       OleDropMode     =   0
  544.       DataMode        =   0
  545.       VirtualData     =   -1  'True
  546.       DataMember      =   ""
  547.       ComboSearch     =   3
  548.       AutoSizeMouse   =   -1  'True
  549.       FrozenRows      =   0
  550.       FrozenCols      =   0
  551.       AllowUserFreezing=   0
  552.       BackColorFrozen =   0
  553.       ForeColorFrozen =   0
  554.       WallPaperAlignment=   9
  555.       AccessibleName  =   ""
  556.       AccessibleDescription=   ""
  557.       AccessibleValue =   ""
  558.       AccessibleRole  =   24
  559.    End
  560. End
  561. Attribute VB_Name = "JS_FrmInventory"
  562. Attribute VB_GlobalNameSpace = False
  563. Attribute VB_Creatable = False
  564. Attribute VB_PredeclaredId = True
  565. Attribute VB_Exposed = False
  566. '*******************************************************
  567. '*    模 块 名 称 :数据盘存
  568. '*    功 能 描 述 :数据盘存
  569. '*    程序员姓名  :xjl
  570. '*    最后修改人  :xjl
  571. '*    最后修改时间:2002/1/22
  572. '*    备        注:
  573. '*******************************************************
  574. Dim RecDigest As New ADODB.Recordset     '常用摘要表
  575. Dim jdzygs As Integer                    '控件焦点转移个数
  576. Dim Lrzt As Integer                      '录入状态标志(0-非录入状态 1-增加 2-修改)
  577. Dim ShowBillLock As Boolean              '是否显示
  578. Dim PrivateYear As Integer               '年
  579. Dim PrivateMm As Integer                 '月
  580. Dim TreeNots_Code As String
  581. Dim Str_RightEdit As String              '编辑权限索引
  582. Dim RecTemp As New ADODB.Recordset
  583. Dim Cxnrrec As New ADODB.Recordset       '显示查询内容动态集
  584. Dim Dyymctbl As New DY_Dyymsz            '打印页面窗体变量
  585. Dim GridCode As String                   '显示网格网格代码
  586. Dim GridInf() As Variant                 '整个网格设置信息
  587. Dim ReportTitle As String                '报表主标题
  588. Dim Tsxx As String                       '系统提示信息
  589. Dim Pmbcsjhs As Long                     '屏幕网格保持数据行数(大于等于1)
  590. Dim Fzxwghs As Integer                   '辅助项网格行数(包括合计行)
  591. Dim Sfxshjwg As Boolean                  '是否显示合计网格
  592. Dim Qslz As Long                         '网格隐藏(非操作显示)列数
  593. Dim Sjhgd As Double                      '网格数据行高度
  594. Dim GridBoolean() As Boolean             '网格列信息(布尔型)
  595. Dim GridStr()  As String                 '网格列信息(字符型)
  596. Dim GridInt() As Integer                 '网格列信息(整型)
  597. Dim Sfblbzkd As Boolean                  '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
  598. Dim Dqlrwgh As Long                      '当前录入数据网格行
  599. Dim Dqlrwgl As Long                      '当前录入数据网格列
  600. Dim Dqlkwgh As Long                      '刚刚离开网格行(不一定为录入行)
  601. Dim Dqlkwgl As Long                      '刚刚离开网格列
  602. Dim Dqtoprow As Long                     '当前录入状态时最上端可视行
  603. Dim Dqleftcol As Long                    '当前录入状态时最左端可视列
  604. Dim Zdlrqnr As String                    '字段录入修改前内容(用来判断内容是否修改)
  605. Dim Wbkbhlock As Boolean                 '文本框改变值锁
  606. Dim Changelock As Boolean                '网格行列改变控制锁(用来区别用户改变.程序改变)
  607. Dim Gdtlock As Boolean                   '滚动条滚动控制(用来区别用户改变.程序改变)
  608. Dim Yxxpdlock As Boolean                 '字段有效性判断锁(内容不修改不需进行字段有效性判断)
  609. Dim Hyxxpdlock As Boolean                '行有效性判断锁(字段内容不修改不需进行行有效性判断)
  610. Dim Valilock As Boolean                  '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
  611. Dim Shsfts As Boolean                    '删除记录行是否提示
  612. Dim Szzls As Integer                     '网格信息数组最大下标值(网格列数-1)
  613. Private Sub Combo_KJQJ_Click()              '会计科目
  614.     PrivateYear = Mid(Trim(CStr(Combo_KJQJ.List(Combo_KJQJ.ListIndex))), 1, 4)
  615.     PrivateMm = Right(Trim(CStr(Combo_KJQJ.List(Combo_KJQJ.ListIndex))), 2)
  616.     Lab_OperStatus.Caption = "1"
  617.     If ShowBillLock = False Then
  618.         Exit Sub
  619.     End If
  620.     '显示数据
  621.     Call ShowCostInventory
  622. End Sub
  623. Private Sub CzxsGrid_BeforeMoveColumn(ByVal Col As Long, Position As Long)
  624.     Call FnBln_RefreshArray(Col, Position, GridStr(), GridInf())
  625. End Sub
  626. Private Sub CzxsGrid_EnterCell()
  627.     With CzxsGrid
  628.         If .Row >= .FixedRows Then
  629.             Lab_Row = Trim(Str(.Row - .FixedRows + 1))
  630.         End If
  631.     End With
  632. End Sub
  633. Private Sub CzxsGrid_GotFocus()
  634.     '网格得到焦点,如果当前选择行为非数据行
  635.     '则调整当前焦点至有效数据行
  636.     With CzxsGrid
  637.         If .Row < .FixedRows And .Rows > .FixedRows Then
  638.             Changelock = True
  639.             .Select .FixedRows, .Col
  640.             Changelock = False
  641.         End If
  642.         If .Col < Qslz Then     '
  643.             Changelock = True
  644.             .Select .Row, Qslz
  645.             Changelock = False
  646.         End If
  647.     End With
  648. End Sub
  649. Private Sub CzxsGrid_KeyDown(KeyCode As Integer, Shift As Integer)
  650.     '如果单据操作状态为浏览状态则不能显示录入载体
  651.     If Trim(Lab_OperStatus.Caption) = "1" Then
  652.         Exit Sub
  653.     End If
  654.     Select Case KeyCode
  655.         Case vbKeyF2                   '按F2键参照
  656.             Call xswbk
  657.             Call Lrzdbz
  658.     End Select
  659. End Sub
  660. Private Sub CzxsGrid_KeyPress(KeyAscii As Integer)
  661.     '当某种条件成立时禁止文本框激活使单据处于录入状态
  662.     If Not Fun_AllowInput Then
  663.         Exit Sub
  664.     End If
  665.   
  666.     With CzxsGrid
  667.   
  668.         '屏 蔽 回 车 键
  669.         If KeyAscii = vbKeyReturn Then
  670.             KeyAscii = 0
  671.             Rowjsq = .Row
  672.             Coljsq = .Col + 1
  673.             If Coljsq > .Cols - 1 Then
  674.                 If Rowjsq < .Rows - 1 Then
  675.                     Rowjsq = Rowjsq + 1
  676.                 End If
  677.                 Coljsq = Qslz
  678.             End If
  679.             Do While Rowjsq <= .Rows - 1
  680.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  681.                     Coljsq = Coljsq + 1
  682.                     If Coljsq > .Cols - 1 Then
  683.                         Rowjsq = Rowjsq + 1
  684.                         Coljsq = Qslz
  685.                     End If
  686.                 Else
  687.                     Exit Do
  688.                 End If
  689.             Loop
  690.           
  691.             If Rowjsq <= .Rows - 1 Then
  692.                 .Select Rowjsq, Coljsq
  693.             End If
  694.        
  695.             Exit Sub
  696.        
  697.         End If
  698.      
  699.         '接受用户录入
  700.         Select Case KeyAscii
  701.             Case 0 To 32             '用户输入KeyAscii为0-32的键 如空格
  702.                 '显示录入载体
  703.                 Call xswbk
  704.             Case Else
  705.                 
  706.                 '防止非编辑字段SendKeys()出现死循环
  707.                 If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  708.                     Exit Sub
  709.                 End If
  710.                 
  711.                 '如果此字段为列表框录入则调入相应列表框
  712.                 If GridBoolean(.Col, 3) Then
  713.                    '列表框录入
  714.                     Call xswbk
  715.                 Else
  716.                     Ydtext.Text = ""
  717.             
  718.                     '录入限制
  719.                     Call InputFieldLimit(Ydtext, GridInt(CzxsGrid.Col, 1), KeyAscii)
  720.                     If KeyAscii = 0 Then
  721.                         Exit Sub
  722.                     End If
  723.                     Call xswbk
  724.                     Ydtext.Text = ""
  725.                     Valilock = True
  726.                     SendKeys Chr(KeyAscii), True
  727.                     DoEvents
  728.                     Valilock = False
  729.                 End If
  730.         End Select
  731.     End With
  732. End Sub
  733. Private Sub CzxsGrid_LeaveCell()
  734.     If Changelock Then
  735.         Exit Sub
  736.     End If
  737.     '记录刚刚离开网格单元的行列值
  738.     Dqlkwgh = CzxsGrid.Row
  739.     Dqlkwgl = CzxsGrid.Col
  740.     '判断是否需要录入数据回写
  741.     If Not (Ydtext.Visible Or YdCombo.Visible) Then
  742.         Exit Sub
  743.     End If
  744.     Call Lrsjhx
  745. End Sub
  746. Private Sub CzxsGrid_LostFocus()
  747.     '网格内部原因:网格单元内需要录入信息过程中,(程序控制)本单元内的文本框或下拉列表框显露并获得焦点时引发该事件发生;
  748.     '网格外部原因:网格之外的控件获得焦点造成网格失去焦点,比如网格外的文本框。
  749.     '用以屏蔽调用其它窗体时发生网格失去焦点事件
  750.     If Changelock Then
  751.         Exit Sub
  752.     End If
  753.     '在每个单元输入均合法,但整行输入有可能不合法,在文本框不可编辑状态,这时网格外的某控件获得焦点时,网格失去焦点,必须人为引发RowColChange事件
  754.     '故意引发网格RowcolChange事件
  755.     With CzxsGrid
  756.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  757.             .Select 0, 0
  758.         End If
  759.     End With
  760. End Sub
  761. Private Sub CzxsGrid_RowColChange()
  762.     Valilock = True       '屏蔽文本框失去焦点进行有效性判断
  763.     With CzxsGrid
  764.         If Changelock Then
  765.             Exit Sub
  766.         End If
  767.         If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  768.             Exit Sub
  769.         End If
  770.         If .Row <> Dqlkwgh Then     '若刚刚进入行《》刚刚离开行,进行行有效性判断
  771.             If Not Sjhzyxxpd(Dqlkwgh) Then
  772.                 Exit Sub
  773.             End If
  774.         End If
  775.     End With
  776.     Call fhyxh      '返回有效行
  777.     Call Xldql
  778. End Sub
  779. Private Sub CzxsGrid_AfterScroll(ByVal OldTopRow As Long, ByVal OldLeftCol As Long, ByVal NewTopRow As Long, ByVal NewLeftCol As Long)
  780.     If Gdtlock Then
  781.         Exit Sub
  782.     End If
  783.     With CzxsGrid
  784.         If Ydtext.Visible Or YdCombo.Visible Then
  785.             Gdtlock = True
  786.             .TopRow = Dqtoprow
  787.             .LeftCol = Dqleftcol
  788.             Gdtlock = False
  789.             Exit Sub
  790.         End If
  791.     End With
  792. End Sub
  793. '控 制 焦 点 转 移
  794. Private Sub Form_KeyPress(KeyAscii As Integer)
  795.     jdzygs = 3
  796.     Select Case KeyAscii
  797.         Case vbKeyReturn
  798.             If Kjjdzy(jdzygs) Then
  799.                 KeyAscii = 0
  800.             End If
  801.         Case 39           '屏蔽"'"
  802.             KeyAscii = 0
  803.     End Select
  804. End Sub
  805. Private Sub Form_Load()
  806.     '初始化各种锁值
  807.     Changelock = False             '网格行列改变控制锁
  808.     Gdtlock = False                '滚动条滚动控制
  809.     Yxxpdlock = True               '字段有效性判断锁
  810.     Hyxxpdlock = True              '行有效性判断锁
  811.     Wbkbhlock = False              '文本框内容改变锁
  812.     ShowBillLock = False           '是否显示查询数据控制
  813.     PrivateYear = Xtyear           '会计年度
  814.     PrivateMm = Xtmm               '会计期间
  815.     
  816.     '定义可变部分变量
  817.     ReportTitle = "月末数据盘存"
  818.     '调入打印页面设置窗体
  819.     XtReportCode = "Cb_Inventory"
  820.     Load Dyymctbl
  821.     
  822.     '树结构
  823.     Call cshtree
  824.     
  825.     '调入网格
  826.     GridCode = "Cb_Inventory"
  827.     Call BzWgcsh(CzxsGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  828.     
  829.     Qslz = GridInf(1)
  830.     Sjhgd = GridInf(2)
  831.     Pmbcsjhs = GridInf(3)
  832.     Fzxwghs = GridInf(4)
  833.     Sfblbzkd = GridInf(5)
  834.     Shsfts = GridInf(6)
  835.     Sfxshjwg = GridInf(7)
  836.     Szzls = CzxsGrid.Cols - 1
  837.     
  838.     Call Sub_FillPeriod(Combo_KJQJ, PrivateYear, PrivateMm)     '会计期间
  839.     TreeNots_Code = ""                                          '显示记录
  840.     Call ShowCostInventory
  841.     
  842.     Lab_OperStatus.Caption = "1"
  843.     '判断是否有数据
  844.     SqlStr = "Select count(*) From Cb_CostStructure Where CheckFlag='1'"
  845.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  846.     If RecTemp.Fields(0) <= 0 Then
  847.         Call Sub_OperStatus("10")
  848.     Else
  849.         ShowBillLock = True
  850.     End If
  851.     '权限编号
  852.     Str_RightEdit = "CB_Inventory_Edit"
  853. End Sub
  854. Private Sub Sub_Query(Code As String, Index As Integer)                                   '查询内容填充网格
  855.     Dim SqlStr As String
  856.     Dim jsqte As Long
  857.     
  858.     '禁止网格刷新动作,为加快网格显示速度(Fixed)
  859.     CzxsGrid.Redraw = False
  860.     
  861.     '查询连接串
  862.     If Index = 0 Then
  863.         SqlStr = "Select A.ItemCode,C.ItemName,C.UnitName,C.PlanUnitPrice,B.InvQuantity,B.InvValue,A.Objectcode,A.CenterCode,D.CenterName From " _
  864.                     & "Cb_CostStructure A " _
  865.                     & "Left Outer Join Cb_Inventory B On " _
  866.                     & "A.ObjectCode=B.Objectcode And A.ItemCode=B.ItemCode And B.Year='" + CStr(PrivateYear) + "' and B.Period='" + CStr(PrivateMm) + "' " _
  867.                     & "Left Outer Join (Select A.ItemCode,A.ItemName,A.PlanUnitPrice,B.UnitName From Cb_CostItem A  " _
  868.                     & "Left Outer Join Gy_UnitSet B On A.MeasureUnit=B.UnitCode ) C On A.ItemCode=C.ItemCode " _
  869.                     & "Left Outer Join Cb_CostCenter D On A.CenterCode=D.CenterCode " _
  870.                     & "Where A.ObjectCode='" & Code & "' And A.CheckFlag='1'"
  871.     Else
  872.         SqlStr = "Select A.ItemCode,B.ItemName,B.UnitName,A.PlanUnitCost as PlanUnitPrice,A.InvQuantity,A.InvValue,A.ObjectCode,A.CenterCode,C.CenterName From Cb_Inventory A " _
  873.                     & "Left Outer Join (Select ItemCode,ItemName,UnitName From Cb_CostItem A " _
  874.                     & "Left Outer Join Gy_UnitSet B On A.MeasureUnit=B.UnitCode) B On A.ItemCode=B.ItemCode " _
  875.                     & "Left Outer Join Cb_CostCenter C On A.CenterCode=C.CenterCode " _
  876.                     & "Where A.ObjectCode='" & Code & "' And A.Year='" + CStr(PrivateYear) + "' And A.Period='" + CStr(PrivateMm) + "'"
  877.     End If
  878.     Set Cxnrrec = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  879.     With Cxnrrec
  880.         CzxsGrid.Rows = CzxsGrid.FixedRows
  881.      
  882.         If .EOF Then
  883.             CzxsGrid.Redraw = True
  884.             Exit Sub
  885.         End If
  886.      
  887.         jsqte = CzxsGrid.FixedRows
  888.         Do While Not .EOF
  889.             CzxsGrid.AddItem ""
  890.             '[>>显示
  891.             CzxsGrid.TextMatrix(jsqte, 0) = "*" '行标识
  892.             CzxsGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("CenterName") & "")    '成本中心
  893.             CzxsGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("ItemCode") & "")      '项目编码
  894.             CzxsGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("ItemName") & "")      '项目名称
  895.             CzxsGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("UnitName") & "")      '计量单位
  896.             CzxsGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("PlanUnitPrice")) & "" '计划单价
  897.             CzxsGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("InvQuantity") & "")   '盘存数量
  898.             CzxsGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("InvValue") & "")      '盘存金额
  899.             CzxsGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = Trim(.Fields("CenterCode") & "")    '中心编码
  900.             CzxsGrid.TextMatrix(jsqte, Sydz("009", GridStr(), Szzls)) = Trim(.Fields("Objectcode") & "")    '对象编码
  901.             '<<]
  902.             CzxsGrid.RowHeight(jsqte) = Sjhgd
  903.             .MoveNext
  904.             jsqte = jsqte + 1
  905.         Loop
  906.     End With
  907.     
  908.     '将网格刷新解禁(Fixed)
  909.     CzxsGrid.Redraw = True
  910. End Sub
  911. Private Sub Form_Resize()                                   '调整窗体
  912.     On Error Resume Next
  913.     With Tree_List
  914.         .Width = Me.Width / 4 + Me.Width / 40
  915.         .Height = Me.Height - .Top - 400
  916.     End With
  917.     With CzxsGrid
  918.         .Left = Tree_List.Left + Tree_List.Width + 30
  919.         .Width = Me.Width - (Me.Width / 4 + Me.Width / 40) - 170
  920.         .Height = Me.Height - .Top - 400
  921.     End With
  922.     With Pic_Title
  923.         .Width = Me.Width - 140
  924.     End With
  925.     GsToolbar.Left = Me.Width - GsToolbar.Width - 140
  926.     Call Cxxswbk
  927. End Sub
  928. Private Sub Form_Unload(Cancel As Integer)                   '窗体卸载
  929.     Set Cxnrrec = Nothing
  930.     Unload Dyymctbl
  931. End Sub
  932. Private Function Sub_SaveBill() As Boolean                   '保存数据
  933.     Dim Recfind As New ADODB.Recordset     '有效性判断动态集
  934.     Dim Rowjsq As Long           '网格行计数器
  935.     Dim Coljsq As Long           '网格列计数器
  936.     Dim Int_RowCount As Integer  '有效数据行计数器
  937.     Dim Lrywlz As Long           '录入有误列值
  938.     '下面将对所有有效数据行进行有效性判断
  939.     Int_RowCount = 0
  940.     With CzxsGrid
  941.         For Rowjsq = .FixedRows To .Rows - 1
  942.             '带*号者为有效数据行
  943.             If .TextMatrix(Rowjsq, 0) <> "*" Then
  944.                 Exit Function
  945.             Else
  946.                 Int_RowCount = Int_RowCount + 1
  947.             End If
  948.                
  949.             '2.[自定义判断(补丁)
  950.             '首先进行为空判断(固定不变)
  951.             For jsqte = Qslz To .Cols - 1
  952.                 If (GridInt(jsqte, 5) = 1 And Len(Trim(.TextMatrix(Rowjsq, jsqte))) = 0) Or (GridInt(jsqte, 5) = 2 And Val(Trim(.TextMatrix(Rowjsq, jsqte))) = 0) Then
  953.                     Tsxx = GridStr(jsqte, 2)
  954.                     Lrywlz = jsqte
  955.                     GoTo Lrcwcl
  956.                     Exit For
  957.                 End If
  958.             Next jsqte
  959.         Next
  960.         If Int_RowCount = 0 Then
  961.             Tsxx = "有效行数为零,不能存盘!"
  962.             Call Xtxxts(Tsxx, 0, 1)
  963.             Exit Function
  964.         End If
  965.     End With  '网格
  966.     
  967.     '如果以上有效性检查均顺利通过,则执行存盘动作
  968.     
  969.     On Error GoTo Swcwcl
  970.     If TreeNots_Code = "" Then
  971.         Exit Function
  972.     End If
  973.     '写数据
  974.     Cw_DataEnvi.DataConnect.BeginTrans
  975.     For Rowjsq = CzxsGrid.FixedRows To CzxsGrid.Rows - 1
  976.         SqlStr = "Delete From Cb_Inventory Where CenterCode='" & Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("008", GridStr(), Szzls))) & "' And ObjectCode='" & Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("009", GridStr(), Szzls))) & "' And ItemCode='" & Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("002", GridStr(), Szzls))) & "' And Year=" & CStr(PrivateYear) & " And Period=" & CStr(PrivateMm) & ""
  977.         Cw_DataEnvi.DataConnect.Execute (SqlStr)
  978.         If RecDigest.State = 1 Then RecDigest.Close
  979.         RecDigest.Open "Select * From Cb_Inventory Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockPessimistic
  980.         If RecDigest.EOF Then
  981.             If CzxsGrid.TextMatrix(Rowjsq, 0) <> "*" Then
  982.                 Exit Function
  983.             End If
  984.             With RecDigest
  985.                 .AddNew
  986.                 .Fields("ItemCode") = Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("002", GridStr(), Szzls)))      '项目编码
  987.                 .Fields("CenterCode") = Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("008", GridStr(), Szzls)))    '成本中心
  988.                 .Fields("Objectcode") = Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("009", GridStr(), Szzls)))    '对象编码
  989.                 .Fields("Year") = PrivateYear                                                               '会计年度
  990.                 .Fields("Period") = PrivateMm                                                               '会计期间
  991.                 .Fields("PlanUnitCost") = Val(CzxsGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), Szzls)))   '计划成本
  992.                 .Fields("InvQuantity") = Val(CzxsGrid.TextMatrix(Rowjsq, Sydz("006", GridStr(), Szzls)))    '盘存数量
  993.                 .Fields("InvValue") = Val(CzxsGrid.TextMatrix(Rowjsq, Sydz("007", GridStr(), Szzls)))       '盘存金额
  994.                 .Update
  995.             End With
  996.         End If
  997.     Next
  998.     Cw_DataEnvi.DataConnect.CommitTrans
  999.     Tsxx = "存盘完毕! "
  1000.     Call Xtxxts(Tsxx, 0, 4)
  1001.     Sub_SaveBill = True
  1002.     Lab_OperStatus = "1"
  1003.     Call Sub_OperStatus("11")
  1004.     Exit Function
  1005. Swcwcl:
  1006.      Cw_DataEnvi.DataConnect.RollbackTrans
  1007.      If Err.Number = -2147217873 Then
  1008.         Tsxx = "不能有重复的对象!"
  1009.      Else
  1010.         Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
  1011.      End If
  1012.      Call Xtxxts(Tsxx, 0, 1)
  1013.      Exit Function
  1014. Lrcwcl:        '录入错误处理
  1015.     Cw_DataEnvi.DataConnect.RollbackTrans
  1016.     With CzxsGrid
  1017.         Call Xtxxts("(第 " + Trim(Str(Int_RowCount)) + " 条记录)-" + Tsxx, 0, 1)
  1018.         Changelock = True
  1019.         .Select Rowjsq, Lrywlz
  1020.         CzxsGrid.SetFocus
  1021.         Changelock = False
  1022.         Exit Function
  1023.     End With
  1024. End Function
  1025. '******************以下为基本处理程序(固定不变)************************'
  1026. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)        '支持热键操作
  1027.     If Shift = 2 Then
  1028.      Select Case UCase(Chr(KeyCode))
  1029.          Case "P"                   'Ctrl+P 打印
  1030.             Call bbyl(False)
  1031.      End Select
  1032.   End If
  1033. End Sub
  1034. Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
  1035.     Select Case Button.Key
  1036.         Case "ymsz"                                          '页面设置
  1037.             Dyymctbl.Show 1
  1038.         Case "yl"                                            '预 览
  1039.             Call bbyl(True)
  1040.         Case "dy"                                            '打 印
  1041.             Call bbyl(False)
  1042.         Case "xg"                                            '编辑
  1043.             If CzxsGrid.Rows <= CzxsGrid.FixedRows Then
  1044.                 Exit Sub
  1045.             End If
  1046.             
  1047.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1048.             If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  1049.                 Exit Sub
  1050.             End If
  1051.             
  1052.             '设置状态
  1053.             Lab_OperStatus.Caption = "3"
  1054.             '设置工具条状态
  1055.             Call Sub_OperStatus("30")
  1056.         Case "bc"                                            '保存
  1057.             If Fun_Drfrmyxxpd Then Call Sub_SaveBill
  1058.         Case "fq"                                            '放弃
  1059.             Call Sub_AbandonBill
  1060.         Case "bz"                                            '帮 助
  1061.             Call F1bz
  1062.         Case "fh"                                            '退 出
  1063.             Unload Me
  1064.     End Select
  1065. End Sub
  1066. Private Sub CzxsGrid_DblClick()                            '修改当前编码记录
  1067.     With CzxsGrid
  1068.         Call xswbk
  1069.    End With
  1070. End Sub
  1071. Private Sub Sub_OperStatus(Str_Status As String)                 '工具条依据不同状态所进行的变化
  1072.     With SzToolbar
  1073.         Select Case Str_Status
  1074.             Case "10"   '浏览
  1075.                 '工具条
  1076.                 .Buttons("xg").Enabled = False     '修改
  1077.                 .Buttons("bc").Enabled = False
  1078.                 .Buttons("fq").Enabled = False
  1079.             Case "11"   '浏览
  1080.                  '工具条
  1081.                 .Buttons("xg").Enabled = True     '修改
  1082.                 .Buttons("bc").Enabled = False
  1083.                 .Buttons("fq").Enabled = False
  1084.             Case "30"   '修改
  1085.                 '工具条
  1086.                 .Buttons("xg").Enabled = False     '修改
  1087.                 .Buttons("bc").Enabled = True
  1088.                 .Buttons("fq").Enabled = True
  1089.         End Select
  1090.     End With
  1091. End Sub
  1092. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)   '表格格式设置(通用)
  1093.     Select Case Button.Key
  1094.         Case "bcgs"                              '保存表格格式
  1095.             Call Bcwggs(CzxsGrid, GridCode, GridStr())
  1096.         Case "hfmrgs"                            '恢复默认格式
  1097.             Call Hfmrgs(CzxsGrid, GridCode, GridStr())
  1098.     End Select
  1099. End Sub
  1100. Private Sub bbyl(bbylte As Boolean)                                     '报表打印预览
  1101.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  1102.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  1103.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  1104.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  1105.     ReDim Bbxbt(1 To Bbxbtgs)
  1106.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  1107.     If Bbbwhgs <> 0 Then
  1108.         ReDim Bbbwh(1 To Bbbwhgs)
  1109.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  1110.     End If
  1111.     Bbzbt = ReportTitle
  1112.     Tree_List.SetFocus
  1113.     '判断是否有数据
  1114.     SqlStr = "Select count(*) From Cb_CostStructure Where CheckFlag='1'"
  1115.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  1116.     If RecTemp.Fields(0) <= 0 Then
  1117.         Bbxbt(1) = Space(2) + "成本对象:"
  1118.     Else
  1119.         Tree_List.SetFocus
  1120.         If Tree_List.SelectedItem.Children = 0 Then
  1121.             Bbxbt(1) = Space(2) + Fun_FormatOutPut("成本对象:" + Tree_List.SelectedItem.Text, 42)
  1122.             Bbxbt(1) = Bbxbt(1) + Fun_FormatOutPut(Mid(CStr(Combo_KJQJ.List(Combo_KJQJ.ListIndex)), 1, 4) + "年" + Right(CStr(Combo_KJQJ.List(Combo_KJQJ.ListIndex)), 2) + "月", 35)
  1123.         Else
  1124.             Bbxbt(1) = Space(2) + "成本对象:"
  1125.         End If
  1126.     End If
  1127.     
  1128.     bbxbtzzxs(1) = 0                                     '报表行组织形式(0-居左 1-居中 2-居右)
  1129.     Call Scyxsjb(CzxsGrid)                               '生成报表数据
  1130.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  1131.     If Not bbylte Then
  1132.         Unload DY_Tybbyldy
  1133.     End If
  1134. End Sub
  1135. '************以下为文本框录入处理程序(固定不变部分)*************'
  1136. Private Sub Wbklrwbcl(Index As Integer)    '文本框录入事后处理程序
  1137.   '以下为依据实际情况自定义部分[
  1138.   
  1139.       '在此填写文本框录入事后处理程序
  1140.    
  1141.   ']以上为依据实际情况自定义部分
  1142. End Sub
  1143. Private Sub Tree_List_NodeClick(ByVal Node As MSComctlLib.Node)
  1144.     Dim code_row As Integer
  1145.     Dim ff As String
  1146.     On Error Resume Next
  1147.     With CzxsGrid
  1148.         code_row = .FindRow(Trim(Mid(Tree_List.SelectedItem.Key, 2)), , Sydz("001", GridStr(), Szzls))
  1149.         If code_row <> -1 Then
  1150.             .Select code_row, 0
  1151.         End If
  1152.     End With
  1153.     '隐藏文本框
  1154.     Call Ycwbk
  1155.     If Tree_List.SelectedItem.Children = 0 Then
  1156.         TreeNots_Code = Right(Mid(Trim(Tree_List.SelectedItem.Key), 2, Len(Trim(Tree_List.SelectedItem.Key)) - 1), 2)
  1157.         Call ShowCostInventory
  1158.     Else
  1159.         TreeNots_Code = ""
  1160.         Call ShowCostInventory
  1161.         Lab_Row = ""
  1162.     End If
  1163. End Sub
  1164. Private Sub TextShow(Index As Integer)                                  '文本框得到焦点,显示相应信息
  1165.    '填写文本框得到焦点,进行相应信息处理程序
  1166. End Sub
  1167. Private Sub Lrsjhx()                                                    '文本框录入数据回写
  1168.     With CzxsGrid
  1169.         If YdCombo.Visible Then .Text = Trim(YdCombo.Text)
  1170.         If Ydtext.Visible Then .Text = Trim(Ydtext.Text)
  1171.         
  1172.         '(如果字段录入内容发生变化,则打开有效性判断锁)
  1173.         If Zdlrqnr <> Trim(.Text) Then
  1174.             Yxxpdlock = False
  1175.             Hyxxpdlock = False
  1176.         End If
  1177.         '如果字段录入内容不为空则写数据行有效性标志
  1178.         If Len(Trim(.Text)) <> 0 Then
  1179.             Call Xyxhbz(.Row)
  1180.         End If
  1181.         '隐藏文本框,帮助按钮,列表组合框
  1182.         Call Ycwbk
  1183.     End With
  1184. End Sub
  1185. Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean                  '录入数据行有效性判断,同时进行行处理
  1186.     Dim Lrywlz As Long
  1187.     With CzxsGrid
  1188.     
  1189.         '判断行是否为空和无效数据行清除
  1190.         If Yxxpdh > (.Rows - .FixedRows) Then Exit Function
  1191.         If .TextMatrix(Yxxpdh, 0) <> "*" Then
  1192.             Sjhzyxxpd = True
  1193.             Exit Function
  1194.         Else
  1195.             If pdhwk(Yxxpdh) And Yxxpdh + 1 <= .Rows - 1 Then
  1196.                 If .TextMatrix(Yxxpdh + 1, 0) <> "*" Then
  1197.                     Changelock = True
  1198.                     .RemoveItem Yxxpdh
  1199.                     If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  1200.                         .AddItem ""
  1201.                         .RowHeight(.Rows - 1) = Sjhgd
  1202.                     End If
  1203.                     Changelock = False
  1204.                     Sjhzyxxpd = True
  1205.                     Exit Function
  1206.                 End If
  1207.             End If
  1208.         End If
  1209.         
  1210.         '行没有发生变化则不进行有效性判断
  1211.         If Hyxxpdlock Then
  1212.             Sjhzyxxpd = True
  1213.             Exit Function
  1214.         End If
  1215.   
  1216.         '以下为自定义部分[
  1217.         '1.放置行有效性判断程序
  1218.         '首先进行为空判断(固定不变)
  1219.         For jsqte = Qslz To .Cols - 1
  1220.             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
  1221.                 Tsxx = GridStr(jsqte, 2)
  1222.                 Lrywlz = jsqte
  1223.                 GoTo Lrcwcl
  1224.                 Exit For
  1225.             End If
  1226.         Next jsqte
  1227.     End With
  1228.     Sjhzyxxpd = True
  1229.     Hyxxpdlock = True
  1230.     Exit Function
  1231. Lrcwcl:      '录入错误处理
  1232.     With CzxsGrid
  1233.         Call Xtxxts(Tsxx, 0, 1)
  1234.         Changelock = True
  1235.         .Select Yxxpdh, Lrywlz
  1236.         Changelock = False
  1237.         Call xswbk
  1238.         Sjhzyxxpd = False
  1239.         Exit Function
  1240.     End With
  1241. End Function
  1242. Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long)        '录入数据字段有效性判断,同时进行字段录入事后处理
  1243.     Dim Str_JudgeText As String  '临时有效性判断字段内容
  1244.     Dim Coljsq As Long           '临时列计数器
  1245.     With CzxsGrid
  1246.         '非录入状态有效性为合法
  1247.         If Yxxpdlock Or .Row < .FixedRows Then
  1248.             sjzdyxxpd = True
  1249.             Exit Function
  1250.         End If
  1251.         Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
  1252.     End With
  1253.     
  1254.     Select Case GridStr(Dqpdwgl, 1)
  1255.         '以下为自定义部分[
  1256.         Case "006"         '实际数量
  1257.             If Len(Str_JudgeText) <> 0 Then
  1258.                 If Trim(CzxsGrid.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls))) <> "" Then
  1259.                     CzxsGrid.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) = CStr(Format(Val(CzxsGrid.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls))) * Val(CzxsGrid.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))), "0.00"))
  1260.                 Else
  1261.                     CzxsGrid.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) = ""
  1262.                 End If
  1263.             End If
  1264.     End Select
  1265.     
  1266.     '根据转帐性质,判断按转帐科目号取项目大类还是按来源科目取项目大类
  1267.     '字段录入正确后为零字段清空
  1268.     Call Qkwlzd(Dqpdwgh, Dqpdwgl)
  1269.     sjzdyxxpd = True
  1270.     Yxxpdlock = True
  1271.     Exit Function
  1272. Lrcwcl:    '录入错误处理
  1273.     With CzxsGrid
  1274.         Call Xtxxts(Tsxx, 0, 1)
  1275.         Changelock = True
  1276.         .Select Dqpdwgh, Dqpdwgl
  1277.         If GridBoolean(.Col, 1) = True Then
  1278.             Changelock = False
  1279.             Call xswbk
  1280.             sjzdyxxpd = False
  1281.         End If
  1282.     End With
  1283.     Exit Function
  1284. End Function
  1285. Private Sub xswbk()                                         '在当前选中单元显示文本框,列表框,帮助按钮(通用)
  1286.     Dim Wbkpy As Integer, Wbkpy1 As Integer '文本框偏移量
  1287.     If Lab_OperStatus.Caption = "1" Then
  1288.         Exit Sub
  1289.     End If
  1290.     '显示文本框前返回有效行列(解决滚动条问题)
  1291.     Call Xldqh
  1292.     Call Xldql
  1293.     
  1294.     '隐藏文本框,帮助按钮,列表组合框  ?何用
  1295.     Call Ycwbk
  1296.     
  1297.     With CzxsGrid
  1298.         Dqlrwgh = .Row
  1299.         Dqlrwgl = .Col
  1300.         If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then Exit Sub
  1301.         Wbkpy = 30
  1302.         Wbkpy1 = 15
  1303.         If GridBoolean(.Col, 3) Then        '若是下拉列表录入
  1304.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  1305.             YdCombo.Top = .CellTop + .Top + Wbkpy
  1306.             YdCombo.Width = .CellWidth - Wbkpy1
  1307.             Call Wbkcl                          '主要是在下拉列表框可用之前填充下拉列表框
  1308.             YdCombo.Visible = True
  1309.             YdCombo.SetFocus
  1310.             Ydcommand.Visible = False
  1311.             Ydtext.Visible = False
  1312.         Else
  1313.             If GridBoolean(.Col, 2) Then        '是否提供帮助
  1314.                 Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
  1315.                 Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
  1316.                 Ydcommand.Visible = True
  1317.             Else
  1318.                 Ydcommand.Visible = False
  1319.             End If
  1320.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1321.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1322.             If Ydcommand.Visible Then
  1323.                 If Sfblbzkd Then
  1324.                     Ydtext.Width = .CellWidth - Ydcommand.Width
  1325.                 Else
  1326.                     Ydtext.Width = .CellWidth - Wbkpy1
  1327.                 End If
  1328.             Else
  1329.                 Ydtext.Width = .CellWidth - Wbkpy1
  1330.             End If
  1331.             Ydtext.Height = .CellHeight - Wbkpy1
  1332.             If GridInt(.Col, 2) <> 0 Then
  1333.                 Ydtext.MaxLength = GridInt(.Col, 2)
  1334.             Else
  1335.                 Ydtext.MaxLength = 3000
  1336.             End If
  1337.              ' 主要是Zdlrqnr = Trim(.Text)即将网格单元的内容赋予文本框,并且记录网格编辑之前的内容
  1338.              '为是否对该单元的内容进行字段有效判断加锁Yxxpdlock = False
  1339.             Call Wbkcl
  1340.             Ydtext.Visible = True
  1341.             Ydtext.SetFocus
  1342.         End If
  1343.         Dqtoprow = .TopRow
  1344.         Dqleftcol = .LeftCol
  1345.         
  1346.         '重置锁值
  1347.         Valilock = False
  1348.         Wbkbhlock = False
  1349.     End With
  1350. End Sub
  1351. Private Function Fun_AllowInput() As Boolean                           '当某种条件成立时禁止文本框激活使单据处于录入状态
  1352.    
  1353.     '如果单据操作状态为浏览状态则不能显示录入载体(通用)
  1354.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1355.         Exit Function
  1356.     End If
  1357.    
  1358.     '[>>
  1359.     
  1360.         '此处可以填写禁止文本框激活使单据处于录入状态的理由
  1361.    
  1362.     '<<]
  1363.    
  1364.     Fun_AllowInput = True
  1365.     
  1366. End Function
  1367. Private Sub fhyxh()                                                     '返回录入数据有效行,同时让得到焦点网格可见
  1368.     With CzxsGrid
  1369.         If .Row >= .FixedRows Then
  1370.             If .TextMatrix(.Row, 0) <> "*" Then     '点击网格空区域时执行此语句
  1371.                 For Rowjsq = .FixedRows To .Rows - 1        '为找到最后一数据行的下一行
  1372.                     If .TextMatrix(Rowjsq, 0) <> "*" Then
  1373.                     Exit For
  1374.                     End If
  1375.                 Next Rowjsq
  1376.                 If Rowjsq <= .Rows - 1 Then
  1377.                     Changelock = True
  1378.                     .Select Rowjsq, .Col
  1379.                     Changelock = False
  1380.                 Else
  1381.                     Changelock = True
  1382.                     .Select .Rows - 1, .Col
  1383.                     Changelock = False
  1384.                 End If
  1385.             End If
  1386.             Call Xldqh
  1387.         End If
  1388.     End With
  1389. End Sub
  1390. Private Sub Xldql()                                                     '显露当前列
  1391.     Dim Leftcolte As Long
  1392.     With CzxsGrid
  1393.         If .Col >= Qslz Then
  1394.             If .LeftCol > .Col Then
  1395.                 .LeftCol = .Col
  1396.             End If
  1397.             Leftcolte = 0
  1398.             Do While .CellLeft + .CellWidth > .Width And .LeftCol <> Leftcolte
  1399.                 Leftcolte = .LeftCol
  1400.                 .LeftCol = .LeftCol + 1
  1401.             Loop
  1402.         End If
  1403.     End With
  1404. End Sub
  1405. Private Sub Qkwlzd(sjh As Long, Sjl As Long)                            '清空为零字段
  1406.     If Not GridBoolean(Sjl, 5) Then Exit Sub
  1407.     With CzxsGrid
  1408.         If Val(Trim(.TextMatrix(sjh, Sjl))) = 0 Then .TextMatrix(sjh, Sjl) = ""
  1409.     End With
  1410. End Sub
  1411. Private Sub Xldqh()                                                      '显露当前行
  1412.     Dim Toprowte As Long
  1413.     With CzxsGrid
  1414.         Toprowte = 0
  1415.         Do While .CellTop + .RowHeight(.Row) + Fzxwghs * Sjhgd > .Height And .TopRow <> Toprowte
  1416.             Toprowte = .TopRow
  1417.             .TopRow = .TopRow + 1
  1418.         Loop
  1419.         Toprowte = 0
  1420.         Do While .CellTop < .FixedRows * .RowHeight(0) And .TopRow <> Toprowte
  1421.             Toprowte = .TopRow
  1422.             .TopRow = .TopRow - 1
  1423.         Loop
  1424.     End With
  1425. End Sub
  1426. Private Sub Ycwbk()                                                     '隐藏文本框,帮助按钮,列表组合框
  1427.     Valilock = True
  1428.     Ydtext.Visible = False
  1429.     YdCombo.Visible = False
  1430.     Ydcommand.Visible = False
  1431. End Sub
  1432. Private Sub Wbkcl()                                                     '文本框录入之前处理(根据实际情况)
  1433.     Dim xswbrr As String
  1434.     With CzxsGrid
  1435.         Zdlrqnr = Trim(.Text)
  1436.         xswbrr = Trim(.Text)
  1437.         If GridBoolean(.Col, 3) Then   '列表框录入
  1438.             
  1439.             '填充列表框程序
  1440.             Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
  1441.         Else
  1442.             Wbkbhlock = True
  1443.             
  1444.             '====以下为用户自定义
  1445.             Ydtext.Text = xswbrr
  1446.             '====以上为用户自定义
  1447.             
  1448.             Wbkbhlock = False
  1449.             Ydtext.SelStart = Len(Ydtext.Text)
  1450.         End If
  1451.     End With
  1452. End Sub
  1453. Private Sub Xyxhbz(sjh As Long)                                         '写行有效性标志,并判断是否增行
  1454.     With CzxsGrid
  1455.         If .TextMatrix(sjh, 0) = "*" Then
  1456.             Exit Sub
  1457.         End If
  1458.         .TextMatrix(sjh, 0) = "*"
  1459.         If sjh >= .Rows - Fzxwghs - 1 Then
  1460.             .AddItem ""
  1461.             .RowHeight(.Rows - 1) = Sjhgd
  1462.         End If
  1463.     End With
  1464. End Sub
  1465. Private Function pdhwk(sjh As Long)                                     '判断网格行是否为空行(所有录入字段均为空*非录入字段除外)
  1466.     With CzxsGrid
  1467.         For Coljsq = Qslz To .Cols - 1
  1468.             If Len(Trim(.TextMatrix(sjh, Coljsq))) <> 0 And GridBoolean(Coljsq, 1) Then
  1469.                 pdhwk = False
  1470.                 Exit Function
  1471.             End If
  1472.         Next Coljsq
  1473.         pdhwk = True
  1474.     End With
  1475. End Function
  1476. Private Sub Cxxswbk()                                                  'Formresize中重新显示文本框,列表框,帮助按钮(通用)
  1477.     Dim Wbkpy As Integer, Wbkpy1 As Integer
  1478.     Wbkpy = 30
  1479.     Wbkpy1 = 15
  1480.     With CzxsGrid
  1481.         If Ydcommand.Visible Then
  1482.             Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
  1483.             Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
  1484.         End If
  1485.         If Ydtext.Visible Then
  1486.             If Ydcommand.Visible Then
  1487.                 If Sfblbzkd Then
  1488.                     Ydtext.Width = .CellWidth - Ydcommand.Width
  1489.                 Else
  1490.                     Ydtext.Width = .CellWidth - Wbkpy1
  1491.                 End If
  1492.             Else
  1493.                 Ydtext.Width = .CellWidth - Wbkpy1
  1494.             End If
  1495.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1496.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1497.             Ydtext.Height = .CellHeight - Wbkpy1
  1498.         End If
  1499.     End With
  1500. End Sub
  1501. Private Function Fun_Drfrmyxxpd() As Boolean                           '调入其它窗体或功能产生的有效性判断(包括数据回写)
  1502.     '因为点工具栏的按纽时文本框或网格均没有失去焦点事件发生,为保证该操作之前进行录入数据的有效性判断而设。
  1503.     Fun_Drfrmyxxpd = True
  1504.     With CzxsGrid
  1505.         '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
  1506.         If Ydtext.Visible Or YdCombo.Visible Then
  1507.             Call Lrsjhx
  1508.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1509.                 Fun_Drfrmyxxpd = False
  1510.                 Exit Function
  1511.             End If
  1512.         End If
  1513.         '进行行有效性判断
  1514.         If Not Sjhzyxxpd(.Row) Then
  1515.             Fun_Drfrmyxxpd = False
  1516.             Exit Function
  1517.         End If
  1518.     End With
  1519. End Function
  1520. Private Sub Sub_AbandonBill()                                           '放弃对当前的操作
  1521.     '先关闭录入载体
  1522.     Changelock = True
  1523.     Valilock = True
  1524.     Call Ycwbk
  1525.     Changelock = False
  1526.     Valilock = False
  1527.     '显示数据
  1528.     Call ShowCostInventory
  1529.     '设置操作状态为浏览
  1530.     Lab_OperStatus = "1"
  1531.     Call Sub_OperStatus("11")
  1532. End Sub
  1533. Private Sub ydtext_Change()
  1534.     If Wbkbhlock Then
  1535.          Exit Sub
  1536.     End If
  1537.     With CzxsGrid
  1538.         '限制字段录入长度
  1539.         Wbkbhlock = True
  1540.         
  1541.         Select Case GridInt(.Col, 1)
  1542.             Case 8, 11   '金额型
  1543.                 Call Sjgskz(Ydtext, Xtjezws - Xtjexsws - 1, Xtjexsws)
  1544.             Case 9, 12   '数量型
  1545.                 Call Sjgskz(Ydtext, Xtslzws - Xtslxsws - 1, Xtslxsws)
  1546.             Case 10      '单价型
  1547.                 Call Sjgskz(Ydtext, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  1548.             Case Else    '其他类型
  1549.                 If GridInt(.Col, 3) <> 0 Or GridInt(.Col, 4) <> 0 Then
  1550.                     Call Sjgskz(Ydtext, GridInt(.Col, 3), GridInt(.Col, 4))
  1551.                 End If
  1552.         End Select
  1553.         
  1554.         Wbkbhlock = False
  1555.     End With
  1556. End Sub
  1557. Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer)
  1558.     Dim Rowjsq As Long, Coljsq As Long
  1559.    
  1560.     With CzxsGrid
  1561.         Select Case KeyCode
  1562.             Case vbKeyF2
  1563.                 Call Lrzdbz
  1564.             Case vbKeyEscape                'ESC 键放弃录入
  1565.                 Valilock = True
  1566.                 Call Ycwbk
  1567.                 .SetFocus
  1568.             Case vbKeyReturn                '回 车 键 =13
  1569.                 KeyCode = 0
  1570.                 .SetFocus
  1571.                 Call Lrsjhx
  1572.                 Rowjsq = .Row
  1573.                 Coljsq = .Col + 1
  1574.                 If Coljsq > .Cols - 1 Then
  1575.                     If Rowjsq < .Rows - 1 Then
  1576.                         Rowjsq = Rowjsq + 1
  1577.                     End If
  1578.                     Coljsq = Qslz
  1579.                 End If
  1580.                 Do While Rowjsq <= .Rows - 1
  1581.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1582.                         Coljsq = Coljsq + 1
  1583.                         If Coljsq > .Cols - 1 Then
  1584.                             Rowjsq = Rowjsq + 1
  1585.                             Coljsq = Qslz
  1586.                         End If
  1587.                     Else
  1588.                         Exit Do
  1589.                     End If
  1590.                 Loop
  1591.                 If Rowjsq <= .Rows - 1 Then
  1592.                     .Select Rowjsq, Coljsq
  1593.                 End If
  1594.                 
  1595.             Case vbKeyUp                    '上 箭 头 =38
  1596.                 KeyCode = 0
  1597.                 .SetFocus
  1598.                 Call Lrsjhx
  1599.                 If .Row > .FixedRows Then
  1600.                     .Row = .Row - 1
  1601.                 End If
  1602.                 
  1603.             Case vbKeyDown                  '下 箭 头 =40
  1604.                 KeyCode = 0
  1605.                 .SetFocus
  1606.                 Call Lrsjhx
  1607.                 If .Row < .Rows - 1 Then
  1608.                     .Row = .Row + 1
  1609.                 End If
  1610.             Case vbKeyLeft                  '左 箭 头 =37
  1611.                 If .Col - 1 = Qslz Then
  1612.                     If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1613.                         GoTo jzzx
  1614.                     End If
  1615.                 End If
  1616.                 If Ydtext.SelStart = 0 And .Col > Qslz Then
  1617.                     KeyCode = 0
  1618.                     .SetFocus
  1619.                     Call Lrsjhx
  1620.                     Coljsq = .Col - 1
  1621.                     Do While Coljsq > Qslz
  1622.                         If Coljsq - 1 = Qslz Then
  1623.                             If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1624.                                 GoTo jzzx
  1625.                             End If
  1626.                         End If
  1627.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1628.                             Coljsq = Coljsq - 1
  1629.                         Else
  1630.                             Exit Do
  1631.                         End If
  1632.                     Loop
  1633.                     .Select .Row, Coljsq
  1634.                 End If
  1635. jzzx:
  1636.            
  1637.            
  1638.             Case vbKeyRight                 '右 箭 头 =39
  1639.                 wblong = Len(Ydtext.Text)
  1640.                 If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
  1641.                     KeyCode = 0
  1642.                     .SetFocus
  1643.                     Call Lrsjhx
  1644.                     Rowjsq = .Row
  1645.                     Coljsq = .Col + 1
  1646.                     If Coljsq > .Cols - 1 Then
  1647.                         If Rowjsq < .Rows - 1 Then
  1648.                             Rowjsq = Rowjsq + 1
  1649.                         End If
  1650.                         Coljsq = Qslz
  1651.                     End If
  1652.                     Do While Rowjsq <= .Rows - 1
  1653.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1654.                             Coljsq = Coljsq + 1
  1655.                             If Coljsq > .Cols - 1 Then
  1656.                                 Rowjsq = Rowjsq + 1
  1657.                                 Coljsq = Qslz
  1658.                             End If
  1659.                         Else
  1660.                             Exit Do
  1661.                         End If
  1662.                     Loop
  1663.                     .Select Rowjsq, Coljsq
  1664.                 End If
  1665.             Case Else
  1666.         End Select
  1667.     End With
  1668. End Sub
  1669. Private Sub ydtext_KeyPress(KeyAscii As Integer)
  1670.     Call InputFieldLimit(Ydtext, GridInt(CzxsGrid.Col, 1), KeyAscii)
  1671. End Sub
  1672. Private Sub ydtext_LostFocus()
  1673.     With CzxsGrid
  1674.         If Not Valilock Then
  1675.             Call Lrsjhx
  1676.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1677.                 Exit Sub
  1678.             End If
  1679.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1680.                 Exit Sub
  1681.             End If
  1682.         End If
  1683.     End With
  1684. End Sub
  1685. Private Sub Lrzdbz()                                                      '录入字段帮助
  1686.     If Not Ydcommand.Visible Then
  1687.         Exit Sub
  1688.     End If
  1689.     Valilock = True         '为防止按ydText中帮助按纽时,引起ydText的LostFocus事件。
  1690.     With CzxsGrid
  1691.         '[>>会计科目编码帮助单独处理
  1692.         Select Case .Col
  1693.             Case Sydz("004", GridStr(), Szzls)
  1694.                 Xtcdcs = Trim(Ydtext.Text)
  1695.                 PZ_FrmKjkmcz.Show 1
  1696.                 If Len(Xtfhcs) <> 0 Then
  1697.                     Ydtext.Text = Xtfhcs
  1698.                 End If
  1699.             Case Else
  1700.                 '处理通用部分
  1701.                 Changelock = True        '调入另外窗体必须加锁,为不必执行网格的离开焦点造成的RowColChange事件
  1702.                                         '?没有必要,因为,文本框和命令按纽之间转换焦点,不会执行RowColChange
  1703.                 Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
  1704.                 Changelock = False
  1705.                 If Len(Xtfhcs) <> 0 Then
  1706.                     If GridInt(.Col, 7) = 0 Then
  1707.                         Ydtext.Text = Xtfhcs
  1708.                     Else
  1709.                         Ydtext.Text = Xtfhcsfz
  1710.                     End If
  1711.                 End If
  1712.         End Select
  1713.         '[>>处理完毕
  1714.         Valilock = False
  1715.         If Ydtext.Visible Then
  1716.             Ydtext.SetFocus
  1717.         End If
  1718.     End With
  1719. End Sub
  1720. '------------------自定义部份------------------
  1721. Sub ShowCostInventory()                                                 '显示成本盘存数据
  1722.     '会计日历
  1723.     SqlStr = "Select Count(*) From gy_kjrlb where kjyear='" + Trim(Str(PrivateYear)) + "' And Period='" + CStr(PrivateMm) + "' " _
  1724.                     & "And CwzzJzbz='1'"
  1725.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  1726.     If RecTemp.Fields(0) > 0 Then
  1727.         Call Sub_OperStatus("10")
  1728.         Call Sub_Query(TreeNots_Code, 1)
  1729.     Else
  1730.         Call Sub_OperStatus("11")
  1731.         Call Sub_Query(TreeNots_Code, 0)
  1732.     End If
  1733.     
  1734. End Sub
  1735. Private Sub cshtree()                                                   '初始化项目树
  1736.     Dim mm_matesort As New ADODB.Recordset
  1737.     '*****************************************************
  1738.     SqlStr = "Select * From (Select A.CenterCode,B.CenterName,A.CenterCode AS AC,'1' As code_level From " _
  1739.                         & "(Select Distinct CenterCode From Cb_CostObject Where ObjectCode In " _
  1740.                         & "(Select Distinct Objectcode From Cb_CostStructure Where CheckFlag='1')) A " _
  1741.                         & "Left Outer Join Cb_CostCenter B On A.CenterCode=B.CenterCode " _
  1742.                         & "Union " _
  1743.                         & "Select A.ObjectCode,B.ObjectName,Rtrim(B.CenterCode)+Ltrim(A.ObjectCode),'2'  " _
  1744.                         & "From (Select Distinct Objectcode From Cb_CostStructure Where CheckFlag='1') A " _
  1745.                         & "Left Outer Join Cb_CostObject B On A.ObjectCode=B.ObjectCode) A Order By Ac"
  1746.     
  1747.     Set mm_matesort = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  1748.     '树的形式出现
  1749.     Call fill_tv(Tree_List, mm_matesort, "CenterCode", "CenterName", "AC", True, "数据盘存", "xttb", "gnqx")
  1750. End Sub
  1751. '---------------------------------------------填充TREEVIEW---------------------------
  1752. Public Sub fill_tv(tv As TreeView, flbm As ADODB.Recordset, field1 As String, field2 As String, Field3 As String, bmjc_bz As Boolean, tree_name As String, Treeprant As String, Treechr As String)
  1753.     Dim fllb, lsbl(), lsbl1(), remlayer, nodX, tem, count
  1754.     On Error GoTo ERRORCL
  1755.     tv.Nodes.Clear
  1756.     flbm.Requery
  1757.     If flbm.EOF Then
  1758.         Set nodX = tv.Nodes.Add(, 4, "r", tree_name, Treeprant)
  1759.         Exit Sub
  1760.     Else
  1761.         Set nodX = tv.Nodes.Add(, 4, "r", tree_name, Treeprant)
  1762.     End If
  1763.     flbm.MoveFirst
  1764.     count = 1
  1765.     If bmjc_bz Then
  1766.         Do While Not flbm.EOF
  1767.             fllb = "(" + Trim(flbm.Fields(field1)) + ")" + Trim(flbm.Fields(field2))
  1768.             remlayer = flbm.Fields("code_level")
  1769.             tem = Trim(flbm.Fields(Field3))
  1770.             Select Case remlayer
  1771.                 Case 1
  1772.                     ReDim Preserve lsbl(remlayer)
  1773.                     ReDim Preserve lsbl1(remlayer)
  1774.                     lsbl(remlayer) = "p" & tem
  1775.                     Set nodX = tv.Nodes.Add("r", 4, lsbl(remlayer), fllb, Treechr)
  1776.                     tv.Nodes(count).Expanded = True
  1777.                 Case 2
  1778.                     ReDim Preserve lsbl1(remlayer)
  1779.                     ReDim Preserve lsbl1(remlayer)
  1780.                     lsbl1(remlayer) = "p" & tem
  1781.                     Set nodX = tv.Nodes.Add(lsbl(remlayer - 1), tvwChild, lsbl1(remlayer), fllb, Treechr)
  1782.                 Case 3
  1783.                     ReDim Preserve lsbl(remlayer)
  1784.                     ReDim Preserve lsbl1(remlayer)
  1785.                     lsbl(remlayer) = lsbl1(remlayer - 1)
  1786.                     lsbl1(remlayer) = "p" & tem
  1787.                     Set nodX = tv.Nodes.Add(lsbl(remlayer), tvwChild, lsbl1(remlayer), fllb, Treechr)
  1788.                 Case Else
  1789.                     ReDim Preserve lsbl(remlayer)
  1790.                     ReDim Preserve lsbl1(remlayer)
  1791.                     lsbl(remlayer) = lsbl1(remlayer - 1)
  1792.                     lsbl1(remlayer) = "p" & tem
  1793.                     Set nodX = tv.Nodes.Add(lsbl(remlayer), tvwChild, lsbl1(remlayer), fllb, Treechr)
  1794.             End Select
  1795.             count = count + 1
  1796.             flbm.MoveNext
  1797.         Loop
  1798.     Else
  1799.         Do While Not flbm.EOF
  1800.             fllb = "(" + Trim(flbm.Fields(field1)) + ")" + Trim(flbm.Fields(field2))
  1801.             tem = Trim(flbm.Fields("flbm"))
  1802.             lsbl(remlayer) = "p" & tem
  1803.             Set nodX = tv.Nodes.Add(, 4, lsbl(remlayer), fllb)
  1804.             flbm.MoveNext
  1805.         Loop
  1806.     End If
  1807.     Exit Sub
  1808. ERRORCL:
  1809.     MsgBox "程序出现错误", vbExclamation, Title_Bar
  1810.     Exit Sub
  1811. End Sub