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

📄 frmaddgoods.frm

📁 超市管理系统是一个超市不可缺少的部分,它的内容对于超市的决策者和管理者来说都至关重要,所以超市管理系统应该能够为用户提供充足的信息和快捷的销售
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Height          =   255
         Left            =   720
         TabIndex        =   27
         Top             =   2760
         Width           =   975
      End
      Begin VB.Label Label8 
         BackStyle       =   0  'Transparent
         Caption         =   "销货价:"
         Height          =   255
         Left            =   3840
         TabIndex        =   26
         Top             =   2160
         Width           =   975
      End
      Begin VB.Label Label7 
         BackStyle       =   0  'Transparent
         Caption         =   "进货价:"
         Height          =   255
         Left            =   720
         TabIndex        =   25
         Top             =   2160
         Width           =   855
      End
      Begin VB.Label Label6 
         BackStyle       =   0  'Transparent
         Caption         =   "数量:"
         Height          =   255
         Left            =   3840
         TabIndex        =   24
         Top             =   1560
         Width           =   855
      End
      Begin VB.Label Label5 
         BackStyle       =   0  'Transparent
         Caption         =   "型号:"
         Height          =   255
         Left            =   720
         TabIndex        =   23
         Top             =   1560
         Width           =   975
      End
      Begin VB.Label Label4 
         BackStyle       =   0  'Transparent
         Caption         =   "生产厂商:"
         Height          =   255
         Left            =   3840
         TabIndex        =   22
         Top             =   960
         Width           =   975
      End
      Begin VB.Label Label3 
         BackStyle       =   0  'Transparent
         Caption         =   "商品名称:"
         Height          =   255
         Left            =   720
         TabIndex        =   21
         Top             =   960
         Width           =   975
      End
      Begin VB.Label Label2 
         BackStyle       =   0  'Transparent
         Caption         =   "商品编号:"
         Height          =   255
         Left            =   3840
         TabIndex        =   20
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "进货编号:"
         Height          =   255
         Left            =   720
         TabIndex        =   19
         Top             =   360
         Width           =   975
      End
   End
End
Attribute VB_Name = "frmAddgoods"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' 在通用中定义的有关连接数据表的记录集
Dim rs_goods As New ADODB.Recordset
Dim rs_buy As New ADODB.Recordset
Dim rs_manufacturer As New ADODB.Recordset
Dim str_goods As String
Dim str_buy As String
Dim str_manufacturer As String
Dim Numgooods As Integer
Private Sub Command1_Click()
'对入库时做的一些屏蔽操作!
   If Text1.Text = "" Then
       MsgBox "请填写进货编号!", vbOKOnly + vbInformation, "注意"
       Text1.SetFocus
       Exit Sub
    ElseIf Text2.Text = "" Then
       MsgBox "请填写商品编号!", vbOKOnly + vbInformation, "注意"
       Text2.SetFocus
       Exit Sub
    ElseIf Text3.Text = "" Then
       MsgBox "请填写商品名称!", vbOKOnly + vbInformation, "注意"
       Text3.SetFocus
       Exit Sub
    ElseIf Text4.Text = "" Then
       MsgBox "请填写生产厂商!", vbOKOnly + vbInformation, "注意"
       Text4.SetFocus
       Exit Sub
    ElseIf Text5.Text = "" Then
       MsgBox "请填写商品型号!", vbOKOnly + vbInformation, "注意"
       Text5.SetFocus
       Exit Sub
    ElseIf Text6.Text = "" Then
       MsgBox "请填写商品数量!", vbOKOnly + vbInformation, "注意"
       Text6.SetFocus
       Exit Sub
    ElseIf Text7.Text = "" Then
       MsgBox "请填写商品进货价格!", vbOKOnly + vbInformation, "注意"
       Text7.SetFocus
       Exit Sub
    ElseIf Text8.Text = "" Then
       MsgBox "请填写商品销货价格!", vbOKOnly + vbInformation, "注意"
       Text8.SetFocus
       Exit Sub
    ElseIf Text13.Text = "" Then
       MsgBox "请填写进货总金额!", vbOKOnly + vbInformation, "注意"
       Text13.SetFocus
       Exit Sub
    End If
 '下面是对进货表进行添加记录操作!
   str_buy = "select * from buy where 进货编号='" & Text1.Text & "'"
   rs_buy.Open str_buy, cnn, adOpenStatic, adLockOptimistic        ' 打开进货表
   If rs_buy.EOF = True Then
     rs_buy.AddNew
     rs_buy.Fields("进货编号") = Text1.Text
     rs_buy.Fields("商品名称") = Text3.Text
     rs_buy.Fields("生产厂商") = Text4.Text
     rs_buy.Fields("型号") = Text5.Text
     rs_buy.Fields("数量") = Val(Text6.Text)
     rs_buy.Fields("进货价") = Val(Text7.Text)
     rs_buy.Fields("进货年") = Text9.Text
     rs_buy.Fields("进货月") = Text10.Text
     rs_buy.Fields("进货日") = Text11.Text
     rs_buy.Fields("业务员编号") = Text12.Text
     rs_buy.Fields("总金额") = Val(Text13.Text)
     rs_buy.Update
     rs_buy.Close                                                   ' 关闭进货表
   Else
    MsgBox "此进货编号已存在,请重添!", vbOKOnly + vbInformation, "注意"
    Text1.Text = ""
    Text1.SetFocus
    rs_buy.Close
    Exit Sub                                                        ' 关闭进货表
   End If
'下面是对商品库存表进行入库操作!
   Dim sql As String
   sql = "select * from goods where 商品编号 = '" & Text2.Text & "'"
   rs_goods.Open sql, cnn, adOpenStatic, adLockOptimistic
  If rs_goods.EOF = True Then
     rs_goods.Close
     str_goods = "select * from goods"
     rs_goods.Open str_goods, cnn, adOpenStatic, adLockOptimistic ' 打开库存表
     rs_goods.AddNew
     rs_goods.Fields("商品编号") = Text2.Text
     rs_goods.Fields("商品名称") = Text3.Text
     rs_goods.Fields("生产厂商") = Text4.Text
     rs_goods.Fields("型号") = Text5.Text
     rs_goods.Fields("数量") = Val(Text6.Text)
     rs_goods.Fields("进货价") = Val(Text7.Text)
     rs_goods.Fields("销货价") = Val(Text8.Text)
     rs_goods.Update
     MsgBox "商品入库成功", vbOKOnly + vbExclamation, ""
     rs_goods.Close                                                ' 关闭库存表
   Else
     numgoods = rs_goods.Fields("数量")
     rs_goods.Fields("数量") = Val(Text6.Text) + numgoods
     rs_goods.Update
     MsgBox "商品入库成功", vbOKOnly + vbExclamation, ""
     rs_goods.Close                                                ' 关闭库存表
   End If
End Sub

Private Sub Command2_Click()
   Text1.Text = ""
   Text2.Text = ""
   Text3.Text = ""
   Text4.Text = ""
   Text5.Text = ""
   Text6.Text = ""
   Text7.Text = ""
   Text8.Text = ""
   Text13.Text = ""
End Sub

Private Sub Command3_Click()
'对入库时做的一些屏蔽操作!
   If Text14.Text = "" Then
       MsgBox "请填写厂商编号!", vbOKOnly + vbInformation, "注意"
       Text14.SetFocus
       Exit Sub
    ElseIf Text15.Text = "" Then
       MsgBox "请填写厂商名称!", vbOKOnly + vbInformation, "注意"
       Text15.SetFocus
       Exit Sub
    ElseIf Text16.Text = "" Then
       MsgBox "请填写厂商联系人姓名!", vbOKOnly + vbInformation, "注意"
       Text16.SetFocus
       Exit Sub
    ElseIf Text17.Text = "" Then
       MsgBox "请填写电话!", vbOKOnly + vbInformation, "注意"
       Text17.SetFocus
       Exit Sub
    ElseIf Text18.Text = "" Then
       MsgBox "请填写厂商地址!", vbOKOnly + vbInformation, "注意"
       Text18.SetFocus
       Exit Sub
    End If
'下面是对进货商表进行入库操作!
   str_manufacturer = "select * from manufacturer where 厂商编号='" & Text14.Text & "'"
   rs_manufacturer.Open str_manufacturer, cnn, adOpenStatic, adLockOptimistic
   If rs_manufacturer.EOF = True Then
       rs_manufacturer.AddNew
       rs_manufacturer.Fields("厂商编号") = Text14.Text
       rs_manufacturer.Fields("厂商名称") = Text15.Text
       rs_manufacturer.Fields("联系人姓名") = Text16.Text
       rs_manufacturer.Fields("电话") = Text17.Text
       rs_manufacturer.Fields("厂商地址") = Text18.Text
    rs_manufacturer.Update
    MsgBox "添加厂商成功", vbOKOnly + vbExclamation, ""
    rs_manufacturer.Close
   Else
    MsgBox "该编号已存在,请确认!", vbOKOnly + vbInformation, ""
      Text14.Text = ""
      Text14.SetFocus
      rs_manufacturer.Close
      Exit Sub
   End If
End Sub

Private Sub Command4_Click()
 Text14.Text = ""
 Text15.Text = ""
 Text16.Text = ""
 Text17.Text = ""
 Text18.Text = ""
End Sub

Private Sub Form_Load()
Text9.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
Text12.Enabled = False
Text9.Text = Year(Date)
Text10.Text = Month(Date)
Text11.Text = Day(Date)
Text12.Text = strs
End Sub

Private Sub Text2_Change()
'如果商品编号存在,则直接出现本商品的相关数据
str_goods = "select * from goods where 商品编号='" & Text2.Text & "'"
rs_goods.Open str_goods, cnn, adOpenStatic, adLockOptimistic
      Text3.Text = rs_goods.Fields("商品名称")
      Text4.Text = rs_goods.Fields("生产厂商")
      Text5.Text = rs_goods.Fields("型号")
      Text7.Text = rs_goods.Fields("进货价")
      Text8.Text = rs_goods.Fields("销货价")
rs_goods.Close
End Sub

Private Sub Text6_Change()
'总金额的直接出现操作
If Text7.Text <> "" Then
Text13.Text = Val(Text6.Text) * Val(Text7.Text)
End If
End Sub

Private Sub Text7_Change()
'总金额的直接出现操作
If Text6.Text <> "" Then
Text13.Text = Val(Text6.Text) * Val(Text7.Text)
End If
End Sub

⌨️ 快捷键说明

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