تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] مساعدة محتاج خبراء ReportViewer
#6
شكرا لكم بارك الله فيكم

انا حصلت كود يعمل نفس الفكرة بس الكود لي حصلته خاص بي CrystalReport

   



كود :
        Dim index As Integer = 0
            Dim innerIndex As Integer = 0


            Dim listItemsDetail As New List(Of Codes.ItemsDetails)()
            Dim itemSelected As Codes.Items = Nothing

            Dim dsPrint As New Codes.DSPrint()
            Dim report1Row As Codes.DSPrint.tblReport1Row

            If rb1.Checked Then
                Do While index < gvItems.Rows.Count
                    If Convert.ToBoolean(gvItems.Rows(index).Cells("colSelect").Value) Then
                        itemSelected = CType(gvItems.Rows(index).DataBoundItem, Codes.Items)



                        Using entity = New Codes.PrintLabelEntities()
                            listItemsDetail = entity.ItemsDetails.Where(Function(x) x.ItemId = itemSelected.Id).ToList()
                        End Using

                        For Each item As Codes.ItemsDetails In listItemsDetail
                            report1Row = dsPrint.tblReport1.NewtblReport1Row()
                            report1Row.ItemName = itemSelected.Name
                            report1Row.UTS = item.UTC
                            report1Row.X2 = item.X2
                            report1Row.Band = item.Band
                            report1Row.Rst = item.Rst
                            report1Row.Date = item.CreateDate.ToShortDateString()
                            dsPrint.tblReport1.AddtblReport1Row(report1Row)

                        Next item
                    End If

                    index += 1
                Loop


               Dim crystalReport1 As New PrintLabel.Properties.CrystalReport1

                crystalReport1.SetDataSource(dsPrint)
                crystalReport1.Refresh()

                Dim frm As New FrmReportingShow()
                frm.crvMain.ReportSource = crystalReport1

                frm.crvMain.Refresh()
                frm.ShowDialog()
            ElseIf rb2.Checked Then
                Do While index < gvItems.Rows.Count
                    If Convert.ToBoolean(gvItems.Rows(index).Cells("colSelect").Value) Then
                        itemSelected = CType(gvItems.Rows(index).DataBoundItem, Codes.Items)

                        Using entity = New Codes.PrintLabelEntities()
                            listItemsDetail = entity.ItemsDetails.Where(Function(x) x.ItemId = itemSelected.Id).ToList()
                        End Using


                        innerIndex = 0

                        Do While innerIndex < listItemsDetail.Count
                            report1Row = dsPrint.tblReport1.NewtblReport1Row()
                            report1Row.ItemName = itemSelected.Name
                            report1Row.UTS = listItemsDetail(innerIndex).UTC
                            report1Row.X2 = listItemsDetail(innerIndex).X2
                            report1Row.Band = listItemsDetail(innerIndex).Band
                            report1Row.Rst = listItemsDetail(innerIndex).Rst
                            report1Row.Date = listItemsDetail(innerIndex).CreateDate.ToShortDateString()


                            innerIndex += 1

                            If innerIndex < listItemsDetail.Count Then
                                report1Row.UTS1 = listItemsDetail(innerIndex).UTC
                                report1Row.X21 = listItemsDetail(innerIndex).X2
                                report1Row.Band1 = listItemsDetail(innerIndex).Band
                                report1Row.Rst1 = listItemsDetail(innerIndex).Rst
                                report1Row.Date1 = listItemsDetail(innerIndex).CreateDate.ToShortDateString()
                            End If

                            dsPrint.tblReport1.AddtblReport1Row(report1Row)

                            innerIndex += 1
                        Loop

                    End If

                    index += 1
                Loop


               Dim crystalReport3 As New PrintLabel.Properties.CrystalReport3



                crystalReport3.SetDataSource(dsPrint)
                crystalReport3.Refresh()

                Dim frm As New FrmReportingShow()
                frm.crvMain.ReportSource = crystalReport3

                frm.crvMain.Refresh()
                frm.ShowDialog()
            ElseIf rb3.Checked Then
                Do While index < gvItems.Rows.Count
                    If Convert.ToBoolean(gvItems.Rows(index).Cells("colSelect").Value) Then
                        itemSelected = CType(gvItems.Rows(index).DataBoundItem, Codes.Items)

                        Using entity = New Codes.PrintLabelEntities()
                            listItemsDetail = entity.ItemsDetails.Where(Function(x) x.ItemId = itemSelected.Id).ToList()
                        End Using


                        innerIndex = 0

                        Do While innerIndex < listItemsDetail.Count
                            report1Row = dsPrint.tblReport1.NewtblReport1Row()
                            report1Row.ItemName = itemSelected.Name
                            report1Row.UTS = listItemsDetail(innerIndex).UTC
                            report1Row.X2 = listItemsDetail(innerIndex).X2
                            report1Row.Band = listItemsDetail(innerIndex).Band
                            report1Row.Rst = listItemsDetail(innerIndex).Rst
                            report1Row.Date = listItemsDetail(innerIndex).CreateDate.ToShortDateString()


                            innerIndex += 1

                            If innerIndex < listItemsDetail.Count Then
                                report1Row.UTS1 = listItemsDetail(innerIndex).UTC
                                report1Row.X21 = listItemsDetail(innerIndex).X2
                                report1Row.Band1 = listItemsDetail(innerIndex).Band
                                report1Row.Rst1 = listItemsDetail(innerIndex).Rst
                                report1Row.Date1 = listItemsDetail(innerIndex).CreateDate.ToShortDateString()
                            End If

                            innerIndex += 1

                            If innerIndex < listItemsDetail.Count Then
                                report1Row.URS2 = listItemsDetail(innerIndex).UTC
                                report1Row.X22 = listItemsDetail(innerIndex).X2
                                report1Row.Band2 = listItemsDetail(innerIndex).Band
                                report1Row.Rst2 = listItemsDetail(innerIndex).Rst
                                report1Row.Date2 = listItemsDetail(innerIndex).CreateDate.ToShortDateString()
                            End If

                            dsPrint.tblReport1.AddtblReport1Row(report1Row)

                            innerIndex += 1
                        Loop

                    End If

                    index += 1
                Loop


               Dim crystalReport2 As New PrintLabel.Properties.CrystalReport2


                crystalReport2.SetDataSource(dsPrint)
                crystalReport2.Refresh()

                Dim frm As New FrmReportingShow()
                frm.crvMain.ReportSource = crystalReport2

                frm.crvMain.Refresh()
                frm.ShowDialog()
            End If
اذا في مجال نغيرة او نقوم  بعمل بنفس الفكرة
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
RE: مساعدة محتاج خبراء ReportViewer - بواسطة viv - 06-05-18, 09:35 PM
RE: مساعدة محتاج خبراء ReportViewer - بواسطة dubai.eig - 07-05-18, 10:04 AM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم