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

📄 frm_stat.frm

📁 是一款专业的销售管理软件
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Begin VB.CommandButton Cmd_stat 
               Caption         =   "统计"
               Height          =   300
               Left            =   1200
               TabIndex        =   18
               Top             =   525
               Width           =   795
            End
            Begin VB.CommandButton Cmd_Cancel 
               Caption         =   "取消"
               Height          =   300
               Left            =   2070
               TabIndex        =   17
               Top             =   525
               Width           =   780
            End
            Begin MSComCtl2.DTPicker DTPicker1 
               Height          =   315
               Left            =   1200
               TabIndex        =   19
               Top             =   165
               Width           =   1650
               _ExtentX        =   2910
               _ExtentY        =   556
               _Version        =   393216
               Format          =   24903681
               CurrentDate     =   39440
            End
            Begin VB.Label Label1 
               Caption         =   "统计日期"
               Height          =   240
               Left            =   255
               TabIndex        =   20
               Top             =   225
               Width           =   930
            End
         End
         Begin MSDataGridLib.DataGrid DataGrid1 
            Bindings        =   "frm_Stat.frx":19E3
            Height          =   850
            Left            =   165
            TabIndex        =   3
            Top             =   3640
            Width           =   5610
            _ExtentX        =   9895
            _ExtentY        =   1508
            _Version        =   393216
            AllowUpdate     =   0   'False
            BackColor       =   16777152
            HeadLines       =   1
            RowHeight       =   15
            FormatLocked    =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "宋体"
               Size            =   9
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "宋体"
               Size            =   9
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   5
            BeginProperty Column00 
               DataField       =   "T_Id"
               Caption         =   "T_Id"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   2052
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "T_Name"
               Caption         =   "商品名称"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   2052
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column02 
               DataField       =   "T_Num"
               Caption         =   "合计数量"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   2052
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column03 
               DataField       =   "T_dj"
               Caption         =   "单价"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   2052
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column04 
               DataField       =   "T_money"
               Caption         =   "合计金额"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   2052
                  SubFormatType   =   0
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
                  Object.Visible         =   0   'False
                  ColumnWidth     =   1094.74
               EndProperty
               BeginProperty Column01 
                  ColumnWidth     =   2085.166
               EndProperty
               BeginProperty Column02 
                  ColumnWidth     =   1094.74
               EndProperty
               BeginProperty Column03 
                  Object.Visible         =   0   'False
                  ColumnWidth     =   2085.166
               EndProperty
               BeginProperty Column04 
                  ColumnWidth     =   2085.166
               EndProperty
            EndProperty
         End
         Begin MSChart20Lib.MSChart MSChart1 
            Height          =   3210
            Left            =   120
            OleObjectBlob   =   "frm_Stat.frx":19F8
            TabIndex        =   2
            Top             =   345
            Width           =   8805
         End
         Begin MSComctlLib.ProgressBar ProgressBar1 
            Height          =   300
            Left            =   150
            TabIndex        =   4
            Top             =   4560
            Visible         =   0   'False
            Width           =   8730
            _ExtentX        =   15399
            _ExtentY        =   529
            _Version        =   393216
            Appearance      =   1
         End
         Begin VB.Label Label3 
            Caption         =   "统计入库货品信息"
            Height          =   300
            Left            =   195
            TabIndex        =   9
            Top             =   4605
            Width           =   2835
         End
      End
   End
End
Attribute VB_Name = "frm_Stat"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Cmd_cancel_Click()
    Unload Me
End Sub

'*** 入库信息统计的事件代码 ***
Private Sub Cmd_stat_Click()
    rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3)     '运用API函数SetWindowPos,来实现取消窗体置前的功能
    '调用删除临时表中数据的过程删除临时表中的数据
    Call tbTemp
    '查询符合日期条件的记录
    Adodc1.RecordSource = "select in_name,in_Price from tb_in where in_date='" + Str(DTPicker1.Value) + "' "
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
        Adodc1.Recordset.MoveFirst
        Do While Adodc1.Recordset.EOF = False       '通过循环,将统计出来的数据添加到临时表当中
            Adodc2.RecordSource = "select sum(in_Num),sum(in_Money) from tb_in where in_Name='" + Adodc1.Recordset.Fields("in_Name") + "'"
            Adodc2.Refresh
            If Adodc2.Recordset.RecordCount > 0 Then
                Dim Nums As Integer
                Nums = Nums + 1
                Call Main            '调用连接数据库的函数
                '保存数据信息到临时表
                Set adoRs = adoCon.Execute("insert into tb_temp  values(" & Nums & ",'" & Adodc1.Recordset.Fields("in_name") & "','" & Str(Adodc2.Recordset.Fields(0)) & "','" & Str(Adodc2.Recordset.Fields(1)) & "')")
                adoCon.Close          '关闭数据连接
            End If
            Adodc1.Recordset.MoveNext
        Loop
        Adodc2.RecordSource = "select distinct t_name,t_num,T_money from tb_temp "
        Adodc2.Refresh
        Call LoadNumI                              '调用在图表中显示入库信息统计数据的过程
    Else
        MsgBox "当前数据库中没有符合条件的统计数据", 64
    End If
End Sub

'*** 出库信息统计的事件代码 ***
Private Sub Cmd_stats_Click()
    rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3)     '运用API函数SetWindowPos,来实现取消窗体置前的功能
    '删除临时表中的数据
    Call tbTemp
    '查询符合日期条件的记录
    Adodc1.RecordSource = "select out_name,OUT_Price from tb_out where out_date='" + Str(DTPicker2.Value) + "' "
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
        Adodc1.Recordset.MoveFirst
        Do While Adodc1.Recordset.EOF = False               '通过循环,将统计出来的数据添加到临时表当中
            Adodc2.RecordSource = "select sum(OUT_Num),sum(OUT_Money) from tb_out where Out_Name='" + Adodc1.Recordset.Fields("Out_Name") + "'"
            Adodc2.Refresh
            If Adodc2.Recordset.RecordCount > 0 Then
                Dim Nums As Integer
                Nums = Nums + 1
                Call Main
                Set adoRs = adoCon.Execute("insert into tb_temp  values(" & Nums & ",'" & Adodc1.Recordset.Fields("out_name") & "','" & Str(Adodc2.Recordset.Fields(0)) & "','" & Str(Adodc2.Recordset.Fields(1)) & "')")
                adoCon.Close
            End If
            Adodc1.Recordset.MoveNext
        Loop
        Adodc2.RecordSource = "select distinct t_name,t_num,T_money from tb_temp "
        Adodc2.Refresh
        Call LoadNumO                             '调用在图表中显示出库信息统计数据的过程
    Else
        MsgBox "当前数据库中没有符合条件的统计数据", 64
    End If
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub


Private Sub Form_Load()
    rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)     '运用API函数SetWindowPos,来实现使窗体置前的功能
    DTPicker1.Value = Date                                 '使日期控件中显示当前系统的日期时间
    DTPicker2.Value = Date
    '通过代码连接数据库与数据表
    Adodc1.ConnectionString = CnnStr
    Adodc1.RecordSource = "select * from tb_temp"
    Adodc1.Refresh
    Adodc2.ConnectionString = CnnStr
    Adodc2.RecordSource = "select * from tb_temp"
    Adodc2.Refresh
    Adodc3.ConnectionString = CnnStr
    Adodc3.RecordSource = "select * from tb_temp"
    Adodc3.Refresh
    Me.Left = (Screen.Width - Me.Width) / 2
    Me.Top = (Screen.Height - Me.Height) / 2
    SSTab1.Tab = 0                           '在窗体运行的时候显示入库信息统计页面
    '   Call Cmd_stat_Click                       '调用入库信息统计事件
End Sub


'*** 自定义在图表中显示入库信息统计数据的事件过程 ***
Private Sub LoadNumI()    '在图表中显示数据
    Dim connter As Integer
    Dim sql, workarea(12) As String     '定义一个变量及数组
    Dim i As Integer
    Dim Nums As Integer
    ProgressBar1.Visible = True         '将ProgressBar设置为不可见
    ProgressBar1.Max = UBound(workarea)
    ProgressBar1.Value = ProgressBar1.Min
    For connter = LBound(workarea) To UBound(workarea)     '显示进度条的运行进度
        workarea(connter) = "initial value" & connter
        ProgressBar1.Value = connter
        Adodc1.RecordSource = "select distinct T_Name,T_num from tb_temp"
        Adodc1.Refresh
        Nums = Adodc1.Recordset.RecordCount
        ReDim arrValues(1 To Nums, 1 To 2)                               '定义动态数组
        For i = 1 To Nums                                            '给数组赋值
            arrValues(i, 1) = "  " & Adodc1.Recordset!T_Name           '显示图表中的横坐标标签
            arrValues(i, 2) = Adodc1.Recordset!T_num                   '显示图表中的纵坐标数据
            Adodc1.Recordset.MoveNext
        Next i

    Next connter
    ProgressBar1.Value = ProgressBar1.Min
    MSChart1.ChartData = arrValues                               '图表显示数据
    MSChart1.Title = "货品入库信息日统计"                        '显示图表的标题
    MSChart1.ColumnLabel = "合计数量"
    ProgressBar1.Visible = False
    Label3.Visible = False
End Sub

'*** 自定义在图表中显示出库信息统计数据的事件过程 ***
Private Sub LoadNumO()
    Dim connter As Integer
    Dim sql, workarea(12) As String
    Dim i As Integer
    Dim Nums As Integer
    ProgressBar2.Visible = True
    ProgressBar2.Max = UBound(workarea)
    ProgressBar2.Value = ProgressBar2.Min
    For connter = LBound(workarea) To UBound(workarea)
        workarea(connter) = "initial value" & connter
        ProgressBar2.Value = connter

        Adodc1.RecordSource = "select distinct T_Name,T_num from tb_temp"
        Adodc1.Refresh
        Nums = Adodc1.Recordset.RecordCount
        ReDim arrValues(1 To Nums, 1 To 2)                               '定义动态数组
        For i = 1 To Nums                                            '给数组赋值
            arrValues(i, 1) = "  " & Adodc1.Recordset!T_Name
            arrValues(i, 2) = Adodc1.Recordset!T_num
            Adodc1.Recordset.MoveNext
        Next i

    Next connter
    ProgressBar2.Value = ProgressBar2.Min
    MSChart2.ChartData = arrValues                               '图表显示数据
    MSChart2.Title = "货品出库信息日统计"                        '显示图表名称
    MSChart2.ColumnLabel = "合计数量"
    ProgressBar2.Visible = False
    Label4.Visible = False
End Sub

Private Sub SSTab1_Click(PreviousTab As Integer)
    If SSTab1.Tab = 0 Then
        Cmd_stat_Click                    '调用入库统计信息事件
    ElseIf SSTab1.Tab = 1 Then
        Cmd_stats_Click                   '调用出库统计信息事件
    End If
End Sub

'*** 自定义删除临时表中数据的事件过程 ***
Private Sub tbTemp()
   On Error Resume Next
    Adodc2.RecordSource = "select * from tb_temp "
    Adodc2.Refresh
    If Adodc2.Recordset.RecordCount > 0 Then
        Adodc2.Recordset.MoveFirst
        Do While Adodc2.Recordset.EOF = False
            Adodc2.Recordset.Delete     '循环删除临时表中的数据
            Adodc2.Recordset.MoveNext
        Loop
    End If
    Adodc2.RecordSource = "select * from tb_temp "
    Adodc2.Refresh
End Sub
Private Sub Form_Unload(Cancel As Integer)
    frm_main.Enabled = True
End Sub

⌨️ 快捷键说明

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