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

📄 frmaddgoods.frm

📁 本科毕业设计-商贸有限公司销售管理系统(论文+源代码+答辩PPT)
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Height          =   255
         Left            =   3600
         TabIndex        =   27
         Top             =   840
         Width           =   855
      End
      Begin VB.Label lblprice 
         Caption         =   "单价:"
         Height          =   375
         Left            =   600
         TabIndex        =   26
         Top             =   1200
         Width           =   975
      End
      Begin VB.Label lblquantity 
         Caption         =   "数量:"
         Height          =   255
         Left            =   3600
         TabIndex        =   25
         Top             =   1200
         Width           =   975
      End
      Begin VB.Label lblbuytime 
         Caption         =   "进货日期:"
         Height          =   375
         Left            =   600
         TabIndex        =   24
         Top             =   1680
         Width           =   975
      End
      Begin VB.Label lblem 
         Caption         =   "业务员编号:"
         Height          =   375
         Left            =   600
         TabIndex        =   23
         Top             =   2280
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "年"
         Height          =   255
         Left            =   2400
         TabIndex        =   22
         Top             =   1800
         Width           =   255
      End
      Begin VB.Label Label2 
         Caption         =   "月"
         Height          =   255
         Left            =   3360
         TabIndex        =   21
         Top             =   1800
         Width           =   375
      End
      Begin VB.Label Label3 
         Caption         =   "日"
         Height          =   375
         Left            =   4320
         TabIndex        =   20
         Top             =   1800
         Width           =   375
      End
      Begin VB.Label Labelmoney 
         Caption         =   "总金额为:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   3360
         TabIndex        =   19
         Top             =   2280
         Width           =   1335
      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_supply As New ADODB.Recordset
Dim rs_name As New ADODB.Recordset
Dim rs_addfc As New ADODB.Recordset
Dim rs_add As New ADODB.Recordset
Dim rs_addfcname As New ADODB.Recordset

Private Sub cmdaddfc_Click()
     txtGoodsNo.Enabled = False
   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
    End If
    
    Dim sqlfc As String
       sqlfc = "select * from manufacturer"
   rs_addfc.Open sqlfc, conn, adOpenKeyset, adLockPessimistic
   rs_addfc.AddNew
       rs_addfc.Fields(1) = Text1.Text
       rs_addfc.Fields(2) = Text2.Text
       rs_addfc.Fields(3) = Text3.Text
       rs_addfc.Fields(4) = Text4.Text
   rs_addfc.Update
   Dim sqlfcn As String
    sqlfcn = "select * from supplyername"
   rs_addfcname.Open sqlfcn, conn, adOpenKeyset, adLockPessimistic
   rs_addfcname.AddNew
       rs_addfcname.Fields(0) = Text1.Text
   rs_addfcname.Update
   MsgBox "添加厂商成功", vbOKOnly + vbExclamation, ""
   rs_addfc.Close
   rs_addfcname.Close
End Sub
Private Sub txtPrice_Change()
If Not IsNumeric(txtPrice.Text) Then
        MsgBox "商品价格请输入数字!", vbOKOnly + vbExclamation, ""
        txtPrice.SetFocus
ElseIf Not IsNumeric(txtPrice.Text) Then
        MsgBox "商品数量请输入数字!", vbOKOnly + vbExclamation, ""
txtQuantity.SetFocus
ElseIf txtQuantity.Text <> "" And txtPrice.Text <> "" Then
txtmoney.Text = txtQuantity.Text * txtPrice.Text
End If
End Sub
Private Sub txtQuantity_Change()
If Not IsNumeric(txtPrice.Text) Then
        MsgBox "商品数量请输入数字!", vbOKOnly + vbExclamation, ""
txtQuantity.SetFocus
ElseIf Not IsNumeric(txtPrice.Text) Then
        MsgBox "商品价格请输入数字!", vbOKOnly + vbExclamation, ""
        txtPrice.SetFocus
ElseIf txtQuantity.Text <> "" And txtPrice.Text <> "" Then
txtmoney.Text = txtQuantity.Text * txtPrice.Text
End If
End Sub

Private Sub cmdadd_Click()
      
   txtGoodsNo.Enabled = False
      If Combo1.Text = "" Then
       MsgBox "请填写厂商名称!", vbOKOnly + vbInformation, "注意"
      Combo1.SetFocus          '使combo1获得光标焦点
       Exit Sub
    ElseIf Comboname.Text = "" Then
       MsgBox "请填写商品名称!", vbOKOnly + vbInformation, "注意"
       Comboname.SetFocus
       Exit Sub
    ElseIf txtType.Text = "" Then
       MsgBox "请填写商品型号!", vbOKOnly + vbInformation, "注意"
       txtType.SetFocus
       
       Exit Sub
    ElseIf txtPrice.Text = "" Then
       MsgBox "请填写商品价格!", vbOKOnly + vbInformation, "注意"
       txtPrice.SetFocus
    ElseIf Not IsNumeric(txtPrice.Text) Then
        MsgBox "商品价格请输入数字!", vbOKOnly + vbExclamation, ""
        txtPrice.SetFocus
       Exit Sub
    ElseIf txtQuantity.Text = "" Then
       MsgBox "请填写商品数量!", vbOKOnly + vbInformation, "注意"
       txtQuantity.SetFocus
    ElseIf Not IsNumeric(txtQuantity.Text) Then
        MsgBox "商品数量请输入数字!", vbOKOnly + vbExclamation, ""
        txtQuantity.SetFocus
          Exit Sub
    ElseIf Comboy.Text = "" Then
       MsgBox "请填写销售年份!", vbOKOnly + vbInformation, "注意"
       Comboy.SetFocus
       Exit Sub
    ElseIf Combom.Text = "" Then
       MsgBox "请填写销售月份!", vbOKOnly + vbInformation, "注意"
       Combom.SetFocus
       Exit Sub
    ElseIf Combod.Text = "" Then
       MsgBox "请填写销售日!", vbOKOnly + vbInformation, "注意"
       Combod.SetFocus
       Exit Sub
    ElseIf Txtemployee.Text = "" Then
       MsgBox "请填写业务员编号!", vbOKOnly + vbInformation, "注意"
       Txtemployee.SetFocus
       Exit Sub
    ElseIf txtmoney.Text = "" Then
     MsgBox "请填写总金额!", vbOKOnly + vbInformation, "注意"
      txtmoney.SetFocus
     Exit Sub
    ElseIf Not IsNumeric(txtmoney.Text) Then
      MsgBox "商品总金额请输入数字!", vbOKOnly + vbExclamation, ""
      txtmoney.SetFocus
      Exit Sub
    ElseIf Combo2.Text = "" Then
       MsgBox "请填写计量单位!", vbOKOnly + vbInformation, "注意"
       Combo2.SetFocus
       Exit Sub
    End If
    
    Dim sql As String
   sql = "select * from goods"
   rs_add.Open sql, conn, adOpenKeyset, adLockPessimistic
   rs_add.AddNew
       rs_add.Fields(1) = Combo1.Text
       rs_add.Fields(2) = Comboname.Text
       rs_add.Fields(3) = txtType.Text
       rs_add.Fields(4) = txtPrice.Text
       rs_add.Fields(5) = Val(txtQuantity.Text) '使用Val函数把TextBox.text中的文本型数据转换成数字型数据
       rs_add.Fields(6) = Val(txtmoney.Text)
       rs_add.Fields(7) = Comboy.Text
       rs_add.Fields(8) = Combom.Text
       rs_add.Fields(9) = Combod.Text
       rs_add.Fields(10) = Txtemployee.Text
       rs_add.Fields(11) = Combo2.Text
       
   rs_add.Update
   MsgBox "添加商品成功", vbOKOnly + vbExclamation, ""
   rs_add.Close
  
End Sub

Private Sub cmdReset_Click()
   Comboname.Text = ""
   Combo1.Text = ""
   txtType.Text = ""
   txtPrice.Text = ""
   txtQuantity.Text = ""
   txtmoney.Text = ""
   Comboy.Text = ""
   Combom.Text = ""
   Combod.Text = ""
   Txtemployee.Text = ""
   Combo2.Text = ""
   Comboname.SetFocus
End Sub

Private Sub cmdResetfc_Click()
   Text1.Text = ""
   Text2.Text = ""
   Text3.Text = ""
   Text4.Text = ""
   Text1.SetFocus
   
End Sub

Private Sub Form_Load()
    Dim X0 As Long
    Dim Y0 As Long
    '让窗体居中
    X0 = Screen.Width
    Y0 = Screen.Height
    X0 = (X0 - Me.Width) / 2
    Y0 = (Y0 - Me.Height) / 2
    Me.Move X0, Y0
    
     
   Dim sqlsu As String
   sqlsu = "select * from supplyername"
   rs_supply.CursorLocation = adUseClient
   rs_supply.Open sqlsu, conn, adOpenKeyset, adLockPessimistic
   While Not rs_supply.EOF
      Combo1.AddItem rs_supply.Fields(0)
      rs_supply.MoveNext
   Wend
   rs_supply.Close
   
   Dim sqlsu1 As String
   sqlsu1 = "select * from goodsname"
   rs_name.CursorLocation = adUseClient
   rs_name.Open sqlsu1, conn, adOpenKeyset, adLockPessimistic
   While Not rs_name.EOF
      Comboname.AddItem rs_name.Fields(0)
      rs_name.MoveNext
   Wend
   rs_name.Close
    
   '添加年份选项
    For i = 2003 To 2050
    Comboy.AddItem i
    Next i
    
    '添加月份选项
    For i = 1 To 12
    Combom.AddItem i
    Next i
      '添加日期选项
    For i = 1 To 31
    Combod.AddItem i
    Next i

End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload Me
End Sub

⌨️ 快捷键说明

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