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

📄 frmputin.frm

📁 vb6.0 开发的一个 VB小型超市、个体户进销存系统源码
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Width           =   1125
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "商品代码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Index           =   5
      Left            =   600
      TabIndex        =   20
      Top             =   1185
      Width           =   1125
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "入库数量:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Index           =   9
      Left            =   5400
      TabIndex        =   19
      Top             =   2160
      Width           =   1125
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "入库日期:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Index           =   8
      Left            =   2640
      TabIndex        =   18
      Top             =   2160
      Width           =   1125
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "价格:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Index           =   7
      Left            =   600
      TabIndex        =   17
      Top             =   2160
      Width           =   675
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   180
      Left            =   360
      TabIndex        =   15
      Top             =   3240
      Width           =   90
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "商 品 入 库 信 息"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   495
      Left            =   1440
      TabIndex        =   0
      Top             =   0
      Width           =   5175
   End
End
Attribute VB_Name = "frmPutin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Cnumber As Integer

Private Sub Display()
    txtIcode.Text = RS.Fields("code")
    txtIname.Text = RS.Fields("name")
    txtJG.Text = RS.Fields("rate")
    DTPdate.Value = RS.Fields("date")
    txtNumber.Text = RS.Fields("number")
    txtIcode.Enabled = False
    txtIname.Enabled = False
    txtJG.Enabled = False
    DTPdate.Enabled = False
    txtNumber.Enabled = False
End Sub

Private Sub KJZT() '设定控件的可用状态
    txtIcode.Enabled = ZJ
    txtIname.Enabled = ZJ
    txtJG.Enabled = ZJ
    txtNumber.Enabled = ZJ
    DTPdate.Enabled = ZJ
    cmdSave.Enabled = ZJ
    cmdMoveF.Enabled = Not ZJ
    cmdMoveP.Enabled = Not ZJ
    cmdMoveL.Enabled = Not ZJ
    cmdMoveN.Enabled = Not ZJ
    cmdAdd.Enabled = Not ZJ
    cmdDel.Enabled = Not ZJ
    cmdUp.Enabled = Not ZJ
End Sub

Private Sub cmdAdd_Click()
    ZJ = True
    KJZT
    txtIcode.SetFocus
    txtIcode.Text = ""
    txtIname.Text = ""
    txtJG.Text = ""
    txtNumber.Text = ""
    DTPdate.Value = Date
    cmdSave.Enabled = True
    RS.AddNew
End Sub

Private Sub cmdClose_Click()
    Unload Me
End Sub

Private Sub cmdDel_Click()
    Dim Queren As Integer
    Queren = MsgBox("记录删除后将无法恢复,请谨慎使用此功能", vbYesNo + vbExclamation)
    If Queren = vbYes Then
        sql = "select * from 库存表 where 商品编号='" & txtIcode.Text & "'"
        Set RSUP = Db.OpenRecordset(sql)
        RSUP.Edit
        RSUP.Fields("库存数量") = RSUP.Fields("库存数量").Value - Val(txtNumber.Text)
        RSUP.Update
        RSUP.Close
        RS.Delete
        cmdMoveN_Click
    End If
End Sub

Private Sub cmdMoveF_Click()
    RS.MoveFirst
    cmdMoveP.Enabled = False
    cmdMoveN.Enabled = True
    Display
End Sub

Private Sub cmdMoveL_Click()
    RS.MoveLast
    cmdMoveP.Enabled = True
    cmdMoveN.Enabled = False
    Display
End Sub

Private Sub cmdMoveN_Click()
    RS.MoveNext
    cmdMoveP.Enabled = True
    If RS.EOF Then
    RS.MoveLast
    cmdMoveN.Enabled = False
    End If
    Display
End Sub

Private Sub cmdMoveP_Click()
    RS.MovePrevious
    cmdMoveN.Enabled = True
    If RS.BOF Then
    RS.MoveFirst
    cmdMoveP.Enabled = False
    End If
    Display
End Sub

Private Sub cmdSave_Click()
    RS.Fields("code") = txtIcode.Text
    RS.Fields("name") = txtIname.Text
    RS.Fields("rate") = txtJG.Text
    RS.Fields("date") = DTPdate.Value
    RS.Fields("number") = txtNumber.Text
    RS.Update
    RS.MoveLast
    sql = "select * from 库存表 where 商品编号='" & txtIcode.Text & "'"
    Set RSUP = Db.OpenRecordset(sql)
    If RSUP.EOF Then
        RSUP.AddNew
        RSUP.Fields("商品编号") = txtIcode.Text
        RSUP.Fields("商品名称") = txtIname.Text
        RSUP.Fields("库存数量") = txtNumber.Text
        RSUP.Update
    Else
        RSUP.Edit
        RSUP.Fields("库存数量") = Val(txtNumber.Text) + RSUP.Fields("库存数量").Value - Cnumber
        RSUP.Update
        Cnumber = 0
    End If
    RSUP.Close
    cmdSave.Enabled = False
    ZJ = False
    KJZT
End Sub

Private Sub cmdUp_Click()
    Cnumber = Val(txtNumber.Text)
    ZJ = True
    KJZT
    txtIcode.Enabled = False
    txtIname.Enabled = False
    RS.Edit
End Sub

Private Sub Form_Load()
    Me.Top = MDIForm1.Top + 1200
    Me.Left = MDIForm1.Left + 1800
    sql = "select * from 进货单 ORDER BY date"
    Set Db = OpenDatabase(App.Path + "\db1.mdb")
    Set RS = Db.OpenRecordset(sql)
    If RS.EOF Then
        MsgBox "记录为空,请先添加记录"
        ZJ = True
        KJZT
        RS.AddNew
    Else
        Display
    End If
    
End Sub

Private Sub txtIcode_Validate(Cancel As Boolean)
    Cancel = True
    If txtIcode = "" Then
        MsgBox "请输入商品代码"
    Else
        Cancel = False
    End If
End Sub

Private Sub txtIname_Validate(Cancel As Boolean)
    Cancel = True
    If txtIname = "" Then
        MsgBox "请输入商品名称"
    Else
        Cancel = False
    End If

End Sub


Private Sub txtJG_Validate(Cancel As Boolean)
    Cancel = True
    If Val(txtJG) <= 0 Then
        MsgBox "商品价格必须大于零"
    Else
        Cancel = False
    End If

End Sub

Private Sub txtNumber_Validate(Cancel As Boolean)
    Cancel = True
    If Val(txtNumber) <= 0 Then
        MsgBox "商品入库数量必须大于零"
    Else
        Cancel = False
    End If

End Sub

⌨️ 快捷键说明

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