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

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{65A39231-6133-11D1-BAA2-444553540000}#1.0#0"; "vslight6.OCX"
  3. Object = "{D76D7128-4A96-11D3-BD95-D296DC2DD072}#1.0#0"; "VSOCX7.OCX"
  4. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  5. Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
  6. Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
  7. Begin VB.Form Tr_Weigh 
  8.    BorderStyle     =   1  'Fixed Single
  9.    Caption         =   "检斤单"
  10.    ClientHeight    =   7110
  11.    ClientLeft      =   45
  12.    ClientTop       =   330
  13.    ClientWidth     =   9360
  14.    Icon            =   "铁运管理_检斤单.frx":0000
  15.    KeyPreview      =   -1  'True
  16.    LinkTopic       =   "Form2"
  17.    MaxButton       =   0   'False
  18.    MinButton       =   0   'False
  19.    ScaleHeight     =   7110
  20.    ScaleWidth      =   9360
  21.    StartUpPosition =   1  '所有者中心
  22.    Begin TabDlg.SSTab StTab 
  23.       Height          =   6435
  24.       Left            =   30
  25.       TabIndex        =   6
  26.       Top             =   660
  27.       Width           =   9330
  28.       _ExtentX        =   16457
  29.       _ExtentY        =   11351
  30.       _Version        =   393216
  31.       Style           =   1
  32.       Tabs            =   2
  33.       TabHeight       =   520
  34.       TabCaption(0)   =   "列表视图"
  35.       TabPicture(0)   =   "铁运管理_检斤单.frx":1042
  36.       Tab(0).ControlEnabled=   -1  'True
  37.       Tab(0).Control(0)=   "CzxsGrid"
  38.       Tab(0).Control(0).Enabled=   0   'False
  39.       Tab(0).ControlCount=   1
  40.       TabCaption(1)   =   "单张视图"
  41.       TabPicture(1)   =   "铁运管理_检斤单.frx":105E
  42.       Tab(1).ControlEnabled=   0   'False
  43.       Tab(1).Control(0)=   "Frame1"
  44.       Tab(1).Control(0).Enabled=   0   'False
  45.       Tab(1).ControlCount=   1
  46.       Begin VB.Frame Frame1 
  47.          Height          =   6015
  48.          Left            =   -74910
  49.          TabIndex        =   7
  50.          Top             =   330
  51.          Width           =   9135
  52.          Begin VB.TextBox LrText 
  53.             Height          =   300
  54.             Index           =   2
  55.             Left            =   1755
  56.             TabIndex        =   4
  57.             Text            =   "2"
  58.             Top             =   2070
  59.             Width           =   1620
  60.          End
  61.          Begin VB.TextBox LrText 
  62.             Height          =   300
  63.             Index           =   0
  64.             Left            =   1755
  65.             TabIndex        =   0
  66.             Text            =   "0"
  67.             Top             =   360
  68.             Width           =   1618
  69.          End
  70.          Begin VB.TextBox LrText 
  71.             Height          =   300
  72.             Index           =   1
  73.             Left            =   1755
  74.             TabIndex        =   3
  75.             Text            =   "1"
  76.             Top             =   1641
  77.             Width           =   1620
  78.          End
  79.          Begin VB.CommandButton QxCommand 
  80.             Cancel          =   -1  'True
  81.             Caption         =   "取消(&C)"
  82.             Height          =   300
  83.             Left            =   2010
  84.             TabIndex        =   9
  85.             Top             =   2820
  86.             Width           =   1120
  87.          End
  88.          Begin VB.CommandButton BcCommand 
  89.             Caption         =   "保存(&S)"
  90.             Height          =   300
  91.             Left            =   780
  92.             TabIndex        =   5
  93.             Top             =   2820
  94.             Width           =   1120
  95.          End
  96.          Begin VB.CommandButton Ydcommand1 
  97.             Height          =   300
  98.             Index           =   0
  99.             Left            =   3720
  100.             Picture         =   "铁运管理_检斤单.frx":107A
  101.             Style           =   1  'Graphical
  102.             TabIndex        =   8
  103.             Top             =   3270
  104.             Visible         =   0   'False
  105.             Width           =   300
  106.          End
  107.          Begin MSMask.MaskEdBox JiText 
  108.             Height          =   300
  109.             Index           =   1
  110.             Left            =   1755
  111.             TabIndex        =   2
  112.             Top             =   1215
  113.             Width           =   1620
  114.             _ExtentX        =   2858
  115.             _ExtentY        =   529
  116.             _Version        =   393216
  117.             MaxLength       =   16
  118.             Mask            =   "####-##-## ##:##"
  119.             PromptChar      =   "_"
  120.          End
  121.          Begin MSMask.MaskEdBox JiText 
  122.             Height          =   300
  123.             Index           =   0
  124.             Left            =   1755
  125.             TabIndex        =   1
  126.             Top             =   787
  127.             Width           =   1620
  128.             _ExtentX        =   2858
  129.             _ExtentY        =   529
  130.             _Version        =   393216
  131.             MaxLength       =   16
  132.             Mask            =   "####-##-## ##:##"
  133.             PromptChar      =   "_"
  134.          End
  135.          Begin VB.Label TsLabel 
  136.             AutoSize        =   -1  'True
  137.             Caption         =   "检斤重量:"
  138.             Height          =   180
  139.             Index           =   4
  140.             Left            =   420
  141.             TabIndex        =   17
  142.             Top             =   2130
  143.             Width           =   810
  144.          End
  145.          Begin VB.Label TsLabel 
  146.             AutoSize        =   -1  'True
  147.             Caption         =   "车号:"
  148.             Height          =   180
  149.             Index           =   0
  150.             Left            =   420
  151.             TabIndex        =   13
  152.             Top             =   420
  153.             Width           =   450
  154.          End
  155.          Begin VB.Label TsLabel 
  156.             AutoSize        =   -1  'True
  157.             Caption         =   "检斤负责人:"
  158.             Height          =   180
  159.             Index           =   1
  160.             Left            =   420
  161.             TabIndex        =   12
  162.             Top             =   1701
  163.             Width           =   990
  164.          End
  165.          Begin VB.Label TsLabel 
  166.             AutoSize        =   -1  'True
  167.             Caption         =   "要求检斤时间:"
  168.             Height          =   180
  169.             Index           =   2
  170.             Left            =   420
  171.             TabIndex        =   11
  172.             Top             =   840
  173.             Width           =   1170
  174.          End
  175.          Begin VB.Label TsLabel 
  176.             AutoSize        =   -1  'True
  177.             Caption         =   "检斤完毕时间:"
  178.             Height          =   180
  179.             Index           =   3
  180.             Left            =   420
  181.             TabIndex        =   10
  182.             Top             =   1274
  183.             Width           =   1170
  184.          End
  185.       End
  186.       Begin VSFlex8Ctl.VSFlexGrid CzxsGrid 
  187.          Height          =   5955
  188.          Left            =   90
  189.          TabIndex        =   14
  190.          Top             =   390
  191.          Width           =   9135
  192.          _ExtentX        =   16113
  193.          _ExtentY        =   10504
  194.          Appearance      =   1
  195.          BorderStyle     =   1
  196.          Enabled         =   -1  'True
  197.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  198.             Name            =   "宋体"
  199.             Size            =   9
  200.             Charset         =   134
  201.             Weight          =   400
  202.             Underline       =   0   'False
  203.             Italic          =   0   'False
  204.             Strikethrough   =   0   'False
  205.          EndProperty
  206.          MousePointer    =   0
  207.          BackColor       =   -2147483643
  208.          ForeColor       =   -2147483640
  209.          BackColorFixed  =   -2147483633
  210.          ForeColorFixed  =   -2147483630
  211.          BackColorSel    =   -2147483635
  212.          ForeColorSel    =   -2147483634
  213.          BackColorBkg    =   8421504
  214.          BackColorAlternate=   -2147483643
  215.          GridColor       =   -2147483633
  216.          GridColorFixed  =   -2147483632
  217.          TreeColor       =   -2147483632
  218.          FloodColor      =   192
  219.          SheetBorder     =   -2147483642
  220.          FocusRect       =   1
  221.          HighLight       =   1
  222.          AllowSelection  =   -1  'True
  223.          AllowBigSelection=   -1  'True
  224.          AllowUserResizing=   0
  225.          SelectionMode   =   0
  226.          GridLines       =   1
  227.          GridLinesFixed  =   2
  228.          GridLineWidth   =   1
  229.          Rows            =   5000
  230.          Cols            =   10
  231.          FixedRows       =   1
  232.          FixedCols       =   0
  233.          RowHeightMin    =   0
  234.          RowHeightMax    =   0
  235.          ColWidthMin     =   0
  236.          ColWidthMax     =   0
  237.          ExtendLastCol   =   0   'False
  238.          FormatString    =   ""
  239.          ScrollTrack     =   0   'False
  240.          ScrollBars      =   3
  241.          ScrollTips      =   0   'False
  242.          MergeCells      =   0
  243.          MergeCompare    =   0
  244.          AutoResize      =   -1  'True
  245.          AutoSizeMode    =   0
  246.          AutoSearch      =   0
  247.          MultiTotals     =   -1  'True
  248.          SubtotalPosition=   1
  249.          OutlineBar      =   0
  250.          OutlineCol      =   0
  251.          Ellipsis        =   0
  252.          ExplorerBar     =   0
  253.          PicturesOver    =   0   'False
  254.          FillStyle       =   0
  255.          RightToLeft     =   0   'False
  256.          PictureType     =   0
  257.          TabBehavior     =   0
  258.          OwnerDraw       =   0
  259.          Editable        =   0   'False
  260.          ShowComboButton =   -1  'True
  261.          WordWrap        =   0   'False
  262.          TextStyle       =   0
  263.          TextStyleFixed  =   0
  264.          OleDragMode     =   0
  265.          OleDropMode     =   0
  266.          DataMode        =   0
  267.          VirtualData     =   -1  'True
  268.       End
  269.    End
  270.    Begin MSComctlLib.Toolbar SzToolbar 
  271.       Align           =   1  'Align Top
  272.       Height          =   570
  273.       Left            =   0
  274.       TabIndex        =   15
  275.       Top             =   0
  276.       Width           =   9360
  277.       _ExtentX        =   16510
  278.       _ExtentY        =   1005
  279.       ButtonWidth     =   820
  280.       ButtonHeight    =   953
  281.       AllowCustomize  =   0   'False
  282.       Appearance      =   1
  283.       Style           =   1
  284.       ImageList       =   "ImageList1"
  285.       _Version        =   393216
  286.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  287.          NumButtons      =   12
  288.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  289.             Caption         =   "设置"
  290.             Key             =   "ymsz"
  291.             ImageKey        =   "sz"
  292.          EndProperty
  293.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  294.             Caption         =   "打印"
  295.             Key             =   "dy"
  296.             Object.ToolTipText     =   "点击或按Ctrl+P打印表格"
  297.             ImageKey        =   "dy"
  298.          EndProperty
  299.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  300.             Caption         =   "预览"
  301.             Key             =   "yl"
  302.             ImageKey        =   "yl"
  303.          EndProperty
  304.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  305.             Style           =   3
  306.          EndProperty
  307.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  308.             Caption         =   "增加"
  309.             Key             =   "zj"
  310.             Object.ToolTipText     =   "点击或按Ctrl+A增加记录"
  311.             ImageKey        =   "xz"
  312.          EndProperty
  313.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  314.             Caption         =   "修改"
  315.             Key             =   "xg"
  316.             ImageKey        =   "xg"
  317.          EndProperty
  318.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  319.             Caption         =   "删除"
  320.             Key             =   "sc"
  321.             Object.ToolTipText     =   "点击或按Ctrl+D删除当前记录"
  322.             ImageKey        =   "sc"
  323.          EndProperty
  324.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  325.             Style           =   3
  326.          EndProperty
  327.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  328.             Caption         =   "刷新"
  329.             Key             =   "sx"
  330.             ImageKey        =   "sx"
  331.          EndProperty
  332.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  333.             Style           =   3
  334.          EndProperty
  335.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  336.             Caption         =   "帮助"
  337.             Key             =   "bz"
  338.             ImageKey        =   "bz"
  339.          EndProperty
  340.          BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  341.             Caption         =   "退出"
  342.             Key             =   "fh"
  343.             ImageKey        =   "tc"
  344.          EndProperty
  345.       EndProperty
  346.       BorderStyle     =   1
  347.       Begin MSComctlLib.Toolbar GsToolbar 
  348.          Height          =   540
  349.          Left            =   6870
  350.          TabIndex        =   16
  351.          Top             =   0
  352.          Width           =   2475
  353.          _ExtentX        =   4366
  354.          _ExtentY        =   953
  355.          ButtonWidth     =   1455
  356.          ButtonHeight    =   953
  357.          AllowCustomize  =   0   'False
  358.          Appearance      =   1
  359.          Style           =   1
  360.          ImageList       =   "ImageList1"
  361.          _Version        =   393216
  362.          BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  363.             NumButtons      =   3
  364.             BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  365.                Caption         =   "保存格式"
  366.                Key             =   "bcgs"
  367.                ImageKey        =   "bcgs"
  368.             EndProperty
  369.             BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  370.                Caption         =   "默认列宽"
  371.                Key             =   "hfmrgs"
  372.                ImageKey        =   "mrlk"
  373.             EndProperty
  374.             BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  375.                Caption         =   "显示项目"
  376.                Key             =   "szxsxm"
  377.                ImageKey        =   "xsxm"
  378.             EndProperty
  379.          EndProperty
  380.       End
  381.    End
  382.    Begin MSComctlLib.ImageList ImageList1 
  383.       Left            =   0
  384.       Top             =   420
  385.       _ExtentX        =   1005
  386.       _ExtentY        =   1005
  387.       BackColor       =   -2147483643
  388.       ImageWidth      =   16
  389.       ImageHeight     =   16
  390.       MaskColor       =   12632256
  391.       _Version        =   393216
  392.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  393.          NumListImages   =   29
  394.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  395.             Picture         =   "铁运管理_检斤单.frx":1404
  396.             Key             =   "sz"
  397.          EndProperty
  398.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  399.             Picture         =   "铁运管理_检斤单.frx":179E
  400.             Key             =   "dy"
  401.          EndProperty
  402.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  403.             Picture         =   "铁运管理_检斤单.frx":1B38
  404.             Key             =   "yl"
  405.          EndProperty
  406.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  407.             Picture         =   "铁运管理_检斤单.frx":1ED2
  408.             Key             =   "xg"
  409.          EndProperty
  410.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  411.             Picture         =   "铁运管理_检斤单.frx":226C
  412.             Key             =   "zh"
  413.          EndProperty
  414.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  415.             Picture         =   "铁运管理_检斤单.frx":2606
  416.             Key             =   "sh"
  417.          EndProperty
  418.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  419.             Picture         =   "铁运管理_检斤单.frx":29A0
  420.             Key             =   "bc"
  421.          EndProperty
  422.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  423.             Picture         =   "铁运管理_检斤单.frx":2D3A
  424.             Key             =   "fq"
  425.          EndProperty
  426.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  427.             Picture         =   "铁运管理_检斤单.frx":30D4
  428.             Key             =   "bz"
  429.          EndProperty
  430.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  431.             Picture         =   "铁运管理_检斤单.frx":346E
  432.             Key             =   "tc"
  433.          EndProperty
  434.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  435.             Picture         =   "铁运管理_检斤单.frx":3808
  436.             Key             =   "bcgs"
  437.          EndProperty
  438.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  439.             Picture         =   "铁运管理_检斤单.frx":3BA2
  440.             Key             =   "mrlk"
  441.          EndProperty
  442.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  443.             Picture         =   "铁运管理_检斤单.frx":3F3C
  444.             Key             =   "xsxm"
  445.          EndProperty
  446.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  447.             Picture         =   "铁运管理_检斤单.frx":42D6
  448.             Key             =   "first"
  449.          EndProperty
  450.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  451.             Picture         =   "铁运管理_检斤单.frx":4670
  452.             Key             =   "prev"
  453.          EndProperty
  454.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  455.             Picture         =   "铁运管理_检斤单.frx":4A0A
  456.             Key             =   "next"
  457.          EndProperty
  458.          BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  459.             Picture         =   "铁运管理_检斤单.frx":4DA4
  460.             Key             =   "last"
  461.          EndProperty
  462.          BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  463.             Picture         =   "铁运管理_检斤单.frx":513E
  464.             Key             =   "xx"
  465.          EndProperty
  466.          BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  467.             Picture         =   "铁运管理_检斤单.frx":54D8
  468.             Key             =   "define"
  469.          EndProperty
  470.          BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  471.             Picture         =   "铁运管理_检斤单.frx":5872
  472.             Key             =   "exec"
  473.          EndProperty
  474.          BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  475.             Picture         =   "铁运管理_检斤单.frx":5C0C
  476.             Key             =   "xz"
  477.          EndProperty
  478.          BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  479.             Picture         =   "铁运管理_检斤单.frx":5FA6
  480.             Key             =   "sc"
  481.          EndProperty
  482.          BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  483.             Picture         =   "铁运管理_检斤单.frx":6340
  484.             Key             =   "sx"
  485.          EndProperty
  486.          BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  487.             Picture         =   "铁运管理_检斤单.frx":66DA
  488.             Key             =   "cx"
  489.          EndProperty
  490.          BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  491.             Picture         =   "铁运管理_检斤单.frx":6A74
  492.             Key             =   "zd"
  493.          EndProperty
  494.          BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  495.             Picture         =   "铁运管理_检斤单.frx":6E0E
  496.             Key             =   "dz"
  497.          EndProperty
  498.          BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  499.             Picture         =   "铁运管理_检斤单.frx":71A8
  500.             Key             =   "ph"
  501.          EndProperty
  502.          BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  503.             Picture         =   "铁运管理_检斤单.frx":7542
  504.             Key             =   "fz"
  505.          EndProperty
  506.          BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  507.             Picture         =   "铁运管理_检斤单.frx":78DC
  508.             Key             =   "dw"
  509.          EndProperty
  510.       EndProperty
  511.    End
  512. End
  513. Attribute VB_Name = "Tr_Weigh"
  514. Attribute VB_GlobalNameSpace = False
  515. Attribute VB_Creatable = False
  516. Attribute VB_PredeclaredId = True
  517. Attribute VB_Exposed = False
  518. '*******************************************************
  519. '*    模 块 名 称 :检斤单设置
  520. '*    功 能 描 述 :设置车辆称重单据
  521. '*    程序员姓名  :孙宝龙
  522. '*    最后修改人  :孙宝龙
  523. '*    最后修改时间:2001/12/06
  524. '*    备        注:封版
  525. '*******************************************************
  526. Dim Rec_CodeSet As New ADODB.Recordset   '编码设置表
  527. Dim jdzygs As Integer                    '控件焦点转移个数
  528. Dim Lrzt As Integer                      '录入状态标志(0-非录入状态 1-增加 2-修改)
  529. Dim ReportTitle As String                '报表主标题
  530. Dim Str_RightEdit As String              '编辑(新增、修改、删除)权限索引
  531. '自定义
  532. Public dbl_RecordAutoCode As Double
  533. '以下为固定使用变量(网格)
  534. Dim Cxnrrec As New ADODB.Recordset       '显示查询内容动态集
  535. Dim Dyymctbl As New DY_Dyymsz            '打印页面窗体变量
  536. Dim GridCode As String                   '显示网格网格代码
  537. Dim GridInf() As Variant                 '整个网格设置信息
  538. Dim Tsxx As String                       '系统提示信息
  539. Dim Qslz As Long                         '网格隐藏(非操作显示)列数
  540. Dim Sjhgd As Double                      '网格数据行高度
  541. Dim GridBoolean() As Boolean             '网格列信息(布尔型)
  542. Dim GridStr()  As String                 '网格列信息(字符型)
  543. Dim GridInt() As Integer                 '网格列信息(整型)
  544. Dim szzls As Integer                     '数组总列数(网格列数-1)
  545. '以下为固定使用变量(文本框)
  546. Dim Textvar() As Variant                 '存储变体型文本框信息
  547. Dim Textboolean() As Boolean             '存储布尔型文本框信息
  548. Dim Textint() As Integer                 '存储整型文本框信息
  549. Dim Textstr() As String                  '存储字符型文本框信息
  550. Dim Max_Text_Index As Integer            '最大录入文本框索引值
  551. Dim TextGroupCode As String              '文本框录入分组编码
  552. Dim TextValiLock As Boolean              '文本框失去焦点是否进行有效性控制判断
  553. Dim TextValiJudgeLock() As Boolean       '文本框录入有效性判断控制锁
  554. Dim CurTextIndex As Integer              '当前文本框索引值
  555. Dim TextChangeLock As Boolean            '文本框内容变换控制锁
  556. Dim Bln_Cancel As Boolean                '取消按钮信息传递
  557. Private Sub Form_KeyPress(KeyAscii As Integer)   '控 制 焦 点 转 移
  558.     jdzygs = 6
  559.     
  560.     Select Case KeyAscii
  561.         Case vbKeyReturn
  562.             If Kjjdzy(jdzygs) Then
  563.                 KeyAscii = 0
  564.             End If
  565.         Case 39           '屏蔽"'"
  566.             KeyAscii = 0
  567.    End Select
  568.    
  569. End Sub
  570. Private Sub Form_Load()
  571.   
  572.     '打印报表标题信息
  573.     ReportTitle = "检 斤 单"
  574.     Xtrq = Format(Xtrq, "yyyy-mm-dd hh:mm")
  575.     '调入打印页面设置窗体
  576.     XtReportCode = "Tr_Weigh"
  577.     Load Dyymctbl
  578.     
  579.     '以下为文本框处理程序(读入文本框录入信息)
  580.     TextGroupCode = "Tr_Weigh"
  581.     Call Drwbkxx(TextGroupCode, Textvar(), Textboolean(), Textint(), Textstr())
  582.     Call Wbkcsh
  583.     
  584.     '调入网格设置信息
  585.     GridCode = "Tr_Weigh"
  586.     Call BzWgcsh(CzxsGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  587.     Qslz = GridInf(1)
  588.     Sjhgd = GridInf(2)
  589.     szzls = CzxsGrid.Cols - 1
  590.     
  591.     '填 充 网 格
  592.     Call Cxnrtcwg
  593.        
  594.     '初始化toolbar,tab卡状态
  595.     StTab.Tab = 0
  596.     StTab.TabEnabled(1) = False
  597.     Frame1.Enabled = False
  598.      
  599.     '设置为非录入状态
  600.     Lrzt = 0
  601.      
  602. End Sub
  603.  
  604. Private Sub Cxnrtcwg()                               '查询内容填充网格
  605.     Dim Sqlstr As String              '查询连接串
  606.     Dim jsqte As Long                '查询临时使用变量
  607.   
  608.     '为加快显示速度,将网格刷新动作冻结
  609.     CzxsGrid.Redraw = False
  610.   
  611.     '[>>查询连接串
  612.    Sqlstr = "SELECT Tr_Weigh.*,Tr_NowAccount.VoucherId as VoucherId FROM Tr_Weigh left outer join Tr_NowAccount on Tr_Weigh.WeighId=Tr_NowAccount.ChildId where Tr_NowAccount.VoucherNum=1 order by Tr_Weigh.WeighTime"
  613.     '<<]
  614.     Set Cxnrrec = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  615.     
  616.     With Cxnrrec
  617.         CzxsGrid.Rows = CzxsGrid.FixedRows
  618.         If .EOF And .BOF Then
  619.             CzxsGrid.Redraw = True
  620.             Exit Sub
  621.         End If
  622.         
  623.         jsqte = CzxsGrid.FixedRows
  624.         
  625.         Do While Not .EOF
  626.             CzxsGrid.AddItem ""
  627.             Call Jltcwg(Cxnrrec, jsqte)                              '调入填充网格子过程
  628.             CzxsGrid.RowHeight(jsqte) = Sjhgd                        '设置网格高度
  629.             .MoveNext
  630.             jsqte = jsqte + 1
  631.         Loop
  632.     End With
  633.   
  634.     '将网格刷新动作解冻
  635.     CzxsGrid.Redraw = True
  636.     
  637. End Sub
  638. Private Sub Jltcwg(Jlbrec As ADODB.Recordset, Rowjsq As Long)           '记录内容填充网格
  639.     '[>>以下为自定义部分
  640.     With Jlbrec
  641.         CzxsGrid.TextMatrix(Rowjsq, 0) = .Fields("WeighId")
  642.         CzxsGrid.TextMatrix(Rowjsq, 1) = .Fields("VoucherId")
  643.         CzxsGrid.TextMatrix(Rowjsq, Sydz("001", GridStr(), szzls)) = Trim(.Fields("VehicleNum") & "")    '车号
  644.         If Not IsNull(.Fields("WeighTime")) Then
  645.               CzxsGrid.TextMatrix(Rowjsq, Sydz("002", GridStr(), szzls)) = Format(Trim(.Fields("WeighTime")), "yyyy-mm-dd hh:mm") '要求检斤时间
  646.         Else
  647.               CzxsGrid.TextMatrix(Rowjsq, Sydz("002", GridStr(), szzls)) = ""
  648.         End If
  649.         If Not IsNull(.Fields("WeighEndTime")) Then
  650.               CzxsGrid.TextMatrix(Rowjsq, Sydz("003", GridStr(), szzls)) = Format(Trim(.Fields("WeighEndTime")), "yyyy-mm-dd hh:mm") '检斤完毕时间
  651.         Else
  652.               CzxsGrid.TextMatrix(Rowjsq, Sydz("003", GridStr(), szzls)) = ""
  653.         End If
  654.         If Not IsNull(.Fields("WeighMan")) Then
  655.               CzxsGrid.TextMatrix(Rowjsq, Sydz("004", GridStr(), szzls)) = Trim(.Fields("WeighMan") & "")   '检斤负责人
  656.         Else
  657.               CzxsGrid.TextMatrix(Rowjsq, Sydz("004", GridStr(), szzls)) = ""
  658.         End If
  659.         If Trim(.Fields("Result")) = True Then                                                             '检斤状态
  660.               CzxsGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), szzls)) = "已检斤"
  661.         Else
  662.               CzxsGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), szzls)) = "未检斤"
  663.         End If
  664.         If Trim(.Fields("Quantity")) <> 0 Then
  665.               CzxsGrid.TextMatrix(Rowjsq, Sydz("006", GridStr(), szzls)) = Trim(.Fields("Quantity") & "")   '吨位
  666.         Else
  667.               CzxsGrid.TextMatrix(Rowjsq, Sydz("006", GridStr(), szzls)) = ""
  668.         End If
  669.     
  670.     End With
  671.     '以上为自定义部分<<]
  672.     
  673. End Sub
  674. Private Sub Form_Unload(Cancel As Integer)             '窗体卸载
  675.     dbl_RecordAutoCode = 0
  676.     Set Cxnrrec = Nothing
  677.     Set Rec_CodeSet = Nothing
  678.     Unload Dyymctbl
  679.    
  680. End Sub
  681. Private Function Bclrsj() As Boolean                   '判断录入数据有效性,并保存数据
  682.     Dim jsqte As Integer
  683.     Dim Findrc As New ADODB.Recordset
  684.   
  685.     '对文本框录入内容进行为零和为空判断(固定不变)
  686.     With Rec_CodeSet
  687.     
  688.         For jsqte = 0 To Max_Text_Index
  689.             If Textint(jsqte, 8) = 1 Then     '字段不能为空
  690.                 If Len(Trim(LrText(jsqte).Text)) = 0 Then
  691.                     Tsxx = Textstr(jsqte, 7) & "不能为空!"
  692.                     Call Xtxxts(Tsxx, 0, 1)
  693.                     LrText(jsqte).SetFocus
  694.                     Bclrsj = False
  695.                     Exit Function
  696.                 End If
  697.             Else
  698.                 If Textint(jsqte, 8) = 2 Then   '字段不能为零
  699.                     If Val(Trim(LrText(jsqte).Text)) = 0 Then
  700.                         Tsxx = Textstr(jsqte, 7) & "不能为零!"
  701.                         Call Xtxxts(Tsxx, 0, 1)
  702.                         LrText(jsqte).SetFocus
  703.                         Bclrsj = False
  704.                         Exit Function
  705.                     End If
  706.                 End If
  707.             End If
  708.         Next jsqte
  709.          '<<自定义
  710.         '判断要求检斤时间的年度是否与当前会计年度相符
  711.         If Trim(JiText(0).Text <> "____-__-__ __:__") Then
  712.         If IsDate(JiText(0).Text) Then
  713.             JiText(0).Text = Format(JiText(0).Text, "yyyy-mm-dd hh:mm")
  714.             If Val(Trim(JiText(0).Text)) <> Val(Year(Xtrq)) Then
  715.                 Tsxx = "年度与当前会计年度不符,请重新输入"
  716.                 Call Xtxxts(Tsxx, 0, 4)
  717.                 JiText(0).SetFocus
  718.                 Exit Function
  719.             End If
  720.         Else
  721.             Tsxx = "非法公历时间!(格式:" + Format(Date, "yyyy-mm-dd hh:mm") + ")"
  722.             Call Xtxxts(Tsxx, 0, 1)
  723.             JiText(0).SetFocus
  724.             Exit Function
  725.         End If
  726.     End If
  727.     
  728.     '要求检斤时间不能为空
  729.     If Trim(JiText(0).Text) = "____-__-__ __:__" Then
  730.         Tsxx = "要求检斤时间不能为空!"
  731.         Call Xtxxts(Tsxx, 0, 1)
  732.         JiText(0).SetFocus
  733.         Bclrsj = False
  734.         Exit Function
  735.     End If
  736.     '判断检斤完毕时间的年度是否与当前会计年度相符
  737.     If Trim(JiText(1).Text <> "____-__-__ __:__") Then
  738.         If IsDate(JiText(1).Text) Then
  739.             JiText(1).Text = Format(JiText(1).Text, "yyyy-mm-dd hh:mm")
  740.             If Val(Trim(JiText(1).Text)) <> Val(Year(Xtrq)) Then
  741.                 Tsxx = "年度与当前会计年度不符,请重新输入"
  742.                 Call Xtxxts(Tsxx, 0, 4)
  743.                 JiText(1).SetFocus
  744.                 Exit Function
  745.             End If
  746.         Else
  747.             Tsxx = "非法公历时间!(格式:" + Format(Date, "yyyy-mm-dd hh:mm") + ")"
  748.             Call Xtxxts(Tsxx, 0, 1)
  749.             JiText(1).SetFocus
  750.             Exit Function
  751.         End If
  752.     End If
  753.     '要求检斤时间不能大于检斤完毕时间
  754.     If Trim(JiText(0).Text) <> "____-__-__ __:__" And Trim(JiText(1).Text) <> "____-__-__ __:__" Then
  755.         If CDate(JiText(0).Text) > CDate(JiText(1).Text) Then
  756.             Tsxx = "要求检斤时间不能大于检斤完毕时间!"
  757.             Call Xtxxts(Tsxx, 0, 1)
  758.             Bclrsj = False
  759.             JiText(1).SetFocus
  760.             Exit Function
  761.         End If
  762.     End If
  763.     If Not JiTextptpd Then
  764.         Exit Function
  765.     End If
  766.     
  767.     '>>
  768.     
  769.         '对需要进行事后判断的文本框录入内容进行有效性判断 (固定不变)
  770.         For jsqte = 0 To Max_Text_Index
  771.             If Textint(jsqte, 9) = 0 Or Textint(jsqte, 9) = 2 Then
  772.                 If Not TextYxxpd(jsqte) Then
  773.                     Exit Function
  774.                 End If
  775.             End If
  776.         Next jsqte
  777.         
  778.    
  779.         If Lrzt = 1 Then  '增 加
  780.         
  781.             If .State = 1 Then .Close
  782.             .Open "SELECT * FROM Tr_Weigh where 1=2 ", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  783.             '判断记录内容无误后,将记录内容写入数据表
  784.             On Error GoTo Swcwcl
  785.     
  786.             Cw_DataEnvi.DataConnect.BeginTrans
  787.    
  788.             .AddNew
  789.                 .Fields("VehicleNum") = Trim(LrText(0).Text & "")                             '车号
  790.                 If Trim(JiText(0).Text) <> "____-__-__ __:__" Then
  791.                     .Fields("WeighTime") = Format(JiText(0).Text, "yyyy-mm-dd hh:mm")          '要求检斤时间
  792.                 Else
  793.                     .Fields("WeighTime") = Null
  794.                 End If
  795.                 If Trim(JiText(1).Text) <> "____-__-__ __:__" Then
  796.                     .Fields("WeighEndTime") = Format(JiText(1).Text, "yyyy-mm-dd hh:mm")       '检斤完毕时间
  797.                 Else
  798.                     .Fields("WeighEndTime") = Null
  799.                 End If
  800.                 If Trim(LrText(1).Text) <> "" Then
  801.                     .Fields("WeighMan") = Trim(LrText(1).Text & "")                            '检斤负责人
  802.                 Else
  803.                     .Fields("WeighMan") = ""
  804.                 End If
  805.                 If Trim(JiText(1).Text) <> "____-__-__ __:__" Then                            '检斤状态
  806.                     .Fields("Result") = 1
  807.                 Else
  808.                     .Fields("Result") = 0
  809.                 End If
  810.                 .Fields("Quantity") = Val(Trim(LrText(2).Text & ""))
  811.             .Update
  812.             dbl_RecordAutoCode = .Fields("WeighId")
  813.             '增加记录的同时增加台准帐排它表中的记录(由此判断各状态时间问题)
  814.              If Findrc.State = 1 Then Findrc.Close
  815.                 Findrc.Open "SELECT * FROM Tr_NowAccount where 1=2 ", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  816.     
  817.     
  818.                 Findrc.AddNew
  819.                 Findrc.Fields("VoucherNum") = 1                                                      '各状态拾别号检斤为4
  820.                 Findrc.Fields("ChildId") = dbl_RecordAutoCode
  821.                 Findrc.Fields("VehicleNum") = Trim(.Fields("VehicleNum") & "")                         '车号
  822.                 If Not IsNull(.Fields("WeighTime")) Then
  823.                      Findrc.Fields("BeginTime") = Format(Trim(.Fields("WeighTime")), "yyyy-mm-dd hh:mm") '各状态要求时间
  824.                 Else
  825.                      Findrc.Fields("BeginTime") = Format(Trim(.Fields("WeighTime")), "yyyy-mm-dd hh:mm")
  826.                 End If
  827.                 If Not IsNull(.Fields("WeighEndTime")) Then
  828.                      Findrc.Fields("EndTime") = Format(Trim(.Fields("WeighEndTime")), "yyyy-mm-dd hh:mm") '各状态完毕时间
  829.                 Else
  830.                      Findrc.Fields("EndTime") = Format(Trim(.Fields("WeighTime")), "yyyy-mm-dd hh:mm")
  831.                 End If
  832.                 Findrc.Fields("MNumber") = Null
  833.                 If .Fields("Result") = True Then
  834.                     Findrc.Fields("NowStatus") = "已检斤"                                                '目前状态
  835.                     Findrc.Fields("LimitMark") = 1
  836.                 Else
  837.                     Findrc.Fields("NowStatus") = "检斤"
  838.                     Findrc.Fields("LimitMark") = 0
  839.                 End If
  840.                 
  841.                 Findrc.Update
  842.             
  843.             Cw_DataEnvi.DataConnect.CommitTrans
  844.             '将记录加入网格
  845.             Sqlstr = "SELECT Tr_Weigh.*,Tr_NowAccount.VoucherId as VoucherId FROM Tr_Weigh left outer join Tr_NowAccount on Tr_Weigh.WeighId=Tr_NowAccount.ChildId where Tr_NowAccount.VoucherNum=1 and Tr_Weigh.WeighId='" & dbl_RecordAutoCode & "' order by Tr_Weigh.WeighTime"
  846.             Set Cxnrrec = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  847.    
  848.             With CzxsGrid
  849.                 .AddItem ""
  850.                 .RowHeight(.Rows - 1) = Sjhgd
  851.                 .Select .Rows - 1, Qslz
  852.                 Call Jltcwg(Cxnrrec, .Rows - 1)
  853.             End With
  854.             Tsxx = "保存完毕!"
  855.             Call Xtxxts(Tsxx, 0, 4)
  856.             
  857.             Call Cshlrxx(1)
  858.             LrText(0).SetFocus
  859.             '将网格按编码排序
  860.             With CzxsGrid
  861.                 .Col = Sydz("002", GridStr(), szzls)
  862.                 CzxsGrid.Sort = flexSortStringAscending
  863.             End With
  864.             '<<]
  865.     
  866.         Else  '否则为修改记录
  867.             On Error GoTo Swcwcl
  868.             Cw_DataEnvi.DataConnect.BeginTrans
  869.             If .State = 1 Then .Close
  870.             .Open "SELECT * FROM Tr_Weigh WHERE WeighId= '" & dbl_RecordAutoCode & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  871.      
  872.             If Not .EOF Then
  873.                 If Trim(JiText(0).Text) <> "____-__-__ __:__" Then
  874.                     .Fields("WeighTime") = Format(JiText(0).Text, "yyyy-mm-dd hh:mm")          '要求检斤时间
  875.                 Else
  876.                     .Fields("WeighTime") = Null
  877.                 End If
  878.                 If Trim(JiText(1).Text) <> "____-__-__ __:__" Then
  879.                     .Fields("WeighEndTime") = Format(JiText(1).Text, "yyyy-mm-dd hh:mm")       '检斤完毕时间
  880.                 Else
  881.                     .Fields("WeighEndTime") = Null
  882.                 End If
  883.                 If Trim(LrText(1).Text) <> "" Then
  884.                     .Fields("WeighMan") = Trim(LrText(1).Text & "")                            '检斤负责人
  885.                 Else
  886.                     .Fields("WeighMan") = ""
  887.                 End If
  888.                 If Trim(JiText(1).Text) <> "____-__-__ __:__" Then                            '检斤状态
  889.                     .Fields("Result") = 1
  890.                 Else
  891.                     .Fields("Result") = 0
  892.                 End If
  893.                 .Fields("Quantity") = Val(Trim(LrText(2).Text & ""))
  894.                 .Update
  895.             End If
  896.             If Findrc.State = 1 Then Findrc.Close
  897.                 Findrc.Open "SELECT * FROM Tr_NowAccount where ChildId = '" & dbl_RecordAutoCode & "'and VoucherNum=1", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  898.                 If Not Findrc.EOF Then
  899.     '                Findrc.Fields("VoucherNum") = 4
  900.     '                Findrc.Fields("ChildId") = dbl_RecordAutoCode
  901.     '                Findrc.Fields("VehicleNum") = Trim(.Fields("VehicleNum") & "")        '车号
  902.                     If Not IsNull(.Fields("WeighTime")) Then
  903.                          Findrc.Fields("BeginTime") = Format(Trim(.Fields("WeighTime")), "yyyy-mm-dd hh:mm")  '各状态要求时间
  904.                     Else
  905.                          Findrc.Fields("BeginTime") = Format(Trim(.Fields("WeighTime")), "yyyy-mm-dd hh:mm")
  906.                     End If
  907.                     If Not IsNull(.Fields("WeighEndTime")) Then
  908.                          Findrc.Fields("EndTime") = Format(Trim(.Fields("WeighEndTime")), "yyyy-mm-dd hh:mm") '各状态完毕时间
  909.                     Else
  910.                          Findrc.Fields("EndTime") = Format(Trim(.Fields("WeighTime")), "yyyy-mm-dd hh:mm")
  911.                     End If
  912.                     Findrc.Fields("MNumber") = Null
  913.                     If .Fields("Result") = True Then
  914.                         Findrc.Fields("NowStatus") = "已检斤"                                                 '目前状态
  915.                         Findrc.Fields("LimitMark") = 1
  916.                     Else
  917.                         Findrc.Fields("NowStatus") = "检斤"
  918.                         Findrc.Fields("LimitMark") = 0
  919.                     End If
  920.                     
  921.                     Findrc.Update
  922.               End If
  923.              Cw_DataEnvi.DataConnect.CommitTrans
  924.    
  925.             '刷新当前网格
  926.             Sqlstr = "SELECT Tr_Weigh.*,Tr_NowAccount.VoucherId as VoucherId FROM Tr_Weigh left outer join Tr_NowAccount on Tr_Weigh.WeighId=Tr_NowAccount.ChildId where Tr_NowAccount.VoucherNum=1  and Tr_Weigh.WeighId='" & dbl_RecordAutoCode & "' order by Tr_Weigh.WeighTime"
  927.             Set Cxnrrec = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  928.    
  929.             With CzxsGrid
  930.                 Call Jltcwg(Cxnrrec, .Row)
  931.             End With
  932.    
  933.         End If
  934.      
  935.         '保存记录成功,函数返回真值
  936.         Bclrsj = True
  937.         Exit Function
  938.         
  939.     End With
  940.  
  941. Swcwcl:
  942.      Cw_DataEnvi.DataConnect.RollbackTrans
  943.      Tsxx = "存盘过程中出现错误,程序自动恢复保存前状态!"
  944.      Call Xtxxts(Tsxx, 0, 1)
  945.      Exit Function
  946.      
  947. End Function
  948. Private Function Cshlrxx(lrztxx As Integer) As Boolean              '初始化录入字段信息
  949.     TextChangeLock = True       '关闭文本框Chang事件
  950.     
  951.     If lrztxx = 1 Then
  952.     
  953.         '增加新记录时将文本框清空
  954.         For jsqte = 0 To Max_Text_Index
  955.             If Len(Trim(Textstr(jsqte, 1))) <> 0 Then
  956.                 LrText(jsqte).Text = ""
  957.                 LrText(jsqte).Tag = ""
  958.             End If
  959.             TextValiJudgeLock(jsqte) = True
  960.         Next jsqte
  961.        
  962.         '[>>
  963.         JiText(1).Text = "____-__-__ __:__"
  964.         JiText(0).Text = Format(Xtrq, "yyyy-mm-dd hh:mm")
  965.         '<<]
  966.     Else
  967.     
  968.         '修改记录时根据记录关键字(编码)从数据表中读入其他字段内容
  969.         With RecTemp
  970.             Sqlstr = "Select * From Tr_Weigh Where  WeighId='" & Trim(CzxsGrid.TextMatrix(CzxsGrid.Row, 0)) & "'"
  971.             Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  972.        
  973.             '记录如存在则读入其内容,否则提示记录已被其他人删除
  974.             If Not RecTemp.EOF Then
  975.                 LrText(0).Tag = Trim(RecTemp.Fields("VehicleNum") & " ")          '车号
  976.                 LrText(0).Text = Trim(RecTemp.Fields("VehicleNum") & " ")
  977.                 JiText(0).Text = Format(Trim(RecTemp.Fields("WeighTime")), "yyyy-mm-dd hh:mm")  '要求检斤时间
  978.                 If IsNull(Trim(RecTemp.Fields("WeighEndTime"))) Then                            '检斤完毕时间
  979.                     JiText(1).Text = "____-__-__ __:__"
  980.                 Else
  981.                     JiText(1).Text = Format(Trim(RecTemp.Fields("WeighEndTime")), "yyyy-mm-dd hh:mm")
  982.                 End If
  983.                 If Not IsNull(RecTemp.Fields("WeighMan")) Then                                   '检斤负责人
  984.                     LrText(1).Text = Trim(RecTemp.Fields("WeighMan") & "")
  985.                 Else
  986.                     LrText(1).Text = ""
  987.                 End If
  988.                     LrText(2).Text = Val(Trim(RecTemp.Fields("Quantity") & ""))
  989.                 dbl_RecordAutoCode = RecTemp.Fields("WeighId")
  990.             Else
  991.                 Tsxx = "该记录已经被其他人删除,请刷新当前数据!"
  992.                 Call Xtxxts(Tsxx, 0, 4)
  993.                 Call Cancel
  994.                 TextChangeLock = False
  995.                 Exit Function
  996.             End If
  997.         End With
  998.     End If
  999.     
  1000.     Cshlrxx = True
  1001.     TextChangeLock = False
  1002.     
  1003. End Function
  1004. Private Sub Scdqjl()                 '删 除 当 前 记 录
  1005.     Dim yhAnswer As Integer
  1006.     Dim Str_Parent As String
  1007.     Dim Sqlstr As String
  1008.     Dim Ts_temp1 As New ADODB.Recordset
  1009.     Dim Findrc As New ADODB.Recordset
  1010.     
  1011.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1012.     If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  1013.         Exit Sub
  1014.     End If
  1015.     
  1016.     '非数据行不能删除
  1017.     If CzxsGrid.Row < CzxsGrid.FixedRows Then
  1018.         Exit Sub
  1019.     End If
  1020.   
  1021.     '用户确认是否删除记录
  1022.     Tsxx = "请确认是否删除当前记录?"
  1023.     yhAnswer = Xtxxts(Tsxx, 2, 2)
  1024.     
  1025.     If yhAnswer = 2 Then
  1026.         Exit Sub
  1027.     End If
  1028.     On Error GoTo Cwcl
  1029.   
  1030.     Cw_DataEnvi.DataConnect.BeginTrans
  1031.     '[>>以下需自定义部分
  1032.     Cw_DataEnvi.DataConnect.Execute "delete Tr_Weigh where WeighId = '" + Trim(CzxsGrid.TextMatrix(CzxsGrid.Row, 0)) + "'"
  1033.     Cw_DataEnvi.DataConnect.Execute "delete Tr_NowAccount where ChildId = '" + Trim(CzxsGrid.TextMatrix(CzxsGrid.Row, 0)) + "'and VoucherNum=1 "
  1034.   
  1035.     '以上为自定义部分<<]
  1036.   
  1037.     Cw_DataEnvi.DataConnect.CommitTrans
  1038.     CzxsGrid.RemoveItem CzxsGrid.Row
  1039.     Exit Sub
  1040.   
  1041. Cwcl:
  1042.     Cw_DataEnvi.DataConnect.RollbackTrans
  1043.     
  1044.     If Err.Number = -2147217873 Then                '(-2147217873 为SQL Server 2000通过建立外键产生的错误号)
  1045.         Tsxx = "该编码已经被使用,不能删除!"
  1046.         Call Xtxxts(Tsxx, 0, 1)
  1047.         Exit Sub
  1048.     Else
  1049.         Tsxx = "出现未知情况,该编码不能被删除!"
  1050.         Call Xtxxts(Tsxx, 0, 1)
  1051.         Exit Sub
  1052.     End If
  1053.     
  1054. End Sub
  1055. '*******************以下区域为编写自定义过程区域**********************
  1056.  '判断各状态的时间
  1057.  Function JiTextptpd() As Boolean
  1058.     Dim Sqlstr As String
  1059.     Dim jsqte As Long
  1060.     Dim str_TempSql As String
  1061.     Dim arrVar_TableCon()
  1062.     Dim arrVar_TableCon1()
  1063.     Dim arr_Var_TableCon2()
  1064.     Dim arrVar_TableCon3()
  1065.     Dim rs_Tmp As New ADODB.Recordset
  1066.     Dim Findrec As New ADODB.Recordset
  1067. On Error GoTo Pdbz
  1068. If Lrzt = 1 Then '各状态增加时的判断
  1069.         '先查询出同车号各状态正在进行的记录并找出最大时间与填入记录进行判断
  1070.         str_tmp = "select * from Tr_NowAccount where VehicleNum='" & Trim(LrText(0).Text) & "'and LimitMark=0 order by BeginTime      "
  1071.         Set rs_Tmp = Nothing
  1072.         Set rs_Tmp = Cw_DataEnvi.DataConnect.Execute(str_tmp)
  1073.         If Not rs_Tmp.RecordCount = 0 Then
  1074.             ReDim arrVar_TableCon(rs_Tmp.RecordCount - 1, 2)
  1075.         End If
  1076.         k = 0
  1077.         Do While Not rs_Tmp.EOF()
  1078.             arrVar_TableCon(k, 0) = Trim(rs_Tmp.Fields("NowStatus"))                              '目前状态
  1079.             arrVar_TableCon(k, 1) = Format(Trim(rs_Tmp.Fields("BeginTime")), "yyyy-mm-dd hh:mm")  '要求时间
  1080.             arrVar_TableCon(k, 2) = Format(Trim(rs_Tmp.Fields("EndTime")), "yyyy-mm-dd hh:mm")    '完毕时间
  1081.             rs_Tmp.MoveNext
  1082.             k = k + 1
  1083.         Loop
  1084.         If Not rs_Tmp.RecordCount = 0 Then
  1085.             If JiText(0).Text < arrVar_TableCon(UBound(arrVar_TableCon, 1), 2) Then
  1086.                 If Trim(JiText(1).Text) = "____-__-__ __:__" Then
  1087.                     Tsxx = "检斤完毕时间不能为空"
  1088.                     Call Xtxxts(Tsxx, 0, 1)
  1089.                     JiText(1).SetFocus
  1090.                     JiTextptpd = False
  1091.                     Exit Function
  1092.                 End If
  1093.             End If
  1094.             For i = LBound(arrVar_TableCon, 1) To UBound(arrVar_TableCon, 1)
  1095.                 If i = UBound(arrVar_TableCon, 1) Then
  1096.                     If JiText(0).Text >= arrVar_TableCon(i, 1) Then
  1097.                         Tsxx = "此车号正处于" & arrVar_TableCon(i, 0) & "状态,不能进行其他处理!"
  1098.                         Call Xtxxts(Tsxx, 0, 1)
  1099.                         JiText(0).SetFocus
  1100.                         JiTextptpd = False
  1101.                         Exit Function
  1102.                     End If
  1103.                 End If
  1104.                 If JiText(1).Text <> "____-__-__ __:__" Then
  1105.                     If JiText(1).Text >= arrVar_TableCon(i, 1) Then
  1106.                         Tsxx = "此车号正处于" & arrVar_TableCon(i, 0) & "状态,请重新输入时间!"
  1107.                         Call Xtxxts(Tsxx, 0, 1)
  1108.                          JiText(1).SetFocus
  1109.                         JiTextptpd = False
  1110.                         Exit Function
  1111.                     End If
  1112.                 End If
  1113.             Next i
  1114.         End If
  1115.          '查询出各状态同车号已完成的记录并找出最大时间与填入的记录进行判断
  1116.         str_tmp = "select * from Tr_NowAccount where VehicleNum='" & Trim(LrText(0).Text) & "'and LimitMark=1 order by BeginTime      "
  1117.         Set rs_Tmp = Nothing
  1118.         Set rs_Tmp = Cw_DataEnvi.DataConnect.Execute(str_tmp)
  1119.         If Not rs_Tmp.RecordCount = 0 Then
  1120.             ReDim arrVar_TableCon2(rs_Tmp.RecordCount - 1, 2)
  1121.         End If
  1122.         k = 0
  1123.         Do While Not rs_Tmp.EOF()
  1124.             arrVar_TableCon2(k, 0) = Trim(rs_Tmp.Fields("NowStatus"))
  1125.             arrVar_TableCon2(k, 1) = Format(Trim(rs_Tmp.Fields("BeginTime")), "yyyy-mm-dd hh:mm")
  1126.             arrVar_TableCon2(k, 2) = Format(Trim(rs_Tmp.Fields("EndTime")), "yyyy-mm-dd hh:mm")
  1127.             rs_Tmp.MoveNext
  1128.             k = k + 1
  1129.         Loop
  1130.         If Not rs_Tmp.RecordCount = 0 Then
  1131.             If JiText(0).Text < arrVar_TableCon2(UBound(arrVar_TableCon2, 1), 2) Then
  1132.                 If Trim(JiText(1).Text) = "____-__-__ __:__" Then
  1133.                     Tsxx = "检斤完毕时间不能为空"
  1134.                     Call Xtxxts(Tsxx, 0, 1)
  1135.                     JiText(1).SetFocus
  1136.                     JiTextptpd = False
  1137.                     Exit Function
  1138.                 End If
  1139.             End If
  1140.             For i = LBound(arrVar_TableCon2, 1) To UBound(arrVar_TableCon2, 1)
  1141.                 If JiText(0).Text >= arrVar_TableCon2(i, 1) And JiText(0).Text <= arrVar_TableCon2(i, 2) Then
  1142.                     Tsxx = "此车号在" & arrVar_TableCon2(i, 1) & "至" & arrVar_TableCon2(i, 2) & ",处于" & arrVar_TableCon2(i, 0) & "状态,请重新输入时间!"
  1143.                     Call Xtxxts(Tsxx, 0, 1)
  1144.                     JiText(0).SetFocus
  1145.                     JiTextptpd = False
  1146.                     Exit Function
  1147.                 End If
  1148.                 If JiText(1).Text >= arrVar_TableCon2(i, 1) And JiText(1).Text <= arrVar_TableCon2(i, 2) Then
  1149.                     Tsxx = "此车号在" & arrVar_TableCon2(i, 1) & "至" & arrVar_TableCon2(i, 2) & ",处于" & arrVar_TableCon2(i, 0) & "状态,请重新输入时间!"
  1150.                     Call Xtxxts(Tsxx, 0, 1)
  1151.                     JiText(1).SetFocus
  1152.                     JiTextptpd = False
  1153.                     Exit Function
  1154.                 End If
  1155.                 If JiText(0) <= arrVar_TableCon2(i, 1) And JiText(1).Text >= arrVar_TableCon2(i, 2) Then
  1156.                         Tsxx = "此车号在" & arrVar_TableCon2(i, 1) & "至" & arrVar_TableCon2(i, 2) & ",处于" & arrVar_TableCon2(i, 0) & "状态,请重新输入时间!"
  1157.                         Call Xtxxts(Tsxx, 0, 1)
  1158.                         JiText(1).SetFocus
  1159.                         JiTextptpd = False
  1160.                         Exit Function
  1161.                 End If
  1162.             Next i
  1163.         End If
  1164.         
  1165.         
  1166.         
  1167. Else  '修改
  1168.             '先查询出同车号各状态正在进行的记录并找出最大时间与填入记录进行判断
  1169.             str_tmp = "select * from Tr_NowAccount where VehicleNum='" & Trim(LrText(0).Text) & "'and LimitMark=0 order by BeginTime      "
  1170.             Set rs_Tmp = Nothing
  1171.             Set rs_Tmp = Cw_DataEnvi.DataConnect.Execute(str_tmp)
  1172.             If Not rs_Tmp.RecordCount = 0 Then
  1173.                 ReDim arrVar_TableCon(rs_Tmp.RecordCount - 1, 3)
  1174.             End If
  1175.             k = 0
  1176.             Do While Not rs_Tmp.EOF()
  1177.                 arrVar_TableCon(k, 0) = Trim(rs_Tmp.Fields("NowStatus"))
  1178.                 arrVar_TableCon(k, 1) = Format(Trim(rs_Tmp.Fields("BeginTime")), "yyyy-mm-dd hh:mm")
  1179.                 arrVar_TableCon(k, 2) = Format(Trim(rs_Tmp.Fields("EndTime")), "yyyy-mm-dd hh:mm")
  1180.                 arrVar_TableCon(k, 3) = rs_Tmp.Fields("VoucherId")
  1181.                 rs_Tmp.MoveNext
  1182.                 k = k + 1
  1183.             Loop
  1184.             If Not rs_Tmp.RecordCount = 0 Then
  1185.                 For i = LBound(arrVar_TableCon, 1) To UBound(arrVar_TableCon, 1)
  1186.                     If i = UBound(arrVar_TableCon, 1) Then
  1187.                         If JiText(0).Text >= arrVar_TableCon(i, 1) And arrVar_TableCon(i, 3) <> CzxsGrid.TextMatrix(CzxsGrid.Row, 1) Then
  1188.                             Tsxx = "此车号正处于" & arrVar_TableCon(i, 0) & "状态,请重新输入时间!"
  1189.                             Call Xtxxts(Tsxx, 0, 1)
  1190.                             JiText(0).SetFocus
  1191.                             JiTextptpd = False
  1192.                             Exit Function
  1193.                         End If
  1194.                         If JiText(1).Text <> "____-__-__ __:__" Then
  1195.                             If JiText(1).Text >= arrVar_TableCon(i, 1) And arrVar_TableCon(i, 3) <> CzxsGrid.TextMatrix(CzxsGrid.Row, 1) Then
  1196.                                 Tsxx = "此车号正处于" & arrVar_TableCon(i, 0) & "状态,请重新输入时间!"
  1197.                                 Call Xtxxts(Tsxx, 0, 1)
  1198.                                  JiText(1).SetFocus
  1199.                                 JiTextptpd = False
  1200.                                 Exit Function
  1201.                             End If
  1202.                         End If
  1203.                     End If
  1204.                 Next i
  1205.                 str_tmp = "select * from Tr_Weigh where WeighId='" & dbl_RecordAutoCode & "'and result=0 order by WeighEndTime      "
  1206.                 Set Findrec = Nothing
  1207.                 Set Findrec = Cw_DataEnvi.DataConnect.Execute(str_tmp)
  1208.                 If Findrec.RecordCount = 0 Then
  1209.                     If JiText(1).Text = "____-__-__ __:__" Then
  1210.                         Tsxx = "检斤完毕时间不能为空"
  1211.                         Call Xtxxts(Tsxx, 0, 1)
  1212.                         JiText(1).SetFocus
  1213.                         JiTextptpd = False
  1214.                         Exit Function
  1215.                     End If
  1216.                 End If
  1217.             End If
  1218.             '先查询出同车号各状态已完成的记录并找出最大时间与填入记录进行判断
  1219.             str_tmp = "select * from Tr_NowAccount where VehicleNum='" & Trim(LrText(0).Text) & "'and LimitMark=1 order by BeginTime      "
  1220.             Set rs_Tmp = Nothing
  1221.             Set rs_Tmp = Cw_DataEnvi.DataConnect.Execute(str_tmp)
  1222.             If Not rs_Tmp.RecordCount = 0 Then
  1223.                  ReDim arrVar_TableCon2(rs_Tmp.RecordCount - 1, 3)
  1224.             End If
  1225.             k = 0
  1226.             Do While Not rs_Tmp.EOF()
  1227.                 arrVar_TableCon2(k, 0) = Trim(rs_Tmp.Fields("NowStatus"))
  1228.                 arrVar_TableCon2(k, 1) = Format(Trim(rs_Tmp.Fields("BeginTime")), "yyyy-mm-dd hh:mm")
  1229.                 arrVar_TableCon2(k, 2) = Format(Trim(rs_Tmp.Fields("EndTime")), "yyyy-mm-dd hh:mm")
  1230.                 arrVar_TableCon2(k, 3) = rs_Tmp.Fields("VoucherId")
  1231.                 rs_Tmp.MoveNext
  1232.                 k = k + 1
  1233.             Loop
  1234.             
  1235.             str_tmp = "select * from Tr_Weigh where WeighId='" & dbl_RecordAutoCode & "'and result=1 order by WeighEndTime      "
  1236.             Set Findrec = Nothing
  1237.             Set Findrec = Cw_DataEnvi.DataConnect.Execute(str_tmp)
  1238.                     If Not Findrec.RecordCount = 0 Then
  1239.                       If CDate(Findrec.Fields("WeighEndTime")) = arrVar_TableCon2(UBound(arrVar_TableCon2, 1), 2) Then
  1240.                         If JiText(1).Text = "____-__-__ __:__" Then
  1241.                             If JiText(0).Text = arrVar_TableCon2(UBound(arrVar_TableCon2, 1), 1) Then
  1242.                                 JiTextptpd = True
  1243.                                 Exit Function
  1244.                             End If
  1245.                         End If
  1246.                       End If
  1247.                     End If
  1248.             If Not rs_Tmp.RecordCount = 0 Then
  1249.                 If JiText(0).Text < arrVar_TableCon2(UBound(arrVar_TableCon2, 1), 2) Then
  1250.                     If Trim(JiText(1).Text) = "____-__-__ __:__" Then
  1251.                         Tsxx = "检斤完毕时间不能为空"
  1252.                         Call Xtxxts(Tsxx, 0, 1)
  1253.                         JiText(1).SetFocus
  1254.                         JiTextptpd = False
  1255.                         Exit Function
  1256.                     End If
  1257.                 End If
  1258.                 For i = LBound(arrVar_TableCon2, 1) To UBound(arrVar_TableCon2, 1)
  1259.                     If JiText(0) >= arrVar_TableCon2(i, 1) And JiText(0).Text <= arrVar_TableCon2(i, 2) And arrVar_TableCon2(i, 3) <> CzxsGrid.TextMatrix(CzxsGrid.Row, 1) Then
  1260.                         Tsxx = "此车号在" & arrVar_TableCon2(i, 1) & "至" & arrVar_TableCon2(i, 2) & ",处于" & arrVar_TableCon2(i, 0) & "状态,请重新输入时间!"
  1261.                         Call Xtxxts(Tsxx, 0, 1)
  1262.                         JiText(0).SetFocus
  1263.                         JiTextptpd = False
  1264.                         Exit Function
  1265.                     End If
  1266.                     If JiText(1) >= arrVar_TableCon2(i, 1) And JiText(1).Text <= arrVar_TableCon2(i, 2) And arrVar_TableCon2(i, 3) <> CzxsGrid.TextMatrix(CzxsGrid.Row, 1) Then
  1267.                         Tsxx = "此车号在" & arrVar_TableCon2(i, 1) & "至" & arrVar_TableCon2(i, 2) & ",处于" & arrVar_TableCon2(i, 0) & "状态,请重新输入时间!"
  1268.                         Call Xtxxts(Tsxx, 0, 1)
  1269.                         JiText(1).SetFocus
  1270.                         JiTextptpd = False
  1271.                         Exit Function
  1272.                     End If
  1273.                     If JiText(0) <= arrVar_TableCon2(i, 1) And JiText(1).Text >= arrVar_TableCon2(i, 2) And arrVar_TableCon2(i, 3) <> CzxsGrid.TextMatrix(CzxsGrid.Row, 1) Then
  1274.                         Tsxx = "此车号在" & arrVar_TableCon2(i, 1) & "至" & arrVar_TableCon2(i, 2) & ",处于" & arrVar_TableCon2(i, 0) & "状态,请重新输入时间!"
  1275.                         Call Xtxxts(Tsxx, 0, 1)
  1276.                         JiText(1).SetFocus
  1277.                         JiTextptpd = False
  1278.                         Exit Function
  1279.                     End If
  1280.                 Next i
  1281.             End If
  1282.             
  1283.             
  1284. '    End If
  1285.     
  1286.        
  1287. End If
  1288.        JiTextptpd = True
  1289.        Exit Function
  1290. Pdbz:
  1291.       Tsxx = "出现未知错误!"
  1292.      Call Xtxxts(Tsxx, 0, 1)
  1293.      JiTextptpd = False
  1294.      Exit Function
  1295.    
  1296. End Function
  1297. '*******************以上区域为编写自定义过程区域**********************
  1298. '******************以下为基本处理程序(固定不变)************************'
  1299. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)        '支持热键操作
  1300.     If Shift = 2 Then
  1301.         Select Case UCase(Chr(KeyCode))
  1302.             Case "P"                                                                          'Ctrl+P 打印
  1303.                 If SzToolbar.Buttons("dy").Visible And SzToolbar.Buttons("dy").Enabled Then
  1304.                     Call bbyl(False)
  1305.                 End If
  1306.             Case "A"                                                                          'Ctrl+A 增加
  1307.                 '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1308.                 If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  1309.                     Exit Sub
  1310.                 End If
  1311.                 If SzToolbar.Buttons("zj").Visible And SzToolbar.Buttons("zj").Enabled Then
  1312.                     Call Toolbjzt
  1313.                     Lrzt = 1
  1314.                     Call Cshlrxx(Lrzt)
  1315.                     LrText(0).Enabled = True
  1316.                     LrText(0).SetFocus
  1317.                 End If
  1318.             Case "D"                                                                          'Ctrl+D 删除
  1319.                 If SzToolbar.Buttons("sc").Visible And SzToolbar.Buttons("sc").Enabled Then
  1320.                     Call Scdqjl
  1321.                 End If
  1322.         End Select
  1323.     End If
  1324.     
  1325. End Sub
  1326. Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
  1327.    
  1328.     Select Case Button.Key
  1329.         Case "ymsz"                                          '页面设置
  1330.             Dyymctbl.Show 1
  1331.         Case "yl"                                            '预 览
  1332.             Call bbyl(True)
  1333.         Case "dy"                                            '打 印
  1334.             Call bbyl(False)
  1335.         Case "zj"                                            '增 加
  1336.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1337.             If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  1338.                 Exit Sub
  1339.             End If
  1340.             Call Toolbjzt
  1341.             Lrzt = 1
  1342.             Call Cshlrxx(Lrzt)
  1343.             LrText(0).Enabled = True
  1344.             LrText(0).SetFocus
  1345.             Ydcommand1(0).Enabled = True
  1346.            
  1347.         Case "xg"                                            '修 改
  1348.             Call Xgdqjl
  1349.         Case "sc"                                            '删 除
  1350.             Call Scdqjl
  1351.         Case "sx"                                            '刷 新
  1352.             Call Cxnrtcwg
  1353.         Case "bz"                                            '帮 助
  1354.             Call F1bz
  1355.         Case "fh"                                            '退 出
  1356.             Unload Me
  1357.         End Select
  1358.         
  1359. End Sub
  1360. Private Sub CzxsGrid_DblClick()                            '修改当前编码记录
  1361.     Call Xgdqjl
  1362.   
  1363. End Sub
  1364. Private Sub Xgdqjl()                                       '修改当前编码记录
  1365.     
  1366.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1367.     If Not Security_Log(Str_RightEdit, Xtczybm, 1, True, False) Then
  1368.         BcCommand.Enabled = False
  1369.     End If
  1370.     
  1371.     If CzxsGrid.Row < CzxsGrid.FixedRows Then
  1372.         Exit Sub
  1373.     End If
  1374.     
  1375.     Call Toolbjzt
  1376.     Lrzt = 2
  1377.     
  1378.     If Cshlrxx(Lrzt) Then
  1379.         LrText(1).SetFocus
  1380.         LrText(0).Enabled = False
  1381.         Ydcommand1(0).Enabled = False
  1382.         
  1383.     End If
  1384.   
  1385. End Sub
  1386. Private Sub Toolbjzt()                                     'Toolbar状态(编辑状态)
  1387.     StTab.TabEnabled(1) = True
  1388.     StTab.Tab = 1
  1389.     Frame1.Enabled = True
  1390.     StTab.TabEnabled(0) = False
  1391.     CzxsGrid.Enabled = False
  1392.     With SzToolbar
  1393.         .Buttons("ymsz").Enabled = False
  1394.         .Buttons("dy").Enabled = False
  1395.         .Buttons("yl").Enabled = False
  1396.         .Buttons("zj").Enabled = False
  1397.         .Buttons("xg").Enabled = False
  1398.         .Buttons("sc").Enabled = False
  1399.         .Buttons("sx").Enabled = False
  1400.     End With
  1401.   
  1402. End Sub
  1403. Private Sub Toolfbjzt()                                    'Toolbar状态(非编辑状态)
  1404.     StTab.TabEnabled(0) = True
  1405.     StTab.Tab = 0
  1406.     CzxsGrid.Enabled = True
  1407.     Frame1.Enabled = False
  1408.     StTab.TabEnabled(1) = False
  1409.     Lrzt = 0
  1410.     
  1411.     With SzToolbar
  1412.         .Buttons("ymsz").Enabled = True
  1413.         .Buttons("dy").Enabled = True
  1414.         .Buttons("yl").Enabled = True
  1415.         .Buttons("zj").Enabled = True
  1416.         .Buttons("xg").Enabled = True
  1417.         .Buttons("sc").Enabled = True
  1418.         .Buttons("sx").Enabled = True
  1419.     End With
  1420.   
  1421. End Sub
  1422. Private Sub BcCommand_Click()                                           '保 存
  1423.     If Not Bclrsj Then
  1424.         Exit Sub
  1425.     End If
  1426.   
  1427.     If Lrzt = 2 Then
  1428.         Call Toolfbjzt
  1429.     End If
  1430.   
  1431. End Sub
  1432. Private Sub QxCommand_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)       '取消
  1433.   
  1434.     '避免执行Click程序
  1435.     Bln_Cancel = True
  1436.   
  1437.     Call Cancel
  1438.     
  1439. End Sub
  1440. Private Sub QxCommand_Click()                                                                         '取消
  1441.  
  1442.     If Bln_Cancel Then
  1443.         Bln_Cancel = False
  1444.         Exit Sub
  1445.     End If
  1446.  
  1447.     Call Cancel
  1448.     
  1449. End Sub
  1450. Private Sub Cancel()                                                                                  '取消
  1451.   
  1452.     '文本框加锁
  1453.     For jsqte = 0 To Max_Text_Index
  1454.         TextValiJudgeLock(jsqte) = True
  1455.     Next jsqte
  1456.   
  1457.     Call Toolfbjzt
  1458.     
  1459. End Sub
  1460. Private Sub CzxsGrid_BeforeMoveColumn(ByVal Col As Long, Position As Long)           '网格列发生移动时自动交换网格索引信息
  1461.     
  1462.     FnBln_RefreshArray Col, Position, GridStr(), GridInf()
  1463. End Sub
  1464. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)   '表格格式设置(通用)
  1465.     
  1466.     Select Case Button.Key
  1467.         Case "bcgs"                                       '保存表格格式
  1468.             Call Bcwggs(CzxsGrid, GridCode, GridStr())
  1469.         Case "hfmrgs"                                     '恢复默认格式
  1470.             Call Hfmrgs(CzxsGrid, GridCode, GridStr())
  1471.         Case "szxsxm"                                     '设置显示项目
  1472.             Call Szxsxm(CzxsGrid, GridCode)
  1473.     End Select
  1474.     
  1475. End Sub
  1476. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  1477.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  1478.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  1479.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  1480.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  1481.     ReDim Bbxbt(1 To Bbxbtgs)
  1482.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  1483.     
  1484.     If Bbbwhgs <> 0 Then
  1485.         ReDim Bbbwh(1 To Bbbwhgs)
  1486.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  1487.     End If
  1488.     
  1489.     Bbzbt = ReportTitle
  1490.     Bbxbt(1) = " "
  1491.     bbxbtzzxs(1) = 0                                     '报表行组织形式(0-居左 1-居中 2-居右)
  1492.     
  1493.     Call Scyxsjb(CzxsGrid)                               '生成报表数据
  1494.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  1495.   
  1496.     If Not bbylte Then
  1497.         Unload DY_Tybbyldy
  1498.     End If
  1499.     
  1500. End Sub
  1501. '************以下为文本框录入处理程序(固定不变部分)*************'
  1502. Private Sub Wbklrwbcl(Index As Integer)    '文本框录入事后处理程序
  1503.     '以下为依据实际情况自定义部分[
  1504.   
  1505.         '在此填写文本框录入事后处理程序
  1506.    
  1507.     ']以上为依据实际情况自定义部分
  1508.     
  1509. End Sub
  1510. Private Sub LrText_Change(Index As Integer)
  1511.     '屏蔽程序改变控制
  1512.     If TextChangeLock Then
  1513.         Exit Sub
  1514.     End If
  1515.     
  1516.     TextValiJudgeLock(Index) = False    '打开有效性判断锁
  1517.     
  1518.     '限制字段录入长度
  1519.           
  1520.     TextChangeLock = True  '加锁(防止执行Lrtext_Change)
  1521.      
  1522.     Select Case Textint(Index, 1)
  1523.         Case 8, 11      '金额型
  1524.             Call Sjgskz(LrText(Index), Xtjezws - Xtjexsws - 1, Xtjexsws)
  1525.         Case 9, 12      '数量型
  1526.             Call Sjgskz(LrText(Index), Xtslzws - Xtslxsws - 1, Xtslxsws)
  1527.         Case 10          '单价型
  1528.             Call Sjgskz(LrText(Index), Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  1529.         Case Else        '其他小数类型控制
  1530.             If Textint(Index, 6) <> 0 Or Textint(Index, 7) <> 0 Then
  1531.                 Call Sjgskz(LrText(Index), Textint(Index, 6), Textint(Index, 7))
  1532.             End If
  1533.     End Select
  1534.         
  1535.     TextChangeLock = False '解锁
  1536.     
  1537. End Sub
  1538. Private Sub LrText_GotFocus(Index As Integer)                                                 '文本框得到焦点,显示相应信息
  1539.    
  1540.     Call TextShow(Index)
  1541.     CurTextIndex = Index
  1542.     LrText(Index).SelStart = Len(LrText(Index))
  1543.    
  1544. End Sub
  1545. Private Sub LrText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)            '字段按F2键提供帮助
  1546.    
  1547.     Select Case KeyCode
  1548.          Case vbKeyF2
  1549.              Call Text_Help(Index)
  1550.     End Select
  1551.    
  1552. End Sub
  1553. Private Sub LrText_KeyPress(Index As Integer, KeyAscii As Integer)                            '文本框录入事中控制
  1554.    
  1555.     Call InputFieldLimit(LrText(Index), Textint(Index, 1), KeyAscii)
  1556. End Sub
  1557. Private Sub LrText_LostFocus(Index As Integer)                                                '文本框失去焦点
  1558.     '显示相应信息但不能进行有效性判断
  1559.   
  1560. End Sub
  1561. Private Sub Ydcommand1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)     '按钮提供帮助
  1562.     
  1563.     Call Text_Help(Index)
  1564.     
  1565. End Sub
  1566. Private Sub Text_Help(Index As Integer)                                                       '录入字段帮助
  1567.   
  1568.     If Not Textboolean(Index, 1) Then
  1569.         Exit Sub
  1570.     End If
  1571.    
  1572.     '调用帮助
  1573.     Call Drbmhelp(Textint(Index, 2), Textstr(Index, 4), Trim(LrText(Index).Text))
  1574.   
  1575.     '根据设置选择显示编码和名称,并进行存储
  1576.     If Len(Xtfhcs) <> 0 Then
  1577.         If Textint(Index, 3) = 1 Then
  1578.             LrText(Index).Text = Xtfhcsfz
  1579.             LrText(Index).Tag = Xtfhcs
  1580.         Else
  1581.             LrText(Index).Text = Xtfhcs
  1582.             LrText(Index).Tag = Xtfhcsfz
  1583.         End If
  1584.     End If
  1585.    
  1586.     LrText(Index).SetFocus
  1587.     
  1588. End Sub
  1589. Private Sub TextShow(Index As Integer)        '文本框得到焦点,显示相应信息
  1590.     '填写文本框得到焦点,进行相应信息处理程序
  1591.    
  1592. End Sub
  1593. Private Sub Wbkcsh()                          '录入文本框初始化
  1594.     Dim jsqte As Long
  1595.   
  1596.     '最大录入文本框索引值
  1597.     Max_Text_Index = Textvar(1)
  1598.   
  1599.     ReDim TextValiJudgeLock(Max_Text_Index)
  1600.     
  1601.     For jsqte = 0 To Max_Text_Index
  1602.      
  1603.         If Len(Trim(Textstr(jsqte, 1))) <> 0 Then
  1604.             If Textboolean(jsqte, 1) Then
  1605.                 If jsqte <> 0 And Not Textboolean(jsqte, 3) Then
  1606.                     Load Ydcommand1(jsqte)
  1607.                 End If
  1608.                 Ydcommand1(jsqte).Visible = True
  1609.                 Ydcommand1(jsqte).Move LrText(jsqte).Left + LrText(jsqte).Width, LrText(jsqte).Top
  1610.             End If
  1611.             TextChangeLock = True
  1612.             LrText(jsqte).Text = ""
  1613.             LrText(jsqte).Tag = ""
  1614.             
  1615.             If Textint(jsqte, 5) <> 0 Then
  1616.                 LrText(jsqte).MaxLength = Textint(jsqte, 5)
  1617.             End If
  1618.             
  1619.             TextChangeLock = False
  1620.         End If
  1621.         
  1622.         TextValiJudgeLock(jsqte) = True
  1623.     Next jsqte
  1624.     
  1625. End Sub
  1626. Private Function TextYxxpd(Index As Integer) As Boolean           '文本框有效性判断
  1627.     Dim Sqlstr As String
  1628.     Dim Findrec As ADODB.Recordset
  1629.   
  1630.     '文本框内容未曾改变不进行有效性判断
  1631.     If TextValiJudgeLock(Index) Then
  1632.         TextYxxpd = True
  1633.         Exit Function
  1634.     End If
  1635.   
  1636.     '文本框内容为空认为有效,并清空其Tag值
  1637.     If Trim(LrText(Index)) = "" Then
  1638.         LrText(Index).Tag = ""
  1639.         Call Wbklrwbcl(Index)
  1640.         TextValiJudgeLock(Index) = True
  1641.         TextYxxpd = True
  1642.         Exit Function
  1643.     End If
  1644.   
  1645.     '可在此加入不做有效性判断的理由
  1646.   
  1647.     Select Case Textint(Index, 4)
  1648.         Case 1      '编码型
  1649.             Sqlstr = Trim(Textstr(Index, 5))
  1650.             Sqlstr = Replace(Sqlstr, "@", "'" + Trim(LrText(Index).Text) + "'")
  1651.             Set Findrec = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  1652.          
  1653.             If Findrec.EOF Then
  1654.                 Call Xtxxts(Trim(Textstr(Index, 6)), 0, 1)
  1655.                 LrText(Index).SetFocus
  1656.                 Exit Function
  1657.             Else
  1658.                 Select Case Textint(Index, 3)
  1659.                     Case 0
  1660.                         If Len(Trim(Textstr(Index, 2))) <> 0 Then
  1661.                             LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
  1662.                         End If
  1663.                         If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
  1664.                             LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
  1665.                         End If
  1666.                     Case 1
  1667.                         If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
  1668.                             LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
  1669.                         End If
  1670.                         If Len(Trim(Textstr(Index, 2))) <> 0 Then
  1671.                             LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
  1672.                         End If
  1673.                 End Select
  1674.             End If
  1675.             
  1676.         Case 2      '日期型
  1677.             If IsDate(LrText(Index).Text) Then
  1678.                 LrText(Index).Text = Format(LrText(Index).Text, "yyyy-mm-dd")
  1679.                 If Val(Mid(LrText(Index), 1, 4)) < 1900 Then
  1680.                     LrText(Index).Text = "1900" + Mid(LrText(Index), 5, 6)
  1681.                 End If
  1682.             Else
  1683.                 Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
  1684.                 Call Xtxxts(Tsxx, 0, 1)
  1685.                 LrText(Index).SetFocus
  1686.                 Exit Function
  1687.             End If
  1688.             
  1689.         Case 3      '其他类型
  1690.             If Index = 0 Then
  1691.                 If Len(LrText(Index).Text) <> 7 And Len(LrText(Index).Text) <> 8 Then
  1692.                      Tsxx = "车号只能是7位或8位数字或字符!"
  1693.                      Call Xtxxts(Tsxx, 0, 1)
  1694.                      LrText(Index).SetFocus
  1695.                      Exit Function
  1696.                 End If
  1697.             End If
  1698.         
  1699.     End Select
  1700.     
  1701.     '如果有效则加锁,用户不改变内容则不再进行有效性判断
  1702.     TextValiJudgeLock(Index) = True
  1703.     '调用文本框事后处理程序
  1704.     Call Wbklrwbcl(Index)
  1705.    
  1706.     '有效性判断通过则返回True
  1707.     TextYxxpd = True
  1708.    
  1709. End Function