以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]关联表的小计  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=159396)

--  作者:hanlingli111999
--  发布时间:2020/12/25 6:59:00
--  [求助]关联表的小计
老师好,在专业报表中,小计及合计我会用了,可在专业报表中打印关联表,小计
怎么设置代码呀,代码有什么区别?

--  作者:有点蓝
--  发布时间:2020/12/25 8:32:00
--  
差不多的,在输出关联表数据后,在加上小计及合计的代码即可
--  作者:hanlingli111999
--  发布时间:2020/12/25 8:47:00
--  
我是 “承包合同.分包合同”关联表,下面定义的变量“=”号后面如何修改
Dim tbl As Table = Tables("订单")

Dim
pds As List(Of String) = tbl.DataTable.GetValues("产品",tbl.Filter)

--  作者:有点蓝
--  发布时间:2020/12/25 8:54:00
--  
意思是获取关联表里的不同产品?比如

Dim pds As List(Of String) = tbl.DataTable.GetValues("产品","编号=‘“ & tables("承包合同").current("编号") & ”’")



--  作者:hanlingli111999
--  发布时间:2020/12/25 13:31:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:@1ncoo55u}9521s}g{qy8.png
图片点击可在新窗口打开查看

--  作者:hanlingli111999
--  发布时间:2020/12/25 13:32:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:ka}1lki9z5l8xakxzdk8dsj.png
图片点击可在新窗口打开查看

--  作者:hanlingli111999
--  发布时间:2020/12/25 13:33:00
--  
老师,还没搞定,我用的是专业报表中的连续打印关联表,小计不能汇总,截图及代码如下:
比如小计汇总“已付款元”
[此贴子已经被作者于2020/12/25 13:34:44编辑过]

--  作者:有点蓝
--  发布时间:2020/12/25 14:25:00
--  
代码在哪?
--  作者:hanlingli111999
--  发布时间:2020/12/25 14:29:00
--  

Dim doc As New Printdoc

Dim rx As prt.RenderText

Dim rt As prt.RenderTable

Dim Rows As List(Of DataRow)

Dim tbl As Table = Tables("承包合同")

Dim cnt As Integer

Dim tb2 As Table = Tables("分包合同")

For i As Integer = tbl.TopRow To tbl.BottomRow

    rx = New prt.RenderText

    \' rx.BreakBefore = prt.BreakEnum.Page \'另起一页再打印

    rx.Style.FontSize = 14

    rx.Style.FontBold = True

    rx.Style.Spacing.Bottom = 5

    rx.Text = "承包合同: " & Tables("承包合同").Rows(i)("承包合同名称")

    rx.style.TextAlignHorz = prt.AlignHorzEnum.center

 

     doc.Body.Children.Add(rx)

     rt = New prt.RenderTable

  

    rt.Style.Spacing.Bottom = 3

rt.Cols.Count = 2

rt.Style.FontBold = True

rt.Cells(0,0).Text = "合同编号:" & Tables("承包合同").Rows(i)("承包合同编号")

rt.Cells(0,0).Style.TextAlignHorz = prt.AlignHorzEnum.Left

rt.Cells(1,0).Text = "建设单位:" & Tables("承包合同").Rows(i)("建设单位")

rt.Cells(1,0).Style.TextAlignHorz = prt.AlignHorzEnum.Left

 

rt.Cells(0,1).Text = "合同额:" & Tables("承包合同").Rows(i)("承包合同额元")&""

rt.Cells(0,1).Style.TextAlignHorz = prt.AlignHorzEnum.Right

rt.Cells(2,0).Text = "联系人:" & Tables("承包合同").Rows(i)("联系人")

rt.Cells(2,0).Style.TextAlignHorz = prt.AlignHorzEnum.Left

rt.Cells(1,1).Text = "结算值:" & Tables("承包合同").Rows(i)("承包结算值元")&""

rt.Cells(1,1).Style.TextAlignHorz = prt.AlignHorzEnum.Right

rt.Cells(2,1).Text = "已回款:" & Tables("承包合同").Rows(i)("已回款元")&""

rt.Cells(2,1).Style.TextAlignHorz = prt.AlignHorzEnum.Right

rt.Cells(3,1).Text = "回款率:" & Tables("承包合同").Rows(i)("回款率")&"%"

rt.Cells(3,1).Style.TextAlignHorz = prt.AlignHorzEnum.Right

 Doc.Body.Children.Add(rt)

    rt = New prt.RenderTable

 

    rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center

    rt.Style.TextAlignVert = prt.AlignVertEnum.Center

    rt.Style.Borders.Bottom = New prt.LineDef(0.3,Color.LightGray)

    rt.CellStyle.Spacing.All = 1

    rt.Cols.Count = 4

    rt.Cells(0,0).Text = "分包合同编号"

    rt.Cells(0,1).Text = "分包合同名称"

    rt.Cells(0,2).Text = "分包单位"

    rt.Cells(0,3).Text = "分包合同额元"

    rt.Cells(0,4).Text = "分包结算值元"

    rt.Cells(0,5).Text = "已付款元"

    rt.Cells(0,6).Text = "付款率%"

    rt.Cells(0,7).Text = "联系人"

    rt.Cells(0,8).Text = "质保日期"

 

   


--  作者:hanlingli111999
--  发布时间:2020/12/25 14:30:00
--  

 rt.rows(0).Style.Borders.Top = New prt.LineDef(1,Color.LightGray)

    rt.rows(0).Style.Borders.Bottom = New prt.LineDef(1,Color.LightGray)

 

    Rows = Tables("承包合同").Rows(i).DataRow.GetChildRows("分包合同")

    For r As Integer = 0 To Rows.Count - 1

        rt.Cells(r+1,0).Text = rows(r)("分包合同编号")

        rt.Cells(r+1,1).Text = rows(r)("分包合同名称")

        rt.Cells(r+1,2).Text = rows(r)("分包单位")

        rt.Cells(r+1,3).Text = rows(r)("分包合同额元")

        rt.Cells(r+1,4).Text = rows(r)("分包结算值元")

        rt.Cells(r+1,5).Text = rows(r)("已付款元")

        rt.Cells(r+1,6).Text = rows(r)("付款率")

        rt.Cells(r+1,7).Text = rows(r)("联系人")

        rt.Cells(r+1,8).Text = rows(r)("质保日期")

 

           Next

 doc.Body.Children.Add(rt)

    rx = New prt.RenderText

    rx.Style.FontBold = True

    rx.Style.Spacing.Top = 3

    rx.Text = "合同数目: " & Rows.count

    rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right

    doc.Body.Children.Add(rx)

Next

For i As Integer = tb2.TopRow To tb2.BottomRow

 Rows = Tables("承包合同").Rows(i).DataRow.GetChildRows("分包合同")

cnt = rt.Rows.Count

    rt.Cells(cnt, 0).Text = "小计 "  \'打印产品的小计

    rt.Cells(cnt,4).Text =tb2.compute("Sum(count)")

Next

doc.Preview