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

📄 gpbjfind.frm

📁 一个机械产品(产品、部件、零件)的工时、工资及进度软件
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{4F29B06F-16D9-4A0C-9C8A-2F0C02F625FE}#1.0#0"; "FlexCell.ocx"
Begin VB.Form gpbjfind 
   Caption         =   "部件工票工时"
   ClientHeight    =   8520
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   11880
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   8520
   ScaleWidth      =   11880
   Begin FlexCell.Grid Grid1 
      Height          =   6255
      Left            =   5430
      TabIndex        =   15
      Top             =   2010
      Width           =   6435
      _ExtentX        =   11351
      _ExtentY        =   11033
      Cols            =   5
      Rows            =   30
   End
   Begin VB.Frame Frame2 
      Caption         =   "日期区间"
      Height          =   675
      Left            =   5460
      TabIndex        =   12
      Top             =   840
      Width           =   3555
      Begin VB.OptionButton optall 
         Caption         =   "全部"
         Height          =   255
         Left            =   2460
         TabIndex        =   14
         Top             =   300
         Width           =   675
      End
      Begin VB.OptionButton optsub 
         Caption         =   "本月"
         Height          =   195
         Left            =   1200
         TabIndex        =   13
         Top             =   300
         Width           =   675
      End
   End
   Begin VB.CommandButton cmdfind 
      Caption         =   "检索"
      Height          =   315
      Left            =   9540
      TabIndex        =   11
      Top             =   1020
      Width           =   915
   End
   Begin VB.CommandButton Cmdexit 
      Caption         =   "返回"
      Height          =   315
      Left            =   10860
      TabIndex        =   10
      Top             =   1020
      Width           =   915
   End
   Begin VB.TextBox txtbjbh 
      BackColor       =   &H00E0E0E0&
      Height          =   285
      Left            =   6060
      TabIndex        =   5
      Top             =   1560
      Width           =   1455
   End
   Begin VB.TextBox txtbjmc 
      BackColor       =   &H00E0E0E0&
      Height          =   315
      Left            =   8100
      TabIndex        =   4
      Top             =   1560
      Width           =   1635
   End
   Begin VB.TextBox txtbjth 
      BackColor       =   &H00E0E0E0&
      Height          =   285
      Left            =   10140
      TabIndex        =   3
      Top             =   1560
      Width           =   1575
   End
   Begin VB.TextBox txtcpbh 
      Height          =   285
      Left            =   8280
      TabIndex        =   2
      Top             =   240
      Width           =   1875
   End
   Begin MSComctlLib.TreeView TvwDB 
      Height          =   7575
      Left            =   0
      TabIndex        =   6
      Top             =   840
      Width           =   5295
      _ExtentX        =   9340
      _ExtentY        =   13361
      _Version        =   393217
      LineStyle       =   1
      Style           =   7
      Appearance      =   1
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Label Label1 
      Caption         =   "注:点击所在行可显示明细工票信息。"
      Height          =   195
      Index           =   3
      Left            =   5520
      TabIndex        =   1
      Top             =   8280
      Width           =   5175
   End
   Begin VB.Label Label1 
      Caption         =   "部件编号"
      Height          =   195
      Index           =   4
      Left            =   5340
      TabIndex        =   9
      Top             =   1620
      Width           =   735
   End
   Begin VB.Label Label1 
      Caption         =   "名称"
      Height          =   195
      Index           =   1
      Left            =   7680
      TabIndex        =   8
      Top             =   1620
      Width           =   375
   End
   Begin VB.Label Label1 
      Caption         =   "型号"
      Height          =   195
      Index           =   2
      Left            =   9780
      TabIndex        =   7
      Top             =   1620
      Width           =   435
   End
   Begin VB.Label Label1 
      Caption         =   "绍兴金氏机械设备有限公司  工票检索"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   315
      Index           =   0
      Left            =   2640
      TabIndex        =   0
      Top             =   120
      Width           =   5235
   End
End
Attribute VB_Name = "gpbjfind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private TempNode As Node
Dim txtkey As String, intIndex As Integer, txtnode As String
Dim curdate1 As String, curdate2 As String
Dim curyear As Integer, curmonth1 As Integer, curmonth2 As Integer
Dim Gsdn As Currency, gszp As Currency, gstot As Currency
Private Sub Form_Load()
    Me.Width = 12000: Me.Height = 9000
   
    Set rsTempA = oDb.Execute("select * from acp where cpyn='Y' order by cpbh")
    Do Until rsTempA.EOF
        Set TempNode = TvwDB.Nodes.Add()
        TempNode.Text = rsTempA!cpbh & "," & rsTempA!cpmc & "," & rsTempA!cpxh
        TempNode.Key = "'" & rsTempA!cpbh & "'"

        intIndex = TempNode.Index
        txtkey = TempNode.Key
        
        Set rsTempB = oDb.Execute("select * from abj where cpbh=" & txtkey & " order by bjbh")
        Do Until rsTempB.EOF
            Set TempNode = TvwDB.Nodes.Add(intIndex, tvwChild)
            TempNode.Text = rsTempB!bjbh & "," & rsTempB!bjmc & "." & rsTempB!bjth
             rsTempB.MoveNext
        Loop
        rsTempA.MoveNext
    Loop
    TvwDB.Nodes(1).Expanded = True
 
    Grid1.AutoRedraw = False
    Grid1.DisplayFocusRect = False
    
    Grid1.Cols = 8
    Grid1.Rows = 1
    Grid1.FixedRows = 1
    Grid1.FixedCols = 3
    
    Grid1.Column(0).Width = 5
    Grid1.Column(1).Width = 25
    Grid1.Column(2).Width = 60
    Grid1.Column(3).Width = 105
    Grid1.Column(4).Width = 90
    Grid1.Column(5).Width = 100
    Grid1.Column(6).Width = 30
    Grid1.Column(7).Width = 50
    
    Grid1.AutoRedraw = True
    Grid1.Refresh
   
    dogridfill
    txtcpbh.Visible = False
    
    optsub.Value = True
    
    If Val(Mid(NOWDate, 6, 2)) = 1 Then
        curyear = Left(NOWDate, 4) - 1
        curmonth1 = 12
        curmonth2 = 1
        Else
        curyear = Left(NOWDate, 4)
        curmonth1 = Mid(NOWDate, 6, 2) - 1
        curmonth2 = Mid(NOWDate, 6, 2)
    End If
    curdate1 = curyear & "-" & Format(curmonth1, "00") & "-26"
    curdate2 = curyear & "-" & Format(curmonth2, "00") & "-25"
End Sub
Private Sub Grid1_Click()
    Rowgpgx = Grid1.ActiveCell.Row
    'netkccol = Grid1.ActiveCell.Col
    If Rowgpgx >= 1 Then
        bhgpgx = Grid1.Cell(Rowgpgx, 3).Text '取得零件号
        mcgpgx = Grid1.Cell(Rowgpgx, 4).Text
        gpgxmx.Show
    End If
End Sub
Private Sub tvwdb_NodeClick(ByVal Node As Node)
    txtnode = Node.Text
    txtcpbh.Text = Node.Key
    txtbjbh.Text = ""
    txtbjmc.Text = ""
    txtbjth.Text = ""
    If txtcpbh.Text = "" Then
        '部件级分支,在表格刷新对应零件,txtcode号初始
        i = InStr(Node.Text, ",")
        j = InStr(Node.Text, ".")
        txtbjbh.Text = Left(txtnode, i - 1)
        txtbjmc.Text = Mid(txtnode, i + 1, j - i - 1)
        txtbjth.Text = Mid(txtnode, j + 1)

        dogridfill
    End If
End Sub
Private Sub cmdfind_Click()
    gstot = 0
    If optall.Value = True Then  '全部时间汇总 and  按零件汇总
        Grid1.Rows = 1
        Grid1.Column(2).Width = 1
        Set rsTempB = oDb.Execute("select * from alj where bjbh='" & txtbjbh.Text & "' order by ljbh")
        Do Until rsTempB.EOF
            Gsdn = 0
            gszp = 0
            griditem = (Grid1.Rows) & Chr(9) & "" & Chr(9) & rsTempB!ljbh & Chr(9) & rsTempB!ljmc & Chr(9) & rsTempB!ljth & Chr(9) & rsTempB!ljsl
            szSql = "select sum(gpdnb.gpgs) as sumgs from gpdnh,gpdnb where (gpdnh.gpbh=gpdnb.gpbh)  and gpdnb.gpljbh='" & rsTempB!ljbh & "'"
            Set rsTempC = oDb.Execute(szSql)
            If rsTempC!sumgs > 0 Then Gsdn = Round(rsTempC!sumgs / 60, 1)
          
            szSql = "select sum(gpzpb.gpgs) as sumgs from gpzph,gpzpb where (gpzph.gpbh=gpzpb.gpbh)  and gpzpb.gpljbh='" & rsTempB!ljbh & "'"
            Set rsTempC = oDb.Execute(szSql)
            If rsTempC!sumgs > 0 Then gszp = Round(rsTempC!sumgs / 60, 1)
        
            griditem = griditem & Chr(9) & (Gsdn + gszp)
            gstot = gstot + (Gsdn + gszp)
            If (Gsdn + gszp) > 0 Then Grid1.AddItem griditem   '有数据显示
            rsTempB.MoveNext
        Loop
        Grid1.AddItem "" & Chr(9) & "" & Chr(9) & "合计工时" & Chr(9) & "" & Chr(9) & "" & Chr(9) & "" & Chr(9) & gstot
    End If
    
        
    If optsub.Value = True Then  '本月汇总 and  按零件汇总
        Grid1.Rows = 1
        Grid1.Column(2).Width = 1
        Set rsTempB = oDb.Execute("select * from alj where bjbh='" & txtbjbh.Text & "' order by ljbh")
        Do Until rsTempB.EOF
            Gsdn = 0
            gszp = 0
            griditem = (Grid1.Rows) & Chr(9) & "" & Chr(9) & rsTempB!ljbh & Chr(9) & rsTempB!ljmc & Chr(9) & rsTempB!ljth & Chr(9) & rsTempB!ljsl
            szSql = "select sum(gpdnb.gpgs) as sumgs from gpdnh,gpdnb where (gpdnh.gpbh=gpdnb.gpbh)  and gpdnb.gpljbh='" & rsTempB!ljbh & "' and gpdnh.gprq>='" & curdate1 & "' and gpdnh.gprq<='" & curdate2 & "'"
            Set rsTempC = oDb.Execute(szSql)
            If rsTempC!sumgs > 0 Then Gsdn = Round(rsTempC!sumgs / 60, 1)
          
            szSql = "select sum(gpzpb.gpgs) as sumgs from gpzph,gpzpb where (gpzph.gpbh=gpzpb.gpbh)  and gpzpb.gpljbh='" & rsTempB!ljbh & "' and gpzph.gprq>='" & curdate1 & "' and gpzph.gprq<='" & curdate2 & "'"
            Set rsTempC = oDb.Execute(szSql)
            If rsTempC!sumgs > 0 Then gszp = Round(rsTempC!sumgs / 60, 1)
        
            griditem = griditem & Chr(9) & (Gsdn + gszp)
            gstot = gstot + (Gsdn + gszp)
            
            If (Gsdn + gszp) > 0 Then Grid1.AddItem griditem
            rsTempB.MoveNext
        Loop
         Grid1.AddItem "" & Chr(9) & "" & Chr(9) & "合计工时" & Chr(9) & "" & Chr(9) & "" & Chr(9) & "" & Chr(9) & gstot
    End If
    
End Sub
Private Sub cmdexit_Click()
    Unload Me
End Sub
Private Sub dogridfill()
    Grid1.Cell(0, 1).Text = "序号"
    Grid1.Cell(0, 2).Text = "日期"
    Grid1.Cell(0, 3).Text = "零件编号"
    Grid1.Cell(0, 4).Text = "零件名称"
    Grid1.Cell(0, 5).Text = "图号"
    Grid1.Cell(0, 6).Text = "数量"
    Grid1.Cell(0, 7).Text = "工时"
    Grid1.Rows = 1
End Sub

⌨️ 快捷键说明

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