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

企业管理

开发平台:

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