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

📄 frmpchart.frm

📁 此为我2001年为东莞建发楦头开发的企业管理软件他们使用至今,望斑竹指教! 其他会员最好不要随意下载,需经斑竹同意或我本人同意,谢谢!
💻 FRM
字号:
VERSION 5.00
Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCHRT20.OCX"
Begin VB.Form frmPchart 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "生产单直方图"
   ClientHeight    =   6645
   ClientLeft      =   555
   ClientTop       =   1050
   ClientWidth     =   11190
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6645
   ScaleWidth      =   11190
   ShowInTaskbar   =   0   'False
   Begin MSChart20Lib.MSChart MSChart1 
      Height          =   6015
      Left            =   120
      OleObjectBlob   =   "frmPchart.frx":0000
      TabIndex        =   10
      Top             =   120
      Width           =   10935
   End
   Begin VB.CommandButton Command2 
      Caption         =   "打印(&P)"
      Height          =   300
      Left            =   10200
      TabIndex        =   9
      Top             =   6240
      Width           =   855
   End
   Begin VB.ComboBox cmbClient 
      Height          =   300
      Left            =   7800
      TabIndex        =   8
      Top             =   6240
      Width           =   1335
   End
   Begin VB.ComboBox cmbTown 
      Height          =   300
      Left            =   5520
      TabIndex        =   7
      Top             =   6240
      Width           =   1335
   End
   Begin VB.ComboBox cmbFangxiang 
      Height          =   300
      Left            =   3240
      TabIndex        =   6
      Top             =   6240
      Width           =   1335
   End
   Begin VB.ComboBox cmbYear 
      Height          =   300
      Left            =   960
      TabIndex        =   5
      Top             =   6240
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "查看(&V)"
      Height          =   300
      Left            =   9240
      TabIndex        =   4
      Top             =   6240
      Width           =   855
   End
   Begin VB.Label Label4 
      Caption         =   "客户名称:"
      Height          =   255
      Left            =   6960
      TabIndex        =   3
      Top             =   6240
      Width           =   855
   End
   Begin VB.Label Label3 
      Caption         =   "客户范围:"
      Height          =   255
      Left            =   4680
      TabIndex        =   2
      Top             =   6240
      Width           =   855
   End
   Begin VB.Label Label2 
      Caption         =   "客户方向:"
      Height          =   255
      Left            =   2400
      TabIndex        =   1
      Top             =   6240
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "所在年份:"
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   6240
      Width           =   855
   End
End
Attribute VB_Name = "frmPchart"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rsChart As Recordset
Dim ssql As String
Dim i As Integer
Dim str As String
Private Sub Command1_Click()
Me.MousePointer = 11

db.Execute "delete from dintemp "

If cmbYear <> "所有年份" Then
       db.Execute " INSERT INTO dintemp (clino,sp1_qty,din_date) SELECT clino,total_qty,din_date FROM sp1_view where chflag=0 and year(din_date)=" & "'" & cmbYear & "'"
       db.Execute " INSERT INTO dintemp (clino,sp2_qty,din_date) SELECT clino,total_qty,din_date FROM sp2_view where chflag=0 and year(din_date)=" & "'" & cmbYear & "'"
Else
       db.Execute " INSERT INTO dintemp (clino,sp1_qty,din_date) SELECT clino,total_qty,din_date FROM sp1_view where chflag=0 "
       db.Execute " INSERT INTO dintemp (clino,sp2_qty,din_date) SELECT clino,total_qty,din_date FROM sp2_view where chflag=0 "
End If
Set rsChart = New Recordset

If cmbYear <> "所有年份" Then
    If cmbFangxiang <> "所有方向" Then
        If cmbTown <> "所有范围" Then
            If cmbClient <> "所有客户" Then
                ssql = "where year(din_date)='" & cmbYear & "' and fangxiang='" & cmbFangxiang & "' and fw='" & cmbTown & "' and s_name='" & cmbClient & "'"
            Else
                ssql = "where year(din_date)='" & cmbYear & "' and fangxiang='" & cmbFangxiang & "' and fw='" & cmbTown & "'"
            End If
        Else
            If cmbClient <> "所有客户" Then
            ssql = "where year(din_date)='" & cmbYear & "' and fangxiang='" & cmbFangxiang & "' and s_name='" & cmbClient & "'"
            Else
            ssql = "where year(din_date)='" & cmbYear & "' and fangxiang='" & cmbFangxiang & "'"
            End If
        End If
    Else
        If cmbTown <> "所有范围" Then
            If cmbClient <> "所有客户" Then
            ssql = "where year(din_date)='" & cmbYear & "' and fw='" & cmbTown & "' and s_name='" & cmbClient & "'"
            Else
            ssql = "where year(din_date)='" & cmbYear & "' and fw='" & cmbTown & "'"
            End If
        Else
            If cmbClient <> "所有客户" Then
            ssql = "where year(din_date)='" & cmbYear & "' and s_name='" & cmbClient & "'"
            Else
            ssql = "where year(din_date)='" & cmbYear & "'"
            End If
        End If
    End If
Else
    If cmbFangxiang <> "所有方向" Then
        If cmbTown <> "所有范围" Then
            If cmbClient <> "所有客户" Then
                ssql = "where fangxiang='" & cmbFangxiang & "' and fw='" & cmbTown & "' and s_name='" & cmbClient & "'"
            Else
                ssql = "where fangxiang='" & cmbFangxiang & "' and fw='" & cmbTown & "'"
            End If
        Else
            If cmbClient <> "所有客户" Then
            ssql = "where fangxiang='" & cmbFangxiang & "' and s_name='" & cmbClient & "'"
            Else
            ssql = "where fangxiang='" & cmbFangxiang & "'"
            End If
        End If
    Else
        If cmbTown <> "所有范围" Then
            If cmbClient <> "所有客户" Then
            ssql = "where fw='" & cmbTown & "' and s_name='" & cmbClient & "'"
            Else
            ssql = "where fw='" & cmbTown & "'"
            End If
        Else
            If cmbClient <> "所有客户" Then
            ssql = "where s_name='" & cmbClient & "'"
            Else
            ssql = ""
            End If
        End If
    End If
End If

db.Execute "update chart set totalsum=0"

rsChart.Open "SELECT sum(total) AS totalsum,month  From dintemp_view " & ssql & " GROUP BY month order by month", db, adOpenStatic, adLockOptimistic
If Not rsChart.BOF Then rsChart.MoveFirst
Do Until rsChart.EOF
    If Not IsNull(rsChart.Fields(1)) Then db.Execute "update chart set totalsum=" & rsChart.Fields(0) & " where month='" & Int(rsChart.Fields(1)) & "'"
    rsChart.MoveNext
Loop
rsChart.Close

rsChart.Open "select totalsum,month from chart", db, adOpenStatic, adLockOptimistic
With MSChart1
    .TitleText = "生产单直方图"
    .RowCount = rsChart.RecordCount
    For i = 1 To rsChart.RecordCount
        If Not IsNull(rsChart.Fields(0)) Then
            .Row = i
            .Data = rsChart.Fields(0)
            .RowLabel = rsChart.Fields(1)
        End If
        rsChart.MoveNext
    Next
End With
rsChart.Close
Set rsChart = Nothing

Me.MousePointer = 0
End Sub

Private Sub Command2_Click()
MSChart1.EditCopy
Printer.Print ""
Printer.PaintPicture Clipboard.GetData(), 0, 0
Printer.EndDoc
End Sub

Private Sub Form_Load()
Me.Icon = frmain.Icon
Dim clitb As Recordset


Set clitb = New Recordset

cmbYear.Clear
cmbYear.AddItem "所有年份"
clitb.Open "select distinct year(din_date) as din_date from dintemp_view order by year(din_date)  asc", db, adOpenStatic, adLockOptimistic
For i = 1 To clitb.RecordCount
    If Not IsNull(clitb!din_date) Then cmbYear.AddItem clitb!din_date
    clitb.MoveNext
Next
cmbYear.Text = Year(Date)
'cmbYear.ListIndex = 0
clitb.Close

cmbFangxiang.Clear
cmbFangxiang.AddItem "所有方向"
clitb.Open "select distinct fangxiang from client order by fangxiang asc", db, adOpenStatic, adLockOptimistic
For i = 1 To clitb.RecordCount
    If Not IsNull(clitb!fangxiang) Then cmbFangxiang.AddItem clitb!fangxiang
    clitb.MoveNext
Next
cmbFangxiang.ListIndex = 0
clitb.Close

cmbTown.Clear
cmbTown.AddItem "所有范围"
clitb.Open "select distinct town from client order by town asc", db, adOpenStatic, adLockOptimistic
For i = 1 To clitb.RecordCount
    If Not IsNull(clitb!town) Then cmbTown.AddItem clitb!town
    clitb.MoveNext
Next
cmbTown.ListIndex = 0
clitb.Close

cmbClient.Clear
cmbClient.AddItem "所有客户"
clitb.Open "select distinct s_name from client order by s_name asc", db, adOpenStatic, adLockOptimistic
For i = 1 To clitb.RecordCount
    If Not IsNull(clitb!s_name) Then cmbClient.AddItem clitb!s_name
    clitb.MoveNext
Next
cmbClient.ListIndex = 0
clitb.Close

'Init
db.Execute "delete from dintemp "
    
 db.Execute " INSERT INTO dintemp (clino,sp1_qty,din_date) SELECT clino,total_qty,din_date FROM sp1_view where chflag=0 and year(din_date)=" & "'" & cmbYear & "'"
 db.Execute " INSERT INTO dintemp (clino,sp2_qty,din_date) SELECT clino,total_qty,din_date FROM sp2_view where chflag=0 and year(din_date)=" & "'" & cmbYear & "'"
'db.Execute " INSERT INTO dintemp (clino,sp1_qty,din_date) SELECT clino,total_qty,din_date FROM sp1_view where chflag=0 "
'db.Execute " INSERT INTO dintemp (clino,sp2_qty,din_date) SELECT clino,total_qty,din_date FROM sp2_view where chflag=0 "

'

Set clitb = Nothing

db.Execute "delete from chart"
For i = 1 To 12
    db.Execute "insert into chart(month) values('" & i & "')"
Next

Set rsChart = New Recordset

rsChart.Open "SELECT sum(total) AS totalsum,month  From dintemp_view  GROUP BY month order by month", db, adOpenStatic, adLockOptimistic
If Not rsChart.BOF Then rsChart.MoveFirst
Do Until rsChart.EOF
    If Not IsNull(rsChart.Fields(1)) Then db.Execute "update chart set totalsum=" & rsChart.Fields(0) & " where month='" & Int(rsChart.Fields(1)) & "'"
    rsChart.MoveNext
Loop
rsChart.Close

rsChart.Open "select totalsum,month from chart", db, adOpenStatic, adLockOptimistic
With MSChart1
    .TitleText = "生产单直方图"
    .RowCount = rsChart.RecordCount
    For i = 1 To rsChart.RecordCount
        If Not IsNull(rsChart.Fields(0)) Then
            .Row = i
            .Data = rsChart.Fields(0)
            .RowLabel = rsChart.Fields(1)
        End If
        rsChart.MoveNext
    Next
End With
rsChart.Close
Set rsChart = Nothing
End Sub

Private Sub Form_Resize()
Me.Top = 0
Me.Left = 50
End Sub

Private Sub Form_Unload(Cancel As Integer)
Unload Me
End Sub

⌨️ 快捷键说明

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