Foxtable(狐表)用户栏目专家坐堂 → 重新总结。


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

主题:重新总结。

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


加好友 发短信
等级:五尾狐 帖子:1062 积分:9781 威望:0 精华:0 注册:2012/3/13 5:23:00
重新总结。  发帖心情 Post By:2013/11/3 19:46:00 [只看该作者]

这个页面是我最终想要的界面,(只筛选 接收单位为 ems的数据)


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

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.foxdb

 

曾经发贴,经过多次测试也没有解决,所以只能厚着脸皮重新发一下。虽然比较嫩,还希望各位前辈不吝赐教啊


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


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

 弄死了,楼主你学一下吧。自食其力,丰衣足食吖

 
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1 (1).foxdb


'DataTables("公斤数录入1").deletefor("[公斤数] is Null")
'DataTables("发货单号1").deletefor("[客户名] is Null")
Dim doc As New PrintDoc
Dim rt As New prt.RenderTable()
Dim tbl As Table = Tables("公斤数录入1")
Dim tb As Table = Tables("发货单号1")

doc.PageSetting.Width = 400 '纸张宽度为100毫米
doc.PageSetting.Landscape = True '横向打印
Doc.PageSetting.LeftMargin = 5 '设置左边距
Doc.PageSetting.RightMargin = 5 '设置右边距
Doc.PageSetting.TopMargin = 10 '设置上边距
Doc.PageSetting.BottomMargin = 5 '设置下边距
Doc.PrinterName = "HP Officejet 6500 E710n-z"

Dim rx As New prt.RenderTable
rx.Cells(0,0).Text = Date.Today
rx.Cells(0,1).Text = "T R J  list"
rx.Cells(0,2).Text = "第[PageNo]页,共[PageCount]页"
rx.Cols(0).Style.TextAlignHorz = prt.AlignHorzEnum.Left
rx.Cols(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rx.Cols(2).Style.TextAlignHorz = prt.AlignHorzEnum.right
rx.Style.Borders.Bottom = New prt.LineDef '设置底边框
rx.CellStyle.Spacing.Bottom = 0.5 '底端内容缩进0.5毫米
rx.Style.FontSize = 15 '字体大小为8磅
Doc.PageHeader = rx '作为页眉使用

rt.Style.Font = New Font("宋体", 15 , FontStyle.Bold) '设置文本对象的字体
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中

rt.Style.Borders.All = New prt.Linedef(0, Color.Lavender) '设置边框
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
doc.Body.Children.Add(rt)
rt.Style.GridLines.All = New prt.Linedef

rt.cells(1,0).text = "地区"
rt.cells(1,1).text = "客户名"
rt.cells(1,2).text = "C/T"
rt.cells(1,3).text = "Total"
rt.cells(1,4).text = "重量1"
rt.cells(1,5).text = "重量2"
rt.cells(1,6).text = "重量3"
rt.cells(1,7).text = "重量4"
rt.cells(1,8).text = "重量5"
rt.cells(1,9).text = "重量6"
rt.cells(1,10).text = "重量7"
rt.cells(1,11).text = "重量8"
rt.cells(1,12).text = "重量9"
rt.cells(1,13).text = "重量10"
rt.cells(1,14).text = "接收单位"
rt.Cols(14).Width = 30

For i As Integer = tb.TopPosition To tb.BottomPosition
    Dim dr As DataRow  = Tables("发货单号1").Rows(i).DataRow
    Dim crs As List(of DataRow) = tbl.DataTable.Select("发货单号 = '" & dr("发货单") & "' and 接收单位 = 'ems'")
    Dim Total As Integer = tbl.Compute("sum(公斤数)", "发货单号 = '" & dr("发货单") & "' and 接收单位 = 'ems'")
    Dim st As Integer = rt.Rows.count - 1 '起始行位置
    Dim nt As Integer = st '当前行位置
    Dim cp As Integer = 4  '当前列位置
    Dim pdr As DataRow = dr.GetParentRow("用户")
    If pdr IsNot Nothing Then
        For n As Integer = 0 To crs.count - 1
            rt.cells(nt+1,cp).text = cint(crs(n)("公斤数"))
            If crs(n)("包") = True Then
                rt.cells(nt+2,cp).text = "yes"
            End If
            If crs(n)("鞋子") Then
                rt.cells(nt+3,cp).text = "yes"
            End If
            If crs(n)("饰品") Then
                rt.cells(nt+4,cp).text = "yes"
            End If
            
            rt.cells(nt+1,0).text =  pdr("city")
            rt.cells(nt+1,1).text =  pdr("name")
            rt.cells(nt+1,2).text =  crs.count
            rt.cells(nt+1,3).text =  total
            rt.cells(nt+1,14).text =  crs(n)("接收单位")
            rt.Cells(st+2, 3).Text = "包"
            rt.Cells(st+3, 3).Text = "鞋子"
            rt.Cells(st+4, 3).Text = "饰品"
            cp = cp + 1
            If cp = 7 Then
                cp=2
                nt = nt + 2
            End If
            
        Next
        
        
        rt.cells(st+5,0).SpanCols = 2
        rt.cells(st+5,0).text = pdr("phone")
        rt.cells(st+5,2).SpanCols = 2
        rt.cells(st+5,2).text = pdr("phone1")
        rt.cells(st+5,4).SpanCols = 6
        rt.cells(st+5,4).text = pdr("address")
    End If
    
    
Next
doc.Preview() '预览报表



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


加好友 发短信
等级:五尾狐 帖子:1062 积分:9781 威望:0 精华:0 注册:2012/3/13 5:23:00
  发帖心情 Post By:2013/11/4 15:16:00 [只看该作者]

学是学了 不是学不会吗,真是太感谢这位恩人了!!!!!

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


加好友 发短信
等级:五尾狐 帖子:1062 积分:9781 威望:0 精华:0 注册:2012/3/13 5:23:00
发现个问题,还望不吝赐教啊  发帖心情 Post By:2013/11/5 8:01:00 [只看该作者]


此主题相关图片如下:??.png
按此在新窗口浏览图片

 

如图,筛选后,其他不想关的情报也会出现在,被打印的表格内,怎么才能不显示,被显示为多余的信息呢?

还有怎么才能控制小数点的位数呢?

 

 

代码如下

 

'DataTables("公斤数录入1").deletefor("[公斤数] is Null")
'DataTables("发货单号1").deletefor("[客户名] is Null")
Dim doc As New PrintDoc
Dim rt As New prt.RenderTable()
Dim tbl As Table = Tables("公斤数录入1")
Dim tb As Table = Tables("发货单号1")


'doc.PageSetting.Width = 400 '纸张宽度为100毫米
doc.PageSetting.Landscape = True '横向打印
Doc.PageSetting.LeftMargin = 5 '设置左边距
Doc.PageSetting.RightMargin = 5 '设置右边距
Doc.PageSetting.TopMargin = 10 '设置上边距
Doc.PageSetting.BottomMargin = 5 '设置下边距
Doc.PrinterName = "HP Officejet 6500 E710n-z"


Dim rx As New prt.RenderTable
rx.Cells(0,0).Text = Date.Today
rx.Cells(0,1).Text = "T R J  list"
rx.Cells(0,2).Text = "第[PageNo]页,共[PageCount]页"
rx.Cols(0).Style.TextAlignHorz = prt.AlignHorzEnum.Left
rx.Cols(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rx.Cols(2).Style.TextAlignHorz = prt.AlignHorzEnum.right
rx.Style.Borders.Bottom = New prt.LineDef '设置底边框
rx.CellStyle.Spacing.Bottom = 0.5 '底端内容缩进0.5毫米
rx.Style.FontSize = 15 '字体大小为8磅
Doc.PageHeader = rx '作为页眉使用


rt.Style.Font = New Font("宋体", 15 , FontStyle.Bold) '设置文本对象的字体
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中


rt.Style.Borders.All = New prt.Linedef(0, Color.Lavender) '设置边框
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
doc.Body.Children.Add(rt)
rt.Style.GridLines.All = New prt.Linedef


rt.cells(1,0).text = "地区"
rt.cells(1,1).text = "客户名"
rt.cells(1,2).text = "C/T"
rt.cells(1,3).text = "Total"
rt.cells(1,4).text = "重量1"
rt.cells(1,5).text = "重量2"
rt.cells(1,6).text = "重量3"
rt.cells(1,7).text = "重量4"
rt.cells(1,8).text = "重量5"
rt.cells(1,9).text = "重量6"
rt.cells(1,10).text = "重量7"
rt.cells(1,11).text = "重量8"
rt.cells(1,12).text = "重量9"
rt.cells(1,13).text = "重量10"
rt.cells(1,14).text = "接收单位"
rt.Cols(14).Width = 30

For i As Integer = Tables("发货单号1").TopPosition To Tables("发货单号1").BottomPosition
    Dim dr As DataRow  = Tables("发货单号1").Rows(i).DataRow
  ' Dim crs As List(of DataRow) = dr.GetChildRows("公斤数录入1")
'For i As Integer = tb.TopPosition To tb.BottomPosition
  ' Dim dr As DataRow  = Tables("发货单号1").Rows(i).DataRow
   Dim crs As List(of DataRow) = tbl.DataTable.Select("发货单号 = '" & dr("发货单") & "' and 接收单位 = 'ems'")
   Dim Total As Integer = tbl.Compute("sum(公斤数)", "发货单号 = '" & dr("发货单") & "' and 接收单位 = 'ems'")
    Dim st As Integer = rt.Rows.count - 1 '起始行位置
    Dim nt As Integer = st '当前行位置
    Dim cp As Integer = 4  '当前列位置
    'Dim pdr As DataRow = dr.GetParentRow("用户")
    'If pdr IsNot Nothing Then
        For n As Integer = 0 To crs.count - 1
            rt.cells(nt+1,cp).text = cint(crs(n)("公斤数"))
            If crs(n)("包") = True Then
                rt.cells(nt+2,cp).text = "yes"
            End If
            If crs(n)("鞋子") Then
                rt.cells(nt+3,cp).text = "yes"
            End If
            If crs(n)("饰品") Then
                rt.cells(nt+4,cp).text = "yes"
            End If
           
            rt.cells(nt+1,0).text =  dr("地区")
            rt.cells(nt+1,1).text =  dr("发货名")
            rt.cells(nt+1,2).text =  crs.count
            rt.cells(nt+1,3).text =  total
            rt.cells(nt+1,14).text =  crs(n)("接收单位")
            rt.Cells(st+2, 3).Text = "包"
            rt.Cells(st+3, 3).Text = "鞋子"
            rt.Cells(st+4, 3).Text = "饰品"
            cp = cp + 1
            If cp = 7 Then
                cp=2
                nt = nt + 2
            End If
           
        Next
       
       
        rt.cells(st+5,0).SpanCols = 2
        rt.Cells(nt+1,0).SpanRows = 4
        rt.Cells(nt+1,1).SpanRows = 4
        rt.cells(nt+1,14).SpanRows = 4
        rt.cells(st+5,0).text = dr("联系方式1") 'pdr("phone")
        rt.cells(st+5,2).SpanCols = 2
        rt.cells(st+5,2).text =dr("联系方式2") 'pdr("phone1")
        rt.cells(st+5,4).SpanCols = 10
        rt.cells(st+5,4).text = dr("发货地址") 'pdr("address")
   ' End If
   
   
Next
doc.Preview() '预览报表


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


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

 无法重现你的问题,把数据也弄上来,说明如何操作。

 回到顶部