以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 时间转换为字符串问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=137628) |
-- 作者:edisontsui -- 发布时间:2019/7/11 10:40:00 -- 时间转换为字符串问题 If e.DataCol.Name = "出库数量" and e.DataRow("客户") = "科顺" Then Dim d1 As String = Format(date.today,"yyyyMMdd") \'取得日期的8位数 Dim d2 As String = d1.substring(4,4) Dim t1 As TimeSpan = CDate(CurrentTable.Current("出入库日期")) dim t2 as integer = t1.hours dim t3 as integer = t1.minutes dim t4 as integer = t1.seconds dim t5 as integer = t1.milliseconds dim h1 as string if t2.length = 1 H1 = "0" & t2 else H1 = t2 end if dim m1 as string if m1.length = 1 m1 = "0" & t3 else m1 = t3 end if dim s1 as string if t4.length = 1 s1 = "0" & t4 else s1 = t4 end if dim ms1 as string if t5.length = 1 ms1 = "00" & t5 elseif ms1.length = 2 ms1 = "0" & t5 else ms1 = t5 end if e.DataRow("条形码") = d2 & h1 & m1 & s1 & ms1 end if 我希望将"出入库日期"这栏的日、时、分、秒、毫秒(比如2019-07-09 12:30:25:221)转换为字符串 0709123025221 作为条形码使用,但是上述代码出现警告:date 值无法转换为 system.timespan 请教如何处理。谢谢。
|
-- 作者:有点蓝 -- 发布时间:2019/7/11 11:06:00 -- If e.DataCol.Name = "出入库日期" andalso e.DataRow.isnull("出入库日期") = false e.DataRow("条形码") = Format(e.DataRow("出入库日期"),"MMddHHmmssfff") end if
|
-- 作者:edisontsui -- 发布时间:2019/7/11 17:12:00 -- 谢谢。 |
-- 作者:edisontsui -- 发布时间:2019/7/12 13:59:00 -- Dim doc As New PrintDoc \'定义一个报表 doc.PageSetting.Width = 100 doc.PageSetting.Height = 76 Doc.PageSetting.LeftMargin = 5 Doc.PageSetting.RightMargin = 1 Doc.PageSetting.TopMargin = 5 Doc.PageSetting.BottomMargin = 2 doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight \'设置排列方式 Dim n As Integer = CurrentTable.Rows.Count - 1 For i As Integer = 1 To n Dim rt As New prt.RenderTable() \'定义一个表格对象 Dim ra As New prt.RenderArea Dim rt2 As New prt.RenderTable() \'定义一个表格对象 Dim ra2 As New prt.RenderArea Dim r As Row = CurrentTable.Rows(i) Dim s1 As Integer = Val(r("每箱数量")) Dim s2 As Integer = Val(r("整数箱数")) Dim s3 As Integer = Val(r("尾数数量")) \'指定行数?列数?列宽?行高 rt.Rows.Count = 7 \'设置总行数 rt.Cols.Count = 2 \'设置总列数 rt.Height = 71 \'设置表格的总高度毫米 rt.Width = 96 \'表格宽度为50mm\' \'设置行高 rt.Rows(0).Height = 6 rt.Rows(1).Height = 8 rt.Rows(2).Height = 15 rt.Rows(3).Height = 10 rt.Rows(4).Height = 8 \' rt.Rows(5).Height = 14 rt.Rows(6).Height = 9 rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'内容垂直居中 \'设置列宽 rt.Cols(0).Width = 15 rt.Cols(1).Width = 79 rt.Style.TextAlignHorz = prt.AlignHorzEnum.Left \'水平居左排列 \'设置合并单元格 rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'避免垂直换页的时候,表格被分割成两部分. \'设置各单元格内容 rt.cells(0,0).Text = "NAME:" rt.cells(0,0).Style.Font = new font("Arial", 12) rt.Cells(0,1).Text = "广州市柏森塑料制品有限公司 - 062006" rt.cells(0,1).Style.Font = new font("Arial", 12) rt.Cells(2,0).Text= "ITEM:" rt.cells(2,0).Style.Font = new font("Arial", 12) rt.cells(3,0).Text = "DESC:" rt.cells(3,0).Style.Font = new font("Arial", 12) rt.cells(4,0).Text = "QTY:" rt.cells(4,0).Style.Font = new font("Arial", 12) rt.cells(6,0).Text = "DATE:" rt.cells(6,0).Style.Font = new font("Arial", 12) rt.Cells(2,1).Text = r("物料编号") rt.cells(2,1).Style.Font = new font("Arial", 35) rt.Cells(3,1).Text = r("物料名称") rt.cells(3,1).Style.Font = new font("Arial", 12) rt.cells(4,1).Text = r("出库数量") * (-1) rt.cells(4,1).Style.Font = new font("Arial", 12) rt.cells(6,1).Text = r("出入库日期") rt.cells(6,1).Style.Font = new font("Arial", 12) Doc.Body.Children.Add(rt) \'将表格对象加入到报表中 \'-------------条形码-供应商代号 ra = rt.cells(1,1).area Dim rg As New prt.RenderGraphics Dim Bar1 As New BarCodeBuilder Bar1.Symbology = Barpro.Symbology.Code128 bar1.Code = "062006" rg = new prt.RenderGraphics Bar1.BarHeight = 8 bar1.DrawOnCanvas(rg.Graphics,0,0,1.2) ra.Children.Add(rg) \'-------------条形码-物料编号 ra2 = rt2.cells(5,1).area Dim rg2 As New prt.RenderGraphics Dim Bar2 As New BarCodeBuilder Bar2.Symbology = Barpro.Symbology.Code128 bar2.Code = r("条形码") rg2 = new prt.RenderGraphics Bar2.BarHeight = 8 bar2.DrawOnCanvas(rg2.Graphics,0,0,1) ra2.Children.Add(rg2) Next Doc.Preview() \'预览报表 我的上述代码,第一个条形码(供应商代号)可以出来,为什么见不到第二个条形码(物料代号)出来呢?谢谢。
|
-- 作者:有点蓝 -- 发布时间:2019/7/12 14:05:00 -- ra2 = rt2.cells(5,1).area 定义了一个rt2表格,却没有任何地方用到
|