Foxtable(狐表)用户栏目专家坐堂 → 关于专业报表


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

主题:关于专业报表

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


加好友 发短信
等级:超级版主 帖子:110597 积分:562881 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/12/12 10:03:00 [显示全部帖子]


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


加好友 发短信
等级:超级版主 帖子:110597 积分:562881 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/12/13 12:00:00 [显示全部帖子]

看3楼,没有其它办法,你这个代码放哪里都实现不了

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


加好友 发短信
等级:超级版主 帖子:110597 积分:562881 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/12/13 13:51:00 [显示全部帖子]

Dim doc As New PrintDoc
Dim tb As Table = Tables("订单")
Dim prs As Integer = 20 '每页20行
Dim sum1 As Integer = 0 '数量小计
Dim sum2 As Double = 0 '金额小计
Dim tsum1 As Integer = 0 '数量总计
Dim tsum2 As Double = 0 '金额总计
Dim idx1 As Integer= tb.cols("数量").Index
Dim idx2 As Integer= tb.cols("金额").Index
'Dim rx As prt.RenderText
For p As Integer = 0 To math.Ceiling(tb.Rows.Count / prs) - 1
    Dim rx As new prt.RenderText
    rx.Text= "AAAAAAAAAAAAAAAAAAA"
    doc.Body.Children.Add(rX)
    Dim rt As New prt.RenderTable
    rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
    rt.CellStyle.Spacing.All = 0.5
    sum1 = 0
    sum2 = 0
    For c As Integer = 0 To tb.Cols.Count - 1
        rt.Cells(0,c).Text = tb.Cols(c).Name
        
    Next
    For r As Integer = p * prs To math.min(tb.Rows.Count - 1,( p + 1) * prs - 1)
        sum1 =sum1 + tb.rows(r)("数量")
        sum2 =sum2 + tb.rows(r)("金额")
        For c As Integer = 0 To tb.Cols.Count - 1
            rt.Cells(r - p * prs + 1, c).Text = tb.rows(r)(c)
        Next
    Next
    
    tsum1 = tsum1 + sum1
    tsum2 = tsum2 + sum2
    rt.Rows.Count = rt.Rows.Count + 1 '增加本页小计行
    rt.Rows(rt.Rows.count -1)(0).text = "本页小计"
    rt.Rows(rt.Rows.count -1)(idx1).text = sum1
    rt.Rows(rt.Rows.count -1)(idx2).text = sum2
    If p = math.Ceiling(tb.Rows.Count / prs) - 1 '如果是最后一页
        rt.Rows.Count = rt.Rows.Count + 1 '增加总计行
        rt.Rows(rt.Rows.count -1)(0).text = "总计"
        rt.Rows(rt.Rows.count -1)(3).text = tsum1
        rt.Rows(rt.Rows.count -1)(6).text = tsum2
    Else
        rt.BreakAfter = prt.BreakEnum.Page '否则换页
    End If
    rt.Rows.Count = rt.Rows.Count + 1
    Dim ro  = rt.Rows(rt.Rows.count -1)
    ro(0).text = "BBBBBBBBBBBBBBBBBBB"
    ro(0).SpanCols = 8
    ro.Height = 8
    ro.Style.TextAlignVert = prt.AlignVertEnum.Center
    ro.Style.Borders.All = New prt.LineDef("0mm", Color.white)
    ro.Style.Borders.Top = New prt.Linedef(Color.Gray)
    doc.Body.Children.Add(rt)
    
Next
doc.Preview()

 回到顶部