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

📄 purchase.frm

📁 这个商品销售管理系统实现了几乎所有的功能,并通过验收
💻 FRM
📖 第 1 页 / 共 3 页
字号:
         Left            =   -73620
         TabIndex        =   12
         Top             =   975
         Width           =   2745
      End
      Begin VB.Label Label8 
         Alignment       =   1  'Right Justify
         BackStyle       =   0  'Transparent
         Caption         =   "商品名称:"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00987758&
         Height          =   285
         Left            =   -73635
         TabIndex        =   11
         Top             =   1410
         Width           =   2745
      End
      Begin VB.Label Label9 
         Alignment       =   1  'Right Justify
         BackStyle       =   0  'Transparent
         Caption         =   "单位:"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00987758&
         Height          =   285
         Left            =   -73635
         TabIndex        =   10
         Top             =   1830
         Width           =   2745
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H00FFFFFF&
         BackStyle       =   1  'Opaque
         BorderColor     =   &H00764E10&
         Height          =   4185
         Left            =   -75000
         Top             =   360
         Width           =   8535
      End
      Begin VB.Shape Shape2 
         BackColor       =   &H00FFFFFF&
         BackStyle       =   1  'Opaque
         BorderColor     =   &H00764E10&
         Height          =   4185
         Left            =   0
         Top             =   360
         Width           =   8535
      End
   End
   Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSHFlexGrid1 
      Height          =   2775
      Left            =   240
      TabIndex        =   31
      Top             =   1800
      Width           =   8295
      _ExtentX        =   14631
      _ExtentY        =   4895
      _Version        =   393216
      HighLight       =   0
      _NumberOfBands  =   1
      _Band(0).Cols   =   2
   End
   Begin VB.Line Line4 
      BorderColor     =   &H00764E10&
      BorderWidth     =   2
      X1              =   5865
      X2              =   6285
      Y1              =   1245
      Y2              =   1065
   End
   Begin VB.Line Line3 
      BorderColor     =   &H00764E10&
      BorderWidth     =   2
      X1              =   6255
      X2              =   8760
      Y1              =   1065
      Y2              =   1065
   End
   Begin VB.Line Line2 
      BorderColor     =   &H00764E10&
      BorderWidth     =   2
      X1              =   30
      X2              =   8760
      Y1              =   1275
      Y2              =   1275
   End
   Begin VB.Label loginbar 
      Alignment       =   2  'Center
      BackColor       =   &H00FFFFFF&
      BackStyle       =   0  'Transparent
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000C0&
      Height          =   285
      Left            =   6180
      TabIndex        =   9
      Top             =   1050
      Width           =   2565
   End
   Begin VB.Line Line1 
      BorderColor     =   &H00764E10&
      BorderWidth     =   2
      X1              =   30
      X2              =   8760
      Y1              =   5370
      Y2              =   5370
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "四维商品销售管理系统"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   27.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00764E10&
      Height          =   675
      Left            =   2520
      TabIndex        =   8
      Top             =   375
      Width           =   7245
   End
   Begin VB.Image Image1 
      Appearance      =   0  'Flat
      Height          =   1470
      Left            =   15
      Picture         =   "purchase.frx":0496
      Stretch         =   -1  'True
      Top             =   30
      Width           =   2520
   End
End
Attribute VB_Name = "purchase"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False



Private Sub cmdsave1_Click()
    If txtname.Text = "" Then
        MsgBox "Enter A 商品名称 Please:", vbCritical
        txtname.SetFocus
        Exit Sub
    End If
        
    If Not validity2(txtname, "Name") Then
        txtname.SetFocus
        Exit Sub
    End If
    
    If txtdw.Text = "" Then
        MsgBox "Enter A 单位 Please:", vbCritical
        txtdw.SetFocus
        Exit Sub
    End If
    
    If Not validity2(txtdw, "Description") Then
        txtdw.SetFocus
        Exit Sub
    End If
        
    If txtjj.Text = "" Then
        MsgBox "Enter A 进价 Please:", vbCritical
        txtjj.SetFocus
        Exit Sub
    End If
        
    If Not IsNumeric(txtjj.Text) Then
        MsgBox "商品进价 should be Numeric!", vbCritical
        txtjj.SetFocus
        Exit Sub
    End If
    
    If CLng(txtjj.Text) < 0 Then
        MsgBox "Cannot Enter Negative Values In 进价!", vbCritical
        txtjj.SetFocus
        Exit Sub
    End If
    
    If txtnum.Text = "" Then
        MsgBox "Enter A 数量 Please:", vbCritical
        txtnum.SetFocus
        Exit Sub
    End If
        
    If Not IsNumeric(txtnum.Text) Then
        MsgBox "数量 should be Numeric!", vbCritical
        txtnum.SetFocus
        Exit Sub
    End If
    
    If CCur(txtnum.Text) < 0 Then
        MsgBox "Cannot Enter Negative Values In Cost!", vbCritical
        txtnum.SetFocus
        Exit Sub
    End If
    
  '  If txtcost.Text = "" Then
   ' MsgBox "总金额不能为空!", vbCritical
   ' txtcost.SetFocus
   ' Exit Sub
   ' End If
       
   ' If Not IsNumeric(txtcost.Text) Then
   ' MsgBox "总金额 should be numeric!", vbCritical
   ' txtcost.SetFocus
   '   Exit Sub
    '  End If
    ' If txtjj.Text <> "" & txtnum.Text <> "" Then
    ' txtcost.Text = Val(txtjj.Text) * Val(txtnum.Text)
     'Exit Sub
     'End If

 
    Call openconn
    sqlstr = "insert into 进货信息表 values('" & txtserial.Text & "','" & txtname.Text & "','" & txtdw.Text & "'," & CLng(txtjj.Text) & "," & CCur(txtnum.Text) & ",'" & txtcost.Text & "','" & DTPicker1.Value & "')"
    Call rs(sqlstr)
    Call closeconn
    
    MsgBox "商品 Entry Saved Successfully!", vbInformation
        
    Unload Me
End Sub

Private Sub cmdsave2_Click()
      If txtname2.Text = "" Then
        MsgBox "Enter A 商品名称 Please:", vbCritical
        txtname.SetFocus
        Exit Sub
    End If
        
    If Not validity2(txtname2, "Name") Then
        txtname2.SetFocus
        Exit Sub
    End If
        
    If txtjj2.Text = "" Then
        MsgBox "Enter A 进价 Please:", vbCritical
        txtjj.SetFocus
        Exit Sub
    End If
        
    If Not IsNumeric(txtjj2.Text) Then
        MsgBox "商品进价 should be Numeric!", vbCritical
        txtjj2.SetFocus
        Exit Sub
    End If
    
    If CLng(txtjj2.Text) < 0 Then
        MsgBox "Cannot Enter Negative Values In 进价!", vbCritical
        txtjj2.SetFocus
        Exit Sub
    End If
    
    If txtnum2.Text = "" Then
        MsgBox "Enter A 数量 Please:", vbCritical
        txtnum2.SetFocus
        Exit Sub
    End If
        
    If Not IsNumeric(txtnum2.Text) Then
        MsgBox "数量 should be Numeric!", vbCritical
        txtnum2.SetFocus
        Exit Sub
    End If
    
    If CCur(txtnum2.Text) < 0 Then
        MsgBox "Cannot Enter Negative Values In Cost!", vbCritical
        txtnum2.SetFocus
        Exit Sub
    End If
        
    
    Call openconn
    sqlstr = "update 进货信息表 set 名称='" & txtname2.Text & "' where 商品编号 = '" & Combo1.Text & "'"
    Call rs(sqlstr)
   sqlstr = "update 进货信息表 set 进价='" & txtjj2.Text & "' where 商品编号 = '" & Combo1.Text & "'"
    Call rs(sqlstr)
   sqlstr = "update 进货信息表 set 数量='" & txtnum2.Text & "' where 商品编号 = '" & Combo1.Text & "'"
    Call rs(sqlstr)
   sqlstr = "update 进货信息表 set 总金额='" & txtcost2.Text & "' where 商品编号 = '" & Combo1.Text & "'"
    Call rs(sqlstr)
    sqlstr = "update 进货信息表 set 进货日期='" & DTPicker2.Value & "' where 商品编号 = '" & Combo1.Text & "'"
    Call rs(sqlstr)
    
    Call closeconn
    
    MsgBox "商品 Entry Saved Successfully!", vbInformation
        
    Unload Me
End Sub

Private Sub Combo1_Click()
Combo3.ListIndex = Combo1.ListIndex
Combo2.ListIndex = Combo1.ListIndex
End Sub


Private Sub Combo2_Click()
Combo1.ListIndex = Combo2.ListIndex
Combo3.ListIndex = Combo2.ListIndex
End Sub


Private Sub Combo3_Click()
Combo1.ListIndex = Combo3.ListIndex
Combo2.ListIndex = Combo3.ListIndex

End Sub


Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Command4_Click()

  If (Combo1.ListIndex = -1) Then
        MsgBox "Please Select 商品编号 Cloth from the Drop Down Box!", vbCritical
        Combo1.SetFocus
    Exit Sub
    End If
    Call openconn
    
   sqlstr = "select 进价, 数量, 总金额,进货日期 from 进货信息表 where 商品编号='" & Combo1.Text & "' and 名称 = '" & Combo2.Text & "' and 单位 = '" & Combo3.Text & "'"
    
    Call rs(sqlstr)
    
    If adoRS.EOF Then
        MsgBox "NO Purchase Selected", vbCritical
    Exit Sub
    End If
        
    txtname2.Text = Combo2.Text
    
    txtjj2.Text = adoRS.Fields("进价")
    txtnum2.Text = adoRS.Fields("数量")
    txtcost2.Text = adoRS.Fields("总金额")
   'txtdate2.Text = adoRS.Fields("进货日期")
    DTPicker2.Value = adoRS.Fields("进货日期")
      Call closeconn
    End Sub

Private Sub Command5_Click()
Unload Me
End Sub



Private Sub Form_Load()
Dim purchaselist As String
purchaselist = "select *  from 进货信息表"
Call Adodc(purchaselist, Adodc1, MSHFlexGrid2)
 Call openconn
    sqlstr = "select 商品编号 from 进货信息表"
    Call rs(sqlstr)
  
      
    If (adoRS.EOF) Then
        txtserial.Text = "001"
    Else
        hello = adoRS.Sort
        adoRS.MoveLast
        txtserial.Text = Right("00" & CStr(CLng(adoRS.Fields(0)) + 1), 10)
    End If
    
    Call closeconn
    
    Call openconn
    sqlstr = "select 商品编号, 名称, 单位 from 进货信息表"
    Call rs(sqlstr)
    
    If Not (adoRS.EOF) Then
        hello = adoRS.Sort
        adoRS.MoveFirst
        While Not (adoRS.EOF)
            Combo1.AddItem adoRS.Fields("商品编号")
            Combo2.AddItem adoRS.Fields("名称")
            Combo3.AddItem adoRS.Fields("单位")
            adoRS.MoveNext
        Wend
    End If
    
    Call closeconn
End Sub

Private Sub Form_Unload(Cancel As Integer)
Unload Me
MainForm2.Show

End Sub

Private Sub txtcost_GotFocus()
     Dim a As Double
     Dim b As Double
     a = Val(txtjj.Text)
     b = Val(txtnum.Text)
     txtcost.Text = a * b
End Sub

Private Sub txtcost2_GotFocus()
   Dim a As Double
     Dim b As Double
     a = Val(txtjj2.Text)
     b = Val(txtnum2.Text)
     txtcost2.Text = a * b
End Sub

⌨️ 快捷键说明

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