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

📄 xtquery.frm

📁 一套鞋厂的销售管理系统
💻 FRM
📖 第 1 页 / 共 4 页
字号:
      Begin VB.OptionButton OptionSellAssay 
         Caption         =   "销售分析"
         Height          =   255
         Left            =   1560
         TabIndex        =   4
         Top             =   360
         Width           =   1095
      End
      Begin VB.OptionButton OptionSellTotal 
         Caption         =   "销售统计"
         Height          =   255
         Left            =   240
         TabIndex        =   3
         Top             =   360
         Value           =   -1  'True
         Width           =   1095
      End
   End
   Begin VB.ListBox DestList 
      Height          =   1680
      Left            =   120
      TabIndex        =   1
      Top             =   3120
      Width           =   8055
   End
   Begin VB.ListBox SourceList 
      Height          =   1950
      Left            =   120
      Style           =   1  'Checkbox
      TabIndex        =   0
      Top             =   960
      Width           =   2655
   End
   Begin VB.Line Line2 
      BorderColor     =   &H00FF8080&
      BorderWidth     =   2
      X1              =   0
      X2              =   8280
      Y1              =   3000
      Y2              =   3000
   End
   Begin VB.Line Line1 
      BorderColor     =   &H00FF8080&
      BorderWidth     =   2
      X1              =   0
      X2              =   8280
      Y1              =   900
      Y2              =   900
   End
   Begin VB.Label WriteValueLabel 
      AutoSize        =   -1  'True
      Caption         =   "请输入关键字"
      Height          =   180
      Left            =   3240
      TabIndex        =   12
      Top             =   1680
      Visible         =   0   'False
      Width           =   1080
   End
   Begin VB.Label DateEndLabel 
      Caption         =   "至"
      Height          =   255
      Left            =   3600
      TabIndex        =   10
      Top             =   2160
      Visible         =   0   'False
      Width           =   615
   End
   Begin VB.Label DataBeginLabel 
      Caption         =   "日期从"
      Height          =   255
      Left            =   3600
      TabIndex        =   9
      Top             =   1440
      Visible         =   0   'False
      Width           =   615
   End
End
Attribute VB_Name = "XtQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim SourceRst As ADODB.Recordset, DestRst As New ADODB.Recordset
Dim CurrentSource As Integer, DestArray() As String, DestArrayCount As Long

Private Sub cmdQuery_Click()
On Error GoTo sub_err
    Dim s As String, k As String, i As Long, j As Long, l As String, m As String, n As String
    Dim s1 As String
    'PrintSqlBox
    If DestList.ListCount = 0 Then
        MsgBox "请先选择条件"
        Exit Sub
    End If
'    SourceList_ItemCheck 0
    If SourceList.ListIndex = 1 Then
        SourceList.ListIndex = 2
    Else
        SourceList.ListIndex = 1
    End If
    SourceList_Click
    DestRst.Filter = ""
    k = ""
    i = DestRst.RecordCount
    s = ""
    k = ""
    If i > 0 Then
        DestRst.MoveFirst
        For j = 1 To i
            SourceRst.Filter = "Class='" & DestRst![doclass] & "'"
            If k = DestRst![doclass] Then
                s = s & " or " & DoSqlString(SourceRst![Field], SourceRst![DoWhy], DestRst![dovalue], SourceRst![fieldtype])
            Else
                s = s & IIf(j = 1, "", ") and ") & "(" & DoSqlString(SourceRst![Field], SourceRst![DoWhy], DestRst![dovalue], SourceRst![fieldtype])
            End If
            If i = j Then
                s = s & ")"
            End If
            k = DestRst![doclass]
            DestRst.MoveNext
        Next
    End If
    
    s1 = ""
    For j = 1 To DestList.ListCount
        s1 = IIf(s1 = "", "", s1 & " 并且 ") & DestList.List(j - 1)
    Next

    If Me.OptionSellTotal Then
        If Me.TotalTypeAll Then
            k = "SELECT Shop_Stock_Trans.date, Shop_Stock_Trans.ordercode, MIN(DISTINCT order_list.OrderName) as OrderName, -sum(Shop_Stock_Trans.[count]*Shop_Stock_Trans.price) as Price, -sum(Shop_Stock_Trans.[count]*Shop_Stock_Trans.discount) as DisCount," & _
            "-sum(Shop_Stock_Trans.[count]) as [count]," & _
            "-sum(Shop_Stock_Trans.S340) as S340, -sum(Shop_Stock_Trans.S345) as S345, -sum(Shop_Stock_Trans.S350) as S350, -sum(Shop_Stock_Trans.S355) as S355, -sum(Shop_Stock_Trans.S360) as S360, -sum(Shop_Stock_Trans.S365) as S365, -sum(Shop_Stock_Trans.S370) as S370, -sum(Shop_Stock_Trans.S375) as S375, -sum(Shop_Stock_Trans.S380) as S380, -sum(Shop_Stock_Trans.S385) as S385, -sum(Shop_Stock_Trans.S390) as S390, -sum(Shop_Stock_Trans.S395) as S395, -sum(Shop_Stock_Trans.S400) as S400, -sum(Shop_Stock_Trans.S405) as S405, -sum(Shop_Stock_Trans.S410) as S410, -sum(Shop_Stock_Trans.S415) as S415, -sum(Shop_Stock_Trans.S420) as S420, -sum(Shop_Stock_Trans.S425) as S425, -sum(Shop_Stock_Trans.S430) as S430, -sum(Shop_Stock_Trans.S435) as S435, -sum(Shop_Stock_Trans.S440) as S440, -sum(Shop_Stock_Trans.S445) as S445, -sum(Shop_Stock_Trans.S450) as S450, -sum(Shop_Stock_Trans.S455) as S455, -sum(Shop_Stock_Trans.S460) as S460, -sum(Shop_Stock_Trans.S465) as S465, -sum(Shop_Stock_Trans.S470) As S470 " & _
            "FROM (Shop_Stock_Trans LEFT JOIN order_list ON Shop_Stock_Trans.ordercode = order_list.FullCode) LEFT JOIN Shop_Dossier ON Shop_Stock_Trans.address = Shop_Dossier.code" & " where Shop_Stock_Trans.Type='销售'" & IIf(s = "", "", " and " & s) & "Group By Date,OrderCode"
            DisPlayQuery_SQL k, "日期|产品代号|产品|金额|折扣|数量|34|-|35|-|36|-|37|-|38|-|39|-|40|-|41|-|42|-|43|-|44|-|45|-|46|-|47|", "销售统计", s1, 0, "800|0|2800|1000|1000|600|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|", "0|0|0|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|", "日期|字符|字符|货币|货币|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|", "|||00,000,000.00|00,000,000.00|"
        End If
        If Me.TotalTypeArea Then
            k = "SELECT Shop_Stock_Trans.date, Shop_Dossier.areacode as AreaCode, MIN(DISTINCT area1.name) AS areaname,Shop_Stock_Trans.OrderCode, MIN(DISTINCT order_list.OrderName) AS OrderName, -sum(Shop_Stock_Trans.[count]*Shop_Stock_Trans.price) AS price, -sum(Shop_Stock_Trans.[count]*Shop_Stock_Trans.discount) as DisCount,-sum(Shop_Stock_Trans.[count]) as [count]," & _
            "-sum(Shop_Stock_Trans.S340) as S340, -sum(Shop_Stock_Trans.S345) as S345, -sum(Shop_Stock_Trans.S350) as S350, -sum(Shop_Stock_Trans.S355) as S355, -sum(Shop_Stock_Trans.S360) as S360, -sum(Shop_Stock_Trans.S365) as S365, -sum(Shop_Stock_Trans.S370) as S370, -sum(Shop_Stock_Trans.S375) as S375, -sum(Shop_Stock_Trans.S380) as S380, -sum(Shop_Stock_Trans.S385) as S385, -sum(Shop_Stock_Trans.S390) as S390, -sum(Shop_Stock_Trans.S395) as S395, -sum(Shop_Stock_Trans.S400) as S400, -sum(Shop_Stock_Trans.S405) as S405, -sum(Shop_Stock_Trans.S410) as S410, -sum(Shop_Stock_Trans.S415) as S415, -sum(Shop_Stock_Trans.S420) as S420, -sum(Shop_Stock_Trans.S425) as S425, -sum(Shop_Stock_Trans.S430) as S430, -sum(Shop_Stock_Trans.S435) as S435, -sum(Shop_Stock_Trans.S440) as S440, -sum(Shop_Stock_Trans.S445) as S445, -sum(Shop_Stock_Trans.S450) as S450, -sum(Shop_Stock_Trans.S455) as S455, -sum(Shop_Stock_Trans.S460) as S460, -sum(Shop_Stock_Trans.S465) as S465, -sum(Shop_Stock_Trans.S470) As S470" & _
            " FROM ((Shop_Stock_Trans LEFT JOIN order_list ON Shop_Stock_Trans.ordercode = order_list.FullCode) LEFT JOIN Shop_Dossier ON Shop_Stock_Trans.address = Shop_Dossier.code) LEFT JOIN area1 ON Shop_Dossier.AreaCode = area1.code" & " where Shop_Stock_Trans.Type='销售'" & IIf(s = "", "", " and " & s) & " Group By Date,AreaCode,OrderCode"
            DisPlayQuery_SQL k, "日期|办事处代号|办事处|产品代号|产品|金额|折扣|数量|34|-|35|-|36|-|37|-|38|-|39|-|40|-|41|-|42|-|43|-|44|-|45|-|46|-|47|", "销售统计(办事处)", s1, 0, "800|0|1500|0|2800|1000|1000|500|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|", "0|0|0|0|0|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|", "日期|字符|字符|字符|字符|货币|货币|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|", "|||||00,000,000.00|00,000,000.00|"
        End If
        If Me.TotalTypeAddress Then
            k = "SELECT Shop_Stock_Trans.date,Shop_Stock_Trans.address, MIN(DISTINCT Shop_Dossier.name) AS AddressName, Shop_Stock_Trans.ordercode, MIN(DISTINCT order_list.OrderName) as OrderName, -sum(Shop_Stock_Trans.[count]*Shop_Stock_Trans.price) as Price, -sum(Shop_Stock_Trans.[count]*Shop_Stock_Trans.discount) as DisCount,-sum(Shop_Stock_Trans.[count]) as [count]," & _
            "-sum(Shop_Stock_Trans.S340) as S340, -sum(Shop_Stock_Trans.S345) as S345, -sum(Shop_Stock_Trans.S350) as S350, -sum(Shop_Stock_Trans.S355) as S355, -sum(Shop_Stock_Trans.S360) as S360, -sum(Shop_Stock_Trans.S365) as S365, -sum(Shop_Stock_Trans.S370) as S370, -sum(Shop_Stock_Trans.S375) as S375, -sum(Shop_Stock_Trans.S380) as S380, -sum(Shop_Stock_Trans.S385) as S385, -sum(Shop_Stock_Trans.S390) as S390, -sum(Shop_Stock_Trans.S395) as S395, -sum(Shop_Stock_Trans.S400) as S400, -sum(Shop_Stock_Trans.S405) as S405, -sum(Shop_Stock_Trans.S410) as S410, -sum(Shop_Stock_Trans.S415) as S415, -sum(Shop_Stock_Trans.S420) as S420, -sum(Shop_Stock_Trans.S425) as S425, -sum(Shop_Stock_Trans.S430) as S430, -sum(Shop_Stock_Trans.S435) as S435, -sum(Shop_Stock_Trans.S440) as S440, -sum(Shop_Stock_Trans.S445) as S445, -sum(Shop_Stock_Trans.S450) as S450, -sum(Shop_Stock_Trans.S455) as S455, -sum(Shop_Stock_Trans.S460) as S460, -sum(Shop_Stock_Trans.S465) as S465, -sum(Shop_Stock_Trans.S470) As S470 " & _
            "FROM (Shop_Stock_Trans LEFT JOIN order_list ON Shop_Stock_Trans.ordercode = order_list.FullCode) LEFT JOIN Shop_Dossier ON Shop_Stock_Trans.address = Shop_Dossier.code" & " where Shop_Stock_Trans.Type='销售'" & IIf(s = "", "", " and " & s) & " Group By Date,Address,OrderCode"
            DisPlayQuery_SQL k, "日期|卖点代号|卖点|产品代号|产品|金额|折扣|数量|34|-|35|-|36|-|37|-|38|-|39|-|40|-|41|-|42|-|43|-|44|-|45|-|46|-|47|", "销售统计(卖点)", s1, 0, "800|0|1500|0|2800|1000|1000|500|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|400|", "0|0|0|0|0|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|", "日期|字符|字符|字符|字符|货币|货币|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|数字|", "|||||00,000,000.00|00,000,000.00|"
        End If
    End If
    
    
    If Me.OptionSellAssay Then
            k = "select Shop_Stock_Trans.ordercode, MIN(DISTINCT order_list.OrderName) as OrderName, -sum(Shop_Stock_Trans.[count]) as [count] " & "FROM (Shop_Stock_Trans LEFT JOIN order_list ON Shop_Stock_Trans.ordercode = order_list.FullCode) LEFT JOIN Shop_Dossier ON Shop_Stock_Trans.address = Shop_Dossier.code" & " where Shop_Stock_Trans.Type='销售'" & IIf(s = "", "", " and " & s) & " Group By OrderCode order by [count] desc"
            l = "SELECT -sum(sellQuery.Total) AS Total, -sum(sellQuery.Value) AS Value, -sum(sellQuery.Season11) AS Season11, -sum(sellQuery.Season12) AS Season12, -sum(sellQuery.Season13) AS Season13, -sum(sellQuery.Season14) AS Season14, -sum(sellQuery.Season15) AS Season15, -sum(sellQuery.Season01) AS Season01, -sum(sellQuery.Season02) AS Season02, -sum(sellQuery.Season03) AS Season03, -sum(sellQuery.Season04) AS Season04, -sum(sellQuery.Season05) AS Season05, -sum(sellQuery.Price1) AS Price1, -sum(sellQuery.Price2) AS Price2, -sum(sellQuery.Price3) AS Price3, -sum(sellQuery.Price4) AS Price4, -sum(sellQuery.Price5) AS Price5, -sum(sellQuery.Price6) AS Price6, -sum(sellQuery.Price7) AS Price7, -sum(sellQuery.Price8) AS Price8, -sum(sellQuery.Brand0) AS Brand0, -sum(sellQuery.Brand1) AS Brand1, -sum(sellQuery.Brand2) AS Brand2, -sum(sellQuery.Brand3) AS Brand3, -sum(sellQuery.Brand4) AS Brand4," & _
                "-sum(sellQuery.Brand5) AS Brand5, -sum(sellQuery.Brand6) AS Brand6, -sum(sellQuery.Brand7) AS Brand7, -sum(sellQuery.Brand8) AS Brand8, -sum(sellQuery.Brand9) AS Brand9, -sum(sellQuery.BrandA) AS BrandA, -sum(sellQuery.BrandB) AS BrandB " & _
                "From sellQuery LEFT JOIN Shop_Dossier " & _
                "ON sellQuery.address = Shop_Dossier.code" & _
                IIf(s = "", "", " Where " & s)
            If Me.AssayTypeArea Then
                m = "SELECT Shop_Dossier.areacode as AreaCode, MIN(DISTINCT area1.name) AS addressname,-sum(Shop_Stock_Trans.[count]) as [count] " & _
                "FROM (Shop_Stock_Trans LEFT JOIN Shop_Dossier ON Shop_Stock_Trans.address = Shop_Dossier.code) LEFT JOIN area1 ON Shop_Dossier.AreaCode = area1.code" & _
                " where Shop_Stock_Trans.Type='销售'" & IIf(s = "", "", " and " & s) & " Group By AreaCode"
            Else
                m = "SELECT Shop_Stock_Trans.address as Address, MIN(DISTINCT Shop_Dossier.name) AS AddressName,-sum(Shop_Stock_Trans.[count]) as [count] " & _
                "FROM Shop_Stock_Trans LEFT JOIN Shop_Dossier ON Shop_Stock_Trans.address = Shop_Dossier.code" & " where Shop_Stock_Trans.Type='销售'" & IIf(s = "", "", " and " & s) & " Group By Address"
            End If
            n = "SELECT Shop_Stock_Trans.date as date,-sum(Shop_Stock_Trans.[count]) as [count] " & _
            "FROM Shop_Stock_Trans LEFT JOIN Shop_Dossier ON Shop_Stock_Trans.address = Shop_Dossier.code" & " where Shop_Stock_Trans.Type='销售'" & IIf(s = "", "", " and " & s) & " Group By date Order By date"
            
            FindSell k, l, IIf(Me.AssayTypeArea, "办事处查询", "卖点查询"), m, n, s1
            
    End If
'            ",min(distinct Shop_Dossier.[Direction]) as Direction " & _

    If Me.OptionSellLine Then
        If Me.OptionLineBSC Then
'            k = "SELECT sellQuery.AreaCode,MIN(DISTINCT area1.name) AS AreaName" & _
'            ",-sum(SeaSon01) as [count1]" & _
'            ",-sum(SeaSon02) as [Ccount2]" & _
'            ",-sum(SeaSon03) as [Ccount3]" & _
'            ",-sum(SeaSon04) as [Ccount4]" & _
'            ",-sum(SeaSon05) as [Ccount5]" & _
'            ",-sum(SeaSon11+SeaSon12+SeaSon13+SeaSon14+SeaSon15) as [Ccount6]" & _
'            ", -Sum(sellQuery.Value) AS Value" & _
'            ", Sum(sellQuery.Total) AS Total" & _
'            " FROM (sellQuery  LEFT JOIN Shop_Dossier ON sellQuery.Address = Shop_Dossier.code ) LEFT JOIN area1 ON Shop_Dossier.Areacode = area1.code " & _
'            IIf(s = "", "", " Where " & s) & _
'            " GROUP BY sellQuery.AreaCode Order By Value Desc"

            k = "SELECT MIN(DISTINCT sellQuery.AreaCode) as AreaCode,area1.name AS AreaName" & _
            ",-sum(SeaSon01) as [count1]" & _
            ",-sum(SeaSon02) as [Ccount2]" & _
            ",-sum(SeaSon03) as [Ccount3]" & _
            ",-sum(SeaSon04) as [Ccount4]" & _
            ",-sum(SeaSon05) as [Ccount5]" & _
            ",-sum(SeaSon11+SeaSon12+SeaSon13+SeaSon14+SeaSon15) as [Ccount6]" & _
            ", -Sum(sellQuery.Value) AS Value" & _
            ", Sum(sellQuery.Total) AS Total" & _
            " FROM (sellQuery  LEFT JOIN Shop_Dossier ON sellQuery.Address = Shop_Dossier.code ) LEFT JOIN area1 ON Shop_Dossier.Areacode = area1.code " & _
            IIf(s = "", "", " Where " & s) & _
            " GROUP BY area1.name Order By Value Desc"
'            DisPlayQuery_SQL k, "代号|名称|春鞋|凉鞋|秋鞋|马靴|休闲鞋|男鞋|数量|金额|", "销售排行(办事处)", s1, 0, , "0|0|1|1|", , "||||||||000000.00|"
            DisPlayQuery_SQL k, "代号|名称|春鞋|凉鞋|秋鞋|马靴|休闲鞋|男鞋|数量|金额|", "销售排行(办事处)", s1, 0, , "0|0|1|1|1|1|1|1|1|1|", , "|||||||||00,000,000.00|"
        End If
        If Me.OptionLineMD Then
            k = "SELECT sellQuery.Address,MIN(DISTINCT Shop_Dossier.name) AS AddressName,MIN(DISTINCT Shop_Dossier.managenature) AS managenature, MIN(DISTINCT Shop_Dossier.brand) AS brand,Shop_Dossier.area" & _
            ",-sum(SeaSon01) as [count1]" & _
            ",-sum(SeaSon02) as [Ccount2]" & _
            ",-sum(SeaSon03) as [Ccount3]" & _
            ",-sum(SeaSon04) as [Ccount4]" & _
            ",-sum(SeaSon05) as [Ccount5]" & _
            ",-sum(SeaSon11+SeaSon12+SeaSon13+SeaSon14+SeaSon15) as [Ccount6]" & _
            ", -Sum(sellQuery.Value) AS Value" & _
            ", Sum(sellQuery.Total) AS Total" & _
            ",sum(case Shop_Dossier.area when 0 then null else sellQuery.Total/Shop_Dossier.area end) as BL" & _
            " FROM sellQuery LEFT JOIN Shop_Dossier ON sellQuery.Address = Shop_Dossier.code " & _
            IIf(s = "", "", " Where " & s) & _
            " GROUP BY sellQuery.Address,Shop_Dossier.area Order By Value Desc"
'            DisPlayQuery_SQL k, "代号|名称|经营性质|品牌|面积|春鞋|凉鞋|秋鞋|马靴|休闲鞋|男鞋|数量|金额|绩效评估|", "销售排行(卖点)", s1, 0, , "0|0|0|0|1|1|1|", , "|||||||||||000000.00|000000.0000|"
            DisPlayQuery_SQL k, "代号|名称|经营性质|品牌|面积|春鞋|凉鞋|秋鞋|马靴|休闲鞋|男鞋|数量|金额|绩效评估|", "销售排行(卖点)", s1, 0, , "0|0|0|0|0|1|1|1|1|1|1|1|1|1|", , "||||||||||||00,000,000.00|00,000,000.00|"
        End If
        If Me.OptionLineDQ Then
            k = " SELECT left(sellQuery.Address,2) as Place, MIN(DISTINCT AREA.name) AS PlaceName" & _
            ",-sum(SeaSon01) as [count1]" & _
            ",-sum(SeaSon02) as [Ccount2]" & _
            ",-sum(SeaSon03) as [Ccount3]" & _
            ",-sum(SeaSon04) as [Ccount4]" & _
            ",-sum(SeaSon05) as [Ccount5]" & _
            ",-sum(SeaSon11+SeaSon12+SeaSon13+SeaSon14+SeaSon15) as [Ccount6]" & _
            ", -Sum(sellQuery.Value) AS Value" & _
            ", Sum(sellQuery.Total) AS Total" & _
            " FROM (sellQuery LEFT JOIN Shop_Dossier ON sellQuery.Address = Shop_Dossier.code) LEFT JOIN AREA ON left(Shop_Dossier.Code,2) = AREA.code " & _
            IIf(s = "", "", " Where " & s) & _
            " GROUP BY left(sellQuery.Address,2) order by value desc"
'            DisPlayQuery_SQL k, "代号|名称|春鞋|凉鞋|秋鞋|马靴|休闲鞋|男鞋|数量|金额|", "销售排行(地区)", s1, 0, , "0|0|1|1|", , "||||||||000000.00|"
            DisPlayQuery_SQL k, "代号|名称|春鞋|凉鞋|秋鞋|马靴|休闲鞋|男鞋|数量|金额|", "销售排行(地区)", s1, 0, , "0|0|1|1|1|1|1|1|1|1|", , "|||||||||00,000,000.00|"
        End If
        If Me.OptionLineSF Then
            k = " SELECT SubString(sellQuery.Address,3,2) as Place, MIN(DISTINCT AREA.name) AS PlaceName" & _
            ",-sum(SeaSon01) as [count1]" & _
            ",-sum(SeaSon02) as [Ccount2]" & _
            ",-sum(SeaSon03) as [Ccount3]" & _
            ",-sum(SeaSon04) as [Ccount4]" & _
            ",-sum(SeaSon05) as [Ccount5]" & _
            ",-sum(SeaSon11+SeaSon12+SeaSon13+SeaSon14+SeaSon15) as [Ccount6]" & _
            ", -Sum(sellQuery.Value) AS Value" & _
            ", Sum(sellQuery.Total) AS Total" & _
            " FROM (sellQuery LEFT JOIN Shop_Dossier ON sellQuery.Address = Shop_Dossier.code) LEFT JOIN AREA ON SubString(sellQuery.Address,3,2) = AREA.code " & _
            IIf(s = "", "", " Where " & s) & _
            " GROUP BY SubString(sellQuery.Address,3,2) order by value desc"

            DisPlayQuery_SQL k, "代号|名称|春鞋|凉鞋|秋鞋|马靴|休闲鞋|男鞋|数量|金额|", "销售排行(地区)", s1, 0, , "0|1|1|1|1|1|1|1|1|1|", , "|||||||||00,000,000.00|"
        End If
    End If

    If Me.OptionSellLineCP Then
        If Me.OptionLineCP Then
            k = "SELECT Shop_Stock_Trans.OrderCode, MIN(DISTINCT OrderName) AS OrderName, -Sum(Shop_Stock_Trans.[Count]) AS [Count], -Sum(Shop_Stock_Trans.[count]*Shop_Stock_Trans.Price) AS Total" & _
                " FROM (Shop_Stock_Trans LEFT JOIN order_list ON Shop_Stock_Trans.OrderCode = order_list.FullCode) LEFT JOIN Shop_Dossier ON Shop_Stock_Trans.Address = Shop_Dossier.code" & _
                " where Shop_Stock_Trans.Type='销售'" & IIf(s = "", "", " and " & s) & _
                " GROUP BY Shop_Stock_Trans.OrderCode" & _
                " ORDER BY [Count] DESC"
            DisPlayQuery_SQL k, "产品|名称|数量|金额|", "销售排行(产品)", s1, 0, , "0|0|1|1|", , "|||00,000,000.00|"
        End If
        If Me.OptionLineXT Then

⌨️ 快捷键说明

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