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

📄 frmsell.frm

📁 本科毕业设计-商贸有限公司销售管理系统(论文+源代码+答辩PPT)
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3480
      TabIndex        =   19
      Top             =   360
      Width           =   1215
   End
   Begin VB.Label lblfcname 
      Caption         =   "客户名称:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   18
      Top             =   840
      Width           =   1095
   End
   Begin VB.Label lbltype 
      Caption         =   "型号:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3720
      TabIndex        =   17
      Top             =   1200
      Width           =   855
   End
   Begin VB.Label lblprice 
      Caption         =   "单价:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   16
      Top             =   2040
      Width           =   975
   End
   Begin VB.Label lblquantity 
      Caption         =   "数量:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3600
      TabIndex        =   15
      Top             =   1920
      Width           =   975
   End
   Begin VB.Label lblselltime 
      Caption         =   "销售日期:"
      Height          =   375
      Left            =   120
      TabIndex        =   14
      Top             =   2880
      Width           =   975
   End
End
Attribute VB_Name = "frmSell"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
   Dim rs_custom As New ADODB.Recordset
   Dim rs_supply As New ADODB.Recordset
   Dim rs_name As New ADODB.Recordset
   Dim rs_add As New ADODB.Recordset
   Dim rs_check As New ADODB.Recordset
Private Sub frmsell_unload(Cancel As Integer)
conn.Close
End Sub
Private Sub cmdReset_Click()
   Comboname.Text = ""
   Combo1.Text = ""
   Combo3.Text = ""
   txtType.Text = ""
   txtPrice.Text = 0
   txtQuantity.Text = 0
   Comboy.Text = ""
   Combom.Text = ""
   Combod.Text = ""
   txtemployee.Text = ""
   Txtmoney.Text = ""
   Combo2.Text = ""
   Comboname.SetFocus
End Sub

Private Sub cmdSell_Click()
   txtGoodsNo.Enabled = False
    Dim price As Currency
    Dim quantity As Double
    Dim money As Currency
    price = Val(txtPrice.Text)
    quantity = txtQuantity.Text
    money = price * quantity
    Txtmoney.Text = money
   If Combo1.Text = "" Then
       MsgBox "请填写客户名称!", vbOKOnly + vbInformation, "注意"
       Combo1.SetFocus
       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
       Exit Sub
    ElseIf Not IsNumeric(txtPrice.Text) Then
        MsgBox "商品价格请输入数字!", vbOKOnly + vbExclamation, ""
        txtPrice.SetFocus
       Exit Sub
    ElseIf txtQuantity.Text = "" Then
       MsgBox "请填写商品数量!", vbOKOnly + vbInformation, "注意"
       txtQuantity.SetFocus
       Exit Sub
    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 sqlcheck As String
   sqlcheck = "select * from goods where 商品名='" & txtName.Text & _
   "'and 生产厂商='" & Combo3.Text & "'and 型号='" & txtType.Text & "'"
   rs_check.CursorLocation = adUseClient   '设定游标类型
   rs_check.Open sqlcheck, conn, adOpenKeyset, adLockPessimistic
   If rs_check.EOF = True Then
      MsgBox "对不起,此商品型号已无货!请选择其他类型!", vbOKOnly + vbInformation, "注意"
      rs_check.Close
      Exit Sub
   ElseIf rs_check.Fields(6) < Val(txtQuantity.Text) Then
      MsgBox "此型号商品不足!", vbOKOnly + vbInformation, "注意"
      rs_check.Close
      Exit Sub
   End If
   Dim sqlsell As String
   sqlsell = "select * from sell"
   rs_add.Open sqlsell, conn, adOpenKeyset, adLockPessimistic
   '添加入销售表
   rs_add.AddNew
       rs_add.Fields(1) = Combo1.Text
       rs_add.Fields(2) = Comboname.Text
       rs_add.Fields(3) = Combo3.Text
       rs_add.Fields(4) = txtType.Text
       rs_add.Fields(5) = txtPrice.Text
       rs_add.Fields(6) = Val(txtQuantity.Text)
       rs_add.Fields(7) = Val(Txtmoney.Text)
       rs_add.Fields(8) = Comboy.Text
       rs_add.Fields(9) = Combom.Text
       rs_add.Fields(10) = Combod.Text
       rs_add.Fields(11) = txtemployee.Text
       rs_add.Fields(12) = Combo2.Text
   rs_add.Update
   
   '从现存商品表中减去
   Dim oldquantity As Long '用于存放goods表中原来的此商品数量
   Dim oldmoney As Long  '用于存放goods表中原来的此商品进货总额
   oldquantity = rs_check.Fields(5)
   oldmoney = rs_check.Fields(6)
   rs_check.Fields(5) = oldquantity - Val(txtQuantity.Text)
   rs_check.Fields(6) = oldmoney - (rs_check.Fields(5)) * Val(txtQuantity.Text)
   rs_check.Update
   rs_check.Close
   rs_add.Close
   MsgBox "销售成功!", vbOKOnly + vbExclamation, "注意"
End Sub

Private Sub Command1_Click()
frmaddnewcustom.Show
frmSell.Hide
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 sql As String
   sql = "select * from customername"
   rs_custom.CursorLocation = adUseClient
   rs_custom.Open sql, conn, adOpenKeyset, adLockPessimistic
   While Not rs_custom.EOF
      Combo1.AddItem rs_custom.Fields(0)
      rs_custom.MoveNext
   Wend
   rs_custom.Close
    
   Dim sqlsu As String
   sqlsu = "select * from supplyername"
   rs_supply.CursorLocation = adUseClient
   rs_supply.Open sqlsu, conn, adOpenKeyset, adLockPessimistic
   While Not rs_supply.EOF
      Combo3.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 + -