frmCg.frm
上传用户:yexiandon
上传日期:2022-07-12
资源大小:895k
文件大小:28k
源码类别:

百货/超市行业

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  4. Begin VB.Form frmCg 
  5.    Caption         =   "配件采购信息"
  6.    ClientHeight    =   5940
  7.    ClientLeft      =   1860
  8.    ClientTop       =   5520
  9.    ClientWidth     =   15240
  10.    Icon            =   "frmCg.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   5940
  14.    ScaleWidth      =   15240
  15.    WindowState     =   2  'Maximized
  16.    Begin MSComctlLib.ImageList ImageList1 
  17.       Left            =   13560
  18.       Top             =   1320
  19.       _ExtentX        =   1005
  20.       _ExtentY        =   1005
  21.       BackColor       =   -2147483643
  22.       ImageWidth      =   16
  23.       ImageHeight     =   16
  24.       MaskColor       =   12632256
  25.       _Version        =   393216
  26.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  27.          NumListImages   =   32
  28.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  29.             Picture         =   "frmCg.frx":08CA
  30.             Key             =   "A2"
  31.          EndProperty
  32.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  33.             Picture         =   "frmCg.frx":11A4
  34.             Key             =   "A1"
  35.          EndProperty
  36.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  37.             Picture         =   "frmCg.frx":1C6E
  38.             Key             =   "A0"
  39.          EndProperty
  40.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  41.             Picture         =   "frmCg.frx":2548
  42.             Key             =   ""
  43.          EndProperty
  44.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  45.             Picture         =   "frmCg.frx":30F2
  46.             Key             =   ""
  47.          EndProperty
  48.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  49.             Picture         =   "frmCg.frx":368C
  50.             Key             =   ""
  51.          EndProperty
  52.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  53.             Picture         =   "frmCg.frx":3C26
  54.             Key             =   ""
  55.          EndProperty
  56.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  57.             Picture         =   "frmCg.frx":41C0
  58.             Key             =   "gb"
  59.          EndProperty
  60.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  61.             Picture         =   "frmCg.frx":4D0A
  62.             Key             =   ""
  63.          EndProperty
  64.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  65.             Picture         =   "frmCg.frx":A92C
  66.             Key             =   ""
  67.          EndProperty
  68.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  69.             Picture         =   "frmCg.frx":AEC6
  70.             Key             =   ""
  71.          EndProperty
  72.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  73.             Picture         =   "frmCg.frx":B020
  74.             Key             =   ""
  75.          EndProperty
  76.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  77.             Picture         =   "frmCg.frx":B17A
  78.             Key             =   ""
  79.          EndProperty
  80.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  81.             Picture         =   "frmCg.frx":B2D4
  82.             Key             =   "f5"
  83.          EndProperty
  84.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  85.             Picture         =   "frmCg.frx":B42E
  86.             Key             =   ""
  87.          EndProperty
  88.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  89.             Picture         =   "frmCg.frx":B588
  90.             Key             =   "del"
  91.          EndProperty
  92.          BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  93.             Picture         =   "frmCg.frx":B6E2
  94.             Key             =   "cz"
  95.          EndProperty
  96.          BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  97.             Picture         =   "frmCg.frx":B83C
  98.             Key             =   ""
  99.          EndProperty
  100.          BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  101.             Picture         =   "frmCg.frx":B996
  102.             Key             =   "new"
  103.          EndProperty
  104.          BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  105.             Picture         =   "frmCg.frx":BF30
  106.             Key             =   "view"
  107.          EndProperty
  108.          BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  109.             Picture         =   "frmCg.frx":C4CA
  110.             Key             =   ""
  111.          EndProperty
  112.          BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  113.             Picture         =   "frmCg.frx":CA64
  114.             Key             =   "save"
  115.          EndProperty
  116.          BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  117.             Picture         =   "frmCg.frx":CFFE
  118.             Key             =   "cute"
  119.          EndProperty
  120.          BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  121.             Picture         =   "frmCg.frx":D598
  122.             Key             =   "copy"
  123.          EndProperty
  124.          BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  125.             Picture         =   "frmCg.frx":DB32
  126.             Key             =   "paste"
  127.          EndProperty
  128.          BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  129.             Picture         =   "frmCg.frx":E0CC
  130.             Key             =   "xg"
  131.          EndProperty
  132.          BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  133.             Picture         =   "frmCg.frx":E666
  134.             Key             =   "serch"
  135.          EndProperty
  136.          BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  137.             Picture         =   "frmCg.frx":EC00
  138.             Key             =   "info"
  139.          EndProperty
  140.          BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  141.             Picture         =   "frmCg.frx":F19A
  142.             Key             =   ""
  143.          EndProperty
  144.          BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  145.             Picture         =   "frmCg.frx":F734
  146.             Key             =   ""
  147.          EndProperty
  148.          BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  149.             Picture         =   "frmCg.frx":FCCE
  150.             Key             =   ""
  151.          EndProperty
  152.          BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  153.             Picture         =   "frmCg.frx":10268
  154.             Key             =   "exit"
  155.          EndProperty
  156.       EndProperty
  157.    End
  158.    Begin VB.PictureBox picSplitter 
  159.       BackColor       =   &H00808080&
  160.       BorderStyle     =   0  'None
  161.       FillColor       =   &H00808080&
  162.       Height          =   4920
  163.       Left            =   3120
  164.       ScaleHeight     =   2142.379
  165.       ScaleMode       =   0  'User
  166.       ScaleWidth      =   780
  167.       TabIndex        =   6
  168.       Top             =   960
  169.       Visible         =   0   'False
  170.       Width           =   72
  171.    End
  172.    Begin MSComctlLib.TreeView tvTreeView 
  173.       Height          =   4920
  174.       Left            =   0
  175.       TabIndex        =   5
  176.       Top             =   945
  177.       Width           =   3090
  178.       _ExtentX        =   5450
  179.       _ExtentY        =   8678
  180.       _Version        =   393217
  181.       HideSelection   =   0   'False
  182.       Indentation     =   529
  183.       LabelEdit       =   1
  184.       Style           =   7
  185.       HotTracking     =   -1  'True
  186.       SingleSel       =   -1  'True
  187.       ImageList       =   "ImageList1"
  188.       Appearance      =   1
  189.    End
  190.    Begin MSComctlLib.ListView lvListView 
  191.       Height          =   4920
  192.       Left            =   3135
  193.       TabIndex        =   4
  194.       Top             =   945
  195.       Width           =   13410
  196.       _ExtentX        =   23654
  197.       _ExtentY        =   8678
  198.       View            =   3
  199.       LabelEdit       =   1
  200.       LabelWrap       =   -1  'True
  201.       HideSelection   =   -1  'True
  202.       FullRowSelect   =   -1  'True
  203.       _Version        =   393217
  204.       Icons           =   "imlViewBIcon"
  205.       SmallIcons      =   "imlViewSIcon"
  206.       ColHdrIcons     =   "imlViewSIcon"
  207.       ForeColor       =   -2147483640
  208.       BackColor       =   -2147483643
  209.       BorderStyle     =   1
  210.       Appearance      =   1
  211.       NumItems        =   0
  212.    End
  213.    Begin VB.PictureBox picTitles 
  214.       Align           =   1  'Align Top
  215.       Appearance      =   0  'Flat
  216.       BorderStyle     =   0  'None
  217.       ForeColor       =   &H80000008&
  218.       Height          =   300
  219.       Left            =   0
  220.       ScaleHeight     =   300
  221.       ScaleWidth      =   15240
  222.       TabIndex        =   1
  223.       TabStop         =   0   'False
  224.       Top             =   585
  225.       Width           =   15240
  226.       Begin VB.Label lblTitle 
  227.          BorderStyle     =   1  'Fixed Single
  228.          Caption         =   " 列表视图:"
  229.          Height          =   270
  230.          Index           =   1
  231.          Left            =   3165
  232.          TabIndex        =   3
  233.          Tag             =   " 列表视图:"
  234.          Top             =   15
  235.          Width           =   11850
  236.       End
  237.       Begin VB.Label lblTitle 
  238.          BorderStyle     =   1  'Fixed Single
  239.          Caption         =   " 单据:"
  240.          Height          =   270
  241.          Index           =   0
  242.          Left            =   0
  243.          TabIndex        =   2
  244.          Tag             =   " 树形视图:"
  245.          Top             =   15
  246.          Width           =   3090
  247.       End
  248.    End
  249.    Begin MSComctlLib.Toolbar ToolBartb 
  250.       Align           =   1  'Align Top
  251.       Height          =   585
  252.       Left            =   0
  253.       TabIndex        =   0
  254.       Top             =   0
  255.       Width           =   15240
  256.       _ExtentX        =   26882
  257.       _ExtentY        =   1032
  258.       ButtonWidth     =   820
  259.       ButtonHeight    =   926
  260.       Appearance      =   1
  261.       Style           =   1
  262.       ImageList       =   "ImageList1"
  263.       _Version        =   393216
  264.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  265.          NumButtons      =   9
  266.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  267.             Caption         =   "新增"
  268.             Key             =   "news"
  269.             ImageKey        =   "new"
  270.          EndProperty
  271.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  272.             Caption         =   "修改"
  273.             Key             =   "modis"
  274.             ImageKey        =   "xg"
  275.          EndProperty
  276.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  277.             Caption         =   "删除"
  278.             Key             =   "dels"
  279.             ImageKey        =   "del"
  280.          EndProperty
  281.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  282.             Caption         =   "查看"
  283.             Key             =   "infos"
  284.             ImageKey        =   "info"
  285.          EndProperty
  286.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  287.             Style           =   3
  288.          EndProperty
  289.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  290.             Caption         =   "图标"
  291.             Key             =   "view"
  292.             ImageKey        =   "view"
  293.             Style           =   5
  294.             BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628} 
  295.                NumButtonMenus  =   5
  296.                BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  297.                   Key             =   "dtb"
  298.                   Text            =   "大图标"
  299.                EndProperty
  300.                BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  301.                   Key             =   "xtb"
  302.                   Text            =   "小图标"
  303.                EndProperty
  304.                BeginProperty ButtonMenu3 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  305.                   Key             =   "lb"
  306.                   Text            =   "列表"
  307.                EndProperty
  308.                BeginProperty ButtonMenu4 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  309.                   Key             =   "xxzl"
  310.                   Text            =   "详细资料"
  311.                EndProperty
  312.                BeginProperty ButtonMenu5 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  313.                EndProperty
  314.             EndProperty
  315.          EndProperty
  316.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  317.             Caption         =   "查找"
  318.             Key             =   "Find"
  319.             ImageKey        =   "cz"
  320.          EndProperty
  321.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  322.             Style           =   3
  323.          EndProperty
  324.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  325.             Caption         =   "关闭"
  326.             Key             =   "exit"
  327.             ImageKey        =   "exit"
  328.          EndProperty
  329.       EndProperty
  330.    End
  331.    Begin MSComDlg.CommonDialog dlgCommonDialog 
  332.       Left            =   13560
  333.       Top             =   2040
  334.       _ExtentX        =   847
  335.       _ExtentY        =   847
  336.       _Version        =   393216
  337.    End
  338.    Begin MSComctlLib.ImageList imlViewBIcon 
  339.       Left            =   600
  340.       Top             =   0
  341.       _ExtentX        =   1005
  342.       _ExtentY        =   1005
  343.       BackColor       =   -2147483643
  344.       ImageWidth      =   32
  345.       ImageHeight     =   32
  346.       MaskColor       =   12632256
  347.       _Version        =   393216
  348.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  349.          NumListImages   =   17
  350.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  351.             Picture         =   "frmCg.frx":10642
  352.             Key             =   "boy"
  353.          EndProperty
  354.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  355.             Picture         =   "frmCg.frx":10A94
  356.             Key             =   "girl"
  357.          EndProperty
  358.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  359.             Picture         =   "frmCg.frx":10EE6
  360.             Key             =   "bboy1"
  361.          EndProperty
  362.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  363.             Picture         =   "frmCg.frx":11F3A
  364.             Key             =   "bgirl"
  365.          EndProperty
  366.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  367.             Picture         =   "frmCg.frx":12F8E
  368.             Key             =   "group"
  369.          EndProperty
  370.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  371.             Picture         =   "frmCg.frx":15740
  372.             Key             =   "add"
  373.          EndProperty
  374.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  375.             Picture         =   "frmCg.frx":15B92
  376.             Key             =   "modify2"
  377.          EndProperty
  378.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  379.             Picture         =   "frmCg.frx":15FE4
  380.             Key             =   "modify"
  381.          EndProperty
  382.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  383.             Picture         =   "frmCg.frx":162FE
  384.             Key             =   "del"
  385.          EndProperty
  386.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  387.             Picture         =   "frmCg.frx":16458
  388.             Key             =   "info"
  389.          EndProperty
  390.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  391.             Picture         =   "frmCg.frx":169F2
  392.             Key             =   "info2"
  393.          EndProperty
  394.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  395.             Picture         =   "frmCg.frx":18CA4
  396.             Key             =   "search"
  397.          EndProperty
  398.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  399.             Picture         =   "frmCg.frx":1923E
  400.             Key             =   "warn"
  401.          EndProperty
  402.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  403.             Picture         =   "frmCg.frx":195D8
  404.             Key             =   "setting"
  405.          EndProperty
  406.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  407.             Picture         =   "frmCg.frx":198F2
  408.             Key             =   "lstView"
  409.          EndProperty
  410.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  411.             Picture         =   "frmCg.frx":19C0C
  412.             Key             =   "exit"
  413.          EndProperty
  414.          BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  415.             Picture         =   "frmCg.frx":1FEA6
  416.             Key             =   "bboy"
  417.          EndProperty
  418.       EndProperty
  419.    End
  420.    Begin MSComctlLib.ImageList imlViewSIcon 
  421.       Left            =   0
  422.       Top             =   0
  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   =   7
  432.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  433.             Picture         =   "frmCg.frx":20AF8
  434.             Key             =   "group"
  435.          EndProperty
  436.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  437.             Picture         =   "frmCg.frx":20F4A
  438.             Key             =   "group2"
  439.          EndProperty
  440.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  441.             Picture         =   "frmCg.frx":236FC
  442.             Key             =   "boy"
  443.          EndProperty
  444.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  445.             Picture         =   "frmCg.frx":23B4E
  446.             Key             =   "girl"
  447.          EndProperty
  448.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  449.             Picture         =   "frmCg.frx":23FA0
  450.             Key             =   "sboy1"
  451.          EndProperty
  452.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  453.             Picture         =   "frmCg.frx":243F4
  454.             Key             =   "sgirl"
  455.          EndProperty
  456.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  457.             Picture         =   "frmCg.frx":24848
  458.             Key             =   "sboy"
  459.          EndProperty
  460.       EndProperty
  461.    End
  462.    Begin VB.Image imgSplitter 
  463.       Height          =   4785
  464.       Left            =   3120
  465.       MousePointer    =   9  'Size W E
  466.       Top             =   960
  467.       Width           =   150
  468.    End
  469. End
  470. Attribute VB_Name = "frmCg"
  471. Attribute VB_GlobalNameSpace = False
  472. Attribute VB_Creatable = False
  473. Attribute VB_PredeclaredId = True
  474. Attribute VB_Exposed = False
  475. '****************************************************************************
  476. '人人为我,我为人人
  477. '枕善居收藏整理
  478. '发布日期:2008/01/21
  479. '描    述:汽车维修管理系统SQL2000版
  480. '网    站:http://www.Mndsoft.com/  (VB6源码博客)
  481. '网    站:http://www.VbDnet.com/   (VB.NET源码博客,主要基于.NET2005)
  482. 'e-mail  :Mndsoft@163.com
  483. 'e-mail  :Mndsoft@126.com
  484. 'OICQ    :88382850
  485. '          如果您有新的好的代码别忘记给枕善居哦!
  486. '****************************************************************************
  487. Dim mbMoving As Boolean
  488. Const sglSplitLimit = 500
  489. Dim strName As String
  490. Private OK As Boolean               '确定用户按了OK还是CANCEL按钮
  491. Private mvarViewType As gxcViewType '显示类型,即表示当前是添加、查看、修改
  492. Const allSQL = "select ID,pID,pNum,pPrice,pDemo from SubStore"
  493. Public Sub AddClientToLvw(ByVal objClient As Recordset, _
  494.                           ByRef lvw As ListView, _
  495.                           ByVal IsOverWrite As Boolean)
  496.   Dim itm As ListItem
  497.   Dim sIcon As String
  498.   Dim bIcon As String
  499.     sIcon = "sboy"
  500.     bIcon = "bboy"
  501.   If IsOverWrite Then
  502.     Set itm = lvw.SelectedItem
  503.     If itm Is Nothing Then Exit Sub
  504.   Else
  505.     Set itm = lvw.ListItems.Add(, "A" & objClient("ID"), , bIcon, sIcon)
  506.   End If
  507.   With objClient  '这里要与InitClientListview相对应
  508.     itm.SmallIcon = sIcon
  509.     itm.Icon = bIcon
  510.     itm.Text = GetValueByID("PeiJian", "ID", .Fields(1).Value, "pName")
  511.     itm.SubItems(1) = GetValueByID("PeiJian", "ID", .Fields(1).Value, "pType")
  512.     itm.SubItems(2) = GetValueByID("PeiJian", "ID", .Fields(1).Value, "pUnit")
  513.     itm.SubItems(3) = GetValueByID("PeiJian", "ID", .Fields(1).Value, "pNum")
  514.     itm.SubItems(4) = GetValueByID("PeiJian", "ID", .Fields(1).Value, "pDemo")
  515.     itm.SubItems(5) = Val(.Fields(2).Value)
  516.     itm.SubItems(6) = Val(.Fields(3).Value)
  517.     itm.SubItems(7) = Val(.Fields(2).Value) * Val(.Fields(3).Value)
  518.     itm.SubItems(8) = .Fields(4).Value
  519.   End With
  520.   Set itm = Nothing
  521. End Sub
  522. '按照“客户”设置ListView的显示样式
  523. Public Sub InitClientListview(ByRef lvw As ListView)
  524.   With lvw
  525.     .ColumnHeaders.Clear
  526.     '加入四个列首
  527.     .ColumnHeaders.Add , , "名称", 1500
  528.     .ColumnHeaders.Add , , "规格", 1200
  529.     .ColumnHeaders.Add , , "单位", 800
  530.     .ColumnHeaders.Add , , "报件数量", 900
  531.     .ColumnHeaders.Add , , "报件时间", 1900
  532.     .ColumnHeaders.Add , , "采购数量", 900
  533.     .ColumnHeaders.Add , , "单价", 1000
  534.     .ColumnHeaders.Add , , "金额", 900
  535.     .ColumnHeaders.Add , , "备注", 2300
  536.   End With
  537. End Sub
  538. '将职员显示到ListView中
  539. Public Sub ClientsToListview(ByVal objClients As Recordset, ByRef lvw As ListView)
  540.   Dim i As Long
  541.   
  542.   If lvw.ColumnHeaders.Count = 0 Then InitClientListview lvw
  543.   lvw.ListItems.Clear '清除当前的列表内容
  544.   
  545.   For i = 1 To objClients.RecordCount
  546.     AddClientToLvw objClients.DataSource, lvw, False
  547.     objClients.MoveNext
  548.   Next i
  549. End Sub
  550. ' 显示全部客户到列表控件
  551. Public Sub ListAllClients(ByRef lvw As ListView)
  552.   Dim rstClients As New Recordset
  553.   Set rstClients = g_Conn.Execute(allSQL)
  554.   ClientsToListview rstClients, lvw
  555.   Set rstClients = Nothing
  556. End Sub
  557. Private Sub cmdAddNews_Click()
  558. frm_CFM.mvarViewType = vtadd
  559. frm_CFM.Show vbModal
  560. If frm_CFM.OK = True Then AddTypeToTvw tvTreeView, g_Conn.Execute("select A.ID,c.clkName,A.Fdate from Store A left join Clerk c on c.clkID=A.cID Where A.ID=" & MaxID("Store", "ID"))
  561. End Sub
  562. Private Sub cmdDeletes_Click()
  563. If MsgBox("真的要删除“" & tvTreeView.SelectedItem.Text & "”吗?", vbQuestion + vbYesNo + _
  564.         vbDefaultButton2) = vbNo Then Exit Sub
  565. On Error Resume Next
  566. g_Conn.BeginTrans
  567. g_Conn.Execute ("Delete from Store where ID=" & GetID(tvTreeView.SelectedItem.Key))
  568. g_Conn.Execute ("Delete from SubStore where sID=" & GetID(tvTreeView.SelectedItem.Key))
  569. If Err.Number = 0 Then g_Conn.CommitTrans Else g_Conn.RollbackTrans: MsgBox Err.Description
  570. tvTreeView.Nodes.Remove tvTreeView.SelectedItem.Index
  571. End Sub
  572. Private Sub cmdModifys_Click()
  573. If GetID(tvTreeView.SelectedItem.Key) = 0 Then Exit Sub
  574. frm_CFM.mvarID = tvTreeView.SelectedItem.Key
  575. frm_CFM.mvarViewType = vtModify
  576. frm_CFM.Show vbModal
  577. 'If frm_CFM.OK = True Then Refrs
  578. End Sub
  579. Private Sub cmdClose_Click()
  580.     Unload Me
  581. End Sub
  582. Private Sub Form_Load()
  583.     InitClientListview lvListView '初始化列表
  584.     TypeToTreeview tvTreeView
  585. End Sub
  586. Private Sub Form_Resize()
  587.     On Error Resume Next
  588.     If Me.Width < 3000 Then Me.Width = 3000
  589.     SizeControls imgSplitter.Left
  590. End Sub
  591. Private Sub imgSplitter_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  592.     With imgSplitter
  593.         picSplitter.Move .Left, .Top, .Width  2, .Height - 20
  594.     End With
  595.     picSplitter.Visible = True
  596.     mbMoving = True
  597. End Sub
  598. Private Sub imgSplitter_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  599.     Dim sglPos As Single
  600.     
  601.     If mbMoving Then
  602.         sglPos = x + imgSplitter.Left
  603.         If sglPos < sglSplitLimit Then
  604.             picSplitter.Left = sglSplitLimit
  605.         ElseIf sglPos > Me.Width - sglSplitLimit Then
  606.             picSplitter.Left = Me.Width - sglSplitLimit
  607.         Else
  608.             picSplitter.Left = sglPos
  609.         End If
  610.     End If
  611. End Sub
  612. Private Sub imgSplitter_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  613.     SizeControls picSplitter.Left
  614.     picSplitter.Visible = False
  615.     mbMoving = False
  616. End Sub
  617. Private Sub TreeView1_DragDrop(Source As Control, x As Single, y As Single)
  618.     If Source = imgSplitter Then
  619.         SizeControls x
  620.     End If
  621. End Sub
  622. Sub SizeControls(x As Single)
  623.     On Error Resume Next
  624.     
  625.     '设置 Width 属性
  626.     If x < 1500 Then x = 1500
  627.     If x > (Me.Width - 1500) Then x = Me.Width - 1500
  628.     tvTreeView.Width = x
  629.     imgSplitter.Left = x
  630.     lvListView.Left = x + 40
  631.     lvListView.Width = Me.Width - (tvTreeView.Width + 140)
  632.     lblTitle(0).Width = tvTreeView.Width
  633.     lblTitle(1).Left = lvListView.Left + 20
  634.     lblTitle(1).Width = lvListView.Width - 40
  635.     '设置 Top 属性
  636.   
  637.     If ToolBartb.Visible Then
  638.         tvTreeView.Top = ToolBartb.Height + picTitles.Height
  639.     Else
  640.         tvTreeView.Top = picTitles.Height
  641.     End If
  642.     lvListView.Top = tvTreeView.Top
  643.     
  644.     '设置 height 属性
  645.         tvTreeView.Height = Me.ScaleHeight - (picTitles.Top + picTitles.Height)
  646.     lvListView.Height = tvTreeView.Height
  647.     imgSplitter.Top = tvTreeView.Top
  648.     imgSplitter.Height = tvTreeView.Height
  649. End Sub
  650. Public Sub TypeToTreeview(ByRef tvw As TreeView)
  651.   Dim i As Long
  652.   Dim Nd As Node
  653.   Dim Rs As Recordset
  654.   Set Nd = tvw.Nodes.Add(, , "A0", "所有单据", "A0")
  655.   
  656.   Nd.Expanded = True
  657.   Nd.Selected = True
  658. Set Rs = g_Conn.Execute("select A.ID,c.clkName,A.Fdate from Store A left join Clerk c on c.clkID=A.cID where A.Type=1")
  659.   For i = 1 To Rs.RecordCount
  660.     Set Nd = tvw.Nodes.Add("A0", tvwChild, "A" & Rs(0), Rs(1) & "(" & Rs(2) & ")", "A1")
  661.     Nd.Expanded = True
  662.  Rs.MoveNext
  663.   Next i
  664. End Sub
  665. Public Sub AddTypeToTvw(ByRef tvw As TreeView, objID As Recordset)
  666.   On Error Resume Next
  667.      tvw.Nodes.Add "A0", tvwChild, "A" & objID.Fields(0), objID.Fields(1) & "(" & objID.Fields(2) & ")", "A1"
  668. End Sub
  669. Private Sub ToolBartb_ButtonClick(ByVal Button As MSComctlLib.Button)
  670. Select Case Button.Key
  671.     Case "exit"
  672.         cmdClose_Click
  673.     Case "news"
  674.         If g_QX(5) Then cmdAddNews_Click Else MsgBox qMSG
  675.     Case "modis"
  676.         If g_QX(5) Then cmdModifys_Click Else MsgBox qMSG
  677.     Case "dels"
  678.         If g_QX(5) Then cmdDeletes_Click Else MsgBox qMSG
  679.     Case "infos"
  680.         tvTreeView_DblClick
  681.     Case "view"
  682.         If lvListView.View = lvwIcon Then
  683.             lvListView.View = lvwSmallIcon
  684.         ElseIf lvListView.View = lvwSmallIcon Then
  685.             lvListView.View = lvwList
  686.         ElseIf lvListView.View = lvwList Then
  687.             lvListView.View = lvwReport
  688.         ElseIf lvListView.View = lvwReport Then
  689.             lvListView.View = lvwIcon
  690.         End If
  691. End Select
  692. End Sub
  693. Private Sub ToolBartb_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
  694. Select Case ButtonMenu.Key
  695.     Case "dtb"
  696.         lvListView.View = lvwIcon
  697.     Case "xtb"
  698.         lvListView.View = lvwSmallIcon
  699.     Case "lb"
  700.         lvListView.View = lvwList
  701.     Case "xxzl"
  702.         lvListView.View = lvwReport
  703. End Select
  704. End Sub
  705. Private Sub tvTreeView_DblClick()
  706. frm_CFM.mvarID = tvTreeView.SelectedItem.Key
  707. frm_CFM.mvarViewType = vtinfo
  708. frm_CFM.Show vbModal
  709. End Sub
  710. Private Sub tvTreeView_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  711. Dim menuRight As Menu
  712. Set menuRight = frmMain.mnuCg
  713. If Button = 2 Then PopupMenu menuRight
  714. End Sub
  715. Private Sub tvTreeView_NodeClick(ByVal Node As MSComctlLib.Node)
  716. Dim Rst As New ADODB.Recordset
  717.     Set Rst = g_Conn.Execute(allSQL & " where sID=" & GetID(Me.tvTreeView.SelectedItem.Key))
  718.     ClientsToListview Rst, lvListView
  719. End Sub