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

📄 frm_stock.frm

📁 这个商品销售管理系统实现了几乎所有的功能,并通过验收
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         _ExtentX        =   14843
         _ExtentY        =   7858
         _Version        =   393216
      End
      Begin MSComctlLib.Toolbar Toolbar1 
         Height          =   885
         Left            =   -75000
         TabIndex        =   28
         Top             =   480
         Width           =   5535
         _ExtentX        =   9763
         _ExtentY        =   1561
         ButtonWidth     =   2408
         ButtonHeight    =   1402
         Appearance      =   1
         ImageList       =   "ImageList1"
         _Version        =   393216
         BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
            NumButtons      =   4
            BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "明细账本"
               ImageIndex      =   1
               BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628} 
                  NumButtonMenus  =   2
                  BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Object.Tag             =   "1"
                  EndProperty
                  BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                  EndProperty
               EndProperty
            EndProperty
            BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "库存上下限设置"
               ImageIndex      =   2
            EndProperty
            BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "打印库存数据"
               ImageIndex      =   3
            EndProperty
            BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "退出窗体"
            EndProperty
         EndProperty
         BorderStyle     =   1
      End
      Begin MSAdodcLib.Adodc Adodc3 
         Height          =   375
         Left            =   -70320
         Top             =   5640
         Visible         =   0   'False
         Width           =   2175
         _ExtentX        =   3836
         _ExtentY        =   661
         ConnectMode     =   0
         CursorLocation  =   3
         IsolationLevel  =   -1
         ConnectionTimeout=   15
         CommandTimeout  =   30
         CursorType      =   3
         LockType        =   3
         CommandType     =   8
         CursorOptions   =   0
         CacheSize       =   50
         MaxRecords      =   0
         BOFAction       =   0
         EOFAction       =   0
         ConnectStringType=   1
         Appearance      =   1
         BackColor       =   -2147483643
         ForeColor       =   -2147483640
         Orientation     =   0
         Enabled         =   -1
         Connect         =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=BMS"
         OLEDBString     =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=BMS"
         OLEDBFile       =   ""
         DataSourceName  =   ""
         OtherAttributes =   ""
         UserName        =   ""
         Password        =   ""
         RecordSource    =   ""
         Caption         =   "Adodc3"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         _Version        =   393216
      End
   End
   Begin VB.Label Label6 
      Caption         =   "Label6"
      Height          =   495
      Left            =   3480
      TabIndex        =   0
      Top             =   2520
      Width           =   1215
   End
End
Attribute VB_Name = "save"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Sub yao()
  Dim qty As Integer
  Dim price As Single
     Adodc2.RecordSource = "select * from tb_stock order by qty"
     Adodc2.Refresh
     For i = 1 To Adodc2.Recordset.RecordCount
       MS2.TextMatrix(i, 1) = Adodc2.Recordset.Fields("tradecode").Value
       MS2.TextMatrix(i, 2) = Adodc2.Recordset.Fields("fullname").Value
       MS2.TextMatrix(i, 3) = Val(Adodc2.Recordset.Fields("qty").Value)
       If Adodc2.Recordset.Fields("averageprice").Value = 0 Then
          MS2.TextMatrix(i, 4) = Adodc2.Recordset.Fields("price").Value
        Else
          MS2.TextMatrix(i, 4) = Val(Adodc2.Recordset.Fields("averageprice").Value)
        End If
        MS2.TextMatrix(i, 5) = Val(MS2.TextMatrix(i, 4)) * Val(MS2.TextMatrix(i, 3))
        Adodc2.Recordset.MoveNext
        qty = qty + Val(MS2.TextMatrix(i, 4))
        price = price + MS2.TextMatrix(i, 5)
    Next i
    
        
End Sub
Sub msf1()
   MS1.Cols = 11
   MS1.ColWidth(0) = 12 * 25 * 1
   MS1.ColWidth(1) = 12 * 25 * 3
   MS1.ColWidth(2) = 12 * 25 * 6
   MS1.ColWidth(3) = 12 * 25 * 3
   MS1.ColWidth(4) = 12 * 25 * 3
   MS1.ColWidth(5) = 12 * 25 * 5
   MS1.ColWidth(6) = 12 * 25 * 3
   MS1.ColWidth(7) = 12 * 25 * 3
   MS1.ColWidth(8) = 12 * 25 * 3
   MS1.ColWidth(9) = 12 * 25 * 4
   MS1.ColWidth(10) = 12 * 25 * 4
   MS1.FixedRows = 1: MS1.FixedCols = 1
   MS1.TextMatrix(0, 0) = "NO"
   MS1.TextMatrix(0, 1) = "商品编号"
   MS1.TextMatrix(0, 2) = "商品名称"
   MS1.TextMatrix(0, 3) = "商品型号"
   MS1.TextMatrix(0, 4) = "商品规格"
   MS1.TextMatrix(0, 5) = "商品产地"
   MS1.TextMatrix(0, 6) = "商品单位"
   MS1.TextMatrix(0, 7) = "库存数量"
   MS1.TextMatrix(0, 8) = "盘点数量"
   MS1.TextMatrix(0, 9) = "盘点盈亏数量"
   MS1.TextMatrix(0, 10) = "盘点盈亏金额"
   Text8.Text = ""
   Text8.Width = MS1.CellWidth: Text8.Height = MS1.CellHeight
   Text8.Left = MS1.CellLeft + MS1.Left
   Text8.Top = MS1.CellTop + MS1.Top
   MS1.Col = 8
   
End Sub

Private Sub Command1_Click()
  On Error Resume Next
  Adodc3.RecordSource = "select * from tb_stock where tradecode='" + Adodc2.Recordset.Fields(0) + "'"
  Adodc3.Refresh
  If Err.Number > 0 Then
    If MsgBox("出现错误,是否继续?", "系统提示") = vbNo Then
      Frame1.Visible = False
      Exit Sub
    End If
    If Adodc3.Recordset.RecordCount > 0 Then
    Adodc3.Recordset.Fields("upperlimit").Value = Val(Text1.Text)
    Adodc3.Recordset.Fields("lowerlimit").Value = Val(Text2.Text)
    Adodc3.Recordset.Update
    MsgBox "设置成功!"
    Frame1.Visible = False
    Text1.Text = "": Text2.Text = ""
  Else
     MsgBox "无库存商品"
  End If
  
  
End Sub

Private Sub Command3_Click()
MS1.Clear
Adodc1.RecordSource = "select tradecode,fullname,type,standard,produce,unit,qty,stockcheck  From tb_stock  WHERE tradecode=" + Text3.Text + ""
'and(fullname LIKE '%"+text6+"%')and(type LIKE'%"+text4+"%'+"%')and(standard LIKE '%"+text5+"%')and(produce LIKE '%"+text7+"%')"


Adodc1.Refresh
Call msf1
If Adodc1.Recordset.RecordCount > 0 Then
   MS1.Rows = Adodc1.Recordset.RecordCount
   For i = 1 To Adodc1.Recordset.RecordCount
   
       MS1.TextMatrix(i, 1) = Adodc1.Recordset.Fields(0)
       MS1.TextMatrix(i, 2) = Adodc1.Recordset.Fields(1)
       MS1.TextMatrix(i, 3) = Adodc1.Recordset.Fields(2)
       MS1.TextMatrix(i, 4) = Adodc1.Recordset.Fields(3)
       MS1.TextMatrix(i, 5) = Adodc1.Recordset.Fields(4)
       MS1.TextMatrix(i, 6) = Adodc1.Recordset.Fields(5)
       MS1.TextMatrix(i, 7) = Adodc1.Recordset.Fields(6)
      On Error Resume Next
       MS1.TextMatrix(i, 8) = Adodc1.Recordset.Fields(7)
       Adodc1.Recordset.MoveNext
   Next i
   For i = 1 To MS1.Rows
      MS1.TextMatrix(i, 0) = i
   Next i
   Else
       MsgBox "无此商品"
    End If

   
    
End Sub

Private Sub DataCombo1_Change()
  If DataCombo1.Text = "" Then MsgBox "请选择商品名称!": Exit Sub
  Adodc2.RecordSource = "select * from tb_stock where fullname='" + DataCombo1.Text + "'"
  Adodc2.Refresh
  If Adodc2.Recordset.RecordCount > 0 Then
    On Error Resume Next
    Text1.Text = Adodc2.Recordset.Fields("upperlimit")
    Text2.Text = Adodc2.Recordset.Fields("lowerlimit")
  End If


End Sub

Private Sub Form_Load()
    Adodc1.RecordSource = "select tradecode,fullname,type,standard,produce,unit,qty,stockcheck from tb_stock"
    Adodc1.Refresh
    Call msf1
    If Adodc1.Recordset.RecordCount > 0 Then
     MS1.Rows = Adodc1.Recordset.RecordCount
    For i = 1 To Adodc1.Recordset.RecordCount
      MS1.TextMatrix(i, 1) = Adodc1.Recordset.Fields(0)
      MS1.TextMatrix(i, 2) = Adodc1.Recordset.Fields(1)
      MS1.TextMatrix(i, 3) = Adodc1.Recordset.Fields(2)
      MS1.TextMatrix(i, 4) = Adodc1.Recordset.Fields(3)
      MS1.TextMatrix(i, 5) = Adodc1.Recordset.Fields(4)
      MS1.TextMatrix(i, 6) = Adodc1.Recordset.Fields(5)
      MS1.TextMatrix(i, 7) = Adodc1.Recordset.Fields(6)
      On Error Resume Next
      MS1.TextMatrix(i, 8) = Adodc1.Recordset.Fields(7)
      Adodc1.Recordset.MoveNext
    Next i
  For i = 1 To MS1.Rows
      MS1.TextMatrix(i, 0) = i
  Next i
  Else
     MsgBox "仓库没有商品"
  End If
  Text3.Text = ""
  Text4.Text = ""
  Text5.Text = ""
  Text6.Text = ""
  Text7.Text = ""
  'Text1.Text = ""
  'Text2.Text = ""
  Adodc2.RecordSource = "select * from tb_stock"
  Adodc2.Refresh
  Adodc3.RecordSource = "select * from tb_stock"
  Adodc3.Refresh
  Set DataCombo1.DataSource = Adodc3
  Set DataCombo1.RowSource = Adodc3
  DataCombo1.ListField = "fullname"
  MS2.Rows = Adodc2.Recordset.RecordCount + 1: MS2.Cols = 6
  MS2.ColWidth(0) = 12 * 25 * 1
  MS2.ColWidth(1) = 12 * 25 * 4
  MS2.ColWidth(2) = 12 * 25 * 8
  MS2.ColWidth(3) = 12 * 25 * 3
  MS2.ColWidth(4) = 12 * 25 * 3
  MS2.ColWidth(5) = 12 * 25 * 3
  On Error Resume Next
  MS2.FixedRows = 1: MS2.FixedCols = 1
  MS2.TextMatrix(0, 0) = "NO"
  MS2.TextMatrix(0, 1) = "商品编号"
  MS2.TextMatrix(0, 2) = "商品全名"
  MS2.TextMatrix(0, 3) = "库存数量"
  MS2.TextMatrix(0, 4) = "成本均价"
  MS2.TextMatrix(0, 5) = "库存总价"
  For i = 1 To Adodc2.Recordset.RecordCount
      MS2.TextMatrix(i, 0) = i
Next i
Call yao

End Sub


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

End Sub

Private Sub MS1_Click()
   MS1.Text = Text8.Text
   Text8.Text = MS1.Text
 If MS1.Col = 8 Then
   Text8.Visible = True
   Text8.SetFocus
   Text8.Locked = False
 Else
   Text8.Locked = True
 End If
 
End Sub

Private Sub MS1_EnterCell()
 Dim X As String, Y As String, p As String
 If MS1.CellWidth <= 0 Or MS1.CellHeight <= 0 Then Exit Sub
    X = MS1.TextMatrix(MS1.FixedRows, MS1.Col)
    Y = MS1.TextMatrix(MS1.Row, 0)
 If Y <> "" Then
   If MS1.Col - MS1.LeftCol <= 3 Then
      MS1.LeftCol = MS1.LeftCol + 1
   End If
   If MS1.CellWidth > 0 And MS1.CellHeight > 0 Then
      Text8.Width = MS1.CellWidth
      Text8.Height = MS1.CellHeight
      Text8.Left = MS1.CellLeft + MS1.Left
      Text8.Top = MS1.CellTop + MS1.Top
    End If
      X = MS1.TextMatrix(MS1.FixedRows, MS1.Col)
      Y = MS1.TextMatrix(MS1.Row, 0)
      p = MS1.TextMatrix(MS1.Row, MS1.Col)
      Text8.Text = MS1.Text
    End If
    
End Sub


Private Sub StatusBar1_PanelClick(ByVal Panel As MSComctlLib.Panel)

End Sub

Private Sub MSFlexGrid1_Click()

End Sub

Private Sub Text8_Keypress(keyascii As Integer)
  On Error Resume Next
  If keyascii = vbKeyReturn Then
    If MS1.Col = 8 Then: MS1.Text = Text8.Text: Text8.Text = MS1.Text
    If MS1.Col = 8 Then
      Adodc1.RecordSource = "select * from tb_stock where tradecode='" + MS1.TextMatrix(MS1.Row, 1) + "'"
      Adodc1.Refresh
      If Adodc1.Recordset.RecordCount > 0 Then
        MS1.TextMatrix(MS1.Row, 9) = Val(MS1.TextMatrix(MS1.Row, 8)) - Val(MS1.TextMatrix(MS1.Row, 7))
        If Adodc1.Recordset.Fields("averageprice").Value = 0 Then
        MS1.TextMatrix(MS1.Row, 10) = Val(MS1.TextMatrix(MS1.Row, 9)) * Adodc1.Recordset.Fields("price").Value
        Else
        MS1.TextMatrix(MS1.Row, 10) = Val(MS1.TextMatrix(MS1.Row, 9)) * Adodc1.Recordset.Fields("averageprice").Value
        End If
        Adodc1.Recordset.Fields("stockcheck") = Val(MS1.TextMatrix(MS1.Row, 8))
        Adodc1.Recordset.Update
    End If
    MS1.Row = MS1.Row + 1
    MS1.Col = 8
 End If
End If


End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
  Select Case Button.Key
     Case Is = "明细账本"
        MS2.Visible = True
     Case Is = "库存上下限设置"
        Frame1.Visible = True
     Case Is = "退出"
        unlode Me
  End Select
    
End Sub

⌨️ 快捷键说明

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