如何在vs2012 vb.net中显示发票?

时间:2017-08-22 07:52:22

标签: vb.net visual-studio-2012 crystal-reports rdlc

我正在使用VB.net开发Visual Studio 2012。我有销售页面,其中客户详细信息转到sale表,产品详细信息从saleprod转到GridView表。我想根据发票号生成发票(inv是销售表中使用的主键和saleprod表中的外键)。

如何从一个Crystal Report或RDLC报告中的两个表生成数据?我可以轻松地从saleprod表中获取一个产品详细信息,但如果一张发票有很多产品,那么它就不会出现。例如,1号发票有5个产品,然后我想在发票中显示所有5个产品,但这没有发生。我也试过了子报告,但它显示了所有的发票,如1,2,3等。我只想要特定的一张发票。

table_details

报告和子报告代码。

Private Sub invoice_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'billdata.saleprod' table. You can move, or remove it, as needed.
    Me.saleprodTableAdapter.Fill(Me.billdata.saleprod)
    'TODO: This line of code loads data into the 'billdata.sale' table. You can move, or remove it, as needed.
    Me.saleTableAdapter.Fill(Me.billdata.sale)

    AddHandler Me.ReportViewer1.LocalReport.SubreportProcessing, AddressOf subEventHandler

    Me.ReportViewer1.RefreshReport()
End Sub

Public Sub subEventHandler(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
    Dim subrepo As DataTable
    subrepo = Me.billdata.Tables("saleprod")
    Dim strfilter As String
    strfilter = e.Parameters("invp").Values.First()
    Me.saleprodTableAdapter.Fillsaleprod(Me.billdata.saleprod, strfilter)
    e.DataSources.Add(New ReportDataSource("subprod", subrepo))
End Sub

0 个答案:

没有答案