求助:打印小piao,执行下列代码先卡死10分钟后,后续再多次使用没问题,等关机再开就又卡死,再等10分钟,循环往复。。。。
DataTables("其他消费").Load
Tables("其他消费").Filter = "编号 = '" & Vars("ktbh") & "'"
If Forms("结账").Controls("RadioButton2").Checked = True Then
Dim doc As New PrintDoc
Dim rt As New prt.RenderText
Dim ra As New prt.RenderArea
ra.Style.Spacing.Bottom = 2
ra.DataBinding.DataSource = BindTables("其他消费") '将容器绑定到订单表
ra.Style.Spacing.Bottom = 2
'设置格式
doc.PageSetting.TopMargin = 1
doc.PageSetting.BottomMargin = 0
doc.PageSetting.LeftMargin = 0
doc.PageSetting.RightMargin = 0
doc.PageSetting.Width = 58 '纸张宽度为57毫米
Dim dd As Integer = DataTables("其他消费").SQLCompute("Count(*)", "编号 = '" & Vars("ktbh") & "'")
doc.PageSetting.Height = 88 + (dd * 10)'纸张高度为61毫米
'加入标题
Dim rx As New prt.RenderText
rx.text = "忘忧阁"
rx.Style.Font = New Font("华文行楷", 16, FontStyle.Bold) '设置字体
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中排列
rx.Style.Spacing.Bottom = 3 '和下面的对象(表格)距离3毫米
doc.Body.Children.Add(rx) '加入到报表中
'加入其他内容
Dim dfd As DataRow = DataTables("结账记录").SQLFind("编号 = '" & Vars("ktbh") & "'")
Dim rx1 As New prt.RenderText
rx1.text = "桌台号 :" & dfd("桌台号") & vblf &
"结账时间:" & vblf &
dfd("结账时间") & vblf &
"开台时间:" & vblf &
dfd("开台时间") & vblf &
"关台时间:" & vblf &
dfd("关台时间") & vblf &
"总时长 :" & dfd("总用时") & vblf &
"消费时长:" & dfd("消费时长") & vblf &
"台 费:" & dfd("台费") & "元" & vblf &
"其他消费:" & dfd("本次消费") - dfd("台费") & "元" & vblf &
"总消费 :" & dfd("本次消费") & "元" & vblf &
"优惠金额:" & dfd("优惠金额") & "元" & vblf &
"实付款 :" & dfd("本次消费") - dfd("优惠金额") & "元" & vblf &
"支付方式:" & dfd("支付方式") & vblf &
" " & vblf &
"其他消费明细:" & vblf &
" " & vblf
doc.Body.Children.Add(rx1) '加入到报表中
rt.Text = "商品名:" & " " & "[Fields!商品名.Value]"
ra.Children.Add(rt)
rt = New prt.RenderText
rt.Text = "数量:[Fields!数量.Value] 单价:[Fields!单价1.Value] 价格:[Fields!价格1.Value]"
'rt.Style.TextAlignHorz = prt.AlignHorzEnum.Right '右侧排列
ra.Children.Add(rt)
doc.body.Children.Add(ra)
'切纸
Dim rx2 As New prt.RenderText
rx2.text = vblf & "."
doc.Body.Children.Add(rx2) '加入到报表中
' Doc.PrinterName = DataTables("IUsers").DataRows(0)("默认打印机")
doc.print()
End If
If Forms("结账").Controls("RadioButton1").Checked = True Then
Dim doc As New PrintDoc
Dim rt As New prt.RenderText
Dim ra As New prt.RenderArea
ra.Style.Spacing.Bottom = 2
ra.DataBinding.DataSource = BindTables("其他消费") '将容器绑定到订单表
ra.Style.Spacing.Bottom = 2
'设置格式
doc.PageSetting.TopMargin = 1
doc.PageSetting.BottomMargin = 0
doc.PageSetting.LeftMargin = 0
doc.PageSetting.RightMargin = 0
doc.PageSetting.Width = 58 '纸张宽度为57毫米
Dim dd As Integer = DataTables("其他消费").SQLCompute("Count(*)", "编号 = '" & Vars("ktbh") & "'")
doc.PageSetting.Height = 88 + (dd * 10)'纸张高度为61毫米
'加入标题
Dim rx As New prt.RenderText
rx.text = "忘忧阁"
rx.Style.Font = New Font("华文行楷", 16, FontStyle.Bold) '设置字体
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中排列
rx.Style.Spacing.Bottom = 3 '和下面的对象(表格)距离3毫米
doc.Body.Children.Add(rx) '加入到报表中
'加入其他内容
Dim dfd As DataRow = DataTables("结账记录").SQLFind("编号 = '" & Vars("ktbh") & "'")
Dim rx1 As New prt.RenderText
rx1.text = "桌台号 :" & dfd("桌台号") & vblf &
"结账时间:" & vblf &
dfd("结账时间") & vblf &
"开台时间:" & vblf &
dfd("开台时间") & vblf &
"关台时间:" & vblf &
dfd("关台时间") & vblf &
"总时长 :" & dfd("总用时") & vblf &
"消费时长:" & dfd("消费时长") & vblf &
"台 费:" & dfd("台费") & "元" & vblf &
"其他消费:" & dfd("本次消费") - dfd("台费") & "元" & vblf &
"总消费 :" & dfd("本次消费") & "元" & vblf &
"优惠金额:" & dfd("优惠金额") & "元" & vblf &
"实付款 :" & dfd("本次消费") - dfd("优惠金额") & "元" & vblf &
"会员余额:" & dfd("消费后余额") & vblf &
" " & vblf &
"其他消费明细:" & vblf &
" " & vblf
doc.Body.Children.Add(rx1) '加入到报表中
rt.Text = "商品名:" & " " & "[Fields!商品名.Value]"
ra.Children.Add(rt)
rt = New prt.RenderText
rt.Text = "数量:[Fields!数量.Value] 单价:[Fields!单价1.Value] 价格:[Fields!价格1.Value]"
'rt.Style.TextAlignHorz = prt.AlignHorzEnum.Right '右侧排列
ra.Children.Add(rt)
doc.body.Children.Add(ra)
'切纸
Dim rx2 As New prt.RenderText
rx2.text = vblf & "."
doc.Body.Children.Add(rx2) '加入到报表中
' Doc.PrinterName = DataTables("IUsers").DataRows(0)("默认打印机")
doc.print()
End If