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

📄 sasset.vb

📁 固定资产管理信息系统,虽然还有些不足,但基本功能已实现!希望大家多多改进!
💻 VB
字号:
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports System.Collections
Imports System.String
Imports System.Data
Imports System.Drawing.Printing

Public Class SAsset
    Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写 dispose 以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意: 以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents ListView1 As System.Windows.Forms.ListView
    Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents Label10 As System.Windows.Forms.Label
    'Friend WithEvents CrystalReportViewer1 As CrystalDecisions.Windows.Forms.CrystalReportViewer
    Friend WithEvents ComboBox3 As System.Windows.Forms.ComboBox
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Button2 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(SAsset))
        Me.Label1 = New System.Windows.Forms.Label
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.Button1 = New System.Windows.Forms.Button
        Me.ComboBox3 = New System.Windows.Forms.ComboBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.ListView1 = New System.Windows.Forms.ListView
        Me.GroupBox2 = New System.Windows.Forms.GroupBox
        Me.Label10 = New System.Windows.Forms.Label
        Me.Label9 = New System.Windows.Forms.Label
        Me.Label8 = New System.Windows.Forms.Label
        Me.Label7 = New System.Windows.Forms.Label
        Me.Label6 = New System.Windows.Forms.Label
        Me.Button2 = New System.Windows.Forms.Button
        Me.GroupBox1.SuspendLayout()
        Me.GroupBox2.SuspendLayout()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.Label1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.Label1.Image = CType(resources.GetObject("Label1.Image"), System.Drawing.Image)
        Me.Label1.Location = New System.Drawing.Point(0, 0)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(696, 80)
        Me.Label1.TabIndex = 0
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.Button2)
        Me.GroupBox1.Controls.Add(Me.Button1)
        Me.GroupBox1.Controls.Add(Me.ComboBox3)
        Me.GroupBox1.Controls.Add(Me.Label4)
        Me.GroupBox1.Location = New System.Drawing.Point(8, 88)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(680, 80)
        Me.GroupBox1.TabIndex = 1
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "条件查询:"
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(400, 40)
        Me.Button1.Name = "Button1"
        Me.Button1.TabIndex = 8
        Me.Button1.Text = "提交"
        '
        'ComboBox3
        '
        Me.ComboBox3.ItemHeight = 12
        Me.ComboBox3.Location = New System.Drawing.Point(176, 40)
        Me.ComboBox3.Name = "ComboBox3"
        Me.ComboBox3.Size = New System.Drawing.Size(160, 20)
        Me.ComboBox3.TabIndex = 5
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(72, 40)
        Me.Label4.Name = "Label4"
        Me.Label4.TabIndex = 4
        Me.Label4.Text = "部门:"
        '
        'ListView1
        '
        Me.ListView1.AllowColumnReorder = True
        Me.ListView1.AllowDrop = True
        Me.ListView1.CheckBoxes = True
        Me.ListView1.FullRowSelect = True
        Me.ListView1.GridLines = True
        Me.ListView1.HoverSelection = True
        Me.ListView1.LabelEdit = True
        Me.ListView1.Location = New System.Drawing.Point(8, 200)
        Me.ListView1.Name = "ListView1"
        Me.ListView1.Size = New System.Drawing.Size(680, 280)
        Me.ListView1.TabIndex = 2
        '
        'GroupBox2
        '
        Me.GroupBox2.Controls.Add(Me.Label10)
        Me.GroupBox2.Controls.Add(Me.Label9)
        Me.GroupBox2.Controls.Add(Me.Label8)
        Me.GroupBox2.Controls.Add(Me.Label7)
        Me.GroupBox2.Controls.Add(Me.Label6)
        Me.GroupBox2.Location = New System.Drawing.Point(8, 480)
        Me.GroupBox2.Name = "GroupBox2"
        Me.GroupBox2.Size = New System.Drawing.Size(680, 64)
        Me.GroupBox2.TabIndex = 3
        Me.GroupBox2.TabStop = False
        Me.GroupBox2.Text = "总计:"
        '
        'Label10
        '
        Me.Label10.Location = New System.Drawing.Point(544, 24)
        Me.Label10.Name = "Label10"
        Me.Label10.TabIndex = 4
        Me.Label10.Text = "概率:"
        '
        'Label9
        '
        Me.Label9.Location = New System.Drawing.Point(424, 24)
        Me.Label9.Name = "Label9"
        Me.Label9.TabIndex = 3
        Me.Label9.Text = "减少:"
        '
        'Label8
        '
        Me.Label8.Location = New System.Drawing.Point(288, 24)
        Me.Label8.Name = "Label8"
        Me.Label8.TabIndex = 2
        Me.Label8.Text = "增加:"
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(168, 24)
        Me.Label7.Name = "Label7"
        Me.Label7.TabIndex = 1
        Me.Label7.Text = "拆算:"
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(16, 24)
        Me.Label6.Name = "Label6"
        Me.Label6.TabIndex = 0
        Me.Label6.Text = "总件:"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(528, 40)
        Me.Button2.Name = "Button2"
        Me.Button2.TabIndex = 9
        Me.Button2.Text = "取 消"
        '
        'SAsset
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(696, 542)
        Me.Controls.Add(Me.GroupBox2)
        Me.Controls.Add(Me.ListView1)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.Label1)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "SAsset"
        Me.Text = "资产报废"
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox2.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region
    Dim sql As New SqlConnection("data source=161F6C5A9E0940C;Initial Catalog=ASSETSMANAGEDB;User ID=sa;Password=;")
    Dim adapter As SqlDataAdapter
    Dim BSearchStrEmpty As Boolean
    Dim StrBrowseBy As String
    Dim result As Integer
    Dim StrQuery As String

    Dim SqlDataAdapter1 As New SqlDataAdapter
    Dim SqlDataAdapter2 As SqlDataAdapter
    Dim SqlDataAdapter3 As SqlDataAdapter
    Dim SqlSelectCommand1 As New SqlCommand
    Dim DrRowPicker As DataRow
    Dim DataSet2 As New DataSet
    Dim DataTable2 As DataTable
    Dim flag As Integer
    Dim ic As Integer
    Dim DataSet1 As New DataSet
    Dim str As String
    Dim DataTable1 As DataTable

    ' Dim cr As New CrystalReport2

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



        ListView1.View = View.Details
        ListView1.Columns.Add("资产编号", 80, HorizontalAlignment.Left)
        ListView1.Columns.Add("资产名称", 80, HorizontalAlignment.Left)
        ListView1.Columns.Add("部门名称", 80, HorizontalAlignment.Left)
        ListView1.Columns.Add("经手人", 80, HorizontalAlignment.Left)
        ListView1.Columns.Add("净值", 60, HorizontalAlignment.Left)
        ListView1.Columns.Add("报废原因", 80, HorizontalAlignment.Left)
        ListView1.Columns.Add("报废时间", 80, HorizontalAlignment.Left)
        ListView1.Columns.Add("登记人", 80, HorizontalAlignment.Left)
        ListView1.Columns.Add("备注", 80, HorizontalAlignment.Left)


        sql = New SqlConnection(StrData)
        sql.Open()




        SqlDataAdapter1 = New SqlDataAdapter("select * from T_SCRAP  ", sql)
        SqlDataAdapter1.Fill(DataSet1)
        DataTable2 = DataSet1.Tables(0)

        Dim k As Integer

        For k = 0 To DataTable2.Rows.Count - 1
            ComboBox3.Items.Add(DataTable2.Rows.Item(k).Item("TYPE_NAME"))
            ' ComboBox2.Items.Add(DataTable1.Rows.Item(i).Item("TYPE_NAME"))
            ' ComboBox3.Items.Add(DataTable1.Rows.Item(i).Item("ASSET_TYPE"))

        Next

        SqlDataAdapter1 = New SqlDataAdapter("select *  from T_SCRAP  ", sql)
        SqlDataAdapter1.Fill(DataSet1, "T_SCRAP")

        Dim t As Integer
        t = 0
        Dim total As Integer
        Dim Amount As Integer

        ListView1.Items.Clear()
        For Each DrRowPicker In DataSet1.Tables("T_SCRAP").Rows
            Dim StrSearchRow As String() = {DrRowPicker(0), DrRowPicker(1), DrRowPicker(2), DrRowPicker(3), DrRowPicker(4), DrRowPicker(5), DrRowPicker(6), DrRowPicker(7), DrRowPicker(8)}

            ListView1.Items.Add(New ListViewItem(StrSearchRow))
            t += 1

            Amount += t 'DrRowPicker(4)
            total += 1



        Next

        Label6.Text = "总计:" + "   " + CStr(total)
        Label7.Text = "拆算:" + "   " + CStr(Amount)



    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


        StrBrowseBy = ComboBox3.Text.ToString

        str = "select * from  T_SCRAP  where  TYPE_NAME= @param"
        Dim Command As New SqlClient.SqlCommand(str, sql)


        Dim OrdYear As New SqlClient.SqlParameter
        OrdYear.ParameterName = "@param"
        OrdYear.SqlDbType = SqlDbType.Char

        OrdYear.Value = StrBrowseBy


        Command.Parameters.Add(OrdYear)

        ic = Command.ExecuteNonQuery()

        SqlDataAdapter1.SelectCommand = Command




        MsgBox("fill")
        DataSet1.Clear()
        SqlDataAdapter1.Fill(DataSet1, "T_SCRAP")



        Dim t As Integer
        t = 0
        Dim total As Integer
        Dim Amount As Integer

        ListView1.Items.Clear()
        For Each DrRowPicker In DataSet1.Tables("T_SCRAP").Rows
            Dim StrSearchRow As String() = {DrRowPicker(0), DrRowPicker(1), DrRowPicker(2), DrRowPicker(3), DrRowPicker(4), DrRowPicker(5), DrRowPicker(6), DrRowPicker(7), DrRowPicker(8)}

            ListView1.Items.Add(New ListViewItem(StrSearchRow))
            t += 1

            Amount += t 'DrRowPicker(4)
            total += 1



        Next

        Label6.Text = "总计:" + "   " + CStr(total)
        Label7.Text = "拆算:" + "   " + CStr(Amount)

        'cr.SetDataSource(DataSet1)
        ' CrystalReportViewer1.ReportSource = cr

        'Dim frm2 As New Form2
        'frm2.Show()



    End Sub



End Class

⌨️ 快捷键说明

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