Foxtable(狐表)用户栏目专家坐堂 → 求助 采用分页加载后按条件筛选问题


  共有3073人关注过本帖树形打印复制链接

主题:求助 采用分页加载后按条件筛选问题

帅哥哟,离线,有人找我吗?
188802386
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:629 积分:4915 威望:0 精华:0 注册:2014/2/25 15:50:00
求助 采用分页加载后按条件筛选问题  发帖心情 Post By:2014/6/10 10:50:00 [只看该作者]

我选择了分页查询 

此主题相关图片如下:qq截图20140610104423.png
按此在新窗口浏览图片
我想实现按条件筛选后台数据 原来没有采用分页加载的时候这些代码就有效 现在却不行了 不知道是哪点出了问题 请高手帮帮忙 谢谢  代码如下

窗口表事件

 

窗口与控件事件

 

佣金一览表_AfterLoad

 

Dim cmb As WinForm.ComboBox = e.form.Controls("ComboBox1")

cmb.ComboList = DataTables("佣金明细").GetComboListString("所属区域")

'==========实现分页加载============

With DataTables("佣金明细")

    .LoadFilter = "" '一定要清除加载条件

    .LoadTop = 20

    .LoadPage = 0

    .Load()

End With

 

佣金一览表_Button1_Click

 

Dim filter As String = "1=1"

With e.Form.Controls("startDate")

    If .Text > "" Then

        filter &= " and 结佣日 >= #" & .text & "#"

    End If

End With

With e.Form.Controls("EndDate")

    If .Text > "" Then

        filter &= " and 结佣日 <= #" & .text & "#"

    End If

End With

Dim g As New CrossTableBuilder("佣金业绩表", DataTables("佣金明细"))

g.HGroups.AddDef("门店")

g.HGroups.AddDef("置业顾问")

g.VGroups.AddDef("类型")

g.Totals.AddDef("佣金", "佣金")

g.Totals.AddDef("套数", "套数")

g.OrderByTotal = True

g.HorizontalTotal = True

g.VerticalTotal = True

g.Decimals = 2

g.Subtotal = True

g.Filter = Filter

g.Build()

MainTable = Tables("佣金业绩表")

Forms("佣金业绩表").show()

MainTable = Tables("LILY")

 

佣金一览表_Button2_Click

 

With DataTables("佣金明细")

    If .LoadPage <> 0 Then

       .LoadTop = 20

       .LoadPage = 0

       .Load()

    End If

End With

 

佣金一览表_Button3_Click

 

With DataTables("佣金明细")

    If .LoadPage < .TotalPages - 1 Then

        .LoadPage = .LoadPage + 1

        .Load()

    End If

End With

 

佣金一览表_Button4_Click

 

With DataTables("佣金明细")

    If .LoadPage > 0 Then

        .LoadPage = .LoadPage - 1

        .Load()

    End If

End With

 

佣金一览表_Button5_Click

 

With DataTables("佣金明细")

    If .LoadPage < .TotalPages - 1 Then

        .LoadPage = .TotalPages - 1

        .Load()

    End If

End With

 

佣金一览表_ComboBox2_Enter

 

Dim cmb As WinForm.ComboBox = e.Sender

Dim str As String = e.Form.Controls("ComboBox1").Value

cmb.ComboList = DataTables("佣金明细").GetComboListString("门店", "所属区域 = '" & str & "'")

 

佣金一览表_ComboBox3_Enter

 

Dim cmb As WinForm.ComboBox = e.Sender

Dim str As String = e.Form.Controls("ComboBox2").Value

cmb.ComboList = DataTables("佣金明细").GetComboListString("置业顾问", "门店 = '" & str & "'")

 

佣金一览表_TextBox1_TextChanged

 

Dim txt As String = e.Form.Controls("TextBox1").Text

Dim dt As DataTable = DataTables("佣金明细")

If txt > "" Then

    txt = "'%" & txt & "%'"

    txt = "合同编号 Like " & txt & " Or 甲方姓名 Like " & txt & " Or 乙方姓名 Like " & txt & " Or 物业地址 Like " & txt & " Or 门店 Like " & txt & " Or 置业顾问 Like " & txt & " Or 店面经理 Like " & txt & " Or 所属区域 Like " & txt 

End If

 

dt.LoadFilter = txt

dt.Load

 

 

佣金一览表_查询_Click

 

Dim Filter As String

With e.Form.Controls("ComboBox1")

    If .Value IsNot Nothing Then

        Filter = "所属区域 = '" & .Value & "'"

    End If

End With

With e.Form.Controls("ComboBox2")

    If .Value IsNot Nothing Then

        If Filter > "" Then

            Filter = Filter & " And "

        End If

        Filter = Filter & "门店 = '" & .Value & "'"

    End If

End With

With e.Form.Controls("ComboBox3")

    If .Value IsNot Nothing Then

        If Filter >"" Then

            Filter = Filter & " And "

        End If

        Filter = Filter & "置业顾问 = '" & .Value & "'"

    End If

End With

With e.Form.Controls("StartDate")

    If .Value IsNot Nothing Then

        If Filter >"" Then

            Filter = Filter & " And "

        End If

        Filter = Filter & "结佣日 >= #" & .Value & "#"

    End If

End With

With e.Form.Controls("EndDate")

    If .Value IsNot Nothing Then

        If Filter >"" Then

            Filter = Filter & " And "

        End If

        Filter = Filter & "结佣日 <= #" & .Value & "#"

    End If

End With

If e.Form.Controls("rdoYifu").Checked = True ' 如果付款状态选择了"已付"

    If Filter >"" Then

        Filter = Filter & " And "

    End If

    Filter = Filter & "状态 Is Not Null"

End If

If e.Form.Controls("rdoWeifu").Checked = True ' 如果付款状态选择了"未付"

    If Filter >"" Then

        Filter = Filter & " And "

    End If

    Filter = Filter & "状态 Is Null"

End If

If Filter > "" Then

    Tables("佣金明细").Filter = Filter

End If

 

佣金一览表_撤销查询_Click

 

Tables("佣金明细").ApplyFilter = False

 

佣金一览表_清除条件_Click

 

e.Form.Controls("ComboBox1").Value = Nothing

e.Form.Controls("ComboBox2").Value = Nothing

e.Form.Controls("ComboBox3").Value = Nothing

e.Form.Controls("StartDate").Value = Nothing

e.Form.Controls("EndDate").Value = Nothing

e.Form.Controls("rdoAll").Checked = True

[此贴子已经被作者于2014-6-10 10:51:23编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
Bin
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2014/6/10 10:51:00 [只看该作者]

设置表的LoadFIlter=Filter  然后LOad

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/6/10 10:52:00 [只看该作者]

 改一改这段,就行了

 

If Filter > "" Then

    Tables("佣金明细").Filter = Filter

End If

 

 改成

 

If Filter > "" Then

    DataTables("佣金明细").LoadFilter = Filter

    DataTables("佣金明细").Load

End If


 回到顶部
帅哥哟,离线,有人找我吗?
188802386
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:629 积分:4915 威望:0 精华:0 注册:2014/2/25 15:50:00
  发帖心情 Post By:2014/6/10 11:13:00 [只看该作者]

提示

图片点击可在新窗口打开查看此主题相关图片如下:qq截图20140610111319.png
图片点击可在新窗口打开查看


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/6/10 11:22:00 [只看该作者]

 回复4楼,#改成单引号'

 

With e.Form.Controls("StartDate")

    If .Value IsNot Nothing Then

        If Filter >"" Then

            Filter = Filter & " And "

        End If

        Filter = Filter & "结佣日 >= '" & .Value & "'"

    End If

End With

With e.Form.Controls("EndDate")

    If .Value IsNot Nothing Then

        If Filter >"" Then

            Filter = Filter & " And "

        End If

        Filter = Filter & "结佣日 <= '" & .Value & "'"

    End If

End With


 回到顶部
帅哥哟,离线,有人找我吗?
188802386
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:629 积分:4915 威望:0 精华:0 注册:2014/2/25 15:50:00
  发帖心情 Post By:2014/6/10 11:44:00 [只看该作者]

佣金一览表_AfterLoad

 

Dim cmb As WinForm.ComboBox = e.form.Controls("ComboBox1")

cmb.ComboList = DataTables("佣金明细").GetComboListString("所属区域")

佣金一览表_ComboBox2_Enter

 

Dim cmb As WinForm.ComboBox = e.Sender

Dim str As String = e.Form.Controls("ComboBox1").Value

cmb.ComboList = DataTables("佣金明细").GetComboListString("门店", "所属区域 = '" & str & "'")

 

佣金一览表_ComboBox3_Enter

 

Dim cmb As WinForm.ComboBox = e.Sender

Dim str As String = e.Form.Controls("ComboBox2").Value

cmb.ComboList = DataTables("佣金明细").GetComboListString("置业顾问", "门店 = '" & str & "'")

这个原来是全部加载了数据可以筛选,但现在实现分页加载后  我想实现区域 门店 置业顾问 能像全部加载后那样的筛选 应该是要涉及到数据源 请问具体改如何操作呢   另外还有就是 重复佣金业绩表 就提示某些列不存在

[此贴子已经被作者于2014-6-10 11:45:11编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/6/10 12:13:00 [只看该作者]

 回复6楼。GetComboListString 改成 SqlGetComboListString 即可。

 回到顶部
帅哥哟,离线,有人找我吗?
188802386
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:629 积分:4915 威望:0 精华:0 注册:2014/2/25 15:50:00
  发帖心情 Post By:2014/6/10 12:33:00 [只看该作者]

谢谢老师 另外 我按条件筛选后加入有两页内容 点击成成佣金业绩表 生成出来的数据就只有佣金一览表显示出来的那页数据  
Dim filter As String = "1=1"
With e.Form.Controls("ComboBox1")
    If .Value IsNot Nothing Then
        Filter = "所属区域 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("ComboBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "门店 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("ComboBox3")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "置业顾问 = '" & .Value & "'"
    End If
End With

With e.Form.Controls("startDate")
    If .Text > "" Then
        filter &= " and 结佣日 >= ‘" & .text & "’"
    End If
End With
With e.Form.Controls("EndDate")
    If .Text > "" Then
        filter &= " and 结佣日 <= ’" & .text & "‘"
    End If
End With
If e.Form.Controls("rdoYifu").Checked = True ' 如果付款状态选择了"已付"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "状态 Is Not Null"
End If
If e.Form.Controls("rdoWeifu").Checked = True ' 如果付款状态选择了"未付"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "状态 Is Null"
End If

Dim g As New CrossTableBuilder("佣金业绩表", DataTables("佣金明细"))
g.HGroups.AddDef("门店")
g.HGroups.AddDef("置业顾问")
g.VGroups.AddDef("类型")
g.Totals.AddDef("佣金", "佣金")
g.Totals.AddDef("套数", "套数")
g.OrderByTotal = True
g.HorizontalTotal = True
g.VerticalTotal = True
g.Decimals = 2
g.Subtotal = True
g.Filter = Filter
g.Build()
MainTable = Tables("佣金业绩表")
Forms("佣金业绩表").show()
MainTable = Tables("LILY")

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/6/10 14:00:00 [只看该作者]

 用SqlCrossTableBuilder,这个是直接统计后台数据的。

 

http://www.foxtable.com/help/topics/1627.htm

 


 回到顶部