⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addorderdialog.frm

📁 VB编写的简单销售管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form AddOrderDialog 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "添加订单"
   ClientHeight    =   3960
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   6000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3960
   ScaleWidth      =   6000
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame Frame1 
      Caption         =   "订单信息"
      Height          =   3255
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   5775
      Begin MSComCtl2.DTPicker DTPicker2 
         Height          =   300
         Left            =   3840
         TabIndex        =   19
         Top             =   2880
         Width           =   1815
         _ExtentX        =   3201
         _ExtentY        =   529
         _Version        =   393216
         Format          =   20054017
         CurrentDate     =   38718
      End
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   300
         Left            =   960
         TabIndex        =   18
         Top             =   2880
         Width           =   1815
         _ExtentX        =   3201
         _ExtentY        =   529
         _Version        =   393216
         Format          =   20054017
         CurrentDate     =   38718
      End
      Begin VB.ComboBox Combo3 
         Height          =   315
         Left            =   960
         Style           =   2  'Dropdown List
         TabIndex        =   12
         Top             =   1920
         Width           =   1815
      End
      Begin VB.ComboBox Combo2 
         Height          =   315
         Left            =   960
         Style           =   2  'Dropdown List
         TabIndex        =   8
         Top             =   1440
         Width           =   1815
      End
      Begin VB.ComboBox Combo1 
         Height          =   315
         Left            =   960
         Style           =   2  'Dropdown List
         TabIndex        =   6
         Top             =   960
         Width           =   1815
      End
      Begin VB.Label Label17 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   4680
         TabIndex        =   25
         Top             =   2400
         Width           =   975
      End
      Begin VB.Label Label16 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   3840
         TabIndex        =   24
         Top             =   1920
         Width           =   1815
      End
      Begin VB.Label Label15 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   3840
         TabIndex        =   23
         Top             =   1440
         Width           =   1815
      End
      Begin VB.Label Label14 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   3840
         TabIndex        =   22
         Top             =   960
         Width           =   1815
      End
      Begin VB.Label Label13 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   3840
         TabIndex        =   21
         Top             =   360
         Width           =   1815
      End
      Begin MSForms.ScrollBar ScrollBar1 
         Height          =   255
         Left            =   960
         TabIndex        =   20
         Top             =   2400
         Width           =   3615
         Size            =   "6376;450"
         Max             =   0
         LargeChange     =   10
      End
      Begin VB.Label Label12 
         Caption         =   "交货日期"
         Height          =   255
         Left            =   3000
         TabIndex        =   17
         Top             =   2880
         Width           =   855
      End
      Begin VB.Label Label11 
         Caption         =   "订购日期"
         Height          =   255
         Left            =   120
         TabIndex        =   16
         Top             =   2880
         Width           =   735
      End
      Begin VB.Label Label10 
         AutoSize        =   -1  'True
         Caption         =   "产品库存"
         Height          =   195
         Left            =   3000
         TabIndex        =   15
         Top             =   360
         Width           =   720
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "产品名称"
         Height          =   195
         Left            =   3000
         TabIndex        =   14
         Top             =   1920
         Width           =   720
      End
      Begin VB.Label Label9 
         AutoSize        =   -1  'True
         Caption         =   "订购数量"
         Height          =   195
         Left            =   120
         TabIndex        =   13
         Top             =   2400
         Width           =   720
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "产品编号"
         Height          =   195
         Left            =   120
         TabIndex        =   11
         Top             =   1920
         Width           =   720
      End
      Begin VB.Label Label6 
         Caption         =   "雇员姓名"
         Height          =   255
         Left            =   3000
         TabIndex        =   10
         Top             =   1440
         Width           =   735
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "雇员编号"
         Height          =   195
         Left            =   120
         TabIndex        =   9
         Top             =   1440
         Width           =   720
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "客户单位"
         Height          =   195
         Left            =   3000
         TabIndex        =   7
         Top             =   960
         Width           =   720
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "客户编号"
         Height          =   195
         Left            =   120
         TabIndex        =   5
         Top             =   960
         Width           =   720
      End
      Begin VB.Label Label2 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   960
         TabIndex        =   4
         Top             =   360
         Width           =   1815
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "订单编号"
         Height          =   195
         Left            =   120
         TabIndex        =   3
         Top             =   360
         Width           =   720
      End
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "取消"
      Height          =   375
      Left            =   3720
      TabIndex        =   1
      Top             =   3480
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "确定"
      Height          =   375
      Left            =   1200
      TabIndex        =   0
      Top             =   3480
      Width           =   1215
   End
End
Attribute VB_Name = "AddOrderDialog"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim MyDB As Database
Dim MyRecord As Recordset
Dim TempStr As String

Private Sub CancelButton_Click()
    Unload Me
End Sub

Private Sub Combo1_Click()
    Set MyRecord = MyDB.OpenRecordset("客户表")
    MyRecord.Index = "PrimaryKey"
    MyRecord.Seek "=", Combo1.Text
    If MyRecord.NoMatch Then
        MsgBox "没有编号为" + Combo1.Text + "的客户!"
    Else
        Label14.Caption = MyRecord.Fields("CompanyTitle")
    End If
End Sub

Private Sub Combo2_Click()
    Set MyRecord = MyDB.OpenRecordset("雇员表")
    MyRecord.Index = "PrimaryKey"
    MyRecord.Seek "=", Combo2.Text
    If MyRecord.NoMatch Then
        MsgBox "没有编号为" + Combo2.Text + "的雇员!"
    Else
        Label15.Caption = MyRecord.Fields("Name")
    End If
End Sub

Private Sub Combo3_Click()
    Set MyRecord = MyDB.OpenRecordset("产品表")
    MyRecord.Index = "PrimaryKey"
    MyRecord.Seek "=", Combo3.Text
    If MyRecord.NoMatch Then
        MsgBox "没有编号为" + Combo3.Text + "的产品!"
    Else
        Label16.Caption = MyRecord.Fields("Product")
        Label13.Caption = MyRecord.Fields("Quantity")
        ScrollBar1.Max = Val(MyRecord.Fields("Quantity"))
    End If
End Sub

Private Sub Form_Load()
    Set MyDB = OpenDatabase(VB.App.Path + "\MySampleDB.mdb", False, False)
    Set MyRecord = MyDB.OpenRecordset("订单表")
    MyRecord.Index = "PrimaryKey"
    MyRecord.MoveLast
    TempStr = MyRecord.Fields("OrderID")
    TempStr = "DD" & Format((Val(Right(TempStr, 5)) + 1), "0000#")
    Label2.Caption = TempStr
    Set MyRecord = MyDB.OpenRecordset("客户表")
    MyRecord.Index = "PrimaryKey"
    Do While Not MyRecord.EOF
        Combo1.AddItem MyRecord.Fields("CustomerID")
        MyRecord.MoveNext
    Loop
    Set MyRecord = MyDB.OpenRecordset("雇员表")
    MyRecord.Index = "PrimaryKey"
    Do While Not MyRecord.EOF
        Combo2.AddItem MyRecord.Fields("EmployeeID")
        MyRecord.MoveNext
    Loop
    Set MyRecord = MyDB.OpenRecordset("产品表")
    MyRecord.Index = "PrimaryKey"
    Do While Not MyRecord.EOF
        Combo3.AddItem MyRecord.Fields("ProductID")
        MyRecord.MoveNext
    Loop
End Sub

Private Sub Form_Unload(Cancel As Integer)
    MyRecord.Close
    MyDB.Close
End Sub

Private Sub OKButton_Click()
    If Combo1.Text = "" Or Combo2.Text = "" Or Combo3.Text = "" Or Label17.Caption = "" Then
        MsgBox "请填写完整信息!"
    Else
        TempStr = "INSERT INTO 订单表 VALUES ('" & Label2.Caption & "','" & Combo1.Text & _
                    "','" & Combo2.Text & "','" & DTPicker1.Value & "','" & Combo3.Text & _
                    "','" & Label17.Caption & "','" & DTPicker2.Value & "')"
        MyDB.Execute TempStr
        TempStr = "UPDATE 产品表 SET Quantity=" & (Val(Label13.Caption) - Val(Label17.Caption)) & _
                    " WHERE ProductID='" & Combo3.Text & "'"
        MyDB.Execute TempStr
        MsgBox "成功添加订单" & Label2.Caption & "!"
        Unload Me
    End If
End Sub

Private Sub ScrollBar1_Change()
    Label17.Caption = ScrollBar1.Value
End Sub

Private Sub ScrollBar1_Scroll()
    Label17.Caption = ScrollBar1.Value
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -