Dim count As Integer = 1
If InputValue(count, "提示", "打印多少次?") Then
If count < = 100 Then
Dim doc As New PrintDoc
doc.PageSetting.Width = 69 '
doc.PageSetting.Height = 42
Doc.PageSetting.LeftMargin = 3
Doc.PageSetting.TopMargin = 3
Doc.PageSetting.RightMargin = 0
Dim t As Table = e.form.controls("Table1").Table
For j As Integer = 1 To count
For i As Integer = t.TopPosition To t.BottomPosition
Dim r As Row = t.Rows(i)
r("printtimes") = count
r("printtime") = now ()
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim rt1 As New prt.RenderText
rt1.Style.FontBold = True
rt.Style.FontSize = 10
rt.Rows(0).Height = 6
rt.Rows(1).Height = 6
rt.Rows(2).Height = 6
rt.Rows(3).Height = 6
'rt.Rows(4).Height = 3
rt.Style.Spacing.bottom = 3
rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
rt.Cols(0).Width = 25
rt.Cols(1).Width = 45
rt.cells(0,0).Text = "Customer:"
rt.Cells(0,1).Text = r("EndCustomer")
rt.Cells(1,0).Text= "Part No.:"
rt.Cells(1,0).Style.WordWrap = False
rt.cells(1,1).Text = r("PartNo")
rt.Cells(2,0).Text= "GSS Part No.:"
rt.cells(2,1).Text = r("GSSPart")
rt.Cells(3,0).Text= "Qty:"
rt.cells(3,1).Text = r("OpenQty")& " PCS"
rt.cells(4,0).SpanCols =2
doc.Body.Children.Add(rt) '将表格对象加入到报表中
Dim rg As prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
bar.Code = r("PartNo")
Bar.Text = Date.Today
rg = new prt.RenderGraphics
rt.Style.ImageAlign.AlignVert = prt.ImageAlignVertEnum.Center
rg.Height = 12
bar.DrawOnCanvas(rg.Graphics,0,0,1)
rt.cells(4,0).RenderObject = rg
Next
Next
doc.Preview()
Dim t1 As Table = Tables("Orderlist")
Dim nmb() As String = {"GSSAG_PO","Endcustomer","CustomerPO","GSSPart","PartNo","OpenQty","ETD","Printtimes","PrintTime"}
Dim nma() As String = {"GSSAG_PO","Endcustomer","CustomerPO","GSSPart","PartNo","OPENQty","ETD","Printtimes","PrintTime"}
For r As Integer = t1.TopPosition To t1.BottomPosition
Dim dr As Row = Tables("PrintHistory").AddNew
For i As Integer = 0 To nma.Length - 1
dr(nma(i)) = t1.rows(r)(nmb(i))
Next
Next
Else
msgbox("一次打印不可以大于100张")
End If
End If
DataTables("PrintHistory").Save()