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


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

主题:专业报表

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


加好友 发短信
等级:婴狐 帖子:29 积分:302 威望:0 精华:0 注册:2012/12/1 11:43:00
专业报表  发帖心情 Post By:2012/12/1 12:03:00 [只看该作者]

请问老师下面代码如何1、合计金额转换成大写格式

                            2、日期转换成YYYY年MM月DD日

              3、单价,金额列4舍5入保留2位小数

 

 

 

 

Dim doc As New PrintDoc '定义一个报表
Dim ra As New prt.RenderTable
doc.PageSetting.PaperKind = 9 '纸张类型改为A4
Dim x As Integer = 0 '定义水平偏移参数
Dim y As Integer = 0 '定义垂直偏移参数

Doc.PageSetting.LeftMargin = 0 '设置左边距
Doc.PageSetting.RightMargin = 0 '设置右边距
Doc.PageSetting.TopMargin = 0 '设置上边距
Doc.PageSetting.BottomMargin = 0 '设置下边距
doc.PageSetting.Landscape = False '横向打印

Dim rx As prt.RenderText  '定义一个文本对象
Dim CurRow As Row = Tables("出货单").Current

rx = new prt.RenderText
rx.Text =Tables("出货单"). Current("日期") rx.x = 44
rx.y = 24

 

 

doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = " 出货单号:    " & Tables("出货单").Current("出货单号")
rx.x = 25
rx.y = 18
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = "合计 (小写) : ¥" & Tables("出货单").Current("金额")
rx.x = 130
rx.y = 101
doc.body.Children.Add(rx)


rx = new prt.RenderText
rx.Text = "合计金额 (大写) : " & Tables("出货单").Current ("金额")
rx.x = 25
rx.y = 101


doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = "出货人:  "& Tables("出货单").Current("出货人")
rx.x = 25
rx.y = 117

doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = "顾客名称:  "& Tables("出货单").Current("顾客名称")
rx.x = 25
rx.y = 30
doc.body.Children.Add(rx)

 


 

Dim  rt As prt.RenderTable
rt = New prt.RenderTable
rt.Width = 170 '表宽为150毫米
rt.Height = 60 '表高为150毫米
rt.Rows.Count = 9 '设置行数
rt.Cols.Count = 5 '设置列数
rt.x=25
rt.y=38

rt.Cols(0).Width = 60
rt.Cols(1).Width = 17
rt.Cols(2).Width = 24
rt.Cols(3).Width = 25
rt.Cols(4).Width = 25

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 = "金额"


With Tables("fa piao.fa piao清单")
    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)("金额")
      Next
End With
doc.Body.Children.Add(rt)

Doc.Preview() '预览报表


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


加好友 发短信
等级:狐神 帖子:6708 积分:34304 威望:0 精华:11 注册:2012/8/18 23:10:00
  发帖心情 Post By:2012/12/1 12:14:00 [只看该作者]

 1、合计金额转换成大写格式

 2、日期转换成YYYY年MM月DD日

 3、单价,金额列4舍5入保留2位小数


http://www.foxtable.com/help/topics/1345.htm


http://www.foxtable.com/help/topics/0360.htm


http://www.foxtable.com/help/topics/0281.htm


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


加好友 发短信
等级:婴狐 帖子:29 积分:302 威望:0 精华:0 注册:2012/12/1 11:43:00
  发帖心情 Post By:2012/12/4 12:52:00 [只看该作者]

谢谢,但我是初学者,还是不明白.希望老师能把代码插入示范给我看看.我加下去还不行,谢谢了!


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


加好友 发短信
等级:狐神 帖子:6708 积分:34304 威望:0 精华:11 注册:2012/8/18 23:10:00
  发帖心情 Post By:2012/12/4 13:10:00 [只看该作者]

楼主参考一下写就好了。

Dim doc As New PrintDoc '定义一个报表
Dim ra As New prt.RenderTable
doc.PageSetting.PaperKind = 9 '纸张类型改为A4
Dim x As Integer = 0 '定义水平偏移参数
Dim y As Integer = 0 '定义垂直偏移参数

Doc.PageSetting.LeftMargin = 0 '设置左边距
Doc.PageSetting.RightMargin = 0 '设置右边距
Doc.PageSetting.TopMargin = 0 '设置上边距
Doc.PageSetting.BottomMargin = 0 '设置下边距
doc.PageSetting.Landscape = False '横向打印

Dim rx As prt.RenderText  '定义一个文本对象
Dim CurRow As Row = Tables("出货单").Current

rx = new prt.RenderText
rx.Text = Format(CDate(Tables("出货单"). Current("日期")), "yyyy年MM月dd日")

rx.x = 44
rx.y = 24

 

 

doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = " 出货单号:    " & Tables("出货单").Current("出货单号")
rx.x = 25
rx.y = 18
doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = "合计 (小写) : ¥" & Math.Round2(CDbl(Tables("出货单").Current("金额")), 2)
rx.x = 130
rx.y = 101
doc.body.Children.Add(rx)


rx = new prt.RenderText
rx.Text = "合计金额 (大写) : " & CUNumber(Tables("出货单").Current ("金额"))
rx.x = 25
rx.y = 101


doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = "出货人:  "& Tables("出货单").Current("出货人")
rx.x = 25
rx.y = 117

doc.body.Children.Add(rx)

rx = new prt.RenderText
rx.Text = "顾客名称:  "& Tables("出货单").Current("顾客名称")
rx.x = 25
rx.y = 30
doc.body.Children.Add(rx)

 


 

Dim  rt As prt.RenderTable
rt = New prt.RenderTable
rt.Width = 170 '表宽为150毫米
rt.Height = 60 '表高为150毫米
rt.Rows.Count = 9 '设置行数
rt.Cols.Count = 5 '设置列数
rt.x=25
rt.y=38

rt.Cols(0).Width = 60
rt.Cols(1).Width = 17
rt.Cols(2).Width = 24
rt.Cols(3).Width = 25
rt.Cols(4).Width = 25

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 = "金额"


With Tables("fa piao.fa piao清单")
    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)("金额")
      Next
End With
doc.Body.Children.Add(rt)

Doc.Preview() '预览报表


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


加好友 发短信
等级:婴狐 帖子:29 积分:302 威望:0 精华:0 注册:2012/12/1 11:43:00
  发帖心情 Post By:2012/12/4 15:04:00 [只看该作者]

解决了,感谢!

 


 回到顶部