Dim FormNo_To_TxT As String = ""
If TextBox2.Text.Trim = "" Then
FormNo_To_TxT = "zzzzzzzzzzzzzzzzzzzzzzzzzzzz"
Else
FormNo_To_TxT = TextBox2.Text
End If
Dim NbrNo_To_TxT As String = ""
If TextBox3.Text.Trim = "" Then
NbrNo_To_TxT = "zzzzzzzzzzzzzzzzzzzzzzzzzzzz"
Else
NbrNo_To_TxT = TextBox3.Text
End If
Select Case ComboBox2.SelectedIndex
Case 0
PrintRpt = New CReport_ShipMent_SumQty1
Case 1
PrintRpt = New CReport_ShipMent_SumQty2
Case 2
PrintRpt = New CReport_ShipMent_SumQty3
End Select
Dim Doc As New System.Drawing.Printing.PrintDocument
Doc.PrinterSettings.PrinterName = ComboBox3.Text
Dim rawkind As Integer = 1
Dim Inti As Integer
Dim FindPagerSizes As Boolean = False
For Inti = 0 To Doc.PrinterSettings.PaperSizes.Count - 1
If Doc.PrinterSettings.PaperSizes(Inti).PaperName = "发货单" Then
rawkind = Doc.PrinterSettings.PaperSizes(Inti).RawKind
FindPagerSizes = True
Exit For
End If
Next
If FindPagerSizes = True Then
PrintRpt.PrintOptions.PaperSize = rawkind
Else
' MessageBox.Show("打印机没有找到预定的纸张大小,表格名:发货单=宽 21.59CM X 高 13.97CM " & vbCrLf & "请在Windows控制面板-打印机和传真-文件(F)-服务器属性(T)中添加以上表格名内容。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
If ComboBox1.SelectedIndex = 1 Then
PrintRpt.ReportDefinition.ReportObjects.Item("trHistUnitPrice1").ObjectFormat.EnableSuppress = True
PrintRpt.ReportDefinition.ReportObjects.Item("ShipCostTotal1").ObjectFormat.EnableSuppress = True
PrintRpt.ReportDefinition.ReportObjects.Item("ShipCostTotal的合计1").ObjectFormat.EnableSuppress = True
PrintRpt.ReportDefinition.ReportObjects.Item("CostTotalShipMent1").ObjectFormat.EnableSuppress = True
End If
If ComboBox4.SelectedIndex = 0 Then
Dim CReportShipMent_SumQty As New Frm_Print
With CReportShipMent_SumQty
.MdiParent = MDI_Main
.CrystalReportViewer1.ReportSource = PrintRpt
.CrystalReportViewer1.DisplayGroupTree = True
.Text = "打印 - 发货单"
.Show()
End With
Else
MDI_Main.ToolStripProgressBar1.Value = 4
MDI_Main.ToolStripStatusLabel3.Text = "正在打印中,请稍候..."
PrintRpt.PrintToPrinter(1, True, 1, 9999)
MDI_Main.ToolStripProgressBar1.Value = 5
MDI_Main.ToolStripStatusLabel3.Text = "就绪:"
MDI_Main.ToolStripProgressBar1.Visible = False
MessageBox.Show(" 打印完成。 ", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If