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

📄 进货表.frm

📁 图书馆管理系统的实现
💻 FRM
📖 第 1 页 / 共 2 页
字号:
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            _Version        =   393216
         End
         Begin MSAdodcLib.Adodc Adodc1 
            Height          =   330
            Left            =   1320
            Top             =   1680
            Visible         =   0   'False
            Width           =   2055
            _ExtentX        =   3625
            _ExtentY        =   582
            ConnectMode     =   0
            CursorLocation  =   3
            IsolationLevel  =   -1
            ConnectionTimeout=   15
            CommandTimeout  =   30
            CursorType      =   3
            LockType        =   3
            CommandType     =   1
            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=Bookdate;Data Source=127.0.0.1"
            OLEDBString     =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Bookdate;Data Source=127.0.0.1"
            OLEDBFile       =   ""
            DataSourceName  =   ""
            OtherAttributes =   ""
            UserName        =   "sa"
            Password        =   ""
            RecordSource    =   ""
            Caption         =   "Adodc1"
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "宋体"
               Size            =   9
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            _Version        =   393216
         End
         Begin MSFlexGridLib.MSFlexGrid FlxGd 
            Height          =   2655
            Left            =   120
            TabIndex        =   16
            Top             =   240
            Width           =   9255
            _ExtentX        =   16325
            _ExtentY        =   4683
            _Version        =   393216
         End
      End
      Begin VB.Label LabPriceIn 
         AutoSize        =   -1  'True
         Caption         =   "进货单价:"
         Height          =   180
         Left            =   4080
         TabIndex        =   26
         Top             =   4560
         Width           =   900
      End
      Begin VB.Label LabNum 
         AutoSize        =   -1  'True
         Caption         =   "数    量:"
         Height          =   180
         Left            =   4080
         TabIndex        =   25
         Top             =   4200
         Width           =   900
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "进货日期:"
         Height          =   180
         Left            =   4080
         TabIndex        =   24
         Top             =   5640
         Width           =   900
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "进货员编号:"
         Height          =   180
         Left            =   4080
         TabIndex        =   23
         Top             =   5280
         Width           =   1080
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "出版社:"
         Height          =   180
         Left            =   240
         TabIndex        =   22
         Top             =   5280
         Width           =   720
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "种    类:"
         Height          =   180
         Left            =   240
         TabIndex        =   21
         Top             =   5640
         Width           =   900
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "供货商编号:"
         Height          =   180
         Left            =   4080
         TabIndex        =   20
         Top             =   4920
         Width           =   1080
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "图书单价:"
         Height          =   180
         Left            =   240
         TabIndex        =   19
         Top             =   4920
         Width           =   900
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "图书名称:"
         Height          =   180
         Left            =   240
         TabIndex        =   18
         Top             =   4560
         Width           =   900
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "图书编号:"
         Height          =   180
         Left            =   240
         TabIndex        =   17
         Top             =   4200
         Width           =   900
      End
   End
End
Attribute VB_Name = "frmJinHuo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i%
Private Sub CmdAdd_Click()
    If TxtNum = "" Then
        MsgBox "请填写进货的数量", vbOKOnly + vbInformation, "提示"
        LabNum.BackColor = &H80C0FF
    ElseIf TxtPriceIn = "" Then
        MsgBox "请填写图书进价", vbOKOnly + vbInformation, "提示"
        LabPriceIn.BackColor = &H80C0FF
        Else
        If Val(TxtPriceIn) >= Val(Mid(TxtPrice, 2)) Then
    
            MsgBox "进货价高于图书单价!", vbOKOnly + vbExclamation, "图书进价有误"
            LabPriceIn.BackColor = &H80FF&
            Exit Sub
        End If
        Dim row%
        For row = 1 To i - 1
            If FlxGd.TextMatrix(row, 2) = TxtFind Then '如果第row行,第1列(既图书编号)=查找的图书编号
                Dim s%
                s = Val(FlxGd.TextMatrix(row, 5))
                FlxGd.TextMatrix(row, 5) = str(s + Val(Trim(TxtNum))) & "本"
                'FlxGd.TextMatrix(row, 5) = str(Val(FlxGd.TextMatrix(row, 5) + Val(Trim(TxtNum)))) & "本" '为先前添加过的图书数量上自加
                FlxGd.TextMatrix(row, 4) = "¥" & Trim(TxtPriceIn)
                Exit Sub
            End If
        Next row
        FlxGd.AddItem str(i), i  'str(i)是新添加的行的说明标题,后面的i是添加的那一行
        FlxGd.TextMatrix(i, 1) = Format(Date, "yyyymd") & Format(Time, "hns") & DcbEmpId.Text
        FlxGd.TextMatrix(i, 2) = TxtId
        FlxGd.TextMatrix(i, 3) = TxtName
        FlxGd.TextMatrix(i, 4) = "¥" & str((Val(Trim(TxtPriceIn))))
        FlxGd.TextMatrix(i, 5) = Trim(TxtNum) & " 本"
        FlxGd.TextMatrix(i, 6) = Trim(TxtCon)
        FlxGd.TextMatrix(i, 7) = Trim(TxtType)
        FlxGd.TextMatrix(i, 8) = DcbProId.Text
        FlxGd.TextMatrix(i, 9) = DcbEmpId.Text
        FlxGd.TextMatrix(i, 10) = Dtp.Value
        i = i + 1
        CmdShanChu.Enabled = True
        CmdSave.Enabled = True
        Call Info
        TxtFind.SetFocus
        End If
End Sub

Private Sub CmdExit_Click()
    Unload Me
End Sub



Private Sub CmdSave_Click()
'On Error GoTo err

    Dim n%, str%
    If MsgBox("确定要添加到数据库中吗?", vbYesNo + vbQuestion, "保存到数据库") = vbYes Then
        For n = 1 To i - 1
'            Adodc1.CommandType = adCmdText
'            Adodc1.RecordSource = "select * from kucun where book_id=" & FlxGd.TextMatrix(n, 2)
'            Adodc1.Refresh
'            'str = Val("select book_num from where book_id='" + FlxGd.TextMatrix(n, 1) + "'")
'            str = Adodc1.Recordset.Fields("book_num")
'            Adodc1.Recordset.Update "book_num", str + Val(FlxGd.TextMatrix(n, 5))
            
            
            Adodc1.CommandType = adCmdText
            Adodc1.RecordSource = "select * from jinhuo "
            Adodc1.Refresh
            Adodc1.Recordset.AddNew
            Adodc1.Recordset.Fields("jh_id") = FlxGd.TextMatrix(n, 1)
            Adodc1.Recordset.Fields("pro_id") = Val(FlxGd.TextMatrix(n, 8))
            Adodc1.Recordset.Fields("book_id") = Val(FlxGd.TextMatrix(n, 2))
            Adodc1.Recordset.Fields("book_num") = Val(FlxGd.TextMatrix(n, 5))
            Adodc1.Recordset.Fields("book_price_in") = Val(Mid(FlxGd.TextMatrix(n, 4), 2))
            Adodc1.Recordset.Fields("jh_date") = Dtp.Value
            Adodc1.Recordset.Fields("jh_emp_id") = Val(FlxGd.TextMatrix(n, 9))
    
            Adodc1.Recordset.Update
           ' Adodc1.Refresh
        Next n
'err:
'      MsgBox err.Description
        For n = 1 To i - 1
            FlxGd.RemoveItem 1
        Next n
        MsgBox "数据保存成功!", vbOKOnly + vbInformation, "保存成功"
        i = 1
    End If
End Sub

Private Sub CmdShanChu_Click()
    Dim str As String
    Dim j As String
    On Error GoTo err
    str = InputBox("请输入要删除的行号 :", "删除信息提示")
    j = Val(str)
    FlxGd.RemoveItem j
    i = i - 1
err:
    Exit Sub
End Sub

Private Sub Form_Load()
    frmJinHuo.Left = 1000
    frmJinHuo.Top = 66
    frmJinHuo.Height = 6600
    frmJinHuo.Width = 10125
    FlxGd.Cols = 12
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = "select * from bookxinxi"
    Adodc1.Refresh
    'FlxGd.row = 1
    
    FlxGd.Rows = Adodc1.Recordset.RecordCount + 1
    FlxGd.TextMatrix(0, 1) = "进货流水号"
    FlxGd.TextMatrix(0, 2) = "图书编号"
    FlxGd.TextMatrix(0, 3) = "图书名称"
    FlxGd.TextMatrix(0, 4) = "进价"
    FlxGd.TextMatrix(0, 5) = "数量"
    FlxGd.TextMatrix(0, 6) = "出版社"
    FlxGd.TextMatrix(0, 7) = "种类"
    FlxGd.TextMatrix(0, 8) = "供货商编号"
    FlxGd.TextMatrix(0, 9) = "进货员编号"
    FlxGd.TextMatrix(0, 10) = "进货日期"
    'FlxGd.ForeColor = &H4080FF
    i = 1
    CmdAdd.Enabled = False
    CmdShanChu.Enabled = False
    CmdSave.Enabled = False
End Sub

Private Sub Label13_Click()
                    frmBookXinXi.CmdSave.Enabled = True
                frmAddBookInfo.Show
                frmJinHuo.Hide
End Sub

Private Sub TxtFind_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If TxtFind = "" Then
        MsgBox "请输入需要查找的图书编号", vbOKOnly + vbInformation
    Else
        Adodc1.CommandType = adCmdText
        Adodc1.RecordSource = "select * from bookxinxi where book_id='" + TxtFind + "'"
        Adodc1.Refresh
        If Adodc1.Recordset.RecordCount = 0 Then
            If MsgBox("库存里面没有这本书,是否需要添加该书信息?", vbYesNo + vbInformation, "没有该图书") = vbYes Then
                frmBookXinXi.CmdSave.Enabled = True
                frmAddBookInfo.Show
                frmJinHuo.Hide
            End If
            TxtFind = ""
        Else
            CmdAdd.Enabled = True
            TxtId = Adodc1.Recordset.Fields("book_id")
            TxtName = Adodc1.Recordset.Fields("book_name")
            TxtPrice = "¥" & Adodc1.Recordset.Fields("book_price")
            TxtCon = Adodc1.Recordset.Fields("book_con")
            TxtType = Adodc1.Recordset.Fields("book_type")
'            Adodc1.RecordSource = "select * from jinhuo where book_id='" + TxtId + "'"
'            Adodc1.Refresh
'
'            Adodc1.Recordset.Fields (3)
'            Adodc1.Recordset.Fields (4)
            
            
        End If
        End If
    End If
End Sub

Private Sub TxtNum_Change()
    LabNum.BackColor = &H8000000F
End Sub

Private Sub TxtPriceIn_Change()
    LabPriceIn.BackColor = &H8000000F
End Sub

Private Sub Info()
    TxtId = ""
    TxtName = ""
    TxtPrice = ""
    TxtCon = ""
    TxtType = ""
    TxtNum = ""
    TxtPriceIn = ""
    TxtFind = ""
End Sub

⌨️ 快捷键说明

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