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

📄 mdlreport.bas

📁 VB数据库设计的代码。需要根据自己的数据库再作调整
💻 BAS
字号:
Attribute VB_Name = "mdlReport"
Option Explicit

'***********************************************************************
'* 过程名:DspDayReport
'* 功  能:日报查询显示
'* 参  数:ListView                 列表控件
'*       :Integer                  店ID
'*       :Date                     日期
'* 版  本:2006.01.06 颜志军 初版
'***********************************************************************
Public Sub DspDayReport(ByRef lvListViewCtl As ListView, _
                        ByVal shopId As Integer, _
                        ByVal saledate As Date)
    '变量定义
    Dim dayReport As clsDayReport
    Dim dayReportItem As clsDayReportItem
    Dim curListItem As ListItem
    
    '取得日报
    Set dayReport = New clsDayReport
    dayReport.LoadSet shopId, saledate
    
    '清除现有显示
    lvListViewCtl.ColumnHeaders.Clear
    lvListViewCtl.ListItems.Clear
        
    '设定表头
    lvListViewCtl.ColumnHeaders.Add , "日期", "日期"
    lvListViewCtl.ColumnHeaders.Add , "店名", "店名"
    lvListViewCtl.ColumnHeaders.Add , "商品", "商品"
    lvListViewCtl.ColumnHeaders.Add , "类别", "类别"
    lvListViewCtl.ColumnHeaders.Add , "销量", "销量"
    
    For Each dayReportItem In dayReport
        Set curListItem = lvListViewCtl.ListItems.Add(, , CStr(dayReportItem.saledate))
        curListItem.SubItems(1) = dayReportItem.shopName
        curListItem.SubItems(2) = dayReportItem.merchandiseName
        curListItem.SubItems(3) = dayReportItem.kindName
        curListItem.SubItems(4) = CStr(dayReportItem.merchandiseCount)
    Next
    g_listViewState = REPORTDAY
End Sub

'***********************************************************************
'* 过程名:PrePrintDayReport
'* 功  能:日报预览显示
'* 参  数:ListView                 列表控件
'*       :Integer                  店ID
'*       :Date                     日期
'* 版  本:2006.01.06 颜志军 初版
'***********************************************************************
Public Sub PrePrintDayReport(ByRef lvListViewCtl As ListView, _
                        ByVal shopId As Integer, _
                        ByVal saledate As Date)
    DayReportCommSub lvListViewCtl, shopId, saledate, False
End Sub

'***********************************************************************
'* 过程名:PrintDayReport
'* 功  能:日报打印
'* 参  数:ListView                 列表控件
'*       :Integer                  店ID
'*       :Date                     日期
'* 版  本:2006.01.06 颜志军 初版
'***********************************************************************
Public Sub PrintDayReport(ByRef lvListViewCtl As ListView, _
                        ByVal shopId As Integer, _
                        ByVal saledate As Date)
    DayReportCommSub lvListViewCtl, shopId, saledate, True
End Sub

'***********************************************************************
'* 过程名:DayReportCommSub
'* 功  能:日报预览显示/打印
'* 参  数:ListView                 列表控件
'*       :Integer                  店ID
'*       :Date                     日期
'*       :Boolean                  打印标志
'* 版  本:2006.01.06 颜志军 初版
'***********************************************************************
Private Sub DayReportCommSub(ByRef lvListViewCtl As ListView, _
                        ByVal shopId As Integer, _
                        ByVal saledate As Date, _
                        ByVal printFlag As Boolean)
    '显示列表
    DspDayReport lvListViewCtl, shopId, saledate
    
    Dim report As arDayReport
    Set report = New arDayReport
    
    '报表数据设定
    
    '日期
    report.g_reportDate = CStr(saledate)
    
    '店名
    Dim shop As clsMembershop
    Set shop = New clsMembershop
    shop.LoadByShopId shopId
    report.g_shopName = shop.shopName
    
    '日报数据
    Dim dayReport As clsDayReport
    Set dayReport = New clsDayReport
    dayReport.LoadSet shopId, saledate
    Set report.g_dayReport = dayReport
    
    If printFlag Then   '打印报表
        report.PrintReport True
    Else '显示报表
        report.Show vbModal
    End If
End Sub

'***********************************************************************
'* 过程名:DspMonReport
'* 功  能:月报查询显示
'* 参  数:ListView                 列表控件
'*       :Integer                  店ID
'*       :Date                     日期
'* 版  本:2006.01.06 颜志军 初版
'***********************************************************************
Public Sub DspMonReport(ByRef lvListViewCtl As ListView, _
                        ByVal shopId As Integer, _
                        ByVal saledate As Date)
    '变量定义
    Dim monReport As clsMonReport
    Dim monReportItem As clsMonReportItem
    Dim curListItem As ListItem
    
    '取得月报
    Set monReport = New clsMonReport
    monReport.LoadSet shopId, saledate
    
    '清除现有显示
    lvListViewCtl.ColumnHeaders.Clear
    lvListViewCtl.ListItems.Clear
        
    '设定表头
    lvListViewCtl.ColumnHeaders.Add , "日期", "日期"
    lvListViewCtl.ColumnHeaders.Add , "店名", "店名"
    lvListViewCtl.ColumnHeaders.Add , "商品", "商品"
    lvListViewCtl.ColumnHeaders.Add , "类别", "类别"
    lvListViewCtl.ColumnHeaders.Add , "销量", "销量"
    
    For Each monReportItem In monReport
        Set curListItem = lvListViewCtl.ListItems.Add(, , _
         CStr(DatePart("yyyy", monReportItem.saledate)) & "-" & _
         CStr(DatePart("m", monReportItem.saledate)))
        curListItem.SubItems(1) = monReportItem.shopName
        curListItem.SubItems(2) = monReportItem.merchandiseName
        curListItem.SubItems(3) = monReportItem.kindName
        curListItem.SubItems(4) = CStr(monReportItem.merchandiseCount)
    Next
    
    g_listViewState = REPORTMON
End Sub

'***********************************************************************
'* 过程名:PrePrintMonReport
'* 功  能:月报预览显示
'* 参  数:ListView                 列表控件
'*       :Integer                  店ID
'*       :Date                     日期
'* 版  本:2006.01.06 颜志军 初版
'***********************************************************************
Public Sub PrePrintMonReport(ByRef lvListViewCtl As ListView, _
                        ByVal shopId As Integer, _
                        ByVal saledate As Date)
    MonReportCommSub lvListViewCtl, shopId, saledate, False
End Sub

'***********************************************************************
'* 过程名:PrintMonReport
'* 功  能:月报打印
'* 参  数:ListView                 列表控件
'*       :Integer                  店ID
'*       :Date                     日期
'* 版  本:2006.01.06 颜志军 初版
'***********************************************************************
Public Sub PrintMonReport(ByRef lvListViewCtl As ListView, _
                        ByVal shopId As Integer, _
                        ByVal saledate As Date)
    MonReportCommSub lvListViewCtl, shopId, saledate, True
End Sub

'***********************************************************************
'* 过程名:MonReportCommSub
'* 功  能:月报预览显示/打印
'* 参  数:ListView                 列表控件
'*       :Integer                  店ID
'*       :Date                     日期
'*       :Boolean                  打印标志
'* 版  本:2006.01.06 颜志军 初版
'***********************************************************************
Private Sub MonReportCommSub(ByRef lvListViewCtl As ListView, _
                        ByVal shopId As Integer, _
                        ByVal saledate As Date, _
                        ByVal printFlag As Boolean)
    '显示列表
    DspMonReport lvListViewCtl, shopId, saledate
    
    Dim report As arMonReport
    Set report = New arMonReport
    
    '报表数据设定
    
    '日期
    report.g_reportDate = CStr(DatePart("yyyy", saledate)) & "-" & _
         CStr(DatePart("m", saledate))
    
    '店名
    Dim shop As clsMembershop
    Set shop = New clsMembershop
    shop.LoadByShopId shopId
    report.g_shopName = shop.shopName
    
    '日报数据
    Dim monReport As clsMonReport
    Set monReport = New clsMonReport
    monReport.LoadSet shopId, saledate
    Set report.g_MonReport = monReport
    
    If printFlag Then   '打印报表
        report.PrintReport True
    Else '显示报表
        report.Show vbModal
    End If
End Sub

⌨️ 快捷键说明

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