Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
数量 | 单价 |
2 | 0.2 |
10 | 1.5 |
数量 | 单价 | 金额 |
2 | 0.2 | 0.4 |
10 | 1.5 | 15 |
原来是:
报表单元格内容 = dr("列名")
现在是:
报表单元格内容 = dr("数量") * dr("单价")
收到..谢谢老爹.
Dim doc As New PrintDoc
Dim rt As New prt.RenderTable '定义一个新表格
Dim tb as Table = Tables("领药单")
rt.Cols(0).Width = 60
rt.Cols(1).Width = 40
rt.Style.Font = tb.Font
Dim cc as integer = tb.Cols.Count
rt.Cells(0,cc).Text = "金额"
For c As Integer = 0 To tb.Cols.Count -1
rt.Cells(0,c).Text = tb.Cols(c).Name
rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center
If tb.Cols(c).IsNumeric Orelse tb.Cols(c).IsDate Then
rt.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Right
End If
For r As integer = 0 To tb.Rows.Count -1
rt.Cells(r + 1, c).Text = tb(r,c)
rt.Cells(r + 1, cc).Text = tb(r,3)*tb(r,4)
Next
Next
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
rt.CellStyle.Spacing.All = 1
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All
doc.Body.Children.Add(rt)
Dim mm As New prt.RenderTable()
mm.cells(0,0).Text = "打单人 :" & Vars("操作员")
mm.Cells(0,1).Text = "领药人 :"
mm.Cells(0,2).Text = "合计:"
mm.Style.Font = New Font("仿宋", 10)
mm.Style.Spacing.Bottom = 5
doc.Body.Children.Add(mm)
doc.preview()
老爹,放出我的代码....标记绿色的为解决方法.
Dim i as Double = 0
For rr As integer = 0 To tb.Rows.Count -1
i=i+tb(rr,3)*tb(rr,4)
Next
Dim mm As New prt.RenderTable()
mm.cells(0,0).Text = "打单人 :" & Vars("操作员")
mm.Cells(0,1).Text = "领药人 :"
mm.Cells(0,2).Text = "合计 : " & i
mm.Style.Font = New Font("仿宋", 10)
mm.Style.Spacing.Bottom = 5
doc.Body.Children.Add(mm)
Dim i as Double = 0
For rr As integer = 0 To tb.Rows.Count -1
i=i+tb(rr,3)*tb(rr,4)
Next
晕,tb.compute("sum(金额)")不行吗?
晕,tb.compute("sum(金额)")不行吗?
当然不行....因为tb表是没有金额列的...完全在专业报表里生成.
呵呵,我只是提示你这里可以任意组合的,这不你自己已经设计出来了啊。