Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
'首页必须导入这两空间。
Public Sub New(ByVal PLineID As Int32)
MyBase.New()
InitializeComponent()
PrintLineID = PLineID
End Sub
'这是New构造函数,传入一个打印ID
Private Sub RptComOutput_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SQL = "SELECT OutputDetailList.ComNum, OutputDetailList.ComName, OutputDetailList.ShowPrice, "
SQL += "OutputDetailList.OutputCount, OutputDetailList.OutputMoney, "
SQL += "OutputDetailList.ShowMoney, OutputDetailList.Rem, OutputDetailList.SupNum, "
SQL += "OutputDetailList.OutputAgio, ClientInfo.ClientName,ClientInfo.TypeID "
SQL += "FROM OutputDetailList INNER JOIN "
SQL += "ClientInfo ON OutputDetailList.ClientID = ClientInfo.ClientID "
SQL += "WHERE(OutputDetailList.OutputLineID = " + PrintLineID.ToString + ")"
MZ.CreateDataTable(SQL, "OL")
If MZ.Tables("OL").Rows.Count > 0 Then
If MZ.Tables("OL").Rows(0).Item("TypeID") = 3 Then
Dim RptOL As New Rpt_Output_Sup
RptOL.SetDataSource(MZ.Tables("OL"))
CrystalReportViewer1.ReportSource = RptOL
Dim ClientNameText As TextObject
ClientNameText = RptOL.ReportDefinition.ReportObjects.Item("ClientName")
ClientNameText.Text = MZ.Tables("OL").Rows(0).Item("ClientName")
Dim PrintLineIDText As TextObject
PrintLineIDText = RptOL.ReportDefinition.ReportObjects.Item("OutputLineID")
PrintLineIDText.Text = PrintLineID.ToString
Dim PrintPeopleText As TextObject
PrintPeopleText = RptOL.ReportDefinition.ReportObjects.Item("PrintPeople")
PrintPeopleText.Text = UseUserName
Else 'If MZ.Tables("OL").Rows(0).Item("TypeID") = 1 Then
Dim RptOL As New Rpt_ComOutput
RptOL.SetDataSource(MZ.Tables("OL"))
CrystalReportViewer1.ReportSource = RptOL
Dim ClientNameText As TextObject
ClientNameText = RptOL.ReportDefinition.ReportObjects.Item("ClientName")
ClientNameText.Text = MZ.Tables("OL").Rows(0).Item("ClientName")
Dim PrintLineIDText As TextObject
PrintLineIDText = RptOL.ReportDefinition.ReportObjects.Item("OutputLineID")
PrintLineIDText.Text = PrintLineID.ToString
Dim PrintPeopleText As TextObject
PrintPeopleText = RptOL.ReportDefinition.ReportObjects.Item("PrintPeople")
PrintPeopleText.Text = UseUserName
Dim OutputAgioText As TextObject
OutputAgioText = RptOL.ReportDefinition.ReportObjects.Item("OutputAgio")
Dim TmpAgio As Int16 = Convert.ToInt16(MZ.Tables("OL").Rows(0).Item("OutputAgio") * 100)
OutputAgioText.Text = TmpAgio.ToString + "%"
End If
End If
'根据传入的ID查询要打印的内容,根据TypeID调用不同的报表格式。