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

📄 添加销售信息.frm

📁 基于VB+SQL Server的零食销售管理系统设计
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   14
         Top             =   600
         Width           =   975
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "顾客信息"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3135
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4695
      Begin VB.TextBox Text6 
         Height          =   375
         Left            =   3480
         TabIndex        =   13
         Top             =   2400
         Width           =   1095
      End
      Begin VB.TextBox Text4 
         Height          =   375
         Left            =   3480
         TabIndex        =   11
         Top             =   1440
         Width           =   1095
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   3480
         TabIndex        =   9
         Top             =   480
         Width           =   1095
      End
      Begin VB.TextBox Text5 
         Height          =   375
         Left            =   1080
         TabIndex        =   7
         Top             =   2400
         Width           =   1095
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   1080
         TabIndex        =   5
         Top             =   1440
         Width           =   1095
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   1080
         TabIndex        =   3
         ToolTipText     =   "请先按添加按钮再输入!"
         Top             =   480
         Width           =   1095
      End
      Begin VB.Label Label6 
         Caption         =   "联系电话"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2400
         TabIndex        =   12
         Top             =   2400
         Width           =   855
      End
      Begin VB.Label Label5 
         Caption         =   "城市名称"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   2400
         TabIndex        =   10
         Top             =   1560
         Width           =   975
      End
      Begin VB.Label Label4 
         Caption         =   "联系人姓名"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   2400
         TabIndex        =   8
         Top             =   600
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "邮政编码"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   6
         Top             =   2400
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "联系地址"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   4
         Top             =   1560
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "顾客名称"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   2
         Top             =   600
         Width           =   975
      End
   End
End
Attribute VB_Name = "添加销售信息"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim myres As ADODB.Recordset
Dim mycon As ADODB.Connection

Private Sub add_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
add.Enabled = False
ok.Enabled = True
End Sub

Private Sub ok_Click()
If Text1.Text = "" Then
MsgBox "顾客名称不能为空!", vbOKOnly + vbInformation, "提示"
Text1.SetFocus
Exit Sub
End If
If Text7.Text = "" Then
MsgBox "商品名称不能为空!", vbOKOnly + vbInformation, "提示"
Text1.SetFocus
Exit Sub
End If
Set myres = mycon.Execute("select * from 商品信息 where 商品名称='" & Text7.Text & "'")
If myres.EOF And myres.BOF Then
  MsgBox "库存中不存在此商品,无法完成销售操作!", vbOKOnly + vbInformation, "提示"
  Exit Sub
Else
Text8.Text = myres.Fields(1)
Text9.Text = myres.Fields(2)
End If
Set myres = mycon.Execute("select * from 顾客信息 where 顾客公司名称='" & Text1.Text & "'")
If myres.EOF And myres.BOF Then
mycon.Execute "insert 顾客信息 values ('" & Text1.Text & "' ,'" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text & "','" & Text6.Text & "')"
Else
Text2.Text = myres.Fields(1)
Text3.Text = myres.Fields(2)
Text4.Text = myres.Fields(3)
Text5.Text = myres.Fields(4)
Text6.Text = myres.Fields(5)
End If
Set myres = mycon.Execute("select 库存量 from 商品信息 where 商品名称= '" & Text7.Text & "'")
If myres.Fields("库存量") > Val(Trim(Text10.Text)) Then
mycon.Execute "insert 销售信息 values('" & Text1.Text & "' ,'" & Text7.Text & "','" & Text8.Text & "','" & Text9.Text & "','" & Text10.Text & "','" & Text11.Text & "','" & Text12.Text & "','" & Text13.Text & "')"
MsgBox "添加成功!", vbOKOnly + vbInformation, "提示"
add.Enabled = True
ok.Enabled = False
Else
MsgBox "库存不足,无法完成销售操作!", vbOKOnly + vbInformation, "提示"
End If
End Sub

Private Sub Form_Load()
Set mycon = New ADODB.Connection
mycon.Open "my", "sa"
Set myres = New ADODB.Recordset
ok.Enabled = False
End Sub

Private Sub quit_Click()
Unload Me
      系统主页.Show
      mycon.Close
Set mycon = Nothing
End Sub

⌨️ 快捷键说明

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