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

📄 frmretreatgoods.frm

📁 超市管理系统是一个超市不可缺少的部分,它的内容对于超市的决策者和管理者来说都至关重要,所以超市管理系统应该能够为用户提供充足的信息和快捷的销售
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmRetreatgoods 
   BackColor       =   &H000080FF&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "添加退货信息"
   ClientHeight    =   6240
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   7815
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "frmRetreatgoods.frx":0000
   ScaleHeight     =   6240
   ScaleWidth      =   7815
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text16 
      Height          =   375
      Left            =   5520
      TabIndex        =   35
      Top             =   3720
      Width           =   1935
   End
   Begin VB.TextBox Text15 
      Height          =   375
      Left            =   4440
      TabIndex        =   32
      Top             =   4320
      Width           =   855
   End
   Begin VB.TextBox Text14 
      Height          =   375
      Left            =   3120
      TabIndex        =   30
      Top             =   4320
      Width           =   855
   End
   Begin VB.TextBox Text13 
      Height          =   375
      Left            =   1680
      TabIndex        =   28
      Top             =   4320
      Width           =   855
   End
   Begin VB.TextBox Text12 
      Height          =   375
      Left            =   1680
      TabIndex        =   25
      Top             =   3720
      Width           =   1695
   End
   Begin VB.CommandButton Command2 
      Caption         =   "清空重添"
      Height          =   375
      Left            =   4680
      TabIndex        =   5
      Top             =   5520
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "退货"
      Height          =   375
      Left            =   1920
      TabIndex        =   4
      Top             =   5520
      Width           =   1215
   End
   Begin VB.TextBox Text11 
      Height          =   375
      Left            =   5520
      TabIndex        =   3
      Top             =   3120
      Width           =   1935
   End
   Begin VB.TextBox Text10 
      Height          =   375
      Left            =   1680
      TabIndex        =   12
      Top             =   3120
      Width           =   1695
   End
   Begin VB.TextBox Text9 
      Height          =   375
      Left            =   4440
      TabIndex        =   11
      Top             =   2520
      Width           =   855
   End
   Begin VB.TextBox Text8 
      Height          =   375
      Left            =   3120
      TabIndex        =   10
      Top             =   2520
      Width           =   855
   End
   Begin VB.TextBox Text7 
      Height          =   375
      Left            =   1680
      TabIndex        =   9
      Top             =   2520
      Width           =   855
   End
   Begin VB.TextBox Text6 
      Height          =   375
      Left            =   5520
      TabIndex        =   8
      Top             =   1920
      Width           =   1935
   End
   Begin VB.TextBox Text5 
      Height          =   375
      Left            =   1680
      TabIndex        =   7
      Top             =   1920
      Width           =   1695
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Left            =   5520
      TabIndex        =   6
      Top             =   1200
      Width           =   1935
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   1680
      TabIndex        =   1
      Top             =   1200
      Width           =   1695
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   5520
      TabIndex        =   2
      Top             =   480
      Width           =   1935
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1680
      TabIndex        =   0
      Top             =   480
      Width           =   1695
   End
   Begin VB.Label Label18 
      BackStyle       =   0  'Transparent
      Caption         =   "商品编号:"
      Height          =   255
      Left            =   4200
      TabIndex        =   34
      Top             =   3840
      Width           =   975
   End
   Begin VB.Label Label17 
      BackStyle       =   0  'Transparent
      Caption         =   "日"
      Height          =   255
      Left            =   5400
      TabIndex        =   33
      Top             =   4440
      Width           =   255
   End
   Begin VB.Label Label16 
      BackStyle       =   0  'Transparent
      Caption         =   "月"
      Height          =   255
      Left            =   4080
      TabIndex        =   31
      Top             =   4440
      Width           =   255
   End
   Begin VB.Label Label15 
      BackStyle       =   0  'Transparent
      Caption         =   "年"
      Height          =   255
      Left            =   2640
      TabIndex        =   29
      Top             =   4440
      Width           =   255
   End
   Begin VB.Label Label14 
      BackStyle       =   0  'Transparent
      Caption         =   "销售日期:"
      Height          =   495
      Left            =   360
      TabIndex        =   27
      Top             =   4440
      Width           =   1215
   End
   Begin VB.Label Label13 
      BackStyle       =   0  'Transparent
      Caption         =   "数量:"
      Height          =   255
      Left            =   4200
      TabIndex        =   26
      Top             =   3240
      Width           =   735
   End
   Begin VB.Label Label12 
      BackStyle       =   0  'Transparent
      Caption         =   "总金额:"
      Height          =   495
      Left            =   360
      TabIndex        =   24
      Top             =   3840
      Width           =   1215
   End
   Begin VB.Label Label11 
      BackStyle       =   0  'Transparent
      Caption         =   "业务员编号 :"
      Height          =   375
      Left            =   360
      TabIndex        =   23
      Top             =   3240
      Width           =   1215
   End
   Begin VB.Label Label10 
      BackStyle       =   0  'Transparent
      Caption         =   "日"
      Height          =   255
      Left            =   5400
      TabIndex        =   22
      Top             =   2640
      Width           =   255
   End
   Begin VB.Label Label9 
      BackStyle       =   0  'Transparent
      Caption         =   "月"
      Height          =   255
      Left            =   4080
      TabIndex        =   21
      Top             =   2640
      Width           =   255
   End
   Begin VB.Label Label8 
      BackStyle       =   0  'Transparent
      Caption         =   "年"
      Height          =   255
      Left            =   2640
      TabIndex        =   20
      Top             =   2640
      Width           =   255
   End
   Begin VB.Label Label7 
      BackStyle       =   0  'Transparent
      Caption         =   "退货日期:"
      Height          =   495
      Left            =   360
      TabIndex        =   19
      Top             =   2640
      Width           =   1215
   End
   Begin VB.Label Label6 
      BackStyle       =   0  'Transparent
      Caption         =   "单价:"
      Height          =   495
      Left            =   4200
      TabIndex        =   18
      Top             =   1920
      Width           =   1215
   End
   Begin VB.Label Label5 
      BackStyle       =   0  'Transparent
      Caption         =   "型号:"
      Height          =   495
      Left            =   360
      TabIndex        =   17
      Top             =   2040
      Width           =   1215
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "生产厂商:"
      Height          =   495
      Left            =   4200
      TabIndex        =   16
      Top             =   1320
      Width           =   1215
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "商品名称:"
      Height          =   495
      Left            =   360
      TabIndex        =   15
      Top             =   1320
      Width           =   1215
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "销货编号:"
      Height          =   255
      Left            =   4200
      TabIndex        =   14
      Top             =   600
      Width           =   975
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "退货编号:"
      Height          =   495
      Left            =   360
      TabIndex        =   13
      Top             =   600
      Width           =   1215
   End
End
Attribute VB_Name = "frmRetreatgoods"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
   Dim rs_retreat As New ADODB.Recordset
   Dim rs_goods As New ADODB.Recordset
   Dim rs_sell As New ADODB.Recordset
   Dim str_retreat As String
   Dim str_goods As String
   Dim str_sell As String
   Dim numsell As Integer
   Dim numgoods As Integer
   Dim countsell 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 Text11.Text = "" Then
       MsgBox "请填写商品数量!", vbOKOnly + vbInformation, "注意"
       Text11.SetFocus
       Exit Sub
End If
  '下面是对销售表进行操作!
   str_sell = "select * from sell where 销货编号='" & Text2.Text & "'"
   rs_sell.Open str_sell, cnn, adOpenStatic, adLockOptimistic
   If rs_sell.EOF = True Then
      MsgBox "对不起,没有销售此商品型号!无法退货!", vbOKOnly + vbInformation, "注意"
      rs_sell.Close
      Exit Sub
   ElseIf rs_sell.Fields("数量") < Val(Text11.Text) Then
      MsgBox "对不起,退货数量过大,无法退货!", vbOKOnly + vbInformation, "注意"
      rs_sell.Close
      Exit Sub
  End If
      rs_sell.Close

   '加入退货表
   str_retreat = "select * from retreat where 退货编号='" & Text1.Text & "'"
   rs_retreat.Open str_retreat, cnn, adOpenStatic, adLockOptimistic
   If rs_retreat.EOF = True Then
       rs_retreat.AddNew
       rs_retreat.Fields("退货编号") = Text1.Text
       rs_retreat.Fields("销货编号") = Text2.Text
       rs_retreat.Fields("商品名称") = Text3.Text
       rs_retreat.Fields("生产厂商") = Text4.Text
       rs_retreat.Fields("型号") = Text5.Text
       rs_retreat.Fields("单价") = Val(Text6.Text)
       rs_retreat.Fields("退货年") = Text7.Text
       rs_retreat.Fields("退货月") = Text8.Text
       rs_retreat.Fields("退货日") = Text9.Text
       rs_retreat.Fields("业务员编号") = Text10.Text
       rs_retreat.Fields("数量") = Val(Text11.Text)
       rs_retreat.Fields("总金额") = Val(Text12.Text)
       rs_retreat.Update
       rs_retreat.Close
   Else
      MsgBox "此退货编号已存在,请重添!", vbOKOnly + vbInformation, "注意"
      Text1.Text = ""
      Text1.SetFocus
      rs_retreat.Close
      Exit Sub
   End If
   '从销售商品表中减去
   str_sell = "select * from sell where 销货编号='" & Text2.Text & "'"
   rs_sell.Open str_sell, cnn, adOpenStatic, adLockOptimistic
   numsell = rs_sell.Fields("数量")
   countsell = rs_sell.Fields("总金额")
   rs_sell.Fields("数量") = numsell - Val(Text11.Text)
   rs_sell.Fields("总金额") = countsell - Val(Text12.Text)
   rs_sell.Update
   rs_sell.Close
   
   '加入现存商品表中
       Dim sql As String
       sql = "select * from goods where 商品编号 = '" & Text16.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(Text11.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(Text11.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 = ""
   Text11.Text = ""
   Text12.Text = ""
End Sub

Private Sub Form_Load()
Text7.Text = Year(Date)
Text8.Text = Month(Date)
Text9.Text = Day(Date)
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Text12.Enabled = False
Text13.Enabled = False
Text14.Enabled = False
Text15.Enabled = False
Text16.Enabled = False
End Sub

Private Sub Text11_Change()
If Text6.Text <> "" Then
   Text12.Text = Val(Text6.Text) * Val(Text11.Text)
End If
End Sub

Private Sub Text2_Change()
str_sell = "select * from sell where 销货编号='" & Text2.Text & "'"
rs_sell.Open str_sell, cnn, adOpenStatic, adLockOptimistic
Text3.Text = rs_sell.Fields("商品名称")
Text4.Text = rs_sell.Fields("生产厂商")
Text5.Text = rs_sell.Fields("型号")
Text6.Text = rs_sell.Fields("单价")
Text10.Text = rs_sell.Fields("业务员编号")
Text13.Text = rs_sell.Fields("销售年")
Text14.Text = rs_sell.Fields("销售月")
Text15.Text = rs_sell.Fields("销售日")
Text16.Text = rs_sell.Fields("商品编号")
rs_sell.Close
End Sub


⌨️ 快捷键说明

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