neededcode2497 0 Newbie Poster

i have two listview where data display, the SALES INVOICE and CHARGE invoice
now when i print it when sales is greater than charge invoice cannot be display in crystal report or charge is greater than
sales cannot also display. my crystal report looks like:

SALES INVOICE                                 CHARGE INVOICE
OR NUMBER       AMOUNT                       OR NUMBER      CUSTOMER NAME      AMOUNT   

Private Sub ParaPrint()

    Dim ds As New DataSet1
    Dim dst As New DataTable

    Dim lvii As Integer
    Dim lvii2 As Integer

    lvii = ListView_salesInvoice.Items.Count - 1
    lvii2 = listview2_chargeinvoice.Items.Count - 1
    dst = ds.Tables.Add("Items")
    dst.Columns.Add("namecus", Type.GetType("System.String"))
    dst.Columns.Add("cashforward", Type.GetType("System.String"))

    dst.Columns.Add("Dateprint", Type.GetType("System.String"))

    dst.Columns.Add("saleinvo", Type.GetType("System.String"))
    dst.Columns.Add("chargeinvo", Type.GetType("System.String"))
    dst.Columns.Add("totalamount", Type.GetType("System.String"))

    dst.Columns.Add("invoOR", Type.GetType("System.String"))
    dst.Columns.Add("invoAmount", Type.GetType("System.String"))
    dst.Columns.Add("chargeOR", Type.GetType("System.String"))
    dst.Columns.Add("ChargeName", Type.GetType("System.String"))
    dst.Columns.Add("chargeAmount", Type.GetType("System.String"))
    Dim r As DataRow

    r = dst.NewRow()

    r("namecus") = frmOrderTransaction.lblname.Text
    r("Dateprint") = dets.ToString("MM/dd/yyyy")
    r("cashForward") = lblcashforward.Text
    r("saleinvo") = lblsalesamount.Text
    r("chargeinvo") = lblchargeamount.Text
    r("totalamount") = lbltotalamountcash.Text
    dst.Rows.Add(r)

    Dim lisg As ListViewItemCollection
    lisg = ListView_salesInvoice.Items

    Dim lsg As ListViewItemCollection
    lsg = listview2_chargeinvoice.Items

    Dim kkk = lisg.Count + lsg.Count
    If lisg.Count = lsg.Count And lisg.Count <> 0 And lsg.Count <> 0 Then

        For i = 0 To kkk - 1

            r = dst.NewRow()
            If lisg.Count <= kkk Then
                Try
                    r("invoOR") = lisg.Item(i).SubItems(1).Text
                    r("invoAmount") = FormatNumber(lisg.Item(i).SubItems(2).Text)
                Catch ex As Exception

                End Try

            End If

            If lsg.Count <= kkk Then
                Try
                    r("chargeOR") = lsg.Item(i).SubItems(1).Text
                    r("ChargeName") = lsg.Item(i).SubItems(2).Text
                    r("chargeAmount") = FormatNumber(lsg.Item(i).SubItems(3).Text)
                Catch ex As Exception

                End Try

            End If

            dst.Rows.Add(r)

        Next
    End If

    Dim objrpt As New SalesReporting

    objrpt.SetDataSource(ds.Tables(1))

    frmReport.crv1.ReportSource = objrpt
    frmReport.crv1.Refresh()
    frmReport.WindowState = FormWindowState.Normal
    frmReport.TopMost = True
    frmReport.ShowDialog()

End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.