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

📄 dareportzh.dsr

📁 VB数据库设计的代码。需要根据自己的数据库再作调整
💻 DSR
📖 第 1 页 / 共 2 页
字号:
   BeginProperty Section2 {1C13A8E0-A0B6-11D0-848E-00A0C90DC8A9} 
      _Version        =   393216
      Name            =   "Section1"
      Object.Height          =   570
      KeepTogether    =   -1  'True
      NumControls     =   6
      ItemType0       =   4
      BeginProperty Item0 {1C13A8E2-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "Text1"
         Object.Width           =   2265
         Object.Height          =   570
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      ItemType1       =   4
      BeginProperty Item1 {1C13A8E2-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "Text2"
         Object.Left            =   2268
         Object.Width           =   1140
         Object.Height          =   570
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Alignment       =   1
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      ItemType2       =   5
      BeginProperty Item2 {1C13A8E3-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "Line1"
         Object.Top             =   567
         Object.Width           =   3402
      EndProperty
      ItemType3       =   5
      BeginProperty Item3 {1C13A8E3-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "Line4"
         Object.Left            =   2268
         Object.Height          =   567
      EndProperty
      ItemType4       =   5
      BeginProperty Item4 {1C13A8E3-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "Line8"
         Object.Left            =   3402
         Object.Height          =   567
      EndProperty
      ItemType5       =   5
      BeginProperty Item5 {1C13A8E3-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "Line11"
         Object.Height          =   570
      EndProperty
   EndProperty
   SectionCode3    =   7
   BeginProperty Section3 {1C13A8E0-A0B6-11D0-848E-00A0C90DC8A9} 
      _Version        =   393216
      Name            =   "Section3"
      Object.Height          =   2355
      KeepTogether    =   -1  'True
      NumControls     =   2
      ItemType0       =   3
      BeginProperty Item0 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "Label1"
         Object.Width           =   2265
         Object.Height          =   570
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Object.Caption         =   "净利润"
      EndProperty
      ItemType1       =   3
      BeginProperty Item1 {1C13A8E1-A0B6-11D0-848E-00A0C90DC8A9} 
         _Version        =   393216
         Name            =   "Label2"
         Object.Left            =   2268
         Object.Width           =   1140
         Object.Height          =   570
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Object.Caption         =   "0"
         Alignment       =   1
      EndProperty
   EndProperty
   SectionCode4    =   8
   BeginProperty Section4 {1C13A8E0-A0B6-11D0-848E-00A0C90DC8A9} 
      _Version        =   393216
      Name            =   "Section5"
      Object.Height          =   1170
      NumControls     =   0
   EndProperty
End
Attribute VB_Name = "Dareportsjyzb"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub DataReport_Initialize()
    Dim AdoCon As New ADODB.Connection
    Dim lirun As Variant

    lirun = 0
    Const iW = 3 '缇,误差调整
    Printer.PaperSize = 9
    Dareportsjyzb.ReportWidth = Printer.Width - Dareportsjyzb.LeftMargin - Dareportsjyzb.RightMargin - iW
    Dim AdoRec As New ADODB.Recordset
    Dim txt As New Collection
    Dim ctl As Object
    Dim ctl1 As Object
    AdoCon.Open nowconnectstring
   ' For i = 0 To 11
   '    filedvalue = 0
   ' Next i
   ' For i = 0 To 11
    Set AdoRec = AdoCon.Execute("SELECT c2,a1,a2,sum(a3) as b1 FROM Vsjyzb   where a4>='" & starttime & "' and a4<='" & endtime & "' GROUP BY c2,a1,a2")
    Do While Not AdoRec.EOF
      If AdoRec.Fields("a2") = 1 Then
         lirun = lirun + AdoRec.Fields("b1")
      Else
         lirun = lirun - AdoRec.Fields("b1")
      End If
      AdoRec.MoveNext
    Loop
   ' AdoRec.Open "select sum(ywje) as a1 from kjyw  where qdsj>='" & starttime & "' and qdsj<='" & endtime & "' and yslbmc='主营业务收入'", AdoCon
    Set Dareportsjyzb.DataSource = AdoRec
    AA = Date
    Dim bb As String
    Dim i As Integer
    i = 4
    bb = str(4)
    For Each ctl1 In Me.Sections.Item("Section2").Controls
    If TypeName(ctl1) = "RptLabel" Then
    Select Case ctl1.Name
    Case "Label21"
    ctl1.Caption = "起始时间:" & starttime
    Case "Label23"
    ctl1.Caption = "截至时间:" & endtime
    End Select
    End If
    Next
    
    For Each ctl In Me.Sections.Item("Section1").Controls
    If TypeName(ctl) = "RptTextBox" Then
    Select Case ctl.Name
    Case "Text1"
    ctl.DataField = AdoRec.Fields("a1").Name
    Case "Text2"
    ctl.DataField = AdoRec.Fields("b1").Name
    End Select
    End If
    Next
'    Label2.Caption = lirun
    For Each ctl1 In Me.Sections.Item("Section3").Controls
      If TypeName(ctl1) = "RptLabel" Then
         If ctl1.Name = "Label2" Then
          'ctl1.Caption = str(lirun)
          ctl1.Caption = Format(lirui, "#,##0.00")
         End If
      End If
    Next
    
    
    
End Sub

⌨️ 快捷键说明

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