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

📄 frmrpt.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 FrmRpt 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "明细报表"
   ClientHeight    =   4245
   ClientLeft      =   2130
   ClientTop       =   3015
   ClientWidth     =   4680
   Icon            =   "FrmRpt.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4245
   ScaleWidth      =   4680
   StartUpPosition =   2  '屏幕中心
   Begin VB.CheckBox ChkCk 
      Caption         =   "仓库"
      Height          =   255
      Left            =   480
      TabIndex        =   15
      Top             =   2280
      Width           =   1095
   End
   Begin VB.ComboBox Cmbck 
      Height          =   300
      ItemData        =   "FrmRpt.frx":0442
      Left            =   1560
      List            =   "FrmRpt.frx":044C
      Style           =   2  'Dropdown List
      TabIndex        =   14
      Top             =   2280
      Width           =   2175
   End
   Begin MSAdodcLib.Adodc Adodc2 
      Height          =   330
      Left            =   3000
      Top             =   0
      Visible         =   0   'False
      Width           =   1575
      _ExtentX        =   2778
      _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         =   "Adodc2"
      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        =   "FrmRpt.frx":0464
      Left            =   1560
      List            =   "FrmRpt.frx":046E
      Style           =   2  'Dropdown List
      TabIndex        =   10
      Top             =   1800
      Width           =   2175
   End
   Begin VB.CheckBox Chklx 
      Caption         =   "运货类型"
      Height          =   255
      Left            =   480
      TabIndex        =   9
      Top             =   1800
      Width           =   1095
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   3120
      Top             =   0
      Visible         =   0   'False
      Width           =   1695
      _ExtentX        =   2990
      _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 cmbhw 
      Height          =   300
      Left            =   1560
      TabIndex        =   8
      Top             =   1320
      Width           =   2175
   End
   Begin VB.ComboBox cmbdw 
      Height          =   300
      Left            =   1560
      TabIndex        =   7
      Top             =   840
      Width           =   2175
   End
   Begin VB.TextBox Txtch 
      Height          =   270
      Left            =   1560
      TabIndex        =   5
      Top             =   360
      Width           =   2175
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   2280
      TabIndex        =   4
      Top             =   3720
      Width           =   1215
   End
   Begin VB.CheckBox Chkhw 
      Caption         =   "按货物"
      Height          =   255
      Left            =   480
      TabIndex        =   3
      Top             =   1320
      Width           =   975
   End
   Begin VB.CheckBox Chkdw 
      Caption         =   "按单位"
      Height          =   255
      Left            =   480
      TabIndex        =   2
      Top             =   840
      Width           =   1215
   End
   Begin VB.CheckBox Chkch 
      Caption         =   "按车号"
      Height          =   255
      Left            =   480
      TabIndex        =   1
      Top             =   360
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   600
      TabIndex        =   0
      Top             =   3720
      Width           =   1215
   End
   Begin MSComCtl2.DTPicker dtrq 
      Height          =   375
      Left            =   1560
      TabIndex        =   6
      Top             =   2760
      Width           =   2175
      _ExtentX        =   3836
      _ExtentY        =   661
      _Version        =   393216
      Format          =   27000833
      CurrentDate     =   37945
   End
   Begin MSComCtl2.DTPicker DTrq1 
      Height          =   375
      Left            =   1560
      TabIndex        =   12
      Top             =   3240
      Width           =   2175
      _ExtentX        =   3836
      _ExtentY        =   661
      _Version        =   393216
      Format          =   27000833
      CurrentDate     =   37945
   End
   Begin VB.Label Label2 
      Caption         =   "结束日期"
      Height          =   255
      Left            =   480
      TabIndex        =   13
      Top             =   3360
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "开始日期"
      Height          =   255
      Left            =   480
      TabIndex        =   11
      Top             =   2880
      Width           =   855
   End
End
Attribute VB_Name = "FrmRpt"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rd_wight As New ADODB.Recordset

Private Sub Command1_Click()
On Error Resume Next
Dim Sql As String
Dim jzzz As Double
Dim zzzj As Double
 Sql = "select*from tb_wight where 1=1 "
 If Chkch.Value = 1 Then
  Sql = Sql & " and 车号='" & Trim(Txtch.Text) & "'"
 End If
 If Chkdw.Value = 1 Then
  Sql = Sql & " and 单位='" & Trim(cmbdw.Text) & "'"
 End If
 If ChkCk.Value = 1 Then
  Sql = Sql & " and 仓库='" & Trim(Cmbck.Text) & "'"
 End If
  If Chkhw.Value = 1 Then
  Sql = Sql & " and 货物名称='" & Trim(cmbhw.Text) & "'"
 End If
 If Chklx.Value = 1 Then
  Sql = Sql & " and 单位类型='" & Trim(Cmblx.Text) & "'"
 End If
 Sql = Sql & " and 日期>=#" & dtrq.Value & "# and 日期<#" & DTrq1.Value + 1 & "#  and 毛重<>'0.00'  and 作废标志<>'是' order by 货物名称,车号,单位"
Adodc1.ConnectionString = Cn
Adodc1.RecordSource = Sql
Adodc1.Refresh
If Adodc1.Recordset.EOF Then
  MsgBox "你要生成的报表不存在!", vbInformation + vbOKOnly, "提示!"
Else
  Do Until Adodc1.Recordset.EOF
   jzzz = jzzz + Adodc1.Recordset.Fields!净重
   Adodc1.Recordset.MoveNext
  Loop
  Set DtDayRp.DataSource = Adodc1
  Adodc1.Recordset.MoveFirst
  DtDayRp.Sections("section4").Controls.Item("label3").Caption = "打印日期:" & Year(Date) & "年" & Month(Date) & "月" & Day(Date) & "日"
  DtDayRp.Sections("section5").Controls.Item("lbjzzj").Caption = "净重总计:" & Format(jzzz, "0.00")
  Adodc1.Recordset.MoveFirst
  DtDayRp.Sections("section1").Controls.Item("txtch").DataField = Adodc1.Recordset.Fields!车号.Name
  DtDayRp.Sections("section1").Controls.Item("txtck").DataField = Adodc1.Recordset.Fields!仓库.Name
  DtDayRp.Sections("section1").Controls.Item("txthw").DataField = Adodc1.Recordset.Fields!货物名称.Name
  DtDayRp.Sections("section1").Controls.Item("txtdw").DataField = Adodc1.Recordset.Fields!单位.Name
  DtDayRp.Sections("section1").Controls.Item("txtdwlx").DataField = Adodc1.Recordset.Fields!单位类型.Name
  DtDayRp.Sections("section1").Controls.Item("txtyssl").DataField = Adodc1.Recordset.Fields!应收数量.Name
  DtDayRp.Sections("section1").Controls.Item("txthl").DataField = Adodc1.Recordset.Fields!含量.Name
  DtDayRp.Sections("section1").Controls.Item("txtjz").DataField = Adodc1.Recordset.Fields!净重.Name
  DtDayRp.Sections("section1").Controls.Item("txtby").DataField = Adodc1.Recordset.Fields!过磅员.Name
  DtDayRp.Sections("section1").Controls.Item("txtrq").DataField = Adodc1.Recordset.Fields!日期.Name
 DtDayRp.Show 1
End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
On Error Resume Next
InitCmb "tb_dw", cmbdw
InitCmb "tb_hw", cmbhw
InitCmb "tb_ck", Cmbck
Cmblx.ListIndex = 0
dtrq.Value = Date - 3
DTrq1.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 + -