以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  如何把两个字段的合计数值显示在Preview  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=161618)

--  作者:wh420
--  发布时间:2021/3/24 14:17:00
--  如何把两个字段的合计数值显示在Preview
如何把“场地费”+ “球费”两个字段相加的和显示在上方的“活动费合计?
    With wb.AddPreview("","pv" & dr("memid"),"活动费合计:",dr("changdifee"))
        
        .AddItem("活动日期:",dr("huodongdate"))
        .AddItem("场地费:" & dr("changdifee"),"球费:" & dr("qiufee"))
        .AddItem("活动人数:" & dr("numpeople"),"人均费用:" & dr("avecost"))
        .AddItem("预存消费:" & dr("yucunkoufee"),"手续费:" & dr("shouxufee"))

    End With


--  作者:有点蓝
--  发布时间:2021/3/24 14:22:00
--  
With wb.AddPreview("","pv" & dr("memid"),"活动费合计:",dr("changdifee")+dr("qiufee"))
--  作者:wh420
--  发布时间:2021/3/24 14:35:00
--  
收到,谢谢老师。
再问下:
Preview页面有很多条记录,怎么实现上一页、下一页翻译功能?


--  作者:有点蓝
--  发布时间:2021/3/24 14:38:00
--  
用法一样:http://www.foxtable.com/mobilehelp/topics/0128.htm
只是把帮助里的显示表格改为Preview即可
--  作者:wh420
--  发布时间:2021/3/24 14:57:00
--  
明白了。

With wb.AddPreview("","pv" & dr("memid"),"<b style=\'font-weight:normal;font-size:16px;color:red\'>活动费合计:</b>","<b style=\'font-weight:normal;font-size:16px;color:red\'> dr("changdifee")+ dr("qiufee")</b>")



--  作者:有点蓝
--  发布时间:2021/3/24 15:05:00
--  
With wb.AddPreview("","pv" & dr("memid"),"<b style=\'font-weight:normal;font-size:16px;color:red\'>活动费合计:</b>","<b style=\'font-weight:normal;font-size:16px;color:red\'> " & dr("changdifee")+ dr("qiufee") & "</b>")
--  作者:wh420
--  发布时间:2021/3/25 16:06:00
--  
关于Preview上一页下一页功能,老师帮忙看看代码哪有问题?

Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Dim page As Integer = 0 \'默认page为0,显示第一页
Dim pageRows As Integer = 12 \'每页10行
If e.GetValues.ContainsKey("page") Then  \'如果地址中有page参数
    Integer.TryParse(e.GetValues("page"), page) \'提取page参数
End If
Dim StartRow As Integer = page * pageRows + 1 \'此页第一行
Dim EndRow As Integer = (page + 1) * pageRows \'此页最后一行

With wb.AddTable("","Preview")
    .PageNumber = page \'设置页码
    .Primarykey = "memid" \'设置主键
End With

With wb.AddButtonGroup("","btg2", False) \'生成上一页和下一页按钮
    If page > 0 Then
        .Add("btnPrev", "上一页","","Detail.htm?page=" & page - 1)
    End If
    If Endrow < count Then
        .Add("btnNext", "下一页","","Detail.htm?page=" & page + 1)
    End If
End With

For Each dr As DataRow In DataTables("Table_Mem").SqlSelect("","","huodongdate DESC")
    Dim Total As  Decimal = dr("changdifee")+ dr("qiufee")
    With wb.AddPreview("","pv" & dr("memid"),dr("huodongdate") & "活动费用小计:", "¥" & Total)


        .additem("场地费用:","¥" & dr("changdifee"))
        .AddItem("球费:","¥" & dr("qiufee"))
      
        .Addbutton("点赞", "", 1, "")
    End With
    wb.AppendHTML("<br/>")
    
Next
e.WriteString(wb.Build)

--  作者:有点蓝
--  发布时间:2021/3/25 16:17:00
--  
没看到加载分页数据的功能

\'获取该页数据
Dim cmd As New SQLCommand
cmd.Connecti \'记得设置数据源名称
cmd.CommandText = "Select Count(*) From {订单}"
Dim Count As Integer = cmd.ExecuteScalar() \'获取总的行数
Dim Pages As Integer = Math.Ceiling(Count/PageRows) \'计算出总页数
cmd.CommandText = "Select * From (Select  Row_Number() Over(Order by 订单.订单编号 desc ) As RowNum,订单.订单编号,日期,客户,Sum(数量) As 数量,sum(数量*单价) As 金额"
cmd.CommandText = cmd.CommandText & " From 订单 Left JOIN 订单明细 ON 订单明细.订单编号 = 订单.订单编号 Group By {订单}.订单编号,日期,客户) As a "
cmd.CommandText = cmd.CommandText & "  Where RowNum >= " & StartRow & " And RowNum <= " & EndRow
Dim dt As DataTable = cmd.ExecuteReader

--  作者:wh420
--  发布时间:2021/3/25 16:30:00
--  
加上了,但翻不了页也没有错误提示,点下一页按钮仍然是当前页
 下载信息  [文件大小:   下载次数: ]
点击浏览该文件:新建文本文档.txt




--  作者:有点蓝
--  发布时间:2021/3/25 16:37:00
--  
……
Dim StartRow As Integer = page * pageRows + 1 \'此页第一行
Dim EndRow As Integer = (page + 1) * pageRows \'此页最后一行

Dim cmd As New SQLCommand
cmd.Connecti \'记得设置数据源名称
cmd.CommandText = "Select Count(*) From {Table_Mem}"
Dim Count As Integer = cmd.ExecuteScalar() \'获取总的行数
cmd.CommandText = "Select * From (Select Row_Number() Over(Order by huodongdate desc) As [NO.],[memid],huodongdate as 日期,changdifee as 场地费,qiufee as 球费,numpeople as 人数,avecost as 人均,yucunkoufee as 预存扣,shouxufee as 手续费,clubyucun as 场馆预存,offlinefee as 线下,tixianmoney as 提现,demo as 备注 From Table_Mem) As a "
cmd.CommandText = cmd.CommandText & "  Where [NO.]>= " & StartRow & " And [NO.] <= " & EndRow

Dim dt As DataTable = cmd.ExecuteReader

For Each dr As DataRow In dt.DataRows
    Dim Total As  Decimal = dr("changdifee")+ dr("qiufee")
    With wb.AddPreview("","pv" & dr("memid"),dr("huodongdate") & "活动费用小计:", "¥" & Total)
        .additem("场地费用:","¥" & dr("changdifee"))
        .AddItem("备注内容:",dr("demo"))
        .Addbutton("点赞", "", 1, "")
    End With
    wb.AppendHTML("<br/>")
    
Next
……