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

📄 frmrp.frm

📁 一个称重计量程序
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frmrp 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "总计报表"
   ClientHeight    =   3645
   ClientLeft      =   3030
   ClientTop       =   4140
   ClientWidth     =   4350
   Icon            =   "Frmrp.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3645
   ScaleWidth      =   4350
   StartUpPosition =   2  '屏幕中心
   Begin VB.ComboBox Cmbck 
      Height          =   300
      Left            =   1560
      Style           =   2  'Dropdown List
      TabIndex        =   11
      Top             =   2400
      Width           =   2175
   End
   Begin VB.CheckBox Chkck 
      Caption         =   "仓库"
      Height          =   255
      Left            =   480
      TabIndex        =   10
      Top             =   2400
      Width           =   735
   End
   Begin VB.ComboBox CmbHw 
      Height          =   300
      Left            =   1560
      Style           =   2  'Dropdown List
      TabIndex        =   9
      Top             =   1920
      Width           =   2175
   End
   Begin VB.CheckBox ChkHw 
      Caption         =   "货物"
      Height          =   255
      Left            =   480
      TabIndex        =   8
      Top             =   1920
      Width           =   735
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   2880
      Top             =   2280
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      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 VB.ComboBox Cmblx 
      Height          =   300
      ItemData        =   "Frmrp.frx":030A
      Left            =   1560
      List            =   "Frmrp.frx":0317
      Style           =   2  'Dropdown List
      TabIndex        =   6
      Top             =   1320
      Width           =   2175
   End
   Begin MSComCtl2.DTPicker DTPicker2 
      Height          =   375
      Left            =   1560
      TabIndex        =   3
      Top             =   720
      Width           =   2175
      _ExtentX        =   3836
      _ExtentY        =   661
      _Version        =   393216
      Format          =   24641537
      CurrentDate     =   37945
   End
   Begin MSComCtl2.DTPicker DTPicker1 
      Height          =   375
      Left            =   1560
      TabIndex        =   2
      Top             =   240
      Width           =   2175
      _ExtentX        =   3836
      _ExtentY        =   661
      _Version        =   393216
      Format          =   24641537
      CurrentDate     =   37945
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   2400
      TabIndex        =   1
      Top             =   3000
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   360
      TabIndex        =   0
      Top             =   3000
      Width           =   1215
   End
   Begin VB.Label Label3 
      Caption         =   "运货类型"
      Height          =   255
      Left            =   480
      TabIndex        =   7
      Top             =   1440
      Width           =   855
   End
   Begin VB.Label Label2 
      Caption         =   "开始日期:"
      Height          =   255
      Left            =   480
      TabIndex        =   5
      Top             =   360
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "到:"
      Height          =   255
      Left            =   600
      TabIndex        =   4
      Top             =   840
      Width           =   375
   End
End
Attribute VB_Name = "Frmrp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Chkck_Click()
On Error Resume Next
 If ChkCk.Value = 1 Then
   InitCmb "tb_ck", Cmbck
   'Chkdw.Value = 0
   'Chkdw.Enabled = False
 'Else
  'Chkdw.Enabled = True
  'Cmbck.Clear
 End If
End Sub

'Private Sub Chkdw_Click()
'Dim rddw As New ADODB.Recordset
'If Chkdw.Value = 1 Then
  'Chkck.Value = 0
  'Chkck.Enabled = False
 ' If Trim(Cmblx.Text) = "拉货" Then
  ' CmbDw.Clear
  '   With rddw
   '   .Open "select*from tb_dw where 单位类型='拉货单位'", Cn, adOpenKeyset, adLockPessimistic
   '    Do Until .EOF
    '     CmbDw.AddItem .Fields(1).Value
     '   .MoveNext
      ' Loop
     ' .Close
     'End With
    'ElseIf Trim(Cmblx.Text) = "送货" Then
     '   CmbDw.Clear
    ' With rddw
     ' .Open "select*from tb_dw where 单位类型='送货单位'", Cn, adOpenKeyset, adLockPessimistic
      ' Do Until .EOF
      '   CmbDw.AddItem .Fields(1).Value
      '  .MoveNext
      ' Loop
      '.Close
     'End With
  '  Else
     ' CmbDw.Clear
     'With rddw
      '.Open "select*from tb_hw", Cn, adOpenKeyset, adLockPessimistic
       'Do Until .EOF
        ' CmbHw.AddItem .Fields(1).Value
       ' .MoveNext
       'Loop
      '.Close
     'End With
 ' End If
'Else
 ' Chkck.Enabled = True
 ' CmbDw.Clear
'End If
'End Sub

Private Sub ChkHw_Click()
On Error Resume Next
Dim rdHw As New ADODB.Recordset
If Chkhw.Value = 1 Then
  'Chkck.Value = 0
  'Chkck.Enabled = False
 ' If Trim(Cmblx.Text) = "拉货" Then
   cmbhw.Clear
     With rdHw
      .Open "select*from tb_hw", Cn, adOpenKeyset, adLockPessimistic
       Do Until .EOF
        cmbhw.AddItem .Fields(1).Value
        .MoveNext
       Loop
      .Close
     End With
End If
End Sub

Private Sub Cmblx_Click()
'CmbHw.Clear
'ChkHw.Value = 0
End Sub

Private Sub Command1_Click()
On Error Resume Next
Dim Sql As String
Dim jzzz As Double
Dim zzzj As Double
 Sql = "select 单位,sum(净重) as 总净重 from tb_wight where 1=1 "
 If Trim(Cmblx.Text) <> "" Then
   If Trim(Cmblx.Text) = "拉货" Then
    Sql = Sql & " and 单位类型='拉货单位'"
   Else
    Sql = Sql & " and 单位类型='送货单位'"
   End If
 End If
 If Chkhw.Value = 1 Then
  Sql = Sql & " and 货物名称='" & Trim(cmbhw.Text) & "'"
 End If
 If ChkCk.Value = 1 Then
  Sql = Sql & " and 仓库='" & Trim(Cmbck.Text) & "'"
 End If
Sql = Sql & " and 日期>=#" & DTPicker1.Value & "# and 日期<#" & DTPicker2.Value + 1 & "#  and 毛重<>'0.00'  and 作废标志<>'是' group by 单位 "
Adodc1.ConnectionString = Cn
Adodc1.RecordSource = Sql
Adodc1.Refresh
If Adodc1.Recordset.EOF Then
  MsgBox "你要生成的报表不存在!", vbInformation + vbOKOnly, "提示!"
Else
  Set Dtrpzj.DataSource = Adodc1
  Adodc1.Recordset.MoveFirst
  If Chkhw.Value = 1 And Trim(cmbhw.Text) <> "" Then
   Dtrpzj.Sections("section4").Controls.Item("lab1").Caption = "货物:" & cmbhw.Text
  End If
  If ChkCk.Value = 1 And Trim(Cmbck.Text) <> "" Then
   Dtrpzj.Sections("section4").Controls.Item("lb2").Caption = "仓库:" & Cmbck.Text
  End If
  Dtrpzj.Sections("section4").Controls.Item("lbgbrq").Caption = "过磅日期:从 " & DTPicker1.Value & " 到 " & DTPicker2.Value
  Dtrpzj.Sections("section4").Controls.Item("lbprrq").Caption = "打印日期:" & Year(Date) & "年" & Month(Date) & "月" & Day(Date) & "日"
  Adodc1.Recordset.MoveFirst
  Dtrpzj.Sections("section1").Controls.Item("txtdw").DataField = Adodc1.Recordset.Fields!单位.Name
  Dtrpzj.Sections("section1").Controls.Item("txtjz").DataField = Adodc1.Recordset.Fields!总净重.Name
  Dtrpzj.Show 1
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
On Error Resume Next
Cmblx.ListIndex = 0
DTPicker1.Value = Date - 30
DTPicker2.Value = Date
End Sub
'//初始化各Cmb
Public Sub InitCmb(ByVal tbName As String, Cmbname As ComboBox)
 On Error Resume Next
 Dim rdmy As New ADODB.Recordset
        Cmbname.Clear
         With rdmy
         .Open "select*from " & tbName, Cn, adOpenKeyset, adLockPessimistic
          Do Until .EOF
             Cmbname.AddItem .Fields(1).Value
           .MoveNext
          Loop
          .Close
         End With
End Sub

⌨️ 快捷键说明

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