以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 报表的关联数据为空,怎么搞成后台获取数据 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=143795) |
-- 作者:yifan3429 -- 发布时间:2019/12/4 16:58:00 -- 报表的关联数据为空,怎么搞成后台获取数据 Dim Result As DialogResult Result = MessageBox.Show("你确定打印凭证吗,是不是?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If Result = DialogResult.Yes Then Dim doc As New PrintDoc \'定义一个报表 Dim rt As New prt.RenderTable() \'定义一个表格对象 Dim rx As New prt.RenderText \'定义一个文本对象 Dim ra As prt.RenderArea Dim CurRow As Row = Tables("凭证往来账户").Current \'设置页边距制杖设定 \'doc.PageSetting.Width = 100 \'纸张宽度为100毫米 \'doc.PageSetting.Height = 120 \'纸张高度为120毫米 doc.PageSetting.PaperKind = 9 \'纸张类型改为B5 \'doc.PageSetting.Landscape = True \'横向打印 Doc.PageSetting.LeftMargin = 20 \'设置左边距 Doc.PageSetting.RightMargin = 10 \'设置右边距 Doc.PageSetting.TopMargin = 10 \'设置上边距 Doc.PageSetting.BottomMargin = 8 \'设置下边距 \'rx.Width = "Parent.Width" \'对象宽度等于页面宽度 \'rx.Height = "Parent.Height" \'对象高度等于页面高度 \'doc.Body.Children.Add(rx) \'将文本对象加入到报表 \'设置水印 Dim rst As prt.RenderText \'定义一个文本对象 rst = New prt.RenderText \'设置文本对象的内容 rst.Text = User.Group & User.Name \'设置文本内容 rst.Width = "Parent.Width" \'宽度等于页面宽度 rst.Height = "Parent.Height" \'高度等于页面高度 rst.Style.TextAngle = 45 \'旋转45度 rst.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中对齐 rst.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中对齐 rst.Style.FontSize = 72 \'字体大小为8磅 rst.Style.TextColor = Color.LightCyan\'文本颜色为灰色 Doc.WaterMark = rst \'作为水印使用 \'设置页脚 Dim rmx As New prt.RenderTable rmx.Style.Borders.Bottom = New prt.LineDef(0.5, Color.DeepSkyBlue) \'设置页眉底边框 \'ryx.Style.Borders.Top = New prt.LineDef(0.5, Color.DeepSkyBlue) \'设置页脚底边 rmx.Cells(0,0).Text = "ID: "& CurRow("对账ID") rmx.Cells(0,2).Text ="操作信息:"& Date.Today & User.Name rmx.Cells(0,1).Text = "TOCASA艺徒国际财务对账凭证" rmx.Cols(0).Style.TextAlignHorz = prt.AlignHorzEnum.Left rmx.Cols(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center rmx.Cols(2).Style.TextAlignHorz = prt.AlignHorzEnum.right rmx.CellStyle.Spacing.Bottom = 0.5 \'底端内容缩进0.5毫米 rmx.Style.FontSize = 10 \'字体大小为8磅 Doc.PageHeader = rmx \'作为页眉使用 \'Doc.PageFooter = ryx \'作为页脚使用 \' \'设置页脚 Dim ryx As New prt.RenderTable \'ryx.Style.Borders.Bottom = New prt.LineDef(0.5, Color.DeepSkyBlue) \'设置页眉底边框 ryx.Style.Borders.Top = New prt.LineDef(0.5, Color.DeepSkyBlue) \'设置页脚底边 ryx.Cells(0,0).Text ="软装|木作|大理石|智能" ryx.Cells(0,1).Text = "中国 开福 TOCASA" ryx.Cells(0,2).Text = "第[PageNo]页,共[PageCount]页" ryx.Cols(0).Style.TextAlignHorz = prt.AlignHorzEnum.Left ryx.Cols(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center ryx.Cols(2).Style.TextAlignHorz = prt.AlignHorzEnum.right ryx.CellStyle.Spacing.Bottom = 0.5 \'底端内容缩进0.5毫米 ryx.Style.FontSize = 10 \'字体大小为8磅 \'Doc.PageHeader = ryx \'作为页眉使用 Doc.PageFooter = ryx \'作为页脚使用 \'\'\'加入标题 \'rx = New prt.RenderText \'rx.Style.FontBold = True \'字体加粗 \'rx.Style.FontSize = 16 \'大体大小为16磅 \'rx.Text = "TOCASA艺徒国际财务对账凭证" \'\'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中排列 \'\'rx.Style.Spacing.Bottom = 1 \'和下面的对象(表格)距离3毫米 \'rx.Style.Spacing.Top= 3 \'和上面的对象(表格)距离3毫米 \'doc.Body.Children.Add(rx) \'\'\'加入副标题 \'rx = New prt.RenderText \'\'rx.Style.FontBold = True \'字体加粗 \'rx.Style.FontSize = 10 \'大体大小为16磅 \'rx.Text = " 凭证ID:"& CurRow("对账ID") \'\'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'水平居中排列 \'rx.Style.Spacing.Bottom = 2 \'和下面的对象(表格)距离3毫米 \'rx.Style.Spacing.Top= 1 \'和上面的对象(表格)距离3毫米 \'rx.Style.Borders.Bottom = New prt.LineDef(0.5, Color.DeepSkyBlue) \'设置页眉底边框 \'doc.Body.Children.Add(rx) rt = New prt.RenderTable() \'定义一个表格对象 rt.CellStyle.Spacing.All = 1 \'单元格内容缩进1毫米 rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'内容垂直居中 rt.Style.FontBold = True \'字体加粗 rt.Cells(0,0).Text= "部门:"& CurRow("核算主体")&"/"& CurRow("收款人") \'rt.Cells(1,2).Text= " 附件张数 :"& CurRow("附件张数") rt.Cells(1,0).Text= "收款人:"& CurRow("收款人") & " " & "开户行:" & CurRow("开户行")& " " & "账号:" & CurRow("收款账号") doc.Body.Children.Add(rt) \'将表格对象加入到报表中 \'\'\' Relations.Add("关联1",DataTables("凭证往来账户").DataCols("收款人"),DataTables("凭证明细").DataCols("收款人")) \'动态创建关联 \' 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.DeepSkyBlue) rt.Style.GridLines.All = New prt.Linedef(Color.DeepSkyBlue) \'设置网格线 rt.Cols(2).Width = 60 \'设置列宽 \'\' 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.rows(0).Style.Borders.Top = New prt.LineDef(1,Color.DeepSkyBlue) rt.rows(0).Style.Borders.Bottom = New prt.LineDef(0.5,Color.DeepSkyBlue) Tables("凭证往来账户.凭证明细").sort = "申请日期" Tables("凭证往来账户.凭证明细").sort = "凭证类别" With Tables("凭证往来账户.凭证明细") 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)("备注") Next End With rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 doc.Body.Children.Add(rt) Relations.Delete("关联1") rt = New prt.RenderTable() \'定义一个表格对象 rt.CellStyle.Spacing.All = 1 \'单元格内容缩进1毫米 rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'内容垂直居中 rt.Style.FontBold = True \'字体加粗 rt.Cells(0,0).Text = "流水金额 ¥: " & Tables("凭证明细").Compute("Sum(金额)") & "元" rt.Cells(1,0).Text= "付款申请¥: "& CurRow("付款金额")& " 大写 :"& CUNumber(CurRow("付款金额") ) rt.Cells(2,0).Text= "借支金额¥:"& CurRow("借支金额") &" 大写 :"& CUNumber(CurRow("借支金额") ) rt.Cells(3,0).Text= "报销金额¥: "& CurRow("报销金额") &" 大写 :"& CUNumber(CurRow("报销金额") ) rt.Cells(4,0).Text= "结余金额¥: "& CurRow("结余金额") & " 大写 :"& CUNumber(CurRow("结余金额") ) \'rt.Cells(5,0).Text= "" \'rt.Cells(5,1).Text= "核对签字:" doc.Body.Children.Add(rt) \'将表格对象加入到报表中 Doc.Preview() \'预览报表 End If
|
-- 作者:有点蓝 -- 发布时间:2019/12/4 17:09:00 -- 不要使用关联,直接使用select获取需要的数据 DataTables("凭证明细").sqlselect("收款人=\'" & CurRow("收款人") & "\'")
|
-- 作者:yifan3429 -- 发布时间:2019/12/4 17:14:00 -- 还是不行 Dim Result As DialogResult Result = MessageBox.Show("你确定打印凭证吗,是不是?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If Result = DialogResult.Yes Then Dim doc As New PrintDoc \'定义一个报表 Dim rt As New prt.RenderTable() \'定义一个表格对象 Dim rx As New prt.RenderText \'定义一个文本对象 Dim ra As prt.RenderArea Dim CurRow As Row = Tables("凭证往来账户").Current \'设置页边距制杖设定 \'doc.PageSetting.Width = 100 \'纸张宽度为100毫米 \'doc.PageSetting.Height = 120 \'纸张高度为120毫米 doc.PageSetting.PaperKind = 9 \'纸张类型改为B5 \'doc.PageSetting.Landscape = True \'横向打印 Doc.PageSetting.LeftMargin = 20 \'设置左边距 Doc.PageSetting.RightMargin = 10 \'设置右边距 Doc.PageSetting.TopMargin = 10 \'设置上边距 Doc.PageSetting.BottomMargin = 8 \'设置下边距 \'rx.Width = "Parent.Width" \'对象宽度等于页面宽度 \'rx.Height = "Parent.Height" \'对象高度等于页面高度 \'doc.Body.Children.Add(rx) \'将文本对象加入到报表 \'设置水印 Dim rst As prt.RenderText \'定义一个文本对象 rst = New prt.RenderText \'设置文本对象的内容 rst.Text = User.Group & User.Name \'设置文本内容 rst.Width = "Parent.Width" \'宽度等于页面宽度 rst.Height = "Parent.Height" \'高度等于页面高度 rst.Style.TextAngle = 45 \'旋转45度 rst.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中对齐 rst.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中对齐 rst.Style.FontSize = 72 \'字体大小为8磅 rst.Style.TextColor = Color.LightCyan\'文本颜色为灰色 Doc.WaterMark = rst \'作为水印使用 \'设置页脚 Dim rmx As New prt.RenderTable rmx.Style.Borders.Bottom = New prt.LineDef(0.5, Color.DeepSkyBlue) \'设置页眉底边框 \'ryx.Style.Borders.Top = New prt.LineDef(0.5, Color.DeepSkyBlue) \'设置页脚底边 rmx.Cells(0,0).Text = "ID: "& CurRow("对账ID") rmx.Cells(0,2).Text ="操作信息:"& Date.Today & User.Name rmx.Cells(0,1).Text = "TOCASA艺徒国际财务对账凭证" rmx.Cols(0).Style.TextAlignHorz = prt.AlignHorzEnum.Left rmx.Cols(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center rmx.Cols(2).Style.TextAlignHorz = prt.AlignHorzEnum.right rmx.CellStyle.Spacing.Bottom = 0.5 \'底端内容缩进0.5毫米 rmx.Style.FontSize = 10 \'字体大小为8磅 Doc.PageHeader = rmx \'作为页眉使用 \'Doc.PageFooter = ryx \'作为页脚使用 \' \'设置页脚 Dim ryx As New prt.RenderTable \'ryx.Style.Borders.Bottom = New prt.LineDef(0.5, Color.DeepSkyBlue) \'设置页眉底边框 ryx.Style.Borders.Top = New prt.LineDef(0.5, Color.DeepSkyBlue) \'设置页脚底边 ryx.Cells(0,0).Text ="软装|木作|大理石|智能" ryx.Cells(0,1).Text = "中国 开福 TOCASA" ryx.Cells(0,2).Text = "第[PageNo]页,共[PageCount]页" ryx.Cols(0).Style.TextAlignHorz = prt.AlignHorzEnum.Left ryx.Cols(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center ryx.Cols(2).Style.TextAlignHorz = prt.AlignHorzEnum.right ryx.CellStyle.Spacing.Bottom = 0.5 \'底端内容缩进0.5毫米 ryx.Style.FontSize = 10 \'字体大小为8磅 \'Doc.PageHeader = ryx \'作为页眉使用 Doc.PageFooter = ryx \'作为页脚使用 \'\'\'加入标题 \'rx = New prt.RenderText \'rx.Style.FontBold = True \'字体加粗 \'rx.Style.FontSize = 16 \'大体大小为16磅 \'rx.Text = "TOCASA艺徒国际财务对账凭证" \'\'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中排列 \'\'rx.Style.Spacing.Bottom = 1 \'和下面的对象(表格)距离3毫米 \'rx.Style.Spacing.Top= 3 \'和上面的对象(表格)距离3毫米 \'doc.Body.Children.Add(rx) \'\'\'加入副标题 \'rx = New prt.RenderText \'\'rx.Style.FontBold = True \'字体加粗 \'rx.Style.FontSize = 10 \'大体大小为16磅 \'rx.Text = " 凭证ID:"& CurRow("对账ID") \'\'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'水平居中排列 \'rx.Style.Spacing.Bottom = 2 \'和下面的对象(表格)距离3毫米 \'rx.Style.Spacing.Top= 1 \'和上面的对象(表格)距离3毫米 \'rx.Style.Borders.Bottom = New prt.LineDef(0.5, Color.DeepSkyBlue) \'设置页眉底边框 \'doc.Body.Children.Add(rx) rt = New prt.RenderTable() \'定义一个表格对象 rt.CellStyle.Spacing.All = 1 \'单元格内容缩进1毫米 rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'内容垂直居中 rt.Style.FontBold = True \'字体加粗 rt.Cells(0,0).Text= "部门:"& CurRow("核算主体")&"/"& CurRow("收款人") \'rt.Cells(1,2).Text= " 附件张数 :"& CurRow("附件张数") rt.Cells(1,0).Text= "收款人:"& CurRow("收款人") & " " & "开户行:" & CurRow("开户行")& " " & "账号:" & CurRow("收款账号") doc.Body.Children.Add(rt) \'将表格对象加入到报表中 \'\'\' \'Relations.Add("关联1",DataTables("凭证往来账户").DataCols("收款人"),DataTables("凭证明细").DataCols("收款人")) \'动态创建关联 DataTables("凭证明细").sqlselect("收款人=\'" & CurRow("收款人") & "\'") \' 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.DeepSkyBlue) rt.Style.GridLines.All = New prt.Linedef(Color.DeepSkyBlue) \'设置网格线 rt.Cols(2).Width = 60 \'设置列宽 \'\' 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.rows(0).Style.Borders.Top = New prt.LineDef(1,Color.DeepSkyBlue) rt.rows(0).Style.Borders.Bottom = New prt.LineDef(0.5,Color.DeepSkyBlue) \'Tables("凭证往来账户.凭证明细").sort = "申请日期" \'Tables("凭证往来账户.凭证明细").sort = "凭证类别" \'With Tables("凭证往来账户.凭证明细") Tables("凭证明细").sort = "申请日期" Tables("凭证明细").sort = "凭证类别" With Tables("凭证明细") 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)("备注") Next End With rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 doc.Body.Children.Add(rt) Relations.Delete("关联1") rt = New prt.RenderTable() \'定义一个表格对象 rt.CellStyle.Spacing.All = 1 \'单元格内容缩进1毫米 rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'内容垂直居中 rt.Style.FontBold = True \'字体加粗 rt.Cells(0,0).Text = "流水金额 ¥: " & Tables("凭证明细").Compute("Sum(金额)") & "元" rt.Cells(1,0).Text= "付款申请¥: "& CurRow("付款金额")& " 大写 :"& CUNumber(CurRow("付款金额") ) rt.Cells(2,0).Text= "借支金额¥:"& CurRow("借支金额") &" 大写 :"& CUNumber(CurRow("借支金额") ) rt.Cells(3,0).Text= "报销金额¥: "& CurRow("报销金额") &" 大写 :"& CUNumber(CurRow("报销金额") ) rt.Cells(4,0).Text= "结余金额¥: "& CurRow("结余金额") & " 大写 :"& CUNumber(CurRow("结余金额") ) \'rt.Cells(5,0).Text= "" \'rt.Cells(5,1).Text= "核对签字:" doc.Body.Children.Add(rt) \'将表格对象加入到报表中 Doc.Preview() \'预览报表 End If
|
-- 作者:有点蓝 -- 发布时间:2019/12/4 17:18:00 -- http://www.foxtable.com/webhelp/topics/2900.htm |
-- 作者:yifan3429 -- 发布时间:2019/12/4 19:26:00 -- DataTables("凭证明细").sqlselect("收款人=\'" & CurRow("收款人") & "\'") 用了SQL呀 还是不明白怎么才可以达成,需要老师明示
[此贴子已经被作者于2019/12/4 19:26:05编辑过]
|
-- 作者:有点蓝 -- 发布时间:2019/12/5 8:43:00 -- 请认真看帮助,怎么获取sqlselect的结果 |